From 186d63070a54fb9b4950b8f50738a5e371efe5b9 Mon Sep 17 00:00:00 2001 From: Anthony Ferrara Date: Thu, 16 Oct 2008 18:17:16 +0000 Subject: [PATCH] Merge refactoring into Trunk. Use TRUNK, not Refactoring branch for continued development git-svn-id: http://joomlacode.org/svn/joomla/development/trunk@11140 6f6e1ebd-4c2b-0410-823f-f34bde69bce9 --- CHANGELOG.php | 136 +- CREDITS.php | 47 +- LICENSES.php | 174 +- administrator/backups/index.html | 2 +- administrator/cache/index.html | 2 +- administrator/components/com_acl/acl.php | 21 + .../components/com_acl/controller.php | 147 + .../components/com_acl/controllers/acl.php | 222 + .../components/com_acl/controllers/group.php | 186 + .../components/com_acl/controllers/index.html | 1 + .../components/com_acl/helpers/acl.php | 25 + .../components/com_acl/helpers/html/acl.php | 82 + .../com_acl/helpers/html/index.html | 1 + .../components/com_acl/helpers/index.html | 1 + administrator/components/com_acl/index.html | 1 + .../com_acl/models/_prototypeitem.php | 85 + .../com_acl/models/_prototypelist.php | 90 + .../components/com_acl/models/acl.php | 231 + .../components/com_acl/models/acls.php | 239 + .../components/com_acl/models/group.php | 82 + .../components/com_acl/models/groups.php | 161 + .../components/com_acl/models/objects.php | 136 + .../components/com_acl/models/sections.php | 81 + .../components/com_acl/views/group/index.html | 1 + .../com_acl/views/group/tmpl/edit.php | 81 + .../com_acl/views/group/tmpl/index.html | 1 + .../com_acl/views/group/view.html.php | 61 + .../com_acl/views/groups/index.html | 1 + .../com_acl/views/groups/tmpl/default.php | 86 + .../com_acl/views/groups/tmpl/index.html | 1 + .../com_acl/views/groups/view.html.php | 56 + .../components/com_acl/views/level/index.html | 1 + .../com_acl/views/level/tmpl/edit.php | 48 + .../com_acl/views/level/tmpl/index.html | 1 + .../com_acl/views/level/view.html.php | 60 + .../com_acl/views/levels/index.html | 1 + .../com_acl/views/levels/tmpl/default.php | 85 + .../com_acl/views/levels/tmpl/index.html | 1 + .../com_acl/views/levels/view.html.php | 56 + .../components/com_acl/views/rule/index.html | 1 + .../com_acl/views/rule/tmpl/edit.php | 106 + .../com_acl/views/rule/tmpl/edit_acos.php | 15 + .../views/rule/tmpl/edit_arogroups.php | 14 + .../views/rule/tmpl/edit_axogroups.php | 14 + .../com_acl/views/rule/tmpl/edit_axos.php | 15 + .../com_acl/views/rule/tmpl/edit_type1.php | 21 + .../com_acl/views/rule/tmpl/edit_type2.php | 29 + .../com_acl/views/rule/tmpl/edit_type3.php | 29 + .../com_acl/views/rule/tmpl/index.html | 1 + .../com_acl/views/rule/view.html.php | 95 + .../components/com_acl/views/rules/index.html | 1 + .../com_acl/views/rules/tmpl/default.php | 24 + .../views/rules/tmpl/default_type1.php | 122 + .../views/rules/tmpl/default_type2.php | 143 + .../views/rules/tmpl/default_type3.php | 136 + .../com_acl/views/rules/tmpl/index.html | 1 + .../com_acl/views/rules/view.html.php | 56 + .../components/com_admin/admin.admin.html.php | 330 -- .../components/com_admin/admin.admin.php | 48 - .../admin.php} | 50 +- .../frontpage.xml => com_admin/admin.xml} | 5 +- administrator/components/com_admin/config.xml | 5 + .../components/com_admin/controller.php | 73 + administrator/components/com_admin/index.html | 2 +- .../components/com_admin/models/changelog.php | 85 + .../components/com_admin/models/index.html | 1 + .../components/com_admin/tmpl/index.html | 1 - .../com_admin/tmpl/sysinfo_directory.php | 75 - .../com_admin/tmpl/sysinfo_phpsettings.php | 165 - .../com_admin/toolbar.admin.html.php | 48 - .../components/com_admin/toolbar.admin.php | 42 - .../com_admin/views/changelog/index.html | 1 + .../views/changelog/tmpl/default.php | 11 + .../com_admin/views/changelog/tmpl/index.html | 1 + .../views/changelog/view.html.php} | 60 +- .../com_admin/views/help/index.html | 1 + .../com_admin/views/help/tmpl/default.php | 99 + .../com_admin/views/help/tmpl/index.html | 1 + .../com_admin/views/help/view.html.php | 112 + .../com_admin/views/sysinfo/index.html | 1 + .../com_admin/views/sysinfo/tmpl/default.php | 57 + .../sysinfo/tmpl/default_config.php} | 13 +- .../views/sysinfo/tmpl/default_directory.php | 71 + .../sysinfo/tmpl/default_navigation.php} | 0 .../sysinfo/tmpl/default_phpinfo.php} | 7 +- .../sysinfo/tmpl/default_phpsettings.php | 145 + .../sysinfo/tmpl/default_system.php} | 11 +- .../com_admin/views/sysinfo/tmpl/index.html | 1 + .../com_admin/views/sysinfo/view.html.php | 86 + .../{admin.banners.php => banners.php} | 7 +- .../com_banners/controllers/banner.php | 388 +- .../com_banners/controllers/client.php | 193 +- .../com_banners/controllers/index.html | 2 +- .../com_banners/elements/index.html | 2 +- .../components/com_banners/helpers/index.html | 2 +- .../components/com_banners/index.html | 2 +- .../components/com_banners/models/banner.php | 398 ++ .../com_banners/models/bannerclient.php | 261 + .../com_banners/models/bannerclients.php | 191 + .../components/com_banners/models/banners.php | 207 + .../components/com_banners/models/index.html | 1 + .../components/com_banners/tables/index.html | 2 +- .../components/com_banners/views/banner.php | 449 -- .../com_banners/views/banner/index.html | 1 + .../com_banners/views/banner/tmpl/default.php | 234 + .../com_banners/views/banner/tmpl/index.html | 1 + .../com_banners/views/banner/view.html.php | 108 + .../com_banners/views/bannerclient/index.html | 1 + .../views/bannerclient/tmpl/default.php | 102 + .../views/bannerclient/tmpl/index.html | 1 + .../views/bannerclient/view.html.php | 67 + .../views/bannerclients/index.html | 1 + .../views/bannerclients/tmpl/default.php | 108 + .../views/bannerclients/tmpl/index.html | 1 + .../views/bannerclients/view.html.php | 48 + .../com_banners/views/banners/index.html | 1 + .../views/banners/tmpl/default.php | 165 + .../com_banners/views/banners/tmpl/index.html | 1 + .../com_banners/views/banners/view.html.php | 51 + .../components/com_banners/views/client.php | 258 - .../components/com_banners/views/index.html | 2 +- .../components/com_cache/admin.cache.html.php | 106 - .../components/com_cache/admin.cache.php | 98 - .../admin.modules.php => com_cache/cache.php} | 67 +- .../components/com_cache/controller.php | 44 + administrator/components/com_cache/index.html | 2 +- .../{cache.class.php => models/cache.php} | 111 +- .../components/com_cache/models/index.html | 1 + .../com_cache/toolbar.cache.html.php | 33 - .../components/com_cache/toolbar.cache.php | 25 - .../com_cache/views/cache/index.html | 1 + .../com_cache/views/cache/tmpl/default.php | 69 + .../com_cache/views/cache/tmpl/index.html | 1 + .../com_cache/views/cache/view.html.php | 68 + .../components/com_cache/views/index.html | 1 + .../com_categories/admin.categories.html.php | 578 -- .../com_categories/admin.categories.php | 997 ---- .../components/com_categories/categories.php | 25 + .../components/com_categories/categories.xml | 12 + .../components/com_categories/config.xml | 5 + .../components/com_categories/controller.php | 546 ++ .../components/com_categories/index.html | 2 +- .../com_categories/models/categories.php | 354 ++ .../com_categories/models/category.php | 399 ++ .../com_categories/models/index.html | 1 + .../com_categories/tables/category.php | 84 + .../com_categories/tables/index.html | 1 + .../toolbar.categories.html.php | 84 - .../com_categories/toolbar.categories.php | 44 - .../views/categories/index.html | 1 + .../views/categories/tmpl/default.php | 189 + .../views/categories/tmpl/index.html | 1 + .../views/categories/view.html.php | 74 + .../com_categories/views/category/index.html | 1 + .../views/category/tmpl/default.php | 200 + .../views/category/tmpl/index.html | 1 + .../views/category/view.html.php | 151 + .../views/copyselect/index.html | 1 + .../views/copyselect/tmpl/default.php | 92 + .../views/copyselect/tmpl/index.html | 1 + .../views/copyselect/view.html.php | 89 + .../com_categories/views/index.html | 1 + .../components/com_checkin/admin.checkin.php | 107 - .../components/com_checkin/checkin.php | 25 + .../components/com_checkin/controller.php | 29 + .../components/com_checkin/index.html | 2 +- .../com_checkin/toolbar.checkin.html.php | 31 - .../com_checkin/views/checkin/index.html | 1 + .../views/checkin/tmpl/default.php | 42 + .../com_checkin/views/checkin/tmpl/index.html | 1 + .../com_checkin/views/checkin/view.html.php | 90 + .../components/com_checkin/views/index.html | 1 + .../classes/config.php} | 29 +- .../components/com_config/classes/index.html | 1 + .../{admin.config.php => config.php} | 21 +- .../com_config/controllers/application.php | 218 +- .../com_config/controllers/component.php | 13 +- .../com_config/controllers/index.html | 2 +- .../components/com_config/index.html | 2 +- .../components/com_config/models/index.html | 2 +- .../com_config/toolbar.config.html.php | 32 - .../com_config/views/application/index.html | 2 +- .../views/application/tmpl/config.php | 67 + .../views/application/tmpl/config_cache.php | 16 +- .../application/tmpl/config_database.php | 12 +- .../views/application/tmpl/config_debug.php | 4 +- .../views/application/tmpl/config_ftp.php | 12 +- .../tmpl/{ftp.php => config_ftp_auth.php} | 0 .../views/application/tmpl/config_locale.php | 2 +- .../views/application/tmpl/config_mail.php | 16 +- .../application/tmpl/config_metadata.php | 8 +- .../{navigation.php => config_navigation.php} | 0 .../views/application/tmpl/config_seo.php | 8 +- .../views/application/tmpl/config_server.php | 6 +- .../views/application/tmpl/config_session.php | 4 +- .../views/application/tmpl/config_site.php | 12 +- .../views/application/tmpl/config_system.php | 8 +- .../views/application/tmpl/index.html | 2 +- .../views/application/view.html.php | 226 + .../com_config/views/application/view.php | 131 - .../com_config/views/component/index.html | 2 +- .../views/component/tmpl/default.php | 31 + .../views/component/tmpl/index.html | 1 + .../com_config/views/component/view.php | 34 +- .../components/com_config/views/index.html | 2 +- .../com_contact/admin.contact.html.php | 476 -- .../components/com_contact/admin.contact.php | 505 -- .../components/com_contact/contact.php | 33 + .../components/com_contact/contact.xml | 2 +- .../components/com_contact/controller.php | 282 + .../com_contact/elements/index.html | 2 +- .../components/com_contact/helpers/index.html | 1 - .../components/com_contact/helpers/vcard.php | 94 - .../components/com_contact/index.html | 2 +- .../components/com_contact/models/contact.php | 439 ++ .../{contact_items.xml => models/contact.xml} | 2 +- .../com_contact/models/contacts.php | 207 + .../components/com_contact/models/index.html | 1 + .../components/com_contact/tables/contact.php | 2 +- .../components/com_contact/tables/index.html | 2 +- .../com_contact/toolbar.contact.html.php | 59 - .../com_contact/toolbar.contact.php | 33 - .../com_contact/views/contact/index.html | 1 + .../views/contact/tmpl/default.php | 299 + .../com_contact/views/contact/tmpl/index.html | 1 + .../com_contact/views/contact/view.html.php | 101 + .../com_contact/views/contacts/index.html | 1 + .../views/contacts/tmpl/default.php | 142 + .../views/contacts/tmpl/index.html | 1 + .../com_contact/views/contacts/view.html.php | 62 + .../components/com_contact/views/index.html | 1 + .../com_contactdirectory/contactdirectory.php | 40 + .../com_contactdirectory/contactdirectory.xml | 12 + .../controllers/contact.php | 265 + .../controllers/field.php | 272 + .../controllers/index.html | 1 + .../com_contactdirectory/elements/contact.php | 42 + .../com_contactdirectory/elements/index.html | 1 + .../com_contactdirectory/helpers/index.html | 1 + .../helpers/stringstream.php | 109 + .../com_contactdirectory/index.html | 1 + .../com_contactdirectory/models/contact.php | 493 ++ .../com_contactdirectory/models/contact.xml | 52 + .../com_contactdirectory/models/contacts.php | 180 + .../com_contactdirectory/models/field.php | 361 ++ .../com_contactdirectory/models/field.xml | 21 + .../com_contactdirectory/models/fields.php | 172 + .../com_contactdirectory/models/index.html | 1 + .../com_contactdirectory/tables/contact.php | 289 + .../com_contactdirectory/tables/field.php | 133 + .../com_contactdirectory/tables/index.html | 1 + .../views/contact/index.html | 1 + .../views/contact/tmpl/default.php | 259 + .../views/contact/tmpl/index.html | 1 + .../views/contact/view.html.php | 136 + .../views/contacts/index.html | 1 + .../views/contacts/tmpl/default.php | 132 + .../views/contacts/tmpl/index.html | 1 + .../views/contacts/view.html.php | 60 + .../views/field/index.html | 1 + .../views/field/tmpl/default.php | 123 + .../views/field/tmpl/index.html | 1 + .../views/field/view.html.php | 111 + .../views/fields/index.html | 1 + .../views/fields/tmpl/default.php | 153 + .../views/fields/tmpl/index.html | 1 + .../views/fields/view.html.php | 57 + .../views/import/index.html | 1 + .../views/import/tmpl/default.php | 31 + .../views/import/tmpl/index.html | 1 + .../views/import/view.html.php | 51 + .../com_contactdirectory/views/index.html | 1 + .../com_content/admin.content.html.php | 924 --- .../components/com_content/admin.content.php | 137 - .../{helper => classes}/content.php | 2 +- .../com_content/classes/contentgrid.php | 53 + .../components/com_content/classes/index.html | 1 + .../components/com_content/content.php | 41 + .../components/com_content/controller.php | 2070 ++----- .../com_content/controllers/frontpage.php | 245 + .../com_content/controllers/index.html | 1 + .../com_content/elements/article.php | 14 +- .../com_content/elements/author.php | 2 +- .../com_content/elements/index.html | 2 +- .../components/com_content/helper.php | 113 - .../components/com_content/helper/index.html | 1 - .../components/com_content/index.html | 2 +- .../components/com_content/models/article.php | 677 +++ .../com_content/models/articles.php | 227 + .../components/com_content/models/element.php | 220 +- .../com_content/models/frontpage.php | 331 ++ .../components/com_content/models/index.html | 2 +- .../tables/frontpage.php | 2 +- .../components/com_content/tables/index.html | 1 + .../com_content/toolbar.content.html.php | 84 - .../com_content/toolbar.content.php | 48 - .../com_content/views/article/index.html | 1 + .../views/article/tmpl/default.php | 280 + .../com_content/views/article/tmpl/index.html | 1 + .../com_content/views/article/view.html.php | 295 + .../com_content/views/articles/index.html | 1 + .../views/articles/tmpl/default.php | 237 + .../views/articles/tmpl/index.html | 1 + .../com_content/views/articles/view.html.php | 71 + .../com_content/views/copyselect/index.html | 1 + .../views/copyselect/tmpl/default.php | 71 + .../views/copyselect/tmpl/index.html | 1 + .../views/copyselect/view.html.php | 81 + .../com_content/views/element/index.html | 2 +- .../views/element/tmpl/default.php | 103 + .../com_content/views/element/tmpl/index.html | 1 + .../com_content/views/element/view.php | 166 +- .../com_content/views/frontpage/index.html | 1 + .../views/frontpage/tmpl/default.php | 237 + .../views/frontpage/tmpl/index.html | 1 + .../com_content/views/frontpage/view.html.php | 63 + .../components/com_content/views/index.html | 2 +- .../com_content/views/pagebreak/index.html | 1 + .../views/pagebreak/tmpl/default.php | 51 + .../views/pagebreak/tmpl/index.html | 1 + .../com_content/views/pagebreak/view.html.php | 42 + .../com_content/views/prevuuw/index.html | 1 + .../views/prevuuw/tmpl/default.php | 24 + .../com_content/views/prevuuw/tmpl/index.html | 1 + .../com_content/views/prevuuw/view.html.php | 63 + .../com_cpanel/admin.cpanel.html.php | 47 - .../components/com_cpanel/controller.php | 29 + .../cpanel.php} | 50 +- .../components/com_cpanel/index.html | 2 +- .../com_cpanel/views/cpanel/index.html | 1 + .../com_cpanel/views/cpanel/tmpl/default.php | 15 + .../com_cpanel/views/cpanel/tmpl/index.html | 1 + .../com_cpanel/views/cpanel/view.html.php | 52 + .../components/com_cpanel/views/index.html | 1 + .../com_frontpage/admin.frontpage.php | 369 -- .../components/com_frontpage/index.html | 1 - .../com_frontpage/tables/index.html | 1 - .../com_frontpage/views/frontpage.php | 263 - .../components/com_frontpage/views/index.html | 1 - .../components/com_installer/index.html | 2 +- .../{admin.installer.php => installer.php} | 2 +- .../com_installer/models/components.php | 5 +- .../com_installer/models/index.html | 2 +- .../com_installer/models/languages.php | 5 +- .../com_installer/models/modules.php | 5 +- .../com_installer/models/plugins.php | 5 +- .../com_installer/models/templates.php | 5 +- .../com_installer/views/components/index.html | 2 +- .../views/components/tmpl/default.php | 2 +- .../views/components/tmpl/default_item.php | 2 +- .../views/components/tmpl/index.html | 2 +- .../com_installer/views/components/view.php | 7 +- .../com_installer/views/default/index.html | 2 +- .../views/default/tmpl/index.html | 2 +- .../com_installer/views/default/view.php | 8 +- .../components/com_installer/views/index.html | 2 +- .../com_installer/views/install/index.html | 2 +- .../views/install/tmpl/default_form.php | 2 +- .../views/install/tmpl/index.html | 2 +- .../com_installer/views/install/view.php | 4 +- .../com_installer/views/languages/index.html | 2 +- .../views/languages/tmpl/default.php | 2 +- .../views/languages/tmpl/index.html | 2 +- .../com_installer/views/languages/view.php | 6 +- .../com_installer/views/modules/index.html | 2 +- .../views/modules/tmpl/default.php | 2 +- .../views/modules/tmpl/index.html | 2 +- .../com_installer/views/modules/view.php | 7 +- .../com_installer/views/plugins/index.html | 2 +- .../views/plugins/tmpl/default.php | 2 +- .../views/plugins/tmpl/index.html | 2 +- .../com_installer/views/plugins/view.php | 6 +- .../com_installer/views/templates/index.html | 2 +- .../views/templates/tmpl/default.php | 6 +- .../views/templates/tmpl/index.html | 2 +- .../com_installer/views/templates/view.php | 6 +- .../com_languages/admin.languages.html.php | 157 - .../com_languages/admin.languages.php | 154 - .../components/com_languages/controller.php | 63 + .../components/com_languages/index.html | 2 +- ...olbar.languages.html.php => languages.php} | 31 +- .../com_languages/models/index.html | 1 + .../com_languages/models/languages.php | 198 + .../components/com_languages/views/index.html | 1 + .../com_languages/views/languages/index.html | 1 + .../views/languages/tmpl/default.php | 126 + .../views/languages/tmpl/index.html | 1 + .../views/languages/view.html.php | 71 + .../{admin.login.php => controller.php} | 144 +- administrator/components/com_login/index.html | 2 +- .../login.php} | 50 +- .../components/com_login/views/index.html | 1 + .../com_login/views/login/index.html | 1 + .../com_login/views/login/tmpl/default.php | 3 + .../com_login/views/login/tmpl/index.html | 1 + .../com_login/views/login/view.html.php | 40 + .../com_massmail/admin.massmail.html.php | 139 - .../com_massmail/admin.massmail.php | 154 - .../components/com_massmail/controller.php | 130 + .../components/com_massmail/index.html | 2 +- .../components/com_massmail/massmail.php | 33 + .../components/com_massmail/massmail.xml | 2 +- .../com_massmail/toolbar.massmail.html.php | 35 - .../components/com_massmail/views/index.html | 1 + .../com_massmail/views/massmail/index.html | 1 + .../views/massmail/tmpl/default.php | 113 + .../views/massmail/tmpl/index.html | 1 + .../com_massmail/views/massmail/view.html.php | 52 + .../components/com_media/assets/index.html | 2 +- .../com_media/assets/mediamanager.css | 1 - .../com_media/assets/popup-imagelist.css | 1 - .../com_media/assets/popup-imagemanager.css | 1 - .../components/com_media/controller.php | 8 +- .../com_media/controllers/folder.php | 3 +- .../com_media/controllers/index.html | 2 +- .../components/com_media/helpers/index.html | 2 +- .../components/com_media/images/index.html | 2 +- .../com_media/images/mime-icon-16/index.html | 2 +- .../com_media/images/mime-icon-32/index.html | 2 +- administrator/components/com_media/index.html | 2 +- administrator/components/com_media/media.php | 10 +- .../components/com_media/models/index.html | 2 +- .../components/com_media/models/list.php | 6 +- .../com_media/views/images/index.html | 2 +- .../com_media/views/images/tmpl/default.php | 4 +- .../com_media/views/images/tmpl/index.html | 2 +- .../com_media/views/images/view.html.php | 2 +- .../com_media/views/imageslist/index.html | 2 +- .../views/imageslist/tmpl/default_folder.php | 2 +- .../views/imageslist/tmpl/index.html | 2 +- .../com_media/views/imageslist/view.html.php | 4 +- .../com_media/views/media/index.html | 2 +- .../com_media/views/media/tmpl/default.php | 144 +- .../views/media/tmpl/default_folders.php | 2 +- .../com_media/views/media/tmpl/index.html | 2 +- .../com_media/views/medialist/index.html | 2 +- .../views/medialist/tmpl/details.php | 2 +- .../views/medialist/tmpl/details_folder.php | 6 +- .../views/medialist/tmpl/details_img.php | 4 +- .../views/medialist/tmpl/details_up.php | 4 +- .../com_media/views/medialist/tmpl/index.html | 2 +- .../com_media/views/medialist/tmpl/thumbs.php | 2 +- .../views/medialist/tmpl/thumbs_doc.php | 2 +- .../views/medialist/tmpl/thumbs_folder.php | 6 +- .../views/medialist/tmpl/thumbs_img.php | 2 +- .../views/medialist/tmpl/thumbs_up.php | 4 +- .../com_media/views/medialist/view.html.php | 6 +- .../components/com_menus/admin.menus.php | 8 +- .../com_menus/assets/images/index.html | 2 +- .../components/com_menus/assets/index.html | 2 +- .../com_menus/assets/rtl_images/index.html | 2 +- .../components/com_menus/classes/index.html | 2 +- .../components/com_menus/helpers/index.html | 2 +- administrator/components/com_menus/index.html | 2 +- .../components/com_menus/models/index.html | 2 +- .../components/com_menus/models/item.php | 26 +- .../components/com_menus/models/list.php | 52 +- .../com_menus/models/metadata/index.html | 2 +- .../components/com_menus/views/index.html | 2 +- .../com_menus/views/item/index.html | 2 +- .../com_menus/views/item/tmpl/form.php | 32 +- .../com_menus/views/item/tmpl/index.html | 2 +- .../com_menus/views/item/tmpl/type.php | 12 +- .../components/com_menus/views/item/view.php | 13 +- .../com_menus/views/list/index.html | 2 +- .../com_menus/views/list/tmpl/copy.php | 2 +- .../com_menus/views/list/tmpl/default.php | 2 +- .../com_menus/views/list/tmpl/index.html | 2 +- .../com_menus/views/list/tmpl/move.php | 2 +- .../components/com_menus/views/list/view.php | 381 +- .../com_menus/views/menus/index.html | 2 +- .../com_menus/views/menus/tmpl/copy.php | 2 +- .../com_menus/views/menus/tmpl/default.php | 4 +- .../com_menus/views/menus/tmpl/delete.php | 2 +- .../com_menus/views/menus/tmpl/edit.php | 2 +- .../com_menus/views/menus/tmpl/index.html | 2 +- .../components/com_menus/views/menus/view.php | 289 +- .../com_messages/admin.messages.html.php | 296 - .../com_messages/admin.messages.php | 300 - .../components/com_messages/controller.php | 116 + .../components/com_messages/index.html | 2 +- .../components/com_messages/messages.php | 52 +- .../components/com_messages/models/config.php | 123 + .../components/com_messages/models/index.html | 1 + .../com_messages/models/message.php | 219 + .../com_messages/models/messages.php | 197 + .../components/com_messages/tables/index.html | 2 +- .../com_messages/tables/message.php | 13 +- .../com_messages/toolbar.messages.html.php | 54 - .../com_messages/toolbar.messages.php | 39 - .../components/com_messages/views/index.html | 1 + .../com_messages/views/message/index.html | 1 + .../views/message/tmpl/default.php | 49 + .../views/message/tmpl/default_form.php | 58 + .../views/message/tmpl/index.html | 1 + .../com_messages/views/message/view.html.php | 93 + .../com_messages/views/messages/index.html | 1 + .../views/messages/tmpl/default.php | 103 + .../views/messages/tmpl/index.html | 1 + .../com_messages/views/messages/view.html.php | 56 + .../com_modules/admin.modules.html.php | 604 -- .../components/com_modules/classes/filter.php | 73 + .../components/com_modules/classes/index.html | 1 + .../components/com_modules/controller.php | 641 +-- .../components/com_modules/helpers/index.html | 2 +- .../components/com_modules/index.html | 2 +- .../components/com_modules/models/index.html | 2 +- .../components/com_modules/models/module.php | 573 +- .../components/com_modules/models/modules.php | 237 + .../{toolbar.modules.php => modules.php} | 32 +- .../com_modules/toolbar.modules.html.php | 68 - .../components/com_modules/views/index.html | 1 + .../com_modules/views/module/index.html | 1 + .../com_modules/views/module/tmpl/default.php | 290 + .../com_modules/views/module/tmpl/index.html | 1 + .../com_modules/views/module/view.html.php | 222 + .../com_modules/views/modules/index.html | 1 + .../views/modules/tmpl/default.php | 170 + .../com_modules/views/modules/tmpl/index.html | 1 + .../com_modules/views/modules/view.html.php | 71 + .../com_modules/views/prevuuw/index.html | 1 + .../views/prevuuw/tmpl/default.php | 17 + .../com_modules/views/prevuuw/tmpl/index.html | 1 + .../views/prevuuw/view.html.php} | 60 +- .../com_modules/views/selecttype/index.html | 1 + .../views/selecttype/tmpl/default.php | 62 + .../views/selecttype/tmpl/index.html | 1 + .../views/selecttype/view.html.php | 80 + .../com_newsfeeds/admin.newsfeeds.html.php | 357 -- .../com_newsfeeds/admin.newsfeeds.php | 463 -- .../components/com_newsfeeds/controller.php | 203 + .../com_newsfeeds/elements/index.html | 2 +- .../components/com_newsfeeds/index.html | 2 +- .../com_newsfeeds/models/index.html | 1 + .../com_newsfeeds/models/newsfeed.php | 385 ++ .../com_newsfeeds/models/newsfeeds.php | 204 + .../components/com_newsfeeds/newsfeeds.php | 33 + .../components/com_newsfeeds/newsfeeds.xml | 2 +- .../com_newsfeeds/tables/index.html | 2 +- .../com_newsfeeds/tables/newsfeed.php | 2 +- .../com_newsfeeds/toolbar.newsfeeds.html.php | 54 - .../components/com_newsfeeds/views/index.html | 1 + .../com_newsfeeds/views/newsfeed/index.html | 1 + .../views/newsfeed/tmpl/default.php | 148 + .../views/newsfeed/tmpl/index.html | 1 + .../views/newsfeed/view.html.php | 85 + .../com_newsfeeds/views/newsfeeds/index.html | 1 + .../views/newsfeeds/tmpl/default.php | 153 + .../views/newsfeeds/tmpl/index.html | 1 + .../views/newsfeeds/view.html.php | 71 + .../components/com_plugins/controller.php | 4 +- .../com_plugins/controllers/index.html | 2 +- .../components/com_plugins/index.html | 2 +- .../components/com_plugins/plugins.php | 6 +- .../com_plugins/views/plugin/index.html | 2 +- .../com_plugins/views/plugin/tmpl/form.php | 2 +- .../com_plugins/views/plugin/tmpl/index.html | 2 +- .../com_plugins/views/plugins/index.html | 2 +- .../views/plugins/tmpl/default.php | 2 +- .../com_plugins/views/plugins/tmpl/index.html | 2 +- .../com_plugins/views/plugins/view.html.php | 11 +- .../components/com_poll/controller.php | 4 +- .../components/com_poll/elements/index.html | 2 +- administrator/components/com_poll/index.html | 2 +- administrator/components/com_poll/poll.php | 8 +- .../components/com_poll/tables/index.html | 2 +- .../components/com_poll/views/index.html | 2 +- .../components/com_poll/views/poll/index.html | 2 +- .../com_poll/views/poll/tmpl/form.php | 2 +- .../com_poll/views/poll/tmpl/index.html | 2 +- .../com_poll/views/poll/view.html.php | 9 +- .../com_poll/views/polls/index.html | 2 +- .../com_poll/views/polls/tmpl/default.php | 2 +- .../com_poll/views/polls/tmpl/index.html | 2 +- .../com_poll/views/polls/view.html.php | 7 +- .../components/com_search/helpers/index.html | 2 +- .../components/com_search/helpers/site.php | 2 +- .../components/com_search/index.html | 2 +- .../components/com_search/models/index.html | 2 +- .../components/com_search/models/search.php | 2 +- .../components/com_search/search.php | 2 +- .../components/com_search/views/index.html | 2 +- .../com_search/views/search/index.html | 2 +- .../com_search/views/search/tmpl/default.php | 6 +- .../com_search/views/search/tmpl/index.html | 2 +- .../com_sections/admin.sections.html.php | 435 -- .../com_sections/admin.sections.php | 712 --- .../components/com_sections/config.xml | 5 + .../components/com_sections/controller.php | 519 ++ .../components/com_sections/index.html | 2 +- .../components/com_sections/models/index.html | 1 + .../com_sections/models/section.php | 396 ++ .../com_sections/models/sections.php | 243 + .../sections.php} | 19 +- .../components/com_sections/sections.xml | 12 + .../components/com_sections/tables/index.html | 1 + .../com_sections/tables/section.php | 82 + .../com_sections/toolbar.sections.html.php | 66 - .../com_sections/views/copyselect/index.html | 1 + .../views/copyselect/tmpl/default.php | 97 + .../views/copyselect/tmpl/index.html | 1 + .../views/copyselect/view.html.php | 77 + .../components/com_sections/views/index.html | 1 + .../com_sections/views/section/index.html | 1 + .../views/section/tmpl/default.php | 163 + .../views/section/tmpl/index.html | 1 + .../com_sections/views/section/view.html.php | 90 + .../com_sections/views/sections/index.html | 1 + .../views/sections/tmpl/default.php | 146 + .../views/sections/tmpl/index.html | 1 + .../com_sections/views/sections/view.html.php | 68 + .../com_templates/admin.templates.html.php | 620 -- .../com_templates/admin.templates.php | 101 - .../components/com_templates/controller.php | 541 +- .../com_templates/helpers/index.html | 2 +- .../components/com_templates/index.html | 2 +- .../com_templates/models/cssedit.php | 208 + .../com_templates/models/index.html | 1 + .../com_templates/models/source.php | 192 + .../com_templates/models/template.php | 277 + .../com_templates/models/templates.php | 176 + .../templates.php} | 35 +- .../com_templates/toolbar.templates.html.php | 77 - .../com_templates/toolbar.templates.php | 48 - .../com_templates/views/csschoose/index.html | 1 + .../views/csschoose/tmpl/default.php | 51 + .../views/csschoose/tmpl/index.html | 1 + .../views/csschoose/view.html.php | 62 + .../com_templates/views/cssedit/index.html | 1 + .../views/cssedit/tmpl/default.php | 61 + .../views/cssedit/tmpl/index.html | 1 + .../com_templates/views/cssedit/view.html.php | 61 + .../components/com_templates/views/index.html | 1 + .../com_templates/views/prevuuw/index.html | 1 + .../views/prevuuw/tmpl/default.php | 26 + .../views/prevuuw/tmpl/index.html | 1 + .../com_templates/views/prevuuw/view.html.php | 58 + .../com_templates/views/source/index.html | 1 + .../views/source/tmpl/default.php | 62 + .../views/source/tmpl/index.html | 1 + .../com_templates/views/source/view.html.php | 60 + .../com_templates/views/template/index.html | 1 + .../views/template/tmpl/default.php | 165 + .../views/template/tmpl/index.html | 1 + .../views/template/view.html.php | 75 + .../com_templates/views/templates/index.html | 1 + .../views/templates/tmpl/default.php | 158 + .../views/templates/tmpl/index.html | 1 + .../views/templates/view.html.php | 76 + .../components/com_trash/admin.trash.html.php | 8 +- .../components/com_trash/admin.trash.php | 8 +- administrator/components/com_trash/index.html | 2 +- .../components/com_trash/toolbar.trash.php | 2 +- administrator/components/com_users/config.xml | 46 +- .../components/com_users/controller.php | 933 +-- .../com_users/controllers/index.html | 1 + .../components/com_users/controllers/user.php | 243 + .../components/com_users/helpers/html/fx.php | 56 + .../com_users/helpers/html/index.html | 1 + .../com_users/helpers/html/user.php | 51 + .../components/com_users/helpers/index.html | 1 + administrator/components/com_users/index.html | 2 +- .../com_users/models/_prototype.php | 284 + .../components/com_users/models/author.xml | 20 +- .../components/com_users/models/index.html | 2 +- .../com_users/models/registered.xml | 16 +- .../components/com_users/models/user.php | 202 + .../components/com_users/models/user.xml | 20 +- .../components/com_users/params/author.xml | 10 + .../com_users/params/general_messages.xml | 14 + .../components/com_users/params/index.html | 1 + .../com_users/params/registered.xml | 8 + .../components/com_users/params/user.xml | 10 + .../components/com_users/tables/group.php | 97 + .../components/com_users/tables/index.html | 1 + administrator/components/com_users/users.php | 168 +- administrator/components/com_users/users.xml | 24 +- .../components/com_users/views/index.html | 2 +- .../com_users/views/user/index.html | 2 +- .../com_users/views/user/tmpl/edit.php | 44 + .../views/user/tmpl/edit_contact.php | 95 + .../com_users/views/user/tmpl/edit_groups.php | 24 + .../com_users/views/user/tmpl/edit_main.php | 101 + .../views/user/tmpl/edit_parameters.php | 32 + .../com_users/views/user/tmpl/form.php | 301 - .../com_users/views/user/tmpl/index.html | 2 +- .../com_users/views/user/view.html.php | 208 +- .../com_users/views/users/index.html | 2 +- .../com_users/views/users/tmpl/default.php | 295 +- .../com_users/views/users/tmpl/index.html | 2 +- .../com_users/views/users/view.html.php | 245 +- .../com_weblinks/classes/index.html | 1 + .../com_weblinks/classes/weblink.php | 63 + .../components/com_weblinks/config.xml | 37 +- .../components/com_weblinks/controller.php | 32 +- .../com_weblinks/elements/index.html | 1 + .../com_weblinks/elements/snapshotsource.php | 34 + .../components/com_weblinks/index.html | 2 +- .../components/com_weblinks/models/index.html | 2 +- .../com_weblinks/models/snapshotsources.php | 164 + .../com_weblinks/models/snapshotsources.xml | 93 + .../com_weblinks/models/weblink.php | 59 +- .../com_weblinks/models/weblink.xml | 3 +- .../com_weblinks/models/weblinks.php | 62 +- .../components/com_weblinks/tables/index.html | 2 +- .../com_weblinks/tables/weblink.php | 2 +- .../components/com_weblinks/views/index.html | 2 +- .../com_weblinks/views/weblink/index.html | 2 +- .../com_weblinks/views/weblink/tmpl/form.php | 6 +- .../views/weblink/tmpl/index.html | 2 +- .../com_weblinks/views/weblink/view.html.php | 14 +- .../com_weblinks/views/weblinks/index.html | 2 +- .../views/weblinks/tmpl/default.php | 43 +- .../views/weblinks/tmpl/index.html | 2 +- .../com_weblinks/views/weblinks/view.html.php | 37 +- .../components/com_weblinks/weblinks.php | 5 +- administrator/components/index.html | 2 +- administrator/help/en-GB/css/index.html | 2 +- administrator/help/en-GB/index.html | 2 +- .../en-GB/screen.banner.categories.edit.html | 14 + .../help/en-GB/screen.banner.categories.html | 14 + .../en-GB/screen.banners.client.edit.html | 8 +- .../help/en-GB/screen.banners.client.html | 8 +- .../help/en-GB/screen.banners.edit.html | 8 +- administrator/help/en-GB/screen.cache.html | 14 + .../help/en-GB/screen.categories.edit.html | 8 +- ...creen.contact_details.categories.edit.html | 14 + .../screen.contact_details.categories.html | 14 + .../en-GB/screen.contactmanager.edit.html | 6 +- .../en-GB/screen.content.categories.edit.html | 14 + .../help/en-GB/screen.content.categories.html | 14 + .../help/en-GB/screen.content.edit.html | 6 +- .../help/en-GB/screen.installer.html | 8 +- .../help/en-GB/screen.menumanager.new.html | 6 +- .../help/en-GB/screen.menus.edit.html | 8 +- administrator/help/en-GB/screen.menus.html | 8 +- .../help/en-GB/screen.messages.edit.html | 14 + .../help/en-GB/screen.messages.inbox.html | 8 +- .../help/en-GB/screen.messages.read.html | 14 + .../help/en-GB/screen.modules.edit.html | 4 +- .../help/en-GB/screen.modules.new.html | 6 +- .../screen.modulesadministrator.edit.html | 14 + .../help/en-GB/screen.modulessite.edit.html | 14 + .../screen.newsfeeds.categories.edit.html | 14 + .../en-GB/screen.newsfeeds.categories.html | 14 + .../help/en-GB/screen.newsfeeds.edit.html | 8 +- .../help/en-GB/screen.plugins.edit.html | 6 +- .../help/en-GB/screen.polls.edit.html | 8 +- .../help/en-GB/screen.sections.edit.html | 6 +- administrator/help/en-GB/screen.users.html | 14 + .../screen.weblinks.categories.edit.html | 14 + .../en-GB/screen.weblinks.categories.html | 14 + administrator/help/index.html | 2 +- administrator/images/index.html | 2 +- .../images}/mainmenu.png | Bin administrator/includes/application.php | 588 +- administrator/includes/framework.php | 5 +- administrator/includes/helper.php | 14 +- administrator/includes/index.html | 2 +- .../includes/js/ThemeOffice/index.html | 4 - .../includes/js/ThemeOffice/theme.js | 45 - .../includes/js/ThemeOffice/theme_rtl.js | 45 - administrator/includes/js/index.html | 4 - .../toolbar.config.php => includes/menu.php} | 53 +- administrator/includes/pageNavigation.php | 7 - administrator/includes/pcl/index.html | 1 - administrator/includes/pcl/pclerror.lib.php | 138 - administrator/includes/pcl/pcltar.lib.php | 3570 ------------ administrator/includes/pcl/pcltrace.lib.php | 459 -- administrator/includes/pcl/pclzip.lib.php | 4981 ----------------- administrator/includes/pcl/zip.lib.php | 74 - administrator/includes/router.php | 1 - administrator/includes/toolbar.php | 1000 ++-- administrator/index.php | 15 +- administrator/index2.php | 15 - administrator/index3.php | 16 - .../language/en-GB/en-GB.com_acl.ini | 82 + .../language/en-GB/en-GB.com_admin.ini | 110 +- .../language/en-GB/en-GB.com_banners.ini | 117 +- .../language/en-GB/en-GB.com_banners.menu.ini | 20 +- .../language/en-GB/en-GB.com_cache.ini | 30 +- .../language/en-GB/en-GB.com_categories.ini | 10 +- .../language/en-GB/en-GB.com_checkin.ini | 28 +- .../language/en-GB/en-GB.com_config.ini | 74 +- .../language/en-GB/en-GB.com_contact.ini | 288 +- .../language/en-GB/en-GB.com_contact.menu.ini | 16 +- .../en-GB/en-GB.com_contactdirectory.ini | 177 + .../language/en-GB/en-GB.com_content.ini | 73 +- .../language/en-GB/en-GB.com_frontpage.ini | 22 +- .../language/en-GB/en-GB.com_installer.ini | 310 +- .../language/en-GB/en-GB.com_languages.ini | 3 +- .../language/en-GB/en-GB.com_login.ini | 12 +- .../language/en-GB/en-GB.com_massmail.ini | 3 +- .../language/en-GB/en-GB.com_media.ini | 20 +- .../language/en-GB/en-GB.com_menus.ini | 81 +- .../language/en-GB/en-GB.com_messages.ini | 5 +- .../language/en-GB/en-GB.com_modules.ini | 13 +- .../language/en-GB/en-GB.com_newsfeeds.ini | 151 +- .../en-GB/en-GB.com_newsfeeds.menu.ini | 18 +- .../language/en-GB/en-GB.com_plugins.ini | 58 +- .../language/en-GB/en-GB.com_poll.ini | 5 + .../language/en-GB/en-GB.com_poll.menu.ini | 14 +- .../language/en-GB/en-GB.com_search.ini | 36 +- .../language/en-GB/en-GB.com_search.menu.ini | 14 +- .../language/en-GB/en-GB.com_statistics.ini | 60 +- .../language/en-GB/en-GB.com_templates.ini | 8 +- .../language/en-GB/en-GB.com_trash.ini | 9 +- .../language/en-GB/en-GB.com_user.ini | 13 +- .../language/en-GB/en-GB.com_users.ini | 24 +- .../language/en-GB/en-GB.com_weblinks.ini | 96 +- .../en-GB/en-GB.com_weblinks.menu.ini | 18 +- .../language/en-GB/en-GB.com_wrapper.ini | 16 +- administrator/language/en-GB/en-GB.ini | 82 +- .../language/en-GB/en-GB.mod_components.ini | 22 +- .../language/en-GB/en-GB.mod_custom.ini | 18 +- .../language/en-GB/en-GB.mod_feed.ini | 22 + .../language/en-GB/en-GB.mod_footer.ini | 23 +- .../language/en-GB/en-GB.mod_latest.ini | 32 +- .../language/en-GB/en-GB.mod_logged.ini | 24 +- .../language/en-GB/en-GB.mod_login.ini | 20 +- .../language/en-GB/en-GB.mod_menu.ini | 168 +- .../language/en-GB/en-GB.mod_online.ini | 20 +- .../language/en-GB/en-GB.mod_popular.ini | 22 +- .../language/en-GB/en-GB.mod_quickicon.ini | 42 +- .../language/en-GB/en-GB.mod_stats.ini | 20 +- .../language/en-GB/en-GB.mod_status.ini | 18 +- .../language/en-GB/en-GB.mod_submenu.ini | 18 +- .../language/en-GB/en-GB.mod_title.ini | 16 +- .../language/en-GB/en-GB.mod_toolbar.ini | 19 +- .../language/en-GB/en-GB.mod_unread.ini | 18 +- .../en-GB.plg_authentication_example.ini | 19 +- .../en-GB/en-GB.plg_authentication_gmail.ini | 14 +- .../en-GB/en-GB.plg_authentication_joomla.ini | 20 +- .../en-GB/en-GB.plg_authentication_ldap.ini | 99 +- .../language/en-GB/en-GB.plg_content_code.ini | 20 +- .../en-GB/en-GB.plg_content_emailcloak.ini | 29 +- .../en-GB/en-GB.plg_content_geshi.ini | 20 +- .../en-GB/en-GB.plg_content_image.ini | 31 +- .../en-GB/en-GB.plg_content_loadmodule.ini | 35 +- .../en-GB/en-GB.plg_content_pagebreak.ini | 50 +- .../en-GB.plg_content_pagenavigation.ini | 26 +- .../language/en-GB/en-GB.plg_content_vote.ini | 20 +- .../en-GB/en-GB.plg_editors-xtd_image.ini | 19 +- .../en-GB/en-GB.plg_editors-xtd_pagebreak.ini | 18 +- .../en-GB/en-GB.plg_editors-xtd_readmore.ini | 19 +- .../language/en-GB/en-GB.plg_editors_none.ini | 14 +- .../en-GB/en-GB.plg_editors_tinymce.ini | 47 +- .../en-GB/en-GB.plg_editors_xstandard.ini | 22 +- .../en-GB/en-GB.plg_search_categories.ini | 26 +- .../en-GB/en-GB.plg_search_contacts.ini | 23 +- .../en-GB/en-GB.plg_search_content.ini | 38 +- .../en-GB/en-GB.plg_search_newsfeeds.ini | 24 +- .../en-GB/en-GB.plg_search_sections.ini | 26 +- .../en-GB/en-GB.plg_search_weblinks.ini | 22 +- .../en-GB/en-GB.plg_system_backlink.ini | 28 +- .../language/en-GB/en-GB.plg_system_debug.ini | 52 +- .../en-GB/en-GB.plg_system_legacy.ini | 16 +- .../language/en-GB/en-GB.plg_system_sef.ini | 14 +- .../language/en-GB/en-GB.plg_user_joomla.ini | 18 +- .../en-GB/en-GB.plg_xmlrpc_blogger.ini | 52 +- .../en-GB/en-GB.plg_xmlrpc_joomla.ini | 16 +- .../en-GB/en-GB.tpl_rhuk_milkyway.ini | 52 +- administrator/language/en-GB/index.html | 2 +- administrator/language/index.html | 2 +- administrator/modules/index.html | 2 +- administrator/modules/mod_custom/index.html | 2 +- administrator/modules/mod_feed/index.html | 2 +- administrator/modules/mod_feed/mod_feed.php | 2 +- .../modules/mod_feed/tmpl/index.html | 2 +- administrator/modules/mod_footer/index.html | 2 +- administrator/modules/mod_latest/index.html | 2 +- .../modules/mod_latest/mod_latest.php | 2 +- .../modules/mod_latest/mod_latest.xml | 6 +- administrator/modules/mod_logged/index.html | 2 +- .../modules/mod_logged/mod_logged.xml | 2 +- .../modules/mod_logged/tmpl/index.html | 2 +- administrator/modules/mod_login/index.html | 2 +- administrator/modules/mod_login/mod_login.xml | 2 +- administrator/modules/mod_menu/helper.php | 19 +- administrator/modules/mod_menu/index.html | 2 +- administrator/modules/mod_menu/mod_menu.php | 2 +- administrator/modules/mod_online/index.html | 2 +- .../modules/mod_online/mod_online.xml | 2 +- administrator/modules/mod_popular/index.html | 2 +- .../modules/mod_popular/mod_popular.php | 2 +- .../modules/mod_popular/mod_popular.xml | 2 +- .../modules/mod_quickicon/index.html | 2 +- administrator/modules/mod_stats/index.html | 2 +- administrator/modules/mod_status/index.html | 2 +- .../modules/mod_status/mod_status.xml | 2 +- administrator/modules/mod_submenu/index.html | 2 +- .../modules/mod_submenu/mod_submenu.php | 3 +- .../modules/mod_submenu/mod_submenu.xml | 2 +- administrator/modules/mod_title/index.html | 2 +- administrator/modules/mod_title/mod_title.xml | 2 +- administrator/modules/mod_toolbar/index.html | 2 +- .../modules/mod_toolbar/mod_toolbar.xml | 2 +- administrator/modules/mod_unread/index.html | 2 +- .../modules/mod_unread/mod_unread.xml | 2 +- administrator/templates/index.html | 2 +- .../templates/khepri/css/component.css | 1 - .../templates/khepri/css/general.css | 4 +- .../templates/khepri/css/general_rtl.css | 1 - administrator/templates/khepri/css/index.html | 2 +- administrator/templates/khepri/css/login.css | 1 - .../templates/khepri/css/login_rtl.css | 1 - administrator/templates/khepri/css/menu.css | 1 - .../templates/khepri/css/menu_rtl.css | 1 - .../templates/khepri/css/norounded.css | 1 - .../templates/khepri/css/template.css | 3 +- .../templates/khepri/css/template_rtl.css | 1 - .../templates/khepri/html/index.html | 2 +- .../templates/khepri/images/header/index.html | 2 +- .../templates/khepri/images/index.html | 2 +- .../templates/khepri/images/menu/index.html | 2 +- .../khepri/images/toolbar/index.html | 2 +- administrator/templates/khepri/index.html | 2 +- administrator/templates/khepri/js/index.html | 2 +- administrator/templates/khepri/js/index.js | 1 - administrator/templates/khepri/js/menu.js | 1 - administrator/templates/khepri/login.php | 4 +- administrator/templates/system/css/index.html | 2 +- administrator/templates/system/error.php | 8 +- .../templates/system/html/index.html | 2 +- .../templates/system/images/index.html | 2 +- administrator/templates/system/index.html | 2 +- cache/index.html | 2 +- components/com_banners/banners.php | 2 +- components/com_banners/index.html | 2 +- components/com_banners/models/index.html | 2 +- components/com_contact/contact.php | 2 +- components/com_contact/controller.php | 174 +- components/com_contact/index.html | 2 +- components/com_contact/models/index.html | 2 +- components/com_contact/router.php | 30 +- .../com_contact/views/category/index.html | 2 +- .../views/category/tmpl/default.php | 8 +- .../views/category/tmpl/default_items.php | 2 +- .../views/category/tmpl/index.html | 2 +- .../com_contact/views/category/view.html.php | 28 +- .../com_contact/views/contact/index.html | 2 +- .../views/contact/tmpl/default.php | 10 +- .../com_contact/views/contact/tmpl/index.html | 2 +- .../com_contact/views/contact/view.html.php | 14 +- .../com_contact/views/contact/view.vcard.php | 101 + components/com_contact/views/index.html | 2 +- .../com_contactdirectory/contactdirectory.php | 16 + .../com_contactdirectory/controller.php | 85 + .../css/contactdirectory.css | 29 + .../com_contactdirectory/css/index.html | 1 + .../com_contactdirectory/includes/index.html | 1 + .../includes/securimage/LICENSE.txt | 64 +- .../includes/securimage/README.txt | 57 + .../includes/securimage/artistamp.ttf | Bin 0 -> 163812 bytes .../includes/securimage/elephant.ttf | Bin 0 -> 51652 bytes .../includes/securimage/gdfonts/automatic.gdf | Bin 0 -> 61196 bytes .../securimage/gdfonts/bubblebath.gdf | Bin 0 -> 67516 bytes .../includes/securimage/gdfonts/caveman.gdf | Bin 0 -> 160540 bytes .../includes/securimage/gdfonts/crass.gdf | Bin 0 -> 39691 bytes .../includes/securimage/images/audio_icon.gif | Bin 0 -> 621 bytes .../includes/securimage/images/pattern.gif | Bin 0 -> 8324 bytes .../includes/securimage/images/refresh.gif | Bin 0 -> 865 bytes .../includes/securimage/index.html | 1 + .../includes/securimage/securimage.php | 932 +++ .../securimage/securimage_example.php | 6 + .../includes/securimage/securimage_play.php | 16 + .../includes/securimage/securimage_show.php | 9 + components/com_contactdirectory/index.html | 1 + components/com_contactdirectory/metadata.xml | 3 + .../models/categories.php | 269 + .../com_contactdirectory/models/category.php | 309 + .../com_contactdirectory/models/contact.php | 350 ++ .../com_contactdirectory/models/index.html | 1 + components/com_contactdirectory/router.php | 306 + .../views/categories/index.html | 1 + .../views/categories/metadata.xml | 6 + .../views/categories/tmpl/default.php | 99 + .../views/categories/tmpl/default.xml | 73 + .../views/categories/tmpl/default_groupby.php | 132 + .../views/categories/tmpl/default_list.php | 120 + .../views/categories/tmpl/index.html | 1 + .../views/categories/view.html.php | 176 + .../views/category/index.html | 1 + .../views/category/metadata.xml | 6 + .../views/category/tmpl/default.php | 215 + .../views/category/tmpl/default.xml | 62 + .../views/category/tmpl/index.html | 1 + .../views/category/view.html.php | 172 + .../views/contact/index.html | 1 + .../views/contact/metadata.xml | 6 + .../views/contact/tmpl/default.php | 157 + .../views/contact/tmpl/default.xml | 16 + .../views/contact/tmpl/default_form.php | 96 + .../views/contact/tmpl/index.html | 1 + .../views/contact/view.html.php | 241 + .../com_contactdirectory/views/index.html | 1 + components/com_content/content.php | 6 +- components/com_content/controller.php | 4 +- components/com_content/helpers/icon.php | 8 +- components/com_content/helpers/index.html | 2 +- components/com_content/index.html | 2 +- components/com_content/models/archive.php | 3 +- components/com_content/models/article.php | 1226 ++-- components/com_content/models/category.php | 13 +- components/com_content/models/frontpage.php | 5 +- components/com_content/models/index.html | 2 +- components/com_content/models/section.php | 22 +- components/com_content/router.php | 79 +- .../com_content/views/archive/index.html | 2 +- .../views/archive/tmpl/default.php | 2 +- .../com_content/views/archive/tmpl/index.html | 2 +- .../com_content/views/archive/view.html.php | 18 +- .../com_content/views/article/index.html | 2 +- .../views/article/tmpl/default.php | 17 +- .../com_content/views/article/tmpl/form.php | 8 +- .../com_content/views/article/tmpl/index.html | 2 +- .../com_content/views/article/view.html.php | 720 +-- .../com_content/views/category/index.html | 2 +- .../com_content/views/category/tmpl/blog.php | 4 +- .../views/category/tmpl/blog_item.php | 12 +- .../views/category/tmpl/blog_links.php | 2 +- .../views/category/tmpl/default.php | 8 +- .../views/category/tmpl/default.xml | 11 + .../views/category/tmpl/default_items.php | 2 +- .../views/category/tmpl/index.html | 2 +- .../com_content/views/category/view.feed.php | 9 +- .../com_content/views/category/view.html.php | 76 +- .../com_content/views/frontpage/index.html | 2 +- .../views/frontpage/tmpl/default.php | 6 +- .../views/frontpage/tmpl/default_item.php | 4 +- .../views/frontpage/tmpl/index.html | 2 +- .../com_content/views/frontpage/view.html.php | 320 +- components/com_content/views/index.html | 2 +- .../com_content/views/section/index.html | 2 +- .../views/section/tmpl/blog_item.php | 2 +- .../views/section/tmpl/blog_links.php | 2 +- .../views/section/tmpl/default.php | 8 +- .../views/section/tmpl/default.xml | 2 +- .../com_content/views/section/tmpl/index.html | 2 +- .../com_content/views/section/view.feed.php | 8 +- .../com_content/views/section/view.html.php | 354 +- components/com_mailto/assets/index.html | 2 +- components/com_mailto/index.html | 2 +- components/com_mailto/mailto.php | 2 +- components/com_mailto/views/index.html | 2 +- components/com_mailto/views/mailto/index.html | 2 +- .../com_mailto/views/mailto/tmpl/default.php | 2 +- .../com_mailto/views/mailto/tmpl/index.html | 2 +- components/com_mailto/views/sent/index.html | 2 +- .../com_mailto/views/sent/tmpl/index.html | 2 +- components/com_media/assets/index.html | 2 +- .../com_media/assets/popup-imagelist.css | 1 - .../com_media/assets/popup-imagemanager.css | 1 - .../com_media/assets/popup-imagemanager.js | 2 - components/com_media/helpers/index.html | 2 +- components/com_media/index.html | 2 +- components/com_media/media.php | 8 +- components/com_newsfeeds/index.html | 2 +- .../com_newsfeeds/models/categories.php | 1 - components/com_newsfeeds/models/category.php | 1 - components/com_newsfeeds/models/index.html | 2 +- components/com_newsfeeds/models/newsfeed.php | 1 - components/com_newsfeeds/newsfeeds.php | 8 +- .../com_newsfeeds/views/categories/index.html | 2 +- .../views/categories/tmpl/default.php | 4 +- .../views/categories/tmpl/index.html | 2 +- .../views/categories/view.html.php | 16 + .../com_newsfeeds/views/category/index.html | 2 +- .../views/category/tmpl/default.php | 6 +- .../views/category/tmpl/default_items.php | 2 +- .../views/category/tmpl/index.html | 2 +- .../views/category/view.html.php | 18 +- components/com_newsfeeds/views/index.html | 2 +- .../com_newsfeeds/views/newsfeed/index.html | 2 +- .../views/newsfeed/tmpl/default.php | 10 +- .../views/newsfeed/tmpl/index.html | 2 +- .../views/newsfeed/view.html.php | 32 +- components/com_poll/assets/index.html | 2 +- components/com_poll/controller.php | 3 +- components/com_poll/index.html | 2 +- components/com_poll/models/index.html | 2 +- components/com_poll/models/poll.php | 8 +- components/com_poll/poll.php | 4 +- components/com_poll/router.php | 2 +- components/com_poll/views/index.html | 2 +- components/com_poll/views/poll/index.html | 2 +- .../com_poll/views/poll/tmpl/default.php | 4 +- .../com_poll/views/poll/tmpl/index.html | 2 +- components/com_poll/views/poll/view.html.php | 21 +- components/com_search/controller.php | 2 +- components/com_search/index.html | 2 +- components/com_search/models/index.html | 2 +- components/com_search/models/search.php | 16 +- components/com_search/search.php | 4 +- components/com_search/views/index.html | 2 +- components/com_search/views/search/index.html | 2 +- .../com_search/views/search/tmpl/default.php | 2 +- .../com_search/views/search/tmpl/index.html | 2 +- .../com_search/views/search/view.html.php | 49 +- components/com_user/controller.php | 20 +- components/com_user/index.html | 2 +- components/com_user/models/index.html | 2 +- components/com_user/models/remind.php | 3 +- components/com_user/models/reset.php | 8 +- components/com_user/models/user.php | 1 - components/com_user/router.php | 27 +- components/com_user/user.php | 2 +- components/com_user/views/index.html | 2 +- components/com_user/views/login/index.html | 2 +- .../views/login/tmpl/default_logout.php | 2 +- .../com_user/views/login/tmpl/index.html | 2 +- components/com_user/views/register/index.html | 2 +- .../com_user/views/register/tmpl/default.php | 6 +- .../com_user/views/register/tmpl/index.html | 2 +- .../com_user/views/register/view.html.php | 21 +- components/com_user/views/remind/index.html | 2 +- .../com_user/views/remind/tmpl/default.php | 10 +- .../com_user/views/remind/tmpl/index.html | 2 +- .../com_user/views/remind/view.html.php | 26 +- components/com_user/views/reset/index.html | 2 +- .../com_user/views/reset/tmpl/complete.php | 2 +- .../com_user/views/reset/tmpl/confirm.php | 2 +- .../com_user/views/reset/tmpl/default.php | 10 +- .../com_user/views/reset/tmpl/index.html | 2 +- components/com_user/views/reset/view.html.php | 24 +- components/com_user/views/user/index.html | 2 +- .../com_user/views/user/tmpl/default.php | 8 +- components/com_user/views/user/tmpl/form.php | 10 +- .../com_user/views/user/tmpl/index.html | 2 +- components/com_user/views/user/view.html.php | 39 +- components/com_weblinks/controller.php | 20 + .../com_weblinks/controllers/index.html | 2 +- .../com_weblinks/controllers/weblink.php | 9 +- components/com_weblinks/helpers/index.html | 2 +- components/com_weblinks/helpers/query.php | 91 + components/com_weblinks/helpers/route.php | 24 +- components/com_weblinks/index.html | 2 +- components/com_weblinks/models/categories.php | 5 +- components/com_weblinks/models/category.php | 4 +- components/com_weblinks/models/index.html | 2 +- components/com_weblinks/models/weblink.php | 34 +- components/com_weblinks/models/weblinks.php | 196 + components/com_weblinks/router.php | 36 +- .../com_weblinks/views/categories/index.html | 2 +- .../views/categories/tmpl/default.php | 8 +- .../views/categories/tmpl/index.html | 2 +- .../views/categories/view.html.php | 16 + .../com_weblinks/views/category/index.html | 2 +- .../views/category/tmpl/default.php | 20 +- .../views/category/tmpl/default_items.php | 26 + .../views/category/tmpl/index.html | 2 +- .../com_weblinks/views/category/view.html.php | 67 +- components/com_weblinks/views/index.html | 2 +- .../com_weblinks/views/weblink/index.html | 2 +- .../com_weblinks/views/weblink/tmpl/form.php | 14 +- .../views/weblink/tmpl/index.html | 2 +- .../com_weblinks/views/weblink/view.html.php | 56 +- .../com_weblinks/views/weblinks/index.html | 1 + .../com_weblinks/views/weblinks/metadata.xml | 6 + .../views/weblinks/tmpl/default.php | 14 + .../views/weblinks/tmpl/default.xml | 35 + .../views/weblinks/tmpl/default_items.php | 104 + .../views/weblinks/tmpl/index.html | 1 + .../com_weblinks/views/weblinks/view.html.php | 151 + components/com_weblinks/weblinks.php | 6 +- components/com_wrapper/index.html | 2 +- components/com_wrapper/router.php | 2 +- components/com_wrapper/views/index.html | 2 +- .../com_wrapper/views/wrapper/index.html | 2 +- .../views/wrapper/tmpl/default.php | 2 +- .../com_wrapper/views/wrapper/tmpl/index.html | 2 +- components/com_wrapper/views/wrapper/view.php | 16 +- components/com_wrapper/wrapper.php | 3 +- components/index.html | 2 +- htaccess.txt | 36 +- images/M_images/index.html | 2 +- images/banners/index.html | 2 +- images/index.html | 2 +- images/smilies/index.html | 2 +- images/stories/food/index.html | 2 +- images/stories/fruit/index.html | 2 +- images/stories/index.html | 2 +- includes/Archive/Tar.php | 7 - includes/Archive/index.html | 1 - includes/HTML_toolbar.php | 7 - includes/PEAR/PEAR.php | 7 - includes/PEAR/index.html | 1 - includes/application.php | 31 +- includes/database.mysqli.php | 23 - includes/database.php | 26 - includes/defines.php | 2 +- includes/domit/index.html | 1 - includes/domit/xml_domit_include.php | 7 - includes/domit/xml_domit_lite_include.php | 7 - includes/domit/xml_domit_lite_parser.php | 7 - includes/domit/xml_domit_rss.php | 7 - includes/domit/xml_domit_rss_lite.php | 7 - includes/feedcreator.class.php | 7 - includes/framework.php | 5 +- includes/gacl.class.php | 7 - includes/gacl_api.class.php | 7 - includes/index.html | 2 +- includes/joomla.php | 7 - includes/js/JSCookMenu.js | 1143 ---- includes/js/JSCookMenu_mini.js | 292 - includes/js/ThemeOffice/add_section.png | Bin 916 -> 0 bytes includes/js/ThemeOffice/arrow.png | Bin 174 -> 0 bytes includes/js/ThemeOffice/arrow_rtl.png | Bin 180 -> 0 bytes includes/js/ThemeOffice/backup.png | Bin 784 -> 0 bytes includes/js/ThemeOffice/blank.png | Bin 151 -> 0 bytes includes/js/ThemeOffice/categories.png | Bin 914 -> 0 bytes includes/js/ThemeOffice/checkin.png | Bin 871 -> 0 bytes includes/js/ThemeOffice/component.png | Bin 900 -> 0 bytes includes/js/ThemeOffice/config.png | Bin 716 -> 0 bytes includes/js/ThemeOffice/content.png | Bin 907 -> 0 bytes includes/js/ThemeOffice/controlpanel.png | Bin 911 -> 0 bytes includes/js/ThemeOffice/credits.png | Bin 888 -> 0 bytes includes/js/ThemeOffice/db.png | Bin 902 -> 0 bytes includes/js/ThemeOffice/document.png | Bin 779 -> 0 bytes includes/js/ThemeOffice/edit.png | Bin 935 -> 0 bytes includes/js/ThemeOffice/globe1.png | Bin 919 -> 0 bytes includes/js/ThemeOffice/globe2.png | Bin 885 -> 0 bytes includes/js/ThemeOffice/globe3.png | Bin 940 -> 0 bytes includes/js/ThemeOffice/globe4.png | Bin 28913 -> 0 bytes includes/js/ThemeOffice/help.png | Bin 868 -> 0 bytes includes/js/ThemeOffice/home.png | Bin 894 -> 0 bytes includes/js/ThemeOffice/index.html | 4 - includes/js/ThemeOffice/install.png | Bin 915 -> 0 bytes includes/js/ThemeOffice/language.png | Bin 895 -> 0 bytes includes/js/ThemeOffice/license.png | Bin 860 -> 0 bytes includes/js/ThemeOffice/mail.png | Bin 566 -> 0 bytes includes/js/ThemeOffice/mass_email.png | Bin 922 -> 0 bytes includes/js/ThemeOffice/media.png | Bin 909 -> 0 bytes includes/js/ThemeOffice/menus.png | Bin 908 -> 0 bytes includes/js/ThemeOffice/messaging.png | Bin 901 -> 0 bytes includes/js/ThemeOffice/messaging_config.png | Bin 933 -> 0 bytes includes/js/ThemeOffice/messaging_inbox.png | Bin 920 -> 0 bytes includes/js/ThemeOffice/module.png | Bin 867 -> 0 bytes includes/js/ThemeOffice/preview.png | Bin 941 -> 0 bytes includes/js/ThemeOffice/query.png | Bin 912 -> 0 bytes includes/js/ThemeOffice/restore.png | Bin 891 -> 0 bytes includes/js/ThemeOffice/search_text.png | Bin 935 -> 0 bytes includes/js/ThemeOffice/sections.png | Bin 385 -> 0 bytes includes/js/ThemeOffice/spacer.png | Bin 58 -> 0 bytes includes/js/ThemeOffice/statistics.png | Bin 891 -> 0 bytes includes/js/ThemeOffice/sysinfo.png | Bin 882 -> 0 bytes includes/js/ThemeOffice/template.png | Bin 926 -> 0 bytes includes/js/ThemeOffice/theme.css | 292 - includes/js/ThemeOffice/theme.js | 45 - includes/js/ThemeOffice/tooltip.png | Bin 748 -> 0 bytes includes/js/ThemeOffice/trash.png | Bin 936 -> 0 bytes includes/js/ThemeOffice/tux.png | Bin 598 -> 0 bytes includes/js/ThemeOffice/user.png | Bin 818 -> 0 bytes includes/js/ThemeOffice/users.png | Bin 878 -> 0 bytes includes/js/ThemeOffice/users_add.png | Bin 934 -> 0 bytes includes/js/calendar/README | 31 - includes/js/calendar/calendar-mos.css | 178 - includes/js/calendar/calendar.js | 1294 ----- includes/js/calendar/calendar_mini.js | 193 - includes/js/calendar/index.html | 4 - includes/js/calendar/lang/calendar-en-GB.js | 45 - includes/js/calendar/lang/index.html | 1 - includes/js/dtree/dtree.css | 36 - includes/js/dtree/dtree.js | 55 - includes/js/dtree/dtree_rtl.css | 36 - includes/js/dtree/img/archive.gif | Bin 597 -> 0 bytes includes/js/dtree/img/base.gif | Bin 1022 -> 0 bytes includes/js/dtree/img/cd.gif | Bin 239 -> 0 bytes includes/js/dtree/img/empty.gif | Bin 62 -> 0 bytes includes/js/dtree/img/folder.gif | Bin 614 -> 0 bytes includes/js/dtree/img/folderopen.gif | Bin 623 -> 0 bytes includes/js/dtree/img/frontpage.gif | Bin 581 -> 0 bytes includes/js/dtree/img/globe.gif | Bin 1095 -> 0 bytes includes/js/dtree/img/imgfolder.gif | Bin 596 -> 0 bytes includes/js/dtree/img/index.html | 1 - includes/js/dtree/img/join.gif | Bin 69 -> 0 bytes includes/js/dtree/img/joinbottom.gif | Bin 66 -> 0 bytes includes/js/dtree/img/line.gif | Bin 66 -> 0 bytes includes/js/dtree/img/minus.gif | Bin 211 -> 0 bytes includes/js/dtree/img/minusbottom.gif | Bin 209 -> 0 bytes includes/js/dtree/img/musicfolder.gif | Bin 633 -> 0 bytes includes/js/dtree/img/nolines_minus.gif | Bin 273 -> 0 bytes includes/js/dtree/img/nolines_plus.gif | Bin 274 -> 0 bytes includes/js/dtree/img/page.gif | Bin 574 -> 0 bytes includes/js/dtree/img/plus.gif | Bin 214 -> 0 bytes includes/js/dtree/img/plusbottom.gif | Bin 211 -> 0 bytes includes/js/dtree/img/question.gif | Bin 1044 -> 0 bytes includes/js/dtree/img/square.gif | Bin 597 -> 0 bytes includes/js/dtree/img/trash.gif | Bin 576 -> 0 bytes includes/js/dtree/index.html | 1 - includes/js/dtree/rtl_img/archive.gif | Bin 597 -> 0 bytes includes/js/dtree/rtl_img/base.gif | Bin 1022 -> 0 bytes includes/js/dtree/rtl_img/cd.gif | Bin 239 -> 0 bytes includes/js/dtree/rtl_img/empty.gif | Bin 62 -> 0 bytes includes/js/dtree/rtl_img/folder.gif | Bin 614 -> 0 bytes includes/js/dtree/rtl_img/folderopen.gif | Bin 623 -> 0 bytes includes/js/dtree/rtl_img/frontpage.gif | Bin 581 -> 0 bytes includes/js/dtree/rtl_img/globe.gif | Bin 1095 -> 0 bytes includes/js/dtree/rtl_img/imgfolder.gif | Bin 596 -> 0 bytes includes/js/dtree/rtl_img/index.html | 1 - includes/js/dtree/rtl_img/join.gif | Bin 67 -> 0 bytes includes/js/dtree/rtl_img/joinbottom.gif | Bin 64 -> 0 bytes includes/js/dtree/rtl_img/line.gif | Bin 65 -> 0 bytes includes/js/dtree/rtl_img/minus.gif | Bin 211 -> 0 bytes includes/js/dtree/rtl_img/minusbottom.gif | Bin 209 -> 0 bytes includes/js/dtree/rtl_img/musicfolder.gif | Bin 633 -> 0 bytes includes/js/dtree/rtl_img/nolines_minus.gif | Bin 311 -> 0 bytes includes/js/dtree/rtl_img/nolines_plus.gif | Bin 312 -> 0 bytes includes/js/dtree/rtl_img/page.gif | Bin 574 -> 0 bytes includes/js/dtree/rtl_img/plus.gif | Bin 215 -> 0 bytes includes/js/dtree/rtl_img/plusbottom.gif | Bin 212 -> 0 bytes includes/js/dtree/rtl_img/question.gif | Bin 1044 -> 0 bytes includes/js/dtree/rtl_img/square.gif | Bin 597 -> 0 bytes includes/js/dtree/rtl_img/trash.gif | Bin 576 -> 0 bytes includes/js/index.html | 4 - .../jscalendar-1.0/calendar-setup_stripped.js | 21 - .../js/jscalendar-1.0/calendar-system.css | 251 - .../js/jscalendar-1.0/calendar_stripped.js | 14 - includes/js/jscalendar-1.0/index.html | 1 - .../js/jscalendar-1.0/lang/calendar-en.js | 127 - includes/js/jscalendar-1.0/lang/cn_utf8.js | 123 - includes/js/jscalendar-1.0/lang/index.html | 1 - includes/js/jscalendar-1.0/menuarrow.gif | Bin 68 -> 0 bytes includes/js/jscalendar-1.0/menuarrow2.gif | Bin 49 -> 0 bytes includes/js/mambojavascript.js | 542 -- includes/js/overlib_hideform_mini.js | 33 - includes/js/overlib_mini.js | 322 -- includes/js/tabs/index.html | 1 - includes/js/tabs/tab_active_l.png | Bin 195 -> 0 bytes includes/js/tabs/tab_active_r.png | Bin 254 -> 0 bytes includes/js/tabs/tab_hover_l.png | Bin 265 -> 0 bytes includes/js/tabs/tab_hover_r.png | Bin 336 -> 0 bytes includes/js/tabs/tab_l.png | Bin 276 -> 0 bytes includes/js/tabs/tab_r.png | Bin 348 -> 0 bytes includes/js/tabs/tabpane.css | 85 - includes/js/tabs/tabpane.js | 368 -- includes/js/tabs/tabpane_mini.js | 86 - includes/js/tabs/tabpane_rtl.css | 83 - includes/js/wz_tooltip.js | 477 -- includes/mambo.php | 7 - includes/mamboxml.php | 7 - includes/menu.php | 4 +- includes/pageNavigation.php | 7 - includes/pathway.php | 12 +- includes/phpInputFilter/class.inputfilter.php | 7 - includes/phpInputFilter/index.html | 4 - includes/phpmailer/class.phpmailer.php | 7 - includes/phpmailer/class.smtp.php | 7 - includes/phpmailer/index.html | 1 - includes/router.php | 7 +- includes/vcard.class.php | 7 - index.php | 182 +- index2.php | 15 - installation/includes/application.php | 357 +- installation/includes/bigdump.php | 916 +-- installation/includes/defines.php | 60 +- installation/includes/framework.php | 116 +- installation/includes/index.html | 2 +- installation/includes/js/index.html | 2 +- installation/includes/js/installation.js | 54 +- installation/includes/js/xajax.js | 80 +- .../includes/js/xajax_uncompressed.js | 80 +- installation/includes/router.php | 103 +- installation/includes/xajax/index.html | 2 +- installation/index.php | 72 +- installation/installer/controller.php | 35 +- installation/installer/helper.php | 102 +- installation/installer/index.html | 2 +- installation/installer/installer.php | 4 +- installation/installer/jajax.php | 565 +- installation/installer/models/index.html | 2 +- installation/installer/models/model.php | 276 +- installation/installer/views/index.html | 2 +- .../installer/views/install/index.html | 2 +- .../installer/views/install/tmpl/default.php | 69 + .../views/install/tmpl/default_dbconfig.php} | 137 +- .../views/install/tmpl/default_error.php | 87 + .../views/install/tmpl/default_finish.php | 144 + .../views/install/tmpl/default_ftpconfig.php} | 108 +- .../views/install/tmpl/default_lang.php | 105 + .../views/install/tmpl/default_license.php | 70 + .../views/install/tmpl/default_mainconfig.php | 411 ++ .../views/install/tmpl/default_migration.php} | 88 +- .../views/install/tmpl/default_preinstall.php | 170 + .../installer/views/install/tmpl/index.html | 1 + .../views/install/tmpl/removedir.php | 28 +- installation/installer/views/install/view.php | 224 +- installation/language/af-ZA/af-ZA.ini | 235 - installation/language/af-ZA/af-ZA.xml | 22 - installation/language/af-ZA/index.html | 1 - installation/language/ar-DZ/ar-DZ.ini | 235 - installation/language/ar-DZ/ar-DZ.xml | 21 - installation/language/ar-DZ/index.html | 1 - installation/language/be-BY/be-BY.ini | 242 + installation/language/be-BY/be-BY.xml | 21 + installation/language/be-BY/index.html | 1 + installation/language/bg-BG/bg-BG.ini | 13 +- installation/language/bg-BG/bg-BG.xml | 5 +- installation/language/bg-BG/index.htm | 6 + installation/language/bg-BG/index.html | 6 - installation/language/bn-IN/bn-IN.ini | 475 +- installation/language/bn-IN/bn-IN.xml | 5 +- installation/language/bn-IN/index.html | 1 + installation/language/bs-BA/bs-BA.ini | 475 +- installation/language/bs-BA/bs-BA.xml | 8 +- installation/language/bs-BA/index.html | 2 +- installation/language/ca-ES/ca-ES.ini | 243 + installation/language/ca-ES/ca-ES.xml | 22 + installation/language/ca-ES/index.htm | 6 + installation/language/cs-CZ/cs-CZ.ini | 478 +- installation/language/cs-CZ/cs-CZ.xml | 5 +- installation/language/da-DK/da-DK.ini | 35 +- installation/language/da-DK/da-DK.xml | 14 +- installation/language/da-DK/index.htm | 6 + installation/language/da-DK/index.html | 0 installation/language/de-AT/de-AT.ini | 476 +- installation/language/de-AT/de-AT.xml | 4 +- installation/language/de-AT/index.html | 2 +- installation/language/de-CH/de-CH.ini | 477 +- installation/language/de-CH/de-CH.xml | 4 +- installation/language/de-CH/index.htm | 6 + installation/language/de-CH/index.html | 1 - installation/language/de-DE/de-DE.ini | 477 +- installation/language/de-DE/de-DE.xml | 40 +- installation/language/de-DE/index.htm | 6 + installation/language/de-DE/index.html | 1 - installation/language/el-GR/el-GR.ini | 395 +- installation/language/el-GR/el-GR.xml | 8 +- installation/language/el-GR/index.htm | 6 + installation/language/el-GR/index.html | 1 - installation/language/en-GB/en-GB.ini | 190 +- installation/language/en-GB/en-GB.xml | 15 +- installation/language/en-GB/index.html | 4 +- installation/language/en-US/en-US.ini | 241 + installation/language/en-US/en-US.xml | 28 + installation/language/en-US/index.htm | 6 + installation/language/eo-XX/eo-XX.ini | 19 +- installation/language/eo-XX/eo-XX.xml | 7 +- installation/language/eo-XX/index.html | 2 +- installation/language/es-ES/es-ES.ini | 479 +- installation/language/es-ES/es-ES.xml | 36 +- installation/language/es-ES/index.htm | 6 + installation/language/es-ES/index.html | 1 - installation/language/eu-ES/eu-ES.ini | 480 +- installation/language/eu-ES/eu-ES.xml | 34 +- installation/language/fa-IR/fa-IR.ini | 11 +- installation/language/fa-IR/fa-IR.xml | 4 +- installation/language/fa-IR/index.html | 2 +- installation/language/fi-FI/fi-FI.ini | 24 +- installation/language/fi-FI/fi-FI.xml | 4 +- installation/language/fi-FI/index.html | 2 +- installation/language/fr-FR/fr-FR.ini | 29 +- installation/language/fr-FR/fr-FR.xml | 37 +- installation/language/fr-FR/index.html | 2 +- installation/language/he-IL/he-IL.ini | 17 +- installation/language/he-IL/he-IL.xml | 8 +- installation/language/he-IL/index.html | 2 +- installation/language/hi-IN/hi-IN.ini | 235 - installation/language/hi-IN/hi-IN.xml | 22 - installation/language/hi-IN/index.html | 1 - installation/language/hr-HR/hr-HR.ini | 475 +- installation/language/hr-HR/hr-HR.xml | 4 +- installation/language/hr-HR/index.html | 2 +- installation/language/hu-HU/hu-HU.ini | 475 +- installation/language/hu-HU/hu-HU.xml | 40 +- installation/language/hu-HU/index.htm | 6 + installation/language/hu-HU/index.html | 1 - installation/language/index.html | 4 +- installation/language/it-IT/index.htm | 6 + installation/language/it-IT/index.html | 1 - installation/language/it-IT/it-IT.ini | 475 +- installation/language/it-IT/it-IT.xml | 2 +- installation/language/ja-JP/index.html | 2 +- installation/language/ja-JP/ja-JP.ini | 29 +- installation/language/ja-JP/ja-JP.xml | 38 +- installation/language/ko-KR/index.html | 1 + installation/language/ko-KR/ko-KR.ini | 242 + installation/language/ko-KR/ko-KR.xml | 22 + installation/language/lo-LA/index.html | 2 +- installation/language/lo-LA/lo-LA.ini | 476 +- installation/language/lo-LA/lo-LA.xml | 38 +- installation/language/lt-LT/index.htm | 6 + installation/language/lt-LT/index.html | 1 - installation/language/lt-LT/lt-LT.ini | 476 +- installation/language/lt-LT/lt-LT.xml | 6 +- installation/language/lv-LV/index.html | 2 +- installation/language/lv-LV/lv-LV.ini | 478 +- installation/language/lv-LV/lv-LV.xml | 7 +- installation/language/nb-NO/index.htm | 6 + installation/language/nb-NO/index.html | 1 - installation/language/nb-NO/nb-NO.ini | 21 +- installation/language/nb-NO/nb-NO.xml | 40 +- installation/language/nl-NL/index.htm | 6 + installation/language/nl-NL/index.html | 0 installation/language/nl-NL/nl-NL.ini | 477 +- installation/language/nl-NL/nl-NL.xml | 30 +- installation/language/pl-PL/index.html | 2 +- installation/language/pl-PL/pl-PL.ini | 142 +- installation/language/pl-PL/pl-PL.xml | 11 +- installation/language/pt-BR/index.htm | 6 + installation/language/pt-BR/index.html | 1 - installation/language/pt-BR/pt-BR.ini | 75 +- installation/language/pt-BR/pt-BR.xml | 44 +- installation/language/pt-PT/index.html | 2 +- installation/language/pt-PT/pt-PT.ini | 475 +- installation/language/pt-PT/pt-PT.xml | 12 +- installation/language/ro-RO/index.htm | 6 + installation/language/ro-RO/index.html | 1 - installation/language/ro-RO/ro-RO.ini | 478 +- installation/language/ro-RO/ro-RO.xml | 4 +- installation/language/ru-RU/index.html | 2 +- installation/language/ru-RU/ru-RU.ini | 539 +- installation/language/ru-RU/ru-RU.xml | 22 +- installation/language/sd-PK/index.html | 1 + installation/language/sd-PK/sd-PK.ini | 242 + installation/language/sd-PK/sd-PK.xml | 22 + installation/language/si-LK/index.htm | 6 + installation/language/si-LK/si-LK.ini | 242 + installation/language/si-LK/si-LK.xml | 23 + installation/language/sk-SK/index.html | 2 +- installation/language/sk-SK/sk-SK.ini | 475 +- installation/language/sk-SK/sk-SK.xml | 7 +- installation/language/sr-ME/index.html | 2 +- installation/language/sr-ME/sr-ME.ini | 409 +- installation/language/sr-ME/sr-ME.xml | 38 +- installation/language/sr-RS/index.htm | 6 + installation/language/sr-RS/index.html | 1 - installation/language/sr-RS/sr-RS.ini | 479 +- installation/language/sr-RS/sr-RS.xml | 42 +- installation/language/sv-SE/index.htm | 6 + installation/language/sv-SE/index.html | 1 - installation/language/sv-SE/sv-SE.ini | 477 +- installation/language/sv-SE/sv-SE.xml | 34 +- installation/language/sy-IQ/index.html | 1 + installation/language/sy-IQ/sy-IQ.ini | 242 + installation/language/sy-IQ/sy-IQ.xml | 21 + installation/language/ta-LK/index.html | 1 + installation/language/ta-LK/ta-LK.ini | 242 + installation/language/ta-LK/ta-LK.xml | 22 + installation/language/th-TH/index.html | 2 +- installation/language/th-TH/th-TH.ini | 475 +- installation/language/th-TH/th-TH.xml | 38 +- installation/language/tr-TR/index.htm | 6 + installation/language/tr-TR/index.html | 1 - installation/language/tr-TR/tr-TR.ini | 196 +- installation/language/tr-TR/tr-TR.xml | 36 +- installation/language/uk-UA/index.html | 2 +- installation/language/uk-UA/uk-UA.ini | 476 +- installation/language/uk-UA/uk-UA.xml | 41 +- installation/language/vi-VN/index.html | 2 +- installation/language/vi-VN/vi-VN.ini | 477 +- installation/language/vi-VN/vi-VN.xml | 36 +- installation/language/zh-TW/index.html | 2 +- installation/language/zh-TW/zh-TW.ini | 475 +- installation/language/zh-TW/zh-TW.xml | 36 +- installation/sql/index.html | 2 +- installation/sql/migration/index.html | 2 +- installation/sql/mysql/diff.sql | 5 - installation/sql/mysql/diff_15_to_16.sql | 350 ++ installation/sql/mysql/diff_rc1_to_rc2.sql | 30 - installation/sql/mysql/diff_rc2_to_rc3.sql | 5 - installation/sql/mysql/diff_rc3_to_rc4.sql | 54 - installation/sql/mysql/index.html | 2 +- installation/sql/mysql/joomla.sql | 440 +- installation/sql/mysql/joomla_backward.sql | 839 --- installation/sql/mysql/sample_data.sql | 178 +- installation/template/css/index.html | 2 +- installation/template/css/template_rtl.css | 144 +- installation/template/images/index.html | 2 +- installation/template/index.html | 2 +- installation/template/index.php | 92 +- installation/template/js/index.html | 2 +- installation/template/js/validation.js | 485 +- installation/template/tmpl/configuration.html | 74 - installation/template/tmpl/error.html | 88 - installation/template/tmpl/finish.html | 153 - installation/template/tmpl/index.html | 1 - installation/template/tmpl/language.html | 94 - installation/template/tmpl/license.html | 65 - installation/template/tmpl/mainconfig.html | 429 -- installation/template/tmpl/page.html | 63 - installation/template/tmpl/preinstall.html | 164 - installation/template/tmpl/removedir.html | 24 - language/en-GB/en-GB.com_banners.ini | 30 +- language/en-GB/en-GB.com_contact.ini | 10 +- language/en-GB/en-GB.com_contactdirectory.ini | 38 + language/en-GB/en-GB.com_content.ini | 228 +- language/en-GB/en-GB.com_frontpage.ini | 14 +- language/en-GB/en-GB.com_mailto.ini | 38 +- language/en-GB/en-GB.com_messages.ini | 4 +- language/en-GB/en-GB.com_newsfeeds.ini | 26 +- language/en-GB/en-GB.com_poll.ini | 38 +- language/en-GB/en-GB.com_search.ini | 10 +- language/en-GB/en-GB.com_user.ini | 292 +- language/en-GB/en-GB.com_weblinks.ini | 6 +- language/en-GB/en-GB.com_wrapper.ini | 16 +- language/en-GB/en-GB.ini | 59 +- language/en-GB/en-GB.mod_archive.ini | 22 +- language/en-GB/en-GB.mod_banners.ini | 54 +- language/en-GB/en-GB.mod_breadcrumbs.ini | 37 +- language/en-GB/en-GB.mod_custom.ini | 20 +- language/en-GB/en-GB.mod_feed.ini | 56 +- language/en-GB/en-GB.mod_footer.ini | 26 +- language/en-GB/en-GB.mod_latestnews.ini | 56 +- language/en-GB/en-GB.mod_login.ini | 16 +- language/en-GB/en-GB.mod_mainmenu.ini | 132 +- language/en-GB/en-GB.mod_mostread.ini | 40 +- language/en-GB/en-GB.mod_newsflash.ini | 59 +- language/en-GB/en-GB.mod_online.ini | 14 +- language/en-GB/en-GB.mod_poll.ini | 26 +- language/en-GB/en-GB.mod_random_image.ini | 42 +- language/en-GB/en-GB.mod_related_items.ini | 24 +- language/en-GB/en-GB.mod_search.ini | 50 +- language/en-GB/en-GB.mod_sections.ini | 26 +- language/en-GB/en-GB.mod_stats.ini | 64 +- language/en-GB/en-GB.mod_syndicate.ini | 30 +- language/en-GB/en-GB.mod_whosonline.ini | 50 +- language/en-GB/en-GB.mod_wrapper.ini | 52 +- language/en-GB/en-GB.plg_system_debug.ini | 52 +- language/en-GB/en-GB.tpl_rhuk_milkyway.ini | 18 +- language/en-GB/index.html | 2 +- language/index.html | 2 +- language/pdf_fonts/index.html | 2 +- libraries/bitfolge/feedcreator.php | 1883 ------- libraries/bitfolge/index.html | 1 - libraries/bitfolge/vcard.php | 208 - libraries/domit/index.html | 2 +- libraries/domit/php_http_connector.php | 4 +- .../domit/xml_domit_getelementsbypath.php | 6 +- libraries/domit/xml_domit_lite_parser.php | 106 +- libraries/domit/xml_domit_nodemaps.php | 22 +- libraries/domit/xml_domit_nodetools.php | 4 +- libraries/domit/xml_domit_parseattributes.php | 4 +- libraries/domit/xml_domit_parser.php | 224 +- libraries/domit/xml_domit_rss.php | 134 +- libraries/domit/xml_domit_rss_lite.php | 14 +- libraries/domit/xml_domit_rss_shared.php | 204 +- libraries/domit/xml_domit_utilities.php | 18 +- libraries/domit/xml_domit_xpath.php | 2 +- libraries/domit/xml_saxy_parser.php | 242 +- libraries/domit/xml_saxy_shared.php | 4 +- libraries/geshi/geshi/index.html | 2 +- libraries/geshi/index.html | 2 +- libraries/index.html | 2 +- libraries/joomla/application/application.php | 405 +- .../application/component/controller.php | 1445 ++--- .../joomla/application/component/helper.php | 412 +- .../joomla/application/component/index.html | 2 +- .../joomla/application/component/model.php | 73 +- .../joomla/application/component/view.php | 204 +- libraries/joomla/application/helper.php | 44 +- libraries/joomla/application/index.html | 2 +- libraries/joomla/application/menu.php | 577 +- .../joomla/application/module/helper.php | 150 +- .../joomla/application/module/index.html | 2 +- libraries/joomla/application/pathway.php | 429 +- libraries/joomla/application/router.php | 833 ++- libraries/joomla/base/index.html | 2 +- libraries/joomla/base/object.php | 244 +- libraries/joomla/base/observable.php | 272 +- libraries/joomla/base/observer.php | 111 +- libraries/joomla/base/stdclass.php | 189 + libraries/joomla/base/tree.php | 218 +- libraries/joomla/cache/cache.php | 633 ++- libraries/joomla/cache/handler/callback.php | 1 - libraries/joomla/cache/handler/index.html | 2 +- libraries/joomla/cache/handler/output.php | 1 - libraries/joomla/cache/handler/page.php | 6 +- libraries/joomla/cache/handler/view.php | 9 +- libraries/joomla/cache/index.html | 2 +- libraries/joomla/cache/storage.php | 357 +- libraries/joomla/cache/storage/apc.php | 309 +- .../joomla/cache/storage/eaccelerator.php | 329 +- libraries/joomla/cache/storage/file.php | 492 +- libraries/joomla/cache/storage/index.html | 2 +- libraries/joomla/cache/storage/memcache.php | 431 +- libraries/joomla/cache/storage/xcache.php | 25 - libraries/joomla/client/ftp.php | 84 +- libraries/joomla/client/helper.php | 14 +- libraries/joomla/client/index.html | 2 +- libraries/joomla/client/ldap.php | 884 +-- libraries/joomla/config.php | 62 +- libraries/joomla/database/database.php | 2092 ++++--- libraries/joomla/database/database/index.html | 2 +- libraries/joomla/database/database/mysql.php | 147 +- libraries/joomla/database/database/mysqli.php | 208 +- libraries/joomla/database/index.html | 2 +- libraries/joomla/database/query.php | 220 + libraries/joomla/database/recordset.php | 163 +- libraries/joomla/database/table.php | 249 +- libraries/joomla/database/table/acl.php | 56 + libraries/joomla/database/table/aro.php | 88 +- libraries/joomla/database/table/arogroup.php | 84 +- libraries/joomla/database/table/axogroup.php | 40 + libraries/joomla/database/table/axomap.php | 93 + libraries/joomla/database/table/category.php | 214 +- libraries/joomla/database/table/component.php | 228 +- libraries/joomla/database/table/content.php | 362 +- libraries/joomla/database/table/group.php | 105 + libraries/joomla/database/table/index.html | 2 +- libraries/joomla/database/table/menu.php | 246 +- libraries/joomla/database/table/menutypes.php | 178 +- libraries/joomla/database/table/module.php | 226 +- libraries/joomla/database/table/plugin.php | 266 +- libraries/joomla/database/table/section.php | 248 +- libraries/joomla/database/table/session.php | 430 +- libraries/joomla/database/table/tree.php | 98 + libraries/joomla/database/table/user.php | 160 +- libraries/joomla/document/document.php | 165 +- libraries/joomla/document/error/error.php | 342 +- libraries/joomla/document/error/index.html | 2 +- libraries/joomla/document/feed/feed.php | 93 +- libraries/joomla/document/feed/index.html | 2 +- .../joomla/document/feed/renderer/atom.php | 214 +- .../joomla/document/feed/renderer/index.html | 2 +- .../joomla/document/feed/renderer/rss.php | 346 +- libraries/joomla/document/html/html.php | 85 +- libraries/joomla/document/html/index.html | 2 +- .../document/html/renderer/component.php | 73 +- .../joomla/document/html/renderer/head.php | 317 +- .../joomla/document/html/renderer/index.html | 2 +- .../document/html/renderer/installation.php | 75 +- .../joomla/document/html/renderer/message.php | 155 +- .../joomla/document/html/renderer/module.php | 171 +- .../joomla/document/html/renderer/modules.php | 91 +- libraries/joomla/document/index.html | 2 +- libraries/joomla/document/pdf/index.html | 2 +- libraries/joomla/document/pdf/pdf.php | 496 +- libraries/joomla/document/raw/index.html | 2 +- libraries/joomla/document/raw/raw.php | 9 +- libraries/joomla/document/renderer.php | 148 +- libraries/joomla/document/vcard/index.html | 1 + libraries/joomla/document/vcard/vcard.php | 276 + libraries/joomla/environment/browser.php | 1713 +++--- libraries/joomla/environment/index.html | 2 +- libraries/joomla/environment/request.php | 104 +- libraries/joomla/environment/response.php | 65 +- libraries/joomla/environment/uri.php | 1480 +++-- libraries/joomla/error/error.php | 1205 ++-- libraries/joomla/error/exception.php | 558 +- libraries/joomla/error/index.html | 2 +- libraries/joomla/error/log.php | 21 +- libraries/joomla/error/profiler.php | 341 +- libraries/joomla/event/dispatcher.php | 341 +- libraries/joomla/event/event.php | 133 +- libraries/joomla/event/index.html | 2 +- libraries/joomla/factory.php | 185 +- libraries/joomla/filesystem/archive.php | 378 +- libraries/joomla/filesystem/archive/bzip2.php | 11 +- libraries/joomla/filesystem/archive/gzip.php | 13 +- .../joomla/filesystem/archive/index.html | 2 +- libraries/joomla/filesystem/archive/tar.php | 17 +- libraries/joomla/filesystem/archive/zip.php | 1005 ++-- libraries/joomla/filesystem/file.php | 645 +-- libraries/joomla/filesystem/filesystem.php | 168 + .../joomla/filesystem/filesystem/ftp.php | 132 + .../joomla/filesystem/filesystem/ftp.xml | 13 + .../joomla/filesystem/filesystem/php.php | 97 + .../joomla/filesystem/filesystem/ssh.php | 163 + .../joomla/filesystem/filesystem/ssh.xml | 13 + libraries/joomla/filesystem/folder.php | 937 ++-- libraries/joomla/filesystem/index.html | 2 +- libraries/joomla/filesystem/path.php | 542 +- libraries/joomla/filter/filterinput.php | 309 +- libraries/joomla/filter/filteroutput.php | 297 +- libraries/joomla/filter/index.html | 2 +- libraries/joomla/html/editor.php | 626 ++- libraries/joomla/html/form.php | 693 +++ libraries/joomla/html/html.php | 654 ++- libraries/joomla/html/html/behavior.php | 78 +- libraries/joomla/html/html/content.php | 100 +- libraries/joomla/html/html/email.php | 206 +- libraries/joomla/html/html/form.php | 76 +- libraries/joomla/html/html/grid.php | 349 +- libraries/joomla/html/html/image.php | 306 +- libraries/joomla/html/html/index.html | 2 +- libraries/joomla/html/html/list.php | 487 +- libraries/joomla/html/html/menu.php | 311 +- libraries/joomla/html/html/select.php | 20 +- libraries/joomla/html/index.html | 2 +- libraries/joomla/html/pagination.php | 162 +- libraries/joomla/html/pane.php | 598 +- libraries/joomla/html/parameter.php | 565 +- libraries/joomla/html/parameter/element.php | 197 +- .../html/parameter/element/calendar.php | 5 +- .../html/parameter/element/category.php | 155 +- .../joomla/html/parameter/element/editors.php | 121 +- .../html/parameter/element/filelist.php | 153 +- .../html/parameter/element/folderlist.php | 133 +- .../html/parameter/element/helpsites.php | 87 +- .../joomla/html/parameter/element/hidden.php | 89 +- .../html/parameter/element/imagelist.php | 87 +- .../joomla/html/parameter/element/index.html | 2 +- .../html/parameter/element/languages.php | 109 +- .../joomla/html/parameter/element/list.php | 97 +- .../joomla/html/parameter/element/menu.php | 96 +- .../html/parameter/element/menuitem.php | 253 +- .../html/parameter/element/password.php | 83 +- .../joomla/html/parameter/element/radio.php | 93 +- .../joomla/html/parameter/element/section.php | 95 +- .../joomla/html/parameter/element/spacer.php | 93 +- .../joomla/html/parameter/element/sql.php | 18 +- .../joomla/html/parameter/element/text.php | 19 +- .../html/parameter/element/textarea.php | 89 +- .../html/parameter/element/timezones.php | 176 +- .../html/parameter/element/usergroup.php | 118 +- libraries/joomla/html/parameter/index.html | 2 +- libraries/joomla/html/toolbar.php | 545 +- libraries/joomla/html/toolbar/button.php | 258 +- .../joomla/html/toolbar/button/confirm.php | 13 +- .../joomla/html/toolbar/button/custom.php | 99 +- libraries/joomla/html/toolbar/button/help.php | 163 +- .../joomla/html/toolbar/button/index.html | 2 +- libraries/joomla/html/toolbar/button/link.php | 147 +- .../joomla/html/toolbar/button/popup.php | 161 +- .../joomla/html/toolbar/button/separator.php | 99 +- .../joomla/html/toolbar/button/standard.php | 13 +- libraries/joomla/html/toolbar/index.html | 2 +- libraries/joomla/import.php | 118 +- libraries/joomla/index.html | 2 +- .../joomla/installer/adapters/component.php | 1439 ++--- .../joomla/installer/adapters/index.html | 2 +- .../joomla/installer/adapters/language.php | 413 +- .../joomla/installer/adapters/module.php | 809 +-- .../joomla/installer/adapters/plugin.php | 638 +-- .../joomla/installer/adapters/template.php | 388 +- libraries/joomla/installer/helper.php | 547 +- libraries/joomla/installer/index.html | 2 +- libraries/joomla/installer/installer.php | 2344 ++++---- libraries/joomla/language/help.php | 291 +- libraries/joomla/language/helper.php | 172 +- libraries/joomla/language/index.html | 2 +- libraries/joomla/language/language.php | 1210 ++-- libraries/joomla/mail/helper.php | 335 +- libraries/joomla/mail/index.html | 2 +- libraries/joomla/mail/mail.php | 639 ++- libraries/joomla/methods.php | 325 +- libraries/joomla/plugin/helper.php | 413 +- libraries/joomla/plugin/index.html | 2 +- libraries/joomla/plugin/plugin.php | 233 +- libraries/joomla/registry/format.php | 21 +- libraries/joomla/registry/format/index.html | 2 +- libraries/joomla/registry/format/ini.php | 5 +- libraries/joomla/registry/format/php.php | 9 +- libraries/joomla/registry/format/xml.php | 11 +- libraries/joomla/registry/index.html | 2 +- libraries/joomla/registry/registry.php | 1021 ++-- libraries/joomla/session/index.html | 2 +- libraries/joomla/session/session.php | 1459 +++-- libraries/joomla/session/storage.php | 360 +- libraries/joomla/session/storage/apc.php | 262 +- libraries/joomla/session/storage/database.php | 269 +- .../joomla/session/storage/eaccelerator.php | 264 +- libraries/joomla/session/storage/index.html | 2 +- libraries/joomla/session/storage/memcache.php | 50 +- libraries/joomla/session/storage/none.php | 158 +- libraries/joomla/session/storage/xcache.php | 41 +- libraries/joomla/template/index.html | 1 - .../template/module/function/index.html | 1 - libraries/joomla/template/module/index.html | 1 - .../template/module/modifier/index.html | 1 - libraries/joomla/template/tmpl/index.html | 1 - libraries/joomla/user/authentication.php | 544 +- libraries/joomla/user/authorization.php | 120 +- libraries/joomla/user/helper.php | 687 +-- libraries/joomla/user/index.html | 2 +- libraries/joomla/user/user.php | 1254 +++-- libraries/joomla/utilities/arrayhelper.php | 573 +- libraries/joomla/utilities/buffer.php | 21 +- libraries/joomla/utilities/compat/compat.php | 48 +- libraries/joomla/utilities/compat/index.html | 2 +- libraries/joomla/utilities/compat/php50x.php | 102 - libraries/joomla/utilities/date.php | 607 +- libraries/joomla/utilities/index.html | 2 +- libraries/joomla/utilities/simplecrypt.php | 23 +- libraries/joomla/utilities/simplexml.php | 80 +- libraries/joomla/utilities/string.php | 1167 ++-- libraries/joomla/utilities/utility.php | 365 +- libraries/joomla/version.php | 32 +- libraries/loader.php | 341 +- libraries/openid/Auth/OpenID.php | 610 +- libraries/openid/Auth/OpenID/Association.php | 486 +- libraries/openid/Auth/OpenID/BigMath.php | 686 ++- libraries/openid/Auth/OpenID/Consumer.php | 1696 +++--- libraries/openid/Auth/OpenID/CryptUtil.php | 160 +- .../openid/Auth/OpenID/DatabaseConnection.php | 196 +- .../openid/Auth/OpenID/DiffieHellman.php | 288 +- libraries/openid/Auth/OpenID/Discover.php | 390 +- libraries/openid/Auth/OpenID/DumbStore.php | 146 +- libraries/openid/Auth/OpenID/FileStore.php | 1266 +++-- libraries/openid/Auth/OpenID/HMACSHA1.php | 68 +- libraries/openid/Auth/OpenID/Interface.php | 305 +- libraries/openid/Auth/OpenID/KVForm.php | 180 +- libraries/openid/Auth/OpenID/MySQLStore.php | 116 +- libraries/openid/Auth/OpenID/Parse.php | 424 +- libraries/openid/Auth/OpenID/SQLStore.php | 1198 ++-- libraries/openid/Auth/OpenID/SQLiteStore.php | 70 +- libraries/openid/Auth/OpenID/Server.php | 1976 ++++--- .../openid/Auth/OpenID/ServerRequest.php | 12 +- libraries/openid/Auth/OpenID/TrustRoot.php | 433 +- libraries/openid/Auth/OpenID/URINorm.php | 346 +- libraries/openid/Auth/OpenID/index.html | 2 +- libraries/openid/Auth/index.html | 2 +- .../openid/Services/Yadis/HTTPFetcher.php | 118 +- libraries/openid/Services/Yadis/Manager.php | 866 +-- libraries/openid/Services/Yadis/Misc.php | 66 +- .../Services/Yadis/ParanoidHTTPFetcher.php | 282 +- libraries/openid/Services/Yadis/ParseHTML.php | 438 +- .../Services/Yadis/PlainHTTPFetcher.php | 432 +- libraries/openid/Services/Yadis/XML.php | 578 +- libraries/openid/Services/Yadis/XRDS.php | 680 ++- libraries/openid/Services/Yadis/XRI.php | 290 +- libraries/openid/Services/Yadis/XRIRes.php | 110 +- libraries/openid/Services/Yadis/Yadis.php | 376 +- libraries/openid/Services/Yadis/index.html | 2 +- libraries/openid/Services/index.html | 2 +- libraries/openid/index.html | 2 +- libraries/pattemplate/index.html | 2 +- libraries/pattemplate/patError.php | 66 +- libraries/pattemplate/patErrorManager.php | 120 +- libraries/pattemplate/patTemplate.php | 24 +- .../pattemplate/patTemplate/Dump/index.html | 2 +- .../pattemplate/patTemplate/Function/Img.php | 2 +- .../patTemplate/Function/index.html | 2 +- .../InputFilter/ShortModifiers.php | 10 +- .../patTemplate/InputFilter/index.html | 2 +- .../patTemplate/Modifier/HTML/Img.php | 2 +- .../patTemplate/Modifier/HTML/index.html | 2 +- .../patTemplate/Modifier/Numberformat.php | 14 +- .../patTemplate/Modifier/Truncate.php | 24 +- .../patTemplate/Modifier/index.html | 2 +- .../patTemplate/OutputFilter/Gzip.php | 6 +- .../patTemplate/OutputFilter/index.html | 2 +- .../pattemplate/patTemplate/Reader/DB.php | 2 +- .../pattemplate/patTemplate/Reader/index.html | 2 +- .../pattemplate/patTemplate/Stat/index.html | 2 +- .../patTemplate/TemplateCache/index.html | 2 +- libraries/pattemplate/patTemplate/index.html | 2 +- libraries/pear/archive_tar/index.html | 2 +- libraries/pear/index.html | 2 +- libraries/phpgacl/gacl.php | 8 +- libraries/phpgacl/gacl_api.php | 116 +- libraries/phpgacl/index.html | 2 +- libraries/phpinputfilter/index.html | 4 - libraries/phpinputfilter/inputfilter.php | 551 -- libraries/phpmailer/index.html | 2 +- libraries/phpmailer/language/index.html | 2 +- .../phpmailer/language/phpmailer.lang-en.php | 4 +- libraries/phpmailer/phpmailer.php | 2946 +++++----- libraries/phpmailer/smtp.php | 2030 +++---- libraries/phputf8/LICENSE | 504 -- libraries/phputf8/README | 85 - libraries/phputf8/TODO.tsk | 4 - libraries/phputf8/index.html | 1 - libraries/phputf8/mbstring/case.php | 49 - libraries/phputf8/mbstring/core.php | 90 - libraries/phputf8/mbstring/index.html | 1 - libraries/phputf8/mbstring/strlen.php | 28 - libraries/phputf8/native/case.php | 206 - libraries/phputf8/native/core.php | 170 - libraries/phputf8/native/index.html | 1 - libraries/phputf8/native/strlen.php | 35 - libraries/phputf8/str_ireplace.php | 80 - libraries/phputf8/str_split.php | 35 - libraries/phputf8/strcasecmp.php | 26 - libraries/phputf8/strcspn.php | 41 - libraries/phputf8/stristr.php | 36 - libraries/phputf8/strrev.php | 22 - libraries/phputf8/strspn.php | 36 - libraries/phputf8/substr_replace.php | 24 - libraries/phputf8/trim.php | 68 - libraries/phputf8/ucfirst.php | 34 - libraries/phputf8/ucwords.php | 44 - libraries/phputf8/utf8.php | 88 - libraries/phputf8/utils/ascii.php | 212 - libraries/phputf8/utils/bad.php | 421 -- libraries/phputf8/utils/index.html | 1 - libraries/phputf8/utils/patterns.php | 69 - libraries/phputf8/utils/specials.php | 143 - libraries/phputf8/utils/unicode.php | 269 - libraries/phputf8/utils/validation.php | 185 - .../phpxmlrpc/compat/array_key_exists.php | 66 +- libraries/phpxmlrpc/compat/index.html | 2 +- libraries/phpxmlrpc/compat/is_a.php | 54 +- libraries/phpxmlrpc/compat/is_callable.php | 88 +- libraries/phpxmlrpc/compat/is_scalar.php | 40 +- libraries/phpxmlrpc/compat/var_export.php | 162 +- .../phpxmlrpc/compat/version_compare.php | 298 +- libraries/phpxmlrpc/index.html | 2 +- libraries/phpxmlrpc/xmlrpc.php | 52 +- libraries/phpxmlrpc/xmlrpc_wrappers.php | 36 +- libraries/phpxmlrpc/xmlrpcs.php | 18 +- .../simplepie/idn/idna_convert.class.php | 1824 +++--- libraries/simplepie/idn/index.html | 2 +- libraries/simplepie/index.html | 2 +- libraries/simplepie/simplepie.php | 8 +- libraries/tcpdf/cache/index.html | 2 +- libraries/tcpdf/config/index.html | 2 +- libraries/tcpdf/config/lang/eng.php | 18 +- libraries/tcpdf/config/lang/index.html | 2 +- libraries/tcpdf/config/tcpdf_config.php | 16 +- libraries/tcpdf/html_entity_decode_php4.php | 12 +- libraries/tcpdf/images/index.html | 2 +- libraries/tcpdf/index.html | 2 +- libraries/tcpdf/tcpdf.php | 84 +- libraries/tcpdf/unicode_data.php | 16 +- logs/index.html | 2 +- media/index.html | 2 +- media/system/css/index.html | 2 +- media/system/images/index.html | 2 +- .../system/images}/warning.png | Bin media/system/index.html | 2 +- media/system/js/index.html | 2 +- .../system/js/legacy.js | 2 +- media/system/js/tabs.js | 71 - modules/index.html | 2 +- modules/mod_archive/index.html | 2 +- modules/mod_archive/mod_archive.php | 2 +- modules/mod_archive/tmpl/index.html | 2 +- modules/mod_banners/helper.php | 4 +- modules/mod_banners/index.html | 2 +- modules/mod_banners/mod_banners.php | 2 +- modules/mod_banners/tmpl/index.html | 2 +- modules/mod_breadcrumbs/index.html | 2 +- modules/mod_breadcrumbs/mod_breadcrumbs.php | 2 +- modules/mod_breadcrumbs/tmpl/default.php | 2 +- modules/mod_breadcrumbs/tmpl/index.html | 2 +- modules/mod_custom/index.html | 2 +- modules/mod_feed/index.html | 2 +- modules/mod_feed/mod_feed.php | 2 +- modules/mod_feed/tmpl/default.php | 2 +- modules/mod_feed/tmpl/index.html | 2 +- modules/mod_footer/index.html | 2 +- modules/mod_footer/tmpl/index.html | 2 +- modules/mod_latestnews/helper.php | 2 +- modules/mod_latestnews/index.html | 2 +- modules/mod_latestnews/mod_latestnews.php | 2 +- modules/mod_latestnews/mod_latestnews.xml | 4 +- modules/mod_latestnews/tmpl/index.html | 2 +- modules/mod_login/index.html | 2 +- modules/mod_login/mod_login.php | 2 +- modules/mod_login/tmpl/index.html | 2 +- modules/mod_mainmenu/helper.php | 67 +- modules/mod_mainmenu/index.html | 2 +- modules/mod_mainmenu/legacy.php | 425 -- modules/mod_mainmenu/mod_mainmenu.php | 13 +- modules/mod_mainmenu/mod_mainmenu.xml | 44 +- modules/mod_mainmenu/tmpl/index.html | 2 +- modules/mod_mostread/helper.php | 2 +- modules/mod_mostread/index.html | 2 +- modules/mod_mostread/mod_mostread.php | 2 +- modules/mod_mostread/tmpl/index.html | 2 +- modules/mod_newsflash/helper.php | 2 +- modules/mod_newsflash/index.html | 2 +- modules/mod_newsflash/mod_newsflash.php | 2 +- modules/mod_newsflash/tmpl/index.html | 2 +- modules/mod_poll/index.html | 2 +- modules/mod_poll/mod_poll.php | 8 +- modules/mod_poll/tmpl/index.html | 2 +- modules/mod_random_image/index.html | 2 +- modules/mod_random_image/mod_random_image.php | 2 +- modules/mod_random_image/tmpl/index.html | 2 +- modules/mod_related_items/helper.php | 2 +- modules/mod_related_items/index.html | 2 +- .../mod_related_items/mod_related_items.php | 2 +- modules/mod_related_items/tmpl/index.html | 2 +- modules/mod_search/helper.php | 4 +- modules/mod_search/index.html | 2 +- modules/mod_search/mod_search.php | 4 +- modules/mod_search/tmpl/default.php | 42 +- modules/mod_search/tmpl/index.html | 2 +- modules/mod_sections/helper.php | 2 +- modules/mod_sections/index.html | 2 +- modules/mod_sections/mod_sections.php | 2 +- modules/mod_sections/tmpl/index.html | 2 +- modules/mod_stats/index.html | 2 +- modules/mod_stats/mod_stats.php | 2 +- modules/mod_stats/tmpl/index.html | 2 +- modules/mod_syndicate/index.html | 2 +- modules/mod_syndicate/mod_syndicate.php | 2 +- modules/mod_syndicate/tmpl/index.html | 2 +- modules/mod_whosonline/helper.php | 18 +- modules/mod_whosonline/index.html | 2 +- modules/mod_whosonline/mod_whosonline.php | 6 +- modules/mod_whosonline/tmpl/default.php | 26 +- modules/mod_whosonline/tmpl/index.html | 2 +- modules/mod_wrapper/index.html | 2 +- modules/mod_wrapper/mod_wrapper.php | 2 +- modules/mod_wrapper/tmpl/index.html | 2 +- plugins/authentication/example.php | 16 - plugins/authentication/gmail.php | 20 +- plugins/authentication/index.html | 2 +- plugins/authentication/joomla.php | 19 +- plugins/authentication/ldap.php | 21 +- plugins/authentication/openid.php | 27 +- plugins/content/example.php | 17 - plugins/content/index.html | 2 +- plugins/editors-xtd/image.php | 21 +- plugins/editors-xtd/index.html | 2 +- plugins/editors-xtd/pagebreak.php | 21 +- plugins/editors-xtd/readmore.php | 21 +- plugins/editors/index.html | 2 +- plugins/editors/none.php | 17 - plugins/editors/tinymce.php | 17 - plugins/editors/tinymce.xml | 10 +- plugins/editors/tinymce/index.html | 2 +- plugins/editors/tinymce/jscripts/index.html | 2 +- .../tinymce/jscripts/tiny_mce/index.html | 2 +- .../jscripts/tiny_mce/langs/index.html | 2 +- .../plugins/_template/images/index.html | 2 +- .../tiny_mce/plugins/_template/index.html | 2 +- .../plugins/_template/langs/index.html | 2 +- .../tiny_mce/plugins/advhr/css/index.html | 2 +- .../tiny_mce/plugins/advhr/images/index.html | 2 +- .../tiny_mce/plugins/advhr/index.html | 2 +- .../plugins/advhr/jscripts/index.html | 2 +- .../tiny_mce/plugins/advhr/langs/index.html | 2 +- .../tiny_mce/plugins/advimage/css/index.html | 2 +- .../plugins/advimage/images/index.html | 2 +- .../tiny_mce/plugins/advimage/index.html | 2 +- .../plugins/advimage/jscripts/index.html | 2 +- .../plugins/advimage/langs/index.html | 2 +- .../tiny_mce/plugins/advlink/css/index.html | 2 +- .../tiny_mce/plugins/advlink/index.html | 2 +- .../plugins/advlink/jscripts/index.html | 2 +- .../tiny_mce/plugins/advlink/langs/index.html | 2 +- .../tiny_mce/plugins/autosave/index.html | 2 +- .../plugins/autosave/langs/index.html | 2 +- .../tiny_mce/plugins/bbcode/index.html | 2 +- .../tiny_mce/plugins/cleanup/index.html | 2 +- .../plugins/contextmenu/css/index.html | 2 +- .../plugins/contextmenu/images/index.html | 2 +- .../tiny_mce/plugins/contextmenu/index.html | 2 +- .../tiny_mce/plugins/devkit/css/index.html | 2 +- .../tiny_mce/plugins/devkit/images/index.html | 2 +- .../tiny_mce/plugins/devkit/index.html | 2 +- .../plugins/devkit/jscripts/index.html | 2 +- .../tiny_mce/plugins/devkit/langs/index.html | 2 +- .../plugins/directionality/images/index.html | 2 +- .../plugins/directionality/index.html | 2 +- .../plugins/directionality/langs/index.html | 2 +- .../plugins/emotions/images/index.html | 2 +- .../tiny_mce/plugins/emotions/index.html | 2 +- .../plugins/emotions/jscripts/index.html | 2 +- .../plugins/emotions/langs/index.html | 2 +- .../tiny_mce/plugins/flash/css/index.html | 2 +- .../tiny_mce/plugins/flash/images/index.html | 2 +- .../tiny_mce/plugins/flash/index.html | 2 +- .../plugins/flash/jscripts/index.html | 2 +- .../tiny_mce/plugins/flash/langs/index.html | 2 +- .../tiny_mce/plugins/fullpage/css/index.html | 2 +- .../plugins/fullpage/images/index.html | 2 +- .../tiny_mce/plugins/fullpage/index.html | 2 +- .../plugins/fullpage/jscripts/index.html | 2 +- .../plugins/fullpage/langs/index.html | 2 +- .../plugins/fullscreen/css/index.html | 2 +- .../plugins/fullscreen/images/index.html | 2 +- .../tiny_mce/plugins/fullscreen/index.html | 2 +- .../plugins/fullscreen/langs/index.html | 2 +- .../plugins/iespell/images/index.html | 2 +- .../tiny_mce/plugins/iespell/index.html | 2 +- .../tiny_mce/plugins/iespell/langs/index.html | 2 +- .../jscripts/tiny_mce/plugins/index.html | 2 +- .../plugins/inlinepopups/css/index.html | 2 +- .../plugins/inlinepopups/images/index.html | 2 +- .../tiny_mce/plugins/inlinepopups/index.html | 2 +- .../plugins/inlinepopups/jscripts/index.html | 2 +- .../plugins/insertdatetime/images/index.html | 2 +- .../plugins/insertdatetime/index.html | 2 +- .../plugins/insertdatetime/langs/index.html | 2 +- .../tiny_mce/plugins/layer/images/index.html | 2 +- .../tiny_mce/plugins/layer/index.html | 2 +- .../tiny_mce/plugins/layer/langs/index.html | 2 +- .../tiny_mce/plugins/media/css/index.html | 2 +- .../tiny_mce/plugins/media/images/index.html | 2 +- .../tiny_mce/plugins/media/index.html | 2 +- .../plugins/media/jscripts/index.html | 2 +- .../tiny_mce/plugins/media/langs/index.html | 2 +- .../plugins/nonbreaking/images/index.html | 2 +- .../tiny_mce/plugins/nonbreaking/index.html | 2 +- .../plugins/nonbreaking/langs/index.html | 2 +- .../plugins/noneditable/css/index.html | 2 +- .../tiny_mce/plugins/noneditable/index.html | 2 +- .../tiny_mce/plugins/paste/css/index.html | 2 +- .../tiny_mce/plugins/paste/images/index.html | 2 +- .../tiny_mce/plugins/paste/index.html | 2 +- .../plugins/paste/jscripts/index.html | 2 +- .../tiny_mce/plugins/paste/langs/index.html | 2 +- .../plugins/preview/images/index.html | 2 +- .../tiny_mce/plugins/preview/index.html | 2 +- .../plugins/preview/jscripts/index.html | 2 +- .../tiny_mce/plugins/preview/langs/index.html | 2 +- .../tiny_mce/plugins/print/images/index.html | 2 +- .../tiny_mce/plugins/print/index.html | 2 +- .../tiny_mce/plugins/print/langs/index.html | 2 +- .../tiny_mce/plugins/save/images/index.html | 2 +- .../jscripts/tiny_mce/plugins/save/index.html | 2 +- .../tiny_mce/plugins/save/langs/index.html | 2 +- .../plugins/searchreplace/css/index.html | 2 +- .../plugins/searchreplace/images/index.html | 2 +- .../tiny_mce/plugins/searchreplace/index.html | 2 +- .../plugins/searchreplace/jscripts/index.html | 2 +- .../plugins/searchreplace/langs/index.html | 2 +- .../tiny_mce/plugins/style/css/index.html | 2 +- .../tiny_mce/plugins/style/images/index.html | 2 +- .../tiny_mce/plugins/style/index.html | 2 +- .../plugins/style/jscripts/index.html | 2 +- .../tiny_mce/plugins/style/langs/index.html | 2 +- .../tiny_mce/plugins/table/css/index.html | 2 +- .../tiny_mce/plugins/table/images/index.html | 2 +- .../tiny_mce/plugins/table/index.html | 2 +- .../plugins/table/jscripts/index.html | 2 +- .../tiny_mce/plugins/table/langs/index.html | 2 +- .../tiny_mce/plugins/template/css/index.html | 2 +- .../plugins/template/images/index.html | 2 +- .../tiny_mce/plugins/template/index.html | 2 +- .../plugins/template/jscripts/index.html | 2 +- .../plugins/template/langs/index.html | 2 +- .../plugins/visualchars/images/index.html | 2 +- .../tiny_mce/plugins/visualchars/index.html | 2 +- .../plugins/visualchars/langs/index.html | 2 +- .../plugins/xhtmlxtras/css/index.html | 2 +- .../plugins/xhtmlxtras/images/index.html | 2 +- .../tiny_mce/plugins/xhtmlxtras/index.html | 2 +- .../plugins/xhtmlxtras/jscripts/index.html | 2 +- .../plugins/xhtmlxtras/langs/index.html | 2 +- .../jscripts/tiny_mce/plugins/zoom/index.html | 2 +- .../tiny_mce/themes/advanced/css/index.html | 2 +- .../themes/advanced/images/index.html | 2 +- .../themes/advanced/images/xp/index.html | 2 +- .../tiny_mce/themes/advanced/index.html | 2 +- .../themes/advanced/jscripts/index.html | 2 +- .../tiny_mce/themes/advanced/langs/index.html | 2 +- .../jscripts/tiny_mce/themes/index.html | 2 +- .../tiny_mce/themes/simple/css/index.html | 2 +- .../tiny_mce/themes/simple/images/index.html | 2 +- .../tiny_mce/themes/simple/index.html | 2 +- .../jscripts/tiny_mce/tiny_mce_gzip.php | 2 +- .../jscripts/tiny_mce/utils/index.html | 2 +- plugins/editors/xstandard.php | 19 +- plugins/editors/xstandard/index.html | 2 +- plugins/index.html | 2 +- plugins/search/categories.php | 2 +- plugins/search/content.php | 2 +- plugins/search/index.html | 2 +- plugins/search/sections.php | 2 +- plugins/search/weblinks.php | 2 +- plugins/system/backlink.php | 529 -- plugins/system/backlink.xml | 29 - plugins/system/cache.php | 17 +- plugins/system/debug.php | 383 +- plugins/system/debug.xml | 13 +- plugins/system/index.html | 2 +- plugins/system/legacy.php | 354 +- plugins/system/legacy.xml | 19 +- plugins/system/legacy/adminmenus.php | 416 -- plugins/system/legacy/cache.php | 42 - plugins/system/legacy/category.php | 60 - plugins/system/legacy/classes.php | 106 - plugins/system/legacy/commonhtml.php | 270 - plugins/system/legacy/component.php | 60 - plugins/system/legacy/content.php | 60 - plugins/system/legacy/dbtable.php | 131 - plugins/system/legacy/functions.php | 910 --- plugins/system/legacy/html.php | 346 -- plugins/system/legacy/index.html | 2 +- plugins/system/legacy/installer.php | 33 - plugins/system/legacy/mainframe.php | 121 - plugins/system/legacy/mambot.php | 60 - plugins/system/legacy/mambothandler.php | 82 - plugins/system/legacy/menu.php | 60 - plugins/system/legacy/menubar.php | 76 - plugins/system/legacy/module.php | 60 - plugins/system/legacy/mysql.php | 80 - plugins/system/legacy/mysqli.php | 80 - plugins/system/legacy/pagination.php | 137 - plugins/system/legacy/parameters.php | 94 - plugins/system/legacy/patfactory.php | 61 - plugins/system/legacy/section.php | 60 - plugins/system/legacy/session.php | 105 - plugins/system/legacy/template/index.html | 1 + .../legacy}/template/module/function/Sef.php | 0 .../template/module/function/Translate.php | 1 - .../template/module/function/index.html | 1 + .../system/legacy/template/module/index.html | 1 + .../legacy}/template/module/modifier/SEF.php | 0 .../template/module/modifier/Translate.php | 0 .../template/module/modifier/index.html | 1 + .../system/legacy}/template/template.php | 1 - .../legacy}/template/tmpl/adminfilters.html | 0 .../legacy}/template/tmpl/adminlists.html | 2 +- .../legacy}/template/tmpl/breadcrumbs.html | 0 .../legacy}/template/tmpl/calendar.html | 0 .../system/legacy}/template/tmpl/dtree.html | 0 .../system/legacy}/template/tmpl/forms.html | 0 .../system/legacy}/template/tmpl/help.html | 0 .../system/legacy/template/tmpl/index.html | 1 + .../system/legacy}/template/tmpl/page.html | 0 .../system/legacy}/template/tmpl/tabs.html | 0 plugins/system/legacy/toolbar.php | 318 -- plugins/system/legacy/user.php | 108 - plugins/system/log.php | 19 +- plugins/system/remember.php | 23 +- plugins/system/sef.php | 57 +- plugins/tmp/index.html | 1 - plugins/user/example.php | 22 +- plugins/user/index.html | 2 +- plugins/user/joomla.php | 26 +- plugins/xmlrpc/blogger.php | 14 +- plugins/xmlrpc/index.html | 2 +- plugins/xmlrpc/joomla.php | 19 +- templates/beez/css/ie7only.css | 1 - templates/beez/css/ieonly.css | 1 - templates/beez/css/index.html | 2 +- templates/beez/css/layout.css | 1 - templates/beez/css/position.css | 1 - templates/beez/css/print.css | 1 - templates/beez/css/template.css | 7 - templates/beez/css/template_rtl.css | 1 - .../beez/html/com_contact/category/index.html | 2 +- .../beez/html/com_contact/contact/default.php | 2 +- .../beez/html/com_contact/contact/index.html | 2 +- templates/beez/html/com_contact/index.html | 2 +- .../beez/html/com_content/article/default.php | 2 +- .../beez/html/com_content/article/form.php | 4 +- .../beez/html/com_content/article/index.html | 2 +- .../html/com_content/category/blog_item.php | 46 +- .../beez/html/com_content/category/index.html | 2 +- .../com_content/frontpage/default_item.php | 2 +- .../html/com_content/frontpage/index.html | 2 +- templates/beez/html/com_content/index.html | 2 +- .../html/com_content/section/blog_item.php | 50 +- .../beez/html/com_content/section/index.html | 2 +- .../html/com_newsfeeds/categories/index.html | 2 +- .../html/com_newsfeeds/category/index.html | 2 +- templates/beez/html/com_newsfeeds/index.html | 2 +- .../html/com_newsfeeds/newsfeed/index.html | 2 +- templates/beez/html/com_poll/index.html | 2 +- templates/beez/html/com_poll/poll/index.html | 2 +- templates/beez/html/com_search/index.html | 2 +- .../beez/html/com_search/search/index.html | 2 +- templates/beez/html/com_user/index.html | 2 +- templates/beez/html/com_user/login/index.html | 2 +- .../beez/html/com_user/register/index.html | 2 +- .../beez/html/com_user/remind/index.html | 2 +- templates/beez/html/com_user/reset/index.html | 2 +- templates/beez/html/com_user/user/index.html | 2 +- .../html/com_weblinks/categories/index.html | 2 +- .../html/com_weblinks/category/index.html | 2 +- templates/beez/html/com_weblinks/index.html | 2 +- .../html/com_weblinks/weblinks/index.html | 2 +- templates/beez/html/index.html | 2 +- templates/beez/html/mod_latestnews/index.html | 2 +- templates/beez/html/mod_login/index.html | 2 +- templates/beez/html/mod_newsflash/index.html | 2 +- templates/beez/html/mod_poll/index.html | 2 +- templates/beez/html/mod_search/default.php | 44 +- templates/beez/html/mod_search/index.html | 2 +- templates/beez/images/index.html | 2 +- templates/beez/images_general/index.html | 2 +- templates/beez/index.html | 2 +- templates/beez/javascript/index.html | 2 +- templates/index.html | 2 +- templates/rhuk_milkyway/css/index.html | 2 +- templates/rhuk_milkyway/css/template.css | 4 +- templates/rhuk_milkyway/css/template_rtl.css | 1 - templates/rhuk_milkyway/css/white.css | 4 - templates/rhuk_milkyway/html/index.html | 2 +- .../rhuk_milkyway/images/black/index.html | 2 +- .../rhuk_milkyway/images/blue/index.html | 2 +- .../rhuk_milkyway/images/green/index.html | 2 +- templates/rhuk_milkyway/images/index.html | 2 +- .../rhuk_milkyway/images/orange/index.html | 2 +- templates/rhuk_milkyway/images/red/index.html | 2 +- .../rhuk_milkyway/images/white/index.html | 2 +- templates/rhuk_milkyway/index.html | 2 +- templates/system/css/general.css | 4 - templates/system/css/index.html | 2 +- templates/system/css/offline_rtl.css | 1 - templates/system/error.php | 16 +- templates/system/html/index.html | 2 +- templates/system/images/index.html | 2 +- templates/system/images/report.png | Bin 0 -> 868 bytes templates/system/index.html | 2 +- tmp/index.html | 2 +- xmlrpc/cache/index.html | 2 +- xmlrpc/includes/framework.php | 4 +- xmlrpc/includes/index.html | 2 +- 2388 files changed, 99285 insertions(+), 104347 deletions(-) create mode 100644 administrator/components/com_acl/acl.php create mode 100644 administrator/components/com_acl/controller.php create mode 100644 administrator/components/com_acl/controllers/acl.php create mode 100644 administrator/components/com_acl/controllers/group.php create mode 100755 administrator/components/com_acl/controllers/index.html create mode 100755 administrator/components/com_acl/helpers/acl.php create mode 100755 administrator/components/com_acl/helpers/html/acl.php create mode 100755 administrator/components/com_acl/helpers/html/index.html create mode 100755 administrator/components/com_acl/helpers/index.html create mode 100755 administrator/components/com_acl/index.html create mode 100644 administrator/components/com_acl/models/_prototypeitem.php create mode 100644 administrator/components/com_acl/models/_prototypelist.php create mode 100644 administrator/components/com_acl/models/acl.php create mode 100644 administrator/components/com_acl/models/acls.php create mode 100644 administrator/components/com_acl/models/group.php create mode 100644 administrator/components/com_acl/models/groups.php create mode 100644 administrator/components/com_acl/models/objects.php create mode 100644 administrator/components/com_acl/models/sections.php create mode 100644 administrator/components/com_acl/views/group/index.html create mode 100644 administrator/components/com_acl/views/group/tmpl/edit.php create mode 100644 administrator/components/com_acl/views/group/tmpl/index.html create mode 100644 administrator/components/com_acl/views/group/view.html.php create mode 100644 administrator/components/com_acl/views/groups/index.html create mode 100644 administrator/components/com_acl/views/groups/tmpl/default.php create mode 100644 administrator/components/com_acl/views/groups/tmpl/index.html create mode 100644 administrator/components/com_acl/views/groups/view.html.php create mode 100644 administrator/components/com_acl/views/level/index.html create mode 100644 administrator/components/com_acl/views/level/tmpl/edit.php create mode 100644 administrator/components/com_acl/views/level/tmpl/index.html create mode 100644 administrator/components/com_acl/views/level/view.html.php create mode 100644 administrator/components/com_acl/views/levels/index.html create mode 100644 administrator/components/com_acl/views/levels/tmpl/default.php create mode 100644 administrator/components/com_acl/views/levels/tmpl/index.html create mode 100644 administrator/components/com_acl/views/levels/view.html.php create mode 100755 administrator/components/com_acl/views/rule/index.html create mode 100644 administrator/components/com_acl/views/rule/tmpl/edit.php create mode 100755 administrator/components/com_acl/views/rule/tmpl/edit_acos.php create mode 100755 administrator/components/com_acl/views/rule/tmpl/edit_arogroups.php create mode 100755 administrator/components/com_acl/views/rule/tmpl/edit_axogroups.php create mode 100755 administrator/components/com_acl/views/rule/tmpl/edit_axos.php create mode 100644 administrator/components/com_acl/views/rule/tmpl/edit_type1.php create mode 100644 administrator/components/com_acl/views/rule/tmpl/edit_type2.php create mode 100644 administrator/components/com_acl/views/rule/tmpl/edit_type3.php create mode 100755 administrator/components/com_acl/views/rule/tmpl/index.html create mode 100755 administrator/components/com_acl/views/rule/view.html.php create mode 100755 administrator/components/com_acl/views/rules/index.html create mode 100755 administrator/components/com_acl/views/rules/tmpl/default.php create mode 100755 administrator/components/com_acl/views/rules/tmpl/default_type1.php create mode 100755 administrator/components/com_acl/views/rules/tmpl/default_type2.php create mode 100755 administrator/components/com_acl/views/rules/tmpl/default_type3.php create mode 100755 administrator/components/com_acl/views/rules/tmpl/index.html create mode 100644 administrator/components/com_acl/views/rules/view.html.php delete mode 100644 administrator/components/com_admin/admin.admin.html.php delete mode 100644 administrator/components/com_admin/admin.admin.php rename administrator/components/{com_cpanel/toolbar.cpanel.php => com_admin/admin.php} (70%) rename administrator/components/{com_frontpage/frontpage.xml => com_admin/admin.xml} (71%) create mode 100644 administrator/components/com_admin/config.xml create mode 100644 administrator/components/com_admin/controller.php create mode 100644 administrator/components/com_admin/models/changelog.php create mode 100644 administrator/components/com_admin/models/index.html delete mode 100644 administrator/components/com_admin/tmpl/index.html delete mode 100644 administrator/components/com_admin/tmpl/sysinfo_directory.php delete mode 100644 administrator/components/com_admin/tmpl/sysinfo_phpsettings.php delete mode 100644 administrator/components/com_admin/toolbar.admin.html.php delete mode 100644 administrator/components/com_admin/toolbar.admin.php create mode 100644 administrator/components/com_admin/views/changelog/index.html create mode 100644 administrator/components/com_admin/views/changelog/tmpl/default.php create mode 100644 administrator/components/com_admin/views/changelog/tmpl/index.html rename administrator/components/{com_cpanel/admin.cpanel.php => com_admin/views/changelog/view.html.php} (53%) create mode 100644 administrator/components/com_admin/views/help/index.html create mode 100644 administrator/components/com_admin/views/help/tmpl/default.php create mode 100644 administrator/components/com_admin/views/help/tmpl/index.html create mode 100644 administrator/components/com_admin/views/help/view.html.php create mode 100644 administrator/components/com_admin/views/sysinfo/index.html create mode 100644 administrator/components/com_admin/views/sysinfo/tmpl/default.php rename administrator/components/com_admin/{tmpl/sysinfo_config.php => views/sysinfo/tmpl/default_config.php} (91%) create mode 100644 administrator/components/com_admin/views/sysinfo/tmpl/default_directory.php rename administrator/components/com_admin/{tmpl/navigation.php => views/sysinfo/tmpl/default_navigation.php} (100%) rename administrator/components/com_admin/{tmpl/sysinfo_phpinfo.php => views/sysinfo/tmpl/default_phpinfo.php} (86%) create mode 100644 administrator/components/com_admin/views/sysinfo/tmpl/default_phpsettings.php rename administrator/components/com_admin/{tmpl/sysinfo_system.php => views/sysinfo/tmpl/default_system.php} (86%) create mode 100644 administrator/components/com_admin/views/sysinfo/tmpl/index.html create mode 100644 administrator/components/com_admin/views/sysinfo/view.html.php rename administrator/components/com_banners/{admin.banners.php => banners.php} (88%) create mode 100644 administrator/components/com_banners/models/banner.php create mode 100644 administrator/components/com_banners/models/bannerclient.php create mode 100644 administrator/components/com_banners/models/bannerclients.php create mode 100644 administrator/components/com_banners/models/banners.php create mode 100644 administrator/components/com_banners/models/index.html delete mode 100644 administrator/components/com_banners/views/banner.php create mode 100644 administrator/components/com_banners/views/banner/index.html create mode 100644 administrator/components/com_banners/views/banner/tmpl/default.php create mode 100644 administrator/components/com_banners/views/banner/tmpl/index.html create mode 100644 administrator/components/com_banners/views/banner/view.html.php create mode 100644 administrator/components/com_banners/views/bannerclient/index.html create mode 100644 administrator/components/com_banners/views/bannerclient/tmpl/default.php create mode 100644 administrator/components/com_banners/views/bannerclient/tmpl/index.html create mode 100644 administrator/components/com_banners/views/bannerclient/view.html.php create mode 100644 administrator/components/com_banners/views/bannerclients/index.html create mode 100644 administrator/components/com_banners/views/bannerclients/tmpl/default.php create mode 100644 administrator/components/com_banners/views/bannerclients/tmpl/index.html create mode 100644 administrator/components/com_banners/views/bannerclients/view.html.php create mode 100644 administrator/components/com_banners/views/banners/index.html create mode 100644 administrator/components/com_banners/views/banners/tmpl/default.php create mode 100644 administrator/components/com_banners/views/banners/tmpl/index.html create mode 100644 administrator/components/com_banners/views/banners/view.html.php delete mode 100644 administrator/components/com_banners/views/client.php delete mode 100644 administrator/components/com_cache/admin.cache.html.php delete mode 100644 administrator/components/com_cache/admin.cache.php rename administrator/components/{com_modules/admin.modules.php => com_cache/cache.php} (58%) create mode 100644 administrator/components/com_cache/controller.php rename administrator/components/com_cache/{cache.class.php => models/cache.php} (55%) create mode 100644 administrator/components/com_cache/models/index.html delete mode 100644 administrator/components/com_cache/toolbar.cache.html.php delete mode 100644 administrator/components/com_cache/toolbar.cache.php create mode 100644 administrator/components/com_cache/views/cache/index.html create mode 100644 administrator/components/com_cache/views/cache/tmpl/default.php create mode 100644 administrator/components/com_cache/views/cache/tmpl/index.html create mode 100644 administrator/components/com_cache/views/cache/view.html.php create mode 100644 administrator/components/com_cache/views/index.html delete mode 100644 administrator/components/com_categories/admin.categories.html.php delete mode 100644 administrator/components/com_categories/admin.categories.php create mode 100644 administrator/components/com_categories/categories.php create mode 100644 administrator/components/com_categories/categories.xml create mode 100644 administrator/components/com_categories/config.xml create mode 100644 administrator/components/com_categories/controller.php create mode 100644 administrator/components/com_categories/models/categories.php create mode 100644 administrator/components/com_categories/models/category.php create mode 100644 administrator/components/com_categories/models/index.html create mode 100644 administrator/components/com_categories/tables/category.php create mode 100644 administrator/components/com_categories/tables/index.html delete mode 100644 administrator/components/com_categories/toolbar.categories.html.php delete mode 100644 administrator/components/com_categories/toolbar.categories.php create mode 100644 administrator/components/com_categories/views/categories/index.html create mode 100644 administrator/components/com_categories/views/categories/tmpl/default.php create mode 100644 administrator/components/com_categories/views/categories/tmpl/index.html create mode 100644 administrator/components/com_categories/views/categories/view.html.php create mode 100644 administrator/components/com_categories/views/category/index.html create mode 100644 administrator/components/com_categories/views/category/tmpl/default.php create mode 100644 administrator/components/com_categories/views/category/tmpl/index.html create mode 100644 administrator/components/com_categories/views/category/view.html.php create mode 100644 administrator/components/com_categories/views/copyselect/index.html create mode 100644 administrator/components/com_categories/views/copyselect/tmpl/default.php create mode 100644 administrator/components/com_categories/views/copyselect/tmpl/index.html create mode 100644 administrator/components/com_categories/views/copyselect/view.html.php create mode 100644 administrator/components/com_categories/views/index.html delete mode 100644 administrator/components/com_checkin/admin.checkin.php create mode 100644 administrator/components/com_checkin/checkin.php create mode 100644 administrator/components/com_checkin/controller.php delete mode 100644 administrator/components/com_checkin/toolbar.checkin.html.php create mode 100644 administrator/components/com_checkin/views/checkin/index.html create mode 100644 administrator/components/com_checkin/views/checkin/tmpl/default.php create mode 100644 administrator/components/com_checkin/views/checkin/tmpl/index.html create mode 100644 administrator/components/com_checkin/views/checkin/view.html.php create mode 100644 administrator/components/com_checkin/views/index.html rename administrator/components/{com_cpanel/toolbar.cpanel.html.php => com_config/classes/config.php} (58%) create mode 100644 administrator/components/com_config/classes/index.html rename administrator/components/com_config/{admin.config.php => config.php} (67%) delete mode 100644 administrator/components/com_config/toolbar.config.html.php create mode 100644 administrator/components/com_config/views/application/tmpl/config.php rename administrator/components/com_config/views/application/tmpl/{ftp.php => config_ftp_auth.php} (100%) rename administrator/components/com_config/views/application/tmpl/{navigation.php => config_navigation.php} (100%) create mode 100644 administrator/components/com_config/views/application/view.html.php delete mode 100644 administrator/components/com_config/views/application/view.php create mode 100644 administrator/components/com_config/views/component/tmpl/default.php create mode 100644 administrator/components/com_config/views/component/tmpl/index.html delete mode 100644 administrator/components/com_contact/admin.contact.html.php delete mode 100644 administrator/components/com_contact/admin.contact.php create mode 100644 administrator/components/com_contact/contact.php create mode 100644 administrator/components/com_contact/controller.php delete mode 100644 administrator/components/com_contact/helpers/index.html delete mode 100644 administrator/components/com_contact/helpers/vcard.php create mode 100644 administrator/components/com_contact/models/contact.php rename administrator/components/com_contact/{contact_items.xml => models/contact.xml} (96%) create mode 100644 administrator/components/com_contact/models/contacts.php create mode 100644 administrator/components/com_contact/models/index.html delete mode 100644 administrator/components/com_contact/toolbar.contact.html.php delete mode 100644 administrator/components/com_contact/toolbar.contact.php create mode 100644 administrator/components/com_contact/views/contact/index.html create mode 100644 administrator/components/com_contact/views/contact/tmpl/default.php create mode 100644 administrator/components/com_contact/views/contact/tmpl/index.html create mode 100644 administrator/components/com_contact/views/contact/view.html.php create mode 100644 administrator/components/com_contact/views/contacts/index.html create mode 100644 administrator/components/com_contact/views/contacts/tmpl/default.php create mode 100644 administrator/components/com_contact/views/contacts/tmpl/index.html create mode 100644 administrator/components/com_contact/views/contacts/view.html.php create mode 100644 administrator/components/com_contact/views/index.html create mode 100755 administrator/components/com_contactdirectory/contactdirectory.php create mode 100644 administrator/components/com_contactdirectory/contactdirectory.xml create mode 100755 administrator/components/com_contactdirectory/controllers/contact.php create mode 100755 administrator/components/com_contactdirectory/controllers/field.php create mode 100755 administrator/components/com_contactdirectory/controllers/index.html create mode 100755 administrator/components/com_contactdirectory/elements/contact.php create mode 100755 administrator/components/com_contactdirectory/elements/index.html create mode 100755 administrator/components/com_contactdirectory/helpers/index.html create mode 100644 administrator/components/com_contactdirectory/helpers/stringstream.php create mode 100755 administrator/components/com_contactdirectory/index.html create mode 100755 administrator/components/com_contactdirectory/models/contact.php create mode 100755 administrator/components/com_contactdirectory/models/contact.xml create mode 100755 administrator/components/com_contactdirectory/models/contacts.php create mode 100755 administrator/components/com_contactdirectory/models/field.php create mode 100755 administrator/components/com_contactdirectory/models/field.xml create mode 100755 administrator/components/com_contactdirectory/models/fields.php create mode 100755 administrator/components/com_contactdirectory/models/index.html create mode 100755 administrator/components/com_contactdirectory/tables/contact.php create mode 100755 administrator/components/com_contactdirectory/tables/field.php create mode 100755 administrator/components/com_contactdirectory/tables/index.html create mode 100755 administrator/components/com_contactdirectory/views/contact/index.html create mode 100755 administrator/components/com_contactdirectory/views/contact/tmpl/default.php create mode 100755 administrator/components/com_contactdirectory/views/contact/tmpl/index.html create mode 100755 administrator/components/com_contactdirectory/views/contact/view.html.php create mode 100755 administrator/components/com_contactdirectory/views/contacts/index.html create mode 100755 administrator/components/com_contactdirectory/views/contacts/tmpl/default.php create mode 100755 administrator/components/com_contactdirectory/views/contacts/tmpl/index.html create mode 100755 administrator/components/com_contactdirectory/views/contacts/view.html.php create mode 100755 administrator/components/com_contactdirectory/views/field/index.html create mode 100755 administrator/components/com_contactdirectory/views/field/tmpl/default.php create mode 100755 administrator/components/com_contactdirectory/views/field/tmpl/index.html create mode 100755 administrator/components/com_contactdirectory/views/field/view.html.php create mode 100755 administrator/components/com_contactdirectory/views/fields/index.html create mode 100755 administrator/components/com_contactdirectory/views/fields/tmpl/default.php create mode 100755 administrator/components/com_contactdirectory/views/fields/tmpl/index.html create mode 100755 administrator/components/com_contactdirectory/views/fields/view.html.php create mode 100755 administrator/components/com_contactdirectory/views/import/index.html create mode 100755 administrator/components/com_contactdirectory/views/import/tmpl/default.php create mode 100755 administrator/components/com_contactdirectory/views/import/tmpl/index.html create mode 100755 administrator/components/com_contactdirectory/views/import/view.html.php create mode 100755 administrator/components/com_contactdirectory/views/index.html delete mode 100644 administrator/components/com_content/admin.content.html.php delete mode 100644 administrator/components/com_content/admin.content.php rename administrator/components/com_content/{helper => classes}/content.php (93%) create mode 100644 administrator/components/com_content/classes/contentgrid.php create mode 100644 administrator/components/com_content/classes/index.html create mode 100644 administrator/components/com_content/content.php create mode 100644 administrator/components/com_content/controllers/frontpage.php create mode 100644 administrator/components/com_content/controllers/index.html delete mode 100644 administrator/components/com_content/helper.php delete mode 100644 administrator/components/com_content/helper/index.html create mode 100644 administrator/components/com_content/models/article.php create mode 100644 administrator/components/com_content/models/articles.php create mode 100644 administrator/components/com_content/models/frontpage.php rename administrator/components/{com_frontpage => com_content}/tables/frontpage.php (92%) create mode 100644 administrator/components/com_content/tables/index.html delete mode 100644 administrator/components/com_content/toolbar.content.html.php delete mode 100644 administrator/components/com_content/toolbar.content.php create mode 100644 administrator/components/com_content/views/article/index.html create mode 100644 administrator/components/com_content/views/article/tmpl/default.php create mode 100644 administrator/components/com_content/views/article/tmpl/index.html create mode 100644 administrator/components/com_content/views/article/view.html.php create mode 100644 administrator/components/com_content/views/articles/index.html create mode 100644 administrator/components/com_content/views/articles/tmpl/default.php create mode 100644 administrator/components/com_content/views/articles/tmpl/index.html create mode 100644 administrator/components/com_content/views/articles/view.html.php create mode 100644 administrator/components/com_content/views/copyselect/index.html create mode 100644 administrator/components/com_content/views/copyselect/tmpl/default.php create mode 100644 administrator/components/com_content/views/copyselect/tmpl/index.html create mode 100644 administrator/components/com_content/views/copyselect/view.html.php create mode 100644 administrator/components/com_content/views/element/tmpl/default.php create mode 100644 administrator/components/com_content/views/element/tmpl/index.html create mode 100644 administrator/components/com_content/views/frontpage/index.html create mode 100644 administrator/components/com_content/views/frontpage/tmpl/default.php create mode 100644 administrator/components/com_content/views/frontpage/tmpl/index.html create mode 100644 administrator/components/com_content/views/frontpage/view.html.php create mode 100644 administrator/components/com_content/views/pagebreak/index.html create mode 100644 administrator/components/com_content/views/pagebreak/tmpl/default.php create mode 100644 administrator/components/com_content/views/pagebreak/tmpl/index.html create mode 100644 administrator/components/com_content/views/pagebreak/view.html.php create mode 100644 administrator/components/com_content/views/prevuuw/index.html create mode 100644 administrator/components/com_content/views/prevuuw/tmpl/default.php create mode 100644 administrator/components/com_content/views/prevuuw/tmpl/index.html create mode 100644 administrator/components/com_content/views/prevuuw/view.html.php delete mode 100644 administrator/components/com_cpanel/admin.cpanel.html.php create mode 100644 administrator/components/com_cpanel/controller.php rename administrator/components/{com_massmail/toolbar.massmail.php => com_cpanel/cpanel.php} (59%) create mode 100644 administrator/components/com_cpanel/views/cpanel/index.html create mode 100644 administrator/components/com_cpanel/views/cpanel/tmpl/default.php create mode 100644 administrator/components/com_cpanel/views/cpanel/tmpl/index.html create mode 100644 administrator/components/com_cpanel/views/cpanel/view.html.php create mode 100644 administrator/components/com_cpanel/views/index.html delete mode 100644 administrator/components/com_frontpage/admin.frontpage.php delete mode 100644 administrator/components/com_frontpage/index.html delete mode 100644 administrator/components/com_frontpage/tables/index.html delete mode 100644 administrator/components/com_frontpage/views/frontpage.php delete mode 100644 administrator/components/com_frontpage/views/index.html rename administrator/components/com_installer/{admin.installer.php => installer.php} (92%) delete mode 100644 administrator/components/com_languages/admin.languages.html.php delete mode 100644 administrator/components/com_languages/admin.languages.php create mode 100644 administrator/components/com_languages/controller.php rename administrator/components/com_languages/{toolbar.languages.html.php => languages.php} (53%) create mode 100644 administrator/components/com_languages/models/index.html create mode 100644 administrator/components/com_languages/models/languages.php create mode 100644 administrator/components/com_languages/views/index.html create mode 100644 administrator/components/com_languages/views/languages/index.html create mode 100644 administrator/components/com_languages/views/languages/tmpl/default.php create mode 100644 administrator/components/com_languages/views/languages/tmpl/index.html create mode 100644 administrator/components/com_languages/views/languages/view.html.php rename administrator/components/com_login/{admin.login.php => controller.php} (52%) rename administrator/components/{com_languages/toolbar.languages.php => com_login/login.php} (65%) create mode 100644 administrator/components/com_login/views/index.html create mode 100644 administrator/components/com_login/views/login/index.html create mode 100644 administrator/components/com_login/views/login/tmpl/default.php create mode 100644 administrator/components/com_login/views/login/tmpl/index.html create mode 100644 administrator/components/com_login/views/login/view.html.php delete mode 100644 administrator/components/com_massmail/admin.massmail.html.php delete mode 100644 administrator/components/com_massmail/admin.massmail.php create mode 100644 administrator/components/com_massmail/controller.php create mode 100644 administrator/components/com_massmail/massmail.php delete mode 100644 administrator/components/com_massmail/toolbar.massmail.html.php create mode 100644 administrator/components/com_massmail/views/index.html create mode 100644 administrator/components/com_massmail/views/massmail/index.html create mode 100644 administrator/components/com_massmail/views/massmail/tmpl/default.php create mode 100644 administrator/components/com_massmail/views/massmail/tmpl/index.html create mode 100644 administrator/components/com_massmail/views/massmail/view.html.php delete mode 100644 administrator/components/com_messages/admin.messages.html.php delete mode 100644 administrator/components/com_messages/admin.messages.php create mode 100644 administrator/components/com_messages/controller.php rename includes/footer.php => administrator/components/com_messages/messages.php (65%) create mode 100644 administrator/components/com_messages/models/config.php create mode 100644 administrator/components/com_messages/models/index.html create mode 100644 administrator/components/com_messages/models/message.php create mode 100644 administrator/components/com_messages/models/messages.php delete mode 100644 administrator/components/com_messages/toolbar.messages.html.php delete mode 100644 administrator/components/com_messages/toolbar.messages.php create mode 100644 administrator/components/com_messages/views/index.html create mode 100644 administrator/components/com_messages/views/message/index.html create mode 100644 administrator/components/com_messages/views/message/tmpl/default.php create mode 100644 administrator/components/com_messages/views/message/tmpl/default_form.php create mode 100644 administrator/components/com_messages/views/message/tmpl/index.html create mode 100644 administrator/components/com_messages/views/message/view.html.php create mode 100644 administrator/components/com_messages/views/messages/index.html create mode 100644 administrator/components/com_messages/views/messages/tmpl/default.php create mode 100644 administrator/components/com_messages/views/messages/tmpl/index.html create mode 100644 administrator/components/com_messages/views/messages/view.html.php delete mode 100644 administrator/components/com_modules/admin.modules.html.php create mode 100644 administrator/components/com_modules/classes/filter.php create mode 100644 administrator/components/com_modules/classes/index.html create mode 100644 administrator/components/com_modules/models/modules.php rename administrator/components/com_modules/{toolbar.modules.php => modules.php} (52%) delete mode 100644 administrator/components/com_modules/toolbar.modules.html.php create mode 100644 administrator/components/com_modules/views/index.html create mode 100644 administrator/components/com_modules/views/module/index.html create mode 100644 administrator/components/com_modules/views/module/tmpl/default.php create mode 100644 administrator/components/com_modules/views/module/tmpl/index.html create mode 100644 administrator/components/com_modules/views/module/view.html.php create mode 100644 administrator/components/com_modules/views/modules/index.html create mode 100644 administrator/components/com_modules/views/modules/tmpl/default.php create mode 100644 administrator/components/com_modules/views/modules/tmpl/index.html create mode 100644 administrator/components/com_modules/views/modules/view.html.php create mode 100644 administrator/components/com_modules/views/prevuuw/index.html create mode 100644 administrator/components/com_modules/views/prevuuw/tmpl/default.php create mode 100644 administrator/components/com_modules/views/prevuuw/tmpl/index.html rename administrator/components/{com_users/users.class.php => com_modules/views/prevuuw/view.html.php} (60%) create mode 100644 administrator/components/com_modules/views/selecttype/index.html create mode 100644 administrator/components/com_modules/views/selecttype/tmpl/default.php create mode 100644 administrator/components/com_modules/views/selecttype/tmpl/index.html create mode 100644 administrator/components/com_modules/views/selecttype/view.html.php delete mode 100644 administrator/components/com_newsfeeds/admin.newsfeeds.html.php delete mode 100644 administrator/components/com_newsfeeds/admin.newsfeeds.php create mode 100644 administrator/components/com_newsfeeds/controller.php create mode 100644 administrator/components/com_newsfeeds/models/index.html create mode 100644 administrator/components/com_newsfeeds/models/newsfeed.php create mode 100644 administrator/components/com_newsfeeds/models/newsfeeds.php create mode 100644 administrator/components/com_newsfeeds/newsfeeds.php delete mode 100644 administrator/components/com_newsfeeds/toolbar.newsfeeds.html.php create mode 100644 administrator/components/com_newsfeeds/views/index.html create mode 100644 administrator/components/com_newsfeeds/views/newsfeed/index.html create mode 100644 administrator/components/com_newsfeeds/views/newsfeed/tmpl/default.php create mode 100644 administrator/components/com_newsfeeds/views/newsfeed/tmpl/index.html create mode 100644 administrator/components/com_newsfeeds/views/newsfeed/view.html.php create mode 100644 administrator/components/com_newsfeeds/views/newsfeeds/index.html create mode 100644 administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php create mode 100644 administrator/components/com_newsfeeds/views/newsfeeds/tmpl/index.html create mode 100644 administrator/components/com_newsfeeds/views/newsfeeds/view.html.php delete mode 100644 administrator/components/com_sections/admin.sections.html.php delete mode 100644 administrator/components/com_sections/admin.sections.php create mode 100644 administrator/components/com_sections/config.xml create mode 100644 administrator/components/com_sections/controller.php create mode 100644 administrator/components/com_sections/models/index.html create mode 100644 administrator/components/com_sections/models/section.php create mode 100644 administrator/components/com_sections/models/sections.php rename administrator/components/{com_newsfeeds/toolbar.newsfeeds.php => com_sections/sections.php} (70%) create mode 100644 administrator/components/com_sections/sections.xml create mode 100644 administrator/components/com_sections/tables/index.html create mode 100644 administrator/components/com_sections/tables/section.php delete mode 100644 administrator/components/com_sections/toolbar.sections.html.php create mode 100644 administrator/components/com_sections/views/copyselect/index.html create mode 100644 administrator/components/com_sections/views/copyselect/tmpl/default.php create mode 100644 administrator/components/com_sections/views/copyselect/tmpl/index.html create mode 100644 administrator/components/com_sections/views/copyselect/view.html.php create mode 100644 administrator/components/com_sections/views/index.html create mode 100644 administrator/components/com_sections/views/section/index.html create mode 100644 administrator/components/com_sections/views/section/tmpl/default.php create mode 100644 administrator/components/com_sections/views/section/tmpl/index.html create mode 100644 administrator/components/com_sections/views/section/view.html.php create mode 100644 administrator/components/com_sections/views/sections/index.html create mode 100644 administrator/components/com_sections/views/sections/tmpl/default.php create mode 100644 administrator/components/com_sections/views/sections/tmpl/index.html create mode 100644 administrator/components/com_sections/views/sections/view.html.php delete mode 100644 administrator/components/com_templates/admin.templates.html.php delete mode 100644 administrator/components/com_templates/admin.templates.php create mode 100644 administrator/components/com_templates/models/cssedit.php create mode 100644 administrator/components/com_templates/models/index.html create mode 100644 administrator/components/com_templates/models/source.php create mode 100644 administrator/components/com_templates/models/template.php create mode 100644 administrator/components/com_templates/models/templates.php rename administrator/components/{com_sections/toolbar.sections.php => com_templates/templates.php} (53%) delete mode 100644 administrator/components/com_templates/toolbar.templates.html.php delete mode 100644 administrator/components/com_templates/toolbar.templates.php create mode 100644 administrator/components/com_templates/views/csschoose/index.html create mode 100644 administrator/components/com_templates/views/csschoose/tmpl/default.php create mode 100644 administrator/components/com_templates/views/csschoose/tmpl/index.html create mode 100644 administrator/components/com_templates/views/csschoose/view.html.php create mode 100644 administrator/components/com_templates/views/cssedit/index.html create mode 100644 administrator/components/com_templates/views/cssedit/tmpl/default.php create mode 100644 administrator/components/com_templates/views/cssedit/tmpl/index.html create mode 100644 administrator/components/com_templates/views/cssedit/view.html.php create mode 100644 administrator/components/com_templates/views/index.html create mode 100644 administrator/components/com_templates/views/prevuuw/index.html create mode 100644 administrator/components/com_templates/views/prevuuw/tmpl/default.php create mode 100644 administrator/components/com_templates/views/prevuuw/tmpl/index.html create mode 100644 administrator/components/com_templates/views/prevuuw/view.html.php create mode 100644 administrator/components/com_templates/views/source/index.html create mode 100644 administrator/components/com_templates/views/source/tmpl/default.php create mode 100644 administrator/components/com_templates/views/source/tmpl/index.html create mode 100644 administrator/components/com_templates/views/source/view.html.php create mode 100644 administrator/components/com_templates/views/template/index.html create mode 100644 administrator/components/com_templates/views/template/tmpl/default.php create mode 100644 administrator/components/com_templates/views/template/tmpl/index.html create mode 100644 administrator/components/com_templates/views/template/view.html.php create mode 100644 administrator/components/com_templates/views/templates/index.html create mode 100644 administrator/components/com_templates/views/templates/tmpl/default.php create mode 100644 administrator/components/com_templates/views/templates/tmpl/index.html create mode 100644 administrator/components/com_templates/views/templates/view.html.php create mode 100644 administrator/components/com_users/controllers/index.html create mode 100644 administrator/components/com_users/controllers/user.php create mode 100644 administrator/components/com_users/helpers/html/fx.php create mode 100644 administrator/components/com_users/helpers/html/index.html create mode 100644 administrator/components/com_users/helpers/html/user.php create mode 100644 administrator/components/com_users/helpers/index.html create mode 100644 administrator/components/com_users/models/_prototype.php create mode 100644 administrator/components/com_users/models/user.php create mode 100644 administrator/components/com_users/params/author.xml create mode 100644 administrator/components/com_users/params/general_messages.xml create mode 100644 administrator/components/com_users/params/index.html create mode 100644 administrator/components/com_users/params/registered.xml create mode 100644 administrator/components/com_users/params/user.xml create mode 100644 administrator/components/com_users/tables/group.php create mode 100644 administrator/components/com_users/tables/index.html create mode 100644 administrator/components/com_users/views/user/tmpl/edit.php create mode 100644 administrator/components/com_users/views/user/tmpl/edit_contact.php create mode 100644 administrator/components/com_users/views/user/tmpl/edit_groups.php create mode 100644 administrator/components/com_users/views/user/tmpl/edit_main.php create mode 100644 administrator/components/com_users/views/user/tmpl/edit_parameters.php delete mode 100644 administrator/components/com_users/views/user/tmpl/form.php create mode 100644 administrator/components/com_weblinks/classes/index.html create mode 100644 administrator/components/com_weblinks/classes/weblink.php create mode 100644 administrator/components/com_weblinks/elements/index.html create mode 100644 administrator/components/com_weblinks/elements/snapshotsource.php create mode 100644 administrator/components/com_weblinks/models/snapshotsources.php create mode 100644 administrator/components/com_weblinks/models/snapshotsources.xml create mode 100644 administrator/help/en-GB/screen.banner.categories.edit.html create mode 100644 administrator/help/en-GB/screen.banner.categories.html create mode 100644 administrator/help/en-GB/screen.cache.html create mode 100644 administrator/help/en-GB/screen.contact_details.categories.edit.html create mode 100644 administrator/help/en-GB/screen.contact_details.categories.html create mode 100644 administrator/help/en-GB/screen.content.categories.edit.html create mode 100644 administrator/help/en-GB/screen.content.categories.html create mode 100644 administrator/help/en-GB/screen.messages.edit.html create mode 100644 administrator/help/en-GB/screen.messages.read.html create mode 100644 administrator/help/en-GB/screen.modulesadministrator.edit.html create mode 100644 administrator/help/en-GB/screen.modulessite.edit.html create mode 100644 administrator/help/en-GB/screen.newsfeeds.categories.edit.html create mode 100644 administrator/help/en-GB/screen.newsfeeds.categories.html create mode 100644 administrator/help/en-GB/screen.users.html create mode 100644 administrator/help/en-GB/screen.weblinks.categories.edit.html create mode 100644 administrator/help/en-GB/screen.weblinks.categories.html rename {includes/js/ThemeOffice => administrator/images}/mainmenu.png (100%) delete mode 100644 administrator/includes/js/ThemeOffice/index.html delete mode 100644 administrator/includes/js/ThemeOffice/theme.js delete mode 100644 administrator/includes/js/ThemeOffice/theme_rtl.js delete mode 100644 administrator/includes/js/index.html rename administrator/{components/com_config/toolbar.config.php => includes/menu.php} (60%) delete mode 100644 administrator/includes/pageNavigation.php delete mode 100644 administrator/includes/pcl/index.html delete mode 100644 administrator/includes/pcl/pclerror.lib.php delete mode 100644 administrator/includes/pcl/pcltar.lib.php delete mode 100644 administrator/includes/pcl/pcltrace.lib.php delete mode 100644 administrator/includes/pcl/pclzip.lib.php delete mode 100644 administrator/includes/pcl/zip.lib.php delete mode 100644 administrator/index2.php delete mode 100644 administrator/index3.php create mode 100644 administrator/language/en-GB/en-GB.com_acl.ini create mode 100644 administrator/language/en-GB/en-GB.com_contactdirectory.ini create mode 100644 administrator/language/en-GB/en-GB.mod_feed.ini create mode 100644 components/com_contact/views/contact/view.vcard.php create mode 100755 components/com_contactdirectory/contactdirectory.php create mode 100755 components/com_contactdirectory/controller.php create mode 100755 components/com_contactdirectory/css/contactdirectory.css create mode 100755 components/com_contactdirectory/css/index.html create mode 100755 components/com_contactdirectory/includes/index.html rename includes/phpmailer/LICENSE => components/com_contactdirectory/includes/securimage/LICENSE.txt (92%) create mode 100644 components/com_contactdirectory/includes/securimage/README.txt create mode 100644 components/com_contactdirectory/includes/securimage/artistamp.ttf create mode 100644 components/com_contactdirectory/includes/securimage/elephant.ttf create mode 100644 components/com_contactdirectory/includes/securimage/gdfonts/automatic.gdf create mode 100644 components/com_contactdirectory/includes/securimage/gdfonts/bubblebath.gdf create mode 100644 components/com_contactdirectory/includes/securimage/gdfonts/caveman.gdf create mode 100644 components/com_contactdirectory/includes/securimage/gdfonts/crass.gdf create mode 100644 components/com_contactdirectory/includes/securimage/images/audio_icon.gif create mode 100644 components/com_contactdirectory/includes/securimage/images/pattern.gif create mode 100644 components/com_contactdirectory/includes/securimage/images/refresh.gif create mode 100755 components/com_contactdirectory/includes/securimage/index.html create mode 100644 components/com_contactdirectory/includes/securimage/securimage.php create mode 100644 components/com_contactdirectory/includes/securimage/securimage_example.php create mode 100644 components/com_contactdirectory/includes/securimage/securimage_play.php create mode 100644 components/com_contactdirectory/includes/securimage/securimage_show.php create mode 100755 components/com_contactdirectory/index.html create mode 100755 components/com_contactdirectory/metadata.xml create mode 100755 components/com_contactdirectory/models/categories.php create mode 100755 components/com_contactdirectory/models/category.php create mode 100755 components/com_contactdirectory/models/contact.php create mode 100755 components/com_contactdirectory/models/index.html create mode 100755 components/com_contactdirectory/router.php create mode 100755 components/com_contactdirectory/views/categories/index.html create mode 100755 components/com_contactdirectory/views/categories/metadata.xml create mode 100755 components/com_contactdirectory/views/categories/tmpl/default.php create mode 100755 components/com_contactdirectory/views/categories/tmpl/default.xml create mode 100755 components/com_contactdirectory/views/categories/tmpl/default_groupby.php create mode 100755 components/com_contactdirectory/views/categories/tmpl/default_list.php create mode 100755 components/com_contactdirectory/views/categories/tmpl/index.html create mode 100755 components/com_contactdirectory/views/categories/view.html.php create mode 100755 components/com_contactdirectory/views/category/index.html create mode 100755 components/com_contactdirectory/views/category/metadata.xml create mode 100755 components/com_contactdirectory/views/category/tmpl/default.php create mode 100755 components/com_contactdirectory/views/category/tmpl/default.xml create mode 100755 components/com_contactdirectory/views/category/tmpl/index.html create mode 100755 components/com_contactdirectory/views/category/view.html.php create mode 100755 components/com_contactdirectory/views/contact/index.html create mode 100755 components/com_contactdirectory/views/contact/metadata.xml create mode 100755 components/com_contactdirectory/views/contact/tmpl/default.php create mode 100755 components/com_contactdirectory/views/contact/tmpl/default.xml create mode 100755 components/com_contactdirectory/views/contact/tmpl/default_form.php create mode 100755 components/com_contactdirectory/views/contact/tmpl/index.html create mode 100755 components/com_contactdirectory/views/contact/view.html.php create mode 100755 components/com_contactdirectory/views/index.html create mode 100644 components/com_weblinks/helpers/query.php create mode 100644 components/com_weblinks/models/weblinks.php create mode 100644 components/com_weblinks/views/weblinks/index.html create mode 100644 components/com_weblinks/views/weblinks/metadata.xml create mode 100644 components/com_weblinks/views/weblinks/tmpl/default.php create mode 100644 components/com_weblinks/views/weblinks/tmpl/default.xml create mode 100644 components/com_weblinks/views/weblinks/tmpl/default_items.php create mode 100644 components/com_weblinks/views/weblinks/tmpl/index.html create mode 100644 components/com_weblinks/views/weblinks/view.html.php delete mode 100644 includes/Archive/Tar.php delete mode 100644 includes/Archive/index.html delete mode 100644 includes/HTML_toolbar.php delete mode 100644 includes/PEAR/PEAR.php delete mode 100644 includes/PEAR/index.html delete mode 100644 includes/database.mysqli.php delete mode 100644 includes/database.php delete mode 100644 includes/domit/index.html delete mode 100644 includes/domit/xml_domit_include.php delete mode 100644 includes/domit/xml_domit_lite_include.php delete mode 100644 includes/domit/xml_domit_lite_parser.php delete mode 100644 includes/domit/xml_domit_rss.php delete mode 100644 includes/domit/xml_domit_rss_lite.php delete mode 100644 includes/feedcreator.class.php delete mode 100644 includes/gacl.class.php delete mode 100644 includes/gacl_api.class.php delete mode 100644 includes/joomla.php delete mode 100644 includes/js/JSCookMenu.js delete mode 100644 includes/js/JSCookMenu_mini.js delete mode 100644 includes/js/ThemeOffice/add_section.png delete mode 100644 includes/js/ThemeOffice/arrow.png delete mode 100644 includes/js/ThemeOffice/arrow_rtl.png delete mode 100644 includes/js/ThemeOffice/backup.png delete mode 100644 includes/js/ThemeOffice/blank.png delete mode 100644 includes/js/ThemeOffice/categories.png delete mode 100644 includes/js/ThemeOffice/checkin.png delete mode 100644 includes/js/ThemeOffice/component.png delete mode 100644 includes/js/ThemeOffice/config.png delete mode 100644 includes/js/ThemeOffice/content.png delete mode 100644 includes/js/ThemeOffice/controlpanel.png delete mode 100644 includes/js/ThemeOffice/credits.png delete mode 100644 includes/js/ThemeOffice/db.png delete mode 100644 includes/js/ThemeOffice/document.png delete mode 100644 includes/js/ThemeOffice/edit.png delete mode 100644 includes/js/ThemeOffice/globe1.png delete mode 100644 includes/js/ThemeOffice/globe2.png delete mode 100644 includes/js/ThemeOffice/globe3.png delete mode 100644 includes/js/ThemeOffice/globe4.png delete mode 100644 includes/js/ThemeOffice/help.png delete mode 100644 includes/js/ThemeOffice/home.png delete mode 100644 includes/js/ThemeOffice/index.html delete mode 100644 includes/js/ThemeOffice/install.png delete mode 100644 includes/js/ThemeOffice/language.png delete mode 100644 includes/js/ThemeOffice/license.png delete mode 100644 includes/js/ThemeOffice/mail.png delete mode 100644 includes/js/ThemeOffice/mass_email.png delete mode 100644 includes/js/ThemeOffice/media.png delete mode 100644 includes/js/ThemeOffice/menus.png delete mode 100644 includes/js/ThemeOffice/messaging.png delete mode 100644 includes/js/ThemeOffice/messaging_config.png delete mode 100644 includes/js/ThemeOffice/messaging_inbox.png delete mode 100644 includes/js/ThemeOffice/module.png delete mode 100644 includes/js/ThemeOffice/preview.png delete mode 100644 includes/js/ThemeOffice/query.png delete mode 100644 includes/js/ThemeOffice/restore.png delete mode 100644 includes/js/ThemeOffice/search_text.png delete mode 100644 includes/js/ThemeOffice/sections.png delete mode 100644 includes/js/ThemeOffice/spacer.png delete mode 100644 includes/js/ThemeOffice/statistics.png delete mode 100644 includes/js/ThemeOffice/sysinfo.png delete mode 100644 includes/js/ThemeOffice/template.png delete mode 100644 includes/js/ThemeOffice/theme.css delete mode 100644 includes/js/ThemeOffice/theme.js delete mode 100644 includes/js/ThemeOffice/tooltip.png delete mode 100644 includes/js/ThemeOffice/trash.png delete mode 100644 includes/js/ThemeOffice/tux.png delete mode 100644 includes/js/ThemeOffice/user.png delete mode 100644 includes/js/ThemeOffice/users.png delete mode 100644 includes/js/ThemeOffice/users_add.png delete mode 100644 includes/js/calendar/README delete mode 100644 includes/js/calendar/calendar-mos.css delete mode 100644 includes/js/calendar/calendar.js delete mode 100644 includes/js/calendar/calendar_mini.js delete mode 100644 includes/js/calendar/index.html delete mode 100644 includes/js/calendar/lang/calendar-en-GB.js delete mode 100644 includes/js/calendar/lang/index.html delete mode 100644 includes/js/dtree/dtree.css delete mode 100644 includes/js/dtree/dtree.js delete mode 100644 includes/js/dtree/dtree_rtl.css delete mode 100644 includes/js/dtree/img/archive.gif delete mode 100644 includes/js/dtree/img/base.gif delete mode 100644 includes/js/dtree/img/cd.gif delete mode 100644 includes/js/dtree/img/empty.gif delete mode 100644 includes/js/dtree/img/folder.gif delete mode 100644 includes/js/dtree/img/folderopen.gif delete mode 100644 includes/js/dtree/img/frontpage.gif delete mode 100644 includes/js/dtree/img/globe.gif delete mode 100644 includes/js/dtree/img/imgfolder.gif delete mode 100644 includes/js/dtree/img/index.html delete mode 100644 includes/js/dtree/img/join.gif delete mode 100644 includes/js/dtree/img/joinbottom.gif delete mode 100644 includes/js/dtree/img/line.gif delete mode 100644 includes/js/dtree/img/minus.gif delete mode 100644 includes/js/dtree/img/minusbottom.gif delete mode 100644 includes/js/dtree/img/musicfolder.gif delete mode 100644 includes/js/dtree/img/nolines_minus.gif delete mode 100644 includes/js/dtree/img/nolines_plus.gif delete mode 100644 includes/js/dtree/img/page.gif delete mode 100644 includes/js/dtree/img/plus.gif delete mode 100644 includes/js/dtree/img/plusbottom.gif delete mode 100644 includes/js/dtree/img/question.gif delete mode 100644 includes/js/dtree/img/square.gif delete mode 100644 includes/js/dtree/img/trash.gif delete mode 100644 includes/js/dtree/index.html delete mode 100644 includes/js/dtree/rtl_img/archive.gif delete mode 100644 includes/js/dtree/rtl_img/base.gif delete mode 100644 includes/js/dtree/rtl_img/cd.gif delete mode 100644 includes/js/dtree/rtl_img/empty.gif delete mode 100644 includes/js/dtree/rtl_img/folder.gif delete mode 100644 includes/js/dtree/rtl_img/folderopen.gif delete mode 100644 includes/js/dtree/rtl_img/frontpage.gif delete mode 100644 includes/js/dtree/rtl_img/globe.gif delete mode 100644 includes/js/dtree/rtl_img/imgfolder.gif delete mode 100644 includes/js/dtree/rtl_img/index.html delete mode 100644 includes/js/dtree/rtl_img/join.gif delete mode 100644 includes/js/dtree/rtl_img/joinbottom.gif delete mode 100644 includes/js/dtree/rtl_img/line.gif delete mode 100644 includes/js/dtree/rtl_img/minus.gif delete mode 100644 includes/js/dtree/rtl_img/minusbottom.gif delete mode 100644 includes/js/dtree/rtl_img/musicfolder.gif delete mode 100644 includes/js/dtree/rtl_img/nolines_minus.gif delete mode 100644 includes/js/dtree/rtl_img/nolines_plus.gif delete mode 100644 includes/js/dtree/rtl_img/page.gif delete mode 100644 includes/js/dtree/rtl_img/plus.gif delete mode 100644 includes/js/dtree/rtl_img/plusbottom.gif delete mode 100644 includes/js/dtree/rtl_img/question.gif delete mode 100644 includes/js/dtree/rtl_img/square.gif delete mode 100644 includes/js/dtree/rtl_img/trash.gif delete mode 100644 includes/js/index.html delete mode 100644 includes/js/jscalendar-1.0/calendar-setup_stripped.js delete mode 100644 includes/js/jscalendar-1.0/calendar-system.css delete mode 100644 includes/js/jscalendar-1.0/calendar_stripped.js delete mode 100644 includes/js/jscalendar-1.0/index.html delete mode 100644 includes/js/jscalendar-1.0/lang/calendar-en.js delete mode 100644 includes/js/jscalendar-1.0/lang/cn_utf8.js delete mode 100644 includes/js/jscalendar-1.0/lang/index.html delete mode 100644 includes/js/jscalendar-1.0/menuarrow.gif delete mode 100644 includes/js/jscalendar-1.0/menuarrow2.gif delete mode 100644 includes/js/mambojavascript.js delete mode 100644 includes/js/overlib_hideform_mini.js delete mode 100644 includes/js/overlib_mini.js delete mode 100644 includes/js/tabs/index.html delete mode 100644 includes/js/tabs/tab_active_l.png delete mode 100644 includes/js/tabs/tab_active_r.png delete mode 100644 includes/js/tabs/tab_hover_l.png delete mode 100644 includes/js/tabs/tab_hover_r.png delete mode 100644 includes/js/tabs/tab_l.png delete mode 100644 includes/js/tabs/tab_r.png delete mode 100644 includes/js/tabs/tabpane.css delete mode 100644 includes/js/tabs/tabpane.js delete mode 100644 includes/js/tabs/tabpane_mini.js delete mode 100644 includes/js/tabs/tabpane_rtl.css delete mode 100644 includes/js/wz_tooltip.js delete mode 100644 includes/mambo.php delete mode 100644 includes/mamboxml.php delete mode 100644 includes/pageNavigation.php delete mode 100644 includes/phpInputFilter/class.inputfilter.php delete mode 100644 includes/phpInputFilter/index.html delete mode 100644 includes/phpmailer/class.phpmailer.php delete mode 100644 includes/phpmailer/class.smtp.php delete mode 100644 includes/phpmailer/index.html delete mode 100644 includes/vcard.class.php delete mode 100644 index2.php create mode 100644 installation/installer/views/install/tmpl/default.php rename installation/{template/tmpl/dbconfig.html => installer/views/install/tmpl/default_dbconfig.php} (50%) create mode 100644 installation/installer/views/install/tmpl/default_error.php create mode 100644 installation/installer/views/install/tmpl/default_finish.php rename installation/{template/tmpl/ftpconfig.html => installer/views/install/tmpl/default_ftpconfig.php} (54%) create mode 100644 installation/installer/views/install/tmpl/default_lang.php create mode 100644 installation/installer/views/install/tmpl/default_license.php create mode 100644 installation/installer/views/install/tmpl/default_mainconfig.php rename installation/{template/tmpl/migration.html => installer/views/install/tmpl/default_migration.php} (50%) create mode 100644 installation/installer/views/install/tmpl/default_preinstall.php create mode 100644 installation/installer/views/install/tmpl/index.html rename administrator/components/com_checkin/toolbar.checkin.php => installation/installer/views/install/tmpl/removedir.php (61%) mode change 100644 => 100755 delete mode 100644 installation/language/af-ZA/af-ZA.ini delete mode 100644 installation/language/af-ZA/af-ZA.xml delete mode 100644 installation/language/af-ZA/index.html delete mode 100644 installation/language/ar-DZ/ar-DZ.ini delete mode 100644 installation/language/ar-DZ/ar-DZ.xml delete mode 100644 installation/language/ar-DZ/index.html create mode 100644 installation/language/be-BY/be-BY.ini create mode 100644 installation/language/be-BY/be-BY.xml create mode 100644 installation/language/be-BY/index.html create mode 100644 installation/language/bg-BG/index.htm delete mode 100644 installation/language/bg-BG/index.html create mode 100644 installation/language/ca-ES/ca-ES.ini create mode 100644 installation/language/ca-ES/ca-ES.xml create mode 100644 installation/language/ca-ES/index.htm create mode 100644 installation/language/da-DK/index.htm delete mode 100644 installation/language/da-DK/index.html create mode 100644 installation/language/de-CH/index.htm delete mode 100644 installation/language/de-CH/index.html create mode 100644 installation/language/de-DE/index.htm delete mode 100644 installation/language/de-DE/index.html create mode 100644 installation/language/el-GR/index.htm delete mode 100644 installation/language/el-GR/index.html create mode 100644 installation/language/en-US/en-US.ini create mode 100644 installation/language/en-US/en-US.xml create mode 100644 installation/language/en-US/index.htm create mode 100644 installation/language/es-ES/index.htm delete mode 100644 installation/language/es-ES/index.html delete mode 100644 installation/language/hi-IN/hi-IN.ini delete mode 100644 installation/language/hi-IN/hi-IN.xml delete mode 100644 installation/language/hi-IN/index.html create mode 100644 installation/language/hu-HU/index.htm delete mode 100644 installation/language/hu-HU/index.html create mode 100644 installation/language/it-IT/index.htm delete mode 100644 installation/language/it-IT/index.html create mode 100644 installation/language/ko-KR/index.html create mode 100644 installation/language/ko-KR/ko-KR.ini create mode 100644 installation/language/ko-KR/ko-KR.xml create mode 100644 installation/language/lt-LT/index.htm delete mode 100644 installation/language/lt-LT/index.html create mode 100644 installation/language/nb-NO/index.htm delete mode 100644 installation/language/nb-NO/index.html create mode 100644 installation/language/nl-NL/index.htm delete mode 100644 installation/language/nl-NL/index.html create mode 100644 installation/language/pt-BR/index.htm delete mode 100644 installation/language/pt-BR/index.html create mode 100644 installation/language/ro-RO/index.htm delete mode 100644 installation/language/ro-RO/index.html create mode 100644 installation/language/sd-PK/index.html create mode 100644 installation/language/sd-PK/sd-PK.ini create mode 100644 installation/language/sd-PK/sd-PK.xml create mode 100644 installation/language/si-LK/index.htm create mode 100644 installation/language/si-LK/si-LK.ini create mode 100644 installation/language/si-LK/si-LK.xml create mode 100644 installation/language/sr-RS/index.htm delete mode 100644 installation/language/sr-RS/index.html create mode 100644 installation/language/sv-SE/index.htm delete mode 100644 installation/language/sv-SE/index.html create mode 100644 installation/language/sy-IQ/index.html create mode 100644 installation/language/sy-IQ/sy-IQ.ini create mode 100644 installation/language/sy-IQ/sy-IQ.xml create mode 100644 installation/language/ta-LK/index.html create mode 100644 installation/language/ta-LK/ta-LK.ini create mode 100644 installation/language/ta-LK/ta-LK.xml create mode 100644 installation/language/tr-TR/index.htm delete mode 100644 installation/language/tr-TR/index.html delete mode 100644 installation/sql/mysql/diff.sql create mode 100644 installation/sql/mysql/diff_15_to_16.sql delete mode 100644 installation/sql/mysql/diff_rc1_to_rc2.sql delete mode 100644 installation/sql/mysql/diff_rc2_to_rc3.sql delete mode 100644 installation/sql/mysql/diff_rc3_to_rc4.sql delete mode 100644 installation/sql/mysql/joomla_backward.sql delete mode 100644 installation/template/tmpl/configuration.html delete mode 100644 installation/template/tmpl/error.html delete mode 100644 installation/template/tmpl/finish.html delete mode 100644 installation/template/tmpl/index.html delete mode 100644 installation/template/tmpl/language.html delete mode 100644 installation/template/tmpl/license.html delete mode 100644 installation/template/tmpl/mainconfig.html delete mode 100644 installation/template/tmpl/page.html delete mode 100644 installation/template/tmpl/preinstall.html delete mode 100755 installation/template/tmpl/removedir.html create mode 100644 language/en-GB/en-GB.com_contactdirectory.ini delete mode 100644 libraries/bitfolge/feedcreator.php delete mode 100644 libraries/bitfolge/index.html delete mode 100644 libraries/bitfolge/vcard.php create mode 100644 libraries/joomla/base/stdclass.php create mode 100644 libraries/joomla/database/query.php create mode 100644 libraries/joomla/database/table/acl.php create mode 100644 libraries/joomla/database/table/axogroup.php create mode 100644 libraries/joomla/database/table/axomap.php create mode 100644 libraries/joomla/database/table/group.php create mode 100644 libraries/joomla/database/table/tree.php rename plugins/system/legacy/profiler.php => libraries/joomla/document/html/renderer/installation.php (51%) create mode 100644 libraries/joomla/document/vcard/index.html create mode 100644 libraries/joomla/document/vcard/vcard.php create mode 100644 libraries/joomla/filesystem/filesystem.php create mode 100644 libraries/joomla/filesystem/filesystem/ftp.php create mode 100644 libraries/joomla/filesystem/filesystem/ftp.xml create mode 100644 libraries/joomla/filesystem/filesystem/php.php create mode 100644 libraries/joomla/filesystem/filesystem/ssh.php create mode 100644 libraries/joomla/filesystem/filesystem/ssh.xml create mode 100644 libraries/joomla/html/form.php delete mode 100644 libraries/joomla/template/index.html delete mode 100644 libraries/joomla/template/module/function/index.html delete mode 100644 libraries/joomla/template/module/index.html delete mode 100644 libraries/joomla/template/module/modifier/index.html delete mode 100644 libraries/joomla/template/tmpl/index.html delete mode 100644 libraries/joomla/utilities/compat/php50x.php delete mode 100644 libraries/phpinputfilter/index.html delete mode 100644 libraries/phpinputfilter/inputfilter.php delete mode 100644 libraries/phputf8/LICENSE delete mode 100644 libraries/phputf8/README delete mode 100644 libraries/phputf8/TODO.tsk delete mode 100644 libraries/phputf8/index.html delete mode 100644 libraries/phputf8/mbstring/case.php delete mode 100644 libraries/phputf8/mbstring/core.php delete mode 100644 libraries/phputf8/mbstring/index.html delete mode 100644 libraries/phputf8/mbstring/strlen.php delete mode 100644 libraries/phputf8/native/case.php delete mode 100644 libraries/phputf8/native/core.php delete mode 100644 libraries/phputf8/native/index.html delete mode 100644 libraries/phputf8/native/strlen.php delete mode 100644 libraries/phputf8/str_ireplace.php delete mode 100644 libraries/phputf8/str_split.php delete mode 100644 libraries/phputf8/strcasecmp.php delete mode 100644 libraries/phputf8/strcspn.php delete mode 100644 libraries/phputf8/stristr.php delete mode 100644 libraries/phputf8/strrev.php delete mode 100644 libraries/phputf8/strspn.php delete mode 100644 libraries/phputf8/substr_replace.php delete mode 100644 libraries/phputf8/trim.php delete mode 100644 libraries/phputf8/ucfirst.php delete mode 100644 libraries/phputf8/ucwords.php delete mode 100644 libraries/phputf8/utf8.php delete mode 100644 libraries/phputf8/utils/ascii.php delete mode 100644 libraries/phputf8/utils/bad.php delete mode 100644 libraries/phputf8/utils/index.html delete mode 100644 libraries/phputf8/utils/patterns.php delete mode 100644 libraries/phputf8/utils/specials.php delete mode 100644 libraries/phputf8/utils/unicode.php delete mode 100644 libraries/phputf8/utils/validation.php rename {includes/js/ThemeOffice => media/system/images}/warning.png (100%) rename includes/js/joomla.javascript.js => media/system/js/legacy.js (95%) delete mode 100644 media/system/js/tabs.js delete mode 100644 modules/mod_mainmenu/legacy.php delete mode 100644 plugins/system/backlink.php delete mode 100644 plugins/system/backlink.xml delete mode 100644 plugins/system/legacy/adminmenus.php delete mode 100644 plugins/system/legacy/cache.php delete mode 100644 plugins/system/legacy/category.php delete mode 100644 plugins/system/legacy/classes.php delete mode 100644 plugins/system/legacy/commonhtml.php delete mode 100644 plugins/system/legacy/component.php delete mode 100644 plugins/system/legacy/content.php delete mode 100644 plugins/system/legacy/dbtable.php delete mode 100644 plugins/system/legacy/functions.php delete mode 100644 plugins/system/legacy/html.php delete mode 100644 plugins/system/legacy/installer.php delete mode 100644 plugins/system/legacy/mainframe.php delete mode 100644 plugins/system/legacy/mambot.php delete mode 100644 plugins/system/legacy/mambothandler.php delete mode 100644 plugins/system/legacy/menu.php delete mode 100644 plugins/system/legacy/menubar.php delete mode 100644 plugins/system/legacy/module.php delete mode 100644 plugins/system/legacy/mysql.php delete mode 100644 plugins/system/legacy/mysqli.php delete mode 100644 plugins/system/legacy/pagination.php delete mode 100644 plugins/system/legacy/parameters.php delete mode 100644 plugins/system/legacy/patfactory.php delete mode 100644 plugins/system/legacy/section.php delete mode 100644 plugins/system/legacy/session.php create mode 100644 plugins/system/legacy/template/index.html rename {libraries/joomla => plugins/system/legacy}/template/module/function/Sef.php (100%) rename {libraries/joomla => plugins/system/legacy}/template/module/function/Translate.php (94%) create mode 100644 plugins/system/legacy/template/module/function/index.html create mode 100644 plugins/system/legacy/template/module/index.html rename {libraries/joomla => plugins/system/legacy}/template/module/modifier/SEF.php (100%) rename {libraries/joomla => plugins/system/legacy}/template/module/modifier/Translate.php (100%) create mode 100644 plugins/system/legacy/template/module/modifier/index.html rename {libraries/joomla => plugins/system/legacy}/template/template.php (98%) rename {libraries/joomla => plugins/system/legacy}/template/tmpl/adminfilters.html (100%) rename {libraries/joomla => plugins/system/legacy}/template/tmpl/adminlists.html (97%) rename {libraries/joomla => plugins/system/legacy}/template/tmpl/breadcrumbs.html (100%) rename {libraries/joomla => plugins/system/legacy}/template/tmpl/calendar.html (100%) rename {libraries/joomla => plugins/system/legacy}/template/tmpl/dtree.html (100%) rename {libraries/joomla => plugins/system/legacy}/template/tmpl/forms.html (100%) rename {libraries/joomla => plugins/system/legacy}/template/tmpl/help.html (100%) create mode 100644 plugins/system/legacy/template/tmpl/index.html rename {libraries/joomla => plugins/system/legacy}/template/tmpl/page.html (100%) rename {libraries/joomla => plugins/system/legacy}/template/tmpl/tabs.html (100%) delete mode 100644 plugins/system/legacy/toolbar.php delete mode 100644 plugins/system/legacy/user.php delete mode 100644 plugins/tmp/index.html create mode 100644 templates/system/images/report.png diff --git a/CHANGELOG.php b/CHANGELOG.php index 7979476d61a05..19beca1094057 100644 --- a/CHANGELOG.php +++ b/CHANGELOG.php @@ -23,11 +23,10 @@ 2. Changelog ------------ This is a non-exhaustive (but still near complete) changelog for -Joomla! 1.5, including beta and release candidate versions. +Joomla! 1.6, including beta and release candidate versions. Our thanks to all those people who've contributed bug reports and code fixes. - Legend: * -> Security Fix @@ -36,13 +35,140 @@ + -> Addition ^ -> Change - -> Removed -! -> Note - +! -> Note + +COMMITERS + +Do not forget to update this page on the wiki when making changes relevant to developers: +http://docs.joomla.org/index.php?title=Version_1.6_Developer_Notes + +14-Oct-2008 Alan Langford + + Added JLanguage::getLanguageIdentifier() plus much rework of class (with supporting unit tests) + +14-Oct-2008 Andrew Eddie + ! SCHEMA CHANGE - REINSTALL REQUIRED + ^ Broke ACLs into 3 types + + Added abstract JTableAxoMap table + +13-Oct-2008 Andrew Eddie + + Added support to edit access levels + +13-Oct-2008 Toby Patterson + # Added access methods to JToolBar + # Removed most references of keyword global from the framework + # Fixed bug with rendering cpanel modules + ^ Moved some routing logic out of index.php into JAdministrator::dispatch() + +11-Oct-2008 Alan Langford + + Added ability to specify module appearance in "exclude from list" mode. + +11-Oct-2008 Andrew Eddie + - Merge System-Debug plugin from 1.5 + - Added com_acl (finally! they all say) + - Moved user group management from com_users to com_acl + +10-Oct-2008 Sam Moffatt + - Commented out useless lines in JDatabaseMySQL and JDatabaseMySQLi + +10-Oct-2008 Andrew Eddie + - Dropped joomla_backward.sql + ^ Changed installation error_reporting to 2047 while under development + + Added new ACL tables + ^ Update queries using jos_groups to jos_core_acl_axo_groups + - Removed JAuthorization::_mos_add_acl + + Added JAuthorization::getUserAccessLevels + +04-Oct-2008 Toby Patterson + # Fixed final step of installation, completed removal of patTemplates from Installer + - Removed global $mainframe from the framework files, except where other extensions will be loaded + +02-Oct-2008 Toby Patterson + - Fixed bug with JFTP and check for connection + # [#12699] Refactor installation application + - Most patTemplate code removed + - Migrator currently broken, may be redesigned, discussion pending +29-Sep-2008 Chantal Bisson + - Removed duplicates of the language files for com_contactdirectory + # Fixed notice about $this->type not initialized on line 199 /administrator/components/com_categories/models/categories.php + # Fixed notice about $filter not initialized on line 23 /administrator/components/com_categories/views/tmpl/default.php + ^ Changed check() contactdirectory/tables/contact.php posible to add contacts with the same name + ^ Changed view for category and categories in com_contactdirectory + # Fixed redirect with router after sending mail in com_contactdirectory + +22-Sep-2008 Chantal Bisson + ^ Changed the column 'name' in the #__contactdirectory_fields table to 'alias' + ^ Changed the fields admin view to show the alias in the list and changed the edit field view to be able to modify the alias + + Added sample date for contact in com_contactdirectory + # Fixed right psition for image in com_contactdirectory contact view + # Fixed notice about $email->data in /components/com_contactdirectory/views/contact/view.html.php on line 203 + # Fixed changing access level in com_contactdirectory from link in contact manager + +15-Sep-2008 Chantal Bisson + + Added com_contactdirectory and language files + + Added sql create table queries for com_contactdirectory in the installation + + Added sql sample data for com_contactdirectory +14-Sep-2008 Johan Janssens + ^ Changed __autoload to spl_autoload_register() and refactored JLoader to adhere to E_STRICT + +11-Sep-2008 Sam Moffatt + ^ Changed behaviour of JFile::write and JFTP::write to use references for the second param + +25-Aug-2008 Andrew Eddie + + Added JQuery class + + Added .invalid styles to admin template for form validation + + Added new filters to com_users list + + Added support to manage groups in com_users + +23-Aug-2008 Andrew Eddie + ! Partial merge with 10701 (around 1.5.6) + - Remove old 1.5 RC sql diffs + ^ JModel::getState will now take an optional second argument to set a default + ^ JDatbase::setQuery cast the sql variable to a string allowing for the __toString interface to be used if an object is passed + +25-Jun-2008 Johan Janssens + - Removed libraries/bitfolge/vcard + + Added JDocumentVCARD format + + Implemented new Vcard format in contact component + +09-Jun-2008 Johan Janssens + - Removed backlink system plugin + - Removed legacy from mod_mainmenu + +08-Jun-2008 Johan Janssens + - Removed deprecated functions from JApplication + +19-May-2008 Johan Janssens + - Removed phpinputfilter library + - Removed phputf8, moved mbstring and iconv implementation into JString + - Removed administrator/includes/js/ThemeOffice + - Removed includes/js/ThemeOffice + - Removed includes/js/calendar + - Removed includes/js/jscalendar-1.0 + - Removed includes/js/tabs + - Removed includes/js/dtree + - Removed includes/js/wz_tooltip.js + - Removed includes/js/overlib + - Removed includes/js/mambojavascript.js + - Removed includes/js/JSCookMenu + ^ Renamed joomla.javascript.js to legacy.js and moved to media/system/js + +15-May-2008 Johan Janssens + - Removed administrator/includes/pcl + - Removed folder and file placeholders from application includes directories + - Removed libraries/bitfolge/feedcreator + - Cleaned up legacy plugin for 1.6 + - Removed 1.0 legacy code + - Updated version information to reflect 1.6 + - Removed hack to support PHP5 style constructors in PHP4 + - Removed hack to support PHP5 style destructors in PHP4 + - Removed _parseURL function from JURI, replaced by parse_url + - Removed index2.php and index3.php entry files + 19-Apr-2008 Andrew Eddie ! Trailing white-space cleanup - + 18-Apr-2008 Ian MacLennan # [#10732] Help screen updates for Menu Manager diff --git a/CREDITS.php b/CREDITS.php index dc4670fb3c05c..a7a25666aa70e 100644 --- a/CREDITS.php +++ b/CREDITS.php @@ -68,7 +68,7 @@ Bengali (bn-IN) - IndicJoomla! Team - Romit Chatterjee Bosnian (bs-BA) - Bosnian Joomla! Community (joomla.ba) - Emir Sakic Bulgarian (bg-BG) - Joomla! Bulgaria - Ivo Apostolov -Catalan (ca-ES) - Damià Verger +Catalan (ca-ES) - Joomla! Catalan Countries (joomla.cat) - Damià Verger Chinese-Traditional (zh-TW) - Traditional Chinese Translation Team - Eddy Chang Croatian (hr-HR) - Croatian Translation Team - Klaudia B. Czech (cs-CZ) - Czech Translation Team - Svatopluk Vit @@ -108,6 +108,35 @@ Ukrainian (uk-UA) - Ukrainian Translation Team - Denys Nosov Vietnamese (vi-VN) - Việt Nam Translation Team - Viet Vu Hoang +Pizaa Bug and fun Event +----------------------- +Chris Davenport +Kevin Devine +Anthony Ferrara +Jerry Hilburn +Louis Landry +Wilco Jansen +Jennifer Marriott +Rob Schley +Amy Stephen +Nereyda Valentin-Macias +Elin Waring +Michael Casha +Marcelo Eden +Matt Thomas +Ross Crawford +Mickael Maison +Ian MacLennan +Jaap Woltjes +Alan Langford +Michael Hamanaka +Joe LeBlanc +Shannon Quinn +Michelle Bisson +Airton Torres +Toni Marie Swats +Jon Giles +Matheus Mendes Joomla! 1.5 includes or is derivative of works distributed under the licenses listed below. The full text for most of the licenses listed below can be found in the LICENSES.php file. @@ -144,13 +173,13 @@ ----------- Author: Mihai Bazon Copyright: Copyright (C) Mihai Bazon, 2002 -License: GNU Lesser General Public License (LGPL) +License: GNU Lesser General Public License (LGPL) js-jscook-menu -------------- Author: Heng Yuan Copyright: Copyright (C) 2002-2005 by Heng Yuan -License: MIT License +License: MIT License js-overlib ---------- @@ -204,13 +233,13 @@ -------------- Author: Daniel Morris Copyright: Copyright (C) Daniel Morris -License: GNU General Public License (GPL) +License: GNU General Public License (GPL) PHPMailer -------- Author: Brent R. Matzelle Copyright: Copyright (C) 2001 - 2003 Brent R. Matzelle -License: GNU General Public License (GPL) +License: GNU General Public License (GPL) PHPXMLRPC --------- @@ -316,13 +345,13 @@ ----------- Author: Mihai Bazon Copyright: Copyright (C) Mihai Bazon, 2002 -License: GNU Lesser General Public License (LGPL) +License: GNU Lesser General Public License (LGPL) js-jscook-menu -------------- Author: Heng Yuan Copyright: Copyright (C) 2002-2005 by Heng Yuan -License: MIT License +License: MIT License js-overlib ---------- @@ -370,13 +399,13 @@ -------------- Author: Daniel Morris Copyright: Copyright (C) Daniel Morris -License: GNU General Public License (GPL) +License: GNU General Public License (GPL) PHPMailer --------- Author: Brent R. Matzelle Copyright: Copyright (C) 2001 - 2003 Brent R. Matzelle -License: GNU General Public License (GPL) +License: GNU General Public License (GPL) TinyMCE ------- diff --git a/LICENSES.php b/LICENSES.php index 338e2c31c8797..a1502ed13c194 100644 --- a/LICENSES.php +++ b/LICENSES.php @@ -117,7 +117,7 @@ that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - + Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a @@ -173,7 +173,7 @@ "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -220,34 +220,34 @@ interface definition files, plus the scripts used to control compilation You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - a) The modified work must itself be a software library. + a) The modified work must itself be a software library. - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, @@ -278,7 +278,7 @@ interface definition files, plus the scripts used to control compilation ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -329,7 +329,7 @@ functions (ten lines or less in length), then the use of the object distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -345,37 +345,37 @@ functions (ten lines or less in length), then the use of the object directing the user to the copy of this License. Also, you must do one of these things: - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for @@ -391,7 +391,7 @@ interface-compatible with the version that the work was made with. accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -399,14 +399,14 @@ interface-compatible with the version that the work was made with. the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any @@ -432,7 +432,7 @@ interface-compatible with the version that the work was made with. restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -484,7 +484,7 @@ interface-compatible with the version that the work was made with. the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -494,7 +494,7 @@ interface-compatible with the version that the work was made with. of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. @@ -551,38 +551,38 @@ interface-compatible with the version that the work was made with. are met: 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. 3. The name "PHP" must not be used to endorse or promote products - derived from this software without prior written permission. For - written permission, please contact group@php.net. + derived from this software without prior written permission. For + written permission, please contact group@php.net. 4. Products derived from this software may not be called "PHP", nor - may "PHP" appear in their name, without prior written permission - from group@php.net. You may indicate that your software works in - conjunction with PHP by saying "Foo for PHP" instead of calling - it "PHP Foo" or "phpfoo" + may "PHP" appear in their name, without prior written permission + from group@php.net. You may indicate that your software works in + conjunction with PHP by saying "Foo for PHP" instead of calling + it "PHP Foo" or "phpfoo" 5. The PHP Group may publish revised and/or new versions of the - license from time to time. Each version will be given a - distinguishing version number. - Once covered code has been published under a particular version - of the license, you may always continue to use it under the terms - of that version. You may also choose to use such covered code - under the terms of any subsequent version of the license - published by the PHP Group. No one other than the PHP Group has - the right to modify the terms applicable to covered code created - under this License. + license from time to time. Each version will be given a + distinguishing version number. + Once covered code has been published under a particular version + of the license, you may always continue to use it under the terms + of that version. You may also choose to use such covered code + under the terms of any subsequent version of the license + published by the PHP Group. No one other than the PHP Group has + the right to modify the terms applicable to covered code created + under this License. 6. Redistributions of any form whatsoever must retain the following - acknowledgment: - "This product includes PHP, freely available from - ". + acknowledgment: + "This product includes PHP, freely available from + ". THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, diff --git a/administrator/backups/index.html b/administrator/backups/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/backups/index.html +++ b/administrator/backups/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/cache/index.html b/administrator/cache/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/cache/index.html +++ b/administrator/cache/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_acl/acl.php b/administrator/components/com_acl/acl.php new file mode 100644 index 0000000000000..a14bac9c8a4e9 --- /dev/null +++ b/administrator/components/com_acl/acl.php @@ -0,0 +1,21 @@ +execute(JRequest::getVar('task')); +$controller->redirect(); diff --git a/administrator/components/com_acl/controller.php b/administrator/components/com_acl/controller.php new file mode 100644 index 0000000000000..434eed48fb4dd --- /dev/null +++ b/administrator/components/com_acl/controller.php @@ -0,0 +1,147 @@ +getType(); + $lName = JRequest::getWord('layout', 'default'); + $type = JRequest::getInt('type', 1); + + if ($view = &$this->getView($vName, $vFormat)) + { + switch ($vName) + { + case 'group': + $model = $this->getModel('group'); + $model->setState('group_type', 'aro'); + break; + + case 'groups': + $model = $this->getModel('groups'); + $model->setState('list.group_type', 'aro'); + $model->setState('list.tree', true); + $model->setState('list.parent_id', 28); + break; + + case 'level': + $model = $this->getModel('group'); + $model->setState('group_type', 'axo'); + break; + + case 'levels': + $model = $this->getModel('groups'); + $model->setState('list.group_type', 'axo'); + $model->setState('list.tree', false); + $model->setState('list.parent_id', 1); + break; + + case 'rule': + $model = $this->getModel('acl'); + $model->setState('acl_type', $type); + break; + + case 'rules': + default: + $model = $this->getModel('acls'); + $model->setState('list.acl_type', $type); + break; + } + + // Push the model into the view (as default) + $view->setModel($model, true); + $view->setLayout($lName); + $view->assignRef('document', $document); + $view->display(); + } + + // Set up the Linkbar + JSubMenuHelper::addEntry(JText::_('ACL Link Rules Type 1'), 'index.php?option=com_acl&view=rules&type=1', $vName == 'rules' AND $type == 1); + JSubMenuHelper::addEntry(JText::_('ACL Link Rules Type 2'), 'index.php?option=com_acl&view=rules&type=2', $vName == 'rules' AND $type == 2); + JSubMenuHelper::addEntry(JText::_('ACL Link Rules Type 3'), 'index.php?option=com_acl&view=rules&type=3', $vName == 'rules' AND $type == 3); + JSubMenuHelper::addEntry(JText::_('ACL Link User Groups'), 'index.php?option=com_acl&view=groups', $vName == 'groups'); + JSubMenuHelper::addEntry(JText::_('ACL Link Access Levels'), 'index.php?option=com_acl&view=levels', $vName == 'levels'); + } + + /** + * Get an instance of the controller + */ + function &getInstance() + { + // Determine the request protocol + $protocol = JRequest::getWord('protocol'); + + // Get task command from the request + $cmd = JRequest::getVar('task', null); + + // If it was a multiple option post get the selected option + if (is_array($cmd)) { + $cmd = array_pop(array_keys($cmd)); + } + + // Filter the command and instantiate the appropriate controller + $cmd = JFilterInput::clean($cmd,'cmd'); + if (strpos($cmd, '.') != false) { + // We have a defined controller/task pair -- lets split them out + list($controllerName, $task) = explode('.', $cmd); + + // Define the controller name and path + $controllerName = strtolower($controllerName); + $controllerFile = ($protocol) ? $controllerName.'.'.$protocol : $controllerName; + $controllerPath = JPATH_COMPONENT.DS.'controllers'.DS.$controllerFile.'.php'; + + // If the controller file path exists, include it ... else lets die with a 500 error + if (file_exists($controllerPath)) { + require_once $controllerPath; + } + else { + JError::raiseError(500, 'Invalid Controller'); + } + + JRequest::setVar('task', $task); + } + else { + // Base controller, just set the task :) + $controllerName = null; + $task = $cmd; + } + + // Set the name for the controller and instantiate it + $controllerClass = 'AccessController'.ucfirst($controllerName); + + if (class_exists($controllerClass)) { + $controller = new $controllerClass(); + } + else { + JError::raiseError(500, 'Invalid Controller Class'); + $controller = null; + } + + return $controller; + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/controllers/acl.php b/administrator/components/com_acl/controllers/acl.php new file mode 100644 index 0000000000000..004b3bdb1b2ea --- /dev/null +++ b/administrator/components/com_acl/controllers/acl.php @@ -0,0 +1,222 @@ +registerTask('save2copy', 'save'); + $this->registerTask('save2new', 'save'); + $this->registerTask('apply', 'save'); + $this->registerTask('deny', 'allow'); + $this->registerTask('disable', 'enable'); + } + + /** + * Display the view + */ + function display() + { + JError::raiseWarning(500, 'This controller does not implement a display method'); + } + + /** + * Proxy for getModel + */ + function &getModel() + { + return parent::getModel('ACL', 'AccessModel', array('ignore_request' => true)); + } + + /** + * Method to edit a object + * + * Sets object ID in the session from the request, checks the item out, and then redirects to the edit page. + * + * @access public + * @return void + */ + function edit() + { + $cid = JRequest::getVar('cid', array(), '', 'array'); + $id = JRequest::getInt('id', @$cid[0]); + $type = JRequest::getInt('acl_type', 1); + + $session = &JFactory::getSession(); + $session->set('com_acl.acl.id', $id); + + if ($id) { + $model = $this->getModel(); + $item = $model->getItem(); + $type = $item->acl_type; + // Checkout item + //$model->checkout($id); + } + $this->setRedirect(JRoute::_('index.php?option=com_acl&view=rule&layout=edit&type='.$type, false)); + } + + /** + * Method to cancel an edit + * + * Checks the item in, sets item ID in the session to null, and then redirects to the list page. + * + * @access public + * @return void + */ + function cancel() + { + $type = JRequest::getInt('acl_type', 1); + $session = &JFactory::getSession(); + //if ($id = (int) $session->get('com_acl.acl.id')) { + // $model = $this->getModel(); + // $model->checkin($id); + //} + + // Clear the session of the item + $session->set('com_acl.acl.id', null); + + $this->setRedirect(JRoute::_('index.php?option=com_acl&view=rules&type='.$type, false)); + } + + /** + * Save the record + */ + function save() + { + // Check for request forgeries. + JRequest::checkToken(); + + // Get posted form variables. + $input = JRequest::get('post'); + $type = JRequest::getInt('acl_type', 1); + + // Get the id of the item out of the session. + $session = &JFactory::getSession(); + + // Override the automatic filters + //$input['username'] = JRequest::getVar('username', '', 'post', 'username'); + + // Clear static values + // @todo Look at moving these to the table bind method (but check how new user values are handled) + unset($input['updated_date']); + + // Get the id of the item out of the session. + $session = &JFactory::getSession(); + $id = (int) $session->get('com_acl.acl.id'); + $input['id'] = $id; + + // Get the extensions model and set the post request in its state. + $model = &$this->getModel(); + $result = $model->save($input); + $msg = JError::isError($result) ? $result->getMessage() : 'Saved'; + + if ($this->_task == 'apply') { + $session->set('com_acl.acl.id', $model->getState('id')); + $this->setRedirect(JRoute::_('index.php?option=com_acl&view=rule&layout=edit', false), JText::_($msg)); + } + else if ($this->_task == 'save2new') { + $session->set('com_acl.acl.id', null); + //$model->checkin($id); + + $this->setRedirect(JRoute::_('index.php?option=com_acl&view=rule&layout=edit&type='.$type, false), JText::_($msg)); + } + else { + $session->set('com_acl.acl.id', null); + //$model->checkin($id); + + $this->setRedirect(JRoute::_('index.php?option=com_acl&view=rules&type='.$type, false), JText::_($msg)); + } + } + + /** + * Removes an item + */ + function delete() + { + // Check for request forgeries + JRequest::checkToken() or die('Invalid Token'); + + $cid = JRequest::getVar('cid', array(), '', 'array'); + $type = JRequest::getInt('acl_type', 1); + + if (empty($cid)) { + JError::raiseWarning(500, JText::_('No items selected')); + } + else { + // Get the model. + $model = $this->getModel(); + + // Make sure the item ids are integers + jimport('joomla.utilities.arrayhelper'); + JArrayHelper::toInteger($cid); + + // Remove the items. + if (!$model->delete($cid)) { + JError::raiseWarning(500, $model->getError()); + } + } + + $this->setRedirect('index.php?option=com_acl&view=rules&type='.$type); + } + + /** + * Sets the allow field value on an ACL + */ + function allow() + { + // Check for request forgeries + JRequest::checkToken() or die('Invalid Token'); + + $values = array('allow' => 1, 'deny' => 0); + $type = JRequest::getInt('acl_type', 1); + $cid = JRequest::getVar('cid', null, 'post', 'array'); + $task = $this->getTask(); + $value = JArrayHelper::getValue($values, $task, 0, 'int'); + + $model = $this->getModel(); + $result = $model->allow($cid, $value); + $this->setMessage(JError::isError($result) ? $result->getMessage() : ''); + $this->setRedirect('index.php?option=com_acl&view=rules&type='.$type); + } + + /** + * Sets the enable field value on an ACL + */ + function enable() + { + // Check for request forgeries + JRequest::checkToken() or die('Invalid Token'); + + $values = array('enable' => 1, 'disable' => 0); + $type = JRequest::getInt('acl_type', 1); + $cid = JRequest::getVar('cid', null, 'post', 'array'); + $task = $this->getTask(); + $value = JArrayHelper::getValue($values, $task, 0, 'int'); + + $model = $this->getModel(); + $result = $model->enable($cid, $value); + $this->setMessage(JError::isError($result) ? $result->getMessage() : ''); + $this->setRedirect('index.php?option=com_acl&view=rules&type='.$type); + } + +} diff --git a/administrator/components/com_acl/controllers/group.php b/administrator/components/com_acl/controllers/group.php new file mode 100644 index 0000000000000..a287fce597737 --- /dev/null +++ b/administrator/components/com_acl/controllers/group.php @@ -0,0 +1,186 @@ +registerTask('save2copy', 'save'); + $this->registerTask('save2new', 'save'); + $this->registerTask('apply', 'save'); + $this->registerTask('unpublish', 'publish'); + $this->registerTask('trash', 'publish'); + $this->registerTask('orderup', 'ordering'); + $this->registerTask('orderdown', 'ordering'); + } + + /** + * Display the view + */ + function display() + { + JError::raiseWarning(500, 'This controller does not implement a display method'); + } + + /** + * Proxy for getModel + */ + function &getModel() + { + return parent::getModel('Group', 'AccessModel', array('ignore_request' => true)); + } + + protected function _getReturnView($type) + { + return strtolower($type) == 'axo' ? 'level' : 'group'; + } + + /** + * Method to edit a object + * + * Sets object ID in the session from the request, checks the item out, and then redirects to the edit page. + * + * @access public + * @return void + */ + function edit() + { + $cid = JRequest::getVar('cid', array(), '', 'array'); + $id = JRequest::getInt('id', @$cid[0]); + $type = JRequest::getWord('group_type', 'aro'); + + $session = &JFactory::getSession(); + $session->set('com_acl.group.id', $id); + + if ($id) { + // Checkout item + //$model = $this->getModel(); + //$model->checkout($id); + } + $view = $this->_getReturnView($type); + $this->setRedirect(JRoute::_('index.php?option=com_acl&view='.$view.'&layout=edit', false)); + } + + /** + * Method to cancel an edit + * + * Checks the item in, sets item ID in the session to null, and then redirects to the list page. + * + * @access public + * @return void + */ + function cancel() + { + $type = JRequest::getWord('group_type', 'aro'); + $session = &JFactory::getSession(); + // Clear the session of the item + $session->set('access.group.id', null); + + $view = $this->_getReturnView($type); + $this->setRedirect(JRoute::_('index.php?option=com_acl&view='.$view.'s', false)); + } + + /** + * Save the record + */ + function save() + { + // Check for request forgeries. + JRequest::checkToken(); + + // Get posted form variables. + $input = JRequest::get('post'); + $type = JRequest::getWord('group_type'); + + // Get the id of the item out of the session. + $session = &JFactory::getSession(); + + // Override the automatic filters + //$input['username'] = JRequest::getVar('username', '', 'post', 'username'); + + // Clear static values + // @todo Look at moving these to the table bind method (but check how new user values are handled) + //unset($input['updated_date']); + + // Get the id of the item out of the session. + $session = &JFactory::getSession(); + $id = (int) $session->get('com_acl.group.id'); + $input['id'] = $id; + + // Get the extensions model and set the post request in its state. + $model = &$this->getModel(); + $model->setState('group_type', $type); + $result = $model->save($input); + $msg = JError::isError($result) ? $result->message : 'Saved'; + $view = $this->_getReturnView($type); + + if ($this->_task == 'apply') { + $session->set('com_acl.group.id', $model->getState('id')); + $this->setRedirect(JRoute::_('index.php?option=com_acl&view='.$view.'&layout=edit', false), JText::_($msg)); + } + else if ($this->_task == 'save2new') { + $session->set('com_acl.group.id', null); + //$model->checkin($id); + + $this->setRedirect(JRoute::_('index.php?option=com_acl&view='.$view.'&layout=edit', false), JText::_($msg)); + } + else { + $session->set('access.group.id', null); + //$model->checkin($id); + + $this->setRedirect(JRoute::_('index.php?option=com_acl&view='.$view.'s', false), JText::_($msg)); + } + } + + /** + * Deletes a group + */ + function delete() + { + // Check for request forgeries + JRequest::checkToken() or die('Invalid Token'); + + $cid = JRequest::getVar('cid', array(), '', 'array'); + $type = JRequest::getWord('group_type', 'aro'); + + if (empty($cid)) { + JError::raiseWarning(500, JText::_('No items selected')); + } + else { + // Get the model. + $model = $this->getModel(); + + // Make sure the item ids are integers + jimport('joomla.utilities.arrayhelper'); + JArrayHelper::toInteger($cid); + + // Remove the items. + if (!$model->delete($cid)) { + JError::raiseWarning(500, $model->getError()); + } + } + + $view = $this->_getReturnView($type); + $this->setRedirect('index.php?option=com_acl&view='.$view.'s'); + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/controllers/index.html b/administrator/components/com_acl/controllers/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/controllers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/helpers/acl.php b/administrator/components/com_acl/helpers/acl.php new file mode 100755 index 0000000000000..86eee3dc93f42 --- /dev/null +++ b/administrator/components/com_acl/helpers/acl.php @@ -0,0 +1,25 @@ + 'images/publish_x.png', 1 => 'images/tick.png'); + $alts = array(0 => 'Disabled', 1 => 'Enabled'); + $img = JArrayHelper::getValue($images, $value, $images[0]); + $task = $value == 1 ? 'acl.disable' : 'acl.enable'; + $alt = JArrayHelper::getValue($alts, $value, $images[0]); + $action = JText::_('Click to toggle setting'); + + $href = ' + + '. $alt .'' + ; + + return $href; + } + + function allowed($value, $i) + { + $images = array(0 => 'images/publish_x.png', 1 => 'images/tick.png'); + $alts = array(0 => 'Denied', 1 => 'Allowed'); + $img = JArrayHelper::getValue($images, $value, $images[0]); + $task = $value == 1 ? 'acl.deny' : 'acl.allow'; + $alt = JArrayHelper::getValue($alts, $value, $images[0]); + $action = JText::_('Click to toggle setting'); + + $href = ' + + '. $alt .'' + ; + + return $href; + } + + /** + * Build the select list for access level + */ + function groups($selected = null, $parentId = 0, $type = 'aro') + { + $model = JModel::getInstance('Groups', 'AccessModel', array('ignore_request' => 1)); + $model->setState('list.group_type', $type); + + // Set the model state to get the groups tree + $model->setState('list.select', 'a.id AS value, a.name AS text'); + $model->setState('list.tree', 1); + $model->setState('list.order', 'a.lft'); + $model->setState('list.parent_id', $parentId); + // Get a list without resolving foreign keys + $options = $model->getList(false); + + // Find the level of the parent + $parentLevel = ($parentId > 0) ? $model->getLevel($parentId, $type) : 0; + + // Pad out the options to create a visual tree + foreach ($options as $i => $option) { + $options[$i]->text = str_pad($option->text, strlen($option->text) + 2*($option->level - $parentLevel), '- ', STR_PAD_LEFT); + } + //array_unshift($options, JHTML::_('select.option', 0, 'Select Group')); + + return JHTML::_('select.options', $options, 'value', 'text', $selected); + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/helpers/html/index.html b/administrator/components/com_acl/helpers/html/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/helpers/html/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/helpers/index.html b/administrator/components/com_acl/helpers/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/helpers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/index.html b/administrator/components/com_acl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/models/_prototypeitem.php b/administrator/components/com_acl/models/_prototypeitem.php new file mode 100644 index 0000000000000..4ac492d34d491 --- /dev/null +++ b/administrator/components/com_acl/models/_prototypeitem.php @@ -0,0 +1,85 @@ +_list_items == null) { + // Load the labels data. + $this->_list_items = $this->_getList($this->_getListQuery($resolveFKs), $this->getState('list.start'), $this->getState('list.limit')); + + // Check for a database error. + if ($this->_db->getErrorNum()) { + $this->setError($this->_db->getErrorMsg()); + } + } + + return $this->_list_items; + } + + /** + * @param boolean True to resolve foreign keys + * + * @return array List of items + */ + function &getListCount($resolveFKs = true) + { + if ($this->_list_count == null) { + $db = &$this->getDBO(); + $db->setQuery($this->_getListQuery($resolveFKs)); + if (!$db->query()) { + $this->setError($this->_db->getErrorMsg()); + } + $this->_list_count = $db->getAffectedRows(); + } + return $this->_list_count; + } + + /** + * @return object A pagination object + */ + function getPagination() + { + jimport('joomla.html.pagination'); + return new JPagination($this->getListCount(), $this->getState('list.start'), $this->getState('list.limit')); + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/models/_prototypelist.php b/administrator/components/com_acl/models/_prototypelist.php new file mode 100644 index 0000000000000..7d68b05e519b9 --- /dev/null +++ b/administrator/components/com_acl/models/_prototypelist.php @@ -0,0 +1,90 @@ +list.limit - the maximum number of items + * list.start - the offset from the start of the list + * + * @package Joomla.Framework + * @subpackage Application + * @since 1.6 + */ +class AccessModelPrototypeList extends JModel +{ + /** + * @var string The SQL for the list + */ + protected $_list_query = null; + + /** + * @var string The current page of items + */ + protected $_list_items = null; + + /** + * @var int The total number of items + */ + protected $_list_count = null; + + /** + * @param boolean True to resolve foreign keys + * + * @return array List of items + */ + function &getList($resolveFKs = true) + { + if ($this->_list_items == null) { + // Load the labels data. + $this->_list_items = $this->_getList($this->_getListQuery($resolveFKs), $this->getState('list.start'), $this->getState('list.limit')); + + // Check for a database error. + if ($this->_db->getErrorNum()) { + $this->setError($this->_db->getErrorMsg()); + } + } + + return $this->_list_items; + } + + /** + * @param boolean True to resolve foreign keys + * + * @return array List of items + */ + function &getListCount($resolveFKs = true) + { + if ($this->_list_count == null) { + $db = &$this->getDBO(); + $db->setQuery($this->_getListQuery($resolveFKs)); + if (!$db->query()) { + $this->setError($this->_db->getErrorMsg()); + } + $this->_list_count = $db->getAffectedRows(); + } + return $this->_list_count; + } + + /** + * @return object A pagination object + */ + function getPagination() + { + jimport('joomla.html.pagination'); + return new JPagination($this->getListCount(), $this->getState('list.start'), $this->getState('list.limit')); + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/models/acl.php b/administrator/components/com_acl/models/acl.php new file mode 100644 index 0000000000000..4b6a9e2402d51 --- /dev/null +++ b/administrator/components/com_acl/models/acl.php @@ -0,0 +1,231 @@ +get('com_acl.acl.id', $this->getState('id')); + $result = $acl->get_acl($id); + return $result; + } + + /** + * @param boolean True to resolve foreign data relationship + * + * @return JStdClass + */ + function &getItem() + { + if (empty($this->_item)) + { + $session = &JFactory::getSession(); + $id = (int) $session->get('com_acl.acl.id', $this->getState('id')); + + $table = $this->getTable(); + if ($table->load($id)) { + // @todo Cannot tell if JTable::load throw an error on a null return + //$this->setError($table->getError()); + } + $this->_item = JArrayHelper::toObject($table->getProperties(1), 'JStdClass'); + } + return $this->_item; + } + + /** + * Gets an ACL with extended data + * + * @return JStdClass + */ + function getExtendedItem() + { + $item = array($this->getItem()); + $model = JModel::getInstance('Acls', 'AccessModel'); + $item = $model->getExtendedItems($item); + return $item[0]; + } + + function getSections() + { + $model = JModel::getInstance('Section', 'AccessModel'); + $model->setState('list.select', 'a.value, a.name AS text'); + $model->setState('list.section_type', 'acl'); + $model->setState('list.order', 'a.order_value,a.name'); + return $model->getList(); + } + + function getACOs() + { + //Model::addIncludePath(JPATH_COMPONENT.DS.'models'); + $model = JModel::getInstance('objects', 'AccessModel'); + $model->setState('list.section_value', $this->getState('section_value')); + $model->setState('list.object_type', 'aco'); + $model->setState('list.hidden', '0'); + $model->setState('list.order', 's.order_value,a.section_value,a.order_value,a.name'); + if ($aclType = $this->getState('acl_type')) { + $model->setState('list.where', 'a.acl_type = '.(int) $aclType); + } + return $model->getList(); + } + + function getAROGroups() + { + $model = JModel::getInstance('Groups', 'AccessModel'); + $model->setState('list.group_type', 'aro'); + $model->setState('list.tree', '1'); + $model->setState('list.parent_id', ACCESS_USERS_ARO_ID); + $model->setState('list.order', 'a.lft'); + return $model->getList(); + } + + function getAXOs() + { + $model = JModel::getInstance('Objects', 'AccessModel'); + $model->setState('list.section_value', $this->getState('section_value')); + $model->setState('list.object_type', 'axo'); + $model->setState('list.hidden', '0'); + $model->setState('list.order', 'a.order_value,a.name'); + return $model->getList(); + } + + function getAXOGroups() + { + $model = JModel::getInstance('Groups', 'AccessModel'); + $model->setState('list.group_type', 'axo'); + $model->setState('list.tree', '1'); + $model->setState('list.order', 'a.lft'); + $model->setState('list.parent_id', 1); + return $model->getList(); + } + + function save($values) + { + $acl = &JFactory::getACL(); + + $acoArray = JArrayHelper::getValue($values, 'aco_array', array(), 'array'); + $aroArray = JArrayHelper::getValue($values, 'aro_array', array(), 'array'); + $aroGroupIds = JArrayHelper::getValue($values, 'aro_group_ids', array(), 'array'); + $axoArray = JArrayHelper::getValue($values, 'axo_array', array(), 'array'); + $axoGroupIds = JArrayHelper::getValue($values, 'axo_group_ids', array(), 'array'); + + $allow = JArrayHelper::getValue($values, 'allow', 1, 'int'); + $enabled = JArrayHelper::getValue($values, 'enabled', 1, 'int'); + $returnValue = JArrayHelper::getValue($values, 'return_value'); + $note = JArrayHelper::getValue($values, 'note'); + $sectionValue = JArrayHelper::getValue($values, 'section_value'); + $aclId = JArrayHelper::getValue($values, 'id', 0, 'int'); + $aclType = JArrayHelper::getValue($values, 'acl_type', 1, 'int'); + + //$acl->_debug = 1; + $result = $acl->add_acl($acoArray, $aroArray, $aroGroupIds, $axoArray, $axoGroupIds, $allow, $enabled, $returnValue, $note, $sectionValue, $aclId, $aclType); + + if ($result) { + $this->setState('id', $result); + } + else { + $result = JError::raiseWarning(500, array_pop($acl->_debugLog)); + } + return $result; + } + + function delete($ids = array()) + { + $acl = &JFactory::getACL(); + foreach ((array) $ids as $id) + { + $result = $acl->del_acl($id); + $acl->_debug = 1; + if ($result == false) { + JError::raiseWarning(500, array_pop($acl->_debugLog)); + break; + } + } + return $result; + } + + function allow($ids = array(), $value = 1) + { + if (empty($ids)) { + return JException('No items selected'); + } + else + { + $acl = &JFactory::getACL(); + $db = $this->getDBO(); + JArrayHelper::toInteger($ids); + + $query = 'UPDATE #__core_acl_acl' . + ' SET allow = '.(int)($value ? 1 : 0) . + ' WHERE id IN ('.implode(',', $ids).')'; + $db->setQuery($query); + if (!$db->query()) { + return new JExecption($db->getErrorMsg()); + } + return true; + } + } + + function enable($ids = array(), $value = 1) + { + if (empty($ids)) { + return JException('No items selected'); + } + else + { + $acl = &JFactory::getACL(); + $db = $this->getDBO(); + JArrayHelper::toInteger($ids); + + $query = 'UPDATE #__core_acl_acl' . + ' SET enabled = '.(int)($value ? 1 : 0) . + ' WHERE id IN ('.implode(',', $ids).')'; + $db->setQuery($query); + if (!$db->query()) { + return new JExecption($db->getErrorMsg()); + } + return true; + } + } +} diff --git a/administrator/components/com_acl/models/acls.php b/administrator/components/com_acl/models/acls.php new file mode 100644 index 0000000000000..dcf2ac868428c --- /dev/null +++ b/administrator/components/com_acl/models/acls.php @@ -0,0 +1,239 @@ +__state_set)) + { + $app = &JFactory::getApplication(); + + $search = $app->getUserStateFromRequest('acl.rules.search', 'search'); + $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit')); + $limitstart = $app->getUserStateFromRequest('acl.rules.limitstart', 'limitstart', 0); + $orderCol = $app->getUserStateFromRequest('acl.rules.ordercol', 'filter_order', 'a.id'); + $orderDirn = $app->getUserStateFromRequest('acl.rules.orderdirn', 'filter_order_Dir', 'asc'); + + $this->setState('list.search', $search); + $this->setState('list.limit', $limit); + $this->setState('list.start', $limitstart); + if ($orderCol) { + $this->setState('list.order', $orderCol.' '.($orderDirn == 'asc' ? 'asc' : 'desc')); + } + $this->setState('orderCol', $orderCol); + $this->setState('orderDirn', $orderDirn); + + $this->__state_set = true; + } + return parent::getState($key, $default); + } + + function getExtendedItems($items = null) + { + if ($items == null) { + $items = $this->getList(); + } + if (!is_array($items)) { + $items = array($items); + } + + // first pass, get the id's + $n = count($items); + $aclIds = array(); + $rlu = array(); + for ($i = 0; $i < $n; $i++) + { + $aclIds[] = $items[$i]->id; + $rlu[$items[$i]->id] = $i; + } + + $db = &$this->getDBO(); + $acls = array(); + + // run sql to get ACO's, ARO's and AXO's + if (!empty($aclIds)) + { + $ids = implode(',', $aclIds); + foreach (array('aco', 'aro', 'axo') as $type) + { + $query = 'SELECT a.acl_id,o.name,s.name AS section_name' . + ' FROM #__core_acl_'. $type .'_map a' . + ' INNER JOIN #__core_acl_'. $type .' o ON (o.section_value=a.section_value AND o.value=a.value)' . + ' INNER JOIN #__core_acl_'. $type . '_sections s ON s.value=a.section_value' . + ' WHERE a.acl_id IN ('. $ids . ')'; + $db->setQuery($query); + $temp = $db->loadObjectList(); + foreach ($temp as $item) + { + $i = $rlu[$item->acl_id]; + $k = $type.'s'; + + if (!isset($items[$i]->$k)) { + $items[$i]->$k = array(); + } + $r = &$items[$i]->$k; + $r[$item->section_name][] = $item->name; + } + } + + // grab ARO and AXO groups + foreach (array('aro', 'axo') as $type) + { + $query = 'SELECT a.acl_id,g.name' . + ' FROM #__core_acl_'. $type .'_groups_map a' . + ' INNER JOIN #__core_acl_'. $type .'_groups g ON g.id=a.group_id' . + ' WHERE a.acl_id IN ('. $ids . ')'; + $db->setQuery($query); + $temp = $db->loadObjectList(); + foreach ($temp as $item) + { + $i = $rlu[$item->acl_id]; + $k = $type.'Groups'; + if (!isset($items[$i]->$k)) { + $items[$i]->$type = array(); + } + $r = &$items[$i]->$k; + $r[] = $item->name; + } + } + } + return $items; + } + + /** + * Gets a list of objects + * + * @param boolean True to resolve foreign keys + * + * @return string + */ + function _getListQuery($resolveFKs = false) + { + if (empty($this->_list_query)) + { + $db = &$this->getDBO(); + $query = new JQuery; + $select = $this->getState('list.select', 'a.*'); + $section = $this->getState('list.section_value'); + $search = $this->getState('list.search'); + $orderBy = $this->getState('list.order'); + $aclType = $this->getState('list.acl_type'); + + $query->select($select); + $query->from('#__core_acl_acl AS a'); + + if ($resolveFKs) { + } + + // Filter on section_value + if ($section) { + if (is_array($section)) { + foreach ($section as $k => $v) { + $section[$k] = $db->Quote($v); + } + $query->where('a.section_value IN ('.implode(',', $section).')'); + } + else { + $query->where('a.section_value = '.$db->Quote($section)); + } + } + + // Search in note + if ($search) { + $serach = $db->Quote('%'.$db->getEscaped($search, true).'%', false); + $query->where('a.note LIKE '.$serach); + } + + if ($orderBy) { + $query->order($db->getEscaped($orderBy)); + } + + if ($aclType !== null) { + $query->where('a.acl_type = '.(int) $aclType); + } + + //echo nl2br($query->toString()); + $this->_list_query = (string) $query; + } + + return $this->_list_query; + } +/* + function getSections() + { + $model = JModel::getInstance('Section', 'AccessModel'); + $model->setState('list.select', 'a.value, a.name AS text'); + $model->setState('list.section_type', 'acl'); + $model->setState('list.order', 'a.order_value,a.name'); + return $model->getList(); + } + + function getACOs() + { + $model = JModel::getInstance('object', 'AccessModel'); + $model->setState('list.section_value', $this->getState('section_value')); + $model->setState('list.object_type', 'aco'); + $model->setState('list.hidden', '0'); + $model->setState('list.order', 'a.section_value,a.order_value,a.name'); + if ($aclType = $this->getState('list.acl_type')) { + $model->setState('list.where', 'a.acl_type = '.(int) $aclType); + } + return $model->getList(); + } + + function getAROGroups() + { + $model = JModel::getInstance('Group', 'AccessModel'); + $model->setState('list.group_type', 'aro'); + $model->setState('list.tree', '1'); + $model->setState('list.parent_id', CONTROL_USERS_ARO_ID); + $model->setState('list.order', 'a.lft'); + return $model->getList(); + } + + function getAXOs() + { + $model = JModel::getInstance('object', 'AccessModel'); + $model->setState('list.section_value', $this->getState('section_value')); + $model->setState('list.object_type', 'axo'); + $model->setState('list.hidden', '0'); + $model->setState('list.order', 'a.order_value,a.name'); + return $model->getList(); + } + + function getAXOGroups() + { + $model = JModel::getInstance('Group', 'AccessModel'); + $model->setState('list.group_type', 'axo'); + $model->setState('list.tree', '1'); + $model->setState('list.order', 'a.lft'); + $model->setState('list.parent_id', 1); + return $model->getList(); + } +*/ +} \ No newline at end of file diff --git a/administrator/components/com_acl/models/group.php b/administrator/components/com_acl/models/group.php new file mode 100644 index 0000000000000..50205599311d9 --- /dev/null +++ b/administrator/components/com_acl/models/group.php @@ -0,0 +1,82 @@ +getState('group_type'); + return JTable::getInstance($type.'Group'); + } + + /** + * @param boolean True to resolve foreign data relationship + * + * @return JStdClass + */ + function &getItem() + { + if (empty($this->_item)) + { + $session = &JFactory::getSession(); + $id = (int) $session->get('com_acl.group.id', $this->getState('id')); + + $table = $this->getTable(); + if (!$table->load($id)) { + $this->setError($table->getError()); + } + $this->_item = JArrayHelper::toObject($table->getProperties(1), 'JStdClass'); + } + return $this->_item; + } + + /** + * Save override + */ + function save($input) + { + $result = true; + $user = &JFactory::getUser(); + $table = &$this->getTable(); + $isNew = empty($input['id']); + + if (!$table->save($input)) { + $result = JError::raiseWarning(500, $table->getError()); + } + if (strtolower($this->getState('group_type')) == 'axo') { + if ($isNew) { + $table->value = $table->id; + $table->store(); + } + } + // Set the new id (if new) + $this->setState('id', $table->id); + + return $result; + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/models/groups.php b/administrator/components/com_acl/models/groups.php new file mode 100644 index 0000000000000..f244b2691562e --- /dev/null +++ b/administrator/components/com_acl/models/groups.php @@ -0,0 +1,161 @@ +__state_set)) + { + $app = &JFactory::getApplication(); + $type = $this->_state->get('list.group_type'); + $context = 'ac.groups.'.$type; + + $type = $app->getUserStateFromRequest($context.'.type', 'group_type'); + $search = $app->getUserStateFromRequest($context.'.search', 'search'); + $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit')); + $limitstart = $app->getUserStateFromRequest($context.'.limitstart', 'limitstart', 0); + $orderCol = $app->getUserStateFromRequest($context.'.ordercol', 'filter_order', 'a.lft'); + $orderDirn = $app->getUserStateFromRequest($context.'.orderdirn', 'filter_order_Dir', 'asc'); + + $this->setState('list.search', $search); + $this->setState('list.limit', $limit); + $this->setState('list.start', $limitstart); + if ($orderCol) { + $this->setState('list.order', $orderCol.' '.($orderDirn == 'asc' ? 'asc' : 'desc')); + } + $this->setState('orderCol', $orderCol); + $this->setState('orderDirn', $orderDirn); + + $this->__state_set = true; + } + return parent::getState($key, $default); + } + + /** + * Gets a list of objects + * + * @param boolean True to resolve foreign keys + * + * @return string + */ + function _getListQuery($resolveFKs = false) + { + if (empty($this->_list_query)) + { + $db = &$this->getDBO(); + $query = new JQuery; + $type = strtolower($this->getState('list.group_type')); + $tree = $this->getState('list.tree'); + $parentId = $this->getState('list.parent_id'); + $select = $this->getState('list.select', 'a.*'); + $search = $this->getState('list.search'); + $where = $this->getState('list.where'); + $orderBy = $this->getState('list.order'); + + // Dynamically determine the table + $table = '#__core_acl_'.$type.'_groups'; + + $query->select($select); + $query->from($table.' AS a'); + + // Add the level in the tree + if ($tree) { + $query->select('COUNT(DISTINCT c2.id) AS level'); + $query->join('LEFT OUTER', $table.' AS c2 ON a.lft > c2.lft AND a.rgt < c2.rgt'); + $query->group('a.id'); + } + + // Get a subtree below the parent + if ($parentId > 0) { + $query->join('LEFT', $table.' AS p ON p.id = '.(int) $parentId); + $query->where('a.lft > p.lft AND a.rgt < p.rgt'); + } + + // Resolve associated data + if ($resolveFKs) + { + // Count the objects in the user group + if ($type == 'aro') { + $query->select('COUNT(DISTINCT map.aro_id) AS object_count'); + $query->join('LEFT', '#__core_acl_groups_'.$type.'_map AS map ON map.group_id=a.id'); + $query->group('a.id'); + } + // Count the items in the access level + else if ($type == 'axo') { + $query->select('COUNT(DISTINCT map.axo_id) AS object_count'); + $query->join('LEFT', '#__core_acl_groups_'.$type.'_map AS map ON map.group_id=a.id'); + $query->group('a.id'); + } + } + + // Search in the group name + if ($search) { + $serach = $db->Quote('%'.$db->getEscaped($search, true).'%', false); + $query->where('a.name LIKE '.$serach); + } + + // An abritrary where clause + if ($where) { + $query->where($where); + } + + if ($orderBy) { + $query->order($this->_db->getEscaped($orderBy)); + } + + //echo nl2br($query->toString()); + $this->_list_query = (string) $query; + } + + return $this->_list_query; + } + + /** + * Utility method to gets the level of a group + */ + function getLevel($id = null, $type = 'aro') + { + $model = new AccessModelGroups(array('ignore_request' => true)); + $model->setState('list.select', 'a.id'); + $model->setState('list.group_type', $type); + $model->setState('list.tree', true); + $model->setState('list.where', 'a.id = '.(int) $id); + $result = $model->getList(false); + return isset($result[0]) ? $result[0]->level : false; + } + +} \ No newline at end of file diff --git a/administrator/components/com_acl/models/objects.php b/administrator/components/com_acl/models/objects.php new file mode 100644 index 0000000000000..df93ea9716a45 --- /dev/null +++ b/administrator/components/com_acl/models/objects.php @@ -0,0 +1,136 @@ +_list_query)) + { + $db = &$this->getDBO(); + $query = new JQuery; + $section = $this->getState('list.section_value'); + $type = strtolower($this->getState('list.object_type')); + $groupId = $this->getState('list.group_id'); + $select = $this->getState('list.select', 'a.*'); + $search = $this->getState('list.search'); + $where = $this->getState('list.where'); + $orderBy = $this->getState('list.order'); + + $query->select($select); + $query->from('#__core_acl_'.$type.' AS a'); + + if ($resolveFKs) + { + // If a user object, resolve the username + if ($type == 'aro') { + $query->select('u.username'); + $query->join('LEFT', '#__users AS u ON u.id = a.value'); + } + + // Get the section name of the object + $query->select('s.name AS section_name'); + $query->join('LEFT', '#__core_acl_'.$type.'_sections AS s ON s.value = a.section_value'); + + if ($type == 'aro' OR $type == 'axo') { + // Count the number of groups or access levels the item is in + $query->select('COUNT(map.group_id) AS group_count'); + $query->join('LEFT', '#__core_acl_groups_'.$type.'_map AS map ON map.'.$type.'_id=a.id'); + $query->group('a.id'); + + // Collect the group names as a new-line seperated string + $query->select('GROUP_CONCAT(g2.name SEPARATOR '.$db->Quote("\n").') AS group_names'); + $query->join('LEFT', '#__core_acl_'.$type.'_groups AS g2 ON g2.id = map.group_id'); + } + } + + // Filter on a section + if ($section) { + if (is_array($section)) { + foreach ($section as $k => $v) { + $section[$k] = $db->Quote($v); + } + $query->where('a.section_value IN ('.implode(',', $section).')'); + } + else { + $query->where('a.section_value = '.$db->Quote($section)); + } + } + + // Filter by a search + if ($search) { + // id:123 will search for a specific ID + if (strpos($search, 'id:') === 0) { + $query->where('a.id = '.(int) substr($search, 3)); + } + // value:123 will search for a specific value of the `value` field + else if (strpos($search, 'value:') === 0) { + $query->where('a.value = '.$db->Quote(substr($search, 6))); + } + else { + // Otherwise search in the name, and for a user, search in the username + $search = $db->Quote('%'.$db->getEscaped($search, true).'%', false); + if ($type == 'aro') { + $query->where('(a.name LIKE '.$search.' OR u.username LIKE '.$search.')'); + } + else { + $query->where('a.name LIKE '.$search); + } + } + } + + // Filter on the Group ID + if ($groupId) { + if ($type == 'aro' OR $type == 'axo') { + $query->join('LEFT', '#__core_acl_groups_'.$type.'_map AS map2 ON map2.'.$type.'_id=a.id'); + $query->where('map2.group_id = '.(int) $groupId); + } + } + + // An abritrary where clause + if ($where) { + $query->where($where); + } + + if ($orderBy) { + $query->order($this->_db->getEscaped($orderBy)); + } + + //echo nl2br($query->toString()); + $this->_list_query = (string) $query; + } + + return $this->_list_query; + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/models/sections.php b/administrator/components/com_acl/models/sections.php new file mode 100644 index 0000000000000..3a74b9291d36c --- /dev/null +++ b/administrator/components/com_acl/models/sections.php @@ -0,0 +1,81 @@ +_list_query)) + { + $db = &$this->getDBO(); + $query = new JQuery; + $type = $this->getState('list.section_type'); + $select = $this->getState('list.select', 'a.*'); + $search = $this->getState('list.search'); + $where = $this->getState('list.where'); + $orderBy = $this->getState('list.order'); + + if (!$this->isValidType($type)) { + return JError::raiseError(500, $type.' is not a valid section type'); + } + + $query->select($select); + $query->from('#__core_acl_'.$type.'_sections AS a'); + + if ($resolveFKs) { + // No foreign keys + } + + // Search in the name + if ($search) { + $serach = $db->Quote('%'.$db->getEscaped($search, true).'%', false); + $query->where('a.name LIKE '.$serach); + } + + // An abritrary where clause + if ($where) { + $query->where($where); + } + + if ($orderBy) { + $query->order($this->_db->getEscaped($orderBy)); + } + + $this->_list_query = (string) $query; + //echo nl2br($this->_list_query); + } + + return $this->_list_query; + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/views/group/index.html b/administrator/components/com_acl/views/group/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/group/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/group/tmpl/edit.php b/administrator/components/com_acl/views/group/tmpl/edit.php new file mode 100644 index 0000000000000..5b94e5c8c00da --- /dev/null +++ b/administrator/components/com_acl/views/group/tmpl/edit.php @@ -0,0 +1,81 @@ +get('State'); + $type = strtoupper($state->get('type')); + + // Find the correct parent group for the filter list + $acl = &JFactory::getACL(); + $parentId = $acl->get_group_id('USERS'); +?> + +
+
+ item->get('id')) : ?> + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ +
+ + + +
+ + diff --git a/administrator/components/com_acl/views/group/tmpl/index.html b/administrator/components/com_acl/views/group/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/group/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/group/view.html.php b/administrator/components/com_acl/views/group/view.html.php new file mode 100644 index 0000000000000..91317be6f5562 --- /dev/null +++ b/administrator/components/com_acl/views/group/view.html.php @@ -0,0 +1,61 @@ +get('State'); + $item = &$this->get('Item'); + + if ($item->id) { + // Existing + } + else { + // New + } + + $this->assignRef('state', $state); + $this->assignRef('item', $item); + + $this->_setToolbar(); + parent::display($tpl); + } + + /** + * Display the toolbar + */ + private function _setToolbar() + { + $isNew = ($this->item->get('id') == 0); + JToolBarHelper::title(JText::_(($isNew ? 'Access Control: Add Group' : 'Access Control: Edit Group')), 'user'); + if (!$isNew) { + JToolBarHelper::custom('group.save2copy', 'copy.png', 'copy_f2.png', 'Toolbar Save To Copy', false); + } + JToolBarHelper::custom('group.save2new', 'new.png', 'new_f2.png', 'Toolbar Save And New', false); + JToolBarHelper::save('group.save'); + JToolBarHelper::apply('group.apply'); + JToolBarHelper::cancel('group.cancel'); + JToolBarHelper::help('screen.groups.edit'); + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/views/groups/index.html b/administrator/components/com_acl/views/groups/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/groups/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/groups/tmpl/default.php b/administrator/components/com_acl/views/groups/tmpl/default.php new file mode 100644 index 0000000000000..c0234b76babc2 --- /dev/null +++ b/administrator/components/com_acl/views/groups/tmpl/default.php @@ -0,0 +1,86 @@ +state->get('list.group_type'); + $editId = 30; +?> +
+
+
+ + + + +
+ +
+ + + + + + + + + + + + + + + + + items as $item) : ?> + + + + + + + + + +
+ + + + + + + + +   +
+ pagination->getListFooter(); ?> +
+ id > $editId) : ?> + id, $item->id); ?> + + + id > $editId) : ?> + + name; ?> + + name; ?> + + + object_count ? $item->object_count : ''; ?> + + + id; ?> + +   +
+ + + + + + + + + +
diff --git a/administrator/components/com_acl/views/groups/tmpl/index.html b/administrator/components/com_acl/views/groups/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/groups/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/groups/view.html.php b/administrator/components/com_acl/views/groups/view.html.php new file mode 100644 index 0000000000000..01f69cca2da5d --- /dev/null +++ b/administrator/components/com_acl/views/groups/view.html.php @@ -0,0 +1,56 @@ +get('State'); + $items = $this->get('List'); + $pagination = $this->get('Pagination'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) { + JError::raiseError(500, implode("\n", $errors)); + return false; + } + + $this->assignRef('state', $state); + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + + $this->_setToolbar(); + parent::display($tpl); + } + + /** + * Display the toolbar + */ + private function _setToolbar() + { + JToolBarHelper::title(JText::_('Access Control: User Groups'), 'user'); + JToolBarHelper::custom('group.edit', 'edit.png', 'edit_f2.png', 'Edit', true); + JToolBarHelper::custom('group.edit', 'new.png', 'new_f2.png', 'New', false); + JToolBarHelper::deleteList('', 'group.delete'); + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/views/level/index.html b/administrator/components/com_acl/views/level/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/level/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/level/tmpl/edit.php b/administrator/components/com_acl/views/level/tmpl/edit.php new file mode 100644 index 0000000000000..ac35a096fc2a3 --- /dev/null +++ b/administrator/components/com_acl/views/level/tmpl/edit.php @@ -0,0 +1,48 @@ +get('State'); + $type = strtoupper($state->get('type')); + + // Find the correct parent group for the filter list + $acl = &JFactory::getACL(); + $parentId = $acl->get_group_id(-1, 'ROOT', 'AXO'); +?> + +
+
+ item->get('id')) : ?> + + + + + + + +
+ + + +
+ +
+ + + + +
diff --git a/administrator/components/com_acl/views/level/tmpl/index.html b/administrator/components/com_acl/views/level/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/level/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/level/view.html.php b/administrator/components/com_acl/views/level/view.html.php new file mode 100644 index 0000000000000..6f9a3b9ea7b64 --- /dev/null +++ b/administrator/components/com_acl/views/level/view.html.php @@ -0,0 +1,60 @@ +get('State'); + $item = $this->get('Item'); + + if ($item->id) { + // Existing + } + else { + // New + } + $this->assignRef('state', $state); + $this->assignRef('item', $item); + + $this->_setToolbar(); + parent::display($tpl); + } + + /** + * Display the toolbar + */ + private function _setToolbar() + { + $isNew = ($this->item->get('id') == 0); + JToolBarHelper::title(JText::_(($isNew ? 'Access Control: Add Level' : 'Access Control: Edit Level')), 'user'); + if (!$isNew) { + JToolBarHelper::custom('group.save2copy', 'copy.png', 'copy_f2.png', 'Toolbar Save To Copy', false); + } + JToolBarHelper::custom('group.save2new', 'new.png', 'new_f2.png', 'Toolbar Save And New', false); + JToolBarHelper::save('group.save'); + JToolBarHelper::apply('group.apply'); + JToolBarHelper::cancel('group.cancel'); + JToolBarHelper::help('screen.groups.edit'); + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/views/levels/index.html b/administrator/components/com_acl/views/levels/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/levels/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/levels/tmpl/default.php b/administrator/components/com_acl/views/levels/tmpl/default.php new file mode 100644 index 0000000000000..e628143fb56c9 --- /dev/null +++ b/administrator/components/com_acl/views/levels/tmpl/default.php @@ -0,0 +1,85 @@ +state->get('list.group_type'); + $editId = 4; +?> +
+
+
+ + + + +
+ +
+ + + + + + + + + + + + + + + + + items as $item) : ?> + + + + + + + + + +
+ + + + + + + + +   +
+ pagination->getListFooter(); ?> +
+ id > $editId) : ?> + id, $item->id); ?> + + + id > $editId) : ?> + + name; ?> + + name; ?> + + + value; ?> + + id; ?> + +   +
+ + + + + + + + + +
diff --git a/administrator/components/com_acl/views/levels/tmpl/index.html b/administrator/components/com_acl/views/levels/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/levels/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/levels/view.html.php b/administrator/components/com_acl/views/levels/view.html.php new file mode 100644 index 0000000000000..d6b0d2ec4a0f9 --- /dev/null +++ b/administrator/components/com_acl/views/levels/view.html.php @@ -0,0 +1,56 @@ +get('State'); + $items = $this->get('List'); + $pagination = $this->get('Pagination'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) { + JError::raiseError(500, implode("\n", $errors)); + return false; + } + + $this->assignRef('state', $state); + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + + $this->_setToolbar(); + parent::display($tpl); + } + + /** + * Display the toolbar + */ + private function _setToolbar() + { + JToolBarHelper::title(JText::_('Access Control: Access Levels'), 'user'); + JToolBarHelper::custom('group.edit', 'edit.png', 'edit_f2.png', 'Edit', true); + JToolBarHelper::custom('group.edit', 'new.png', 'new_f2.png', 'New', false); + JToolBarHelper::deleteList('', 'group.delete'); + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/views/rule/index.html b/administrator/components/com_acl/views/rule/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/rule/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/rule/tmpl/edit.php b/administrator/components/com_acl/views/rule/tmpl/edit.php new file mode 100644 index 0000000000000..ae6a5451ebd50 --- /dev/null +++ b/administrator/components/com_acl/views/rule/tmpl/edit.php @@ -0,0 +1,106 @@ + + + + +
+
+ item->id) : ?> + item->id); ?> + + + + + + + + + + + + + + + +
+ + + + + item->allow); ?> + + + +
+ + + + + item->enabled); ?> + + + +
+ + loadTemplate('type'.$this->item->acl_type); ?> +
+ + + + + +
diff --git a/administrator/components/com_acl/views/rule/tmpl/edit_acos.php b/administrator/components/com_acl/views/rule/tmpl/edit_acos.php new file mode 100755 index 0000000000000..02b50a7447936 --- /dev/null +++ b/administrator/components/com_acl/views/rule/tmpl/edit_acos.php @@ -0,0 +1,15 @@ + + +
    + acos as $item) : ?> +
  • + section_value.'_'.$item->value; ?> + acl['aco'], $item->section_value, $item->value); ?> /> + +
  • + +
diff --git a/administrator/components/com_acl/views/rule/tmpl/edit_arogroups.php b/administrator/components/com_acl/views/rule/tmpl/edit_arogroups.php new file mode 100755 index 0000000000000..c8e834bb620a1 --- /dev/null +++ b/administrator/components/com_acl/views/rule/tmpl/edit_arogroups.php @@ -0,0 +1,14 @@ + + +
    + aroGroups as $item) : ?> +
  • + value; ?> + acl['aro_groups'], $item->id); ?> /> + +
  • + +
diff --git a/administrator/components/com_acl/views/rule/tmpl/edit_axogroups.php b/administrator/components/com_acl/views/rule/tmpl/edit_axogroups.php new file mode 100755 index 0000000000000..ed060f7d43562 --- /dev/null +++ b/administrator/components/com_acl/views/rule/tmpl/edit_axogroups.php @@ -0,0 +1,14 @@ + + +
    + axoGroups as $item) : ?> +
  • + value; ?> + acl['axo_groups'], $item->id); ?> /> + +
  • + +
diff --git a/administrator/components/com_acl/views/rule/tmpl/edit_axos.php b/administrator/components/com_acl/views/rule/tmpl/edit_axos.php new file mode 100755 index 0000000000000..432e7d925ceaf --- /dev/null +++ b/administrator/components/com_acl/views/rule/tmpl/edit_axos.php @@ -0,0 +1,15 @@ + + +
    + axos as $item) : ?> +
  • + section_value.'_'.$item->value; ?> + acl['axo'], $item->section_value, $item->value); ?> /> + +
  • + +
diff --git a/administrator/components/com_acl/views/rule/tmpl/edit_type1.php b/administrator/components/com_acl/views/rule/tmpl/edit_type1.php new file mode 100644 index 0000000000000..7c9283f58a576 --- /dev/null +++ b/administrator/components/com_acl/views/rule/tmpl/edit_type1.php @@ -0,0 +1,21 @@ + + + + + + + + +
+
+ + loadTemplate('arogroups'); ?> +
+
+
+ + + + loadTemplate('acos'); ?> +
+
diff --git a/administrator/components/com_acl/views/rule/tmpl/edit_type2.php b/administrator/components/com_acl/views/rule/tmpl/edit_type2.php new file mode 100644 index 0000000000000..fda4cbaf2d284 --- /dev/null +++ b/administrator/components/com_acl/views/rule/tmpl/edit_type2.php @@ -0,0 +1,29 @@ + + + + + + + + + +
+
+ + loadTemplate('arogroups'); ?> +
+
+
+ + + + loadTemplate('acos'); ?> +
+
+
+ + + + loadTemplate('axos'); ?> +
+
diff --git a/administrator/components/com_acl/views/rule/tmpl/edit_type3.php b/administrator/components/com_acl/views/rule/tmpl/edit_type3.php new file mode 100644 index 0000000000000..3be71203a408e --- /dev/null +++ b/administrator/components/com_acl/views/rule/tmpl/edit_type3.php @@ -0,0 +1,29 @@ + + + + + + + + + +
+
+ + loadTemplate('arogroups'); ?> +
+
+
+ + + + loadTemplate('acos'); ?> +
+
+
+ + + + loadTemplate('axogroups'); ?> +
+
diff --git a/administrator/components/com_acl/views/rule/tmpl/index.html b/administrator/components/com_acl/views/rule/tmpl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/rule/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/rule/view.html.php b/administrator/components/com_acl/views/rule/view.html.php new file mode 100755 index 0000000000000..00e0ce66e6338 --- /dev/null +++ b/administrator/components/com_acl/views/rule/view.html.php @@ -0,0 +1,95 @@ +get('State'); + $item = $this->get('ExtendedItem'); + $acl = $this->get('ACL'); + $aclType = $state->get('acl_type', 1); + + // Check for errors. + if (count($errors = $this->get('Errors'))) { + JError::raiseError(500, implode("\n", $errors)); + return false; + } + + //$layout = $this->getLayout(); + if ($state->get('id')) { + // Existing + } + else { + // New + $item->section_value = 'user'; + $item->enabled = 1; + $item->allow = 1; + $item->acl_type = $aclType; + } + + $this->assignRef('state', $state); + $this->assignRef('item', $item); + $this->assignRef('acl', $acl); + $this->assignRef('acos', $this->get('ACOs')); + $this->assignRef('aroGroups', $this->get('AROGroups')); + if ($aclType == 2) { + $this->assignRef('axos', $this->get('AXOs')); + } + else if ($aclType == 3) { + $this->assignRef('axoGroups', $this->get('AXOGroups')); + } + + $this->_setToolBar($aclType); + parent::display($tpl); + JRequest::setVar('hidemainmenu',1); + } + + /** + * Display the toolbar + * + * @access private + */ + function _setToolBar($type) + { + $title = empty($this->item->id) ? 'Edit Rule' : 'Add Rule'; + JToolBarHelper::title(JText::_('Access Control: '.$title.' Type '.(int) $type)); + JToolBarHelper::custom('acl.save2new', 'new.png', 'new_f2.png', 'Toolbar Save And New', false, false); + JToolBarHelper::save('acl.save'); + JToolBarHelper::apply('acl.apply'); + JToolBarHelper::cancel('acl.cancel'); + } +} \ No newline at end of file diff --git a/administrator/components/com_acl/views/rules/index.html b/administrator/components/com_acl/views/rules/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/rules/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/rules/tmpl/default.php b/administrator/components/com_acl/views/rules/tmpl/default.php new file mode 100755 index 0000000000000..823660cc2c13b --- /dev/null +++ b/administrator/components/com_acl/views/rules/tmpl/default.php @@ -0,0 +1,24 @@ +state->get('list.acl_type', 1); +?> + + +
+ + loadTemplate('type'.$aclType); ?> + + + + + + + +
diff --git a/administrator/components/com_acl/views/rules/tmpl/default_type1.php b/administrator/components/com_acl/views/rules/tmpl/default_type1.php new file mode 100755 index 0000000000000..bf7f8e4ca28a2 --- /dev/null +++ b/administrator/components/com_acl/views/rules/tmpl/default_type1.php @@ -0,0 +1,122 @@ + + +
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + items as $item) : ?> + + + + + + + + + + + +
+ + + state->orderDirn, $this->state->orderCol); ?> + + + + + + state->orderDirn, $this->state->orderCol); ?> + + state->orderDirn, $this->state->orderCol); ?> + + +
+ pagination->getListFooter(); ?> +
+ id, $item->id); ?> + + + note; ?> + +
+ aros)) : + foreach ($item->aros as $section => $aros) : ?> + + +
    + +
  1. + +
  2. + +
+ aroGroups) && count($item->aroGroups)) : ?> +
    + aroGroups as $name) : ?> +
  1. + +
  2. + +
+ +
+
+ acos) AND !empty($item->acos)) : ?> +
+
    + acos as $section => $acos) : ?> + + +
  1. + : + +
  2. + + +
+
+ +
+ allow, $item->id); ?> + + enabled, $item->id); ?> + + id; ?> +
+ +
+ +
diff --git a/administrator/components/com_acl/views/rules/tmpl/default_type2.php b/administrator/components/com_acl/views/rules/tmpl/default_type2.php new file mode 100755 index 0000000000000..4f2694cc68a83 --- /dev/null +++ b/administrator/components/com_acl/views/rules/tmpl/default_type2.php @@ -0,0 +1,143 @@ + + +
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + items as $item) : ?> + + + + + + + + + + + + + +
+ + + state->orderDirn, $this->state->orderCol); ?> + + + + + + + + state->orderDirn, $this->state->orderCol); ?> + + state->orderDirn, $this->state->orderCol); ?> + + +
+ pagination->getListFooter(); ?> +
+ id, $item->id); ?> + + + note; ?> + +
+ aros)) : + foreach ($item->aros as $section => $aros) : ?> + + +
    + +
  1. + +
  2. + +
+ aroGroups) && count($item->aroGroups)) : ?> +
    + aroGroups as $name) : ?> +
  1. + +
  2. + +
+ +
+
+ acos) AND !empty($item->acos)) : ?> +
+
    + acos as $section => $acos) : ?> + + +
  1. + : + +
  2. + + +
+
+ +
+ axos)) : ?> +
+ axos as $section => $axos) : ?> + +
    + +
  1. + +
  2. + +
+ +
+ +
+ allow, $item->id); ?> + + enabled, $item->id); ?> + + id; ?> +
+ +
+ +
\ No newline at end of file diff --git a/administrator/components/com_acl/views/rules/tmpl/default_type3.php b/administrator/components/com_acl/views/rules/tmpl/default_type3.php new file mode 100755 index 0000000000000..6d05993d6d2fb --- /dev/null +++ b/administrator/components/com_acl/views/rules/tmpl/default_type3.php @@ -0,0 +1,136 @@ + +
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + items as $item) : ?> + + + + + + + + + + + + + +
+ + + state->orderDirn, $this->state->orderCol); ?> + + + + + + + + state->orderDirn, $this->state->orderCol); ?> + + state->orderDirn, $this->state->orderCol); ?> + + +
+ pagination->getListFooter(); ?> +
+ id, $item->id); ?> + + + note; ?> + +
+ aros)) : + foreach ($item->aros as $section => $aros) : ?> + + +
    + +
  1. + +
  2. + +
+ aroGroups) && count($item->aroGroups)) : ?> +
    + aroGroups as $name) : ?> +
  1. + +
  2. + +
+ +
+
+ acos) AND !empty($item->acos)) : ?> +
+
    + acos as $section => $acos) : ?> + + +
  1. + : + +
  2. + + +
+
+ +
+ axoGroups) && count($item->axoGroups)) : ?> +
    + axoGroups as $name) : ?> +
  1. + +
  2. + +
+ +
+ allow, $item->id); ?> + + enabled, $item->id); ?> + + id; ?> +
+ +
+ +
\ No newline at end of file diff --git a/administrator/components/com_acl/views/rules/tmpl/index.html b/administrator/components/com_acl/views/rules/tmpl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_acl/views/rules/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_acl/views/rules/view.html.php b/administrator/components/com_acl/views/rules/view.html.php new file mode 100644 index 0000000000000..7bd1be8dbab62 --- /dev/null +++ b/administrator/components/com_acl/views/rules/view.html.php @@ -0,0 +1,56 @@ +get('State'); + $items = $this->get('ExtendedItems'); + $pagination = $this->get('Pagination'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) { + JError::raiseError(500, implode("\n", $errors)); + return false; + } + + $this->assignRef('state', $state); + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + + $this->_setToolBar($state->get('list.acl_type',1)); + parent::display($tpl); + } + + /** + * Display the toolbar + */ + private function _setToolBar($type) + { + JToolBarHelper::title(JText::_('Access Control: Rules Type '.(int) $type)); + JToolBarHelper::custom('acl.edit', 'edit.png', 'edit_f2.png', 'Edit', true); + JToolBarHelper::custom('acl.edit', 'new.png', 'new_f2.png', 'ACL New Rule', false); + JToolBarHelper::deleteList('','acl.delete'); + } +} \ No newline at end of file diff --git a/administrator/components/com_admin/admin.admin.html.php b/administrator/components/com_admin/admin.admin.html.php deleted file mode 100644 index 62b961e8bafcd..0000000000000 --- a/administrator/components/com_admin/admin.admin.html.php +++ /dev/null @@ -1,330 +0,0 @@ -setBuffer($contents, 'modules', 'submenu'); - ?> -
- -
-
- - - - -
- -
-
- -
- - - - -
- -
-
- -
- - - - -
- -
-
- -
- - - - -
- -
-
- -
- - - - -
- -
-
-
- -
- - * In case of the remote server it is assumed that this server provide one specific - * help set of files in one particular language. - */ - function help() - { - global $mainframe; - jimport( 'joomla.filesystem.folder' ); - jimport( 'joomla.language.help' ); - - // Get Help URL - an empty helpurl is interpreted as local help files! - $helpurl = $mainframe->getCfg('helpurl'); - if ( $helpurl == 'http://help.mamboserver.com' ) { - $helpurl = 'http://help.joomla.org'; - } - $fullhelpurl = $helpurl . '/index2.php?option=com_content&task=findkey&pop=1&keyref='; - - $helpsearch = JRequest::getString('helpsearch'); - $page = JRequest::getCmd('page', 'joomla.whatsnew15.html'); - $toc = getHelpToc( $helpsearch ); - $lang =& JFactory::getLanguage(); - $langTag = $lang->getTag(); - if( !JFolder::exists( JPATH_BASE.DS.'help'.DS.$langTag ) ) { - $langTag = 'en-GB'; // use english as fallback - } - - if (!eregi( '\.html$', $page )) { - $page .= '.xml'; - } - ?> - - - - - - -
- - - - - -
- : - - - - - - - 'helpFrame')) ?> - | - 'helpFrame')) ?> - | - 'helpFrame')) ?> - - 'helpFrame')) ?> - | - 'helpFrame')) ?> - | - 'helpFrame')) ?> - - | - 'helpFrame')) ?> - | - 'helpFrame')) ?> - | - 'helpFrame')) ?> - | - 'helpFrame')) ?> -
-
- -
-
- - - - -
-
    - $v) { - if ($helpurl) { - echo '
  • '; - echo JHTML::_('link', JHelp::createUrl( $k ), $v, array('target' => 'helpFrame')); - echo '
  • '; - } else { - echo '
  • '; - echo JHTML::_('link', JURI::base() .'help/'.$langTag.'/'.$k, $v, array('target' => 'helpFrame')); - echo '
  • '; - } - } - ?> -
-
-
-
- -
-
- - - - - - - - -
-
- - -
- -
-			
-		
- '. JText::_( 'Writable' ) .''; - $unwriteable = ''. JText::_( 'Unwritable' ) .''; - - echo ''; - echo ''; - echo $text; - if ( $visible ) { - echo $folder . '/'; - } - echo ''; - echo ''; - if ( $relative ) { - echo is_writable( "../$folder" ) ? $writeable : $unwriteable; - } else { - echo is_writable( "$folder" ) ? $writeable : $unwriteable; - } - echo ''; - echo ''; -} - -/** - * Compiles the help table of contents - * @param string A specific keyword on which to filter the resulting list - */ -function getHelpTOC( $helpsearch ) -{ - global $mainframe; - - $lang =& JFactory::getLanguage(); - jimport( 'joomla.filesystem.folder' ); - - $helpurl = $mainframe->getCfg('helpurl'); - - // Check for files in the actual language - $langTag = $lang->getTag(); - if( !JFolder::exists( JPATH_BASE.DS.'help'.DS.$langTag ) ) { - $langTag = 'en-GB'; // use english as fallback - } - $files = JFolder::files( JPATH_BASE.DS.'help'.DS.$langTag, '\.xml$|\.html$' ); - - $toc = array(); - foreach ($files as $file) { - $buffer = file_get_contents( JPATH_BASE.DS.'help'.DS.$langTag.DS.$file ); - if (preg_match( '#(.*?)#', $buffer, $m )) { - $title = trim( $m[1] ); - if ($title) { - if ($helpurl) { - // strip the extension - $file = preg_replace( '#\.xml$|\.html$#', '', $file ); - } - if ($helpsearch) { - if (JString::strpos( strip_tags( $buffer ), $helpsearch ) !== false) { - $toc[$file] = $title; - } - } else { - $toc[$file] = $title; - } - } - } - } - asort( $toc ); - return $toc; -} diff --git a/administrator/components/com_admin/admin.admin.php b/administrator/components/com_admin/admin.admin.php deleted file mode 100644 index 06aefa460a2be..0000000000000 --- a/administrator/components/com_admin/admin.admin.php +++ /dev/null @@ -1,48 +0,0 @@ -execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_frontpage/frontpage.xml b/administrator/components/com_admin/admin.xml similarity index 71% rename from administrator/components/com_frontpage/frontpage.xml rename to administrator/components/com_admin/admin.xml index c2041f821e0d9..8adcd2a3b6384 100644 --- a/administrator/components/com_frontpage/frontpage.xml +++ b/administrator/components/com_admin/admin.xml @@ -1,11 +1,12 @@ - Frontpage + Admin Joomla! Project + March 2008 (C) 2005 - 2008 Open Source Matters. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL admin@joomla.org www.joomla.org 1.5.0 - This Component shows all the published Articles from your site marked Show on Front Page. + This component manages sections diff --git a/administrator/components/com_admin/config.xml b/administrator/components/com_admin/config.xml new file mode 100644 index 0000000000000..49c8e10f7a663 --- /dev/null +++ b/administrator/components/com_admin/config.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/administrator/components/com_admin/controller.php b/administrator/components/com_admin/controller.php new file mode 100644 index 0000000000000..aed72ce02b271 --- /dev/null +++ b/administrator/components/com_admin/controller.php @@ -0,0 +1,73 @@ +registerTask( 'sysinfo', 'display' ); + $this->registerTask( 'help', 'display' ); + $this->registerTask( 'changelog', 'display' ); + } + + /** + * Display the view + */ + function display() + { + // Intercept URL's using the old task format + $task = $this->getTask(); + + switch ($task) + { + case 'sysinfo': + case 'help': + case 'changelog': + JRequest::setVar( 'view', $task ); + break; + } + + if (JRequest::getVar( 'view' )) { + parent::display(); + } + } + + /** + * TODO: Description? + */ + function keepalive( ) + { + return; + } +} \ No newline at end of file diff --git a/administrator/components/com_admin/index.html b/administrator/components/com_admin/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_admin/index.html +++ b/administrator/components/com_admin/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_admin/models/changelog.php b/administrator/components/com_admin/models/changelog.php new file mode 100644 index 0000000000000..f4545f0afdd03 --- /dev/null +++ b/administrator/components/com_admin/models/changelog.php @@ -0,0 +1,85 @@ + 'changelog')); + } + + /** + * Method to get a currency + */ + function &getChangelog() + { + // Load the changelog + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Method to load currency data + * + * @access private + * @return boolean True on success + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (!$this->_data) + { + ob_start(); + readfile( JPATH_SITE.DS.'CHANGELOG.php' ); + $this->_data = ob_get_contents(); + ob_clean(); + + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the data + * + * @access private + * @return boolean True on success + */ + function _initData() + { + if (empty($this->_data)) + { + $this->_data = null; + return (boolean) $this->_data; + } + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_admin/models/index.html b/administrator/components/com_admin/models/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_admin/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_admin/tmpl/index.html b/administrator/components/com_admin/tmpl/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/administrator/components/com_admin/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_admin/tmpl/sysinfo_directory.php b/administrator/components/com_admin/tmpl/sysinfo_directory.php deleted file mode 100644 index c80485597b05d..0000000000000 --- a/administrator/components/com_admin/tmpl/sysinfo_directory.php +++ /dev/null @@ -1,75 +0,0 @@ - -
- - - - - - - - - - - - - - - get('image_path')); - writableCell( 'language' ); - - // List all site languages - $site_langs = JFolder::folders(JPATH_SITE.DS.'language'); - foreach ($site_langs as $slang) - { - writableCell( 'language/'.$slang ); - } - - writableCell( 'modules' ); - writableCell( 'plugins' ); - writableCell( 'plugins/content' ); - writableCell( 'plugins/editors' ); - writableCell( 'plugins/editors-xtd' ); - writableCell( 'plugins/search' ); - writableCell( 'plugins/system' ); - writableCell( 'plugins/user' ); - writableCell( 'plugins/xmlrpc' ); - writableCell( 'tmp' ); - writableCell( 'templates' ); - writableCell( JPATH_SITE.DS.'cache', 0, ''. JText::_( 'Cache Directory' ) .' ' ); - writableCell( JPATH_ADMINISTRATOR.DS.'cache', 0, ''. JText::_( 'Cache Directory' ) .' ' ); - ?> - -
- - - -
-   -
-
\ No newline at end of file diff --git a/administrator/components/com_admin/tmpl/sysinfo_phpsettings.php b/administrator/components/com_admin/tmpl/sysinfo_phpsettings.php deleted file mode 100644 index 71ee3fb63006c..0000000000000 --- a/administrator/components/com_admin/tmpl/sysinfo_phpsettings.php +++ /dev/null @@ -1,165 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - setQuery( $query, 0, 1 ); - $editor = $db->loadResult(); - ?> - - - - - -
- - - -
  -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
- : - - -
-
diff --git a/administrator/components/com_admin/toolbar.admin.html.php b/administrator/components/com_admin/toolbar.admin.html.php deleted file mode 100644 index 2625265ba1e9e..0000000000000 --- a/administrator/components/com_admin/toolbar.admin.html.php +++ /dev/null @@ -1,48 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_admin/views/changelog/tmpl/default.php b/administrator/components/com_admin/views/changelog/tmpl/default.php new file mode 100644 index 0000000000000..d0c22eb90ddc5 --- /dev/null +++ b/administrator/components/com_admin/views/changelog/tmpl/default.php @@ -0,0 +1,11 @@ + + +
+	/','',$this->changelog);
+
+	// Convert all other HTML entities
+	echo htmlentities($changelog);
+	?>
+
\ No newline at end of file diff --git a/administrator/components/com_admin/views/changelog/tmpl/index.html b/administrator/components/com_admin/views/changelog/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_admin/views/changelog/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_cpanel/admin.cpanel.php b/administrator/components/com_admin/views/changelog/view.html.php similarity index 53% rename from administrator/components/com_cpanel/admin.cpanel.php rename to administrator/components/com_admin/views/changelog/view.html.php index 44bc855f58507..cf9757db63dfd 100644 --- a/administrator/components/com_cpanel/admin.cpanel.php +++ b/administrator/components/com_admin/views/changelog/view.html.php @@ -1,27 +1,35 @@ -assign( 'changelog', $this->get( 'Changelog' ) ); + parent::display($tpl); + } } \ No newline at end of file diff --git a/administrator/components/com_admin/views/help/index.html b/administrator/components/com_admin/views/help/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_admin/views/help/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_admin/views/help/tmpl/default.php b/administrator/components/com_admin/views/help/tmpl/default.php new file mode 100644 index 0000000000000..13d1c802ea831 --- /dev/null +++ b/administrator/components/com_admin/views/help/tmpl/default.php @@ -0,0 +1,99 @@ + + +
+ + + + + +
+ + + + + +
+ : + + + + + + + 'helpFrame')) ?> + | + 'helpFrame')) ?> + | + 'helpFrame')) ?> + + langTag.'/joomla.glossary.html', JText::_( 'Glossary' ), array('target' => 'helpFrame')) ?> + | + langTag.'/joomla.credits.html', JText::_( 'Credits' ), array('target' => 'helpFrame')) ?> + | + langTag.'/joomla.support.html', JText::_( 'Support' ), array('target' => 'helpFrame')) ?> + + | + 'helpFrame')) ?> + | + 'helpFrame')) ?> + | + 'helpFrame')) ?> + | + 'helpFrame')) ?> +
+
+ +
+
+ + + + +
+
    + getCfg('helpurl'); + foreach ($this->toc as $k=>$v) { + if ($helpurl) { + echo '
  • '; + echo JHTML::_('link', JHelp::createUrl( $k ), $v, array('target' => 'helpFrame')); + echo '
  • '; + } else { + echo '
  • '; + echo JHTML::_('link', JURI::base() .'help/'.$this->langTag.'/'.$k, $v, array('target' => 'helpFrame')); + echo '
  • '; + } + } + ?> +
+
+
+
+ +
+
+ + + + page != 'joomla.whatsnew15.html') { + ?> + + + + +
+
+ + +
\ No newline at end of file diff --git a/administrator/components/com_admin/views/help/tmpl/index.html b/administrator/components/com_admin/views/help/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_admin/views/help/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_admin/views/help/view.html.php b/administrator/components/com_admin/views/help/view.html.php new file mode 100644 index 0000000000000..7087a2f24f91a --- /dev/null +++ b/administrator/components/com_admin/views/help/view.html.php @@ -0,0 +1,112 @@ +getCfg('helpurl'); + if ( $helpurl == 'http://help.mamboserver.com' ) { + $helpurl = 'http://help.joomla.org'; + } + $fullhelpurl = $helpurl . '/index2.php?option=com_content&task=findkey&pop=1&keyref='; + + $helpsearch = JRequest::getString('helpsearch'); + $page = JRequest::getCmd('page', 'joomla.whatsnew15.html'); + $toc = AdminViewHelp::getHelpToc( $helpsearch ); + $lang =& JFactory::getLanguage(); + $langTag = $lang->getTag(); + if( !JFolder::exists( JPATH_BASE.DS.'help'.DS.$langTag ) ) { + $langTag = 'en-GB'; // use english as fallback + } + + if (!eregi( '\.html$', $page )) { + $page .= '.xml'; + } + + // Toolbar + JToolBarHelper::title( JText::_( 'Help' ), 'help_header.png' ); + + $this->assignRef('fullhelpurl', $fullhelpurl); + $this->assignRef('helpsearch', $helpsearch); + $this->assignRef('page', $page); + $this->assignRef('toc', $toc); + $this->assignRef('lang', $lang); + $this->assignRef('langTag', $langTag); + + parent::display($tpl); + } + + /** + * Compiles the help table of contents + * @param string A specific keyword on which to filter the resulting list + */ + function getHelpTOC( $helpsearch ) + { + global $mainframe; + + $lang =& JFactory::getLanguage(); + jimport( 'joomla.filesystem.folder' ); + + $helpurl = $mainframe->getCfg('helpurl'); + + // Check for files in the actual language + $langTag = $lang->getTag(); + if( !JFolder::exists( JPATH_BASE.DS.'help'.DS.$langTag ) ) { + $langTag = 'en-GB'; // use english as fallback + } + $files = JFolder::files( JPATH_BASE.DS.'help'.DS.$langTag, '\.xml$|\.html$' ); + + $toc = array(); + foreach ($files as $file) { + $buffer = file_get_contents( JPATH_BASE.DS.'help'.DS.$langTag.DS.$file ); + if (preg_match( '#(.*?)#', $buffer, $m )) { + $title = trim( $m[1] ); + if ($title) { + if ($helpurl) { + // strip the extension + $file = preg_replace( '#\.xml$|\.html$#', '', $file ); + } + if ($helpsearch) { + if (JString::strpos( strip_tags( $buffer ), $helpsearch ) !== false) { + $toc[$file] = $title; + } + } else { + $toc[$file] = $title; + } + } + } + } + asort( $toc ); + return $toc; + } +} \ No newline at end of file diff --git a/administrator/components/com_admin/views/sysinfo/index.html b/administrator/components/com_admin/views/sysinfo/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_admin/views/sysinfo/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_admin/views/sysinfo/tmpl/default.php b/administrator/components/com_admin/views/sysinfo/tmpl/default.php new file mode 100644 index 0000000000000..64b715e4a54e9 --- /dev/null +++ b/administrator/components/com_admin/views/sysinfo/tmpl/default.php @@ -0,0 +1,57 @@ + + +
+ +
+
+ + + + +
+ loadTemplate('system'); ?> +
+
+ +
+ + + + +
+ loadTemplate('phpsettings'); ?> +
+
+ +
+ + + + +
+ loadTemplate('config'); ?> +
+
+ +
+ + + + +
+ loadTemplate('directory'); ?> +
+
+ +
+ + + + +
+ loadTemplate('phpinfo'); ?> +
+
+
+ +
\ No newline at end of file diff --git a/administrator/components/com_admin/tmpl/sysinfo_config.php b/administrator/components/com_admin/views/sysinfo/tmpl/default_config.php similarity index 91% rename from administrator/components/com_admin/tmpl/sysinfo_config.php rename to administrator/components/com_admin/views/sysinfo/tmpl/default_config.php index 69c9ec3e016c6..d250c29090cec 100644 --- a/administrator/components/com_admin/tmpl/sysinfo_config.php +++ b/administrator/components/com_admin/views/sysinfo/tmpl/default_config.php @@ -1,9 +1,4 @@ -
@@ -44,9 +39,9 @@ $cf[$k] = 'var $ftp_user = \'xxxxxx\''; } else if (eregi( 'var \$ftp_pass ', $v)) { $cf[$k] = 'var $ftp_pass = \'xxxxxx\''; - } else if (eregi( 'var \$smtpuser ', $v)) { - $cf[$k] = 'var $smtpuser = \'xxxxxx\''; - } else if (eregi( 'var \$smtppass ', $v)) { + } else if (eregi( 'var \$smtpuser ', $v)) { + $cf[$k] = 'var $smtpuser = \'xxxxxx\''; + } else if (eregi( 'var \$smtppass ', $v)) { $cf[$k] = 'var $smtppass = \'xxxxxx\''; } else if (eregi( ' +
+ + + + + + + + + + + + + + + get('image_path')); + AdminViewSysinfo::writableRow( 'language' ); + + // List all site languages + $site_langs = JFolder::folders(JPATH_SITE.DS.'language'); + foreach ($site_langs as $slang) + { + AdminViewSysinfo::writableRow( 'language/'.$slang ); + } + + AdminViewSysinfo::writableRow( 'media' ); + AdminViewSysinfo::writableRow( 'modules' ); + AdminViewSysinfo::writableRow( 'plugins' ); + AdminViewSysinfo::writableRow( 'plugins/content' ); + AdminViewSysinfo::writableRow( 'plugins/editors' ); + AdminViewSysinfo::writableRow( 'plugins/editors-xtd' ); + AdminViewSysinfo::writableRow( 'plugins/search' ); + AdminViewSysinfo::writableRow( 'plugins/system' ); + AdminViewSysinfo::writableRow( 'plugins/user' ); + AdminViewSysinfo::writableRow( 'plugins/xmlrpc' ); + AdminViewSysinfo::writableRow( 'tmp' ); + AdminViewSysinfo::writableRow( 'templates' ); + AdminViewSysinfo::writableRow( JPATH_SITE.DS.'cache', 0, ''. JText::_( 'Cache Directory' ) .' ' ); + AdminViewSysinfo::writableRow( JPATH_ADMINISTRATOR.DS.'cache', 0, ''. JText::_( 'Cache Directory' ) .' ' ); + ?> + +
+ + + +
+   +
+
\ No newline at end of file diff --git a/administrator/components/com_admin/tmpl/navigation.php b/administrator/components/com_admin/views/sysinfo/tmpl/default_navigation.php similarity index 100% rename from administrator/components/com_admin/tmpl/navigation.php rename to administrator/components/com_admin/views/sysinfo/tmpl/default_navigation.php diff --git a/administrator/components/com_admin/tmpl/sysinfo_phpinfo.php b/administrator/components/com_admin/views/sysinfo/tmpl/default_phpinfo.php similarity index 86% rename from administrator/components/com_admin/tmpl/sysinfo_phpinfo.php rename to administrator/components/com_admin/views/sysinfo/tmpl/default_phpinfo.php index 8fcacca1ffc2d..10348a68327f5 100644 --- a/administrator/components/com_admin/tmpl/sysinfo_phpinfo.php +++ b/administrator/components/com_admin/views/sysinfo/tmpl/default_phpinfo.php @@ -1,9 +1,4 @@ -
diff --git a/administrator/components/com_admin/views/sysinfo/tmpl/default_phpsettings.php b/administrator/components/com_admin/views/sysinfo/tmpl/default_phpsettings.php new file mode 100644 index 0000000000000..c3181762daacf --- /dev/null +++ b/administrator/components/com_admin/views/sysinfo/tmpl/default_phpsettings.php @@ -0,0 +1,145 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
  +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+ : + + +
+
diff --git a/administrator/components/com_admin/tmpl/sysinfo_system.php b/administrator/components/com_admin/views/sysinfo/tmpl/default_system.php similarity index 86% rename from administrator/components/com_admin/tmpl/sysinfo_system.php rename to administrator/components/com_admin/views/sysinfo/tmpl/default_system.php index bf1b56d84b97c..441ee288d1054 100644 --- a/administrator/components/com_admin/tmpl/sysinfo_system.php +++ b/administrator/components/com_admin/views/sysinfo/tmpl/default_system.php @@ -1,10 +1,7 @@ - +
@@ -63,7 +60,7 @@ : - + diff --git a/administrator/components/com_admin/views/sysinfo/tmpl/index.html b/administrator/components/com_admin/views/sysinfo/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_admin/views/sysinfo/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_admin/views/sysinfo/view.html.php b/administrator/components/com_admin/views/sysinfo/view.html.php new file mode 100644 index 0000000000000..60f98f58ebcc8 --- /dev/null +++ b/administrator/components/com_admin/views/sysinfo/view.html.php @@ -0,0 +1,86 @@ +loadTemplate('navigation'); + $document =& JFactory::getDocument(); + $document->setBuffer($contents, 'modules', 'submenu'); + + // Toolbar + JToolBarHelper::title( JText::_( 'Information' ), 'systeminfo.png' ); + JToolBarHelper::help( 'screen.system.info' ); + + parent::display($tpl); + } + + function get_php_setting($val) + { + $r = (ini_get($val) == '1' ? 1 : 0); + return $r ? JText::_( 'ON' ) : JText::_( 'OFF' ) ; + } + + function get_server_software() + { + if (isset($_SERVER['SERVER_SOFTWARE'])) { + return $_SERVER['SERVER_SOFTWARE']; + } else if (($sf = getenv('SERVER_SOFTWARE'))) { + return $sf; + } else { + return JText::_( 'n/a' ); + } + } + + function writableRow( $folder, $relative=1, $text='', $visible=1 ) + { + $writeable = ''. JText::_( 'Writable' ) .''; + $unwriteable = ''. JText::_( 'Unwritable' ) .''; + + echo ''; + echo ''; + echo $text; + if ( $visible ) { + echo $folder . '/'; + } + echo ''; + echo ''; + if ( $relative ) { + echo is_writable( "../$folder" ) ? $writeable : $unwriteable; + } else { + echo is_writable( "$folder" ) ? $writeable : $unwriteable; + } + echo ''; + echo ''; + } +} \ No newline at end of file diff --git a/administrator/components/com_banners/admin.banners.php b/administrator/components/com_banners/banners.php similarity index 88% rename from administrator/components/com_banners/admin.banners.php rename to administrator/components/com_banners/banners.php index 2b92f5b5c27f5..941745a7b8c55 100644 --- a/administrator/components/com_banners/admin.banners.php +++ b/administrator/components/com_banners/banners.php @@ -17,13 +17,10 @@ // Make sure the user is authorized to view this page $user = & JFactory::getUser(); -if (!$user->authorize( 'com_banners', 'manage' )) { +if (!$user->authorize2( 'com_banners', 'manage' )) { $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); } -// Set the table directory -JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_banners'.DS.'tables'); - $controllerName = JRequest::getCmd( 'c', 'banner' ); if($controllerName == 'client') { @@ -50,7 +47,7 @@ $controllerName = 'client'; } - require_once( JPATH_COMPONENT.DS.'controllers'.DS.$controllerName.'.php' ); + require_once JPATH_COMPONENT.DS.'controllers'.DS.$controllerName.'.php'; $controllerName = 'BannerController'.$controllerName; // Create the controller diff --git a/administrator/components/com_banners/controllers/banner.php b/administrator/components/com_banners/controllers/banner.php index a02dbf65f70d8..ecc06b224dc58 100644 --- a/administrator/components/com_banners/controllers/banner.php +++ b/administrator/components/com_banners/controllers/banner.php @@ -30,7 +30,8 @@ function __construct( $config = array() ) { parent::__construct( $config ); // Register Extra tasks - $this->registerTask( 'add', 'edit' ); + $this->registerTask( 'add', 'display' ); + $this->registerTask( 'edit', 'display' ); $this->registerTask( 'apply', 'save' ); $this->registerTask( 'resethits', 'save' ); $this->registerTask( 'unpublish', 'publish' ); @@ -41,138 +42,30 @@ function __construct( $config = array() ) */ function display() { - global $mainframe; + $app =& JFactory::getApplication(); + $user =& JFactory::getUser(); - $db =& JFactory::getDBO(); - - $context = 'com_banners.banner.list.'; - $filter_order = $mainframe->getUserStateFromRequest( $context.'filter_order', 'filter_order', 'cc.title', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $context.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); - $filter_catid = $mainframe->getUserStateFromRequest( $context.'filter_catid', 'filter_catid', '', 'int' ); - $filter_state = $mainframe->getUserStateFromRequest( $context.'filter_state', 'filter_state', '', 'word' ); - $search = $mainframe->getUserStateFromRequest( $context.'search', 'search', '', 'string' ); - - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); - $limitstart = $mainframe->getUserStateFromRequest( $context.'limitstart', 'limitstart', 0, 'int' ); - - $where = array(); - - if ( $filter_state ) + switch($this->getTask()) { - if ( $filter_state == 'P' ) { - $where[] = 'b.showBanner = 1'; - } - else if ($filter_state == 'U' ) { - $where[] = 'b.showBanner = 0'; + case 'add': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'banner'); + JRequest::setVar( 'edit', false ); + } break; + case 'edit': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'banner'); + JRequest::setVar( 'edit', true ); + } break; + default: + { + JRequest::setVar( 'view', 'banners'); } } - if ($filter_catid) { - $where[] = 'cc.id = ' . (int) $filter_catid; - } - if ($search) { - $where[] = 'LOWER(b.name) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); - } - $where = count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : ''; - $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', b.ordering'; - - // get the total number of records - $query = 'SELECT COUNT(*)' - . ' FROM #__banner AS b' - . ' LEFT JOIN #__categories AS cc ON cc.id = b.catid' - . $where - ; - $db->setQuery( $query ); - $total = $db->loadResult(); - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $total, $limitstart, $limit ); - - $query = 'SELECT b.*, c.name AS client_name, cc.title AS category_name, u.name AS editor' - . ' FROM #__banner AS b' - . ' INNER JOIN #__bannerclient AS c ON c.cid = b.cid' - . ' LEFT JOIN #__categories AS cc ON cc.id = b.catid' - . ' LEFT JOIN #__users AS u ON u.id = b.checked_out' - . $where - . $orderby - ; - $db->setQuery( $query, $pageNav->limitstart, $pageNav->limit ); - $rows = $db->loadObjectList(); - - // build list of categories - $javascript = 'onchange="document.adminForm.submit();"'; - $lists['catid'] = JHTML::_('list.category', 'filter_catid', 'com_banner', (int) $filter_catid, $javascript ); - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - require_once(JPATH_COMPONENT.DS.'views'.DS.'banner.php'); - BannersViewBanner::banners( $rows, $pageNav, $lists ); - } - - function edit() - { - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - if ($this->_task == 'edit') { - $cid = JRequest::getVar('cid', array(0), 'method', 'array'); - $cid = array((int) $cid[0]); - } else { - $cid = array( 0 ); - } - - $option = JRequest::getCmd('option'); - - $lists = array(); - - $row =& JTable::getInstance('banner', 'Table'); - $row->load( $cid[0] ); - - if ($cid[0]) { - $row->checkout( $user->get('id') ); - } else { - $row->showBanner = 1; - } - - // Build Client select list - $sql = 'SELECT cid, name' - . ' FROM #__bannerclient' - ; - $db->setQuery($sql); - if (!$db->query()) - { - $this->setRedirect( 'index.php?option=com_banners' ); - return JError::raiseWarning( 500, $db->getErrorMsg() ); - } - - $clientlist[] = JHTML::_('select.option', '0', JText::_( 'Select Client' ), 'cid', 'name' ); - $clientlist = array_merge( $clientlist, $db->loadObjectList() ); - $lists['cid'] = JHTML::_('select.genericlist', $clientlist, 'cid', 'class="inputbox" size="1"','cid', 'name', $row->cid ); - - // Imagelist - $javascript = 'onchange="changeDisplayImage();"'; - $directory = '/images/banners'; - $lists['imageurl'] = JHTML::_('list.images', 'imageurl', $row->imageurl, $javascript, $directory ); - - // build list of categories - $lists['catid'] = JHTML::_('list.category', 'catid', 'com_banner', intval( $row->catid ) ); - - // sticky - $lists['sticky'] = JHTML::_('select.booleanlist', 'sticky', 'class="inputbox"', $row->sticky ); - - // published - $lists['showBanner'] = JHTML::_('select.booleanlist', 'showBanner', '', $row->showBanner ); - - require_once(JPATH_COMPONENT.DS.'views'.DS.'banner.php'); - BannersViewBanner::banner( $row, $lists ); + parent::display(); } /** @@ -183,55 +76,41 @@ function save() // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - $this->setRedirect( 'index.php?option=com_banners' ); - - // Initialize variables - $db =& JFactory::getDBO(); - - $post = JRequest::get( 'post' ); + $post = JRequest::get('post'); + $bid = JRequest::getVar( 'bid', array(0), 'post', 'array' ); + $post['bid'] = (int) $bid[0]; // fix up special html fields $post['custombannercode'] = JRequest::getVar( 'custombannercode', '', 'post', 'string', JREQUEST_ALLOWRAW ); - $row =& JTable::getInstance('banner', 'Table'); - - if (!$row->bind( $post )) { - return JError::raiseWarning( 500, $row->getError() ); - } - // Resets clicks when `Reset Clicks` button is used instead of `Save` button $task = JRequest::getCmd( 'task' ); if ( $task == 'resethits' ) - { - $row->clicks = 0; - $msg = JText::_( 'Reset Banner clicks' ); - } + $post['clicks'] = 0; // Sets impressions to unlimited when `unlimited` checkbox ticked $unlimited = JRequest::getBool('unlimited'); if ($unlimited) { - $row->imptotal = 0; + $post['imptotal'] = 0; } - if (!$row->check()) { - return JError::raiseWarning( 500, $row->getError() ); - } + $model = $this->getModel('banner'); - // if new item order last in appropriate group - if (!$row->bid) - { - $where = 'catid = '.(int) $row->catid; - $row->ordering = $row->getNextOrder( $where ); + if ($model->store($post)) { + if ( $task == 'resethits' ) + $msg = JText::_( 'Reset Banner clicks' ); + else + $msg = JText::_( 'Banner Saved' ); + } else { + $msg = JText::_( 'Error Saving Banner' ); } - if (!$row->store()) { - return JError::raiseWarning( 500, $row->getError() ); - } - $row->checkin(); + // Check the table in so it can be edited.... we are done with it anyway + $model->checkin(); switch ($task) { case 'apply': - $link = 'index.php?option=com_banners&task=edit&cid[]='. $row->bid ; + $link = 'index.php?option=com_banners&task=edit&bid[]='. (int) $bid[0] ; break; case 'save': @@ -240,22 +119,16 @@ function save() break; } - $this->setRedirect( $link, JText::_( 'Item Saved' ) ); + $this->setRedirect( $link, $msg ); } function cancel() { - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); + // Checkin the data + $model = $this->getModel('banner'); + $model->checkin(); $this->setRedirect( 'index.php?option=com_banners' ); - - // Initialize variables - $db =& JFactory::getDBO(); - $post = JRequest::get( 'post' ); - $row =& JTable::getInstance('banner', 'Table'); - $row->bind( $post ); - $row->checkin(); } /** @@ -266,40 +139,21 @@ function copy() // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - $this->setRedirect( 'index.php?option=com_banners' ); - - $cid = JRequest::getVar( 'cid', null, 'post', 'array' ); - $db =& JFactory::getDBO(); - $table =& JTable::getInstance('banner', 'Table'); - $user = &JFactory::getUser(); - $n = count( $cid ); + // Initialize variables + $bid = JRequest::getVar( 'bid', array(), 'post', 'array' ); + JArrayHelper::toInteger($bid); - if ($n > 0) - { - foreach ($cid as $id) - { - if ($table->load( (int)$id )) - { - $table->bid = 0; - $table->name = 'Copy of ' . $table->name; - $table->impmade = 0; - $table->clicks = 0; - $table->showBanner = 0; - $table->date = $db->getNullDate(); - - if (!$table->store()) { - return JError::raiseWarning( $table->getError() ); - } - } - else { - return JError::raiseWarning( 500, $table->getError() ); - } - } + if (count( $bid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to copy' ) ); } - else { - return JError::raiseWarning( 500, JText::_( 'No items selected' ) ); + + $model = $this->getModel('banner'); + + if(!$model->copy($bid)) { + echo "\n"; } - $this->setMessage( JText::sprintf( 'Items copied', $n ) ); + + $this->setRedirect( 'index.php?option=com_banners', JText::sprintf( 'Items copied', count( $cid ) ) ); } function publish() @@ -307,33 +161,22 @@ function publish() // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - $this->setRedirect( 'index.php?option=com_banners' ); - // Initialize variables - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + $bid = JRequest::getVar( 'bid', array(), 'post', 'array' ); $task = JRequest::getCmd( 'task' ); $publish = ($task == 'publish'); - $n = count( $cid ); + JArrayHelper::toInteger($bid); - if (empty( $cid )) { - return JError::raiseWarning( 500, JText::_( 'No items selected' ) ); + if (count( $bid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to publish' ) ); } - JArrayHelper::toInteger( $cid ); - $cids = implode( ',', $cid ); - - $query = 'UPDATE #__banner' - . ' SET showBanner = ' . (int) $publish - . ' WHERE bid IN ( '. $cids.' )' - . ' AND ( checked_out = 0 OR ( checked_out = ' .(int) $user->get('id'). ' ) )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - return JError::raiseWarning( 500, $row->getError() ); + $model = $this->getModel('banner'); + if(!$model->publish($bid, $publish)) { + echo "\n"; } - $this->setMessage( JText::sprintf( $publish ? 'Items published' : 'Items unpublished', $n ) ); + + $this->setRedirect( 'index.php?option=com_banners' ); } function remove() @@ -341,87 +184,60 @@ function remove() // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - $this->setRedirect( 'index.php?option=com_banners' ); + $bid = JRequest::getVar( 'bid', array(), 'post', 'array' ); + JArrayHelper::toInteger($bid); - // Initialize variables - $db =& JFactory::getDBO(); - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); - $n = count( $cid ); - JArrayHelper::toInteger( $cid ); + if (count( $bid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to delete' ) ); + } - if ($n) - { - $query = 'DELETE FROM #__banner' - . ' WHERE bid = ' . implode( ' OR bid = ', $cid ) - ; - $db->setQuery( $query ); - if (!$db->query()) { - JError::raiseWarning( 500, $row->getError() ); - } + $model = $this->getModel('banner'); + if(!$model->delete($bid)) { + echo "\n"; } - $this->setMessage( JText::sprintf( 'Items removed', $n ) ); + $this->setRedirect( 'index.php?option=com_banners' ); } - /** - * Save the new order given by user - */ - function saveOrder() + function orderup() { // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - $this->setRedirect( 'index.php?option=com_banners' ); + $model = $this->getModel('banner'); + $model->move(-1); - // Initialize variables - $db =& JFactory::getDBO(); - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); - $order = JRequest::getVar( 'order', array(), 'post', 'array' ); - $row =& JTable::getInstance('banner', 'Table'); - $total = count( $cid ); - $conditions = array(); - - if (empty( $cid )) { - return JError::raiseWarning( 500, JText::_( 'No items selected' ) ); - } + $this->setRedirect( 'index.php?option=com_banners'); + } - // update ordering values - for ($i = 0; $i < $total; $i++) - { - $row->load( (int) $cid[$i] ); - if ($row->ordering != $order[$i]) - { - $row->ordering = $order[$i]; - if (!$row->store()) { - return JError::raiseError( 500, $db->getErrorMsg() ); - } - // remember to reorder this category - $condition = 'catid = '.(int) $row->catid; - $found = false; - foreach ($conditions as $cond) { - if ($cond[1] == $condition) - { - $found = true; - break; - } - } - if (!$found) { - $conditions[] = array ( $row->bid, $condition ); - } - } - } + function orderdown() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); - // execute reorder for each category - foreach ($conditions as $cond) - { - $row->load( $cond[0] ); - $row->reorder( $cond[1] ); - } + $model = $this->getModel('banner'); + $model->move(1); + + $this->setRedirect( 'index.php?option=com_banners'); + } + + /** + * Save the new order given by user + */ + function saveorder() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + $order = JRequest::getVar( 'order', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + JArrayHelper::toInteger($order); - // Clear the component's cache - $cache =& JFactory::getCache('com_banners'); - $cache->clean(); + $model = $this->getModel('banner'); + $model->saveorder($cid, $order); - $this->setMessage( JText::_('New ordering saved') ); + $msg = JText::_('New ordering saved'); + $this->setRedirect( 'index.php?option=com_banners', $msg ); } } \ No newline at end of file diff --git a/administrator/components/com_banners/controllers/client.php b/administrator/components/com_banners/controllers/client.php index 8293b6cc14eef..0b484224aa191 100644 --- a/administrator/components/com_banners/controllers/client.php +++ b/administrator/components/com_banners/controllers/client.php @@ -36,128 +36,65 @@ function __construct( $config = array() ) function display() { - global $mainframe; + $app =& JFactory::getApplication(); + $user =& JFactory::getUser(); - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - $context = 'com_banners.bannerclient.list.'; - $filter_order = $mainframe->getUserStateFromRequest( $context.'filter_order', 'filter_order', 'a.name', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $context.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); - $search = $mainframe->getUserStateFromRequest( $context.'search', 'search', '', 'string' ); - $search = JString::strtolower( $search ); - - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); - $limitstart = $mainframe->getUserStateFromRequest( $context.'limitstart', 'limitstart', 0, 'int' ); - - $where = array(); - - if ($search) { - $where[] = 'LOWER(a.name) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); + switch($this->getTask()) + { + case 'add': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'bannerclient'); + JRequest::setVar( 'edit', false ); + } break; + case 'edit': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'bannerclient'); + JRequest::setVar( 'edit', true ); + } break; } - $where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' ); - $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', a.cid'; - - // get the total number of records - $query = 'SELECT a.*, count(b.bid) AS nbanners, u.name AS editor' - . ' FROM #__bannerclient AS a' - . ' LEFT JOIN #__banner AS b ON a.cid = b.cid' - . ' LEFT JOIN #__users AS u ON u.id = a.checked_out' - . $where - . ' GROUP BY a.cid' - . $orderby - ; - - $db->setQuery( $query ); - $db->query(); - $total = $db->getNumRows(); - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $total, $limitstart, $limit ); - - $db->setQuery( $query, $pageNav->limitstart, $pageNav->limit ); - $rows = $db->loadObjectList(); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - require_once(JPATH_COMPONENT.DS.'views'.DS.'client.php'); - BannersViewClients::clients( $rows, $pageNav, $lists ); + if (JRequest::getVar( 'view', '') == '') { + JRequest::setVar( 'view', 'bannerclients'); + } + parent::display(); } - /** - * Edit a banner client record - */ - function edit() + function save() { - // Initialize variables - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - $userId = $user->get ( 'id' ); - - if ($this->_task == 'edit') { - $cid = JRequest::getVar('cid', array(0), 'method', 'array'); - } else { - $cid = array( 0 ); + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); } - $row =& JTable::getInstance('bannerclient', 'Table'); - $row->load( (int) $cid[0] ); + $post = JRequest::get('post'); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $post['cid'] = (int) $cid[0]; - // fail if checked out not by 'me' - if ($row->isCheckedOut( $userId )) { - $this->setRedirect( 'index.php?option=com_banners&c=client' ); - return JError::raiseWarning( JText::sprintf( 'WARNEDITEDBYPERSON', $row->name ) ); - } + $model = $this->getModel('bannerclient'); - if ($row->cid) { - // do stuff for existing record - $row->checkout( $userId ); + if ($model->store($post)) { + $msg = JText::_( 'Item Saved' ); } else { - // do stuff for new record - $row->published = 0; - $row->approved = 0; + $msg = JText::_( 'Error Saving Item' ); } - require_once(JPATH_COMPONENT.DS.'views'.DS.'client.php'); - BannersViewClients::client( $row ); - } - - function save() - { - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $this->setRedirect( 'index.php?option=com_banners&c=client' ); - - // Initialize variables - $db =& JFactory::getDBO(); - $table =& JTable::getInstance('bannerclient', 'Table'); - - if (!$table->bind( JRequest::get( 'post' ) )) { - return JError::raiseWarning( 500, $table->getError() ); - } - if (!$table->check()) { - return JError::raiseWarning( 500, $table->getError() ); - } - if (!$table->store()) { - return JError::raiseWarning( 500, $table->getError() ); - } - $table->checkin(); + // Check the table in so it can be edited.... we are done with it anyway + $model->checkin(); switch (JRequest::getCmd( 'task' )) { case 'apply': - $this->setRedirect( 'index.php?option=com_banners&c=client&task=edit&cid[]='. $table->cid ); + $link = 'index.php?option=com_banners&c=client&task=edit&cid[]='. $post['cid']; + break; + default: + $link = 'index.php?option=com_banners&c=client'; break; } - $this->setMessage( JText::_( 'Item Saved' ) ); + $this->setRedirect($link, $msg); } function cancel() @@ -165,49 +102,33 @@ function cancel() // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - $this->setRedirect( 'index.php?option=com_banners&c=client' ); + // Checkin the contact + $model = $this->getModel('bannerclient'); + $model->checkin(); - // Initialize variables - $db =& JFactory::getDBO(); - $table =& JTable::getInstance('bannerclient', 'Table'); - $table->cid = JRequest::getVar( 'cid', 0, 'post', 'int' ); - $table->checkin(); + $this->setRedirect( 'index.php?option=com_banners&c=client' ); } function remove() { - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } - $this->setRedirect( 'index.php?option=com_banners&c=client' ); + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); - // Initialize variables - $db =& JFactory::getDBO(); - $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); - $table =& JTable::getInstance('bannerclient', 'Table'); - $n = count( $cid ); + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to delete' ) ); + } - for ($i = 0; $i < $n; $i++) - { - $query = 'SELECT COUNT( bid )' - . ' FROM #__banner' - . ' WHERE cid = '. (int) $cid[$i] - ; - $db->setQuery($query); - $count = $db->loadResult(); - if ($count === null) { - return JError::raiseWarning( 500, $db->getErrorMsg() ); - } - else if ($count > 0) { - return JError::raiseWarning( 500, JText::_( 'WARNCANNOTDELCLIENTBANNER' ) ); - } - else { - if (!$table->delete( (int) $cid[$i] )) { - return JError::raiseWarning( 500, $table->getError() ); - } - } + $model = $this->getModel('contact'); + if(!$model->delete($cid)) { + echo "\n"; } - $this->setMessage( JText::sprintf( 'Items removed', $n ) ); + $this->setRedirect( 'index.php?option=com_banners&c=client', JText::sprintf( 'Items removed', count($cid) ) ); } } \ No newline at end of file diff --git a/administrator/components/com_banners/controllers/index.html b/administrator/components/com_banners/controllers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_banners/controllers/index.html +++ b/administrator/components/com_banners/controllers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_banners/elements/index.html b/administrator/components/com_banners/elements/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_banners/elements/index.html +++ b/administrator/components/com_banners/elements/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_banners/helpers/index.html b/administrator/components/com_banners/helpers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_banners/helpers/index.html +++ b/administrator/components/com_banners/helpers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_banners/index.html b/administrator/components/com_banners/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_banners/index.html +++ b/administrator/components/com_banners/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_banners/models/banner.php b/administrator/components/com_banners/models/banner.php new file mode 100644 index 0000000000000..3baa2d5a3e47d --- /dev/null +++ b/administrator/components/com_banners/models/banner.php @@ -0,0 +1,398 @@ +setId((int)$array[0]); + } + + /** + * Method to set the banner identifier + * + * @access public + * @param int identifier + */ + function setId($id) + { + // Set banner id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a banner + * + * @since 1.6 + */ + function &getData() + { + // Load the banner data + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Tests if banner is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.6 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_loadData()) + { + if ($uid) { + return ($this->_data->checked_out && $this->_data->checked_out != $uid); + } else { + return $this->_data->checked_out; + } + } + } + + /** + * Method to checkin/unlock the banner + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function checkin() + { + if ($this->_id) + { + $banner = & $this->getTable(); + if(! $banner->checkin($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return false; + } + + /** + * Method to checkout/lock the banner + * + * @access public + * @param int $uid User ID of the user checking the banner out + * @return boolean True on success + * @since 1.6 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the banner with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $banner = & $this->getTable(); + if(!$banner->checkout($uid, $this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + return false; + } + + /** + * Method to store the banner + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function store($data) + { + $row =& $this->getTable(); + + // Bind the form fields to the web link table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Make sure the data is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the data to the database + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to remove a banner + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__banner' + . ' WHERE bid IN ( '.$cids.' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to (un)publish a banner + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function publish($cid = array(), $publish = 1) + { + $user =& JFactory::getUser(); + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__banner' + . ' SET showBanner = '.(int) $publish + . ' WHERE bid IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to move a banner + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function move($direction) + { + $row =& $this->getTable(); + if (!$row->load($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if (!$row->move( $direction, ' catid = '.(int) $row->catid.' AND showBanner >= 0 ' )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to move a banner + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function saveorder($cid = array(), $order) + { + $row =& $this->getTable(); + $groupings = array(); + + // update ordering values + for( $i=0; $i < count($cid); $i++ ) + { + $row->load( (int) $cid[$i] ); + // track categories + $groupings[] = $row->catid; + + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + } + + // execute updateOrder for each parent group + $groupings = array_unique( $groupings ); + foreach ($groupings as $group){ + $row->reorder('catid = '.$this->_db->Quote($group)); + } + + return true; + } + + /** + * Copies one or more banners + */ + function copy($cid = array()) + { + $row =& $this->getTable(); + + $n = count( $cid ); + + // update ordering values + for( $i=0; $i < $n; $i++ ) + { + $row->load( (int) $cid[$i] ); + + $row->bid = 0; + $row->name = 'Copy of ' . $row->name; + $row->impmade = 0; + $row->clicks = 0; + $row->showBanner = 0; + $row->date = $this->_db->getNullDate(); + + if (!$row->store()) { + return JError::raiseWarning( $row->getError() ); + } + } + + return true; + } + + /** + * Method to load banner data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _loadData() + { + if (empty($this->_data)) + { + // Lets load the banners + $query = 'SELECT b.*'. + ' FROM #__banner AS b' . + ' WHERE b.bid = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the banner data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $banner = new stdClass(); + $banner->bid = 0; + $banner->cid = 0; + $banner->type = null; + $banner->name = null; + $banner->alias = null; + $banner->imptotal = 0; + $banner->impmade = 0; + $banner->clicks = 0; + $banner->imageurl = null; + $banner->clickurl = null; + $banner->date = null; + $banner->showBanner = null; + $banner->checked_out = 0; + $banner->checked_out_time = 0; + $banner->editor = null; + $banner->custombannercode = null; + $banner->catid = 0; + $banner->description = null; + $banner->sticky = 0; + $banner->ordering = 0; + $banner->publish_up = null; + $banner->publish_down = null; + $banner->tags = null; + $banner->params = null; + $this->_data = $banner; + return (boolean) $this->_data; + } + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_banners/models/bannerclient.php b/administrator/components/com_banners/models/bannerclient.php new file mode 100644 index 0000000000000..f609415bb1472 --- /dev/null +++ b/administrator/components/com_banners/models/bannerclient.php @@ -0,0 +1,261 @@ +setId((int)$array[0]); + } + + /** + * Method to set the banner client identifier + * + * @access public + * @param int identifier + */ + function setId($id) + { + // Set banner client id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a banner client + * + * @since 1.6 + */ + function &getData() + { + // Load the banner client data + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Tests if banner client is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.6 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_loadData()) + { + if ($uid) { + return ($this->_data->checked_out && $this->_data->checked_out != $uid); + } else { + return $this->_data->checked_out; + } + } + } + + /** + * Method to checkin/unlock the banner client + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function checkin() + { + if ($this->_id) + { + $bannerclient = & $this->getTable(); + if(! $bannerclient->checkin($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return false; + } + + /** + * Method to checkout/lock the banner client + * + * @access public + * @param int $uid User ID of the user checking the banner client out + * @return boolean True on success + * @since 1.6 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the banner client with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $bannerclient = & $this->getTable(); + if(!$bannerclient->checkout($uid, $this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + return false; + } + + /** + * Method to store the banner client + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function store($data) + { + $row =& $this->getTable(); + + // Bind the form fields to the web link table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Make sure the data is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the data to the database + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to remove a banner client + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__bannerclient' + . ' WHERE cid IN ( '.$cids.' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to load banner client data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _loadData() + { + if (empty($this->_data)) + { + // Lets load the banner clients + $query = 'SELECT bc.*'. + ' FROM #__bannerclient AS bc' . + ' WHERE bc.cid = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the banner client data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $bannerclient = new stdClass(); + $bannerclient->id = 0; + $bannerclient->name = null; + $bannerclient->contact = null; + $bannerclient->email = null; + $bannerclient->extrainfo = null; + $bannerclient->checked_out = 0; + $bannerclient->checked_out_time = 0; + $bannerclient->editor = null; + $this->_data = $bannerclient; + return (boolean) $this->_data; + } + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_banners/models/bannerclients.php b/administrator/components/com_banners/models/bannerclients.php new file mode 100644 index 0000000000000..e0675afa3d1bb --- /dev/null +++ b/administrator/components/com_banners/models/bannerclients.php @@ -0,0 +1,191 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + // In case limit has been changed, adjust limitstart accordingly + $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $context = 'com_banners.bannerclient.list.'; + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $context.'filter_order', 'filter_order', 'a.name', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $context.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $context.'filter_state', 'filter_state', '', 'word' ); + $filter->search = $mainframe->getUserStateFromRequest( $context.'search', 'search', '', 'string' ); + $this->_filter = $filter; + } + + /** + * Method to get weblinks item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_data; + } + + /** + * Method to get the total number of weblink items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the weblinks + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the weblinks + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = 'SELECT a.*, count(b.bid) AS nbanners, u.name AS editor' + . ' FROM #__bannerclient AS a' + . ' LEFT JOIN #__banner AS b ON a.cid = b.cid' + . ' LEFT JOIN #__users AS u ON u.id = a.checked_out' + . $where + . ' GROUP BY a.cid' + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy() + { + $orderby = ' ORDER BY '. $this->_filter->order .' '. $this->_filter->order_Dir .', a.cid'; + + return $orderby; + } + + function _buildContentWhere() + { + $search = JString::strtolower( $this->_filter->search ); + + $where = array(); + + if ($search) { + $where[] = 'LOWER(a.name) LIKE '.$this->_db->Quote( '%'.$this->_db->getEscaped( $search, true ).'%', false ); + } + + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + + return $where; + } +} diff --git a/administrator/components/com_banners/models/banners.php b/administrator/components/com_banners/models/banners.php new file mode 100644 index 0000000000000..4a50448083bea --- /dev/null +++ b/administrator/components/com_banners/models/banners.php @@ -0,0 +1,207 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $context.'limitstart', 'limitstart', 0, 'int' ); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $context.'filter_order', 'filter_order', 'b.ordering', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $context.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $context.'filter_state', 'filter_state', '', 'word' ); + $filter->catid = $mainframe->getUserStateFromRequest( $context.'filter_catid', 'filter_catid', 0, 'int' ); + $filter->search = $mainframe->getUserStateFromRequest( $context.'search', 'search', '', 'string' ); + $this->_filter = $filter; + } + + /** + * Method to get contacts item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_data; + } + + /** + * Method to get the total number of contact items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the contacts + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the contacts + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = 'SELECT b.*, c.name AS client_name, cc.title AS category_name, u.name AS editor' + . ' FROM #__banner AS b' + . ' INNER JOIN #__bannerclient AS c ON c.cid = b.cid' + . ' LEFT JOIN #__categories AS cc ON cc.id = b.catid' + . ' LEFT JOIN #__users AS u ON u.id = b.checked_out' + . $where + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy() + { + if ($this->_filter->order == 'b.ordering'){ + $orderby = ' ORDER BY cc.title, b.ordering'; + } else { + $orderby = ' ORDER BY '.$this->_filter->order.' '. $this->_filter->order_Dir.', cc.title, b.ordering'; + } + + return $orderby; + } + + function _buildContentWhere() + { + global $mainframe, $option; + + $search = JString::strtolower( $this->_filter->search ); + + $where = array(); + + if ( $this->_filter->state ) + { + if ( $this->_filter->state == 'P' ) { + $where[] = 'b.showBanner = 1'; + } + else if ($this->_filter->state == 'U' ) { + $where[] = 'b.showBanner = 0'; + } + } + if ($this->_filter->catid) { + $where[] = 'cc.id = ' . (int) $this->_filter->catid; + } + if ($search) { + $where[] = 'LOWER(b.name) LIKE '.$this->_db->Quote('%'.$this->_db->getEscaped( $search, true ).'%', false); + } + + $where = count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : ''; + + return $where; + } +} \ No newline at end of file diff --git a/administrator/components/com_banners/models/index.html b/administrator/components/com_banners/models/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_banners/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_banners/tables/index.html b/administrator/components/com_banners/tables/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_banners/tables/index.html +++ b/administrator/components/com_banners/tables/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_banners/views/banner.php b/administrator/components/com_banners/views/banner.php deleted file mode 100644 index 7405f86abe2b8..0000000000000 --- a/administrator/components/com_banners/views/banner.php +++ /dev/null @@ -1,449 +0,0 @@ - - - - - - - -
- : - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - id = $row->bid; - $link = JRoute::_( 'index.php?option=com_banners&task=edit&cid[]='. $row->id ); - - if( $row->imptotal <= 0 ) { - $row->imptotal = JText::_('unlimited'); - } - - if ( $row->impmade != 0 ) { - $percentClicks = 100 * $row->clicks/$row->impmade; - } else { - $percentClicks = 0; - } - - $row->published = $row->showBanner; - $published = JHTML::_('grid.published', $row, $i ); - $checked = JHTML::_('grid.checkedout', $row, $i ); - ?> - "> - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- getListFooter(); ?> -
- getRowOffset($i); ?> - - - - - get ('id'), $row->checked_out ) ) { - echo $row->name; - } else { - ?> - - - name; ?> - - - - client_name;?> - - category_name;?> - - - - - - sticky ? JText::_( 'Yes' ) : JText::_( 'No' );?> - - impmade.' '.JText::_('of').' '.$row->imptotal?> - - clicks;?> - - - - tags; ?> - - id; ?> -
- - - - - - - - - - [ '. JText::_( 'New' ) .' ]' : JText::_( 'Banner' ) . ': [ '. JText::_( 'Edit' ) .' ]', 'generic.png' ); - JToolBarHelper::save( 'save' ); - JToolBarHelper::apply('apply'); - JToolBarHelper::cancel( 'cancel' ); - JToolBarHelper::help( 'screen.banners.edit' ); - } - - function banner( &$row, &$lists ) - { - BannersViewBanner::setBannerToolbar(); - JRequest::setVar( 'hidemainmenu', 1 ); - JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'custombannercode' ); - ?> - -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - imptotal == 0) { - $unlimited = 'checked="checked"'; - $row->imptotal = ''; - } - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- : - - -
- : - - -
- - - -
- - - -
- - - -
- - - -      - - /> -
- - - -
- : - - clicks;?> -      - -
- - - -
- - - -
-
- - - -
- : - - imageurl)) { - ?> - - imageurl)) { - ?> - - - - -
- - - -
-
-
-
- - - - - - - - -
- \ No newline at end of file diff --git a/administrator/components/com_banners/views/banner/tmpl/default.php b/administrator/components/com_banners/views/banner/tmpl/default.php new file mode 100644 index 0000000000000..23771b490a91a --- /dev/null +++ b/administrator/components/com_banners/views/banner/tmpl/default.php @@ -0,0 +1,234 @@ + + + + + +
" method="post" name="adminForm"> + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + row->imptotal == 0) { + $unlimited = 'checked="checked"'; + $this->row->imptotal = ''; + } + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ : + + lists['showBanner']; ?> +
+ : + + lists['sticky']; ?> +
+ + + row, $this->row->bid, $this->order_query, 1 ); ?> +
+ + + lists['catid']; ?> +
+ + + lists['cid']; ?> +
+ + + +      + + /> +
+ + + +
+ : + + row->clicks;?> +      + +
+ + + +
+ + + +
+
+ + + lists['imageurl']; ?> +
+ : + + row->imageurl)) { + ?> + + row->imageurl)) { + ?> + + + + +
+ + + +
+
+
+
+ + + + + + + + +
diff --git a/administrator/components/com_banners/views/banner/tmpl/index.html b/administrator/components/com_banners/views/banner/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_banners/views/banner/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_banners/views/banner/view.html.php b/administrator/components/com_banners/views/banner/view.html.php new file mode 100644 index 0000000000000..97735535cba43 --- /dev/null +++ b/administrator/components/com_banners/views/banner/view.html.php @@ -0,0 +1,108 @@ +getModel(); + + // Set toolbar items for the page + $edit = JRequest::getVar('edit',true); + $text = !$edit ? JText::_( 'New' ) : JText::_( 'Edit' ); + JToolBarHelper::title( JText::_( 'Banner' ).': [ ' . $text.' ]', 'generic.png' ); + JToolBarHelper::save( 'save' ); + JToolBarHelper::apply('apply'); + JToolBarHelper::cancel( 'cancel' ); + JToolBarHelper::help( 'screen.banners.edit' ); + + //get the banner + $row =& $this->get('data'); + + // fail if checked out not by 'me' + if ($model->isCheckedOut( $user->get('id') )) { + $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The banner' ), $row->name ); + $mainframe->redirect( 'index.php?option='. $option, $msg ); + } + + // Edit or Create? + if ($edit) + { + $model->checkout( $user->get('id') ); + } + else + { + // initialise new record + $row->showBanner = 1; + } + + // Build Client select list + $sql = 'SELECT cid, name' + . ' FROM #__bannerclient' + ; + $db->setQuery($sql); + if (!$db->query()) + { + $this->setRedirect( 'index.php?option=com_banners' ); + return JError::raiseWarning( 500, $db->getErrorMsg() ); + } + + $clientlist[] = JHTML::_('select.option', '0', '- ' . JText::_( 'Select Client' ) . ' -', 'cid', 'name' ); + $clientlist = array_merge( $clientlist, $db->loadObjectList() ); + $lists['cid'] = JHTML::_('select.genericlist', $clientlist, 'cid', 'class="inputbox" size="1"','cid', 'name', $row->cid ); + + // Imagelist + $javascript = 'onchange="changeDisplayImage();"'; + $directory = '/images/banners'; + $lists['imageurl'] = JHTML::_('list.images', 'imageurl', $row->imageurl, $javascript, $directory ); + + // build list of categories + $lists['catid'] = JHTML::_('list.category', 'catid', 'com_banner', intval( $row->catid ) ); + + // sticky + $lists['sticky'] = JHTML::_('select.booleanlist', 'sticky', 'class="inputbox"', $row->sticky ); + + // published + $lists['showBanner'] = JHTML::_('select.booleanlist', 'showBanner', '', $row->showBanner ); + + // build the html select list for ordering + $order_query = 'SELECT ordering AS value, name AS text' + . ' FROM #__banner' + . ' WHERE catid = ' . (int) $row->catid + . ' ORDER BY ordering'; + + //clean data + JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'custombannercode' ); + + $this->assignRef('row', $row); + $this->assignRef('lists', $lists); + $this->assignRef('order_query', $order_query); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_banners/views/bannerclient/index.html b/administrator/components/com_banners/views/bannerclient/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_banners/views/bannerclient/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_banners/views/bannerclient/tmpl/default.php b/administrator/components/com_banners/views/bannerclient/tmpl/default.php new file mode 100644 index 0000000000000..896e9116587c7 --- /dev/null +++ b/administrator/components/com_banners/views/bannerclient/tmpl/default.php @@ -0,0 +1,102 @@ + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+
+
+ +
+
+ + + + + + +
+ +
+
+
+
+ + + + + + + +
diff --git a/administrator/components/com_banners/views/bannerclient/tmpl/index.html b/administrator/components/com_banners/views/bannerclient/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_banners/views/bannerclient/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_banners/views/bannerclient/view.html.php b/administrator/components/com_banners/views/bannerclient/view.html.php new file mode 100644 index 0000000000000..dc368fa76f357 --- /dev/null +++ b/administrator/components/com_banners/views/bannerclient/view.html.php @@ -0,0 +1,67 @@ +getModel(); + + $task = JRequest::getVar( 'task', '', 'method', 'string'); + + JToolBarHelper::title( $task == 'add' ? JText::_( 'Banner Client' ) . ': [ '. JText::_( 'New' ) .' ]' : JText::_( 'Banner Client' ) . ': [ '. JText::_( 'Edit' ) .' ]', 'generic.png' ); + JToolBarHelper::save( 'save' ); + JToolBarHelper::apply('apply'); + JToolBarHelper::cancel( 'cancel' ); + JToolBarHelper::help( 'screen.banners.client.edit' ); + + $row =& $this->get('data'); + $isNew = ($row->cid < 1); + + // fail if checked out not by 'me' + if ($model->isCheckedOut( $user->get('id') )) { + $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The banner client' ), $row->name ); + $app->redirect( 'index.php?option=com_banners', $msg ); + } + + // Edit or Create? + if (!$isNew) + { + $model->checkout( $user->get('id') ); + } + else + { + // do stuff for new record + $row->published = 0; + $row->approved = 0; + } + + JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'extrainfo' ); + + $this->assignRef('row', $row); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_banners/views/bannerclients/index.html b/administrator/components/com_banners/views/bannerclients/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_banners/views/bannerclients/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_banners/views/bannerclients/tmpl/default.php b/administrator/components/com_banners/views/bannerclients/tmpl/default.php new file mode 100644 index 0000000000000..62cc70fc8c3e1 --- /dev/null +++ b/administrator/components/com_banners/views/bannerclients/tmpl/default.php @@ -0,0 +1,108 @@ + + + + +
+ + + + + + +
+ : + + + + +
+ + + + + + + + + + + + + + + + + + + items ); $i < $n; $i++) { + $row = &$this->items[$i]; + + $row->id = $row->cid; + $link = JRoute::_( 'index.php?option=com_banners&c=client&task=edit&cid[]='. $row->id ); + + $checked = JHTML::_('grid.checkedout', $row, $i ); + ?> + "> + + + + + + + + + +
+ + + + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> +
+ pagination->getListFooter(); ?> +
+ pagination->getRowOffset( $i ); ?> + + + + user->get ('id'), $row->checked_out ) ) { + echo $row->name; + } else { + ?> + + + name; ?> + + + + contact; ?> + + nbanners;?> + + cid; ?> +
+ + + + + + + + +
diff --git a/administrator/components/com_banners/views/bannerclients/tmpl/index.html b/administrator/components/com_banners/views/bannerclients/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_banners/views/bannerclients/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_banners/views/bannerclients/view.html.php b/administrator/components/com_banners/views/bannerclients/view.html.php new file mode 100644 index 0000000000000..3484e8d9a5294 --- /dev/null +++ b/administrator/components/com_banners/views/bannerclients/view.html.php @@ -0,0 +1,48 @@ +get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter'); + + $this->assignRef('user', JFactory::getUser()); + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_banners/views/banners/index.html b/administrator/components/com_banners/views/banners/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_banners/views/banners/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_banners/views/banners/tmpl/default.php b/administrator/components/com_banners/views/banners/tmpl/default.php new file mode 100644 index 0000000000000..620b5e264b7cb --- /dev/null +++ b/administrator/components/com_banners/views/banners/tmpl/default.php @@ -0,0 +1,165 @@ + + +filter->order == 'b.ordering'); + JHTML::_('behavior.tooltip'); +?> +
+ + + + + +
+ : + + + + + filter->catid, 'onchange="document.adminForm.submit();"' ); + echo JHTML::_('grid.state', $this->filter->state ); + ?> +
+ + + + + + + + + + + + + + + + + + + + + + + + + rows ); $i < $n; $i++) { + $row = &$this->rows[$i]; + + $link = JRoute::_( 'index.php?option=com_banners&task=edit&bid[]='. $row->bid ); + + if( $row->imptotal <= 0 ) { + $row->imptotal = JText::_('unlimited'); + } + + if ( $row->impmade != 0 ) { + $percentClicks = 100 * $row->clicks/$row->impmade; + } else { + $percentClicks = 0; + } + + $row->published = $row->showBanner; + $published = JHTML::_('grid.published', $row, $i ); + $checked = JHTML::_('grid.checkedout', $row, $i, 'bid' ); + ?> + "> + + + + + + + + + + + + + + + +
+ + + + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + rows ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + + + filter->order_Dir, @$this->filter->order ); ?> +
+ pagination->getListFooter(); ?> +
+ pagination->getRowOffset($i); ?> + + + + + user->get ('id'), $row->checked_out ) ) { + echo $row->name; + } else { + ?> + + + name; ?> + + + + client_name;?> + + category_name;?> + + + + pagination->orderUpIcon( $i, ($row->category_name == @$this->rows[$i-1]->category_name), 'orderup', 'Move Up', $ordering ); ?> + pagination->orderDownIcon( $i, $n, ($row->category_name == @$this->rows[$i+1]->category_name), 'orderdown', 'Move Down', $ordering ); ?> + + class="text_area" style="text-align: center" /> + + sticky ? JText::_( 'Yes' ) : JText::_( 'No' );?> + + impmade.' '.JText::_('of').' '.$row->imptotal?> + + clicks;?> - + + + tags; ?> + + bid; ?> +
+ + + + + + + + +
diff --git a/administrator/components/com_banners/views/banners/tmpl/index.html b/administrator/components/com_banners/views/banners/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_banners/views/banners/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_banners/views/banners/view.html.php b/administrator/components/com_banners/views/banners/view.html.php new file mode 100644 index 0000000000000..489c30eee5e4a --- /dev/null +++ b/administrator/components/com_banners/views/banners/view.html.php @@ -0,0 +1,51 @@ +get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter'); + + $this->assignRef('user', JFactory::getUser()); + $this->assignRef('rows', $rows); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_banners/views/client.php b/administrator/components/com_banners/views/client.php deleted file mode 100644 index 368d7bfe49b46..0000000000000 --- a/administrator/components/com_banners/views/client.php +++ /dev/null @@ -1,258 +0,0 @@ - -
- - - - - - -
- : - - - - -
- - - - - - - - - - - - - - - - - - - id = $row->cid; - $link = JRoute::_( 'index.php?option=com_banners&c=client&task=edit&cid[]='. $row->id ); - - $checked = JHTML::_('grid.checkedout', $row, $i ); - ?> - "> - - - - - - - - - -
- - - - - - - - - - - -
- getListFooter(); ?> -
- getRowOffset( $i ); ?> - - - - get ('id'), $row->checked_out ) ) { - echo $row->name; - } else { - ?> - - - name; ?> - - - - contact; ?> - - nbanners;?> - - cid; ?> -
- - - - - - - - -
- [ '. JText::_( 'New' ) .' ]' : JText::_( 'Banner Client' ) . ': [ '. JText::_( 'Edit' ) .' ]', 'generic.png' ); - JToolBarHelper::save( 'save' ); - JToolBarHelper::apply('apply'); - JToolBarHelper::cancel( 'cancel' ); - JToolBarHelper::help( 'screen.banners.client.edit' ); - } - - function client( &$row ) - { - BannersViewClients::setClientToolbar(); - JRequest::setVar( 'hidemainmenu', 1 ); - JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'extrainfo' ); - ?> - - -
- -
-
- - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
-
-
- -
-
- - - - - - -
- -
-
-
-
- - - - - - - -
- \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_cache/admin.cache.html.php b/administrator/components/com_cache/admin.cache.html.php deleted file mode 100644 index 18c62c8d845e6..0000000000000 --- a/administrator/components/com_cache/admin.cache.html.php +++ /dev/null @@ -1,106 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - " > - - - - - - - - -
- - - - - - - - - -
- getListFooter(); ?> -
- getRowOffset( $i ); ?> - - - - - group; ?> - - - count; ?> - - size ?> -
- - - - - - -
- authorize( 'com_cache', 'manage' )) { - $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); -} - -// Load the html output class and the model class -require_once (JApplicationHelper::getPath('admin_html')); -require_once (JApplicationHelper::getPath('class')); - -$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); - -/* - * This is our main control structure for the component - * - * Each view is determined by the $task variable - */ -switch ( JRequest::getVar( 'task' ) ) -{ - case 'delete': - CacheController::deleteCache($cid); - CacheController::showCache(); - break; - - default : - CacheController::showCache(); - break; -} - -/** - * Static class to hold controller functions for the Cache component - * - * @static - * @package Joomla - * @subpackage Weblinks - * @since 1.5 - */ -class CacheController -{ - /** - * Show the cache - * - * @since 1.5 - */ - function showCache() - { - global $mainframe, $option; - $submenu = JRequest::getVar('client', '0', '', 'int'); - $client =& JApplicationHelper::getClientInfo($submenu); - if ($submenu == 1) { - JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_cache&client=0'); - JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_cache&client=1', true); - } else { - JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_cache&client=0', true); - JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_cache&client=1'); - } - - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit')); - $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0 ); - - $cmData = new CacheData($client->path.DS.'cache'); - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $cmData->getGroupCount(), $limitstart, $limit ); - - CacheView::displayCache( $cmData->getRows( $limitstart, $limit ), $client, $pageNav ); - } - - function deleteCache($cid) - { - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - - $cmData = new CacheData($client->path.DS.'cache'); - $cmData->cleanCacheList( $cid ); - } -} \ No newline at end of file diff --git a/administrator/components/com_modules/admin.modules.php b/administrator/components/com_cache/cache.php similarity index 58% rename from administrator/components/com_modules/admin.modules.php rename to administrator/components/com_cache/cache.php index b1712d929ef90..05ef4ac9232c2 100644 --- a/administrator/components/com_modules/admin.modules.php +++ b/administrator/components/com_cache/cache.php @@ -1,34 +1,33 @@ -authorize( 'com_modules', 'manage' )) { - $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); -} - -// Require the base controller -require_once (JPATH_COMPONENT.DS.'controller.php'); - -// Create the controller -$controller = new ModulesController( array( 'default_task' => 'view' )); - -// Perform the Request task -$controller->execute( JRequest::getCmd('task', 'view') ); - -// Redirect if set by the controller -$controller->redirect(); +authorize( 'com_cache', 'manage' )) { + $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); +} + +// Require the base controller +require_once JPATH_COMPONENT.DS.'controller.php'; + +$controller = new CacheController(); + +// Perform the Request task +$controller->execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_cache/controller.php b/administrator/components/com_cache/controller.php new file mode 100644 index 0000000000000..90b833e0e505a --- /dev/null +++ b/administrator/components/com_cache/controller.php @@ -0,0 +1,44 @@ +getModel('cache'); + $model->setPath($client->path.DS.'cache'); + $model->cleanlist( $cid ); + + $this->display(); + } +} \ No newline at end of file diff --git a/administrator/components/com_cache/index.html b/administrator/components/com_cache/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_cache/index.html +++ b/administrator/components/com_cache/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_cache/cache.class.php b/administrator/components/com_cache/models/cache.php similarity index 55% rename from administrator/components/com_cache/cache.class.php rename to administrator/components/com_cache/models/cache.php index d20f119b66556..2e39c07a79365 100644 --- a/administrator/components/com_cache/cache.class.php +++ b/administrator/components/com_cache/models/cache.php @@ -1,6 +1,6 @@ getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit')); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0 ); + + $this->setPath($path); + } + + /** + * Method to set contacts item path + * + * @access public + * @param string + */ + function setPath($path) { $this->_path = $path; - $this->_parse(); + $this->_data = null; + } + + /** + * Method to get contacts item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $this->_parse(); + } + + return $this->_data; } /** @@ -56,7 +105,6 @@ function __construct( $path ) * in a group and stored in $this->items. * * @access private - * @param String $path */ function _parse() { @@ -68,12 +116,13 @@ function _parse() { $files = array(); $files = JFolder::files($this->_path.DS.$folder); - $this->_items[$folder] = new CacheItem( $folder ); + $item = new CacheItem( $folder ); foreach ($files as $file) { - $this->_items[$folder]->updateSize( filesize( $this->_path.DS.$folder.DS.$file )/ 1024 ); + $item->updateSize( filesize( $this->_path.DS.$folder.DS.$file )/ 1024 ); } + $this->_data[] = $item; } } @@ -83,36 +132,34 @@ function _parse() * @access public * @return int */ - function getGroupCount() + function getTotal() { - return count($this->_items); + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $this->getData(); + $this->_total = count($this->_data); + } + + return $this->_total; } /** - * Retrun an Array containing a sub set of the total - * number of Cache Groups as defined by the params. + * Method to get a pagination object for the cache * * @access public - * @param Int $start - * @param Int $limit - * @return Array + * @return integer */ - function getRows( $start, $limit ) + function getPagination() { - if ( (!is_array($this->_items)) || (count($this->_items) <= 0) ) { - return null; - } - - $i = 0; - $rows = null; - foreach ($this->_items as $item) + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) { - if ( (($i >= $start) && ($i < $start+$limit)) || ($limit == 0) ) { - $rows[] = $item; - } - $i++; + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); } - return $rows; + + return $this->_pagination; } /** @@ -121,16 +168,16 @@ function getRows( $start, $limit ) * * @param String $group */ - function cleanCache( $group='' ) + function clean( $group='' ) { $cache =& JFactory::getCache(); $cache->clean( $group ); } - function cleanCacheList( $array ) + function cleanlist( $array ) { foreach ($array as $group) { - $this->cleanCache( $group ); + $this->clean( $group ); } } } diff --git a/administrator/components/com_cache/models/index.html b/administrator/components/com_cache/models/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_cache/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_cache/toolbar.cache.html.php b/administrator/components/com_cache/toolbar.cache.html.php deleted file mode 100644 index 5d110cbc22ae3..0000000000000 --- a/administrator/components/com_cache/toolbar.cache.html.php +++ /dev/null @@ -1,33 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_cache/views/cache/tmpl/default.php b/administrator/components/com_cache/views/cache/tmpl/default.php new file mode 100644 index 0000000000000..8e0f01a5dd12a --- /dev/null +++ b/administrator/components/com_cache/views/cache/tmpl/default.php @@ -0,0 +1,69 @@ + + +
+ + + + + + + + + + + + + + + + + rows); $i < $n; $i ++) { + $row = & $this->rows[$i]; + ?> + + " > + + + + + + + + +
+ + + + + + + + + +
+ pagination->getListFooter(); ?> +
+ pagination->getRowOffset( $i ); ?> + + + + + group; ?> + + + count; ?> + + size ?> +
+ + + + + + +
diff --git a/administrator/components/com_cache/views/cache/tmpl/index.html b/administrator/components/com_cache/views/cache/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_cache/views/cache/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_cache/views/cache/view.html.php b/administrator/components/com_cache/views/cache/view.html.php new file mode 100644 index 0000000000000..0d71e33fd1286 --- /dev/null +++ b/administrator/components/com_cache/views/cache/view.html.php @@ -0,0 +1,68 @@ +path.DS.'cache'); + + // Set the model path + $model =& $this->getModel(); + $model->setPath($client->path.DS.'cache'); + + // Get data from the model + $rows = & $this->get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + + $this->assignRef('rows', $rows); + $this->assignRef('client', $client); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_cache/views/index.html b/administrator/components/com_cache/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_cache/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_categories/admin.categories.html.php b/administrator/components/com_categories/admin.categories.html.php deleted file mode 100644 index d173b6151a634..0000000000000 --- a/administrator/components/com_categories/admin.categories.html.php +++ /dev/null @@ -1,578 +0,0 @@ - -
- - - - - - -
- : - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->section ); - - $link = 'index.php?option=com_categories§ion='. $section .'&task=edit&cid[]='. $row->id .'&type='.$type; - - $access = JHTML::_('grid.access', $row, $i ); - $checked = JHTML::_('grid.checkedout', $row, $i ); - $published = JHTML::_('grid.published', $row, $i ); - ?> - "> - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- getListFooter(); ?> -
- getRowOffset( $i ); ?> - - - - - get ('id'), $row->checked_out ) ) { - echo $row->title; - } else { - ?> - - title; ?> - - - - - orderUpIcon( $i, ($row->section == @$rows[$i-1]->section), 'orderup', 'Move Up', $ordering ); ?> - orderDownIcon( $i, $n, ($row->section == @$rows[$i+1]->section), 'orderdown', 'Move Down', $ordering ); ?> - - class="text_area" style="text-align: center" /> - - - - - section_name; ?> - - active; ?> - - trash; ?> - - id; ?> -
- - - - - - - - - - - -
- image == '') { - $row->image = 'blank.png'; - } - - if ( $redirect == 'content' ) { - $component = 'Content'; - } else { - $component = ucfirst( substr( $redirect, 4 ) ); - if ( $redirect == 'com_contact_details' ) { - $component = 'Contact'; - } - } - - JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'description' ); - $cparams = JComponentHelper::getParams ('com_media'); - ?> - - -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- : - - -
- - - -
- - - -
- - - -
- - - -
- - - -
  - -
-
- -
- - - - - - -
- display( 'description', $row->description, '550', '300', '60', '20', array('pagebreak', 'readmore') ) ; - ?> -
-
-
-
- - - - - - - - -
- - - -
- -
- - - - - - - . - -
- : -
- -

-
- : -
- "; - foreach ( $items as $item ) { - echo "
  • ". $item->title ."
  • "; - } - echo ""; - ?> -
    - : -
    - "; - foreach ( $contents as $content ) { - echo "
  • ". $content->title ."
  • "; - } - echo ""; - ?> -
    - -
    - -
    - . -
    -

    - - - - - - - "; - } - ?> - -
    - - - -
    - -
    - - - - - - - . - -
    - : -
    - -

    -
    - : -
    - "; - foreach ( $items as $item ) { - echo "
  • ". $item->title ."
  • "; - } - echo ""; - ?> -
    - : -
    - "; - foreach ( $contents as $content ) { - echo "
  • ". $content->title ."
  • "; - echo "\n id\" />"; - } - echo ""; - ?> -
    - -
    - -
    - -
    - . -
    -

    - - - - - - - "; - } - ?> - -
    - getUserStateFromRequest( $option.'.filter_order', 'filter_order', 'c.ordering', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); - $filter_state = $mainframe->getUserStateFromRequest( $option.'.'.$section.'.filter_state', 'filter_state', '', 'word' ); - $sectionid = $mainframe->getUserStateFromRequest( $option.'.'.$section.'.sectionid', 'sectionid', 0, 'int' ); - $search = $mainframe->getUserStateFromRequest( $option.'.search', 'search', '', 'string' ); - $search = JString::strtolower( $search ); - - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); - $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); - - $section_name = ''; - $content_add = ''; - $content_join = ''; - $order = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', c.ordering'; - if (intval( $section ) > 0) { - $table = 'content'; - - $query = 'SELECT title' - . ' FROM #__sections' - . ' WHERE id = '.(int) $section; - $db->setQuery( $query ); - $section_name = $db->loadResult(); - $section_name = JText::sprintf( 'Content:', JText::_( $section_name ) ); - $where = ' WHERE c.section = '.$db->Quote($section); - $type = 'content'; - } else if (strpos( $section, 'com_' ) === 0) { - $table = substr( $section, 4 ); - - $query = 'SELECT name' - . ' FROM #__components' - . ' WHERE link = '.$db->Quote('option='.$section); - ; - $db->setQuery( $query ); - $section_name = $db->loadResult(); - $where = ' WHERE c.section = '.$db->Quote($section); - $type = 'other'; - // special handling for contact component - if ( $section == 'com_contact_details' ) { - $section_name = JText::_( 'Contact' ); - } - $section_name = JText::sprintf( 'Component:', $section_name ); - } else { - $table = $section; - $where = ' WHERE c.section = '.$db->Quote($section); - $type = 'other'; - } - - // get the total number of records - $query = 'SELECT COUNT(*)' - . ' FROM #__categories' - ; - if ($section == 'com_content') - { - $query .= ' WHERE section > 0'; - } else { - $query .= ' WHERE section = '.$db->quote($section); - } - $db->setQuery( $query ); - $total = $db->loadResult(); - - // allows for viweing of all content categories - if ( $section == 'com_content' ) { - $table = 'content'; - $content_add = ' , z.title AS section_name'; - $content_join = ' LEFT JOIN #__sections AS z ON z.id = c.section'; - $where = ' WHERE c.section NOT LIKE "%com_%"'; - if ($filter_order == 'c.ordering'){ - $order = ' ORDER BY z.title, c.ordering'; - } else { - $order = ' ORDER BY '.$filter_order.' '. $filter_order_Dir.', z.title, c.ordering'; - } - - $section_name = JText::_( 'All Content:' ); - - $type = 'content'; - } - - // used by filter - if ( $sectionid > 0 ) { - $filter = ' AND c.section = '.$db->Quote($sectionid); - } else { - $filter = ''; - } - if ( $filter_state ) { - if ( $filter_state == 'P' ) { - $filter .= ' AND c.published = 1'; - } else if ($filter_state == 'U' ) { - $filter .= ' AND c.published = 0'; - } - } - if ($search) { - $filter .= ' AND LOWER(c.title) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); - } - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $total, $limitstart, $limit ); - - $tablesAllowed = $db->getTableList(); - if (!in_array($db->getPrefix().$table, $tablesAllowed)) { - $table = 'content'; - } - - $query = 'SELECT c.*, c.checked_out as checked_out_contact_category, g.name AS groupname, u.name AS editor, COUNT( DISTINCT s2.checked_out ) AS checked_out_count' - . $content_add - . ' FROM #__categories AS c' - . ' LEFT JOIN #__users AS u ON u.id = c.checked_out' - . ' LEFT JOIN #__groups AS g ON g.id = c.access' - . ' LEFT JOIN #__'.$table.' AS s2 ON s2.catid = c.id AND s2.checked_out > 0' - . $content_join - . $where - . $filter - . ' AND c.published != -2' - . ' GROUP BY c.id' - . $order - ; - $db->setQuery( $query, $pageNav->limitstart, $pageNav->limit ); - $rows = $db->loadObjectList(); - if ($db->getErrorNum()) { - echo $db->stderr(); - return; - } - - $count = count( $rows ); - // number of Active Items - for ( $i = 0; $i < $count; $i++ ) { - $query = 'SELECT COUNT( a.id )' - . ' FROM #__content AS a' - . ' WHERE a.catid = '. (int) $rows[$i]->id - . ' AND a.state <> -2' - ; - $db->setQuery( $query ); - $active = $db->loadResult(); - $rows[$i]->active = $active; - } - // number of Trashed Items - for ( $i = 0; $i < $count; $i++ ) { - $query = 'SELECT COUNT( a.id )' - . ' FROM #__content AS a' - . ' WHERE a.catid = '. (int) $rows[$i]->id - . ' AND a.state = -2' - ; - $db->setQuery( $query ); - $trash = $db->loadResult(); - $rows[$i]->trash = $trash; - } - - // get list of sections for dropdown filter - $javascript = 'onchange="document.adminForm.submit();"'; - $lists['sectionid'] = JHTML::_('list.section', 'sectionid', $sectionid, $javascript ); - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - categories_html::show( $rows, $section, $section_name, $pageNav, $lists, $type ); -} - -/** -* Compiles information to add or edit a category -* @param string The name of the category section -* @param integer The unique id of the category to edit (0 if new) -* @param string The name of the current user -*/ -function editCategory($edit ) -{ - global $mainframe; - - // Initialize variables - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - $uid = $user->get('id'); - - $type = JRequest::getCmd( 'type' ); - $redirect = JRequest::getCmd( 'section', 'com_content' ); - $section = JRequest::getCmd( 'section', 'com_content' ); - $cid = JRequest::getVar( 'cid', array(0), '', 'array' ); - - JArrayHelper::toInteger($cid, array(0)); - - // check for existance of any sections - $query = 'SELECT COUNT( id )' - . ' FROM #__sections' - . ' WHERE scope = "content"' - ; - $db->setQuery( $query ); - $sections = $db->loadResult(); - if (!$sections && $type != 'other' - && $section != 'com_weblinks' - && $section != 'com_newsfeeds' - && $section != 'com_contact_details' - && $section != 'com_banner') { - $mainframe->redirect( 'index.php?option=com_categories§ion='. $section, JText::_( 'WARNSECTION', true ) ); - } - - $row =& JTable::getInstance('category'); - // load the row from the db table - if ($edit) - $row->load( $cid[0] ); - - // fail if checked out not by 'me' - if ( JTable::isCheckedOut($user->get ('id'), $row->checked_out )) { - $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The category' ), $row->title ); - $mainframe->redirect( 'index.php?option=com_categories§ion='. $row->section, $msg ); - } - - if ( $edit ) { - $row->checkout( $user->get('id')); - } else { - $row->published = 1; - } - - - // make order list - $order = array(); - $query = 'SELECT COUNT(*)' - . ' FROM #__categories' - . ' WHERE section = '.$db->Quote($row->section) - ; - $db->setQuery( $query ); - $max = intval( $db->loadResult() ) + 1; - - for ($i=1; $i < $max; $i++) { - $order[] = JHTML::_('select.option', $i ); - } - - // build the html select list for sections - if ( $section == 'com_content' ) { - - if (!$row->section && JRequest::getInt('sectionid')) { - $row->section = JRequest::getInt('sectionid'); - } - - $query = 'SELECT s.id AS value, s.title AS text' - . ' FROM #__sections AS s' - . ' ORDER BY s.ordering' - ; - $db->setQuery( $query ); - $sections = $db->loadObjectList(); - $lists['section'] = JHTML::_('select.genericlist', $sections, 'section', 'class="inputbox" size="1"', 'value', 'text', $row->section ); - } else { - if ( $type == 'other' ) { - $section_name = JText::_( 'N/A' ); - } else { - $temp =& JTable::getInstance('section'); - $temp->load( $row->section ); - $section_name = $temp->name; - } - if(!$section_name) $section_name = JText::_( 'N/A' ); - $row->section = $section; - $lists['section'] = ''. $section_name; - } - - // build the html select list for ordering - $query = 'SELECT ordering AS value, title AS text' - . ' FROM #__categories' - . ' WHERE section = '.$db->Quote($row->section) - . ' ORDER BY ordering' - ; - if ($edit) { - $lists['ordering'] = JHTML::_('list.specificordering', $row, $cid[0], $query ); - } - else { - $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query ); - } - // build the select list for the image positions - $active = ( $row->image_position ? $row->image_position : 'left' ); - $lists['image_position'] = JHTML::_('list.positions', 'image_position', $active, NULL, 0, 0 ); - // Imagelist - $lists['image'] = JHTML::_('list.images', 'image', $row->image ); - // build the html select list for the group access - $lists['access'] = JHTML::_('list.accesslevel', $row ); - // build the html radio buttons for published - $published = ($row->id) ? $row->published : 1; - $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $published ); - - categories_html::edit( $row, $lists, $redirect ); -} - -/** -* Saves the catefory after an edit form submit -* @param string The name of the category section -*/ -function saveCategory() -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - $menu = JRequest::getCmd( 'menu', 'mainmenu', 'post' ); - $menuid = JRequest::getVar( 'menuid', 0, 'post', 'int' ); - $redirect = JRequest::getCmd( 'redirect', '', 'post' ); - $oldtitle = JRequest::getString( 'oldtitle', '', 'post' ); - $post = JRequest::get( 'post' ); - - // fix up special html fields - $post['description'] = JRequest::getVar( 'description', '', 'post', 'string', JREQUEST_ALLOWRAW ); - - $row =& JTable::getInstance('category'); - if (!$row->bind( $post )) { - JError::raiseError(500, $row->getError() ); - } - if (!$row->check()) { - JError::raiseError(500, $row->getError() ); - } - // if new item order last in appropriate group - if (!$row->id) { - $where = "section = " . $db->Quote($row->section); - $row->ordering = $row->getNextOrder( $where ); - } - - if (!$row->store()) { - JError::raiseError(500, $row->getError() ); - } - $row->checkin(); - - if ($row->section > 0) { - $query = 'UPDATE #__content' - .' SET sectionid = '.$row->section - .' WHERE catid = '.$row->id - ; - $db->setQuery( $query ); - $db->query(); - } - - if ( $oldtitle ) { - if ($oldtitle != $row->title) { - $query = 'UPDATE #__menu' - . ' SET name = '.$db->Quote($row->title) - . ' WHERE name = '.$db->Quote($oldtitle) - . ' AND type = "content_category"' - ; - $db->setQuery( $query ); - $db->query(); - } - } - - // Update Section Count - if ($row->section != 'com_contact_details' && - $row->section != 'com_newsfeeds' && - $row->section != 'com_weblinks') { - $query = 'UPDATE #__sections SET count=count+1' - . ' WHERE id = '.$db->Quote($row->section) - ; - $db->setQuery( $query ); - } - - if (!$db->query()) { - JError::raiseError(500, $db->getErrorMsg() ); - } - - switch ( JRequest::getCmd('task') ) - { - case 'go2menu': - $mainframe->redirect( 'index.php?option=com_menus&menutype='. $menu ); - break; - - case 'go2menuitem': - $mainframe->redirect( 'index.php?option=com_menus&menutype='. $menu .'&task=edit&id='. $menuid ); - break; - - case 'apply': - $msg = JText::_( 'Changes to Category saved' ); - $mainframe->redirect( 'index.php?option=com_categories§ion='. $redirect .'&task=edit&cid[]='. $row->id, $msg ); - break; - - case 'save': - default: - $msg = JText::_( 'Category saved' ); - $mainframe->redirect( 'index.php?option=com_categories§ion='. $redirect, $msg ); - break; - } -} - -/** -* Deletes one or more categories from the categories table -* @param string The name of the category section -* @param array An array of unique category id numbers -*/ -function removeCategories( $section, $cid ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - - JArrayHelper::toInteger($cid); - - if (count( $cid ) < 1) { - JError::raiseError(500, JText::_( 'Select a category to delete', true )); - } - - $cids = implode( ',', $cid ); - - if (intval( $section ) > 0) { - $table = 'content'; - } else if (strpos( $section, 'com_' ) === 0) { - $table = substr( $section, 4 ); - } else { - $table = $section; - } - - $tablesAllowed = $db->getTableList(); - if (!in_array($db->getPrefix().$table, $tablesAllowed)) { - $table = 'content'; - } - - $query = 'SELECT c.id, c.name, c.title, COUNT( s.catid ) AS numcat' - . ' FROM #__categories AS c' - . ' LEFT JOIN #__'.$table.' AS s ON s.catid = c.id' - . ' WHERE c.id IN ( '.$cids.' )' - . ' GROUP BY c.id' - ; - $db->setQuery( $query ); - - if (!($rows = $db->loadObjectList())) { - JError::raiseError( 500, $db->stderr() ); - return false; - } - - $err = array(); - $cid = array(); - foreach ($rows as $row) { - if ($row->numcat == 0) { - $cid[] = (int) $row->id; - } else { - $err[] = $row->title; - } - } - - if (count( $cid )) { - $cids = implode( ',', $cid ); - $query = 'DELETE FROM #__categories' - . ' WHERE id IN ( '.$cids.' )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - JError::raiseError( 500, $db->stderr() ); - return false; - } - } - - if (count( $err )) { - $cids = implode( ", ", $err ); - $msg = JText::sprintf( 'WARNNOTREMOVEDRECORDS', $cids ); - $mainframe->redirect( 'index.php?option=com_categories§ion='. $section, $msg ); - } - - $mainframe->redirect( 'index.php?option=com_categories§ion='. $section ); -} - -/** -* Publishes or Unpublishes one or more categories -* @param string The name of the category section -* @param integer A unique category id (passed from an edit form) -* @param array An array of unique category id numbers -* @param integer 0 if unpublishing, 1 if publishing -* @param string The name of the current user -*/ -function publishCategories( $section, $cid=null, $publish=1 ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - $uid = $user->get('id'); - - JArrayHelper::toInteger($cid); - - if (count( $cid ) < 1) { - $action = $publish ? 'publish' : 'unpublish'; - JError::raiseError(500, JText::_( 'Select a category to '.$action, true ) ); - } - - $cids = implode( ',', $cid ); - - $query = 'UPDATE #__categories' - . ' SET published = ' . (int) $publish - . ' WHERE id IN ( '.$cids.' )' - . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $uid.' ) )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - JError::raiseError(500, $db->getErrorMsg() ); - } - - if (count( $cid ) == 1) { - $row =& JTable::getInstance('category'); - $row->checkin( $cid[0] ); - } - - $mainframe->redirect( 'index.php?option=com_categories§ion='. $section ); -} - -/** -* Cancels an edit operation -* @param string The name of the category section -* @param integer A unique category id -*/ -function cancelCategory() -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - - $redirect = JRequest::getCmd( 'redirect', '', 'post' ); - - $row =& JTable::getInstance('category'); - $row->bind( JRequest::get( 'post' )); - $row->checkin(); - - $mainframe->redirect( 'index.php?option=com_categories§ion='. $redirect ); -} - -/** -* Moves the order of a record -* @param integer The increment to reorder by -*/ -function orderCategory( $uid, $inc ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - $row =& JTable::getInstance('category' ); - $row->load( $uid ); - $row->move( $inc, 'section = '.$db->Quote($row->section) ); - $section = JRequest::getCmd('section'); - if($section) { - $section = '§ion='. $section; - } - $mainframe->redirect( 'index.php?option=com_categories'. $section ); -} - -/** -* Form for moving item(s) to a specific menu -*/ -function moveCategorySelect( $option, $cid, $sectionOld ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $redirect = JRequest::getCmd( 'section', 'com_content', 'post' ); - - JArrayHelper::toInteger($cid); - - if (count( $cid ) < 1) { - JError::raiseError(500, JText::_( 'Select an item to move', true )); - } - - ## query to list selected categories - $cids = implode( ',', $cid ); - $query = 'SELECT a.title, a.section' - . ' FROM #__categories AS a' - . ' WHERE a.id IN ( '.$cids.' )' - ; - $db->setQuery( $query ); - $items = $db->loadObjectList(); - - ## query to list items from categories - $query = 'SELECT a.title' - . ' FROM #__content AS a' - . ' WHERE a.catid IN ( '.$cids.' )' - . ' ORDER BY a.catid, a.title' - ; - $db->setQuery( $query ); - $contents = $db->loadObjectList(); - - ## query to choose section to move to - $query = 'SELECT a.title AS text, a.id AS value' - . ' FROM #__sections AS a' - . ' WHERE a.published = 1' - . ' ORDER BY a.title' - ; - $db->setQuery( $query ); - $sections = $db->loadObjectList(); - - // build the html select list - $SectionList = JHTML::_('select.genericlist', $sections, 'sectionmove', 'class="inputbox" size="10"', 'value', 'text', null ); - - categories_html::moveCategorySelect( $option, $cid, $SectionList, $items, $sectionOld, $contents, $redirect ); -} - - -/** -* Save the item(s) to the menu selected -*/ -function moveCategorySave( $cid, $sectionOld ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $sectionMove = JRequest::getCmd( 'sectionmove' ); - - //Check to see of a section was selected to copy the items too - if (!$sectionMove) - { - $msg = JText::_('Please select a section from the list'); - moveCategorySelect( 'com_categories', $cid, $sectionOld ); - JError::raiseWarning(500, $msg); - return; - } - - JArrayHelper::toInteger($cid, array(0)); - - $sectionNew =& JTable::getInstance('section'); - $sectionNew->load( $sectionMove ); - - //Remove the categories was in destination section - $cids = implode( ',', $cid ); - - $query = 'SELECT id, title' - . ' FROM #__categories' - . ' WHERE id IN ( '.$cids.' )' - . ' AND section = '.$db->Quote($sectionMove) - ; - $db->setQuery( $query ); - - $scid = $db->loadResultArray(0); - $title = $db->loadResultArray(1); - - $cid = array_diff($cid, $scid); - - // - if ( !empty($cid) ) { - $cids = implode( ',', $cid ); - $total = count( $cid ); - - $query = 'UPDATE #__categories' - . ' SET section = '.$db->Quote($sectionMove) - . ' WHERE id IN ( '.$cids.' )' - ; - $db->setQuery( $query ); - if ( !$db->query() ) { - JError::raiseError(500, $db->getErrorMsg() ); - } - $query = 'UPDATE #__content' - . ' SET sectionid = '.$db->Quote($sectionMove) - . ' WHERE catid IN ( '.$cids.' )' - ; - $db->setQuery( $query ); - if ( !$db->query() ) { - JError::raiseError(500, $db->getErrorMsg()); - } - - $msg = JText::sprintf( 'Categories moved to', $sectionNew->title ); - $mainframe->enqueueMessage($msg); - } - if ( !empty($title) && is_array($title) ) { - if ( count($title) == 1 ) { - $msg = JText::sprintf( 'Category already in', implode( ', ', $title ), $sectionNew->title ); - } else { - $msg = JText::sprintf( 'Categories already in', implode( ', ', $title ), $sectionNew->title ); - } - $mainframe->enqueueMessage($msg); - } - - $mainframe->redirect( 'index.php?option=com_categories§ion='. $sectionOld ); -} - -/** -* Form for copying item(s) to a specific menu -*/ -function copyCategorySelect( $option, $cid, $sectionOld ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $redirect = JRequest::getCmd( 'section', 'com_content', 'post' ); - - JArrayHelper::toInteger($cid); - - if (count( $cid ) < 1) { - JError::raiseError(500, JText::_( 'Select an item to move', true )); - } - - ## query to list selected categories - $cids = implode( ',', $cid ); - $query = 'SELECT a.title, a.section' - . ' FROM #__categories AS a' - . ' WHERE a.id IN ( '.$cids.' )' - ; - $db->setQuery( $query ); - $items = $db->loadObjectList(); - - ## query to list items from categories - $query = 'SELECT a.title, a.id' - . ' FROM #__content AS a' - . ' WHERE a.catid IN ( '.$cids.' )' - . ' ORDER BY a.catid, a.title' - ; - $db->setQuery( $query ); - $contents = $db->loadObjectList(); - - ## query to choose section to move to - $query = 'SELECT a.title AS `text`, a.id AS `value`' - . ' FROM #__sections AS a' - . ' WHERE a.published = 1' - . ' ORDER BY a.name' - ; - $db->setQuery( $query ); - $sections = $db->loadObjectList(); - - // build the html select list - $SectionList = JHTML::_('select.genericlist', $sections, 'sectionmove', 'class="inputbox" size="10"', 'value', 'text', null ); - - categories_html::copyCategorySelect( $option, $cid, $SectionList, $items, $sectionOld, $contents, $redirect ); -} - - -/** -* Save the item(s) to the menu selected -*/ -function copyCategorySave( $cid, $sectionOld ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - - $sectionMove = JRequest::getInt( 'sectionmove' ); - - //Check to see of a section was selected to copy the items too - if (!$sectionMove) - { - $msg = JText::_('Please select a section from the list'); - copyCategorySelect( 'com_categories', $cid, $sectionOld ); - JError::raiseWarning(500, $msg); - return; - } - - $contentid = JRequest::getVar( 'item', null, '', 'array' ); - JArrayHelper::toInteger($contentid); - - $category =& JTable::getInstance('category'); - - foreach( $cid as $id ) - { - $category->load( $id ); - $category->id = NULL; - $category->title = JText::sprintf( 'Copy of', $category->title ); - $category->name = JText::sprintf( 'Copy of', $category->name ); - $category->section = $sectionMove; - if (!$category->check()) { - JError::raiseError(500, $category->getError()); - } - - if (!$category->store()) { - JError::raiseError(500, $category->getError()); - } - $category->checkin(); - // stores original catid - $newcatids[]["old"] = $id; - // pulls new catid - $newcatids[]["new"] = $category->id; - } - - $content =& JTable::getInstance('content'); - foreach( $contentid as $id) { - $content->load( $id ); - $content->id = NULL; - $content->sectionid = $sectionMove; - $content->hits = 0; - foreach( $newcatids as $newcatid ) { - if ( $content->catid == $newcatid["old"] ) { - $content->catid = $newcatid["new"]; - } - } - if (!$content->check()) { - JError::raiseError(500, $content->getError()); - } - - if (!$content->store()) { - JError::raiseError(500, $content->getError()); - } - $content->checkin(); - } - - $sectionNew =& JTable::getInstance('section'); - $sectionNew->load( $sectionMove ); - - $msg = JText::sprintf( 'Categories copied to', count($cid), $sectionNew->title ); - $mainframe->redirect( 'index.php?option=com_categories§ion='. $sectionOld, $msg ); -} - -/** -* changes the access level of a record -* @param integer The increment to reorder by -*/ -function accessMenu( $uid, $access, $section ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - - $row =& JTable::getInstance('category'); - $row->load( $uid ); - $row->access = $access; - - if ( !$row->check() ) { - return $row->getError(); - } - if ( !$row->store() ) { - return $row->getError(); - } - - $mainframe->redirect( 'index.php?option=com_categories§ion='. $section ); -} - -function saveOrder( &$cid, $section ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - - $total = count( $cid ); - $order = JRequest::getVar( 'order', array(0), 'post', 'array' ); - JArrayHelper::toInteger($order, array(0)); - $row =& JTable::getInstance('category'); - $groupings = array(); - - // update ordering values - for( $i=0; $i < $total; $i++ ) { - $row->load( (int) $cid[$i] ); - // track sections - $groupings[] = $row->section; - if ($row->ordering != $order[$i]) { - $row->ordering = $order[$i]; - if (!$row->store()) { - //TODO - convert to JError - JError::raiseError(500, $db->getErrorMsg()); - } - } - } - - // execute updateOrder for each parent group - $groupings = array_unique( $groupings ); - foreach ($groupings as $group){ - $row->reorder('section = '.$db->Quote($group)); - } - - $msg = JText::_( 'New ordering saved' ); - $mainframe->redirect( 'index.php?option=com_categories§ion='. $section, $msg ); -} \ No newline at end of file diff --git a/administrator/components/com_categories/categories.php b/administrator/components/com_categories/categories.php new file mode 100644 index 0000000000000..c84b529e20da1 --- /dev/null +++ b/administrator/components/com_categories/categories.php @@ -0,0 +1,25 @@ +execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_categories/categories.xml b/administrator/components/com_categories/categories.xml new file mode 100644 index 0000000000000..6036d3118383e --- /dev/null +++ b/administrator/components/com_categories/categories.xml @@ -0,0 +1,12 @@ + + + Categories + Joomla! Project + December 2007 + (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + This component manages sections + diff --git a/administrator/components/com_categories/config.xml b/administrator/components/com_categories/config.xml new file mode 100644 index 0000000000000..49c8e10f7a663 --- /dev/null +++ b/administrator/components/com_categories/config.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/administrator/components/com_categories/controller.php b/administrator/components/com_categories/controller.php new file mode 100644 index 0000000000000..63698132c46b0 --- /dev/null +++ b/administrator/components/com_categories/controller.php @@ -0,0 +1,546 @@ +registerTask( 'add', 'display' ); + $this->registerTask( 'edit', 'display' ); + $this->registerTask( 'copyselect', 'display' ); + $this->registerTask( 'moveselect', 'display' ); + $this->registerTask( 'apply', 'save' ); + $this->registerTask( 'go2menu', 'save' ); + $this->registerTask( 'go2menuitem', 'save' ); + } + + function display( ) + { + switch($this->getTask()) + { + case 'add': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'category'); + JRequest::setVar( 'edit', false ); + + // Checkout the section + $model = $this->getModel('category'); + $model->checkout(); + } break; + case 'edit': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'category'); + JRequest::setVar( 'edit', true ); + + // Checkout the section + $model = $this->getModel('category'); + $model->checkout(); + } break; + case 'copyselect': + case 'moveselect': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'copyselect'); + } break; + } + + parent::display(); + } + + function save() + { + global $mainframe, $option; + + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $db =& JFactory::getDBO(); + $menu = JRequest::getVar( 'menu', 'mainmenu', 'post', 'string' ); + $menuid = JRequest::getVar( 'menuid', 0, 'post', 'int' ); + $oldtitle = JRequest::getVar( 'oldtitle', '', '', 'post', 'string' ); + $task = JRequest::getVar( 'task', '', '', 'post', 'string' ); + $redirect = JRequest::getCmd( 'redirect', '', 'post' ); + + $post = JRequest::get('post'); + + // fix up special html fields + $post['description'] = JRequest::getVar( 'description', '', 'post', 'string', JREQUEST_ALLOWRAW ); + + $row =& JTable::getInstance('category'); + if (!$row->bind($post)) { + JError::raiseError(500, $row->getError() ); + } + if (!$row->check()) { + JError::raiseError(500, $row->getError() ); + } + if ( $oldtitle ) { + if ( $oldtitle <> $row->title ) { + $query = 'UPDATE #__menu' + . ' SET name = '.$db->Quote($row->title) + . ' WHERE name = '.$db->Quote($oldtitle) + . ' AND type = "content_category"' + ; + $db->setQuery( $query ); + $db->query(); + } + } + + // if new item order last in appropriate group + if (!$row->id) { + $row->ordering = $row->getNextOrder(); + } + + if (!$row->store()) { + JError::raiseError(500, $row->getError() ); + } + $row->checkin(); + + // Update Section Count + if ($row->section != 'com_contact_details' && + $row->section != 'com_newsfeeds' && + $row->section != 'com_weblinks') { + $query = 'UPDATE #__sections SET count=count+1' + . ' WHERE id = '.$db->Quote($row->section) + ; + $db->setQuery( $query ); + } + + if (!$db->query()) { + JError::raiseError(500, $db->getErrorMsg() ); + } + + switch ( $task ) + { + case 'go2menu': + $mainframe->redirect( 'index.php?option=com_menus&menutype='. $menu ); + break; + + case 'go2menuitem': + $mainframe->redirect( 'index.php?option=com_menus&menutype='. $menu .'&task=edit&id='. $menuid ); + break; + + case 'apply': + $msg = JText::_( 'Changes to Category saved' ); + $mainframe->redirect( 'index.php?option=com_categories§ion='. $redirect .'&task=edit&cid[]='. $row->id, $msg ); + break; + + case 'save': + default: + $msg = JText::_( 'Category saved' ); + $mainframe->redirect( 'index.php?option=com_categories§ion='. $redirect, $msg ); + break; + } + } + + function copysave() + { + global $mainframe; + + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + // Initialize variables + $db =& JFactory::getDBO(); + + $sectionMove = JRequest::getInt( 'sectionmove' ); + $sectionOld = JRequest::getCmd( 'section', 'com_content', 'post' ); + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + + //Check to see if a section was selected to copy the items too + if (!$sectionMove) + { + $msg = JText::_('Please select a section from the list'); + $this->setRedirect( 'index.php?option=com_categories&task=copyselect§ion='. $sectionOld . '&cid[]='. $cid, $msg ); + return; + } + + $contentid = JRequest::getVar( 'item', null, '', 'array' ); + JArrayHelper::toInteger($contentid); + + $category =& JTable::getInstance('category'); + + foreach( $cid as $id ) + { + $category->load( $id ); + $category->id = NULL; + $category->title = JText::sprintf( 'Copy of', $category->title ); + $category->name = JText::sprintf( 'Copy of', $category->name ); + $category->section = $sectionMove; + if (!$category->check()) { + JError::raiseError(500, $category->getError()); + } + + if (!$category->store()) { + JError::raiseError(500, $category->getError()); + } + $category->checkin(); + // stores original catid + $newcatids[]["old"] = $id; + // pulls new catid + $newcatids[]["new"] = $category->id; + } + + $content =& JTable::getInstance('content'); + foreach( $contentid as $id) { + $content->load( $id ); + $content->id = NULL; + $content->sectionid = $sectionMove; + $content->title = JText::sprintf( 'Copy of', $content->title ); + $content->hits = 0; + foreach( $newcatids as $newcatid ) { + if ( $content->catid == $newcatid["old"] ) { + $content->catid = $newcatid["new"]; + } + } + if (!$content->check()) { + JError::raiseError(500, $content->getError()); + } + + if (!$content->store()) { + JError::raiseError(500, $content->getError()); + } + $content->checkin(); + } + + $sectionNew =& JTable::getInstance('section'); + $sectionNew->load( $sectionMove ); + + $msg = JText::sprintf( 'Categories copied to', count($cid), $sectionNew->title ); + $this->setRedirect( 'index.php?option=com_categories§ion='. $sectionOld, $msg ); + } + + function movesave() + { + global $mainframe; + + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $db =& JFactory::getDBO(); + $sectionMove = JRequest::getCmd( 'sectionmove' ); + $sectionOld = JRequest::getCmd( 'section', 'com_content', 'post' ); + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + + //Check to see of a section was selected to copy the items too + if (!$sectionMove) + { + $msg = JText::_('Please select a section from the list'); + $this->setRedirect( 'index.php?option=com_categories&task=moveselect§ion='. $sectionOld . '&cid[]='. $cid, $msg ); + return; + } + + JArrayHelper::toInteger($cid, array(0)); + + $sectionNew =& JTable::getInstance('section'); + $sectionNew->load( $sectionMove ); + + //Remove the categories was in destination section + $cids = implode( ',', $cid ); + + $query = 'SELECT id, title' + . ' FROM #__categories' + . ' WHERE id IN ( '.$cids.' )' + . ' AND section = '.$db->Quote($sectionMove) + ; + $db->setQuery( $query ); + + $scid = $db->loadResultArray(0); + $title = $db->loadResultArray(1); + + $cid = array_diff($cid, $scid); + + if ( !empty($cid) ) { + $cids = implode( ',', $cid ); + $total = count( $cid ); + + $query = 'UPDATE #__categories' + . ' SET section = '.$db->Quote($sectionMove) + . ' WHERE id IN ( '.$cids.' )' + ; + $db->setQuery( $query ); + if ( !$db->query() ) { + JError::raiseError(500, $db->getErrorMsg() ); + } + $query = 'UPDATE #__content' + . ' SET sectionid = '.$db->Quote($sectionMove) + . ' WHERE catid IN ( '.$cids.' )' + ; + $db->setQuery( $query ); + if ( !$db->query() ) { + JError::raiseError(500, $db->getErrorMsg()); + } + + $msg = JText::sprintf( 'Categories moved to', $sectionNew->title ); + } + if ( !empty($title) && is_array($title) ) { + if ( count($title) == 1 ) { + $msg = JText::sprintf( 'Category already in', implode( ',', $title ), $sectionNew->title ); + } else { + $msg = JText::sprintf( 'Categories already in', implode( ',', $title ), $sectionNew->title ); + } + } + + $this->setRedirect( 'index.php?option=com_categories§ion='. $sectionOld, $msg ); + } + + function remove() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $db =& JFactory::getDBO(); + $section = JRequest::getCmd( 'section', 'com_content' ); + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select a section to delete', true ) ); + } + + $cids = implode( ',', $cid ); + + if (intval( $section ) > 0) { + $table = 'content'; + } else if (strpos( $section, 'com_' ) === 0) { + $table = substr( $section, 4 ); + } else { + $table = $section; + } + + $tablesAllowed = $db->getTableList(); + if (!in_array($db->getPrefix().$table, $tablesAllowed)) { + $table = 'content'; + } + + $query = 'SELECT c.id, c.name, c.title, COUNT( s.catid ) AS numcat' + . ' FROM #__categories AS c' + . ' LEFT JOIN #__'.$table.' AS s ON s.catid = c.id' + . ' WHERE c.id IN ( '.$cids.' )' + . ' GROUP BY c.id' + ; + $db->setQuery( $query ); + + if (!($rows = $db->loadObjectList())) { + JError::raiseError( 500, $db->stderr() ); + return false; + } + + $err = array(); + $names = array(); + $cid = array(); + foreach ($rows as $row) { + if ($row->numcat == 0) { + $cid[] = (int) $row->id; + $name[] = $row->name; + } else { + $err[] = $row->name; + } + } + + if (count( $cid )) + { + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__categories' + . ' WHERE id IN ( '.$cids.' )' + ; + $db->setQuery( $query ); + if (!$db->query()) { + JError::raiseError( 500, $db->stderr() ); + return false; + } + } + + if (count( $err )) + { + $cids = implode( ", ", $err ); + $msg = JText::sprintf( 'WARNNOTREMOVEDRECORDS', $cids ); + } + else + { + $names = implode( ', ', $name ); + $msg = JText::sprintf( 'Categories successfully deleted', $names ); + } + $this->setRedirect( 'index.php?option=com_categories§ion='.$section, $msg ); + } + + + function publish() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to publish' ) ); + } + + $model = $this->getModel('category'); + if(!$model->publish($cid, 1)) { + echo "\n"; + } + + $section = JRequest::getCmd( 'section' ); + $this->setRedirect( 'index.php?option=com_categories§ion='.$section ); + } + + + function unpublish() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to unpublish' ) ); + } + + $model = $this->getModel('category'); + if(!$model->publish($cid, 0)) { + echo "\n"; + } + + $section = JRequest::getCmd( 'section' ); + $this->setRedirect( 'index.php?option=com_categories§ion='.$section ); + } + + function cancel() + { + // Checkin the section + $model = $this->getModel('category'); + $model->checkin(); + + $redirect = JRequest::getCmd( 'redirect', '', 'post' ); + + $this->setRedirect( 'index.php?option=com_categories§ion='. $redirect ); + } + + + function orderup() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $model = $this->getModel('category'); + $model->move(-1); + + $section = JRequest::getCmd( 'section', 'com_content' ); + $this->setRedirect( 'index.php?option=com_categories§ion='.$section ); + } + + function orderdown() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $model = $this->getModel('category'); + $model->move(1); + + $section = JRequest::getCmd( 'section', 'com_content' ); + $this->setRedirect( 'index.php?option=com_categories§ion='.$section ); + } + + function saveorder() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + $order = JRequest::getVar( 'order', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + JArrayHelper::toInteger($order); + + $model = $this->getModel('category'); + $model->saveorder($cid, $order); + + $msg = 'New ordering saved'; + $section = JRequest::getCmd( 'section', 'com_content' ); + $this->setRedirect( 'index.php?option=com_categories§ion='.$section, $msg ); + } + + function accesspublic() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('category'); + if(!$model->setAccess($cid, 0)) { + $msg = $model->getError(); + } + + $section = JRequest::getCmd( 'section', 'com_content' ); + $this->setRedirect( 'index.php?option=com_categories§ion='.$section, $msg ); + } + + function accessregistered() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('category'); + if(!$model->setAccess($cid, 1)) { + $msg = $model->getError(); + } + + $section = JRequest::getCmd( 'section', 'com_content' ); + $this->setRedirect( 'index.php?option=com_categories§ion='.$section, $msg ); + } + + function accessspecial() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('category'); + if(!$model->setAccess($cid, 2)) { + $msg = $model->getError(); + } + + $section = JRequest::getCmd( 'section', 'com_content' ); + $this->setRedirect( 'index.php?option=com_categories§ion='.$section, $msg ); + } +} \ No newline at end of file diff --git a/administrator/components/com_categories/index.html b/administrator/components/com_categories/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_categories/index.html +++ b/administrator/components/com_categories/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_categories/models/categories.php b/administrator/components/com_categories/models/categories.php new file mode 100644 index 0000000000000..ee67336c61004 --- /dev/null +++ b/administrator/components/com_categories/models/categories.php @@ -0,0 +1,354 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'c.ordering', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter->search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $filter->section = JRequest::getCmd( 'section', 'com_content' ); + $filter->sectionid = $mainframe->getUserStateFromRequest( $option.'.'.$filter->section.'.sectionid', 'sectionid', 0, 'int' ); + $this->_filter = $filter; + } + + /** + * Method to get Categories item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + $this->getCategoryTotals(); + } + + return $this->_data; + } + + /** + * Method to get the total number of section items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get the section totals + * + * @access public + */ + function getCategoryTotals() + { + $db =& JFactory::getDBO(); + + $count = count( $this->_data ); + // number of Active Items + for ( $i = 0; $i < $count; $i++ ) { + $query = 'SELECT COUNT( a.id )' + . ' FROM #__content AS a' + . ' WHERE a.catid = '.(int) $this->_data[$i]->id + . ' AND a.state <> -2' + ; + $db->setQuery( $query ); + $active = $db->loadResult(); + $this->_data[$i]->active = $active; + } + // number of Trashed Items + for ( $i = 0; $i < $count; $i++ ) { + $query = 'SELECT COUNT( a.id )' + . ' FROM #__content AS a' + . ' WHERE a.catid = '.(int) $this->_data[$i]->id + . ' AND a.state = -2' + ; + $db->setQuery( $query ); + $trash = $db->loadResult(); + $this->_data[$i]->trash = $trash; + } + } + + /** + * Method to get a pagination object for the Categories + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the categories + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + /** + * Method to get the Categories type + * + * @access public + * @return string + */ + function getType() + { + // Lets load the content if it doesn't already exist + if (empty($this->type)) + { + $query = $this->_buildQuery(); + } + + return $this->type; + } + + /** + * Method to get the Categories Section Name + * + * @access public + * @return string + */ + function getSectionName() + { + // Lets load the content if it doesn't already exist + if (empty($this->section_name)) + { + $query = $this->_buildQuery(); + } + + return $this->section_name; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere($this->_filter->section); + $orderby = $this->_buildContentOrderBy($this->_filter->section); + + $query = 'SELECT c.*, c.checked_out as checked_out_contact_category, g.name AS groupname, u.name AS editor, COUNT( DISTINCT s2.checked_out ) AS checked_out_count' + . $this->content_add + . ' FROM #__categories AS c' + . ' LEFT JOIN #__users AS u ON u.id = c.checked_out' + . ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = c.access' + . ' LEFT JOIN #__'.$this->table.' AS s2 ON s2.catid = c.id AND s2.checked_out > 0' + . $this->content_join + . $where + . ' AND c.published != -2' + . ' GROUP BY c.id' + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy($section) + { + if ( $section == 'com_content' ) { + if ($this->_filter->order == 'c.ordering'){ + $orderby = ' ORDER BY z.title, c.ordering'; + } else { + $orderby = ' ORDER BY '.$this->_filter->order.' '. $this->_filter->order_Dir.', z.title, c.ordering'; + } + } + else + { + if ($this->_filter->order == 'c.ordering'){ + $orderby = ' ORDER BY c.ordering '.$this->_filter->order_Dir; + } else { + $orderby = ' ORDER BY '.$this->_filter->order.' '.$this->_filter->order_Dir.' , c.ordering '; + } + } + + return $orderby; + } + + function _buildContentWhere($section) + { + global $mainframe, $option; + + $db =& JFactory::getDBO(); + $search = JString::strtolower( $this->_filter->search ); + + $where = array(); + + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + + $this->section_name = ''; + $this->content_add = ''; + $this->content_join = ''; + if (intval( $section ) > 0) { + $this->table = 'content'; + + $query = 'SELECT title' + . ' FROM #__sections' + . ' WHERE id = '.(int) $section; + $db->setQuery( $query ); + $this->section_name = $db->loadResult(); + $this->section_name = JText::sprintf( 'Content:', JText::_( $this->section_name ) ); + $where = ' WHERE c.section = '.$db->Quote($section); + $this->type = 'content'; + } else if (strpos( $section, 'com_' ) === 0) { + $this->table = substr( $section, 4 ); + + $query = 'SELECT name' + . ' FROM #__components' + . ' WHERE link = '.$db->Quote('option='.$section); + ; + $db->setQuery( $query ); + $this->section_name = $db->loadResult(); + + $where = ' WHERE c.section = '.$db->Quote($section); + $this->type = 'other'; + // special handling for contact component + if ( $section == 'com_contact_details' ) { + $this->section_name = JText::_( 'Contact' ); + } + $this->section_name = JText::sprintf( 'Component:', $this->section_name ); + + } else { + $this->table = $section; + $where = ' WHERE c.section = '.$db->Quote($section); + $this->type = 'other'; + } + + // allows for viweing of all content categories + if ( $section == 'com_content' ) { + $this->table = 'content'; + $this->content_add = ' , z.title AS section_name'; + $this->content_join = ' LEFT JOIN #__sections AS z ON z.id = c.section'; + $where = ' WHERE c.section NOT LIKE "%com_%"'; + + $this->section_name = JText::_( 'All Content:' ); + + $this->type = 'content'; + } + + // used by filter + if ( $this->_filter->sectionid > 0 ) { + $filter = ' AND c.section = '.$db->Quote($this->_filter->sectionid); + } else { + $filter = ''; + } + + if ( $this->_filter->state ) { + if ( $this->_filter->state == 'P' ) { + $filter .= ' AND c.published = 1'; + } else if ($this->_filter->state == 'U' ) { + $filter .= ' AND c.published = 0'; + } + } + if ($search) { + $filter .= ' AND LOWER(c.title) LIKE '.$this->_db->Quote('%'.$this->_db->getEscaped( $search, true ).'%'); + } + + $tablesAllowed = $db->getTableList(); + if (!in_array($db->getPrefix().$this->table, $tablesAllowed)) { + $this->table = 'content'; + } + + return $where . $filter; + } +} diff --git a/administrator/components/com_categories/models/category.php b/administrator/components/com_categories/models/category.php new file mode 100644 index 0000000000000..239e2101b4b0a --- /dev/null +++ b/administrator/components/com_categories/models/category.php @@ -0,0 +1,399 @@ +setId((int)$array[0]); + } + + /** + * Method to set the category identifier + * + * @access public + * @param int Category identifier + */ + function setId($id) + { + // Set category id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a category + * + * @since 1.5 + */ + function &getData() + { + // Load the category data + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Tests if category is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.5 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_loadData()) + { + if ($uid) { + return ($this->_data->checked_out && $this->_data->checked_out != $uid); + } else { + return $this->_data->checked_out; + } + } + } + + /** + * Method to checkin/unlock the category + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function checkin() + { + if ($this->_id) + { + $category = & $this->getTable(); + if(! $category->checkin($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return true; + } + return false; + } + + /** + * Method to checkout/lock the category + * + * @access public + * @param int $uid User ID of the user checking the category out + * @return boolean True on success + * @since 1.5 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the category with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $category = & $this->getTable(); + if(!$category->checkout($uid, $this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return true; + } + return false; + } + + /** + * Method to store the category + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function store($data) + { + $row =& $this->getTable(); + + // Bind the form fields to the web link table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // if new item, order last in appropriate group + if (!$row->id) { + $where = '1 = 1'; + $row->ordering = $row->getNextOrder( $where ); + } + + // Make sure the web link table is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the web link table to the database + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to remove a category + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__categories' + . ' WHERE id IN ( '.$cids.' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to (un)publish a category + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function publish($cid = array(), $publish = 1) + { + $user =& JFactory::getUser(); + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__categories' + . ' SET published = '.(int) $publish + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to move a category + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function move($direction) + { + $row =& $this->getTable(); + if (!$row->load($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if (!$row->move( $direction, ' published >= 0 ' )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to move a category + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function saveorder($cid = array(), $order) + { + $row =& $this->getTable(); + $groupings = array(); + + // update ordering values + for( $i=0; $i < count($cid); $i++ ) + { + $row->load( (int) $cid[$i] ); + // track sections + $groupings[] = $row->section; + if ($row->ordering != $order[$i]) { + $row->ordering = $order[$i]; + if (!$row->store()) { + JError::raiseError(500, $db->getErrorMsg()); + } + } + } + + // execute updateOrder for each parent group + $groupings = array_unique( $groupings ); + foreach ($groupings as $group){ + $row->reorder('section = '.$this->_db->Quote($group)); + } + + return true; + } + + /** + * Method to load category data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = 'SELECT s.* '. + ' FROM #__categories AS s' . + ' WHERE s.id = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the category data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $category = new stdClass(); + $category->id = 0; + $category->parent_id = 0; + $category->name = null; + $category->alias = null; + $category->title = null; + $category->image = null; + $category->image_position = null; + $category->section = null; + $category->description = null; + $category->count = 0; + $category->params = null; + $category->published = 0; + $category->checked_out = 0; + $category->checked_out_time = 0; + $category->ordering = 0; + $category->archived = 0; + $category->approved = 0; + $category->categories = 0; + $category->active = 0; + $category->trash = 0; + $this->_data = $category; + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to set the category access + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function setAccess($cid = array(), $access = 0) + { + if (count( $cid )) + { + $user =& JFactory::getUser(); + + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__categories' + . ' SET access = '.(int) $access + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_categories/models/index.html b/administrator/components/com_categories/models/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_categories/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_categories/tables/category.php b/administrator/components/com_categories/tables/category.php new file mode 100644 index 0000000000000..98d882747040b --- /dev/null +++ b/administrator/components/com_categories/tables/category.php @@ -0,0 +1,84 @@ +title); + + if(empty($this->alias) || $this->alias === $alias ) { + $this->alias = $alias; + } + + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_categories/tables/index.html b/administrator/components/com_categories/tables/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_categories/tables/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_categories/toolbar.categories.html.php b/administrator/components/com_categories/toolbar.categories.html.php deleted file mode 100644 index 1d76840936504..0000000000000 --- a/administrator/components/com_categories/toolbar.categories.html.php +++ /dev/null @@ -1,84 +0,0 @@ -[ '. $text.' ]', 'categories.png' ); - JToolBarHelper::save(); - JToolBarHelper::apply(); - if ($edit) { - // for existing articles the button is renamed `close` - JToolBarHelper::cancel( 'cancel', 'Close' ); - } else { - JToolBarHelper::cancel(); - } - JToolBarHelper::help( 'screen.categories.edit' ); - } - - /** - * Draws the menu for Moving existing categories - * @param int The published state (to display the inverse button) - */ - function _MOVE() { - - JToolBarHelper::title( JText::_( 'Category' ) .': [ '. JText::_( 'Move' ).' ]', 'categories.png' ); - JToolBarHelper::save( 'movesave' ); - JToolBarHelper::cancel(); - } - - /** - * Draws the menu for Copying existing categories - * @param int The published state (to display the inverse button) - */ - function _COPY() { - JToolBarHelper::title( JText::_( 'Category' ) .': [ '. JText::_( 'Copy' ).' ]', 'categories.png' ); - - JToolBarHelper::save( 'copysave' ); - JToolBarHelper::cancel(); - } - - /** - * Draws the menu for Editing an existing category - */ - function _DEFAULT() - { - $section = JRequest::getCmd( 'section' ); - - JToolBarHelper::title( JText::_( 'Category Manager' ) .': [ '. JText::_(JString::substr($section, 4)).' ]', 'categories.png' ); - JToolBarHelper::publishList(); - JToolBarHelper::unpublishList(); - - if ( $section == 'com_content' || ( $section > 0 ) ) { - JToolBarHelper::customX( 'moveselect', 'move.png', 'move_f2.png', 'Move', true ); - JToolBarHelper::customX( 'copyselect', 'copy.png', 'copy_f2.png', 'Copy', true ); - } - JToolBarHelper::deleteList(); - JToolBarHelper::editListX(); - JToolBarHelper::addNewX(); - JToolBarHelper::help( 'screen.categories' ); - } -} \ No newline at end of file diff --git a/administrator/components/com_categories/toolbar.categories.php b/administrator/components/com_categories/toolbar.categories.php deleted file mode 100644 index 4ce162e50ff96..0000000000000 --- a/administrator/components/com_categories/toolbar.categories.php +++ /dev/null @@ -1,44 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_categories/views/categories/tmpl/default.php b/administrator/components/com_categories/views/categories/tmpl/default.php new file mode 100644 index 0000000000000..89e3725a16e10 --- /dev/null +++ b/administrator/components/com_categories/views/categories/tmpl/default.php @@ -0,0 +1,189 @@ + + +filter->order == 'c.ordering'); + + JHTML::_('behavior.tooltip'); +?> + +
    + + + + + + +
    + : + + + + + filter->section == 'com_content') { + echo JHTML::_('list.section', 'sectionid', $this->filter->sectionid, 'onchange="document.adminForm.submit();"' ); + } + ?> + filter->state ); + ?> +
    + + + + + + + + + + + filter->section == 'com_content') { + ?> + + + type == 'content') { + ?> + + + + + + + + + + + + +rows ) ) { +for ($i=0, $n=count( $this->rows ); $i < $n; $i++) { + $row = &$this->rows[$i]; + + $row->sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->section ); + + $link = 'index.php?option=com_categories§ion='. $this->filter->section .'&task=edit&cid[]='. $row->id .'&type='.$this->type; + + $access = JHTML::_('grid.access', $row, $i ); + $checked = JHTML::_('grid.checkedout', $row, $i ); + $published = JHTML::_('grid.published', $row, $i ); + ?> + "> + + + + + + + filter->section == 'com_content' ) { + ?> + + + type == 'content') { + ?> + + + + + + type == 'content') { + ?> + + + + + +
    + + + + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + rows ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + + + + + filter->order_Dir, @$this->filter->order ); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset( $i ); ?> + + + + + user->get ('id'), $row->checked_out ) ) { + echo $row->title; + } else { + ?> + + title; ?> + + + + + pagination->orderUpIcon( $i, ($row->section == @$this->rows[$i-1]->section), 'orderup', 'Move Up', $ordering ); ?> + pagination->orderDownIcon( $i, $n, ($row->section == @$this->rows[$i+1]->section), 'orderdown', 'Move Down', $ordering ); ?> + + class="text_area" style="text-align: center" /> + + + + + section_name; ?> + + active; ?> + + trash; ?> + + id; ?> +
    + + + + + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_categories/views/categories/tmpl/index.html b/administrator/components/com_categories/views/categories/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_categories/views/categories/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_categories/views/categories/view.html.php b/administrator/components/com_categories/views/categories/view.html.php new file mode 100644 index 0000000000000..8fa0e2b93f0f6 --- /dev/null +++ b/administrator/components/com_categories/views/categories/view.html.php @@ -0,0 +1,74 @@ +get( 'Data'); + $pagination = & $this->get( 'Pagination' ); + $type = & $this->get( 'Type'); + $section_name = & $this->get( 'SectionName'); + $filter = & $this->get( 'Filter'); + + // Set toolbar items for the page + JToolBarHelper::title( JText::_( 'Category Manager' ) .': [ '. JText::_(JString::substr($filter->section, 4)).' ]', 'categories.png' ); + JToolBarHelper::publishList(); + JToolBarHelper::unpublishList(); + + if ( $filter->section == 'com_content' || ( $filter->section > 0 ) ) { + JToolBarHelper::customX( 'moveselect', 'move.png', 'move_f2.png', 'Move', true ); + JToolBarHelper::customX( 'copyselect', 'copy.png', 'copy_f2.png', 'Copy', true ); + } + JToolBarHelper::deleteList(); + JToolBarHelper::editListX(); + JToolBarHelper::addNewX(); + JToolBarHelper::help( 'screen.categories' ); + + $this->assignRef('user', $user); + $this->assignRef('type', $type); + $this->assignRef('section_name',$section_name); + $this->assignRef('rows', $rows); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_categories/views/category/index.html b/administrator/components/com_categories/views/category/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_categories/views/category/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_categories/views/category/tmpl/default.php b/administrator/components/com_categories/views/category/tmpl/default.php new file mode 100644 index 0000000000000..ea0e3810f3ba9 --- /dev/null +++ b/administrator/components/com_categories/views/category/tmpl/default.php @@ -0,0 +1,200 @@ + + + + + + +[ '. $text.' ]', 'categories.png' ); + JToolBarHelper::save(); + JToolBarHelper::apply(); + if ($edit) { + // for existing articles the button is renamed `close` + JToolBarHelper::cancel( 'cancel', 'Close' ); + } else { + JToolBarHelper::cancel(); + } + JToolBarHelper::help( 'screen.categories.edit' ); + + $editor =& JFactory::getEditor(); + + if ($this->row->image == '') { + $this->row->image = 'blank.png'; + } + + if ( $this->redirect == 'content' ) { + $component = 'Content'; + } else { + $component = ucfirst( substr( $this->redirect, 4 ) ); + if ( $this->redirect == 'com_contact_details' ) { + $component = 'Contact'; + } + } + + JFilterOutput::objectHTMLSafe( $this->row, ENT_QUOTES, 'description' ); + $cparams = JComponentHelper::getParams ('com_media'); +?> + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + : + + lists['published']; ?> +
    + + + lists['section']; ?> +
    + + + lists['ordering']; ?> +
    + + + lists['access']; ?> +
    + + + lists['image']; ?> +
    + + + lists['image_position']; ?> +
      + +
    +
    + +
    + + + + + + +
    + display( 'description', $this->row->description, '550', '300', '60', '20', array('pagebreak', 'readmore') ) ; + ?> +
    +
    +
    +
    + + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_categories/views/category/tmpl/index.html b/administrator/components/com_categories/views/category/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_categories/views/category/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_categories/views/category/view.html.php b/administrator/components/com_categories/views/category/view.html.php new file mode 100644 index 0000000000000..8dcc90f78506e --- /dev/null +++ b/administrator/components/com_categories/views/category/view.html.php @@ -0,0 +1,151 @@ +get('id'); + + $type = JRequest::getCmd( 'type' ); + $redirect = JRequest::getCmd( 'section', 'com_content' ); + $section = JRequest::getCmd( 'section', 'com_content' ); + $cid = JRequest::getVar( 'cid', array(0), '', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + $model =& $this->getModel(); + + // check for existance of any sections + $query = 'SELECT COUNT( id )' + . ' FROM #__sections' + . ' WHERE scope = "content"' + ; + $db->setQuery( $query ); + $sections = $db->loadResult(); + if (!$sections && $type != 'other' + && $section != 'com_weblinks' + && $section != 'com_newsfeeds' + && $section != 'com_contact_details' + && $section != 'com_banner') { + $mainframe->redirect( 'index.php?option=com_categories§ion='. $section, JText::_( 'WARNSECTION', true ) ); + } + + //get the section + $row =& $this->get('data'); + $edit = JRequest::getVar('edit',true); + + // fail if checked out not by 'me' + if ( JTable::isCheckedOut($user->get ('id'), $row->checked_out )) { + $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The category' ), $row->title ); + $mainframe->redirect( 'index.php?option=com_categories§ion='. $row->section, $msg ); + } + + if ( $edit ) { + $model->checkout( $user->get('id')); + } else { + $row->published = 1; + } + + + // make order list + /* + $order = array(); + $query = 'SELECT COUNT(*)' + . ' FROM #__categories' + . ' WHERE section = '.$db->Quote($row->section) + ; + $db->setQuery( $query ); + $max = intval( $db->loadResult() ) + 1; + + for ($i=1; $i < $max; $i++) { + $order[] = JHTML::_('select.option', $i ); + } + */ + + // build the html select list for sections + if ( $section == 'com_content' ) { + + if (!$row->section && JRequest::getInt('sectionid')) { + $row->section = JRequest::getInt('sectionid'); + } + + $query = 'SELECT s.id AS value, s.title AS text' + . ' FROM #__sections AS s' + . ' ORDER BY s.ordering' + ; + $db->setQuery( $query ); + $sections = $db->loadObjectList(); + $lists['section'] = JHTML::_('select.genericlist', $sections, 'section', 'class="inputbox" size="1"', 'value', 'text', $row->section ); + } else { + if ( $type == 'other' ) { + $section_name = JText::_( 'N/A' ); + } else { + $temp =& JTable::getInstance('section'); + $temp->load( $row->section ); + $section_name = $temp->name; + } + if(!$section_name) $section_name = JText::_( 'N/A' ); + $row->section = $section; + $lists['section'] = ''. $section_name; + } + + // build the html select list for ordering + $query = 'SELECT ordering AS value, title AS text' + . ' FROM #__categories' + . ' WHERE section = '.$db->Quote($row->section) + . ' ORDER BY ordering' + ; + if($edit) + $lists['ordering'] = JHTML::_('list.specificordering', $row, $cid[0], $query ); + else + $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query ); + + // build the select list for the image positions + $active = ( $row->image_position ? $row->image_position : 'left' ); + $lists['image_position'] = JHTML::_('list.positions', 'image_position', $active, NULL, 0, 0 ); + // Imagelist + $lists['image'] = JHTML::_('list.images', 'image', $row->image ); + // build the html select list for the group access + $lists['access'] = JHTML::_('list.accesslevel', $row ); + // build the html radio buttons for published + $published = ($row->id) ? $row->published : 1; + $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $published ); + + $this->assignRef('redirect', $redirect); + $this->assignRef('lists', $lists); + $this->assignRef('row', $row); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_categories/views/copyselect/index.html b/administrator/components/com_categories/views/copyselect/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_categories/views/copyselect/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_categories/views/copyselect/tmpl/default.php b/administrator/components/com_categories/views/copyselect/tmpl/default.php new file mode 100644 index 0000000000000..798c06bd2a0f9 --- /dev/null +++ b/administrator/components/com_categories/views/copyselect/tmpl/default.php @@ -0,0 +1,92 @@ + + + + + + +[ '. JText::_( $isCopy ? 'Copy' : 'Move' ).' ]', 'categories.png' ); + JToolBarHelper::save( $isCopy ? 'copysave' : 'movesave' ); + JToolBarHelper::cancel(); +?> + + +
    + +
    + + + + + + + . + +
    + : +
    + lists['SectionList'] ?> +

    +
    + : +
    + "; + foreach ( $this->items as $item ) { + echo "
  • ". $item->title ."
  • "; + } + echo ""; + ?> +
    + : +
    + "; + foreach ( $this->contents as $content ) { + echo "
  • ". $content->title ."
  • "; + echo "\n id\" />"; + } + echo ""; + ?> +
    + +
    + +
    + +
    + +
    +

    + + + + + + + +cid as $id ) { + echo "\n "; +} +?> +
    \ No newline at end of file diff --git a/administrator/components/com_categories/views/copyselect/tmpl/index.html b/administrator/components/com_categories/views/copyselect/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_categories/views/copyselect/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_categories/views/copyselect/view.html.php b/administrator/components/com_categories/views/copyselect/view.html.php new file mode 100644 index 0000000000000..0dba00c292982 --- /dev/null +++ b/administrator/components/com_categories/views/copyselect/view.html.php @@ -0,0 +1,89 @@ +setQuery( $query ); + $items = $db->loadObjectList(); + + ## query to list items from categories + $query = 'SELECT a.title, a.id' + . ' FROM #__content AS a' + . ' WHERE a.catid IN ( '.$cids.' )' + . ' ORDER BY a.catid, a.title' + ; + $db->setQuery( $query ); + $contents = $db->loadObjectList(); + + ## query to choose section to move to + $query = 'SELECT a.title AS `text`, a.id AS `value`' + . ' FROM #__sections AS a' + . ' WHERE a.published = 1' + . ' ORDER BY a.name' + ; + $db->setQuery( $query ); + $sections = $db->loadObjectList(); + + // build the html select list + $lists['SectionList'] = JHTML::_('select.genericlist', $sections, 'sectionmove', 'class="inputbox" size="10"', 'value', 'text', null ); + + $this->assignRef('lists', $lists); + $this->assignRef('redirect', $redirect); + $this->assignRef('sectionOld', $sectionOld); + $this->assignRef('items', $items); + $this->assignRef('contents', $contents); + $this->assignRef('cid', $cid); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_categories/views/index.html b/administrator/components/com_categories/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_categories/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_checkin/admin.checkin.php b/administrator/components/com_checkin/admin.checkin.php deleted file mode 100644 index efb5c038a9b92..0000000000000 --- a/administrator/components/com_checkin/admin.checkin.php +++ /dev/null @@ -1,107 +0,0 @@ -authorize( 'com_checkin', 'manage' )) { - $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); -} -$db =& JFactory::getDBO(); -$nullDate = $db->getNullDate(); -?> -
    - - - - - - - - getTableList(); - $k = 0; - foreach ($tables as $tn) { - // make sure we get the right tables based on prefix - if (!preg_match( "/^".$mainframe->getCfg('dbprefix')."/i", $tn )) { - continue; - } - $fields = $db->getTableFields( array( $tn ) ); - - $foundCO = false; - $foundCOT = false; - $foundE = false; - - $foundCO = isset( $fields[$tn]['checked_out'] ); - $foundCOT = isset( $fields[$tn]['checked_out_time'] ); - $foundE = isset( $fields[$tn]['editor'] ); - - if ($foundCO && $foundCOT) { - if ($foundE) { - $query = 'SELECT checked_out, editor FROM '.$tn.' WHERE checked_out > 0'; - } else { - $query = 'SELECT checked_out FROM '.$tn.' WHERE checked_out > 0'; - } - $db->setQuery( $query ); - $res = $db->query(); - $num = $db->getNumRows( $res ); - - if ($foundE) { - $query = 'UPDATE '.$tn.' SET checked_out = 0, checked_out_time = '.$db->Quote($nullDate).', editor = NULL WHERE checked_out > 0'; - } else { - $query = 'UPDATE '.$tn.' SET checked_out = 0, checked_out_time = '.$db->Quote($nullDate).' WHERE checked_out > 0'; - } - $db->setQuery( $query ); - $res = $db->query(); - - if ($res == 1) { - if ($num > 0) { - echo ""; - echo "\n "; - echo "\n "; - echo "\n "; - echo "\n "; - echo "\n"; - } else { - echo ""; - echo "\n "; - echo "\n "; - echo "\n "; - echo "\n "; - echo "\n"; - } - $k = 1 - $k; - } - } - } - ?> - - - -
    - - - - - - -
    ". JText::_( 'Checking table' ) ." - ". $tn ."". JText::_( 'Checked-In' ) ." ". $num ." ". JText::_( 'items' ) ."\"". 
    ". JText::_( 'Checking table' ) ." - ". $tn ."". JText::_( 'Checked-In' ) ." ". $num ." ". JText::_( 'items' ) ."  
    - - - -
    -
    \ No newline at end of file diff --git a/administrator/components/com_checkin/checkin.php b/administrator/components/com_checkin/checkin.php new file mode 100644 index 0000000000000..f7d15eb4a59bd --- /dev/null +++ b/administrator/components/com_checkin/checkin.php @@ -0,0 +1,25 @@ +execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_checkin/controller.php b/administrator/components/com_checkin/controller.php new file mode 100644 index 0000000000000..7780828a642d8 --- /dev/null +++ b/administrator/components/com_checkin/controller.php @@ -0,0 +1,29 @@ + \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_checkin/toolbar.checkin.html.php b/administrator/components/com_checkin/toolbar.checkin.html.php deleted file mode 100644 index 9687081affcbc..0000000000000 --- a/administrator/components/com_checkin/toolbar.checkin.html.php +++ /dev/null @@ -1,31 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_checkin/views/checkin/tmpl/default.php b/administrator/components/com_checkin/views/checkin/tmpl/default.php new file mode 100644 index 0000000000000..ef544b8e51790 --- /dev/null +++ b/administrator/components/com_checkin/views/checkin/tmpl/default.php @@ -0,0 +1,42 @@ + + +
    + + + + + + + + rows as $row) { + echo ""; + echo "\n "; + echo "\n "; + if ($row['checked_in'] > 0) { + echo "\n "; + } else { + echo "\n "; + } + echo "\n "; + echo "\n"; + $k = 1 - $k; + } + ?> + + + +
    + + + + + + +
    ". JText::_( 'Checking table' ) ." - ". $row['table'] ."". JText::_( 'Checked-In' ) ." ". $row['checked_in'] ." ". JText::_( 'items' ) ."\"".  
    + + + +
    +
    diff --git a/administrator/components/com_checkin/views/checkin/tmpl/index.html b/administrator/components/com_checkin/views/checkin/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_checkin/views/checkin/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_checkin/views/checkin/view.html.php b/administrator/components/com_checkin/views/checkin/view.html.php new file mode 100644 index 0000000000000..6d20aed241388 --- /dev/null +++ b/administrator/components/com_checkin/views/checkin/view.html.php @@ -0,0 +1,90 @@ +getTableList(); + foreach ($tables as $tn) { + // make sure we get the right tables based on prefix + if (!preg_match( "/^".$mainframe->getCfg('dbprefix')."/i", $tn )) { + continue; + } + $fields = $db->getTableFields( array( $tn ) ); + + $foundCO = false; + $foundCOT = false; + $foundE = false; + + $foundCO = isset( $fields[$tn]['checked_out'] ); + $foundCOT = isset( $fields[$tn]['checked_out_time'] ); + $foundE = isset( $fields[$tn]['editor'] ); + + if ($foundCO && $foundCOT) { + if ($foundE) { + $query = 'SELECT checked_out, editor FROM '.$tn.' WHERE checked_out > 0'; + } else { + $query = 'SELECT checked_out FROM '.$tn.' WHERE checked_out > 0'; + } + $db->setQuery( $query ); + $res = $db->query(); + $num = $db->getNumRows( $res ); + + if ($foundE) { + $query = 'UPDATE '.$tn.' SET checked_out = 0, checked_out_time = '.$db->Quote($nullDate).', editor = NULL WHERE checked_out > 0'; + } else { + $query = 'UPDATE '.$tn.' SET checked_out = 0, checked_out_time = '.$db->Quote($nullDate).' WHERE checked_out > 0'; + } + $db->setQuery( $query ); + $res = $db->query(); + + if ($res == 1) { + $rows[] = array( + 'table' => $tn, + 'checked_in' => $num, + ); + } + } + } + + $this->assignRef('rows', $rows); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_checkin/views/index.html b/administrator/components/com_checkin/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_checkin/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_cpanel/toolbar.cpanel.html.php b/administrator/components/com_config/classes/config.php similarity index 58% rename from administrator/components/com_cpanel/toolbar.cpanel.html.php rename to administrator/components/com_config/classes/config.php index 730176cfae8fc..c821c6c11b348 100644 --- a/administrator/components/com_cpanel/toolbar.cpanel.html.php +++ b/administrator/components/com_config/classes/config.php @@ -1,8 +1,8 @@ '; + return $tip; } -} \ No newline at end of file +} diff --git a/administrator/components/com_config/classes/index.html b/administrator/components/com_config/classes/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_config/classes/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_config/admin.config.php b/administrator/components/com_config/config.php similarity index 67% rename from administrator/components/com_config/admin.config.php rename to administrator/components/com_config/config.php index 8630066139637..63ae08d421464 100644 --- a/administrator/components/com_config/admin.config.php +++ b/administrator/components/com_config/config.php @@ -1,19 +1,19 @@ redirect('index.php', JText::_('ALERTNOTAUTH')); } -// Require the base controller -require_once (JPATH_COMPONENT.DS.'controller.php'); +// Helper classes +JHTML::addIncludePath(JPATH_COMPONENT.DS.'classes'); // Require specific controller if requested if($controller = JRequest::getWord('controller', 'application')) { @@ -38,6 +38,7 @@ $classname = 'ConfigController'.ucfirst($controller); $controller = new $classname( ); +// What is this for? JResponse::setHeader( 'Expires', 'Mon, 26 Jul 1997 05:00:00 GMT', true ); // Perform the Request task diff --git a/administrator/components/com_config/controllers/application.php b/administrator/components/com_config/controllers/application.php index 61315698cec8e..da70409cdd084 100644 --- a/administrator/components/com_config/controllers/application.php +++ b/administrator/components/com_config/controllers/application.php @@ -12,7 +12,10 @@ * details. */ -require_once( JPATH_COMPONENT.DS.'views'.DS.'application'.DS.'view.php' ); +// Check to ensure this file is included in Joomla! +defined('_JEXEC') or die('Restricted access'); + +require_once JPATH_COMPONENT.DS.'controller.php'; /** * @package Joomla @@ -23,177 +26,21 @@ class ConfigControllerApplication extends ConfigController /** * Custom Constructor */ - function __construct( $default = array() ) + function __construct($default = array()) { - $default['default_task'] = 'showConfig'; - parent::__construct( $default ); - - $this->registerTask( 'apply', 'save' ); + parent::__construct($default); + $this->registerTask('apply', 'save'); } /** * Show the configuration edit form * @param string The URL option */ - function showConfig() + function display() { - // Initialize some variables - $db =& JFactory::getDBO(); - $row = new JConfig(); - - // compile list of the languages - $langs = array (); - $menuitems = array (); - $lists = array (); - - // PRE-PROCESS SOME LIST - - // -- Editors -- - - // compile list of the editors - $query = 'SELECT element AS value, name AS text' - .' FROM #__plugins' - .' WHERE folder = "editors"' - .' AND published = 1' - .' ORDER BY ordering, name' - ; - $db->setQuery($query); - $edits = $db->loadObjectList(); - - // -- Show/Hide -- - - $show_hide = array (JHTML::_('select.option', 1, JText::_('Hide')), JHTML::_('select.option', 0, JText::_('Show')),); - - $show_hide_r = array (JHTML::_('select.option', 0, JText::_('Hide')), JHTML::_('select.option', 1, JText::_('Show')),); - - // -- menu items -- - - $query = 'SELECT id AS value, name AS text FROM #__menu' - .' WHERE ( type="content_section" OR type="components" OR type="content_typed" )' - .' AND published = 1' - .' AND access = 0' - .' ORDER BY name' - ; - $db->setQuery($query); - $menuitems = array_merge($menuitems, $db->loadObjectList()); - - // SITE SETTINGS - $lists['offline'] = JHTML::_('select.booleanlist', 'offline', 'class="inputbox"', $row->offline); - if (!$row->editor) { - $row->editor = ''; - } - // build the html select list - $lists['editor'] = JHTML::_('select.genericlist', $edits, 'editor', 'class="inputbox" size="1"', 'value', 'text', $row->editor); - $listLimit = array (JHTML::_('select.option', 5, 5), JHTML::_('select.option', 10, 10), JHTML::_('select.option', 15, 15), JHTML::_('select.option', 20, 20), JHTML::_('select.option', 25, 25), JHTML::_('select.option', 30, 30), JHTML::_('select.option', 50, 50), JHTML::_('select.option', 100, 100),); - $lists['list_limit'] = JHTML::_('select.genericlist', $listLimit, 'list_limit', 'class="inputbox" size="1"', 'value', 'text', ($row->list_limit ? $row->list_limit : 50)); - - jimport('joomla.language.help'); - $helpsites = array (); - $helpsites = JHelp::createSiteList(JPATH_BASE.DS.'help'.DS.'helpsites-15.xml', $row->helpurl); - array_unshift($helpsites, JHTML::_('select.option', '', JText::_('local'))); - $lists['helpsites'] = JHTML::_('select.genericlist', $helpsites, 'helpurl', ' class="inputbox"', 'value', 'text', $row->helpurl); - - // DEBUG - $lists['debug'] = JHTML::_('select.booleanlist', 'debug', 'class="inputbox"', $row->debug); - $lists['debug_lang'] = JHTML::_('select.booleanlist', 'debug_lang', 'class="inputbox"', $row->debug_lang); - - // DATABASE SETTINGS - - // SERVER SETTINGS - $lists['gzip'] = JHTML::_('select.booleanlist', 'gzip', 'class="inputbox"', $row->gzip); - $errors = array (JHTML::_('select.option', -1, JText::_('System Default')), JHTML::_('select.option', 0, JText::_('None')), JHTML::_('select.option', E_ERROR | E_WARNING | E_PARSE, JText::_('Simple')), JHTML::_('select.option', E_ALL, JText::_('Maximum'))); - $lists['xmlrpc_server'] = JHTML::_('select.booleanlist', 'xmlrpc_server', 'class="inputbox"', $row->xmlrpc_server); - $lists['error_reporting'] = JHTML::_('select.genericlist', $errors, 'error_reporting', 'class="inputbox" size="1"', 'value', 'text', $row->error_reporting); - $lists['enable_ftp'] = JHTML::_('select.booleanlist', 'ftp_enable', 'class="inputbox"', intval($row->ftp_enable)); - - // LOCALE SETTINGS - $timeoffset = array ( JHTML::_('select.option', -12, JText::_('(UTC -12:00) International Date Line West')), - JHTML::_('select.option', -11, JText::_('(UTC -11:00) Midway Island, Samoa')), - JHTML::_('select.option', -10, JText::_('(UTC -10:00) Hawaii')), - JHTML::_('select.option', -9.5, JText::_('(UTC -09:30) Taiohae, Marquesas Islands')), - JHTML::_('select.option', -9, JText::_('(UTC -09:00) Alaska')), - JHTML::_('select.option', -8, JText::_('(UTC -08:00) Pacific Time (US & Canada)')), - JHTML::_('select.option', -7, JText::_('(UTC -07:00) Mountain Time (US & Canada)')), - JHTML::_('select.option', -6, JText::_('(UTC -06:00) Central Time (US & Canada), Mexico City')), - JHTML::_('select.option', -5, JText::_('(UTC -05:00) Eastern Time (US & Canada), Bogota, Lima')), - JHTML::_('select.option', -4, JText::_('(UTC -04:00) Atlantic Time (Canada), Caracas, La Paz')), - JHTML::_('select.option', -3.5, JText::_('(UTC -03:30) St. John\'s, Newfoundland, Labrador')), - JHTML::_('select.option', -3, JText::_('(UTC -03:00) Brazil, Buenos Aires, Georgetown')), - JHTML::_('select.option', -2, JText::_('(UTC -02:00) Mid-Atlantic')), - JHTML::_('select.option', -1, JText::_('(UTC -01:00) Azores, Cape Verde Islands')), - JHTML::_('select.option', 0, JText::_('(UTC 00:00) Western Europe Time, London, Lisbon, Casablanca')), - JHTML::_('select.option', 1, JText::_('(UTC +01:00) Amsterdam, Berlin, Brussels, Copenhagen, Madrid, Paris')), - JHTML::_('select.option', 2, JText::_('(UTC +02:00) Istanbul, Jerusalem, Kaliningrad, South Africa')), - JHTML::_('select.option', 3, JText::_('(UTC +03:00) Baghdad, Riyadh, Moscow, St. Petersburg')), - JHTML::_('select.option', 3.5, JText::_('(UTC +03:30) Tehran')), - JHTML::_('select.option', 4, JText::_('(UTC +04:00) Abu Dhabi, Muscat, Baku, Tbilisi')), - JHTML::_('select.option', 4.5, JText::_('(UTC +04:30) Kabul')), - JHTML::_('select.option', 5, JText::_('(UTC +05:00) Ekaterinburg, Islamabad, Karachi, Tashkent')), - JHTML::_('select.option', 5.5, JText::_('(UTC +05:30) Bombay, Calcutta, Madras, New Delhi')), - JHTML::_('select.option', 5.75, JText::_('(UTC +05:45) Kathmandu')), - JHTML::_('select.option', 6, JText::_('(UTC +06:00) Almaty, Dhaka, Colombo')), - JHTML::_('select.option', 6.30, JText::_('(UTC +06:30) Yagoon')), - JHTML::_('select.option', 7, JText::_('(UTC +07:00) Bangkok, Hanoi, Jakarta')), - JHTML::_('select.option', 8, JText::_('(UTC +08:00) Beijing, Perth, Singapore, Hong Kong')), - JHTML::_('select.option', 8.75, JText::_('(UTC +08:00) Western Australia')), - JHTML::_('select.option', 9, JText::_('(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk')), - JHTML::_('select.option', 9.5, JText::_('(UTC +09:30) Adelaide, Darwin, Yakutsk')), - JHTML::_('select.option', 10, JText::_('(UTC +10:00) Eastern Australia, Guam, Vladivostok')), - JHTML::_('select.option', 10.5, JText::_('(UTC +10:30) Lord Howe Island (Australia)')), - JHTML::_('select.option', 11, JText::_('(UTC +11:00) Magadan, Solomon Islands, New Caledonia')), - JHTML::_('select.option', 11.30, JText::_('(UTC +11:30) Norfolk Island')), - JHTML::_('select.option', 12, JText::_('(UTC +12:00) Auckland, Wellington, Fiji, Kamchatka')), - JHTML::_('select.option', 12.75, JText::_('(UTC +12:45) Chatham Island')), - JHTML::_('select.option', 13, JText::_('(UTC +13:00) Tonga')), - JHTML::_('select.option', 14, JText::_('(UTC +14:00) Kiribati')),); - $lists['offset'] = JHTML::_('select.genericlist', $timeoffset, 'offset', 'class="inputbox" size="1"', 'value', 'text', $row->offset); - - // MAIL SETTINGS - $mailer = array (JHTML::_('select.option', 'mail', JText::_('PHP mail function')), JHTML::_('select.option', 'sendmail', JText::_('Sendmail')), JHTML::_('select.option', 'smtp', JText::_('SMTP Server'))); - $lists['mailer'] = JHTML::_('select.genericlist', $mailer, 'mailer', 'class="inputbox" size="1"', 'value', 'text', $row->mailer); - $lists['smtpauth'] = JHTML::_('select.booleanlist', 'smtpauth', 'class="inputbox"', $row->smtpauth); - - // CACHE SETTINGS - $lists['caching'] = JHTML::_('select.booleanlist', 'caching', 'class="inputbox"', $row->caching); - jimport('joomla.cache.cache'); - $stores = JCache::getStores(); - $options = array(); - foreach($stores as $store) { - $options[] = JHTML::_('select.option', $store, JText::_(ucfirst($store)) ); - } - $lists['cache_handlers'] = JHTML::_('select.genericlist', $options, 'cache_handler', 'class="inputbox" size="1"', 'value', 'text', $row->cache_handler); - - // MEMCACHE SETTINGS - if (!empty($row->memcache_settings) && !is_array($row->memcache_settings)) { - $row->memcache_settings = unserialize(stripslashes($row->memcache_settings)); - } - $lists['memcache_persist'] = JHTML::_('select.booleanlist', 'memcache_settings[persistent]', 'class="inputbox"', @$row->memcache_settings['persistent']); - $lists['memcache_compress'] = JHTML::_('select.booleanlist', 'memcache_settings[compression]', 'class="inputbox"', @$row->memcache_settings['compression']); - - // META SETTINGS - $lists['MetaAuthor'] = JHTML::_('select.booleanlist', 'MetaAuthor', 'class="inputbox"', $row->MetaAuthor); - $lists['MetaTitle'] = JHTML::_('select.booleanlist', 'MetaTitle', 'class="inputbox"', $row->MetaTitle); - - // SEO SETTINGS - $lists['sef'] = JHTML::_('select.booleanlist', 'sef', 'class="inputbox"', $row->sef); - $lists['sef_rewrite'] = JHTML::_('select.booleanlist', 'sef_rewrite', 'class="inputbox"', $row->sef_rewrite); - $lists['sef_suffix'] = JHTML::_('select.booleanlist', 'sef_suffix', 'class="inputbox"', $row->sef_suffix); - - // FEED SETTINGS - $formats = array (JHTML::_('select.option', 'RSS2.0', JText::_('RSS')), JHTML::_('select.option', 'Atom', JText::_('Atom'))); - $summary = array (JHTML::_('select.option', 1, JText::_('Full Text')), JHTML::_('select.option', 0, JText::_('Intro Text')),); - $lists['feed_limit'] = JHTML::_('select.genericlist', $listLimit, 'feed_limit', 'class="inputbox" size="1"', 'value', 'text', ($row->feed_limit ? $row->feed_limit : 10)); - - // SESSION SETTINGS - $stores = JSession::getStores(); - $options = array(); - foreach($stores as $store) { - $options[] = JHTML::_('select.option', $store, JText::_(ucfirst($store)) ); - } - $lists['session_handlers'] = JHTML::_('select.genericlist', $options, 'session_handler', 'class="inputbox" size="1"', 'value', 'text', $row->session_handler); - - // SHOW EDIT FORM - ConfigApplicationView::showConfig($row, $lists); + JRequest::setVar('view', 'application'); + JRequest::setVar('layout', 'config'); + parent::display(); } /** @@ -204,7 +51,7 @@ function save() global $mainframe; // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); + JRequest::checkToken() or jexit('Invalid Token'); // Set FTP credentials, if given jimport('joomla.client.helper'); @@ -216,18 +63,18 @@ function save() $userpost['params'] = JRequest::getVar('userparams', array(), 'post', 'array'); $userpost['option'] = 'com_users'; - $table->loadByOption( 'com_users' ); - $table->bind( $userpost ); + $table->loadByOption('com_users'); + $table->bind($userpost); // pre-save checks if (!$table->check()) { - JError::raiseWarning( 500, $table->getError() ); + JError::raiseWarning(500, $table->getError()); return false; } // save the changes if (!$table->store()) { - JError::raiseWarning( 500, $table->getError() ); + JError::raiseWarning(500, $table->getError()); return false; } @@ -255,18 +102,18 @@ function save() $mediapost['params']['file_path'] = $file_path; $mediapost['params']['image_path'] = $image_path; - $table->loadByOption( 'com_media' ); - $table->bind( $mediapost ); + $table->loadByOption('com_media'); + $table->bind($mediapost); // pre-save checks if (!$table->check()) { - JError::raiseWarning( 500, $table->getError() ); + JError::raiseWarning(500, $table->getError()); return false; } // save the changes if (!$table->store()) { - JError::raiseWarning( 500, $table->getError() ); + JError::raiseWarning(500, $table->getError()); return false; } @@ -342,31 +189,27 @@ function save() $config_array['lifetime'] = JRequest::getVar('lifetime', 0, 'post', 'int'); $config_array['session_handler'] = JRequest::getVar('session_handler', 'none', 'post', 'word'); - //LANGUAGE SETTINGS - //$config_array['lang'] = JRequest::getVar('lang', 'none', 'english', 'cmd'); - //$config_array['language'] = JRequest::getVar('language', 'en-GB', 'post', 'cmd'); - $config->loadArray($config_array); //override any possible database password change $config->setValue('config.password', $mainframe->getCfg('password')); // handling of special characters - $sitename = htmlspecialchars( JRequest::getVar( 'sitename', '', 'post', 'string' ), ENT_COMPAT, 'UTF-8' ); + $sitename = htmlspecialchars(JRequest::getVar('sitename', '', 'post', 'string'), ENT_COMPAT, 'UTF-8'); $config->setValue('config.sitename', $sitename); - $MetaDesc = htmlspecialchars( JRequest::getVar( 'MetaDesc', '', 'post', 'string' ), ENT_COMPAT, 'UTF-8' ); + $MetaDesc = htmlspecialchars(JRequest::getVar('MetaDesc', '', 'post', 'string'), ENT_COMPAT, 'UTF-8'); $config->setValue('config.MetaDesc', $MetaDesc); - $MetaKeys = htmlspecialchars( JRequest::getVar( 'MetaKeys', '', 'post', 'string' ), ENT_COMPAT, 'UTF-8' ); + $MetaKeys = htmlspecialchars(JRequest::getVar('MetaKeys', '', 'post', 'string'), ENT_COMPAT, 'UTF-8'); $config->setValue('config.MetaKeys', $MetaKeys); // handling of quotes (double and single) and amp characters // htmlspecialchars not used to preserve ability to insert other html characters - $offline_message = JRequest::getVar( 'offline_message', '', 'post', 'string' ); - $offline_message = JFilterOutput::ampReplace( $offline_message ); - $offline_message = str_replace( '"', '"', $offline_message ); - $offline_message = str_replace( "'", ''', $offline_message ); + $offline_message = JRequest::getVar('offline_message', '', 'post', 'string'); + $offline_message = JFilterOutput::ampReplace($offline_message); + $offline_message = str_replace('"', '"', $offline_message); + $offline_message = str_replace("'", ''', $offline_message); $config->setValue('config.offline_message', $offline_message); //purge the database session table (only if we are changing to a db session store) @@ -432,18 +275,21 @@ function cancel() jimport('joomla.client.helper'); JClientHelper::setCredentialsFromRequest('ftp'); - $this->setRedirect( 'index.php' ); + $this->setRedirect('index.php'); } function refreshHelp() { + // Check for request forgeries + JRequest::checkToken() or jexit('Invalid Token'); + jimport('joomla.filesystem.file'); // Set FTP credentials, if given jimport('joomla.client.helper'); JClientHelper::setCredentialsFromRequest('ftp'); - if (($data = file_get_contents('http://help.joomla.org/helpsites-15.xml')) === false ) { + if (($data = file_get_contents('http://help.joomla.org/helpsites-15.xml')) === false) { $this->setRedirect('index.php?option=com_config', JText::_('HELPREFRESH ERROR FETCH'), 'error'); } else if (!JFile::write(JPATH_BASE.DS.'help'.DS.'helpsites-15.xml', $data)) { $this->setRedirect('index.php?option=com_config', JText::_('HELPREFRESH ERROR STORE'), 'error'); diff --git a/administrator/components/com_config/controllers/component.php b/administrator/components/com_config/controllers/component.php index 2835813e762fe..4aa115704c1af 100644 --- a/administrator/components/com_config/controllers/component.php +++ b/administrator/components/com_config/controllers/component.php @@ -12,7 +12,7 @@ * details. */ -require_once( JPATH_COMPONENT.DS.'views'.DS.'component'.DS.'view.php' ); +jimport('joomla.application.component.controller'); /** * Note: this view is intended only to be opened in a popup @@ -52,16 +52,7 @@ function edit() $lang->load( $component ); $model = $this->getModel('Component' ); - $table =& JTable::getInstance('component'); - - if (!$table->loadByOption( $component )) - { - JError::raiseWarning( 500, 'Not a valid component' ); - return false; - } - - $view = new ConfigViewComponent( ); - $view->assignRef('component', $table); + $view = $this->getView('Component'); $view->setModel( $model, true ); $view->display(); } diff --git a/administrator/components/com_config/controllers/index.html b/administrator/components/com_config/controllers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_config/controllers/index.html +++ b/administrator/components/com_config/controllers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_config/index.html b/administrator/components/com_config/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_config/index.html +++ b/administrator/components/com_config/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_config/models/index.html b/administrator/components/com_config/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_config/models/index.html +++ b/administrator/components/com_config/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_config/toolbar.config.html.php b/administrator/components/com_config/toolbar.config.html.php deleted file mode 100644 index 0a2adf44d2143..0000000000000 --- a/administrator/components/com_config/toolbar.config.html.php +++ /dev/null @@ -1,32 +0,0 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_config/views/application/tmpl/config.php b/administrator/components/com_config/views/application/tmpl/config.php new file mode 100644 index 0000000000000..6ab74deadcb36 --- /dev/null +++ b/administrator/components/com_config/views/application/tmpl/config.php @@ -0,0 +1,67 @@ + + +
    +ftp) { + echo $this->loadTemplate('ftp_auth'); +} ?> +
    +
    + + + + + +
    + loadTemplate('site'); ?> + loadTemplate('metadata'); ?> + + loadTemplate('seo'); ?> +
    +
    +
    + + + + + +
    + loadTemplate('system'); ?> +
    + + userparams->render('userparams'); ?> +
    +
    + + mediaparams->render('mediaparams'); ?> +
    +
    + loadTemplate('debug'); ?> + loadTemplate('cache'); ?> + loadTemplate('session'); ?> +
    +
    +
    + + + + + +
    + loadTemplate('server'); ?> + loadTemplate('locale'); ?> + loadTemplate('ftp'); ?> + + loadTemplate('database'); ?> + loadTemplate('mail'); ?> +
    +
    +
    +
    + + + + + + + +
    diff --git a/administrator/components/com_config/views/application/tmpl/config_cache.php b/administrator/components/com_config/views/application/tmpl/config_cache.php index 588d230959bb6..00a8efb07865c 100644 --- a/administrator/components/com_config/views/application/tmpl/config_cache.php +++ b/administrator/components/com_config/views/application/tmpl/config_cache.php @@ -10,7 +10,7 @@ - + lists['caching']; ?> @@ -20,7 +20,7 @@ - + @@ -31,16 +31,16 @@ - + lists['cache_handlers']; ?> - cache_handler == 'memcache' || $row->session_handler == 'memcache') : ?> + row->cache_handler == 'memcache' || $this->row->session_handler == 'memcache') : ?> - + lists['memcache_persist']; ?> @@ -48,7 +48,7 @@ - + lists['memcache_compress']; ?> @@ -57,10 +57,10 @@ : - +

    : - + diff --git a/administrator/components/com_config/views/application/tmpl/config_database.php b/administrator/components/com_config/views/application/tmpl/config_database.php index 19ccbc2bc26a5..e3620be0fdd45 100644 --- a/administrator/components/com_config/views/application/tmpl/config_database.php +++ b/administrator/components/com_config/views/application/tmpl/config_database.php @@ -9,7 +9,7 @@ - + @@ -19,7 +19,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -49,10 +49,10 @@ - +   - + diff --git a/administrator/components/com_config/views/application/tmpl/config_debug.php b/administrator/components/com_config/views/application/tmpl/config_debug.php index ea8e5097fc9b6..c2675ec58232c 100644 --- a/administrator/components/com_config/views/application/tmpl/config_debug.php +++ b/administrator/components/com_config/views/application/tmpl/config_debug.php @@ -10,7 +10,7 @@ - + lists['debug']; ?> @@ -20,7 +20,7 @@ - + lists['debug_lang']; ?> diff --git a/administrator/components/com_config/views/application/tmpl/config_ftp.php b/administrator/components/com_config/views/application/tmpl/config_ftp.php index f9c470188b69e..731acd5229030 100644 --- a/administrator/components/com_config/views/application/tmpl/config_ftp.php +++ b/administrator/components/com_config/views/application/tmpl/config_ftp.php @@ -10,7 +10,7 @@ - + lists['enable_ftp']; ?> @@ -20,7 +20,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -60,7 +60,7 @@ - + diff --git a/administrator/components/com_config/views/application/tmpl/ftp.php b/administrator/components/com_config/views/application/tmpl/config_ftp_auth.php similarity index 100% rename from administrator/components/com_config/views/application/tmpl/ftp.php rename to administrator/components/com_config/views/application/tmpl/config_ftp_auth.php diff --git a/administrator/components/com_config/views/application/tmpl/config_locale.php b/administrator/components/com_config/views/application/tmpl/config_locale.php index 339c17de18cfd..4c893c8aa2092 100644 --- a/administrator/components/com_config/views/application/tmpl/config_locale.php +++ b/administrator/components/com_config/views/application/tmpl/config_locale.php @@ -9,7 +9,7 @@ - + lists['offset']; ?> diff --git a/administrator/components/com_config/views/application/tmpl/config_mail.php b/administrator/components/com_config/views/application/tmpl/config_mail.php index 449a04421646f..6f8b651eed229 100644 --- a/administrator/components/com_config/views/application/tmpl/config_mail.php +++ b/administrator/components/com_config/views/application/tmpl/config_mail.php @@ -10,7 +10,7 @@ - + lists['mailer']; ?> @@ -20,7 +20,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -50,7 +50,7 @@ - + lists['smtpauth']; ?> @@ -60,7 +60,7 @@ - + @@ -70,7 +70,7 @@ - + @@ -80,7 +80,7 @@ - + diff --git a/administrator/components/com_config/views/application/tmpl/config_metadata.php b/administrator/components/com_config/views/application/tmpl/config_metadata.php index b9c7fde2b8481..ef2886fa15ce9 100644 --- a/administrator/components/com_config/views/application/tmpl/config_metadata.php +++ b/administrator/components/com_config/views/application/tmpl/config_metadata.php @@ -10,7 +10,7 @@ - + @@ -20,7 +20,7 @@ - + @@ -30,7 +30,7 @@ - + lists['MetaTitle']; ?> @@ -40,7 +40,7 @@ - + lists['MetaAuthor']; ?> diff --git a/administrator/components/com_config/views/application/tmpl/navigation.php b/administrator/components/com_config/views/application/tmpl/config_navigation.php similarity index 100% rename from administrator/components/com_config/views/application/tmpl/navigation.php rename to administrator/components/com_config/views/application/tmpl/config_navigation.php diff --git a/administrator/components/com_config/views/application/tmpl/config_seo.php b/administrator/components/com_config/views/application/tmpl/config_seo.php index 18198f6d025c8..72b6918e4dae4 100644 --- a/administrator/components/com_config/views/application/tmpl/config_seo.php +++ b/administrator/components/com_config/views/application/tmpl/config_seo.php @@ -10,7 +10,7 @@ - + lists['sef']; ?> @@ -20,9 +20,9 @@ - + lists['sef_rewrite']; ?> - + @@ -33,7 +33,7 @@ - + lists['sef_suffix']; ?> diff --git a/administrator/components/com_config/views/application/tmpl/config_server.php b/administrator/components/com_config/views/application/tmpl/config_server.php index a83b2e81faf61..ad8a5d5d0bf6c 100644 --- a/administrator/components/com_config/views/application/tmpl/config_server.php +++ b/administrator/components/com_config/views/application/tmpl/config_server.php @@ -10,7 +10,7 @@ - + @@ -20,7 +20,7 @@ - + lists['gzip']; ?> @@ -30,7 +30,7 @@ - + lists['error_reporting']; ?> diff --git a/administrator/components/com_config/views/application/tmpl/config_session.php b/administrator/components/com_config/views/application/tmpl/config_session.php index dbf37c3c5afd4..b7a14c3d0d7ca 100644 --- a/administrator/components/com_config/views/application/tmpl/config_session.php +++ b/administrator/components/com_config/views/application/tmpl/config_session.php @@ -9,7 +9,7 @@ - +    @@ -20,7 +20,7 @@ - + lists['session_handlers']; ?> diff --git a/administrator/components/com_config/views/application/tmpl/config_site.php b/administrator/components/com_config/views/application/tmpl/config_site.php index bba58b4b2dc10..e821385ab63f4 100644 --- a/administrator/components/com_config/views/application/tmpl/config_site.php +++ b/administrator/components/com_config/views/application/tmpl/config_site.php @@ -11,7 +11,7 @@ - + lists['offline']; ?> @@ -21,7 +21,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -41,7 +41,7 @@ - + lists['editor']; ?> @@ -51,7 +51,7 @@ - + lists['list_limit']; ?> @@ -61,7 +61,7 @@ - + lists['feed_limit']; ?> diff --git a/administrator/components/com_config/views/application/tmpl/config_system.php b/administrator/components/com_config/views/application/tmpl/config_system.php index 0f693ee281b55..387ff227bf07f 100644 --- a/administrator/components/com_config/views/application/tmpl/config_system.php +++ b/administrator/components/com_config/views/application/tmpl/config_system.php @@ -10,7 +10,7 @@ - secret; ?> + row->secret; ?> @@ -20,7 +20,7 @@ - + @@ -30,7 +30,7 @@ - + lists['xmlrpc_server']; ?> @@ -40,7 +40,7 @@ - + lists['helpsites']; ?> diff --git a/administrator/components/com_config/views/application/tmpl/index.html b/administrator/components/com_config/views/application/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_config/views/application/tmpl/index.html +++ b/administrator/components/com_config/views/application/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_config/views/application/view.html.php b/administrator/components/com_config/views/application/view.html.php new file mode 100644 index 0000000000000..107247a8418fe --- /dev/null +++ b/administrator/components/com_config/views/application/view.html.php @@ -0,0 +1,226 @@ +setQuery($query); + $edits = $db->loadObjectList(); + + // -- Show/Hide -- + + $show_hide = array (JHTML::_('select.option', 1, JText::_('Hide')), JHTML::_('select.option', 0, JText::_('Show')),); + + $show_hide_r = array (JHTML::_('select.option', 0, JText::_('Hide')), JHTML::_('select.option', 1, JText::_('Show')),); + + // -- menu items -- + + $query = 'SELECT id AS value, name AS text FROM #__menu' + .' WHERE ( type="content_section" OR type="components" OR type="content_typed" )' + .' AND published = 1' + .' AND access = 0' + .' ORDER BY name' + ; + $db->setQuery($query); + $menuitems = array_merge($menuitems, $db->loadObjectList()); + + // SITE SETTINGS + $lists['offline'] = JHTML::_('select.booleanlist', 'offline', 'class="inputbox"', $row->offline); + if (!$row->editor) { + $row->editor = ''; + } + // build the html select list + $lists['editor'] = JHTML::_('select.genericlist', $edits, 'editor', 'class="inputbox" size="1"', 'value', 'text', $row->editor); + $listLimit = array (JHTML::_('select.option', 5, 5), JHTML::_('select.option', 10, 10), JHTML::_('select.option', 15, 15), JHTML::_('select.option', 20, 20), JHTML::_('select.option', 25, 25), JHTML::_('select.option', 30, 30), JHTML::_('select.option', 50, 50), JHTML::_('select.option', 100, 100),); + $lists['list_limit'] = JHTML::_('select.genericlist', $listLimit, 'list_limit', 'class="inputbox" size="1"', 'value', 'text', ($row->list_limit ? $row->list_limit : 50)); + + jimport('joomla.language.help'); + $helpsites = array (); + $helpsites = JHelp::createSiteList(JPATH_BASE.DS.'help'.DS.'helpsites-15.xml', $row->helpurl); + array_unshift($helpsites, JHTML::_('select.option', '', JText::_('local'))); + $lists['helpsites'] = JHTML::_('select.genericlist', $helpsites, 'helpurl', ' class="inputbox"', 'value', 'text', $row->helpurl); + + // DEBUG + $lists['debug'] = JHTML::_('select.booleanlist', 'debug', 'class="inputbox"', $row->debug); + $lists['debug_lang'] = JHTML::_('select.booleanlist', 'debug_lang', 'class="inputbox"', $row->debug_lang); + + // DATABASE SETTINGS + + // SERVER SETTINGS + $lists['gzip'] = JHTML::_('select.booleanlist', 'gzip', 'class="inputbox"', $row->gzip); + $errors = array (JHTML::_('select.option', -1, JText::_('System Default')), JHTML::_('select.option', 0, JText::_('None')), JHTML::_('select.option', E_ERROR | E_WARNING | E_PARSE, JText::_('Simple')), JHTML::_('select.option', E_ALL, JText::_('Maximum'))); + $lists['xmlrpc_server'] = JHTML::_('select.booleanlist', 'xmlrpc_server', 'class="inputbox"', $row->xmlrpc_server); + $lists['error_reporting'] = JHTML::_('select.genericlist', $errors, 'error_reporting', 'class="inputbox" size="1"', 'value', 'text', $row->error_reporting); + $lists['enable_ftp'] = JHTML::_('select.booleanlist', 'ftp_enable', 'class="inputbox"', intval($row->ftp_enable)); + + // LOCALE SETTINGS + $timeoffset = array ( JHTML::_('select.option', -12, JText::_('(UTC -12:00) International Date Line West')), + JHTML::_('select.option', -11, JText::_('(UTC -11:00) Midway Island, Samoa')), + JHTML::_('select.option', -10, JText::_('(UTC -10:00) Hawaii')), + JHTML::_('select.option', -9.5, JText::_('(UTC -09:30) Taiohae, Marquesas Islands')), + JHTML::_('select.option', -9, JText::_('(UTC -09:00) Alaska')), + JHTML::_('select.option', -8, JText::_('(UTC -08:00) Pacific Time (US & Canada)')), + JHTML::_('select.option', -7, JText::_('(UTC -07:00) Mountain Time (US & Canada)')), + JHTML::_('select.option', -6, JText::_('(UTC -06:00) Central Time (US & Canada), Mexico City')), + JHTML::_('select.option', -5, JText::_('(UTC -05:00) Eastern Time (US & Canada), Bogota, Lima')), + JHTML::_('select.option', -4, JText::_('(UTC -04:00) Atlantic Time (Canada), Caracas, La Paz')), + JHTML::_('select.option', -3.5, JText::_('(UTC -03:30) St. John\'s, Newfoundland, Labrador')), + JHTML::_('select.option', -3, JText::_('(UTC -03:00) Brazil, Buenos Aires, Georgetown')), + JHTML::_('select.option', -2, JText::_('(UTC -02:00) Mid-Atlantic')), + JHTML::_('select.option', -1, JText::_('(UTC -01:00) Azores, Cape Verde Islands')), + JHTML::_('select.option', 0, JText::_('(UTC 00:00) Western Europe Time, London, Lisbon, Casablanca')), + JHTML::_('select.option', 1, JText::_('(UTC +01:00) Amsterdam, Berlin, Brussels, Copenhagen, Madrid, Paris')), + JHTML::_('select.option', 2, JText::_('(UTC +02:00) Istanbul, Jerusalem, Kaliningrad, South Africa')), + JHTML::_('select.option', 3, JText::_('(UTC +03:00) Baghdad, Riyadh, Moscow, St. Petersburg')), + JHTML::_('select.option', 3.5, JText::_('(UTC +03:30) Tehran')), + JHTML::_('select.option', 4, JText::_('(UTC +04:00) Abu Dhabi, Muscat, Baku, Tbilisi')), + JHTML::_('select.option', 4.5, JText::_('(UTC +04:30) Kabul')), + JHTML::_('select.option', 5, JText::_('(UTC +05:00) Ekaterinburg, Islamabad, Karachi, Tashkent')), + JHTML::_('select.option', 5.5, JText::_('(UTC +05:30) Bombay, Calcutta, Madras, New Delhi')), + JHTML::_('select.option', 5.75, JText::_('(UTC +05:45) Kathmandu')), + JHTML::_('select.option', 6, JText::_('(UTC +06:00) Almaty, Dhaka, Colombo')), + JHTML::_('select.option', 6.30, JText::_('(UTC +06:30) Yagoon')), + JHTML::_('select.option', 7, JText::_('(UTC +07:00) Bangkok, Hanoi, Jakarta')), + JHTML::_('select.option', 8, JText::_('(UTC +08:00) Beijing, Perth, Singapore, Hong Kong')), + JHTML::_('select.option', 8.75, JText::_('(UTC +08:00) Western Australia')), + JHTML::_('select.option', 9, JText::_('(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk')), + JHTML::_('select.option', 9.5, JText::_('(UTC +09:30) Adelaide, Darwin, Yakutsk')), + JHTML::_('select.option', 10, JText::_('(UTC +10:00) Eastern Australia, Guam, Vladivostok')), + JHTML::_('select.option', 10.5, JText::_('(UTC +10:30) Lord Howe Island (Australia)')), + JHTML::_('select.option', 11, JText::_('(UTC +11:00) Magadan, Solomon Islands, New Caledonia')), + JHTML::_('select.option', 11.30, JText::_('(UTC +11:30) Norfolk Island')), + JHTML::_('select.option', 12, JText::_('(UTC +12:00) Auckland, Wellington, Fiji, Kamchatka')), + JHTML::_('select.option', 12.75, JText::_('(UTC +12:45) Chatham Island')), + JHTML::_('select.option', 13, JText::_('(UTC +13:00) Tonga')), + JHTML::_('select.option', 14, JText::_('(UTC +14:00) Kiribati')),); + $lists['offset'] = JHTML::_('select.genericlist', $timeoffset, 'offset', 'class="inputbox" size="1"', 'value', 'text', $row->offset); + + // MAIL SETTINGS + $mailer = array (JHTML::_('select.option', 'mail', JText::_('PHP mail function')), JHTML::_('select.option', 'sendmail', JText::_('Sendmail')), JHTML::_('select.option', 'smtp', JText::_('SMTP Server'))); + $lists['mailer'] = JHTML::_('select.genericlist', $mailer, 'mailer', 'class="inputbox" size="1"', 'value', 'text', $row->mailer); + $lists['smtpauth'] = JHTML::_('select.booleanlist', 'smtpauth', 'class="inputbox"', $row->smtpauth); + + // CACHE SETTINGS + $lists['caching'] = JHTML::_('select.booleanlist', 'caching', 'class="inputbox"', $row->caching); + jimport('joomla.cache.cache'); + $stores = JCache::getStores(); + $options = array(); + foreach($stores as $store) { + $options[] = JHTML::_('select.option', $store, JText::_(ucfirst($store)) ); + } + $lists['cache_handlers'] = JHTML::_('select.genericlist', $options, 'cache_handler', 'class="inputbox" size="1"', 'value', 'text', $row->cache_handler); + + // MEMCACHE SETTINGS + if (!empty($row->memcache_settings) && !is_array($row->memcache_settings)) { + $row->memcache_settings = unserialize(stripslashes($row->memcache_settings)); + } + $lists['memcache_persist'] = JHTML::_('select.booleanlist', 'memcache_settings[persistent]', 'class="inputbox"', @$row->memcache_settings['persistent']); + $lists['memcache_compress'] = JHTML::_('select.booleanlist', 'memcache_settings[compression]', 'class="inputbox"', @$row->memcache_settings['compression']); + + // META SETTINGS + $lists['MetaAuthor'] = JHTML::_('select.booleanlist', 'MetaAuthor', 'class="inputbox"', $row->MetaAuthor); + $lists['MetaTitle'] = JHTML::_('select.booleanlist', 'MetaTitle', 'class="inputbox"', $row->MetaTitle); + + // SEO SETTINGS + $lists['sef'] = JHTML::_('select.booleanlist', 'sef', 'class="inputbox"', $row->sef); + $lists['sef_rewrite'] = JHTML::_('select.booleanlist', 'sef_rewrite', 'class="inputbox"', $row->sef_rewrite); + $lists['sef_suffix'] = JHTML::_('select.booleanlist', 'sef_suffix', 'class="inputbox"', $row->sef_suffix); + + // FEED SETTINGS + $formats = array (JHTML::_('select.option', 'RSS2.0', JText::_('RSS')), JHTML::_('select.option', 'Atom', JText::_('Atom'))); + $summary = array (JHTML::_('select.option', 1, JText::_('Full Text')), JHTML::_('select.option', 0, JText::_('Intro Text')),); + $lists['feed_limit'] = JHTML::_('select.genericlist', $listLimit, 'feed_limit', 'class="inputbox" size="1"', 'value', 'text', ($row->feed_limit ? $row->feed_limit : 10)); + + // SESSION SETTINGS + $stores = JSession::getStores(); + $options = array(); + foreach($stores as $store) { + $options[] = JHTML::_('select.option', $store, JText::_(ucfirst($store)) ); + } + $lists['session_handlers'] = JHTML::_('select.genericlist', $options, 'session_handler', 'class="inputbox" size="1"', 'value', 'text', $row->session_handler); + + // Load component specific configurations + $table =& JTable::getInstance('component'); + $table->loadByOption( 'com_users' ); + $userparams = new JParameter( $table->params, JPATH_ADMINISTRATOR.DS.'components'.DS.'com_users'.DS.'config.xml' ); + $table->loadByOption( 'com_media' ); + $mediaparams = new JParameter( $table->params, JPATH_ADMINISTRATOR.DS.'components'.DS.'com_media'.DS.'config.xml' ); + + // Build the component's submenu + $submenu = $this->loadTemplate('navigation'); + + // Set document data + $document =& JFactory::getDocument(); + $document->setBuffer($submenu, 'modules', 'submenu'); + + // Load settings for the FTP layer + jimport('joomla.client.helper'); + $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); + + $this->assignRef('row', $row); + $this->assignRef('ftp', $ftp); + $this->assignRef('lists', $lists); + $this->assignRef('userparams', $userparams); + $this->assignRef('mediaparams', $mediaparams); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_config/views/application/view.php b/administrator/components/com_config/views/application/view.php deleted file mode 100644 index 642c112a37417..0000000000000 --- a/administrator/components/com_config/views/application/view.php +++ /dev/null @@ -1,131 +0,0 @@ -loadByOption( 'com_users' ); - $userparams = new JParameter( $table->params, JPATH_ADMINISTRATOR.DS.'components'.DS.'com_users'.DS.'config.xml' ); - $table->loadByOption( 'com_media' ); - $mediaparams = new JParameter( $table->params, JPATH_ADMINISTRATOR.DS.'components'.DS.'com_media'.DS.'config.xml' ); - - // Build the component's submenu - $contents = ''; - $tmplpath = dirname(__FILE__).DS.'tmpl'; - ob_start(); - require_once($tmplpath.DS.'navigation.php'); - $contents = ob_get_contents(); - ob_end_clean(); - - // Set document data - $document =& JFactory::getDocument(); - $document->setBuffer($contents, 'modules', 'submenu'); - - // Load settings for the FTP layer - jimport('joomla.client.helper'); - $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); - ?> -
    - -
    -
    - - - - - -
    - - - - -
    -
    -
    - - - - - -
    - -
    - - render('userparams'); ?> -
    -
    - - render('mediaparams'); ?> -
    -
    - - - -
    -
    -
    - - - - - -
    - - - - - - -
    -
    -
    -
    - - - - - - - -
    - '; - - return $tip; - } -} diff --git a/administrator/components/com_config/views/component/index.html b/administrator/components/com_config/views/component/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_config/views/component/index.html +++ b/administrator/components/com_config/views/component/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_config/views/component/tmpl/default.php b/administrator/components/com_config/views/component/tmpl/default.php new file mode 100644 index 0000000000000..efbe5632a7348 --- /dev/null +++ b/administrator/components/com_config/views/component/tmpl/default.php @@ -0,0 +1,31 @@ + + +
    +
    +
    + + +
    +
    + component->name) ?> +
    +
    + +
    + + + + params->render();?> +
    + + + + + + + + + +
    diff --git a/administrator/components/com_config/views/component/tmpl/index.html b/administrator/components/com_config/views/component/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_config/views/component/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_config/views/component/view.php b/administrator/components/com_config/views/component/view.php index 5fa076becb261..bfd33a9ca1cd5 100644 --- a/administrator/components/com_config/views/component/view.php +++ b/administrator/components/com_config/views/component/view.php @@ -26,7 +26,7 @@ class ConfigViewComponent extends JView /** * Display the view */ - function display() + function display($tpl = null) { $model = &$this->getModel(); $params = &$model->getParams(); @@ -35,36 +35,10 @@ function display() $document = & JFactory::getDocument(); $document->setTitle( JText::_('Edit Preferences') ); JHTML::_('behavior.tooltip'); -?> -
    -
    -
    - - -
    -
    - component->name) ?> -
    -
    -
    - - - - render();?> -
    + $this->assignRef('params', $params); + $this->assignRef('component', $component); - - - - - - - - -
    - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_contact/admin.contact.html.php b/administrator/components/com_contact/admin.contact.html.php deleted file mode 100644 index 9876ed1931aab..0000000000000 --- a/administrator/components/com_contact/admin.contact.html.php +++ /dev/null @@ -1,476 +0,0 @@ - -
    - - - - - - -
    - : - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - id ); - - $checked = JHTML::_('grid.checkedout', $row, $i ); - $access = JHTML::_('grid.access', $row, $i ); - $published = JHTML::_('grid.published', $row, $i ); - - $row->cat_link = JRoute::_( 'index.php?option=com_categories§ion=com_contact_details&task=edit&type=other&cid[]='. $row->catid ); - $row->user_link = JRoute::_( 'index.php?option=com_users&task=editA&cid[]='. $row->user_id ); - ?> - "> - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - -
    - getListFooter(); ?> -
    - getRowOffset( $i ); ?> - - - - get ('id'), $row->checked_out )) : - echo $row->name; - else : - ?> - - - name; ?> - - - - - orderUpIcon( $i, ( $row->catid == @$rows[$i-1]->catid ), 'orderup', 'Move Up', $ordering ); ?> - orderDownIcon( $i, $n, ( $row->catid == @$rows[$i+1]->catid ), 'orderdown', 'Move Down', $ordering ); ?> - - class="text_area" style="text-align: center" /> - - - - - category; ?> - - - user; ?> - - id; ?> -
    - - - - - - - -
    - image == '') { - $row->image = 'blank.png'; - } - - JHTML::_('behavior.tooltip'); - jimport('joomla.html.pane'); - $pane =& JPane::getInstance('sliders'); - - JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'misc' ); - $cparams = JComponentHelper::getParams ('com_media'); - ?> - - -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id) { - ?> - - - - - -
    - - - -
    - - - -
    - : - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - id;?> -
    -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - - - -
    - -
    -
    -
    - -
    -
    - - - startPane("menu-pane"); - echo $pane->startPanel(JText :: _('Contact Parameters'), "param-page"); - echo $params->render(); - echo $pane->endPanel(); - echo $pane->startPanel(JText :: _('Advanced Parameters'), "param-page"); - echo $params->render('params', 'advanced'); - echo $pane->endPanel(); - echo $pane->startPanel(JText :: _('E-mail Parameters'), "param-page"); - echo $params->render('params', 'email'); - echo $pane->endPanel(); - echo $pane->endPane(); - ?>
    -
    -
    - - - - - - -
    - authorize( 'com_contact', 'manage' )) { - $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); -} - -require_once( JApplicationHelper::getPath( 'admin_html' ) ); -// Set the table directory -JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_contact'.DS.'tables'); - -$task = JRequest::getCmd('task'); -$id = JRequest::getVar('id', 0, 'get', 'int'); -$cid = JRequest::getVar('cid', array(0), 'post', 'array'); -JArrayHelper::toInteger($cid, array(0)); - -switch ($task) -{ - case 'add' : - editContact(false ); - break; - case 'edit': - editContact(true); - break; - - case 'apply': - case 'save': - case 'save2new': - case 'save2copy': - saveContact( $task ); - break; - - case 'remove': - removeContacts( $cid ); - break; - - case 'publish': - changeContact( $cid, 1 ); - break; - - case 'unpublish': - changeContact( $cid, 0 ); - break; - - case 'orderup': - orderContacts( $cid[0], -1 ); - break; - - case 'orderdown': - orderContacts( $cid[0], 1 ); - break; - - case 'accesspublic': - changeAccess( $cid[0], 0 ); - break; - - case 'accessregistered': - changeAccess( $cid[0], 1 ); - break; - - case 'accessspecial': - changeAccess( $cid[0], 2 ); - break; - - case 'saveorder': - saveOrder( $cid ); - break; - - case 'cancel': - cancelContact(); - break; - - default: - showContacts( $option ); - break; -} - -/** -* List the records -* @param string The current GET/POST option -*/ -function showContacts( $option ) -{ - global $mainframe; - - $db =& JFactory::getDBO(); - $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'cd.ordering', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); - $filter_state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); - $filter_catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' ); - $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); - $search = JString::strtolower( $search ); - - $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); - $limitstart = $mainframe->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int'); - - $where = array(); - - if ( $search ) { - $where[] = 'cd.name LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); - } - if ( $filter_catid ) { - $where[] = 'cd.catid = '.(int) $filter_catid; - } - if ( $filter_state ) { - if ( $filter_state == 'P' ) { - $where[] = 'cd.published = 1'; - } else if ($filter_state == 'U' ) { - $where[] = 'cd.published = 0'; - } - } - - $where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' ); - if ($filter_order == 'cd.ordering'){ - $orderby = ' ORDER BY category, cd.ordering'; - } else { - $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', category, cd.ordering'; - } - - // get the total number of records - $query = 'SELECT COUNT(*)' - . ' FROM #__contact_details AS cd' - . $where - ; - $db->setQuery( $query ); - $total = $db->loadResult(); - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $total, $limitstart, $limit ); - - // get the subset (based on limits) of required records - $query = 'SELECT cd.*, cc.title AS category, u.name AS user, v.name as editor, g.name AS groupname' - . ' FROM #__contact_details AS cd' - . ' LEFT JOIN #__groups AS g ON g.id = cd.access' - . ' LEFT JOIN #__categories AS cc ON cc.id = cd.catid' - . ' LEFT JOIN #__users AS u ON u.id = cd.user_id' - . ' LEFT JOIN #__users AS v ON v.id = cd.checked_out' - . $where - . $orderby - ; - $db->setQuery( $query, $pageNav->limitstart, $pageNav->limit ); - $rows = $db->loadObjectList(); - - // build list of categories - $javascript = 'onchange="document.adminForm.submit();"'; - $lists['catid'] = JHTML::_('list.category', 'filter_catid', 'com_contact_details', intval( $filter_catid ), $javascript ); - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - HTML_contact::showcontacts( $rows, $pageNav, $option, $lists ); -} - -/** -* Creates a new or edits and existing user record -* @param int The id of the record, 0 if a new entry -* @param string The current GET/POST option -*/ -function editContact($edit ) -{ - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - $cid = JRequest::getVar('cid', array(0), '', 'array'); - $option = JRequest::getCmd('option'); - - JArrayHelper::toInteger($cid, array(0)); - - $row =& JTable::getInstance('contact', 'Table'); - // load the row from the db table - if($edit) - $row->load( $cid[0] ); - - if ($edit) { - // do stuff for existing records - $row->checkout($user->get('id')); - } else { - // do stuff for new records - $row->imagepos = 'top'; - $row->ordering = 0; - $row->published = 1; - } - $lists = array(); - - // build the html select list for ordering - $query = 'SELECT ordering AS value, name AS text' - . ' FROM #__contact_details' - . ' WHERE published >= 0' - . ' AND catid = '.(int) $row->catid - . ' ORDER BY ordering' - ; - if($edit) - $lists['ordering'] = JHTML::_('list.specificordering', $row, $cid[0], $query ); - else - $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query ); - - // build list of users - $lists['user_id'] = JHTML::_('list.users', 'user_id', $row->user_id, 1, NULL, 'name', 0 ); - // build list of categories - $lists['catid'] = JHTML::_('list.category', 'catid', 'com_contact_details', intval( $row->catid ) ); - // build the html select list for images - $lists['image'] = JHTML::_('list.images', 'image', $row->image ); - // build the html select list for the group access - $lists['access'] = JHTML::_('list.accesslevel', $row ); - // build the html radio buttons for published - $lists['published'] = JHTML::_('select.booleanlist', 'published', '', $row->published ); - // build the html radio buttons for default - $lists['default_con'] = JHTML::_('select.booleanlist', 'default_con', '', $row->default_con ); - - // get params definitions - $file = JPATH_ADMINISTRATOR .'/components/com_contact/contact_items.xml'; - $params = new JParameter( $row->params, $file, 'component' ); - - HTML_contact::editcontact( $row, $lists, $option, $params ); -} - -/** -* Saves the record from an edit form submit -* @param string The current GET/POST option -*/ -function saveContact( $task ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - $row =& JTable::getInstance('contact', 'Table'); - $post = JRequest::get( 'post' ); - $post['misc'] = JRequest::getVar('misc', '', 'POST', 'string', JREQUEST_ALLOWHTML); - if (!$row->bind( $post )) { - JError::raiseError(500, $row->getError() ); - } - // save params - $params = JRequest::getVar( 'params', array(), 'post', 'array' ); - if (is_array( $params )) { - $txt = array(); - foreach ( $params as $k=>$v) { - $txt[] = "$k=$v"; - } - $row->params = implode( "\n", $txt ); - } - - // save to a copy, reset the primary key - if ($task == 'save2copy') { - $row->id = 0; - } - - // pre-save checks - if (!$row->check()) { - JError::raiseError(500, $row->getError() ); - } - - // if new item, order last in appropriate group - if (!$row->id) { - $where = "catid = " . (int) $row->catid; - $row->ordering = $row->getNextOrder( $where ); - } - - // save the changes - if (!$row->store()) { - JError::raiseError(500, $row->getError() ); - } - $row->checkin(); - if ($row->default_con) { - $query = 'UPDATE #__contact_details' - . ' SET default_con = 0' - . ' WHERE id <> '. (int) $row->id - . ' AND default_con = 1' - ; - $db->setQuery( $query ); - $db->query(); - } - - switch ($task) - { - case 'apply': - case 'save2copy': - $msg = JText::sprintf( 'Changes to X saved', 'Contact' ); - $link = 'index.php?option=com_contact&task=edit&cid[]='. $row->id .''; - break; - - case 'save2new': - $msg = JText::sprintf( 'Changes to X saved', 'Contact' ); - $link = 'index.php?option=com_contact&task=edit'; - break; - - case 'save': - default: - $msg = JText::_( 'Contact saved' ); - $link = 'index.php?option=com_contact'; - break; - } - - $mainframe->redirect( $link, $msg ); -} - -/** -* Removes records -* @param array An array of id keys to remove -* @param string The current GET/POST option -*/ -function removeContacts( &$cid ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - JArrayHelper::toInteger($cid); - - if (count( $cid )) { - $cids = implode( ',', $cid ); - $query = 'DELETE FROM #__contact_details' - . ' WHERE id IN ( '. $cids .' )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - echo "\n"; - } - } - - $mainframe->redirect( "index.php?option=com_contact" ); -} - -/** -* Changes the state of one or more content pages -* @param array An array of unique category id numbers -* @param integer 0 if unpublishing, 1 if publishing -* @param string The current option -*/ -function changeContact( $cid=null, $state=0 ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - JArrayHelper::toInteger($cid); - - if (count( $cid ) < 1) { - $action = $state ? 'publish' : 'unpublish'; - JError::raiseError(500, JText::_( 'Select an item to' .$action, true ) ); - } - - $cids = implode( ',', $cid ); - - $query = 'UPDATE #__contact_details' - . ' SET published = ' . (int) $state - . ' WHERE id IN ( '. $cids .' )' - . ' AND ( checked_out = 0 OR ( checked_out = '. (int) $user->get('id') .' ) )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - JError::raiseError(500, $db->getErrorMsg() ); - } - - if (count( $cid ) == 1) { - $row =& JTable::getInstance('contact', 'Table'); - $row->checkin( intval( $cid[0] ) ); - } - - $mainframe->redirect( 'index.php?option=com_contact' ); -} - -/** JJC -* Moves the order of a record -* @param integer The increment to reorder by -*/ -function orderContacts( $uid, $inc ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - - $row =& JTable::getInstance('contact', 'Table'); - $row->load( $uid ); - $row->move( $inc, 'catid = '. (int) $row->catid .' AND published != 0' ); - - $mainframe->redirect( 'index.php?option=com_contact' ); -} - -/** PT -* Cancels editing and checks in the record -*/ -function cancelContact() -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - $row =& JTable::getInstance('contact', 'Table'); - $row->bind( JRequest::get( 'post' )); - $row->checkin(); - - $mainframe->redirect('index.php?option=com_contact'); -} - -/** -* changes the access level of a record -* @param integer The increment to reorder by -*/ -function changeAccess( $id, $access ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - - $row =& JTable::getInstance('contact', 'Table'); - $row->load( $id ); - $row->access = $access; - - if ( !$row->check() ) { - return $row->getError(); - } - if ( !$row->store() ) { - return $row->getError(); - } - - $mainframe->redirect( 'index.php?option=com_contact' ); -} - -function saveOrder( &$cid ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - $total = count( $cid ); - $order = JRequest::getVar( 'order', array(0), 'post', 'array' ); - JArrayHelper::toInteger($order, array(0)); - - $row =& JTable::getInstance('contact', 'Table'); - $groupings = array(); - - // update ordering values - for( $i=0; $i < $total; $i++ ) { - $row->load( (int) $cid[$i] ); - // track categories - $groupings[] = $row->catid; - - if ($row->ordering != $order[$i]) { - $row->ordering = $order[$i]; - if (!$row->store()) { - //TODO - convert to JError - JError::raiseError(500, $db->getErrorMsg() ); - } - } - } - - // execute updateOrder for each parent group - $groupings = array_unique( $groupings ); - foreach ($groupings as $group){ - $row->reorder('catid = '.(int) $group); - } - - $msg = 'New ordering saved'; - $mainframe->redirect( 'index.php?option=com_contact', $msg ); -} diff --git a/administrator/components/com_contact/contact.php b/administrator/components/com_contact/contact.php new file mode 100644 index 0000000000000..438db1f054ff7 --- /dev/null +++ b/administrator/components/com_contact/contact.php @@ -0,0 +1,33 @@ +authorize('com_contact', 'manage')) { + $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH')); +} + +// Require the base controller +require_once JPATH_COMPONENT.DS.'controller.php'; + +$controller = new ContactsController(); + +// Perform the Request task +$controller->execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_contact/contact.xml b/administrator/components/com_contact/contact.xml index 9a7b1f3a06997..c57f498ebbe2e 100644 --- a/administrator/components/com_contact/contact.xml +++ b/administrator/components/com_contact/contact.xml @@ -2,7 +2,7 @@ Contact Joomla! Project - Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + (C) 2005 - 2007 Open Source Matters. All rights reserved. April 2006 http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL admin@joomla.org diff --git a/administrator/components/com_contact/controller.php b/administrator/components/com_contact/controller.php new file mode 100644 index 0000000000000..7f8074247a259 --- /dev/null +++ b/administrator/components/com_contact/controller.php @@ -0,0 +1,282 @@ +registerTask( 'add', 'display' ); + $this->registerTask( 'edit', 'display' ); + } + + function display( ) + { + switch($this->getTask()) + { + case 'add': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'contact'); + JRequest::setVar( 'edit', false ); + + // Checkout the contact + $model = $this->getModel('contact'); + $model->checkout(); + } break; + case 'edit': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'contact'); + JRequest::setVar( 'edit', true ); + + // Checkout the contact + $model = $this->getModel('contact'); + $model->checkout(); + } break; + } + + parent::display(); + } + + function save() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $post = JRequest::get('post'); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $post['id'] = (int) $cid[0]; + + $model = $this->getModel('contact'); + + if ($model->store($post)) { + $msg = JText::_( 'Contact Saved' ); + } else { + $msg = JText::_( 'Error Saving Contact' ); + } + + // Check the table in so it can be edited.... we are done with it anyway + $model->checkin(); + $link = 'index.php?option=com_contact'; + $this->setRedirect($link, $msg); + } + + function remove() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to delete' ) ); + } + + $model = $this->getModel('contact'); + if(!$model->delete($cid)) { + echo "\n"; + } + + $this->setRedirect( 'index.php?option=com_contact' ); + } + + + function publish() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to publish' ) ); + } + + $model = $this->getModel('contact'); + if(!$model->publish($cid, 1)) { + echo "\n"; + } + + $this->setRedirect( 'index.php?option=com_contact' ); + } + + + function unpublish() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to unpublish' ) ); + } + + $model = $this->getModel('contact'); + if(!$model->publish($cid, 0)) { + echo "\n"; + } + + $this->setRedirect( 'index.php?option=com_contact' ); + } + + function cancel() + { + // Checkin the contact + $model = $this->getModel('contact'); + $model->checkin(); + + $this->setRedirect( 'index.php?option=com_contact' ); + } + + + function orderup() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $model = $this->getModel('contact'); + $model->move(-1); + + $this->setRedirect( 'index.php?option=com_contact'); + } + + function orderdown() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $model = $this->getModel('contact'); + $model->move(1); + + $this->setRedirect( 'index.php?option=com_contact'); + } + + function saveorder() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + $order = JRequest::getVar( 'order', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + JArrayHelper::toInteger($order); + + $model = $this->getModel('contact'); + $model->saveorder($cid, $order); + + $msg = 'New ordering saved'; + $this->setRedirect( 'index.php?option=com_contact', $msg ); + } + + function accesspublic() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('contact'); + if(!$model->setAccess($cid, 0)) { + $msg = $model->getError(); + } + + $this->setRedirect( 'index.php?option=com_contact', $msg ); + } + + function accessregistered() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('contact'); + if(!$model->setAccess($cid, 1)) { + $msg = $model->getError(); + } + + $this->setRedirect( 'index.php?option=com_contact', $msg ); + } + + function accessspecial() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('contact'); + if(!$model->setAccess($cid, 2)) { + $msg = $model->getError(); + } + + $this->setRedirect( 'index.php?option=com_contact', $msg ); + } + +} \ No newline at end of file diff --git a/administrator/components/com_contact/elements/index.html b/administrator/components/com_contact/elements/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_contact/elements/index.html +++ b/administrator/components/com_contact/elements/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_contact/helpers/index.html b/administrator/components/com_contact/helpers/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/administrator/components/com_contact/helpers/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_contact/helpers/vcard.php b/administrator/components/com_contact/helpers/vcard.php deleted file mode 100644 index c102f15463fc2..0000000000000 --- a/administrator/components/com_contact/helpers/vcard.php +++ /dev/null @@ -1,94 +0,0 @@ -properties["N"] = "$family;$first;$additional;$prefix;$suffix"; - $this->setFormattedName( trim( "$prefix $first $additional $family $suffix" ) ); - } - - // needed to fix bug in vcard class - function setAddress( $postoffice='', $extended='', $street='', $city='', $region='', $zip='', $country='', $type='HOME;POSTAL' ) { - // $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL" - $separator = ';'; - - $key = 'ADR'; - if ( $type != '' ) { - $key .= $separator . $type; - } - $key.= ';ENCODING=QUOTED-PRINTABLE'; - - $return = encode( $postoffice ); - $return .= $separator . encode( $extended ); - $return .= $separator . encode( $street ); - $return .= $separator . encode( $city ); - $return .= $separator . encode( $region); - $return .= $separator . encode( $zip ); - $return .= $separator . encode( $country ); - - $this->properties[$key] = $return; - } - - // added ability to set filename - function setFilename( $filename ) { - $this->filename = $filename .'.vcf'; - } - - // added ability to set position/title - function setTitle( $title ) { - $title = trim( $title ); - - $this->properties['TITLE'] = $title; - } - - // added ability to set organisation/company - function setOrg( $org ) { - $org = trim( $org ); - - $this->properties['ORG'] = $org; - } - - function getVCard( $sitename ) { - $text = 'BEGIN:VCARD'; - $text .= "\r\n"; - $text .= 'VERSION:2.1'; - $text .= "\r\n"; - - foreach( $this->properties as $key => $value ) { - $text .= "$key:$value"; - $text .= "\r\n"; - } - $text .= 'REV:'. date( 'Y-m-d' ) .'T'. date( 'H:i:s' ). 'Z'; - $text .= "\r\n"; - $text .= 'MAILER: Joomla! vCard for '. $sitename; - $text .= "\r\n"; - $text .= 'END:VCARD'; - $text .= "\r\n"; - - return $text; - } -} \ No newline at end of file diff --git a/administrator/components/com_contact/index.html b/administrator/components/com_contact/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_contact/index.html +++ b/administrator/components/com_contact/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_contact/models/contact.php b/administrator/components/com_contact/models/contact.php new file mode 100644 index 0000000000000..5d3d976b99e40 --- /dev/null +++ b/administrator/components/com_contact/models/contact.php @@ -0,0 +1,439 @@ +setId((int)$array[0]); + } + + /** + * Method to set the contact identifier + * + * @access public + * @param int Contact identifier + */ + function setId($id) + { + // Set contact id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a contact + * + * @since 1.5 + */ + function &getData() + { + // Load the contact data + if ($this->_loadData()) + { + // Initialize some variables + $user = &JFactory::getUser(); + + // Check to see if the category is published + if (!$this->_data->cat_pub) { + JError::raiseError( 404, JText::_("Resource Not Found") ); + return; + } + + // Check whether category access level allows access + if ($this->_data->cat_access > $user->get('aid', 0)) { + JError::raiseError( 403, JText::_('ALERTNOTAUTH') ); + return; + } + } + else $this->_initData(); + + return $this->_data; + } + + /** + * Tests if contact is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.5 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_loadData()) + { + if ($uid) { + return ($this->_data->checked_out && $this->_data->checked_out != $uid); + } else { + return $this->_data->checked_out; + } + } + } + + /** + * Method to checkin/unlock the contact + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function checkin() + { + if ($this->_id) + { + $contact = & $this->getTable(); + if(! $contact->checkin($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return false; + } + + /** + * Method to checkout/lock the contact + * + * @access public + * @param int $uid User ID of the user checking the contact out + * @return boolean True on success + * @since 1.5 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the contact with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $contact = & $this->getTable(); + if(!$contact->checkout($uid, $this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + return false; + } + + /** + * Method to store the contact + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function store($data) + { + $row =& $this->getTable(); + + // Bind the form fields to the web link table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // if new item, order last in appropriate group + if (!$row->id) { + $where = 'catid = ' . (int) $row->catid ; + $row->ordering = $row->getNextOrder( $where ); + } + + // Make sure the web link table is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the web link table to the database + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if ($row->default_con) { + $query = 'UPDATE #__contact_details' + . ' SET default_con = 0' + . ' WHERE id <> '. (int) $row->id + . ' AND default_con = 1' + ; + $db->setQuery( $query ); + $db->query(); + } + + return true; + } + + /** + * Method to remove a contact + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__contact_details' + . ' WHERE id IN ( '.$cids.' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to (un)publish a contact + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function publish($cid = array(), $publish = 1) + { + $user =& JFactory::getUser(); + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__contact_details' + . ' SET published = '.(int) $publish + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to move a contact + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function move($direction) + { + $row =& $this->getTable(); + if (!$row->load($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if (!$row->move( $direction, ' catid = '.(int) $row->catid.' AND published >= 0 ' )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to move a contact + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function saveorder($cid = array(), $order) + { + $row =& $this->getTable(); + $groupings = array(); + + // update ordering values + for( $i=0; $i < count($cid); $i++ ) + { + $row->load( (int) $cid[$i] ); + // track categories + $groupings[] = $row->catid; + + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + } + + // execute updateOrder for each parent group + $groupings = array_unique( $groupings ); + foreach ($groupings as $group){ + $row->reorder('catid = '.(int) $group); + } + + return true; + } + + /** + * Method to load contact data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = 'SELECT c.*, cc.title AS category,'. + ' cc.published AS cat_pub, cc.access AS cat_access'. + ' FROM #__contact_details AS c' . + ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . + ' WHERE c.id = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the contact data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $contact = new stdClass(); + $contact->id = 0; + $contact->catid = 0; + $contact->user_id = 0; + $contact->name = null; + $contact->alias = null; + $contact->con_position = null; + $contact->address = null; + $contact->suburb = null; + $contact->state = null; + $contact->country = null; + $contact->postcode = null; + $contact->telephone = null; + $contact->fax = null; + $contact->misc = null; + $contact->image = null; + $contact->imagepos = null; + $contact->email_to = null; + $contact->default_con = null; + $contact->mobile = null; + $contact->webpage = null; + $contact->access = 0; + $contact->published = 0; + $contact->checked_out = 0; + $contact->checked_out_time = 0; + $contact->ordering = 0; + $contact->archived = 0; + $contact->approved = 0; + $contact->params = null; + $contact->category = null; + $this->_data = $contact; + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to set the contact access + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function setAccess($cid = array(), $access = 0) + { + if (count( $cid )) + { + $user =& JFactory::getUser(); + + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__contact_details' + . ' SET access = '.(int) $access + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_contact/contact_items.xml b/administrator/components/com_contact/models/contact.xml similarity index 96% rename from administrator/components/com_contact/contact_items.xml rename to administrator/components/com_contact/models/contact.xml index e2e60e1ad48f7..3ed0dfce9b13e 100644 --- a/administrator/components/com_contact/contact_items.xml +++ b/administrator/components/com_contact/models/contact.xml @@ -2,7 +2,7 @@ Contact Items Joomla! Project - Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + (C) 2005 Open Source Matters. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL admin@joomla.org www.joomla.org diff --git a/administrator/components/com_contact/models/contacts.php b/administrator/components/com_contact/models/contacts.php new file mode 100644 index 0000000000000..35b7869c78fdf --- /dev/null +++ b/administrator/components/com_contact/models/contacts.php @@ -0,0 +1,207 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'a.ordering', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter->catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' ); + $filter->search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $this->_filter = $filter; + } + + /** + * Method to get contacts item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_data; + } + + /** + * Method to get the total number of contact items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the contacts + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the contacts + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = ' SELECT a.*, cc.title AS category, u.name AS editor, g.name AS groupname, v.name AS user ' + . ' FROM #__contact_details AS a ' + . ' LEFT JOIN #__categories AS cc ON cc.id = a.catid ' + . ' LEFT JOIN #__users AS u ON u.id = a.checked_out ' + . ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = a.access' + . ' LEFT JOIN #__users AS v ON v.id = a.user_id' + . $where + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy() + { + global $mainframe, $option; + + if ($this->_filter->order == 'a.ordering'){ + $orderby = ' ORDER BY category, a.ordering '.$this->_filter->order_Dir; + } else { + $orderby = ' ORDER BY '.$this->_filter->order.' '.$this->_filter->order_Dir.' , category, a.ordering '; + } + + return $orderby; + } + + function _buildContentWhere() + { + global $mainframe, $option; + + $search = JString::strtolower( $this->_filter->search ); + + $where = array(); + + if ($this->_filter->catid > 0) { + $where[] = 'a.catid = '.(int) $this->_filter->catid; + } + if ($search) { + $where[] = 'LOWER(a.name) LIKE '.$this->_db->Quote('%'.$this->_db->getEscaped( $search, true ).'%', false); + } + if ( $this->_filter->state ) { + if ( $this->_filter->state == 'P' ) { + $where[] = 'a.published = 1'; + } else if ($this->_filter->state == 'U' ) { + $where[] = 'a.published = 0'; + } + } + + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + + return $where; + } +} \ No newline at end of file diff --git a/administrator/components/com_contact/models/index.html b/administrator/components/com_contact/models/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contact/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contact/tables/contact.php b/administrator/components/com_contact/tables/contact.php index b7b9c22399ac2..d3f4cd4826c51 100644 --- a/administrator/components/com_contact/tables/contact.php +++ b/administrator/components/com_contact/tables/contact.php @@ -116,4 +116,4 @@ function check() return true; } -} +} \ No newline at end of file diff --git a/administrator/components/com_contact/tables/index.html b/administrator/components/com_contact/tables/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_contact/tables/index.html +++ b/administrator/components/com_contact/tables/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_contact/toolbar.contact.html.php b/administrator/components/com_contact/toolbar.contact.html.php deleted file mode 100644 index 9bd0d3c4b7230..0000000000000 --- a/administrator/components/com_contact/toolbar.contact.html.php +++ /dev/null @@ -1,59 +0,0 @@ -[ '. $text .' ]', 'generic.png' ); - - //JToolBarHelper::custom( 'save2new', 'new.png', 'new_f2.png', 'Save & New', false, false ); - //JToolBarHelper::custom( 'save2copy', 'copy.png', 'copy_f2.png', 'Save To Copy', false, false ); - JToolBarHelper::save(); - JToolBarHelper::apply(); - if ( $edit ) { - // for existing items the button is renamed `close` - JToolBarHelper::cancel( 'cancel', 'Close' ); - } else { - JToolBarHelper::cancel(); - } - JToolBarHelper::help( 'screen.contactmanager.edit' ); - } - - function _DEFAULT() { - - JToolBarHelper::title( JText::_( 'Contact Manager' ), 'generic.png' ); - JToolBarHelper::publishList(); - JToolBarHelper::unpublishList(); - JToolBarHelper::deleteList(); - JToolBarHelper::editListX(); - JToolBarHelper::addNewX(); - JToolBarHelper::preferences('com_contact', '500'); - - JToolBarHelper::help( 'screen.contactmanager' ); - } -} \ No newline at end of file diff --git a/administrator/components/com_contact/toolbar.contact.php b/administrator/components/com_contact/toolbar.contact.php deleted file mode 100644 index 39297ddb22097..0000000000000 --- a/administrator/components/com_contact/toolbar.contact.php +++ /dev/null @@ -1,33 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_contact/views/contact/tmpl/default.php b/administrator/components/com_contact/views/contact/tmpl/default.php new file mode 100644 index 0000000000000..a377b17c98bda --- /dev/null +++ b/administrator/components/com_contact/views/contact/tmpl/default.php @@ -0,0 +1,299 @@ + + + + + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + contact->id) { + ?> + + + + + +
    + + + +
    + + + +
    + : + + contact->published ); ?> +
    + + + contact->catid ) ); ?> +
    + + + contact->user_id, 1, NULL, 'name', 0 ); ?> +
    + + + contact, $this->contact->id, $this->order_query, 1 ); ?> +
    + + + contact ); ?> +
    + + + contact->id;?> +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + contact->image ); ?> +
    + contact->image != 'blank.png') { + $path.= 'stories/'; + } + ?> + <?php echo JText::_( 'Preview' ); ?> +
    +
    +
    + +
    +
    + + + startPane("menu-pane"); + echo $pane->startPanel(JText :: _('Contact Parameters'), "param-page"); + echo $this->params->render(); + echo $pane->endPanel(); + echo $pane->startPanel(JText :: _('Advanced Parameters'), "param-page"); + echo $this->params->render('params', 'advanced'); + echo $pane->endPanel(); + echo $pane->startPanel(JText :: _('E-mail Parameters'), "param-page"); + echo $this->params->render('params', 'email'); + echo $pane->endPanel(); + echo $pane->endPane(); + ?>
    +
    +
    + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_contact/views/contact/tmpl/index.html b/administrator/components/com_contact/views/contact/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contact/views/contact/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contact/views/contact/view.html.php b/administrator/components/com_contact/views/contact/view.html.php new file mode 100644 index 0000000000000..3cb661d77dbd8 --- /dev/null +++ b/administrator/components/com_contact/views/contact/view.html.php @@ -0,0 +1,101 @@ +getModel(); + + // Set toolbar items for the page + JRequest::setVar( 'hidemainmenu', 1 ); + + $edit = JRequest::getVar('edit',true); + $text = !$edit ? JText::_( 'New' ) : JText::_( 'Edit' ); + JToolBarHelper::title( JText::_( 'Contact' ).': [ ' . $text.' ]' ); + JToolBarHelper::save(); + if (!$edit) { + JToolBarHelper::cancel(); + } else { + // for existing items the button is renamed `close` + JToolBarHelper::cancel( 'cancel', 'Close' ); + } + JToolBarHelper::help( 'screen.contact.edit' ); + + //get the contact + $contact =& $this->get('data'); + $isNew = ($contact->id < 1); + + // fail if checked out not by 'me' + if ($model->isCheckedOut( $user->get('id') )) { + $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The contact' ), $contact->name ); + $mainframe->redirect( 'index.php?option='. $option, $msg ); + } + + // Edit or Create? + if (!$isNew) + { + $model->checkout( $user->get('id') ); + } + else + { + // initialise new record + $contact->published = 1; + $contact->approved = 1; + $contact->order = 0; + $contact->catid = JRequest::getVar( 'catid', 0, 'post', 'int' ); + } + + // build the html select list for ordering + $order_query = 'SELECT ordering AS value, name AS text' + . ' FROM #__contact_details' + . ' WHERE catid = ' . (int) $contact->catid + . ' ORDER BY ordering'; + + //clean data + JFilterOutput::objectHTMLSafe( $contact, ENT_QUOTES, 'description' ); + JFilterOutput::objectHTMLSafe( $contact, ENT_QUOTES, 'misc' ); + + if ('' == $contact->image) { + $contact->image = 'blank.png'; + } + + $file = JPATH_COMPONENT.DS.'models'.DS.'contact.xml'; + $params = new JParameter( $contact->params, $file ); + + $this->assignRef('contact', $contact); + $this->assignRef('params', $params); + $this->assignRef('order_query', $order_query); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_contact/views/contacts/index.html b/administrator/components/com_contact/views/contacts/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contact/views/contacts/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contact/views/contacts/tmpl/default.php b/administrator/components/com_contact/views/contacts/tmpl/default.php new file mode 100644 index 0000000000000..1f01079039c08 --- /dev/null +++ b/administrator/components/com_contact/views/contacts/tmpl/default.php @@ -0,0 +1,142 @@ + + +filter->order == 'a.ordering'); +?> + +
    + + + + + +
    + : + + + + + filter->catid ), 'onchange="document.adminForm.submit();"' ); + echo JHTML::_('grid.state', $this->filter->state ); + ?> +
    +
    + + + + + + + + + + + + + + + + + + + + + items ); $i < $n; $i++) + { + $row = &$this->items[$i]; + + $link = JRoute::_( 'index.php?option=com_contact&view=contact&task=edit&cid[]='. $row->id ); + + $checked = JHTML::_('grid.checkedout', $row, $i ); + $access = JHTML::_('grid.access', $row, $i ); + $published = JHTML::_('grid.published', $row, $i ); + + $row->cat_link = JRoute::_( 'index.php?option=com_categories§ion=com_contact&task=edit&type=other&cid[]='. $row->catid ); + $row->user_link = JRoute::_( 'index.php?option=com_users&task=edit&cid[]='. $row->user_id ); + ?> + "> + + + + + + + + + + + + +
    + + + + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + items ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset( $i ); ?> + + + + user->get ('id'), $row->checked_out ) ) { + echo $row->title; + } else { + ?> + + + name; ?> + + + + + pagination->orderUpIcon( $i, ($row->catid == @$this->items[$i-1]->catid),'orderup', 'Move Up', $ordering ); ?> + pagination->orderDownIcon( $i, $n, ($row->catid == @$this->items[$i+1]->catid), 'orderdown', 'Move Down', $ordering ); ?> + + class="text_area" style="text-align: center" /> + + + + + + category; ?> + + + + user; ?> + + id; ?> +
    +
    + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_contact/views/contacts/tmpl/index.html b/administrator/components/com_contact/views/contacts/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contact/views/contacts/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contact/views/contacts/view.html.php b/administrator/components/com_contact/views/contacts/view.html.php new file mode 100644 index 0000000000000..459e845ad80a4 --- /dev/null +++ b/administrator/components/com_contact/views/contacts/view.html.php @@ -0,0 +1,62 @@ +get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter'); + + // build list of categories + $javascript = 'onchange="document.adminForm.submit();"'; + $lists['catid'] = JHTML::_('list.category', 'filter_catid', 'com_contact_details', intval( $filter_catid ), $javascript ); + + $this->assignRef('user', JFactory::getUser()); + $this->assignRef('lists', $lists); + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_contact/views/index.html b/administrator/components/com_contact/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contact/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/contactdirectory.php b/administrator/components/com_contactdirectory/contactdirectory.php new file mode 100755 index 0000000000000..f708889ca24d2 --- /dev/null +++ b/administrator/components/com_contactdirectory/contactdirectory.php @@ -0,0 +1,40 @@ +addACL('com_contactdirectory', 'manage contacts', 'users', 'super administrator'); +$auth->addACL('com_contactdirectory', 'manage contacts', 'users', 'administrator'); +$auth->addACL('com_contactdirectory', 'manage contacts', 'users', 'manager'); +$auth->addACL('com_contactdirectory', 'manage fields', 'users', 'super administrator'); +$auth->addACL('com_contactdirectory', 'manage fields', 'users', 'administrator'); + +// Require specific controller if requested +if($controller = JRequest::getVar('controller','contact')) { + $path = JPATH_COMPONENT.DS.'controllers'.DS.$controller.'.php'; + if (file_exists($path)) { + require_once $path; + }else { + JError::raiseError( 500, 'Invalid Controller' ); + } +} + +// Create the controller +$controllerClass = 'ContactdirectoryController'.ucfirst($controller); +if (class_exists( $controllerClass )) { + $controller = new $controllerClass(); +} +else { + JError::raiseError(500, 'Invalid Controller Class'); +} + +// Perform the Request task +$controller->execute( JRequest::getVar( 'task' ) ); + +// Redirect if set by the controller +$controller->redirect(); + +?> \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/contactdirectory.xml b/administrator/components/com_contactdirectory/contactdirectory.xml new file mode 100644 index 0000000000000..178469260ae19 --- /dev/null +++ b/administrator/components/com_contactdirectory/contactdirectory.xml @@ -0,0 +1,12 @@ + + + Contact Directory + Joomla! Project + (C) 2005 - 2007 Open Source Matters. All rights reserved. + April 2006 + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + This component shows a listing of contact information like a contact directory. + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/controllers/contact.php b/administrator/components/com_contactdirectory/controllers/contact.php new file mode 100755 index 0000000000000..7bd0c8abeadac --- /dev/null +++ b/administrator/components/com_contactdirectory/controllers/contact.php @@ -0,0 +1,265 @@ +getModel('contact'); + $model->checkout(); + + parent::display(); + } + + function edit() + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'contact'); + JRequest::setVar( 'edit', true ); + + // Checkout the contact + $model = $this->getModel('contact'); + $model->checkout(); + + parent::display(); + } + + function importView() + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'import'); + + parent::display(); + } + + function apply() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $post = JRequest::get('post'); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $post['id'] = (int) $cid[0]; + + $model =& $this->getModel('contact'); + + if ($id = $model->store($post)) { + $msg = JText::_( 'CONTACT_SAVED' ); + } else { + $msg = $model->getError();//JText::_( 'ERROR_SAVING_CONTACT' ); + } + + // Check the table in so it can be edited.... we are done with it anyway + $model->checkin(); + $link = 'index.php?option=com_contactdirectory&controller=contact&task=edit&cid[]='. $id; + $this->setRedirect($link, $msg); + } + + function save() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $post = JRequest::get('post'); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $post['id'] = (int) $cid[0]; + + $model = $this->getModel('contact'); + + if ($model->store($post)) { + $msg = JText::_( 'CONTACT_SAVED' ); + } else { + $model->getError();//$msg = JText::_( 'ERROR_SAVING_CONTACT' ); + } + // Check the table in so it can be edited.... we are done with it anyway + $model->checkin(); + $link = 'index.php?option=com_contactdirectory&controller=contact'; + $this->setRedirect($link, $msg); + } + + function remove() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'SELECT_ITEM_DELETE' ) ); + } + + $model = $this->getModel('contact'); + if(!$model->delete($cid)) { + $msg = $model->getError(); + } + + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=contact', $msg ); + } + + + function publish() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'SELECT_ITEM_PUBLISH' ) ); + } + + $model = $this->getModel('contact'); + if(!$model->publish($cid, 1)) { + $msg = $model->getError(); + } + + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=contact', $msg ); + } + + function unpublish() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'SELECT_ITEM_UNPUBLISH' ) ); + } + + $model = $this->getModel('contact'); + if(!$model->publish($cid, 0)) { + $msg = $model->getError(); + } + + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=contact', $msg ); + } + + function cancel() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + // Checkin the contact + $model = $this->getModel('contact'); + $model->checkin(); + + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=contact' ); + } + + /** + * Save the item(s) to the menu selected + */ + function accesspublic() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + // Get some variables from the request + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $model = $this->getModel( 'Contact' ); + if (!$model->setAccess($cid, 0)) { + $msg = $model->getError(); + } + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=contact', $msg ); + } + + /** + * Save the item(s) to the menu selected + */ + function accessregistered() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + // Get some variables from the request + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $model = $this->getModel( 'Contact' ); + if (!$model->setAccess($cid, 1)) { + $msg = $model->getError(); + } + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=contact', $msg ); + } + + /** + * Save the item(s) to the menu selected + */ + function accessspecial() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + // Get some variables from the request + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $model = $this->getModel( 'Contact' ); + if(!$model->setAccess($cid, 2)) { + $msg = $model->getError(); + } + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=contact', $msg ); + } + + function import() + { + $string = JRequest::getVar('importString', null, 'post', 'string', JREQUEST_ALLOWHTML); + $file = JRequest::getVar('importFile', array(), 'files', 'array'); + + $model = $this->getModel('contact'); + + if(!empty($string)){ + // import the contacts from the text editor + if(!$model->import($string)){ + $message = $model->getError(); + //$message = JText::_('CONTACTS_IMPORT_FAILED'); + }else{ + $message = JText::_('CONTACTS_IMPORT_SUCCESS'); + } + $this->setRedirect('index.php?option=com_contactdirectory&controller=contact', $message); + }elseif(!empty($file) && $file['error'] == 0 && $file['size'] > 0 && is_readable($file['tmp_name'])){ + // import the contacts from a file + if($file['type'] != 'text/csv'){ + $message = JText::_('WRONG_FILE_TYPE'); + $this->setRedirect('index.php?option=com_contactdirectory&controller=contact&task=importView', $message); + }else{ + $string = implode("", file($file['tmp_name'])); + if (!$model->import($string)) { + $message = $model->getError(); + //$message = JText::_('CONTACTS_IMPORT_FAILED'); + } else { + $message = JText::_('CONTACTS_IMPORT_SUCCESS'); + } + $this->setRedirect('index.php?option=com_contactdirectory&controller=contact', $message); + } + } + } +} \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/controllers/field.php b/administrator/components/com_contactdirectory/controllers/field.php new file mode 100755 index 0000000000000..8d3f949bc4a8d --- /dev/null +++ b/administrator/components/com_contactdirectory/controllers/field.php @@ -0,0 +1,272 @@ +getModel('field'); + $model->checkout(); + + parent::display(); + } + + function edit() + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'field'); + JRequest::setVar( 'edit', true ); + + // Checkout the field + $model = $this->getModel('field'); + $model->checkout(); + + parent::display(); + } + + function apply() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $post = JRequest::get('post'); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $post['id'] = (int) $cid[0]; + + $model =& $this->getModel('field'); + + if ($id = $model->store($post)) { + $msg = JText::_( 'FIELD_SAVED' ); + } else { + $msg = JText::_( 'ERROR_SAVING_FIELD' ); + } + + // Check the table in so it can be edited.... we are done with it anyway + $model->checkin(); + $link = 'index.php?option=com_contactdirectory&controller=field&task=edit&cid[]='. $id; + $this->setRedirect($link, $msg); + } + + function save() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $post = JRequest::get('post'); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $post['id'] = (int) $cid[0]; + + $model = $this->getModel('field'); + + if ($model->store($post)) { + $msg = JText::_( 'FIELD_SAVED' ); + } else { + $msg = $model->getError(); + } + + // Check the table in so it can be edited.... we are done with it anyway + $model->checkin(); + $link = 'index.php?option=com_contactdirectory&controller=field'; + $this->setRedirect($link, $msg); + } + + function remove() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'ERROR_SAVING_FIELD' ) ); + } + + $model = $this->getModel('field'); + if($model->delete($cid)) { + $msg = JText::_( 'FIELD_DELETED' ); + } else { + $msg = JText::_( 'ERROR_DELETING_FIELD' ); + } + + $link = 'index.php?option=com_contactdirectory&controller=field'; + $this->setRedirect($link, $msg); + } + + + function publish() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'SELECT_ITEM_PUBLISH' ) ); + } + + $model = $this->getModel('field'); + if(!$model->publish($cid, 1)) { + echo "\n"; + } + + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=field' ); + } + + function unpublish() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'SELECT_ITEM_UNPUBLISH' ) ); + } + + $model = $this->getModel('field'); + if(!$model->publish($cid, 0)) { + echo "\n"; + } + + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=field' ); + } + + function cancel() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + // Checkin the field + $model = $this->getModel('field'); + $model->checkin(); + + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=field' ); + } + + + function orderup() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $model = $this->getModel('field'); + $model->move(-1); + + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=field'); + } + + function orderdown() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $model = $this->getModel('field'); + $model->move(1); + + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=field'); + } + + function saveorder() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + $order = JRequest::getVar( 'order', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + JArrayHelper::toInteger($order); + + $model = $this->getModel('field'); + $model->saveorder($cid, $order); + + $msg = 'New ordering saved'; + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=field', $msg ); + } + + /** + * Save the item(s) to the menu selected + */ + function accesspublic() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + // Get some variables from the request + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $model = $this->getModel( 'field' ); + if ($model->setAccess($cid, 0)) { + } else { + $msg = $model->getError(); + } + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=field' ); + } + + /** + * Save the item(s) to the menu selected + */ + function accessregistered() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + // Get some variables from the request + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $model = $this->getModel( 'field' ); + if ($model->setAccess($cid, 1)) { + } else { + $msg = $model->getError(); + } + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=field' ); + } + + /** + * Save the item(s) to the menu selected + */ + function accessspecial() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + // Get some variables from the request + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $model = $this->getModel( 'field' ); + if ($model->setAccess($cid, 2)) { + } else { + $msg = $model->getError(); + } + $this->setRedirect( 'index.php?option=com_contactdirectory&controller=field' ); + } +} + +?> \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/controllers/index.html b/administrator/components/com_contactdirectory/controllers/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/controllers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/elements/contact.php b/administrator/components/com_contactdirectory/elements/contact.php new file mode 100755 index 0000000000000..b760d119f6fc8 --- /dev/null +++ b/administrator/components/com_contactdirectory/elements/contact.php @@ -0,0 +1,42 @@ +setQuery( $query ); + $options = $db->loadObjectList( ); + + return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'id', 'text', $value, $control_name.$name ); + } +} \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/elements/index.html b/administrator/components/com_contactdirectory/elements/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/elements/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/helpers/index.html b/administrator/components/com_contactdirectory/helpers/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/helpers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/helpers/stringstream.php b/administrator/components/com_contactdirectory/helpers/stringstream.php new file mode 100644 index 0000000000000..a03f5ab7ad2a7 --- /dev/null +++ b/administrator/components/com_contactdirectory/helpers/stringstream.php @@ -0,0 +1,109 @@ + + * @author Toowoomba Regional Council Information Management Branch + * @license GNU/GPL http://www.gnu.org/licenses/gpl.html + * @copyright 2008 Toowoomba Regional Council/Sam Moffatt + * @version SVN: $Id:$ + */ + +class StringStreamController { + + function &_getArray() { + static $strings = Array(); + return $strings; + } + + function createRef($reference, &$string) { + $ref =& StringStreamController::_getArray(); + $ref[$reference] =& $string; + } + + + function &getRef($reference) { + $ref =& StringStreamController::_getArray(); + if(isset($ref[$reference])) { + return $ref[$reference]; + } else { + $false = false; + return $false; + } + } +} + + +class StringStream { + var $_currentstring; + + var $_path; + var $_mode; + var $_options; + var $_opened_path; + var $_pos; + var $_len; + + function stream_open($path, $mode, $options, &$opened_path) { + $this->_currentstring = StringStreamController::getRef(str_replace('string://','',$path)); + if($this->_currentstring) { + $this->_len = strlen($this->_currentstring); + $this->_pos = 0; + return true; + } else { + return false; + } + } + + function stream_stat() { + return false; + } + + function stream_read($count) { + $result = substr($this->_currentstring, $this->_pos, $count); + $this->_pos += $count; + return $result; + } + + function stream_write($data) { + return strlen($data); + } + + function stream_tell() { + return $this->_pos; + } + + function stream_eof() { + if($this->_pos > $this->_len) return true; + return false; + } + + function stream_seek($offset, $whence) { + //$whence: SEEK_SET, SEEK_CUR, SEEK_END + if($offset > $this->_len) return false; // we can't seek beyond our len + switch($whence) { + case SEEK_SET: + $this->_pos = $offset; + break; + case SEEK_CUR: + if(($this->_pos + $offset) < $this->_len) { + $this->_pos += $offset; + } else return false; + break; + case SEEK_END: + $this->_pos = $this->_len - $offset; + break; + } + return true; + } +} + +stream_wrapper_register('string', 'StringStream') or die('Failed to register string stream'); diff --git a/administrator/components/com_contactdirectory/index.html b/administrator/components/com_contactdirectory/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/models/contact.php b/administrator/components/com_contactdirectory/models/contact.php new file mode 100755 index 0000000000000..178b4fc30dbf5 --- /dev/null +++ b/administrator/components/com_contactdirectory/models/contact.php @@ -0,0 +1,493 @@ +setId((int)$array[0]); + } + } + + /** + * Method to set the contact identifier + * + * @access public + * @param int Contact identifier + */ + function setId($id) + { + // Set contact id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a contact + * + * @since 1.5 + */ + function &getData() + { + // Load the contact data + $result = $this->_loadData(); + if (!$result) $this->_initData(); + + return $this->_data; + } + + function &getFields() + { + if(!$this->_fields){ + $query = "SELECT f.title, d.data, f.type, f.alias, d.show_contact, d.show_directory, f.params " + ."FROM #__contactdirectory_fields f " + ."LEFT JOIN #__contactdirectory_details d ON d.field_id = f.id " + ."WHERE f.published = 1 AND d.contact_id = '$this->_id'" + ."ORDER BY f.pos, f.ordering"; + $this->_db->setQuery($query); + $this->_fields = $this->_db->loadObjectList(); + } + return $this->_fields; + } + + function &getCategories() + { + if(!$this->_categories){ + $query = "SELECT c.title, map.category_id AS id, map.ordering " + ."FROM #__categories c " + ."LEFT JOIN jos_contactdirectory_con_cat_map map ON map.category_id = c.id " + ."WHERE c.published = 1 AND map.contact_id = '$this->_id'" + ."ORDER BY c.ordering"; + $this->_db->setQuery($query); + $this->_categories = $this->_db->loadObjectList(); + } + return $this->_categories; + } + + /** + * Method to load the contact data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = 'SELECT * FROM #__contactdirectory_contacts WHERE id = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + function _initData(){ + // Lets load the field data if it doesn't already exist + if (empty($this->_data)) + { + $contact = new stdClass(); + $contact->id = null; + $contact->name = ''; + $contact->alias = ''; + $contact->published = 0; + $contact->checked_out = 0; + $contact->checked_out_time = 0; + $contact->params = null; + $contact->user_id = 0; + $contact->access = 0; + $this->_data = $contact; + return (boolean) $this->_data; + } + return true; + } + + /** + * Tests if contact is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.5 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_loadData()) + { + if ($uid) { + return ($this->_data->checked_out && $this->_data->checked_out != $uid); + } else { + return $this->_data->checked_out; + } + } + } + + /** + * Method to checkin/unlock the contact + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function checkin() + { + if ($this->_id) + { + $contact = & $this->getTable(); + if(! $contact->checkin($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return false; + } + + /** + * Method to checkout/lock the contact + * + * @access public + * @param int $uid User ID of the user checking the article out + * @return boolean True on success + * @since 1.5 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the article with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $contact = & $this->getTable(); + if(!$contact->checkout($uid, $this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return true; + } + return false; + } + + /** + * Method to store the contact + * + * @access public + * @return the id on success or false if error + * @since 1.5 + */ + function store($data) + { + $row =& $this->getTable(); + + // Bind the form contacts to the contact table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Create the timestamp for the date + $row->checked_out_time = gmdate('Y-m-d H:i:s'); + + // Make sure the contacts table is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the data in the different database tables + if (!$row->store($data)) { + $this->setError($row->getError()); + return false; + } + return $row->id; + } + + /** + * Method to remove a contact + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__contactdirectory_contacts' + . ' WHERE id IN ( '.$cids.' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + $query = 'DELETE FROM #__contactdirectory_details WHERE contact_id IN ('.$cids.')'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + $query = 'DELETE FROM #__contactdirectory_con_cat_map WHERE contact_id IN ('.$cids.')'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return true; + } + + /** + * Method to (un)publish a contact + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function publish($cid = array(), $publish = 1) + { + $user =& JFactory::getUser(); + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__contactdirectory_contacts' + . ' SET published = '.(int) $publish + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )'; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return true; + } + + /** + * Set the access of selected menu items + */ + function setAccess( $cid = array(), $access = 0 ) + { + $user =& JFactory::getUser(); + + foreach ($cid as $id) + { + $query = 'UPDATE #__contactdirectory_contacts' + . ' SET access = '.(int) $access + . ' WHERE id = '.$id + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )'; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return true; + } + + /** + * Method to import the contacts + * + * @access public + * @param string $data The contacts string in CSV format. + * @return boolean True on success + * @since 1.0 + */ + function import($data = null) + { + require_once JPATH_COMPONENT.DS.'helpers'.DS.'stringstream.php'; + + $i=0; + $cols = array(); + + StringStreamController::createRef('csv',$data); + $file = fopen('string://csv','r'); + + while($csv = fgetcsv($file)) { + $contact_data = array(); + $name_bool = false; + $cat_bool = false; + + $query = "SELECT alias, params FROM #__contactdirectory_fields WHERE published=1 "; + $this->_db->setQuery($query); + $fields = $this->_db->loadObjectList(); + + foreach($fields as $field){ + $field->params = new JParameter($field->params); + + $contact_data['fields'][$field->alias] = null; + $contact_data['showContactPage'][$field->alias] = 1; + $contact_data['showContactLists'][$field->alias] = 1; + } + + if($i == 0){ + $cols = $csv; + }else{ + $k = 0; + foreach($cols as $col){ + if($col == 'name'){ + if($csv[$k] != null){ + $name_bool = true; + $contact_data['name'] = $csv[$k]; + } + } + elseif($col == 'alias'){ + $contact_data['alias'] = $csv[$k]; + } + elseif($col == 'published'){ + if($csv[$k] == 'y') $csv[$k] = 1; + elseif($csv[$k] == 'n') $csv[$k] = 0; + else{ + $this->setError( JText::sprintf('VALUE_NOT_VALID', $csv[$k])); + fclose($file); + return false; + } + $contact_data['published'] = $csv[$k]; + } + elseif($col == 'user_id'){ + $contact_data['user_id'] = $csv[$k]; + } + elseif($col == 'access'){ + if($csv[$k] == 'p') $csv[$k] = 0; + elseif($csv[$k] == 'r') $csv[$k] = 1; + elseif($csv[$k] == 's') $csv[$k] = 2; + else{ + $this->setError( JText::sprintf('VALUE_NOT_VALID', $csv[$k])); + fclose($file); + return false; + } + $contact_data['access'] = $csv[$k]; + } + elseif($col == 'categories'){ + if($csv[$k] != null){ + $cat_bool = true; + $categories = explode('|', $csv[$k]); + $contact_data['categories'] = $categories; + } + } + elseif($col == 'showContactPage'){ + if(isset($csv[$k]) && $csv[$k] != null){ + $showContact = explode('|', $csv[$k]); + foreach($showContact as $show){ + $show = explode('=', $show); + if($show[1] == 'y') $show[1] = 1; + elseif($show[1]== 'n') $show[1] = 0; + else{ + $this->setError( JText::sprintf('VALUE_NOT_VALID', $show[1])); + fclose($file); + return false; + } + $contact_data['showContactPage'][$show[0]] = $show[1]; + } + } + } + elseif($col == 'showContactLists'){ + if(isset($csv[$k]) && $csv[$k] != null){ + $showLists = explode('|', $csv[$k]); + foreach($showLists as $show){ + $show = explode('=', $show); + if($show[1] == 'y') $show[1] = 1; + elseif($show[1]== 'n') $show[1] = 0; + else{ + $this->setError( JText::sprintf('VALUE_NOT_VALID', $show[1])); + fclose($file); + return false; + } + $contact_data['showContactLists'][$show[0]] = $show[1]; + } + } + } + elseif($col == 'params'){ + if(isset($csv[$k]) && $csv[$k] != null){ + $params = explode('|', $csv[$k]); + foreach($params as $param){ + $param = explode('=', $param); + $contact_data['params'][$param[0]] = $param[1]; + } + } + } + // Add the column to the $contact_data array if the name exists in the database + else{ + $found = false; + $required = false; + foreach($fields as $field){ + if($field->alias == $col){ + $found = true; + break; + }elseif($field->params->get('required') && $csv[$k] == null){ + $req_field = $field->alias; + $required = true; + } + } + if($found) $contact_data['fields'][$col] = $csv[$k]; + elseif($required){ + $this->setError( JText::sprintf('FIELD_REQUIRED', $req_field)); + fclose($file); + return false; + } + else{ + $this->setError( JText::sprintf('FIELD_NOT_VALID', $col)); + fclose($file); + return false; + } + } + $k++; + } + if(!$name_bool && !$cat_bool){ + $this->setError( JText::__('MANDATORY_COL_NAME_CAT')); + fclose($file); + return false; + }elseif(!$name_bool && $cat_bool){ + $this->setError( JText::__('MANDATORY_COL_NAME')); + fclose($file); + return false; + }elseif($name_bool && !$cat_bool){ + $this->setError( JText::__('MANDATORY_COL_CAT')); + fclose($file); + return false; + } + + // Save the contact info + if(!$this->store($contact_data)){ + $this->setError( JText::sprintf('STORE_FAILED', $contact_data['name'])); + fclose($file); + return false; + } + } + $i++; + } + fclose($file); + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/models/contact.xml b/administrator/components/com_contactdirectory/models/contact.xml new file mode 100755 index 0000000000000..c8133114eb37c --- /dev/null +++ b/administrator/components/com_contactdirectory/models/contact.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/models/contacts.php b/administrator/components/com_contactdirectory/models/contacts.php new file mode 100755 index 0000000000000..0baa2ea06e986 --- /dev/null +++ b/administrator/components/com_contactdirectory/models/contacts.php @@ -0,0 +1,180 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + // In case limit has been changed, adjust limitstart accordingly + $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + } + + /** + * Method to get contact item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_data; + } + + /** + * Method to get the total number of contact items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the contact + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = ' SELECT DISTINCT c.*, d.data AS email, u.name AS editor, v.name AS user, g.name AS groupname' + . ' FROM #__contactdirectory_contacts AS c ' + . ' LEFT JOIN #__users AS u ON u.id = c.checked_out ' + . ' LEFT JOIN #__users AS v ON v.id = c.user_id ' + . ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = c.access ' + . ' LEFT JOIN #__contactdirectory_con_cat_map AS map ON map.contact_id = c.id ' + . ' LEFT JOIN #__categories AS cat ON cat.id = map.category_id ' + . ' LEFT JOIN #__contactdirectory_details AS d ON d.contact_id = c.id ' + . $where + . $orderby; + + return $query; + } + + function _buildContentOrderBy() + { + global $mainframe, $option; + + $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'map.ordering', 'cmd' ); + $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + + if ($filter_order == 'c.ordering'){ + $orderby = ' ORDER BY map.ordering '.$filter_order_Dir.' , c.name '; + } else { + $orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.' , map.ordering, c.name '; + } + + return $orderby; + } + + function _buildContentWhere() + { + global $mainframe, $option; + $db =& JFactory::getDBO(); + $filter_state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter_catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' ); + $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'map.ordering', 'cmd' ); + $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + $where = array(); + + if ($search) { + $where[] = 'LOWER(c.name) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); + } + if ( $filter_catid ) { + $where[] = 'map.category_id = '.(int) $filter_catid; + } + if ( $filter_state ) { + if ( $filter_state == 'P' ) { + $where[] = 'c.published = 1'; + } else if ($filter_state == 'U' ) { + $where[] = 'c.published = 0'; + } + } + + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + $where .= ' AND d.field_id = 1'; + return $where; + } +} diff --git a/administrator/components/com_contactdirectory/models/field.php b/administrator/components/com_contactdirectory/models/field.php new file mode 100755 index 0000000000000..561ef279e55ca --- /dev/null +++ b/administrator/components/com_contactdirectory/models/field.php @@ -0,0 +1,361 @@ +setId((int)$array[0]); + } + + /** + * Method to set the field identifier + * + * @access public + * @param int Field identifier + */ + + function setId($id) + { + // Set field id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a field + * + * @since 1.5 + */ + + function &getData() + { + // Load the field data + $result = $this->_loadData(); + if (!$result) $this->_initData(); + + return $this->_data; + } + + /** + * Method to load the field data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = 'SELECT * FROM #__contactdirectory_fields WHERE id = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the field data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _initData() + { + // Lets load the field data if it doesn't already exist + if (empty($this->_data)) + { + $field = new stdClass(); + $field->id = null; + $field->title = ''; + $field->description = null; + $field->type = 'text'; + $field->published = 0; + $field->checked_out = 0; + $field->checked_out_time = 0; + $field->ordering = 0; + $field->pos = 'main'; + $field->access = 0; + $field->params = null; + $this->_data = $field; + return (boolean) $this->_data; + } + return true; + } + + /** + * Tests if field is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.5 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_loadData()) + { + if ($uid) { + return ($this->_data->checked_out && $this->_data->checked_out != $uid); + } else { + return $this->_data->checked_out; + } + } + } + + /** + * Method to checkin/unlock the field + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function checkin() + { + if ($this->_id) + { + $field = & $this->getTable(); + if(! $field->checkin($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return false; + } + + /** + * Method to checkout/lock the field + * + * @access public + * @param int $uid User ID of the user checking the article out + * @return boolean True on success + * @since 1.5 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the article with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $field = & $this->getTable(); + if(!$field->checkout($uid, $this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return true; + } + return false; + } + + /** + * Method to store the field + * + * @access public + * @return the id on success else false + * @since 1.5 + */ + function store($data) + { + $row =& $this->getTable(); + + // Bind the form fields to the field table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Create the timestamp for the date + $row->checked_out_time = gmdate('Y-m-d H:i:s'); + + // if new item, order last in appropriate group + if (!$row->id) { + $where = 'pos = ' . (int) $row->pos ; + $row->ordering = $row->getNextOrder( $where ); + } + + // Make sure the fields table is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the fields table to the database + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return $row->id; + } + + /** + * Method to remove a field + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function delete($cid = array()) + { + $row =& $this->getTable(); + + // delete field from contactdirectory_field table + for( $i=0; $i < count($cid); $i++ ) + { + if (!$row->load( (int) $cid[$i] )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if($row->id == 1){ + $this->setError( JText::_('You are not authorized to delete the email field')); + return false; + } + + $query = 'DELETE FROM #__contactdirectory_fields' + . ' WHERE id = '.$row->id; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + $query = 'DELETE FROM #__contactdirectory_details WHERE field_id = '.$row->id; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return true; + } + + /** + * Method to (un)publish a field + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function publish($cid = array(), $publish = 1) + { + $user =& JFactory::getUser(); + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__contactdirectory_fields' + . ' SET published = '.(int) $publish + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )'; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return true; + } + + /** + * Method to move a field + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function move($direction) + { + $row =& $this->getTable(); + if (!$row->load($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if (!$row->move( $direction, "pos = '$row->pos' AND published != 0" )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return true; + } + + /** + * Method to move a field + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function saveorder($cid = array(), $order) + { + $row =& $this->getTable(); + + // update ordering values + for( $i=0; $i < count($cid); $i++ ) + { + $row->load( (int) $cid[$i] ); + + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + } + return true; + } + + /** + * Set the access of selected menu items + */ + function setAccess( $cid = array(), $access = 0 ) + { + $row =& $this->getTable(); + foreach ($cid as $id) + { + $row->load( $id ); + $row->access = $access; + + if (!$row->check()) { + $this->setError($row->getError()); + return false; + } + if (!$row->store()) { + $this->setError($row->getError()); + return false; + } + } + return true; + } +} + +?> \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/models/field.xml b/administrator/components/com_contactdirectory/models/field.xml new file mode 100755 index 0000000000000..45a6334fb5175 --- /dev/null +++ b/administrator/components/com_contactdirectory/models/field.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/models/fields.php b/administrator/components/com_contactdirectory/models/fields.php new file mode 100755 index 0000000000000..f9b4db6255b49 --- /dev/null +++ b/administrator/components/com_contactdirectory/models/fields.php @@ -0,0 +1,172 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + // In case limit has been changed, adjust limitstart accordingly + $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + } + + /** + * Method to get fields item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_data; + } + + /** + * Method to get the total number of fields items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the fields + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = ' SELECT f.*, u.name AS editor, g.name AS groupname ' + . ' FROM #__contactdirectory_fields AS f ' + . ' LEFT JOIN #__users AS u ON u.id = f.checked_out ' + . ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = f.access ' + . $where + . $orderby; + + return $query; + } + + function _buildContentOrderBy() + { + global $mainframe, $option; + + $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'f.ordering', 'cmd' ); + $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + + if ($filter_order == 'f.ordering'){ + $orderby = ' ORDER BY f.pos, f.ordering '.$filter_order_Dir.' , f.title '; + } else { + $orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.' , f.pos, f.ordering, f.title '; + } + + return $orderby; + } + + function _buildContentWhere() + { + global $mainframe, $option; + $db =& JFactory::getDBO(); + $filter_state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'f.ordering', 'cmd' ); + $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + $where = array(); + + if ($search) { + $where[] = 'LOWER(f.title) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); + } + if ( $filter_state ) { + if ( $filter_state == 'P' ) { + $where[] = 'f.published = 1'; + } else if ($filter_state == 'U' ) { + $where[] = 'f.published = 0'; + } + } + + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + + return $where; + } +} diff --git a/administrator/components/com_contactdirectory/models/index.html b/administrator/components/com_contactdirectory/models/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/tables/contact.php b/administrator/components/com_contactdirectory/tables/contact.php new file mode 100755 index 0000000000000..1a78f3243e45e --- /dev/null +++ b/administrator/components/com_contactdirectory/tables/contact.php @@ -0,0 +1,289 @@ +loadArray($array['params']); + $array['params'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } + + /** + * Overloaded check method to ensure data integrity + * + * @access public + * @return boolean True on success + * @since 1.0 + */ + function check() + { + if(empty($this->alias)) { + $this->alias = $this->name; + } + $this->alias = JFilterOutput::stringURLSafe($this->alias); + if(trim(str_replace('-','',$this->alias)) == '') { + $datenow =& JFactory::getDate(); + $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); + } + + /** check for valid name */ + if (trim($this->name) == '') { + $this->setError(JText::_('CONTACT_MUST_HAVE_A_NAME')); + return false; + } + + return true; + } + + /** + * Overloaded store method + * + * @access public + * @return boolean True on success + * @since 1.0 + */ + function store( $data ) + { + if( $this->id != null ) { + // Edit Contact + if( !$this->_db->updateObject( '#__contactdirectory_contacts', $this, 'id', false ) ) { + $this->setError(get_class( $this ).'::store failed 1 - '.$this->_db->getErrorMsg()); + return false; + } + + $fields = $data['fields']; + foreach ($fields as $key => $field){ + // Get the id of the current field + $query = "SELECT id FROM #__contactdirectory_fields WHERE alias = '$key'"; + $this->_db->setQuery($query); + $field_id = $this->_db->loadResult(); + if(!$field_id) { + $this->setError(get_class( $this ).'::store failed 2 - '.$this->_db->getErrorMsg()); + return false; + } + // Update the #__contactdirectory_details table in the database + $field = addslashes($field); + $query = "UPDATE #__contactdirectory_details SET data = '$field' WHERE contact_id = $this->id AND field_id = ".$field_id; + $this->_db->setQuery($query); + if(!$this->_db->query()) { + $this->setError(get_class( $this ).'::store failed 3 - '.$this->_db->getErrorMsg()); + return false; + } + if(isset($data['showContactPage'][$key])){ + $query = "UPDATE #__contactdirectory_details SET show_contact = ".$data['showContactPage'][$key]." WHERE contact_id = $this->id AND field_id = ".$field_id; + $this->_db->setQuery($query); + if(!$this->_db->query()) { + $this->setError(get_class( $this ).'::store failed 4 - '.$this->_db->getErrorMsg()); + return false; + } + } + if(isset($data['showContactList'][$key])){ + $query = "UPDATE #__contactdirectory_details SET show_directory = ".$data['showContactList'][$key]." WHERE contact_id = $this->id AND field_id = ".$field_id; + $this->_db->setQuery($query); + if(!$this->_db->query()) { + $this->setError(get_class( $this ).'::store failed 5 - '.$this->_db->getErrorMsg()); + return false; + } + } + + } + + // Get the original categories in order to compaire with new categories + // If the category exists in both $cat_map and $categories and the ordering is different then update the ordering + // If the category does not exist in $cat_map but is in $categories then it is a new category and insert it in the database + // If the category exists in $cat_map but not in $categories then then delete the category from the database + $query = "SELECT category_id FROM #__contactdirectory_con_cat_map WHERE contact_id = '$this->id'"; + $this->_db->setQuery($query); + $cat_map = $this->_db->loadResultArray(); + if(!$cat_map) { + $this->setError(get_class( $this ).'::store failed 6 - '.$this->_db->getErrorMsg()); + return false; + } + + $categories = $data['categories']; + $ordering = $data['ordering']; + + $i = 0; + foreach ($categories as $category){ + $found = false; + for($k=0; $k_db->setQuery($query); + if(!$this->_db->query()) { + $this->setError(get_class( $this ).'::store failed 7 - '.$this->_db->getErrorMsg()); + return false; + } + } + } + if(!$found){ + // If it is a new category, save the category and set the ordering as the last value + $query = "SELECT MAX(ordering) FROM #__contactdirectory_con_cat_map WHERE category_id = '$category'"; + $this->_db->setQuery( $query ); + $maxord = $this->_db->loadResult(); + if ($this->_db->getErrorNum()) { + $this->setError(get_class( $this ).'::store failed 8 - '.$this->_db->getErrorMsg()); + return false; + } + $maxord++; + + $query = "INSERT INTO #__contactdirectory_con_cat_map VALUES('$this->id', '$category', '$maxord')"; + $this->_db->setQuery($query); + if(!$this->_db->query()) { + $this->setError(get_class( $this ).'::store failed 9 - '.$this->_db->getErrorMsg()); + return false; + } + } + $i++; + } + + for($k=0; $k_db->setQuery($query); + if(!$this->_db->query()) { + $this->setError(get_class( $this ).'::store failed 10 - '.$this->_db->getErrorMsg()); + return false; + } + } + + // Reorder the ordering + $query = "SELECT contact_id, category_id, ordering " + ."FROM #__contactdirectory_con_cat_map " + ."WHERE ordering >= 0 AND category_id = '$category' " + ."ORDER BY ordering"; + $this->_db->setQuery( $query ); + if (!($orders = $this->_db->loadObjectList())) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // compact the ordering numbers + for ($i=0, $n=count( $orders ); $i < $n; $i++) + { + if ($orders[$i]->ordering >= 0) + { + if ($orders[$i]->ordering != $i+1) + { + $orders[$i]->ordering = $i+1; + $query = 'UPDATE #__contactdirectory_con_cat_map SET ordering = '. (int) $orders[$i]->ordering + .' WHERE contact_id = '. $this->_db->Quote($orders[$i]->contact_id) + .' AND category_id = '.$this->_db->Quote($orders[$i]->category_id); + $this->_db->setQuery( $query); + if(!$this->_db->query()) { + $this->setError(get_class( $this ).'::store failed 11 - '.$this->_db->getErrorMsg()); + return false; + } + } + } + } + } + + } else { + // Add Contact + $ret = $this->_db->insertObject( '#__contactdirectory_contacts', $this, 'id' ); + $this->id = $this->_db->insertid(); + + if( !$ret || $this->id == null) { + $this->setError(get_class( $this ).'::store failed 12 - '.$this->_db->getErrorMsg()); + return false; + } + + $fields = $data['fields']; + foreach ($fields as $key => $field){ + // Get the id of the current field + $query = "SELECT id FROM #__contactdirectory_fields WHERE alias = '$key' "; + $this->_db->setQuery($query); + $field_id = $this->_db->loadResult(); + if(!$field_id) { + $this->setError(get_class( $this ).'::store failed 13 - '.$this->_db->getErrorMsg()); + return false; + } + // Insert into the #__contactdirectory_details table + $field = addslashes($field); + $showList = $data['showContactLists'][$key]; + $showContact = $data['showContactPage'][$key]; + $query = "INSERT INTO #__contactdirectory_details VALUES('$this->id', '$field_id', '$field', '$showContact', '$showList')"; + $this->_db->setQuery($query); + if(!$this->_db->query()) { + $this->setError(get_class( $this ).'::store failed 14 - '.$this->_db->getErrorMsg()); + return false; + } + } + + $categories = $data['categories']; + $i = 0; + // Save the categories in $categories by inserting it in the database and setting the ordering to the maxvalue + foreach ($categories as $category){ + $query = "SELECT MAX(ordering) FROM #__contactdirectory_con_cat_map WHERE category_id = '$category'"; + $this->_db->setQuery( $query ); + $maxord = $this->_db->loadResult(); + if ($this->_db->getErrorNum()) { + $this->setError(get_class( $this ).'::store failed 15 - '.$this->_db->getErrorMsg()); + return false; + } + if($maxord == -1){ + $maxord += 2; + } + $maxord++; + + $query = "INSERT INTO #__contactdirectory_con_cat_map VALUES('$this->id', '$category', '$maxord')"; + $this->_db->setQuery($query); + if(!$this->_db->query()) { + $this->setError(get_class( $this ).'::store failed 16 - '.$this->_db->getErrorMsg()); + return false; + } + } + } + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/tables/field.php b/administrator/components/com_contactdirectory/tables/field.php new file mode 100755 index 0000000000000..87ef64754be3c --- /dev/null +++ b/administrator/components/com_contactdirectory/tables/field.php @@ -0,0 +1,133 @@ +loadArray($array['params']); + $array['params'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } + + /** + * Overloaded check method to ensure data integrity + * + * @access public + * @return boolean True on success + * @since 1.0 + */ + function check() + { + /** check for valid title */ + if (trim($this->title) == '') { + $this->setError(JText::_('FIELD_MUST_HAVE_A_TITLE')); + return false; + } + + + if(empty($this->alias)) { + $this->alias = $this->title; + } + $this->alias = JFilterOutput::stringURLSafe($this->alias); + if(trim(str_replace('-','',$this->alias)) == '') { + $datenow =& JFactory::getDate(); + $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); + } + + $xid = intval($this->_db->loadResult()); + if ($xid && $xid != intval($this->id)) { + $this->setError(JText::sprintf('WARNNAMETRYAGAIN', JText::_('FIELD'))); + return false; + } + + return true; + } + + /** + * Overloaded store method + * + * @access public + * @return boolean True on success + * @since 1.0 + */ + function store() + { + if( $this->id ) { + if( !$this->_db->updateObject( '#__contactdirectory_fields', $this, 'id', false ) ) { + $this->setError(get_class( $this ).'::store failed 1 - '.$this->_db->getErrorMsg()); + return false; + } + } else { + $ret = $this->_db->insertObject( '#__contactdirectory_fields', $this, 'id' ); + $this->id = $this->_db->insertid(); + if( !$ret || $this->id == null) { + $this->setError(get_class( $this ).'::store failed 2 - '.$this->_db->getErrorMsg()); + return false; + } + + $query = "SELECT id FROM #__contactdirectory_contacts"; + $this->_db->setQuery($query); + $contacts = $this->_db->loadObjectList(); + + foreach ($contacts as $contact){ + $query = "INSERT INTO #__contactdirectory_details VALUES('$contact->id', '$this->id', '', '1', '1')"; + $this->_db->setQuery($query); + if(!$this->_db->query()) { + $this->setError(get_class( $this ).'::store failed 3 - '.$this->_db->getErrorMsg()); + return false; + } + } + } + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/tables/index.html b/administrator/components/com_contactdirectory/tables/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/tables/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/contact/index.html b/administrator/components/com_contactdirectory/views/contact/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/contact/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/contact/tmpl/default.php b/administrator/components/com_contactdirectory/views/contact/tmpl/default.php new file mode 100755 index 0000000000000..8856c4b0e28dc --- /dev/null +++ b/administrator/components/com_contactdirectory/views/contact/tmpl/default.php @@ -0,0 +1,259 @@ + + +[ ' . $text.' ]' ); + JToolBarHelper::save(); + JToolBarHelper::apply(); + if (!$edit) { + JToolBarHelper::cancel(); + } else { + // for existing items the button is renamed `close` + JToolBarHelper::cancel( 'cancel', 'Close' ); + } +?> + + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + contact->id) { + ?> + + + + + +
    + + + +
    + + + +
    + + + lists['published']; ?> +
    + + + lists['user_id'];?> +
    + + + lists['access']; ?> +
    + + + contact->id;?> +
    +
    +
    + + + + + + + + categories); $i++) { ?> + + + + + +
    + + + lists['category']; ?> +
    field->title))); ?> + + + lists['ordering'.$i]; ?> +
    +
    +
    + + + + fields); $i++) { + $field = &$this->fields[$i]; + if($field->params->get('required')){ + $star = '* '; + } else{ + $star =''; + } + ?> + + + + + +
    + + + type == 'text' || $field->type == 'email' || $field->type == 'url'){ + echo ''; + }else if($field->type == 'textarea'){ + echo ''; + }else if($field->type == 'editor'){ + $editor =& JFactory::getEditor(); + echo $editor->display('fields['.$field->alias.']', $field->data, '100%', '100%', '50', '5'); + }else if($field->type == 'image'){ + echo JHTML::_('list.images', 'fields['.$field->alias.']', $field->data ); + } + + ?> +
    +
    +
    +
    +
    + + startPane("menu-pane"); + echo $pane->startPanel(JText :: _('CONTACT_PARAMETERS'), "param-page"); + echo $this->params->render(); + $i = 0; + ?> + + + fields as $this->field){ ?> + + + + + + + +
    + + + + + lists['showContact'.$i]; ?> +
    + endPanel(); + echo $pane->startPanel(JText :: _('DIRECTORY_PARAMETERS'), "param-page"); + echo $this->params->render('params', 'directory'); + $i = 0; + ?> + + + fields as $this->field){ ?> + + + + + + + +
    + + + + + lists['showDirectory'.$i]; ?> +
    + endPanel(); + echo $pane->startPanel(JText :: _('EMAIL_PARAMETERS'), "param-page"); + echo $this->params->render('params', 'email'); + echo $pane->endPanel(); + echo $pane->endPane(); + ?> +
    +
    + +
    + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/contact/tmpl/index.html b/administrator/components/com_contactdirectory/views/contact/tmpl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/contact/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/contact/view.html.php b/administrator/components/com_contactdirectory/views/contact/view.html.php new file mode 100755 index 0000000000000..9cca5a12ee524 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/contact/view.html.php @@ -0,0 +1,136 @@ +getModel(); + + if (!$user->authorize( 'com_contactdirectory', 'manage contacts' )) { + $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH')); + } + + $lists = array(); + + //get the contact + $contact =& $this->get('data'); + $isNew = ($contact->id < 1); + + //get the fields + $fields =& $this->get('fields'); + if($fields == null){ + $query = "SELECT title, type, params, alias FROM #__contactdirectory_fields WHERE published = 1 ORDER BY pos, ordering"; + $db->setQuery( $query ); + $fields = $db->loadObjectList(); + foreach($fields as $field){ + $field->show_contact = 1; + $field->show_directory = 1; + $field->data = null; + } + } + + //get the categories + $categories =& $this->get('categories'); + + // fail if checked out not by 'me' + if ($model->isCheckedOut( $user->get('id') )) { + $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'THE_CONTACT' ), $contact->name ); + $mainframe->redirect( 'index.php?option=com_contactdirectory&controller=contact', $msg ); + } + + // Edit or Create? + if (!$isNew) + { + $model->checkout( $user->get('id') ); + } + else + { + // initialise new record + $contact->published = 1; + $contact->approved = 1; + $contact->order = 0; + } + + // build the html list for categories + $query = "SELECT id AS value, title AS text" + . " FROM #__categories" + . " WHERE section = 'com_contactdirectory'" + . " AND published = 1" + . " ORDER BY ordering"; + $db->setQuery( $query ); + $cat = $db->loadObjectList(); + + $select = array(); + foreach ($categories as $category){ + $select[] = $category->id; + } + + $lists['category'] = JHTML::_('select.genericlist', $cat, 'categories[]', 'multiple="multiple" class="inputbox" size="'. count($cat).'"', 'value', 'text', $select ); + + $i = 0; + foreach ($categories as $category) { + $query = "SELECT c.name AS text, map.ordering AS value " + ."FROM jos_contactdirectory_contacts c " + ."LEFT JOIN jos_contactdirectory_con_cat_map map ON map.contact_id = c.id " + ."WHERE c.published = 1 AND map.category_id = '$category->id' ORDER BY ordering"; + + $order = JHTML::_('list.genericordering', $query ); + $lists['ordering'.$i] = JHTML::_('select.genericlist', $order, 'ordering[]', 'class="inputbox" size="1"', 'value', 'text', intval( $category->ordering ) ); + $i++; + } + + //$lists['ordering'] = JHTML::_('list.specificordering', $contact, $contact->id, $query ); + + // build the html select list for published + $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $contact->published ); + + // build the html select list for access + $lists['access'] = JHTML::_('list.accesslevel', $contact); + + + // build the html for the booleanlist Show / Hide Field + $i = 0; + foreach ($fields as $field){ + $field->params = new JParameter($field->params); + + $lists['showContact'.$i] = JHTML::_('select.booleanlist', 'showContactPage['.$field->alias.']', 'class="inputbox"', $field->show_contact, 'show', 'hide' ); + $lists['showDirectory'.$i] = JHTML::_('select.booleanlist', 'showContactLists['.$field->alias.']', 'class="inputbox"', $field->show_directory, 'show', 'hide' ); + $i++; + } + + // build list of users + $lists['user_id'] = JHTML::_('list.users', 'user_id', $contact->user_id, 1, null, 'name', 0 ); + + //clean contact data + JFilterOutput::objectHTMLSafe( $contact, ENT_QUOTES, 'description' ); + + $file = JPATH_COMPONENT.DS.'models'.DS.'contact.xml'; + $params = new JParameter( $contact->params, $file ); + + $this->assignRef('lists', $lists); + $this->assignRef('contact', $contact); + $this->assignRef('fields', $fields); + $this->assignRef('categories', $categories); + $this->assignRef('params', $params); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_contactdirectory/views/contacts/index.html b/administrator/components/com_contactdirectory/views/contacts/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/contacts/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/contacts/tmpl/default.php b/administrator/components/com_contactdirectory/views/contacts/tmpl/default.php new file mode 100755 index 0000000000000..80c546183f759 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/contacts/tmpl/default.php @@ -0,0 +1,132 @@ + + + + + + +
    + + + + + +
    + : + + + + + lists['category']; + echo $this->lists['state']; + ?> +
    +
    + + + + + + + + + + + + + + + + + + + + items ); $i < $n; $i++) + { + $row = &$this->items[$i]; + + $link = JRoute::_( 'index.php?option=com_contactdirectory&controller=contact&view=contact&task=edit&cid[]='. $row->id ); + $access = JHTML::_('grid.access', $row, $i ); + $checked = JHTML::_('grid.checkedout', $row, $i ); + $published = JHTML::_('grid.published', $row, $i ); + + $user_link = JRoute::_( 'index.php?option=com_users&task=editA&cid[]='. $row->user_id ); + + $ordering = ($this->lists['order'] == 'c.ordering'); + + ?> + "> + + + + + + + + + + + +
    + + + + + lists['order_Dir'], $this->lists['order'] ); ?> + + lists['order_Dir'], $this->lists['order'] ); ?> + + lists['order_Dir'], $this->lists['order'] ); ?> + + lists['order_Dir'], $this->lists['order'] ); ?> + + + + lists['order_Dir'], $this->lists['order'] ); ?> +
    + pagination->getListFooter(); ?> +
    pagination->getRowOffset( $i ); ?> + user->get ('id'), $row->checked_out ) ) { + echo $row->name; + } else { + ?> + + + name; ?> + + email; ?> + + user; ?> + + id; ?>
    +
    + + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/contacts/tmpl/index.html b/administrator/components/com_contactdirectory/views/contacts/tmpl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/contacts/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/contacts/view.html.php b/administrator/components/com_contactdirectory/views/contacts/view.html.php new file mode 100755 index 0000000000000..64ce11b5e53bb --- /dev/null +++ b/administrator/components/com_contactdirectory/views/contacts/view.html.php @@ -0,0 +1,60 @@ +getModel(); + + if (!$user->authorize( 'com_contactdirectory', 'manage contacts' )) { + $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH')); + } + + $filter_state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter_catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' ); + $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'c.ordering', 'cmd' ); + $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + // Get data from the model + $items = & $this->get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + + // build list of categories + $javascript = 'onchange="document.adminForm.submit();"'; + $lists['category'] = JHTML::_('list.category', 'filter_catid', $option, intval( $filter_catid ), $javascript ); + + // state filter + $lists['state'] = JHTML::_('grid.state', $filter_state ); + + // table ordering + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + // search filter + $lists['search']= $search; + + $this->assignRef('user', JFactory::getUser()); + $this->assignRef('lists', $lists); + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } +} +?> \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/field/index.html b/administrator/components/com_contactdirectory/views/field/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/field/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/field/tmpl/default.php b/administrator/components/com_contactdirectory/views/field/tmpl/default.php new file mode 100755 index 0000000000000..646f7774e62d9 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/field/tmpl/default.php @@ -0,0 +1,123 @@ + + + + +[ ' . $text.' ]' ); +JToolBarHelper::save(); +JToolBarHelper::apply(); +if (!$edit) { + JToolBarHelper::cancel(); +} else { + // for existing items the button is renamed `close` + JToolBarHelper::cancel( 'cancel', 'Close' ); +} +?> + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + field->id) { + ?> + + + + + +
    : + +
    : + +
    :lists['published']; ?>
    :lists['pos']; ?>
    :lists['ordering']; ?>
    :lists['access']; ?>
    :lists['type']; ?>
    : + +
    :field->id;?>
    +
    +
    + +
    +
    + + startPane("menu-pane"); + echo $pane->startPanel(JText :: _('FIELD_PARAMETERS'), "param-page"); + echo $this->params->render(); + echo $pane->endPanel(); + echo $pane->endPane(); + ?> +
    +
    + +
    + + + + + + +
    diff --git a/administrator/components/com_contactdirectory/views/field/tmpl/index.html b/administrator/components/com_contactdirectory/views/field/tmpl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/field/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/field/view.html.php b/administrator/components/com_contactdirectory/views/field/view.html.php new file mode 100755 index 0000000000000..a0edfa807446a --- /dev/null +++ b/administrator/components/com_contactdirectory/views/field/view.html.php @@ -0,0 +1,111 @@ +getModel(); + + if (!$user->authorize( 'com_contactdirectory', 'manage fields' )) { + $mainframe->redirect('index.php?option=com_contactdirectory&controller=contact', JText::_('ALERTNOTAUTH')); + } + + $lists = array(); + + //get the field + $field =& $this->get('data'); + $isNew = ($field->id < 1); + + // fail if checked out not by 'me' + if ($model->isCheckedOut( $user->get('id') )) { + $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'THE_FIELD' ), $field->title ); + $mainframe->redirect( 'index.php?option=com_contactdirectory&controller=field', $msg ); + } + + // Edit or Create? + if (!$isNew) + { + $model->checkout( $user->get('id') ); + } + else + { + // initialise new record + $field->published = 1; + $field->approved = 1; + $field->order = 0; + } + + // build the html select list for ordering + $query = "SELECT ordering AS value, title AS text" + . " FROM #__contactdirectory_fields" + . " WHERE pos = '$field->pos'" + . " ORDER BY ordering"; + + $lists['ordering'] = JHTML::_('list.specificordering', $field, $field->id, $query ); + + // build the html select list for published + $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $field->published ); + + // build the html select list for access + $lists['access'] = JHTML::_('list.accesslevel', $field); + + // build the html select list for type + $types = array(); + //$types[] = JHTML::_('select.option', 'checkbox', 'Check Box (Single)' ); + //$types[] = JHTML::_('select.option', 'multicheckbox', 'Check Box (Muliple)' ); + //$types[] = JHTML::_('select.option', 'date', 'Date' ); + //$types[] = JHTML::_('select.option', 'select', 'Drop Down (Single Select)' ); + //$types[] = JHTML::_('select.option', 'multiselect', 'Drop Down (Multi-Select)' ); + $types[] = JHTML::_('select.option', 'text', JText::_('TEXT_FIELD')); + $types[] = JHTML::_('select.option', 'textarea', JText::_('TEXT_AREA')); + $types[] = JHTML::_('select.option', 'editor', JText::_('EDITOR_TEXT_AREA')); + //$types[] = JHTML::_('select.option', 'number', 'Number Text' ); + $types[] = JHTML::_('select.option', 'email', JText::_('EMAIL_ADDRESS')); + $types[] = JHTML::_('select.option', 'url', JText::_('URL')); + //$types[] = JHTML::_('select.option', 'radio', 'Radio Button' ); + $types[] = JHTML::_('select.option', 'image', JText::_('IMAGE')); + + $lists['type'] = JHTML::_('select.genericlist', $types, 'type', 'class="inputbox"', 'value', 'text', $field->type ); + + // build the html select list for position + $positions = array(); + $positions[] = JHTML::_('select.option', 'title', JText::_('TITLE')); + $positions[] = JHTML::_('select.option', 'top', JText::_('TOP')); + $positions[] = JHTML::_('select.option', 'left', JText::_('LEFT')); + $positions[] = JHTML::_('select.option', 'main', JText::_('MAIN')); + $positions[] = JHTML::_('select.option', 'right', JText::_('RIGHT')); + $positions[] = JHTML::_('select.option', 'bottom', JText::_('BOTTOM')); + + $lists['pos'] = JHTML::_('select.genericlist', $positions, 'pos', 'class="inputbox"', 'value', 'text', $field->pos ); + + //clean field data + JFilterOutput::objectHTMLSafe( $field, ENT_QUOTES, 'description' ); + + $file = JPATH_COMPONENT.DS.'models'.DS.'field.xml'; + $params = new JParameter( $field->params, $file ); + + $this->assignRef('lists', $lists); + $this->assignRef('field', $field); + $this->assignRef('params', $params); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_contactdirectory/views/fields/index.html b/administrator/components/com_contactdirectory/views/fields/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/fields/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/fields/tmpl/default.php b/administrator/components/com_contactdirectory/views/fields/tmpl/default.php new file mode 100755 index 0000000000000..2d99fea41821b --- /dev/null +++ b/administrator/components/com_contactdirectory/views/fields/tmpl/default.php @@ -0,0 +1,153 @@ + + + + + + +
    + + + + + +
    + : + + + + + lists['state']; + ?> +
    +
    + + + + + + + + + + + + + + + + + + + + + + items ); $i < $n; $i++) + { + $row = &$this->items[$i]; + + $link = JRoute::_( 'index.php?option=com_contactdirectory&controller=field&view=field&task=edit&cid[]='. $row->id ); + $access = JHTML::_('grid.access', $row, $i ); + $checked = JHTML::_('grid.checkedout', $row, $i ); + $published = JHTML::_('grid.published', $row, $i ); + + $ordering = ($this->lists['order'] == 'f.ordering'); + + ?> + "> + + + + + + + + + + + + + +
    + + + + + lists['order_Dir'], $this->lists['order'] ); ?> + + lists['order_Dir'], $this->lists['order'] ); ?> + + lists['order_Dir'], $this->lists['order'] ); ?> + + lists['order_Dir'], $this->lists['order'] ); ?> + + lists['order_Dir'], $this->lists['order'] ); ?> + items ); ?> + + lists['order_Dir'], $this->lists['order'] ); ?> + + lists['order_Dir'], @$this->lists['order'] ); ?> + + lists['order_Dir'], $this->lists['order'] ); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset( $i ); ?> + + + + user->get ('id'), $row->checked_out ) ) { + echo $row->title; + } else { + ?> + + + title; ?> + + + alias; ?> + + type; ?> + + + + pagination->orderUpIcon( $i, ($row->pos == @$this->items[$i-1]->pos),'orderup', 'Move Up', $ordering ); ?> + pagination->orderDownIcon( $i, $n, ($row->pos == @$this->items[$i+1]->pos), 'orderdown', 'Move Down', $ordering ); ?> + + class="text_area" style="text-align: center" /> + + pos;?> + + + + id; ?> +
    +
    + + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/fields/tmpl/index.html b/administrator/components/com_contactdirectory/views/fields/tmpl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/fields/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/fields/view.html.php b/administrator/components/com_contactdirectory/views/fields/view.html.php new file mode 100755 index 0000000000000..1db1998475358 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/fields/view.html.php @@ -0,0 +1,57 @@ +authorize( 'com_contactdirectory', 'manage fields' )) { + $mainframe->redirect('index.php?option=com_contactdirectory&controller=contact', JText::_('ALERTNOTAUTH')); + } + + $filter_state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'f.ordering', 'cmd' ); + $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + // Get data from the model + $items = & $this->get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + + // state filter + $lists['state'] = JHTML::_('grid.state', $filter_state ); + + // table ordering + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + // search filter + $lists['search'] = $search; + + $this->assignRef('user', JFactory::getUser()); + $this->assignRef('lists', $lists); + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } + +} + + +?> \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/import/index.html b/administrator/components/com_contactdirectory/views/import/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/import/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/import/tmpl/default.php b/administrator/components/com_contactdirectory/views/import/tmpl/default.php new file mode 100755 index 0000000000000..7371d6971b6b2 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/import/tmpl/default.php @@ -0,0 +1,31 @@ + + +
    +
    + +

    +
    + + + + + + +
    diff --git a/administrator/components/com_contactdirectory/views/import/tmpl/index.html b/administrator/components/com_contactdirectory/views/import/tmpl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/import/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/import/view.html.php b/administrator/components/com_contactdirectory/views/import/view.html.php new file mode 100755 index 0000000000000..b33d57e847283 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/import/view.html.php @@ -0,0 +1,51 @@ +get('Errors'))) { + JError::raiseError(500, implode("\n", $errors)); + return false; + } + + // Load the view template. + $result = $this->loadTemplate($tpl); + + // Check for an error. + if (JError::isError($result)) { + return $result; + } + echo $result; + } +} \ No newline at end of file diff --git a/administrator/components/com_contactdirectory/views/index.html b/administrator/components/com_contactdirectory/views/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_contactdirectory/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/admin.content.html.php b/administrator/components/com_content/admin.content.html.php deleted file mode 100644 index 71ae53c67e95e..0000000000000 --- a/administrator/components/com_content/admin.content.html.php +++ /dev/null @@ -1,924 +0,0 @@ - -
    - - - - - - -
    - : - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - getNullDate(); - for ($i=0, $n=count( $rows ); $i < $n; $i++) - { - $row = &$rows[$i]; - - $link = 'index.php?option=com_content§ionid='. $redirect .'&task=edit&cid[]='. $row->id; - - $row->sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->sectionid ); - $row->cat_link = JRoute::_( 'index.php?option=com_categories&task=edit&cid[]='. $row->catid ); - - $publish_up =& JFactory::getDate($row->publish_up); - $publish_down =& JFactory::getDate($row->publish_down); - $publish_up->setOffset($config->getValue('config.offset')); - $publish_down->setOffset($config->getValue('config.offset')); - if ( $now->toUnix() <= $publish_up->toUnix() && $row->state == 1 ) { - $img = 'publish_y.png'; - $alt = JText::_( 'Published' ); - } else if ( ( $now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate ) && $row->state == 1 ) { - $img = 'publish_g.png'; - $alt = JText::_( 'Published' ); - } else if ( $now->toUnix() > $publish_down->toUnix() && $row->state == 1 ) { - $img = 'publish_r.png'; - $alt = JText::_( 'Expired' ); - } else if ( $row->state == 0 ) { - $img = 'publish_x.png'; - $alt = JText::_( 'Unpublished' ); - } else if ( $row->state == -1 ) { - $img = 'disabled.png'; - $alt = JText::_( 'Archived' ); - } - $times = ''; - if (isset($row->publish_up)) { - if ($row->publish_up == $nullDate) { - $times .= JText::_( 'Start: Always' ); - } else { - $times .= JText::_( 'Start' ) .": ". $publish_up->toFormat(); - } - } - if (isset($row->publish_down)) { - if ($row->publish_down == $nullDate) { - $times .= "
    ". JText::_( 'Finish: No Expiry' ); - } else { - $times .= "
    ". JText::_( 'Finish' ) .": ". $publish_down->toFormat(); - } - } - - if ( $user->authorize( 'com_users', 'manage' ) ) { - if ( $row->created_by_alias ) { - $author = $row->created_by_alias; - } else { - $linkA = 'index.php?option=com_users&task=edit&cid[]='. $row->created_by; - $author = ''. $row->author .''; - } - } else { - if ( $row->created_by_alias ) { - $author = $row->created_by_alias; - } else { - $author = $row->author; - } - } - - $access = JHTML::_('grid.access', $row, $i, $row->state ); - $checked = JHTML::_('grid.checkedout', $row, $i ); - ?> - "> - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - getListFooter(); ?> -
    - getRowOffset( $i ); ?> - - - - get ('id'), $row->checked_out ) ) { - echo $row->title; - } else if ($row->state == -1) { - echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8'); - echo ' [ '. JText::_( 'Archived' ) .' ]'; - } else { - ?> - - title, ENT_QUOTES); ?> - - - - <?php echo $alt; ?> - - - <?php echo ( $row->frontpage ) ? JText::_( 'Yes' ) : JText::_( 'No' );?> - - orderUpIcon( $i, ($row->catid == @$rows[$i-1]->catid), 'orderup', 'Move Up', $ordering); ?> - orderDownIcon( $i, $n, ($row->catid == @$rows[$i+1]->catid), 'orderdown', 'Move Down', $ordering ); ?> - - class="text_area" style="text-align: center" /> - - - - - section_name; ?> - - - name; ?> - - - - created, JText::_('DATE_FORMAT_LC4') ); ?> - - hits ?> - - id; ?> -
    - - - - - - - - - -
    - - -
    - - - - - - -
    - : - - - - - -
    - -
    - - - - - - - - - - - - - - - - - - - - cat_link = JRoute::_( 'index.php?option=com_categories&task=edit&cid[]='. $row->catid ); - $row->sec_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->sectionid ); - - if ( $user->authorize( 'com_users', 'manage' ) ) { - if ( $row->created_by_alias ) { - $author = $row->created_by_alias; - } else { - $linkA = JRoute::_( 'index.php?option=com_users&task=edit&cid[]='. $row->created_by ); - $author = ''. $row->author .''; - } - } else { - if ( $row->created_by_alias ) { - $author = $row->created_by_alias; - } else { - $author = $row->author; - } - } - - ?> - "> - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - getListFooter(); ?> -
    - getRowOffset( $i ); ?> - - id ); ?> - - title; ?> - - id; ?> - - - sectname; ?> - - - name; ?> - - - - created, JText::_( 'DATE_FORMAT_LC4' ) ); ?> -
    -
    - - - - - - - - - - -
    - $row is passed with the id - * property set to 0. - * @param JTableContent The category object - * @param string The html for the groups select list - */ - function editContent( &$row, $section, &$lists, &$sectioncategories, $option, &$form ) - { - JRequest::setVar( 'hidemainmenu', 1 ); - - jimport('joomla.html.pane'); - JFilterOutput::objectHTMLSafe( $row ); - - $db =& JFactory::getDBO(); - $editor =& JFactory::getEditor(); - $pane =& JPane::getInstance('sliders'); - - JHTML::_('behavior.tooltip'); - ?> - - -
    - - - - - - -
    - - - - - -
    - display( 'text', $row->text , '100%', '550', '75', '20' ) ; - ?> -
    -
    - startPane("content-pane"); - echo $pane->startPanel( $title, "detail-page" ); - echo $form->render('details'); - - $title = JText::_( 'Parameters - Advanced' ); - echo $pane->endPanel(); - echo $pane->startPanel( $title, "params-page" ); - echo $form->render('params', 'advanced'); - - $title = JText::_( 'Metadata Information' ); - echo $pane->endPanel(); - echo $pane->startPanel( $title, "metadata-page" ); - echo $form->render('meta', 'metadata'); - - echo $pane->endPanel(); - echo $pane->endPane(); - ?> -
    - - - - - - - - -
    - - - -
    - - - - - - -
    - : -
    - -

    -
    - : -
    - "; - foreach ( $items as $item ) { - echo "
  • ". $item->title ."
  • "; - } - echo ""; - ?> -
    -

    - - - - - "; - } - ?> - -
    - - -
    - - - - - - -
    - : -
    - -

    -
    - : -
    - "; - foreach ( $items as $item ) { - echo "
  • ". $item->title ."
  • "; - } - echo ""; - ?> -
    -

    - - - - - "; - } - ?> - -
    - setLink(JURI::root()); - - JHTML::_('behavior.caption'); - - ?> - - - - - - - - - -
    - - - -
    - - - - - - - - - -
    - - - -
    - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - -
    - - - - - - - -
    - - - - - - - -
    - getNullDate(); - - // used to hide "Reset Hits" when hits = 0 - if ( !$row->hits ) { - $visibility = 'style="display: none; visibility: hidden;"'; - } else { - $visibility = ''; - } - - ?> - - id ) { - ?> - - - - - - - - - - - - - - - - - - - - - - - - - -
    - : - - id; ?> -
    - - - state > 0 ? JText::_( 'Published' ) : ($row->state < 0 ? JText::_( 'Archived' ) : JText::_( 'Draft Unpublished' ) );?> -
    - - - hits;?> - > - - -
    - - - version;?> -
    - - - created == $nullDate ) { - echo JText::_( 'New document' ); - } else { - echo JHTML::_('date', $row->created, JText::_('DATE_FORMAT_LC2') ); - } - ?> -
    - - - modified == $nullDate ) { - echo JText::_( 'Not modified' ); - } else { - echo JHTML::_('date', $row->modified, JText::_('DATE_FORMAT_LC2')); - } - ?> -
    - execute( $task ); - $controller->redirect(); - break; - - case 'add' : - case 'new' : - ContentController::editContent(false); - break; - - case 'edit' : - ContentController::editContent(true); - break; - - case 'go2menu' : - case 'go2menuitem' : - case 'resethits' : - case 'menulink' : - case 'apply' : - case 'save' : - ContentController::saveContent(); - break; - - case 'remove' : - ContentController::removeContent(); - break; - - case 'publish' : - ContentController::changeContent(1); - break; - - case 'unpublish' : - ContentController::changeContent(0); - break; - - case 'toggle_frontpage' : - ContentController::toggleFrontPage(); - break; - - case 'archive' : - ContentController::changeContent(-1); - break; - - case 'unarchive' : - ContentController::changeContent(0); - break; - - case 'cancel' : - ContentController::cancelContent(); - break; - - case 'orderup' : - ContentController::orderContent(-1); - break; - - case 'orderdown' : - ContentController::orderContent(1); - break; - - //case 'showarchive' : - // JContentController::viewArchive(); - // break; - - case 'movesect' : - ContentController::moveSection(); - break; - - case 'movesectsave' : - ContentController::moveSectionSave(); - break; - - case 'copy' : - ContentController::copyItem(); - break; - - case 'copysave' : - ContentController::copyItemSave(); - break; - - case 'accesspublic' : - ContentController::accessMenu(0); - break; - - case 'accessregistered' : - ContentController::accessMenu(1); - break; - - case 'accessspecial' : - ContentController::accessMenu(2); - break; - - case 'saveorder' : - ContentController::saveOrder(); - break; - - case 'preview' : - ContentController::previewContent(); - break; - - case 'ins_pagebreak' : - ContentController::insertPagebreak(); - break; - - default : - ContentController::viewContent(); - break; -} \ No newline at end of file diff --git a/administrator/components/com_content/helper/content.php b/administrator/components/com_content/classes/content.php similarity index 93% rename from administrator/components/com_content/helper/content.php rename to administrator/components/com_content/classes/content.php index 81ba951b422d9..0563dab2106c3 100644 --- a/administrator/components/com_content/helper/content.php +++ b/administrator/components/com_content/classes/content.php @@ -1,6 +1,6 @@ -1' . + ' AND c.state <> -2' . + ' GROUP BY u.name' . + ' ORDER BY u.name'; + $authors[] = JHTML::_('select.option', '0', '- '.JText::_('Select Author').' -', 'created_by', 'name'); + $db->setQuery($query); + $authors = array_merge($authors, $db->loadObjectList()); + return JHTML::_('select.genericlist', $authors, $name, 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'created_by', 'name', $filter_authorid); + } + + function category( $name, $filter_catid, $filter_sectionid = null ) + { + $db =& JFactory::getDBO(); + $cat_filter = null; + if (($filter_sectionid !== null) && ($filter_sectionid >= 0)) { + $cat_filter = ' WHERE cc.section = '. (int) $filter_sectionid; + } + $query = 'SELECT cc.id AS value, cc.title AS text, section' . + ' FROM #__categories AS cc' . + ' INNER JOIN #__sections AS s ON s.id = cc.section ' . + $cat_filter . + ' ORDER BY s.ordering, cc.ordering'; + $categories[] = JHTML::_('select.option', '0', '- '.JText::_('Select Category').' -'); + $db->setQuery($query); + $categories = array_merge($categories, $db->loadObjectList()); + return JHTML::_('select.genericlist', $categories, $name, 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $filter_catid); + } +} diff --git a/administrator/components/com_content/classes/index.html b/administrator/components/com_content/classes/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/classes/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/content.php b/administrator/components/com_content/content.php new file mode 100644 index 0000000000000..cb6b65b49b852 --- /dev/null +++ b/administrator/components/com_content/content.php @@ -0,0 +1,41 @@ +execute(JRequest::getCmd('task')); +$controller_obj->redirect(); \ No newline at end of file diff --git a/administrator/components/com_content/controller.php b/administrator/components/com_content/controller.php index 13b446574f486..7dad3bde916ff 100644 --- a/administrator/components/com_content/controller.php +++ b/administrator/components/com_content/controller.php @@ -1,1451 +1,619 @@ -getModel( 'element' ); - $view = &$this->getView( 'element'); - $view->setModel( $model, true ); - $view->display(); - } - - /** - * Compiles a list of installed or defined modules - * @param database A database connector object - */ - function viewContent() - { - global $mainframe; - - // Initialize variables - $db =& JFactory::getDBO(); - $filter = null; - - // Get some variables from the request - $sectionid = JRequest::getVar( 'sectionid', -1, '', 'int' ); - $redirect = $sectionid; - $option = JRequest::getCmd( 'option' ); - $context = 'com_content.viewcontent'; - $filter_order = $mainframe->getUserStateFromRequest( $context.'filter_order', 'filter_order', '', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $context.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); - $filter_state = $mainframe->getUserStateFromRequest( $context.'filter_state', 'filter_state', '', 'word' ); - $catid = $mainframe->getUserStateFromRequest( $context.'catid', 'catid', 0, 'int' ); - $filter_authorid = $mainframe->getUserStateFromRequest( $context.'filter_authorid', 'filter_authorid', 0, 'int' ); - $filter_sectionid = $mainframe->getUserStateFromRequest( $context.'filter_sectionid', 'filter_sectionid', -1, 'int' ); - $search = $mainframe->getUserStateFromRequest( $context.'search', 'search', '', 'string' ); - $search = JString::strtolower($search); - - $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); - $limitstart = $mainframe->getUserStateFromRequest($context.'limitstart', 'limitstart', 0, 'int'); - - // In case limit has been changed, adjust limitstart accordingly - $limitstart = ( $limit != 0 ? (floor($limitstart / $limit) * $limit) : 0 ); - - //$where[] = "c.state >= 0"; - $where[] = 'c.state != -2'; - - if (!$filter_order) { - $filter_order = 'section_name'; - } - $order = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', section_name, cc.title, c.ordering'; - $all = 1; - - if ($filter_sectionid >= 0) { - $filter = ' WHERE cc.section = '. (int) $filter_sectionid; - } - $section->title = 'All Articles'; - $section->id = 0; - - /* - * Add the filter specific information to the where clause - */ - // Section filter - if ($filter_sectionid >= 0) { - $where[] = 'c.sectionid = ' . (int) $filter_sectionid; - } - // Category filter - if ($catid > 0) { - $where[] = 'c.catid = ' . (int) $catid; - } - // Author filter - if ($filter_authorid > 0) { - $where[] = 'c.created_by = ' . (int) $filter_authorid; - } - // Content state filter - if ($filter_state) { - if ($filter_state == 'P') { - $where[] = 'c.state = 1'; - } else { - if ($filter_state == 'U') { - $where[] = 'c.state = 0'; - } else if ($filter_state == 'A') { - $where[] = 'c.state = -1'; - } else { - $where[] = 'c.state != -2'; - } - } - } - // Keyword filter - if ($search) { - $where[] = '(LOWER( c.title ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ) . - ' OR c.id = ' . (int) $search . ')'; - } - - // Build the where clause of the content record query - $where = (count($where) ? ' WHERE '.implode(' AND ', $where) : ''); - - // Get the total number of records - $query = 'SELECT COUNT(*)' . - ' FROM #__content AS c' . - ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . - ' LEFT JOIN #__sections AS s ON s.id = c.sectionid' . - $where; - $db->setQuery($query); - $total = $db->loadResult(); - - - // Create the pagination object - jimport('joomla.html.pagination'); - $pagination = new JPagination($total, $limitstart, $limit); - - // Get the articles - $query = 'SELECT c.*, g.name AS groupname, cc.title AS name, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author' . - ' FROM #__content AS c' . - ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . - ' LEFT JOIN #__sections AS s ON s.id = c.sectionid' . - ' LEFT JOIN #__groups AS g ON g.id = c.access' . - ' LEFT JOIN #__users AS u ON u.id = c.checked_out' . - ' LEFT JOIN #__users AS v ON v.id = c.created_by' . - ' LEFT JOIN #__content_frontpage AS f ON f.content_id = c.id' . - $where . - $order; - $db->setQuery($query, $pagination->limitstart, $pagination->limit); - $rows = $db->loadObjectList(); - - // If there is a database query error, throw a HTTP 500 and exit - if ($db->getErrorNum()) { - JError::raiseError( 500, $db->stderr() ); - return false; - } - - // get list of categories for dropdown filter - $query = 'SELECT cc.id AS value, cc.title AS text, section' . - ' FROM #__categories AS cc' . - ' INNER JOIN #__sections AS s ON s.id = cc.section ' . - $filter . - ' ORDER BY s.ordering, cc.ordering'; - $lists['catid'] = ContentHelper::filterCategory($query, $catid); - - // get list of sections for dropdown filter - $javascript = 'onchange="document.adminForm.submit();"'; - $lists['sectionid'] = JHTML::_('list.section', 'filter_sectionid', $filter_sectionid, $javascript); - - // get list of Authors for dropdown filter - $query = 'SELECT c.created_by, u.name' . - ' FROM #__content AS c' . - ' INNER JOIN #__sections AS s ON s.id = c.sectionid' . - ' LEFT JOIN #__users AS u ON u.id = c.created_by' . - ' WHERE c.state <> -1' . - ' AND c.state <> -2' . - ' GROUP BY u.name' . - ' ORDER BY u.name'; - $authors[] = JHTML::_('select.option', '0', '- '.JText::_('Select Author').' -', 'created_by', 'name'); - $db->setQuery($query); - $authors = array_merge($authors, $db->loadObjectList()); - $lists['authorid'] = JHTML::_('select.genericlist', $authors, 'filter_authorid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'created_by', 'name', $filter_authorid); - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state, 'Published', 'Unpublished', 'Archived'); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search'] = $search; - - ContentView::showContent($rows, $lists, $pagination, $redirect); - } - - /** - * Shows a list of archived articles - * @param int The section id - */ - function viewArchive() - { - global $mainframe; - - // Initialize variables - $db =& JFactory::getDBO(); - - $sectionid = JRequest::getVar( 'sectionid', 0, '', 'int' ); - $option = JRequest::getCmd( 'option' ); - - $filter_order = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.filter_order", 'filter_order', 'sectname', 'cmd'); - $filter_order_Dir = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.filter_order_Dir", 'filter_order_Dir', '', 'word'); - $catid = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.catid", 'catid', 0, 'int'); - $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); - $limitstart = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.limitstart", 'limitstart', 0, 'int'); - $filter_authorid = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.filter_authorid", 'filter_authorid', 0, 'int'); - $filter_sectionid = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.filter_sectionid", 'filter_sectionid', 0, 'int'); - $search = $mainframe->getUserStateFromRequest("$option.$sectionid.viewarchive.search", 'search', '', 'string'); - $search = JString::strtolower($search); - $redirect = $sectionid; - - // A section id of zero means view all articles [all sections] - if ($sectionid == 0) - { - $where = array ('c.state = -1', 'c.catid = cc.id', 'cc.section = s.id', 's.scope = "content"'); - $filter = ' , #__sections AS s WHERE s.id = c.section'; - $all = 1; - } - else - { - //We are viewing a specific section - $where = array ('c.state = -1', 'c.catid = cc.id', 'cc.section = s.id', 's.scope = "content"', 'c.sectionid= '.(int) $sectionid); - $filter = ' WHERE section = '.$db->Quote($sectionid); - $all = NULL; - } - - // Section filter - if ($filter_sectionid > 0) - { - $where[] = 'c.sectionid = ' . (int) $filter_sectionid; - } - // Author filter - if ($filter_authorid > 0) - { - $where[] = 'c.created_by = ' . (int) $filter_authorid; - } - // Category filter - if ($catid > 0) - { - $where[] = 'c.catid = ' . (int) $catid; - } - // Keyword filter - if ($search) - { - $where[] = 'LOWER( c.title ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); - } - - // TODO: Sanitise $filter_order - $filter_order_Dir = ($filter_order_Dir == 'ASC' ? 'ASC' : 'DESC'); - $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', sectname, cc.name, c.ordering'; - $where = (count($where) ? ' WHERE '.implode(' AND ', $where) : ''); - - // get the total number of records - $query = 'SELECT COUNT(*)' . - ' FROM #__content AS c' . - ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . - ' LEFT JOIN #__sections AS s ON s.id = c.sectionid' . - $where; - $db->setQuery($query); - $total = $db->loadResult(); - - jimport('joomla.html.pagination'); - $pagination = new JPagination($total, $limitstart, $limit); - - $query = 'SELECT c.*, g.name AS groupname, cc.name, v.name AS author, s.title AS sectname' . - ' FROM #__content AS c' . - ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . - ' LEFT JOIN #__sections AS s ON s.id = c.sectionid' . - ' LEFT JOIN #__groups AS g ON g.id = c.access' . - ' LEFT JOIN #__users AS v ON v.id = c.created_by' . - $where . - $orderby; - $db->setQuery($query, $pagination->limitstart, $pagination->limit); - $rows = $db->loadObjectList(); - - // If there is a database query error, throw a HTTP 500 and exit - if ($db->getErrorNum()) - { - JError::raiseError( 500, $db->stderr() ); - return false; - } - - // get list of categories for dropdown filter - $query = 'SELECT c.id AS value, c.title AS text' . - ' FROM #__categories AS c' . - $filter . - ' ORDER BY c.ordering'; - $lists['catid'] = ContentHelper::filterCategory($query, $catid); - - // get list of sections for dropdown filter - $javascript = 'onchange="document.adminForm.submit();"'; - $lists['sectionid'] = JAdminMenus::SelectSection('filter_sectionid', $filter_sectionid, $javascript); - - $section = & JTable::getInstance('section'); - $section->load($sectionid); - - // get list of Authors for dropdown filter - $query = 'SELECT c.created_by, u.name' . - ' FROM #__content AS c' . - ' INNER JOIN #__sections AS s ON s.id = c.sectionid' . - ' LEFT JOIN #__users AS u ON u.id = c.created_by' . - ' WHERE c.state = -1' . - ' GROUP BY u.name' . - ' ORDER BY u.name'; - $db->setQuery($query); - $authors[] = JHTML::_('select.option', '0', '- '.JText::_('Select Author').' -', 'created_by', 'name'); - $authors = array_merge($authors, $db->loadObjectList()); - $lists['authorid'] = JHTML::_('select.genericlist', $authors, 'filter_authorid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'created_by', 'name', $filter_authorid); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search'] = $search; - - ContentView::showArchive($rows, $section, $lists, $pagination, $option, $all, $redirect); - } - - /** - * Compiles information to add or edit the record - * - * @param database A database connector object - * @param integer The unique id of the record to edit (0 if new) - * @param integer The id of the content section - */ - function editContent($edit) - { - global $mainframe; - - // Initialize variables - $db = & JFactory::getDBO(); - $user = & JFactory::getUser(); - - $cid = JRequest::getVar( 'cid', array(0), '', 'array' ); - JArrayHelper::toInteger($cid, array(0)); - $id = JRequest::getVar( 'id', $cid[0], '', 'int' ); - $option = JRequest::getCmd( 'option' ); - $nullDate = $db->getNullDate(); - $contentSection = ''; - $sectionid = 0; - - // Create and load the content table row - $row = & JTable::getInstance('content'); - if($edit) - $row->load($id); - - if ($id) { - $sectionid = $row->sectionid; - if ($row->state < 0) { - $mainframe->redirect('index.php?option=com_content', JText::_('You cannot edit an archived item')); - } - } - - // A sectionid of zero means grab from all sections - if ($sectionid == 0) { - $where = ' WHERE section NOT LIKE "%com_%"'; - } else { - // Grab from the specific section - $where = ' WHERE section = '. $db->Quote( $sectionid ); - } - - /* - * If the item is checked out we cannot edit it... unless it was checked - * out by the current user. - */ - if ( JTable::isCheckedOut($user->get ('id'), $row->checked_out )) - { - $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The item'), $row->title); - $mainframe->redirect('index.php?option=com_content', $msg); - } - - if ($id) - { - $row->checkout($user->get('id')); - - if (trim($row->images)) { - $row->images = explode("\n", $row->images); - } else { - $row->images = array (); - } - - $query = 'SELECT name' . - ' FROM #__users'. - ' WHERE id = '. (int) $row->created_by; - $db->setQuery($query); - $row->creator = $db->loadResult(); - - // test to reduce unneeded query - if ($row->created_by == $row->modified_by) { - $row->modifier = $row->creator; - } else { - $query = 'SELECT name' . - ' FROM #__users' . - ' WHERE id = '. (int) $row->modified_by; - $db->setQuery($query); - $row->modifier = $db->loadResult(); - } - - $query = 'SELECT COUNT(content_id)' . - ' FROM #__content_frontpage' . - ' WHERE content_id = '. (int) $row->id; - $db->setQuery($query); - $row->frontpage = $db->loadResult(); - if (!$row->frontpage) { - $row->frontpage = 0; - } - } - else - { - if (!$sectionid && JRequest::getInt('filter_sectionid')) { - $sectionid =JRequest::getInt('filter_sectionid'); - } - - if (JRequest::getInt('catid')) - { - $row->catid = JRequest::getInt('catid'); - $category = & JTable::getInstance('category'); - $category->load($row->catid); - $sectionid = $category->section; - } else { - $row->catid = NULL; - } - $createdate =& JFactory::getDate(); - $row->sectionid = $sectionid; - $row->version = 0; - $row->state = 1; - $row->ordering = 0; - $row->images = array (); - $row->publish_up = $createdate->toUnix(); - $row->publish_down = JText::_('Never'); - $row->creator = ''; - $row->created = $createdate->toUnix(); - $row->modified = $nullDate; - $row->modifier = ''; - $row->frontpage = 0; - - } - - $javascript = "onchange=\"changeDynaList( 'catid', sectioncategories, document.adminForm.sectionid.options[document.adminForm.sectionid.selectedIndex].value, 0, 0);\""; - - $query = 'SELECT s.id, s.title' . - ' FROM #__sections AS s' . - ' ORDER BY s.ordering'; - $db->setQuery($query); - - $sections[] = JHTML::_('select.option', '-1', '- '.JText::_('Select Section').' -', 'id', 'title'); - $sections[] = JHTML::_('select.option', '0', JText::_('Uncategorized'), 'id', 'title'); - $sections = array_merge($sections, $db->loadObjectList()); - $lists['sectionid'] = JHTML::_('select.genericlist', $sections, 'sectionid', 'class="inputbox" size="1" '.$javascript, 'id', 'title', intval($row->sectionid)); - - foreach ($sections as $section) - { - $section_list[] = (int) $section->id; - // get the type name - which is a special category - if ($row->sectionid) { - if ($section->id == $row->sectionid) { - $contentSection = $section->title; - } - } else { - if ($section->id == $sectionid) { - $contentSection = $section->title; - } - } - } - - $sectioncategories = array (); - $sectioncategories[-1] = array (); - $sectioncategories[-1][] = JHTML::_('select.option', '-1', JText::_( 'Select Category' ), 'id', 'title'); - $section_list = implode('\', \'', $section_list); - - $query = 'SELECT id, title, section' . - ' FROM #__categories' . - ' WHERE section IN ( \''.$section_list.'\' )' . - ' ORDER BY ordering'; - $db->setQuery($query); - $cat_list = $db->loadObjectList(); - - // Uncategorized category mapped to uncategorized section - $uncat = new stdClass(); - $uncat->id = 0; - $uncat->title = JText::_('Uncategorized'); - $uncat->section = 0; - $cat_list[] = $uncat; - foreach ($sections as $section) - { - $sectioncategories[$section->id] = array (); - $rows2 = array (); - foreach ($cat_list as $cat) - { - if ($cat->section == $section->id) { - $rows2[] = $cat; - } - } - foreach ($rows2 as $row2) { - $sectioncategories[$section->id][] = JHTML::_('select.option', $row2->id, $row2->title, 'id', 'title'); - } - } - $sectioncategories['-1'][] = JHTML::_('select.option', '-1', JText::_( 'Select Category' ), 'id', 'title'); - $categories = array(); - foreach ($cat_list as $cat) { - if($cat->section == $row->sectionid) - $categories[] = $cat; - } - - $categories[] = JHTML::_('select.option', '-1', JText::_( 'Select Category' ), 'id', 'title'); - $lists['catid'] = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1"', 'id', 'title', intval($row->catid)); - - // build the html select list for ordering - $query = 'SELECT ordering AS value, title AS text' . - ' FROM #__content' . - ' WHERE catid = ' . (int) $row->catid . - ' AND state >= 0' . - ' ORDER BY ordering'; - if($edit) - $lists['ordering'] = JHTML::_('list.specificordering', $row, $id, $query, 1); - else - $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query, 1); - - // build the html radio buttons for frontpage - $lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', $row->frontpage); - - // build the html radio buttons for published - $lists['state'] = JHTML::_('select.booleanlist', 'state', '', $row->state); - - /* - * We need to unify the introtext and fulltext fields and have the - * fields separated by the {readmore} tag, so lets do that now. - */ - if (JString::strlen($row->fulltext) > 1) { - $row->text = $row->introtext . "
    " . $row->fulltext; - } else { - $row->text = $row->introtext; - } - - // Create the form - $form = new JParameter('', JPATH_COMPONENT.DS.'models'.DS.'article.xml'); - - // Details Group - $active = (intval($row->created_by) ? intval($row->created_by) : $user->get('id')); - $form->set('created_by', $active); - $form->set('access', $row->access); - $form->set('created_by_alias', $row->created_by_alias); - - $form->set('created', JHTML::_('date', $row->created, '%Y-%m-%d %H:%M:%S')); - $form->set('publish_up', JHTML::_('date', $row->publish_up, '%Y-%m-%d %H:%M:%S')); - if (JHTML::_('date', $row->publish_down, '%Y') <= 1969 || $row->publish_down == $db->getNullDate()) { - $form->set('publish_down', JText::_('Never')); - } else { - $form->set('publish_down', JHTML::_('date', $row->publish_down, '%Y-%m-%d %H:%M:%S')); - } - - // Advanced Group - $form->loadINI($row->attribs); - - // Metadata Group - $form->set('description', $row->metadesc); - $form->set('keywords', $row->metakey); - $form->loadINI($row->metadata); - - ContentView::editContent($row, $contentSection, $lists, $sectioncategories, $option, $form); - } - - /** - * Saves the article an edit form submit - * @param database A database connector object - */ - function saveContent() - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db = & JFactory::getDBO(); - $user = & JFactory::getUser(); - - $details = JRequest::getVar( 'details', array(), 'post', 'array'); - $option = JRequest::getCmd( 'option' ); - $task = JRequest::getCmd( 'task' ); - $sectionid = JRequest::getVar( 'sectionid', 0, '', 'int' ); - $redirect = JRequest::getVar( 'redirect', $sectionid, 'post', 'int' ); - $menu = JRequest::getVar( 'menu', 'mainmenu', 'post', 'cmd' ); - $menuid = JRequest::getVar( 'menuid', 0, 'post', 'int' ); - $nullDate = $db->getNullDate(); - - $row = & JTable::getInstance('content'); - if (!$row->bind(JRequest::get('post'))) { - JError::raiseError( 500, $db->stderr() ); - return false; - } - $row->bind($details); - - // sanitise id field - $row->id = (int) $row->id; - - // Are we saving from an item edit? - if ($row->id) { - $datenow =& JFactory::getDate(); - $row->modified = $datenow->toMySQL(); - $row->modified_by = $user->get('id'); - } - - $row->created_by = $row->created_by ? $row->created_by : $user->get('id'); - - if ($row->created && strlen(trim( $row->created )) <= 10) { - $row->created .= ' 00:00:00'; - } - - $config =& JFactory::getConfig(); - $tzoffset = $config->getValue('config.offset'); - $date =& JFactory::getDate($row->created, $tzoffset); - $row->created = $date->toMySQL(); - - // Append time if not added to publish date - if (strlen(trim($row->publish_up)) <= 10) { - $row->publish_up .= ' 00:00:00'; - } - - $date =& JFactory::getDate($row->publish_up, $tzoffset); - $row->publish_up = $date->toMySQL(); - - // Handle never unpublish date - if (trim($row->publish_down) == JText::_('Never') || trim( $row->publish_down ) == '') - { - $row->publish_down = $nullDate; - } - else - { - if (strlen(trim( $row->publish_down )) <= 10) { - $row->publish_down .= ' 00:00:00'; - } - $date =& JFactory::getDate($row->publish_down, $tzoffset); - $row->publish_down = $date->toMySQL(); - } - - // Get a state and parameter variables from the request - $row->state = JRequest::getVar( 'state', 0, '', 'int' ); - $params = JRequest::getVar( 'params', null, 'post', 'array' ); - - // Build parameter INI string - if (is_array($params)) - { - $txt = array (); - foreach ($params as $k => $v) { - $txt[] = "$k=$v"; - } - $row->attribs = implode("\n", $txt); - } - - // Get metadata string - $metadata = JRequest::getVar( 'meta', null, 'post', 'array'); - if (is_array($params)) - { - $txt = array(); - foreach ($metadata as $k => $v) { - if ($k == 'description') { - $row->metadesc = $v; - } elseif ($k == 'keywords') { - $row->metakey = $v; - } else { - $txt[] = "$k=$v"; - } - } - $row->metadata = implode("\n", $txt); - } - - // Prepare the content for saving to the database - ContentHelper::saveContentPrep( $row ); - - // Make sure the data is valid - if (!$row->check()) { - JError::raiseError( 500, $db->stderr() ); - return false; - } - - // Increment the content version number - $row->version++; - - // Store the content to the database - if (!$row->store()) { - JError::raiseError( 500, $db->stderr() ); - return false; - } - - // Check the article and update item order - $row->checkin(); - $row->reorder('catid = '.(int) $row->catid.' AND state >= 0'); - - /* - * We need to update frontpage status for the article. - * - * First we include the frontpage table and instantiate an instance of it. - */ - require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_frontpage'.DS.'tables'.DS.'frontpage.php'); - $fp = new TableFrontPage($db); - - // Is the article viewable on the frontpage? - if (JRequest::getVar( 'frontpage', 0, '', 'int' )) - { - // Is the item already viewable on the frontpage? - if (!$fp->load($row->id)) - { - // Insert the new entry - $query = 'INSERT INTO #__content_frontpage' . - ' VALUES ( '. (int) $row->id .', 1 )'; - $db->setQuery($query); - if (!$db->query()) - { - JError::raiseError( 500, $db->stderr() ); - return false; - } - $fp->ordering = 1; - } - } - else - { - // Delete the item from frontpage if it exists - if (!$fp->delete($row->id)) { - $msg .= $fp->stderr(); - } - $fp->ordering = 0; - } - $fp->reorder(); - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - switch ($task) - { - case 'go2menu' : - $mainframe->redirect('index.php?option=com_menus&menutype='.$menu); - break; - - case 'go2menuitem' : - $mainframe->redirect('index.php?option=com_menus&menutype='.$menu.'&task=edit&id='.$menuid); - break; - - case 'menulink' : - ContentHelper::menuLink($redirect, $row->id); - break; - - case 'resethits' : - ContentHelper::resetHits($redirect, $row->id); - break; - - case 'apply' : - $msg = JText::sprintf('SUCCESSFULLY SAVED CHANGES TO ARTICLE', $row->title); - $mainframe->redirect('index.php?option=com_content§ionid='.$redirect.'&task=edit&cid[]='.$row->id, $msg); - break; - - case 'save' : - default : - $msg = JText::sprintf('Successfully Saved Article', $row->title); - $mainframe->redirect('index.php?option=com_content§ionid='.$redirect, $msg); - break; - } - } - - /** - * Changes the state of one or more content pages - * - * @param string The name of the category section - * @param integer A unique category id (passed from an edit form) - * @param array An array of unique category id numbers - * @param integer 0 if unpublishing, 1 if publishing - * @param string The name of the current user - */ - function changeContent( $state = 0 ) - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db = & JFactory::getDBO(); - $user = & JFactory::getUser(); - - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); - JArrayHelper::toInteger($cid); - $option = JRequest::getCmd( 'option' ); - $task = JRequest::getCmd( 'task' ); - $rtask = JRequest::getCmd( 'returntask', '', 'post' ); - if ($rtask) { - $rtask = '&task='.$rtask; - } - - if (count($cid) < 1) { - $redirect = JRequest::getVar( 'redirect', '', 'post', 'int' ); - $action = ($state == 1) ? 'publish' : ($state == -1 ? 'archive' : 'unpublish'); - $msg = JText::_('Select an item to') . ' ' . JText::_($action); - $mainframe->redirect('index.php?option='.$option.$rtask.'§ionid='.$redirect, $msg, 'error'); - } - - // Get some variables for the query - $uid = $user->get('id'); - $total = count($cid); - $cids = implode(',', $cid); - - $query = 'UPDATE #__content' . - ' SET state = '. (int) $state . - ' WHERE id IN ( '. $cids .' ) AND ( checked_out = 0 OR (checked_out = '. (int) $uid .' ) )'; - $db->setQuery($query); - if (!$db->query()) { - JError::raiseError( 500, $db->getErrorMsg() ); - return false; - } - - if (count($cid) == 1) { - $row = & JTable::getInstance('content'); - $row->checkin($cid[0]); - } - - switch ($state) - { - case -1 : - $msg = JText::sprintf('Item(s) successfully Archived', $total); - break; - - case 1 : - $msg = JText::sprintf('Item(s) successfully Published', $total); - break; - - case 0 : - default : - if ($task == 'unarchive') { - $msg = JText::sprintf('Item(s) successfully Unarchived', $total); - } else { - $msg = JText::sprintf('Item(s) successfully Unpublished', $total); - } - break; - } - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - // Get some return/redirect information from the request - $redirect = JRequest::getVar( 'redirect', $row->sectionid, 'post', 'int' ); - - $mainframe->redirect('index.php?option='.$option.$rtask.'§ionid='.$redirect, $msg); - } - - /** - * Changes the frontpage state of one or more articles - * - */ - function toggleFrontPage() - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); - $option = JRequest::getCmd( 'option' ); - $msg = null; - - JArrayHelper::toInteger($cid); - - if (count($cid) < 1) { - $msg = JText::_('Select an item to toggle'); - $mainframe->redirect('index.php?option='.$option, $msg, 'error'); - } - - /* - * We need to update frontpage status for the articles. - * - * First we include the frontpage table and instantiate an instance of - * it. - */ - require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_frontpage'.DS.'tables'.DS.'frontpage.php'); - $fp = new TableFrontPage($db); - - foreach ($cid as $id) - { - // toggles go to first place - if ($fp->load($id)) { - if (!$fp->delete($id)) { - $msg .= $fp->stderr(); - } - $fp->ordering = 0; - } else { - // new entry - $query = 'INSERT INTO #__content_frontpage' . - ' VALUES ( '. (int) $id .', 0 )'; - $db->setQuery($query); - if (!$db->query()) { - JError::raiseError( 500, $db->stderr() ); - return false; - } - $fp->ordering = 0; - } - $fp->reorder(); - } - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - $mainframe->redirect('index.php?option='.$option, $msg); - } - - function removeContent() - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db = & JFactory::getDBO(); - - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); - $option = JRequest::getCmd( 'option' ); - $return = JRequest::getCmd( 'returntask', '', 'post' ); - $nullDate = $db->getNullDate(); - - JArrayHelper::toInteger($cid); - - if (count($cid) < 1) { - $msg = JText::_('Select an item to delete'); - $mainframe->redirect('index.php?option='.$option, $msg, 'error'); - } - - // Removed content gets put in the trash [state = -2] and ordering is always set to 0 - $state = '-2'; - $ordering = '0'; - - // Get the list of content id numbers to send to trash. - $cids = implode(',', $cid); - - // Update articles in the database - $query = 'UPDATE #__content' . - ' SET state = '.(int) $state . - ', ordering = '.(int) $ordering . - ', checked_out = 0, checked_out_time = '.$db->Quote($nullDate). - ' WHERE id IN ( '. $cids. ' )'; - $db->setQuery($query); - if (!$db->query()) - { - JError::raiseError( 500, $db->getErrorMsg() ); - return false; - } - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - $msg = JText::sprintf('Item(s) sent to the Trash', count($cid)); - $mainframe->redirect('index.php?option='.$option.'&task='.$return, $msg); - } - - /** - * Cancels an edit operation - */ - function cancelContent() - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db = & JFactory::getDBO(); - - // Check the article in if checked out - $row = & JTable::getInstance('content'); - $row->bind(JRequest::get('post')); - $row->checkin(); - - $mainframe->redirect('index.php?option=com_content'); - } - - /** - * Moves the order of a record - * @param integer The increment to reorder by - */ - function orderContent($direction) - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db = & JFactory::getDBO(); - - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); - - if (isset( $cid[0] )) - { - $row = & JTable::getInstance('content'); - $row->load( (int) $cid[0] ); - $row->move($direction, 'catid = ' . (int) $row->catid . ' AND state >= 0' ); - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - } - - $mainframe->redirect('index.php?option=com_content'); - } - - /** - * Form for moving item(s) to a different section and category - */ - function moveSection() - { - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db =& JFactory::getDBO(); - - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); - $sectionid = JRequest::getVar( 'sectionid', 0, '', 'int' ); - - JArrayHelper::toInteger($cid); - - if (count($cid) < 1) { - $msg = JText::_('Select an item to move'); - $mainframe->redirect('index.php?option=com_content', $msg, 'error'); - } - - //seperate contentids - $cids = implode(',', $cid); - // Articles query - $query = 'SELECT a.title' . - ' FROM #__content AS a' . - ' WHERE ( a.id IN ( '. $cids .' ) )' . - ' ORDER BY a.title'; - $db->setQuery($query); - $items = $db->loadObjectList(); - - $query = 'SELECT CONCAT_WS( ", ", s.id, c.id ) AS `value`, CONCAT_WS( " / ", s.title, c.title ) AS `text`' . - ' FROM #__sections AS s' . - ' INNER JOIN #__categories AS c ON c.section = s.id' . - ' WHERE s.scope = "content"' . - ' ORDER BY s.title, c.title'; - $db->setQuery($query); - $rows[] = JHTML::_('select.option', "0, 0", JText::_('UNCATEGORIZED')); - $rows = array_merge($rows, $db->loadObjectList()); - // build the html select list - $sectCatList = JHTML::_('select.genericlist', $rows, 'sectcat', 'class="inputbox" size="8"', 'value', 'text', null); - - ContentView::moveSection($cid, $sectCatList, 'com_content', $sectionid, $items); - } - - /** - * Save the changes to move item(s) to a different section and category - */ - function moveSectionSave() - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db = & JFactory::getDBO(); - $user = & JFactory::getUser(); - - $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); - $sectionid = JRequest::getVar( 'sectionid', 0, '', 'int' ); - $option = JRequest::getCmd( 'option' ); - - JArrayHelper::toInteger($cid, array(0)); - - $sectcat = JRequest::getVar( 'sectcat', '', 'post', 'string' ); - $sectcat = explode(',', $sectcat); - $newsect = (int) @$sectcat[0]; - $newcat = (int) @$sectcat[1]; - - if ((!$newsect || !$newcat) && ($sectcat !== array('0', ' 0'))) { - $mainframe->redirect("index.php?option=com_content§ionid=$sectionid", JText::_('An error has occurred')); - } - - // find section name - $query = 'SELECT a.title' . - ' FROM #__sections AS a' . - ' WHERE a.id = '. (int) $newsect; - $db->setQuery($query); - $section = $db->loadResult(); - - // find category name - $query = 'SELECT a.title' . - ' FROM #__categories AS a' . - ' WHERE a.id = '. (int) $newcat; - $db->setQuery($query); - $category = $db->loadResult(); - - $total = count($cid); - $cids = implode(',', $cid); - $uid = $user->get('id'); - - $row = & JTable::getInstance('content'); - // update old orders - put existing items in last place - foreach ($cid as $id) - { - $row->load(intval($id)); - $row->ordering = 0; - $row->store(); - $row->reorder('catid = '.(int) $row->catid.' AND state >= 0'); - } - - $query = 'UPDATE #__content SET sectionid = '.(int) $newsect.', catid = '.(int) $newcat. - ' WHERE id IN ( '.$cids.' )' . - ' AND ( checked_out = 0 OR ( checked_out = '.(int) $uid.' ) )'; - $db->setQuery($query); - if (!$db->query()) - { - JError::raiseError( 500, $db->getErrorMsg() ); - return false; - } - - // update new orders - put items in last place - foreach ($cid as $id) - { - $row->load(intval($id)); - $row->ordering = 0; - $row->store(); - $row->reorder('catid = '.(int) $row->catid.' AND state >= 0'); - } - - if ($section && $category) { - $msg = JText::sprintf('Item(s) successfully moved to Section', $total, $section, $category); - } else { - $msg = JText::sprintf('ITEM(S) SUCCESSFULLY MOVED TO UNCATEGORIZED', $total); - } - - $mainframe->redirect('index.php?option='.$option.'§ionid='.$sectionid, $msg); - } - - /** - * Form for copying item(s) - **/ - function copyItem() - { - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db = & JFactory::getDBO(); - - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); - $sectionid = JRequest::getVar( 'sectionid', 0, '', 'int' ); - $option = JRequest::getCmd( 'option' ); - - JArrayHelper::toInteger($cid); - - if (count($cid) < 1) { - $msg = JText::_('Select an item to move'); - $mainframe->redirect('index.php?option='.$option, $msg, 'error'); - } - - //seperate contentids - $cids = implode(',', $cid); - ## Articles query - $query = 'SELECT a.title' . - ' FROM #__content AS a' . - ' WHERE ( a.id IN ( '. $cids .' ) )' . - ' ORDER BY a.title'; - $db->setQuery($query); - $items = $db->loadObjectList(); - - ## Section & Category query - $query = 'SELECT CONCAT_WS(",",s.id,c.id) AS `value`, CONCAT_WS(" / ", s.title, c.title) AS `text`' . - ' FROM #__sections AS s' . - ' INNER JOIN #__categories AS c ON c.section = s.id' . - ' WHERE s.scope = "content"' . - ' ORDER BY s.title, c.title'; - $db->setQuery($query); - - // Add a row for uncategorized content - $uncat = JHTML::_('select.option', '0,0', JText::_('UNCATEGORIZED')); - $rows = $db->loadObjectList(); - array_unshift($rows, $uncat); - // build the html select list - $sectCatList = JHTML::_('select.genericlist', $rows, 'sectcat', 'class="inputbox" size="10"', 'value', 'text', NULL); - - ContentView::copySection($option, $cid, $sectCatList, $sectionid, $items); - } - - /** - * saves Copies of items - **/ - function copyItemSave() - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db = & JFactory::getDBO(); - - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); - $sectionid = JRequest::getVar( 'sectionid', 0, '', 'int' ); - $option = JRequest::getCmd( 'option' ); - - JArrayHelper::toInteger($cid); - - $item = null; - $sectcat = JRequest::getVar( 'sectcat', '-1,-1', 'post', 'string' ); - //seperate sections and categories from selection - $sectcat = explode(',', $sectcat); - $newsect = (int) @$sectcat[0]; - $newcat = (int) @$sectcat[1]; - - if (($newsect == -1) || ($newcat == -1)) { - $mainframe->redirect('index.php?option=com_content§ionid='.$sectionid, JText::_('An error has occurred')); - } - - // find section name - $query = 'SELECT a.title' . - ' FROM #__sections AS a' . - ' WHERE a.id = '. (int) $newsect; - $db->setQuery($query); - $section = $db->loadResult(); - - // find category name - $query = 'SELECT a.title' . - ' FROM #__categories AS a' . - ' WHERE a.id = '. (int) $newcat; - $db->setQuery($query); - $category = $db->loadResult(); - - if (($newsect == 0) && ($newcat == 0)) - { - $section = JText::_('UNCATEGORIZED'); - $category = JText::_('UNCATEGORIZED'); - } - - $total = count($cid); - for ($i = 0; $i < $total; $i ++) - { - $row = & JTable::getInstance('content'); - - // main query - $query = 'SELECT a.*' . - ' FROM #__content AS a' . - ' WHERE a.id = '.(int) $cid[$i]; - $db->setQuery($query, 0, 1); - $item = $db->loadObject(); - - // values loaded into array set for store - $row->id = NULL; - $row->sectionid = $newsect; - $row->catid = $newcat; - $row->hits = '0'; - $row->ordering = '0'; - $row->title = $item->title; - $row->title_alias = $item->title_alias; - $row->introtext = $item->introtext; - $row->fulltext = $item->fulltext; - $row->state = $item->state; - $row->mask = $item->mask; - $row->created = $item->created; - $row->created_by = $item->created_by; - $row->created_by_alias = $item->created_by_alias; - $row->modified = $item->modified; - $row->modified_by = $item->modified_by; - $row->checked_out = $item->checked_out; - $row->checked_out_time = $item->checked_out_time; - $row->publish_up = $item->publish_up; - $row->publish_down = $item->publish_down; - $row->images = $item->images; - $row->attribs = $item->attribs; - $row->version = $item->parentid; - $row->parentid = $item->parentid; - $row->metakey = $item->metakey; - $row->metadesc = $item->metadesc; - $row->access = $item->access; - - if (!$row->check()) { - JError::raiseError( 500, $row->getError() ); - return false; - } - - if (!$row->store()) { - JError::raiseError( 500, $row->getError() ); - return false; - } - $row->reorder('catid='.(int) $row->catid.' AND state >= 0'); - } - - $msg = JText::sprintf('Item(s) successfully copied to Section', $total, $section, $category); - $mainframe->redirect('index.php?option='.$option.'§ionid='.$sectionid, $msg); - } - - /** - * @param integer The id of the article - * @param integer The new access level - * @param string The URL option - */ - function accessMenu($access) - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db = & JFactory::getDBO(); - - $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); - $option = JRequest::getCmd( 'option' ); - $cid = $cid[0]; - - // Create and load the article table object - $row = & JTable::getInstance('content'); - $row->load($cid); - $row->access = $access; - - // Ensure the article object is valid - if (!$row->check()) { - JError::raiseError( 500, $row->getError() ); - return false; - } - - // Store the changes - if (!$row->store()) { - JError::raiseError( 500, $row->getError() ); - return false; - } - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - $mainframe->redirect('index.php?option='.$option); - } - - function saveOrder() - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize variables - $db = & JFactory::getDBO(); - - $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); - $order = JRequest::getVar( 'order', array (0), 'post', 'array' ); - $redirect = JRequest::getVar( 'redirect', 0, 'post', 'int' ); - $rettask = JRequest::getVar( 'returntask', '', 'post', 'cmd' ); - $total = count($cid); - $conditions = array (); - - JArrayHelper::toInteger($cid, array(0)); - JArrayHelper::toInteger($order, array(0)); - - // Instantiate an article table object - $row = & JTable::getInstance('content'); - - // Update the ordering for items in the cid array - for ($i = 0; $i < $total; $i ++) - { - $row->load( (int) $cid[$i] ); - if ($row->ordering != $order[$i]) { - $row->ordering = $order[$i]; - if (!$row->store()) { - JError::raiseError( 500, $db->getErrorMsg() ); - return false; - } - // remember to updateOrder this group - $condition = 'catid = '.(int) $row->catid.' AND state >= 0'; - $found = false; - foreach ($conditions as $cond) - if ($cond[1] == $condition) { - $found = true; - break; - } - if (!$found) - $conditions[] = array ($row->id, $condition); - } - } - - // execute updateOrder for each group - foreach ($conditions as $cond) - { - $row->load($cond[0]); - $row->reorder($cond[1]); - } - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - $msg = JText::_('New ordering saved'); - switch ($rettask) - { - case 'showarchive' : - $mainframe->redirect('index.php?option=com_content&task=showarchive§ionid='.$redirect, $msg); - break; - - default : - $mainframe->redirect('index.php?option=com_content§ionid='.$redirect, $msg); - break; - } - } - - function previewContent() - { - // Initialize variables - $document =& JFactory::getDocument(); - $db =& JFactory::getDBO(); - $id = JRequest::getVar( 'id', 0, '', 'int' ); - $option = JRequest::getCmd( 'option' ); - - // Get the current default template - $query = 'SELECT template' . - ' FROM #__templates_menu' . - ' WHERE client_id = 0' . - ' AND menuid = 0'; - $db->setQuery($query); - $template = $db->loadResult(); - - // check if template editor stylesheet exists - if (!file_exists( JPATH_SITE.DS.'templates'.DS.$template.DS.'css'.DS.'editor.css' )) { - $template = 'system'; - } - - // Set page title - $document->setTitle(JText::_('Article Preview')); - $document->addStyleSheet('../templates/'.$template.'/css/editor.css'); - $document->setBase(JUri::root()); - - // Render article preview - ContentView::previewContent(); - } - - function insertPagebreak() - { - $document =& JFactory::getDocument(); - $document->setTitle(JText::_('PGB ARTICLE PAGEBRK')); - ContentView::insertPagebreak(); - } -} +registerTask( 'wizard', 'element' ); + $this->registerTask( 'content', 'display' ); + $this->registerTask( 'add', 'display' ); + $this->registerTask( 'new', 'display' ); + $this->registerTask( 'edit', 'display' ); + $this->registerTask( 'ins_pagebreak', 'display' ); + $this->registerTask( 'preview', 'display' ); + $this->registerTask( 'copy', 'display' ); + $this->registerTask( 'movesect', 'display' ); + $this->registerTask( 'go2menu', 'save' ); + $this->registerTask( 'go2menuitem', 'save' ); + $this->registerTask( 'menulink', 'save' ); + $this->registerTask( 'resethits', 'save' ); + $this->registerTask( 'apply', 'save' ); + } + + function display() + { + switch($this->getTask()) + { + case 'add': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'article'); + JRequest::setVar( 'edit', false ); + + // Checkout the section + $model = $this->getModel('article'); + $model->checkout(); + } break; + case 'edit': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'article'); + JRequest::setVar( 'edit', true ); + + // Checkout the section + $model = $this->getModel('article'); + $model->checkout(); + } break; + case 'movesect': + case 'copy': + { + JRequest::setVar( 'view' , 'copyselect'); + } break; + case 'ins_pagebreak': + { + JRequest::setVar( 'view' , 'pagebreak'); + } break; + case 'preview': + { + JRequest::setVar( 'view' , 'prevuuw'); + } break; + case 'content': + default: + { + JRequest::setVar( 'view' , 'articles'); + } break; + } + + parent::display(); + } + + /** + * Articles element + */ + function element() + { + $model = &$this->getModel( 'element' ); + $view = &$this->getView( 'element'); + $view->setModel( $model, true ); + $view->display(); + } + + /** + * Saves the article an edit form submit + * @param database A database connector object + */ + function save() + { + global $mainframe; + + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + $db = & JFactory::getDBO(); + + // Initialize variables + $post = JRequest::get('post'); + $task = $this->getTask(); + $sectionid = JRequest::getVar( 'sectionid', 0, '', 'int' ); + $redirect = JRequest::getVar( 'redirect', $sectionid, 'post', 'int' ); + $menu = JRequest::getVar( 'menu', 'mainmenu', 'post', 'cmd' ); + $menuid = JRequest::getVar( 'menuid', 0, 'post', 'int' ); + + $model = $this->getModel('article'); + + $success = $model->store($post); + $article = $model->getData(); + + switch ($task) + { + case 'go2menu' : + $this->setRedirect('index.php?option=com_menus&menutype='.$menu); + break; + + case 'go2menuitem' : + $this->setRedirect('index.php?option=com_menus&menutype='.$menu.'&task=edit&id='.$menuid); + break; + + case 'resethits' : + $model->resetHits(); + $msg = JText::_('Successfully Reset Hit count'); + $this->setRedirect('index.php?option=com_content§ionid='.$redirect.'&task=edit&cid[]='.$article->id, $msg); + break; + + case 'apply' : + if ($success) + $msg = JText::sprintf('SUCCESSFULLY SAVED CHANGES TO ARTICLE', $article->title); + else + $msg = JText::_( 'Error Saving Article' ); + $this->setRedirect('index.php?option=com_content§ionid='.$redirect.'&task=edit&cid[]='.$article->id, $msg); + break; + + case 'save' : + default : + if ($success) + $msg = JText::sprintf('Successfully Saved Article', $article->title); + else + $msg = JText::_( 'Error Saving Article' ); + $this->setRedirect('index.php?option=com_content§ionid='.$redirect, $msg); + break; + } + } + + function publish( ) + { + $this->changeState(1); + } + + function unpublish( ) + { + $this->changeState(0); + } + + function archive( ) + { + $this->changeState(-1); + } + + function unarchive( ) + { + $this->changeState(0); + } + + /** + * Changes the state of one or more content pages + * + * @param string The name of the category section + * @param integer A unique category id (passed from an edit form) + * @param array An array of unique category id numbers + * @param integer 0 if unpublishing, 1 if publishing + * @param string The name of the current user + */ + function changeState( $state = 0 ) + { + global $mainframe; + + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + // Initialize variables + $db = & JFactory::getDBO(); + $user = & JFactory::getUser(); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + $option = JRequest::getCmd( 'option' ); + $task = $this->getTask(); + $rtask = JRequest::getCmd( 'returntask', '', 'post' ); + if ($rtask) { + $rtask = '&task='.$rtask; + } + + $total = count($cid); + if ($total < 1) { + $redirect = JRequest::getVar( 'redirect', '', 'post', 'int' ); + $action = ($state == 1) ? 'publish' : ($state == -1 ? 'archive' : 'unpublish'); + $msg = JText::_('Select an item to') . ' ' . JText::_($action); + $this->setRedirect('index.php?option='.$option.$rtask.'§ionid='.$redirect, $msg, 'error'); + return; + } + + $model = $this->getModel('article'); + if(!$model->setArticleState($cid, $state)) { + echo "\n"; + } + + switch ($state) + { + case -1 : + $msg = JText::sprintf('Item(s) successfully Archived', $total); + break; + + case 1 : + $msg = JText::sprintf('Item(s) successfully Published', $total); + break; + + case 0 : + default : + if ($task == 'unarchive') { + $msg = JText::sprintf('Item(s) successfully Unarchived', $total); + } else { + $msg = JText::sprintf('Item(s) successfully Unpublished', $total); + } + break; + } + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + // Get some return/redirect information from the request + $redirect = JRequest::getVar( 'redirect', $row->sectionid, 'post', 'int' ); + + $this->setRedirect('index.php?option='.$option.$rtask.'§ionid='.$redirect, $msg); + } + + /** + * Changes the frontpage state of one or more articles + * + */ + function toggle_frontpage() + { + global $mainframe; + + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + // Initialize variables + $db =& JFactory::getDBO(); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + $option = JRequest::getCmd( 'option' ); + $msg = null; + + JArrayHelper::toInteger($cid); + + if (count($cid) < 1) { + $msg = JText::_('Select an item to toggle'); + $this->setRedirect('index.php?option='.$option, $msg, 'error'); + return; + } + + $model = $this->getModel('frontpage'); + if (!$model->toggle($cid)) + $msg = JText::_('Error toggling frontpage flag'); + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $this->setRedirect('index.php?option='.$option, $msg); + } + + function remove() + { + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to delete' ) ); + } + + $model = $this->getModel('article'); + if(!$model->trash($cid)) { + echo "\n"; + } + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $msg = JText::sprintf('Item(s) sent to the Trash', count($cid)); + $this->setRedirect( 'index.php?option=com_content', $msg ); + } + + /** + * Cancels an edit operation + */ + function cancel() + { + // Checkin the section + $model = $this->getModel('article'); + $model->checkin(); + + $this->setRedirect( 'index.php?option=com_content' ); + } + + function orderup() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $model = $this->getModel('article'); + $model->move(-1); + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $option = JRequest::getCmd( 'option' ); + $this->setRedirect( 'index.php?option='.$option ); + } + + function orderdown() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $model = $this->getModel('article'); + $model->move(1); + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $option = JRequest::getCmd( 'option' ); + $this->setRedirect( 'index.php?option='.$option ); + } + + /** + * Save the changes to move item(s) to a different section and category + */ + function movesectsave() + { + global $mainframe; + + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + // Initialize variables + $db = & JFactory::getDBO(); + $user = & JFactory::getUser(); + + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $sectionid = JRequest::getVar( 'sectionid', 0, '', 'int' ); + $option = JRequest::getCmd( 'option' ); + + JArrayHelper::toInteger($cid, array(0)); + + $sectcat = JRequest::getVar( 'sectcat', '', 'post', 'string' ); + $sectcat = explode(',', $sectcat); + $newsect = (int) @$sectcat[0]; + $newcat = (int) @$sectcat[1]; + + if ((!$newsect || !$newcat) && ($sectcat !== array('0', '0'))) { + $this->setRedirect("index.php?option=com_content§ionid=$sectionid", JText::_('An error has occurred')); + return; + } + + // find section name + $query = 'SELECT a.title' . + ' FROM #__sections AS a' . + ' WHERE a.id = '. (int) $newsect; + $db->setQuery($query); + $section = $db->loadResult(); + + // find category name + $query = 'SELECT a.title' . + ' FROM #__categories AS a' . + ' WHERE a.id = '. (int) $newcat; + $db->setQuery($query); + $category = $db->loadResult(); + + $total = count($cid); + $cids = implode(',', $cid); + $uid = $user->get('id'); + + $content = & JTable::getInstance('content'); + // update old orders - put existing items in last place + foreach ($cid as $id) + { + $content->load(intval($id)); + $content->ordering = 0; + $content->store(); + $content->reorder('catid = '.(int) $content->catid.' AND state >= 0'); + } + + $query = 'UPDATE #__content SET sectionid = '.(int) $newsect.', catid = '.(int) $newcat. + ' WHERE id IN ( '.$cids.' )' . + ' AND ( checked_out = 0 OR ( checked_out = '.(int) $uid.' ) )'; + $db->setQuery($query); + if (!$db->query()) + { + JError::raiseError( 500, $db->getErrorMsg() ); + return false; + } + + // update new orders - put items in last place + foreach ($cid as $id) + { + $content->load(intval($id)); + $content->ordering = 0; + $content->store(); + $content->reorder('catid = '.(int) $content->catid.' AND state >= 0'); + } + + if ($section && $category) { + $msg = JText::sprintf('Item(s) successfully moved to Section', $total, $section, $category); + } else { + $msg = JText::sprintf('ITEM(S) SUCCESSFULLY MOVED TO UNCATEGORIZED', $total); + } + + $this->setRedirect('index.php?option='.$option.'§ionid='.$sectionid, $msg); + } + + /** + * saves Copies of items + **/ + function copysave() + { + global $mainframe; + + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + // Initialize variables + $db = & JFactory::getDBO(); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + $sectionid = JRequest::getVar( 'sectionid', 0, '', 'int' ); + $option = JRequest::getCmd( 'option' ); + + JArrayHelper::toInteger($cid); + + $item = null; + $sectcat = JRequest::getVar( 'sectcat', '-1,-1', 'post', 'string' ); + //seperate sections and categories from selection + $sectcat = explode(',', $sectcat); + $newsect = (int) @$sectcat[0]; + $newcat = (int) @$sectcat[1]; + + if (($newsect == -1) || ($newcat == -1)) { + $this->setRedirect('index.php?option=com_content§ionid='.$sectionid, JText::_('An error has occurred')); + return; + } + + // find section name + $query = 'SELECT a.title' . + ' FROM #__sections AS a' . + ' WHERE a.id = '. (int) $newsect; + $db->setQuery($query); + $section = $db->loadResult(); + + // find category name + $query = 'SELECT a.title' . + ' FROM #__categories AS a' . + ' WHERE a.id = '. (int) $newcat; + $db->setQuery($query); + $category = $db->loadResult(); + + if (($newsect == 0) && ($newcat == 0)) + { + $section = JText::_('UNCATEGORIZED'); + $category = JText::_('UNCATEGORIZED'); + } + + $total = count($cid); + $content = & JTable::getInstance('content'); + + for ($i = 0; $i < $total; $i ++) + { + $id = $cid[$i]; + $content->load( $id ); + $content->id = NULL; + $content->sectionid = $newsect; + $content->catid = $newcat; + $content->title = JText::sprintf( 'Copy of', $content->title ); + $content->hits = 0; + $content->ordering = 0; + + if (!$content->check()) { + JError::raiseError(500, $content->getError()); + } + + if (!$content->store()) { + JError::raiseError(500, $content->getError()); + } + + $content->checkin(); + $content->reorder('catid='.(int) $content->catid.' AND state >= 0'); + } + + $msg = JText::sprintf('Item(s) successfully copied to Section', $total, $section, $category); + $this->setRedirect('index.php?option='.$option.'§ionid='.$sectionid, $msg); + } + + function accesspublic() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('article'); + if(!$model->setAccess($cid, 0)) { + $msg = $model->getError(); + } + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $option = JRequest::getCmd( 'option' ); + $this->setRedirect( 'index.php?option='.$option, $msg ); + } + + function accessregistered() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('article'); + if(!$model->setAccess($cid, 1)) { + $msg = $model->getError(); + } + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $option = JRequest::getCmd( 'option' ); + $this->setRedirect( 'index.php?option='.$option, $msg ); + } + + function accessspecial() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('article'); + if(!$model->setAccess($cid, 2)) { + $msg = $model->getError(); + } + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $option = JRequest::getCmd( 'option' ); + $this->setRedirect( 'index.php?option='.$option, $msg ); + } + + function saveorder() + { + global $mainframe; + + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + // Initialize variables + $db = & JFactory::getDBO(); + + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $order = JRequest::getVar( 'order', array (0), 'post', 'array' ); + $redirect = JRequest::getVar( 'redirect', 0, 'post', 'int' ); + + JArrayHelper::toInteger($cid, array(0)); + JArrayHelper::toInteger($order, array(0)); + + $model = $this->getModel('article'); + $model->saveorder($cid, $order); + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $msg = JText::_('New ordering saved'); + $this->setRedirect('index.php?option=com_content§ionid='.$redirect, $msg); + } +} \ No newline at end of file diff --git a/administrator/components/com_content/controllers/frontpage.php b/administrator/components/com_content/controllers/frontpage.php new file mode 100644 index 0000000000000..e23069a9759e1 --- /dev/null +++ b/administrator/components/com_content/controllers/frontpage.php @@ -0,0 +1,245 @@ +getModel(); + if(!$model->delete($cid)) { + echo "\n"; + } + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $this->setRedirect( 'index.php?option=com_content&controller=frontpage' ); + } + + function publish( ) + { + $this->changeState(1); + } + + function unpublish( ) + { + $this->changeState(0); + } + + function archive( ) + { + $this->changeState(-1); + } + + /** + * Changes the state of one or more content pages + * + * @param integer 0 if unpublishing, 1 if publishing, -1 if archiving + */ + function changeState( $state = 0 ) + { + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + $task = $this->getTask(); + + $total = count($cid); + if ($total < 1) { + $redirect = JRequest::getVar( 'redirect', '', 'post', 'int' ); + $action = ($state == 1) ? 'publish' : ($state == -1 ? 'archive' : 'unpublish'); + $msg = JText::_('Select an item to') . ' ' . JText::_($action); + $this->setRedirect('index.php?option=com_content&controller=frontpage', $msg, 'error'); + return; + } + + $model = JModel::getInstance('article', 'ContentModel'); + if(!$model->setArticleState($cid, $state)) { + echo "\n"; + } + + switch ($state) + { + case -1 : + $msg = JText::sprintf('Item(s) successfully Archived', $total); + break; + + case 1 : + $msg = JText::sprintf('Item(s) successfully Published', $total); + break; + + case 0 : + default : + $msg = JText::sprintf('Item(s) successfully Unpublished', $total); + break; + } + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $this->setRedirect('index.php?option=com_content&controller=frontpage', $msg); + } + + function orderup() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + + $model = $this->getModel('frontpage'); + $model->move(-1); + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $this->setRedirect( 'index.php?option=com_content&controller=frontpage' ); + } + + function orderdown() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + JArrayHelper::toInteger($cid, array(0)); + + $model = $this->getModel('frontpage'); + $model->move(1); + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $this->setRedirect( 'index.php?option=com_content&controller=frontpage' ); + } + + function accesspublic() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('article'); + if(!$model->setAccess($cid, 0)) { + $msg = $model->getError(); + } + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $this->setRedirect( 'index.php?option=com_content&controller=frontpage', $msg ); + } + + function accessregistered() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('article'); + if(!$model->setAccess($cid, 1)) { + $msg = $model->getError(); + } + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $this->setRedirect( 'index.php?option=com_content&controller=frontpage', $msg ); + } + + function accessspecial() + { + // Check for request forgeries. + JRequest::checkToken() or die( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('article'); + if(!$model->setAccess($cid, 2)) { + $msg = $model->getError(); + } + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $this->setRedirect( 'index.php?option=com_content&controller=frontpage', $msg ); + } + + function saveorder() + { + global $mainframe; + + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + // Initialize variables + $db = & JFactory::getDBO(); + + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $order = JRequest::getVar( 'order', array (0), 'post', 'array' ); + + JArrayHelper::toInteger($cid, array(0)); + JArrayHelper::toInteger($order, array(0)); + + $model = $this->getModel('frontpage'); + $model->saveorder($cid, $order); + + $cache = & JFactory::getCache('com_content'); + $cache->clean(); + + $msg = JText::_('New ordering saved'); + $this->setRedirect('index.php?option=com_content&controller=frontpage', $msg); + } +} \ No newline at end of file diff --git a/administrator/components/com_content/controllers/index.html b/administrator/components/com_content/controllers/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/controllers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/elements/article.php b/administrator/components/com_content/elements/article.php index b18a4297e68f2..4e0c3a8aa489a 100644 --- a/administrator/components/com_content/elements/article.php +++ b/administrator/components/com_content/elements/article.php @@ -12,7 +12,7 @@ */ // Check to ensure this file is included in Joomla! -defined('_JEXEC') or die( 'Restricted access' ); +defined('_JEXEC') or die(); class JElementArticle extends JElement { @@ -40,20 +40,20 @@ function fetchElement($name, $value, &$node, $control_name) } $js = " - function jSelectArticle(id, title, object) { - document.getElementById(object + '_id').value = id; - document.getElementById(object + '_name').value = title; + function jSelectArticle(id, title) { + document.getElementById('a_id').value = id; + document.getElementById('a_name').value = title; document.getElementById('sbox-window').close(); }"; $doc->addScriptDeclaration($js); - $link = 'index.php?option=com_content&task=element&tmpl=component&object='.$name; + $link = 'index.php?option=com_content&task=element&tmpl=component'; JHTML::_('behavior.modal', 'a.modal'); - $html = "\n".'
    '; + $html = "\n".'
    '; // $html .= "\n   "; $html .= ''."\n"; - $html .= "\n".''; + $html .= "\n".''; return $html; } diff --git a/administrator/components/com_content/elements/author.php b/administrator/components/com_content/elements/author.php index c238f800df799..0e8fa8b7888d2 100644 --- a/administrator/components/com_content/elements/author.php +++ b/administrator/components/com_content/elements/author.php @@ -13,7 +13,7 @@ */ // Check to ensure this file is included in Joomla! -defined('_JEXEC') or die( 'Restricted access' ); +defined('_JEXEC') or die(); /** * Renders a author element diff --git a/administrator/components/com_content/elements/index.html b/administrator/components/com_content/elements/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_content/elements/index.html +++ b/administrator/components/com_content/elements/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_content/helper.php b/administrator/components/com_content/helper.php deleted file mode 100644 index 1a3f66551d556..0000000000000 --- a/administrator/components/com_content/helper.php +++ /dev/null @@ -1,113 +0,0 @@ -', '
    ', $text ); - - // Search for the {readmore} tag and split the text up accordingly. - $tagPos = JString::strpos( $text, '
    ' ); - - if ( $tagPos === false ) - { - $row->introtext = $text; - } else - { - $row->introtext = JString::substr($text, 0, $tagPos); - $row->fulltext = JString::substr($text, $tagPos + 27 ); - } - - // Filter settings - jimport( 'joomla.application.component.helper' ); - $config = JComponentHelper::getParams( 'com_content' ); - $user = &JFactory::getUser(); - $gid = $user->get( 'gid' ); - - $filterGroups = (array) $config->get( 'filter_groups' ); - if (in_array( $gid, $filterGroups )) - { - $filterType = $config->get( 'filter_type' ); - $filterTags = preg_split( '#[,\s]+#', trim( $config->get( 'filter_tags' ) ) ); - $filterAttrs = preg_split( '#[,\s]+#', trim( $config->get( 'filter_attritbutes' ) ) ); - switch ($filterType) - { - case 'NH': - $filter = new JFilterInput(); - break; - case 'WL': - $filter = new JFilterInput( $filterTags, $filterAttrs, 0, 0 ); - break; - case 'BL': - default: - $filter = new JFilterInput( $filterTags, $filterAttrs, 1, 1 ); - break; - } - $row->introtext = $filter->clean( $row->introtext ); - $row->fulltext = $filter->clean( $row->fulltext ); - } - - return true; - } - - /** - * Function to reset Hit count of an article - * - */ - function resetHits($redirect, $id) - { - global $mainframe; - - // Initialize variables - $db = & JFactory::getDBO(); - - // Instantiate and load an article table - $row = & JTable::getInstance('content'); - $row->Load($id); - $row->hits = 0; - $row->store(); - $row->checkin(); - - $msg = JText::_('Successfully Reset Hit count'); - $mainframe->redirect('index.php?option=com_content§ionid='.$redirect.'&task=edit&id='.$id, $msg); - } - - function filterCategory($query, $active = NULL) - { - // Initialize variables - $db = & JFactory::getDBO(); - - $categories[] = JHTML::_('select.option', '0', '- '.JText::_('Select Category').' -'); - $db->setQuery($query); - $categories = array_merge($categories, $db->loadObjectList()); - - $category = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $active); - - return $category; - } - -} \ No newline at end of file diff --git a/administrator/components/com_content/helper/index.html b/administrator/components/com_content/helper/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/administrator/components/com_content/helper/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_content/index.html b/administrator/components/com_content/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_content/index.html +++ b/administrator/components/com_content/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_content/models/article.php b/administrator/components/com_content/models/article.php new file mode 100644 index 0000000000000..6306a08c62763 --- /dev/null +++ b/administrator/components/com_content/models/article.php @@ -0,0 +1,677 @@ + 'content')); + parent::__construct(); + + $array = JRequest::getVar('cid', array(0), '', 'array'); + $edit = JRequest::getVar('edit',true); + if($edit) + $this->setId((int)$array[0]); + } + + /** + * Method to set the article identifier + * + * @access public + * @param int Category identifier + */ + function setId($id) + { + // Set article id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get an article + * + * @since 1.5 + */ + function &getData() + { + // Load the article data + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Tests if article is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.5 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_loadData()) + { + if ($uid) { + return ($this->_data->checked_out && $this->_data->checked_out != $uid); + } else { + return $this->_data->checked_out; + } + } + } + + /** + * Method to checkin/unlock the article + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function checkin() + { + if ($this->_id) + { + $article = & JTable::getInstance('content'); + if(! $article->checkin($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return true; + } + return false; + } + + /** + * Method to checkout/lock the article + * + * @access public + * @param int $uid User ID of the user checking the article out + * @return boolean True on success + * @since 1.5 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the article with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $article = & JTable::getInstance('content'); + if(!$article->checkout($uid, $this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return true; + } + return false; + } + + /** + * Method to store the article + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function store($data) + { + jimport('joomla.utilities.date'); + $user = & JFactory::getUser(); + $details = JRequest::getVar( 'details', array(), 'post', 'array'); + $nullDate = $this->_db->getNullDate(); + + $row = & JTable::getInstance('content'); + if (!$row->bind($data)) { + JError::raiseError( 500, $this->_db->stderr() ); + return false; + } + $row->bind($details); + + // sanitise id field + $row->id = (int) $row->id; + + // Are we saving from an item edit? + if ($row->id) { + $datenow =& JFactory::getDate(); + $row->modified = $datenow->toMySQL(); + $row->modified_by = $user->get('id'); + } + + $row->created_by = $row->created_by ? $row->created_by : $user->get('id'); + + if ($row->created && strlen(trim( $row->created )) <= 10) { + $row->created .= ' 00:00:00'; + } + + $config =& JFactory::getConfig(); + $tzoffset = $config->getValue('config.offset'); + $date =& JFactory::getDate($row->created, $tzoffset); + $row->created = $date->toMySQL(); + + // Append time if not added to publish date + if (strlen(trim($row->publish_up)) <= 10) { + $row->publish_up .= ' 00:00:00'; + } + + $date =& JFactory::getDate($row->publish_up, $tzoffset); + $row->publish_up = $date->toMySQL(); + + // Handle never unpublish date + if (trim($row->publish_down) == JText::_('Never') || trim( $row->publish_down ) == '') + { + $row->publish_down = $nullDate; + } + else + { + if (strlen(trim( $row->publish_down )) <= 10) { + $row->publish_down .= ' 00:00:00'; + } + $date =& JFactory::getDate($row->publish_down, $tzoffset); + $row->publish_down = $date->toMySQL(); + } + + // Get a state and parameter variables from the request + $row->state = JRequest::getVar( 'state', 0, '', 'int' ); + $params = JRequest::getVar( 'params', null, 'post', 'array' ); + + // Build parameter INI string + if (is_array($params)) + { + $txt = array (); + foreach ($params as $k => $v) { + $txt[] = "$k=$v"; + } + $row->attribs = implode("\n", $txt); + } + + // Get metadata string + $metadata = JRequest::getVar( 'meta', null, 'post', 'array'); + if (is_array($params)) + { + $txt = array(); + foreach ($metadata as $k => $v) { + if ($k == 'description') { + $row->metadesc = $v; + } elseif ($k == 'keywords') { + $row->metakey = $v; + } else { + $txt[] = "$k=$v"; + } + } + $row->metadata = implode("\n", $txt); + } + + // Prepare the content for saving to the database + $this->saveContentPrep( $row ); + + // Make sure the data is valid + if (!$row->check()) { + JError::raiseError( 500, $this->_db->stderr() ); + return false; + } + + // Increment the content version number + $row->version++; + + // Store the content to the database + if (!$row->store()) { + JError::raiseError( 500, $this->_db->stderr() ); + return false; + } + + // Check the article and update item order + $row->checkin(); + $row->reorder('catid = '.(int) $row->catid.' AND state >= 0'); + + // Save ID so controller can find data + $this->setId($row->id); + + /* + * We need to update frontpage status for the article. + * + * First we include the frontpage table and instantiate an instance of it. + */ + $fp = & JTable::getInstance('frontpage', 'Table'); + + // Is the article viewable on the frontpage? + if ($data['frontpage']) + { + // Is the item already viewable on the frontpage? + if (!$fp->load($row->id)) + { + // Insert the new entry + $query = 'INSERT INTO #__content_frontpage' . + ' VALUES ( '. (int) $row->id .', 1 )'; + $this->_db->setQuery($query); + if (!$this->_db->query()) + { + JError::raiseError( 500, $this->_db->stderr() ); + return false; + } + $fp->ordering = 1; + } + } + else + { + // Delete the item from frontpage if it exists + if (!$fp->delete($article->id)) { + $msg .= $fp->stderr(); + } + $fp->ordering = 0; + } + $fp->reorder(); + + return true; + } + + /** + * Method to remove a article + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__content' + . ' WHERE id IN ( '.$cids.' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to move an article to the trash + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function trash($cid = array()) + { + $result = false; + + if (count( $cid )) + { + // Removed content gets put in the trash [state = -2] and ordering is always set to 0 + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $nullDate = $this->_db->getNullDate(); + $state = '-2'; + $ordering = '0'; + $query = 'UPDATE #__content' . + ' SET state = '.(int) $state . + ', ordering = '.(int) $ordering . + ', checked_out = 0, checked_out_time = '.$this->_db->Quote($nullDate). + ' WHERE id IN ( '. $cids. ' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to set article state + * Published = 1 + * Not published = 0 + * Archived = -1 + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function setArticleState($cid = array(), $new_state = 1) + { + $user =& JFactory::getUser(); + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__content' + . ' SET state = '.(int) $new_state + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to move a article + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function move($direction) + { + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + + $row = & JTable::getInstance('content'); + if (!$row->load( (int) $cid[0] )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if (!$row->move( $direction, ' catid = '.(int) $row->catid.' AND state >= 0 ' )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to move a article + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function saveorder($cid = array(), $order) + { + $row = & JTable::getInstance('content'); + $conditions = array (); + + // Update the ordering for items in the cid array + for ($i = 0; $i < count($cid); $i ++) + { + $row->load( (int) $cid[$i] ); + if ($row->ordering != $order[$i]) { + $row->ordering = $order[$i]; + if (!$row->store()) { + JError::raiseError( 500, $this->_db->getErrorMsg() ); + return false; + } + // remember to updateOrder this group + $condition = 'catid = '.(int) $row->catid.' AND state >= 0'; + $found = false; + foreach ($conditions as $cond) + if ($cond[1] == $condition) { + $found = true; + break; + } + if (!$found) + $conditions[] = array ($row->id, $condition); + } + } + + // execute updateOrder for each group + foreach ($conditions as $cond) + { + $row->load($cond[0]); + $row->reorder($cond[1]); + } + + return true; + } + + /** + * Method to load article data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = 'SELECT c.* '. + ' FROM #__content AS c' . + ' WHERE c.id = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + + if (!$this->_data) { + return false; + } + + $query = 'SELECT name' . + ' FROM #__users'. + ' WHERE id = '. (int) $this->_data->created_by; + $this->_db->setQuery($query); + $this->_data->creator = $this->_db->loadResult(); + + // test to reduce unneeded query + if ($this->_data->created_by == $this->_data->modified_by) { + $this->_data->modifier = $this->_data->creator; + } else { + $query = 'SELECT name' . + ' FROM #__users' . + ' WHERE id = '. (int) $this->_data->modified_by; + $this->_db->setQuery($query); + $this->_data->modifier = $this->_db->loadResult(); + } + + $query = 'SELECT COUNT(content_id)' . + ' FROM #__content_frontpage' . + ' WHERE content_id = '. (int) $this->_id; + $this->_db->setQuery($query); + $this->_data->frontpage = $this->_db->loadResult(); + if (!$this->_data->frontpage) { + $this->_data->frontpage = 0; + } + + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the article data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $article = new stdClass(); + $article->id = null; + $article->name = null; + $article->alias = null; + $article->title = null; + $article->title_alias = null; + $article->introtext = null; + $article->fulltext = null; + $article->sectionid = null; + $article->catid = 0; + $article->state = 0; + $article->mask = 0; + $article->created_by = 0; + $article->created_by_alias = null; + $article->modified = 0; + $article->modified_by = 0; + $article->checked_out = 0; + $article->checked_out_time = 0; + $article->publish_up = 0; + $article->publish_down = 0; + $article->images = null; + $article->urls = null; + $article->attribs = null; + $article->version = 1; + $article->parent_id = null; + $article->ordering = null; + $article->metakey = null; + $article->metadesc = null; + $article->metadata = null; + $article->access = null; + $article->hits = null; + + $this->_data = $article; + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to set the article access + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function setAccess($cid = array(), $access = 0) + { + if (count( $cid )) + { + $user =& JFactory::getUser(); + + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__content' + . ' SET access = '.(int) $access + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + function saveContentPrep( &$row ) + { + // Get submitted text from the request variables + $text = JRequest::getVar( 'text', '', 'post', 'string', JREQUEST_ALLOWRAW ); + + // Clean text for xhtml transitional compliance + $text = str_replace( '
    ', '
    ', $text ); + + // Search for the {readmore} tag and split the text up accordingly. + $tagPos = JString::strpos( $text, '
    ' ); + + if ( $tagPos === false ) + { + $row->introtext = $text; + } else + { + $row->introtext = JString::substr($text, 0, $tagPos); + $row->fulltext = JString::substr($text, $tagPos + 27 ); + } + + // Filter settings + jimport( 'joomla.application.component.helper' ); + $config = JComponentHelper::getParams( 'com_content' ); + $user = &JFactory::getUser(); + $gid = $user->get( 'gid' ); + + $filterGroups = (array) $config->get( 'filter_groups' ); + if (in_array( $gid, $filterGroups )) + { + $filterType = $config->get( 'filter_type' ); + $filterTags = preg_split( '#[,\s]+#', trim( $config->get( 'filter_tags' ) ) ); + $filterAttrs = preg_split( '#[,\s]+#', trim( $config->get( 'filter_attritbutes' ) ) ); + switch ($filterType) + { + case 'NH': + $filter = new JFilterInput(); + break; + case 'WL': + $filter = new JFilterInput( $filterTags, $filterAttrs, 0, 0 ); + break; + case 'BL': + default: + $filter = new JFilterInput( $filterTags, $filterAttrs, 1, 1 ); + break; + } + $row->introtext = $filter->clean( $row->introtext ); + $row->fulltext = $filter->clean( $row->fulltext ); + } + + return true; + } + + /** + * Function to reset Hit count of an article + * + */ + function resetHits() + { + // Instantiate and load an article table + $row = & JTable::getInstance('content'); + $row->Load($this->_id); + $row->hits = 0; + $row->store(); + $row->checkin(); + } +} diff --git a/administrator/components/com_content/models/articles.php b/administrator/components/com_content/models/articles.php new file mode 100644 index 0000000000000..d38257951e590 --- /dev/null +++ b/administrator/components/com_content/models/articles.php @@ -0,0 +1,227 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $context = 'com_content.viewcontent'; + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $context.'.filter_order', 'filter_order', 'section_name', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $context.'.filter_state', 'filter_state', '', 'word' ); + $filter->catid = $mainframe->getUserStateFromRequest( $context.'.filter_catid', 'filter_catid', 0, 'int' ); + $filter->search = $mainframe->getUserStateFromRequest( $context.'.search', 'search', '', 'string' ); + $filter->authorid = $mainframe->getUserStateFromRequest( $context.'.filter_authorid', 'filter_authorid', 0, 'int' ); + $filter->section = JRequest::getCmd( 'section', 'com_content' ); + $filter->sectionid = $mainframe->getUserStateFromRequest( $context.'.filter_sectionid', 'filter_sectionid', -1, 'int' ); + $this->_filter = $filter; + } + + /** + * Method to get Content item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_data; + } + + /** + * Method to get the total number of section items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the Content + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the articles + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere($this->_filter->section); + $orderby = $this->_buildContentOrderBy($this->_filter->section); + + $query = 'SELECT c.*, g.name AS groupname, cc.title AS name, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author' . + ' FROM #__content AS c' . + ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . + ' LEFT JOIN #__sections AS s ON s.id = c.sectionid' . + ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = c.access' . + ' LEFT JOIN #__users AS u ON u.id = c.checked_out' . + ' LEFT JOIN #__users AS v ON v.id = c.created_by' . + ' LEFT JOIN #__content_frontpage AS f ON f.content_id = c.id' . + $where . + $orderby; + + return $query; + } + + function _buildContentOrderBy($section) + { + $orderby = ' ORDER BY '. $this->_filter->order .' '. $this->_filter->order_Dir .', section_name, cc.title, c.ordering'; + + return $orderby; + } + + function _buildContentWhere($section) + { + $db =& JFactory::getDBO(); + $search = JString::strtolower( $this->_filter->search ); + + $where[] = 'c.state != -2'; + + /* + * Add the filter specific information to the where clause + */ + // Section filter + if ($this->_filter->sectionid >= 0) { + $where[] = 'c.sectionid = ' . (int) $this->_filter->sectionid; + } + // Category filter + if ($this->_filter->catid > 0) { + $where[] = 'c.catid = ' . (int) $this->_filter->catid; + } + // Author filter + if ($this->_filter->authorid > 0) { + $where[] = 'c.created_by = ' . (int) $this->_filter->authorid; + } + // Content state filter + if ($this->_filter->state) { + if ($this->_filter->state == 'P') { + $where[] = 'c.state = 1'; + } else { + if ($this->_filter->state == 'U') { + $where[] = 'c.state = 0'; + } else if ($this->_filter->state == 'A') { + $where[] = 'c.state = -1'; + } else { + $where[] = 'c.state != -2'; + } + } + } + // Keyword filter + if ($search) { + $where[] = '(LOWER( c.title ) LIKE ' . $db->Quote( "%$search%" ) . + ' OR c.id = ' . (int) $search . ')'; + } + + // Build the where clause of the content record query + $where = (count($where) ? ' WHERE '.implode(' AND ', $where) : ''); + + return $where; + } +} \ No newline at end of file diff --git a/administrator/components/com_content/models/element.php b/administrator/components/com_content/models/element.php index 95f1fc8af407c..e108b3592721e 100644 --- a/administrator/components/com_content/models/element.php +++ b/administrator/components/com_content/models/element.php @@ -34,123 +34,175 @@ class ContentModelElement extends JModel */ var $_list = null; - var $_page = null; + /** + * Total + * + * @var integer + */ + var $_total = null; /** - * Method to get content article data for the frontpage + * Pagination object + * + * @var object + */ + var $_pagination = null; + + /** + * Filter object + * + * @var object + */ + var $_filter = null; + + /** + * Constructor * * @since 1.5 */ - function getList() + function __construct() { - global $mainframe; + parent::__construct(); - if (!empty($this->_list)) { - return $this->_list; - } + global $mainframe, $option; - // Initialize variables - $db =& $this->getDBO(); - $filter = null; - - // Get some variables from the request - $sectionid = JRequest::getVar( 'sectionid', -1, '', 'int' ); - $redirect = $sectionid; - $option = JRequest::getCmd( 'option' ); - $filter_order = $mainframe->getUserStateFromRequest('articleelement.filter_order', 'filter_order', '', 'cmd'); - $filter_order_Dir = $mainframe->getUserStateFromRequest('articleelement.filter_order_Dir', 'filter_order_Dir', '', 'word'); - $catid = $mainframe->getUserStateFromRequest('articleelement.catid', 'catid', 0, 'int'); - $filter_authorid = $mainframe->getUserStateFromRequest('articleelement.filter_authorid', 'filter_authorid', 0, 'int'); - $filter_sectionid = $mainframe->getUserStateFromRequest('articleelement.filter_sectionid', 'filter_sectionid', -1, 'int'); + // Get the pagination request variables $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); $limitstart = $mainframe->getUserStateFromRequest('articleelement.limitstart', 'limitstart', 0, 'int'); - $search = $mainframe->getUserStateFromRequest('articleelement.search', 'search', '', 'string'); - $search = JString::strtolower($search); - //$where[] = "c.state >= 0"; - $where[] = "c.state != -2"; + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest('articleelement.filter_order', 'filter_order', 'section_name', 'cmd'); + $filter->order_Dir = $mainframe->getUserStateFromRequest('articleelement.filter_order_Dir', 'filter_order_Dir', '', 'word'); + $filter->catid = $mainframe->getUserStateFromRequest('articleelement.filter_catid', 'filter_catid', 0, 'int'); + $filter->authorid = $mainframe->getUserStateFromRequest('articleelement.filter_authorid', 'filter_authorid', 0, 'int'); + $filter->sectionid = $mainframe->getUserStateFromRequest('articleelement.filter_sectionid', 'filter_sectionid', -1, 'int'); + $filter->search = $mainframe->getUserStateFromRequest('articleelement.search', 'search', '', 'string'); + $this->_filter = $filter; + } - if (!$filter_order) { - $filter_order = 'section_name'; + /** + * Method to get content article data for the frontpage + * + * @since 1.5 + */ + function getList() + { + // Lets load the content if it doesn't already exist + if (empty($this->_list)) + { + $query = $this->_buildQuery(); + $this->_list = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_list; + } + + /** + * Method to get the total number of articles + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); } - $order = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', section_name, cc.name, c.ordering'; - $all = 1; - if ($filter_sectionid >= 0) { - $filter = ' WHERE cc.section = '.$db->Quote($filter_sectionid); + return $this->_total; + } + + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); } - $section->title = 'All Articles'; - $section->id = 0; + + return $this->_pagination; + } + + /** + * Method to get filter object for the articles + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = 'SELECT c.*, g.name AS groupname, cc.title as cctitle, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author' + . ' FROM #__content AS c' + . ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' + . ' LEFT JOIN #__sections AS s ON s.id = c.sectionid' + . ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = c.access' + . ' LEFT JOIN #__users AS u ON u.id = c.checked_out' + . ' LEFT JOIN #__users AS v ON v.id = c.created_by' + . ' LEFT JOIN #__content_frontpage AS f ON f.content_id = c.id' + . $where + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy() + { + $orderby = ' ORDER BY '.$this->_filter->order.' '.$this->_filter->order_Dir; + return $orderby; + } + + function _buildContentWhere() + { + $search = JString::strtolower( $this->_filter->search ); + + // Only published articles + $where[] = 'c.state = 1'; /* * Add the filter specific information to the where clause */ // Section filter - if ($filter_sectionid >= 0) { - $where[] = 'c.sectionid = '.(int) $filter_sectionid; + if ($this->_filter->sectionid >= 0) { + $where[] = 'c.sectionid = '.(int) $this->_filter->sectionid; } // Category filter - if ($catid > 0) { - $where[] = 'c.catid = '.(int) $catid; + if ($this->_filter->catid > 0) { + $where[] = 'c.catid = '.(int) $this->_filter->catid; } // Author filter - if ($filter_authorid > 0) { - $where[] = 'c.created_by = '.(int) $filter_authorid; + /* + * Not currently used + if ($this->_filter->authorid > 0) { + $where[] = 'c.created_by = '.(int) $this->_filter->authorid; } - - // Only published articles - $where[] = 'c.state = 1'; + */ // Keyword filter if ($search) { - $where[] = 'LOWER( c.title ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); + $where[] = 'LOWER( c.title ) LIKE '.$this->_db->Quote( '%'.$this->_db->getEscaped( $search, true ).'%', false ); } // Build the where clause of the content record query $where = (count($where) ? ' WHERE '.implode(' AND ', $where) : ''); - // Get the total number of records - $query = 'SELECT COUNT(*)' . - ' FROM #__content AS c' . - ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . - ' LEFT JOIN #__sections AS s ON s.id = c.sectionid' . - $where; - $db->setQuery($query); - $total = $db->loadResult(); - - // Create the pagination object - jimport('joomla.html.pagination'); - $this->_page = new JPagination($total, $limitstart, $limit); - - // Get the articles - $query = 'SELECT c.*, g.name AS groupname, cc.title as cctitle, u.name AS editor, f.content_id AS frontpage, s.title AS section_name, v.name AS author' . - ' FROM #__content AS c' . - ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . - ' LEFT JOIN #__sections AS s ON s.id = c.sectionid' . - ' LEFT JOIN #__groups AS g ON g.id = c.access' . - ' LEFT JOIN #__users AS u ON u.id = c.checked_out' . - ' LEFT JOIN #__users AS v ON v.id = c.created_by' . - ' LEFT JOIN #__content_frontpage AS f ON f.content_id = c.id' . - $where . - $order; - $db->setQuery($query, $this->_page->limitstart, $this->_page->limit); - $this->_list = $db->loadObjectList(); - - // If there is a db query error, throw a HTTP 500 and exit - if ($db->getErrorNum()) { - JError::raiseError( 500, $db->stderr() ); - return false; - } - - return $this->_list; - } - - function getPagination() - { - if (is_null($this->_list) || is_null($this->_page)) { - $this->getList(); - } - return $this->_page; + return $where; } } ?> diff --git a/administrator/components/com_content/models/frontpage.php b/administrator/components/com_content/models/frontpage.php new file mode 100644 index 0000000000000..8bea38e317a9c --- /dev/null +++ b/administrator/components/com_content/models/frontpage.php @@ -0,0 +1,331 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'fpordering', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter->catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' ); + $filter->search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $filter->authorid = $mainframe->getUserStateFromRequest( $option.'filter_authorid', 'filter_authorid', 0, 'int' ); + $filter->sectionid = $mainframe->getUserStateFromRequest( $option.'filter_sectionid', 'filter_sectionid', -1, 'int' ); + $this->_filter = $filter; + } + + /** + * Method to get Frontpages item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_data; + } + + /** + * Method to get the total number of Frontpage items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the Frontpages + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the Frontpages + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = 'SELECT c.*, g.name AS groupname, cc.title as name, s.title AS sect_name, u.name AS editor, f.ordering AS fpordering, v.name AS author' + . ' FROM #__content AS c' + . ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' + . ' LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope="content"' + . ' INNER JOIN #__content_frontpage AS f ON f.content_id = c.id' + . ' INNER JOIN #__core_acl_axo_groups AS g ON g.value = c.access' + . ' LEFT JOIN #__users AS u ON u.id = c.checked_out' + . ' LEFT JOIN #__users AS v ON v.id = c.created_by' + . $where + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy() + { + $orderby = ' ORDER BY '. $this->_filter->order .' '. $this->_filter->order_Dir .', fpordering'; + return $orderby; + } + + function _buildContentWhere() + { + $search = JString::strtolower( $this->_filter->search ); + + $where = array(); + $where[] = "c.state >= 0"; + + if ($this->_filter->catid > 0) { + $where[] = 'c.catid = '.(int) $this->_filter->catid; + } + if ( $this->_filter->sectionid >= 0 ) { + $where[] = 'c.sectionid = '.(int) $this->_filter->sectionid; + } + if ( $this->_filter->authorid > 0 ) { + $where[] = 'c.created_by = '. (int) $this->_filter->authorid; + } + if ( $this->_filter->state ) { + if ( $this->_filter->state == 'P' ) { + $where[] = 'c.state = 1'; + } else if ($this->_filter->state == 'U' ) { + $where[] = 'c.state = 0'; + } + } + if ($search) { + $where[] = 'LOWER(c.title) LIKE '.$this->_db->Quote('%'.$this->_db->getEscaped( $search, true ).'%', false); + } + + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + + return $where; + } + + /** + * Method to move a frontpage article + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function move($direction) + { + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + + $row = & JTable::getInstance('frontpage', 'Table'); + if (!$row->load( (int) $cid[0] )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if (!$row->move( $direction, ' 1 ' )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to save article order + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function saveorder($cid = array(), $order) + { + $row = & JTable::getInstance('frontpage', 'Table'); + + // update ordering values + for( $i=0; $i < count($cid); $i++ ) + { + $row->load( (int) $cid[$i] ); + + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + } + + // execute updateOrder + $row->reorder(' 1 '); + + return true; + } + + /** + * Method to remove articles + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__content_frontpage' + . ' WHERE content_id IN ( '.$cids.' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Function to toggle frontpage flag + * + */ + function toggle($cid) + { + /* + * We need to update frontpage status for the articles. + * + * First we include the frontpage table and instantiate an instance of + * it. + */ + $fp = & JTable::getInstance('frontpage', 'Table'); + + foreach ($cid as $id) + { + // toggles go to first place + if ($fp->load($id)) { + if (!$fp->delete($id)) { + $msg .= $fp->stderr(); + } + $fp->ordering = 0; + } else { + // new entry + $query = 'INSERT INTO #__content_frontpage' . + ' VALUES ( '. (int) $id .', 0 )'; + $this->_db->setQuery($query); + if (!$this->_db->query()) { + JError::raiseError( 500, $this->_db->stderr() ); + return false; + } + $fp->ordering = 0; + } + $fp->reorder(); + } + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_content/models/index.html b/administrator/components/com_content/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_content/models/index.html +++ b/administrator/components/com_content/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_frontpage/tables/frontpage.php b/administrator/components/com_content/tables/frontpage.php similarity index 92% rename from administrator/components/com_frontpage/tables/frontpage.php rename to administrator/components/com_content/tables/frontpage.php index 27d372b0c0241..8dd1b7b8af1af 100644 --- a/administrator/components/com_frontpage/tables/frontpage.php +++ b/administrator/components/com_content/tables/frontpage.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/administrator/components/com_content/toolbar.content.html.php b/administrator/components/com_content/toolbar.content.html.php deleted file mode 100644 index 4a2507a841dcc..0000000000000 --- a/administrator/components/com_content/toolbar.content.html.php +++ /dev/null @@ -1,84 +0,0 @@ -[ '. $text.' ]', 'addedit.png' ); - JToolBarHelper::preview( 'index.php?option=com_content&id='.$cid.'&tmpl=component', true ); - JToolBarHelper::save(); - JToolBarHelper::apply(); - if ( $edit ) { - // for existing articles the button is renamed `close` - JToolBarHelper::cancel( 'cancel', 'Close' ); - } else { - JToolBarHelper::cancel(); - } - JToolBarHelper::help( 'screen.content.edit' ); - } -/* - function _ARCHIVE() - { - JToolBarHelper::title( JText::_( 'Archive Manager' ), 'addedit.png' ); - JToolBarHelper::unarchiveList(); - JToolBarHelper::custom( 'remove', 'delete.png', 'delete_f2.png', 'Trash', false ); - JToolBarHelper::help( 'screen.content.archive' ); - } -*/ - function _MOVE() - { - JToolBarHelper::title( JText::_( 'Move Articles' ), 'move_f2.png' ); - JToolBarHelper::custom( 'movesectsave', 'save.png', 'save_f2.png', 'Save', false ); - JToolBarHelper::cancel(); - } - - function _COPY() - { - JToolBarHelper::title( JText::_( 'Copy Articles' ), 'copy_f2.png' ); - JToolBarHelper::custom( 'copysave', 'save.png', 'save_f2.png', 'Save', false ); - JToolBarHelper::cancel(); - } - - function _DEFAULT() - { - global $filter_state; - - JToolBarHelper::title( JText::_( 'Article Manager' ), 'addedit.png' ); - if ($filter_state == 'A' || $filter_state == NULL) { - JToolBarHelper::unarchiveList(); - } - if ($filter_state != 'A') { - JToolBarHelper::archiveList(); - } - JToolBarHelper::publishList(); - JToolBarHelper::unpublishList(); - JToolBarHelper::customX( 'movesect', 'move.png', 'move_f2.png', 'Move' ); - JToolBarHelper::customX( 'copy', 'copy.png', 'copy_f2.png', 'Copy' ); - JToolBarHelper::trash(); - JToolBarHelper::editListX(); - JToolBarHelper::addNewX(); - JToolBarHelper::preferences('com_content', '550'); - JToolBarHelper::help( 'screen.content' ); - } -} \ No newline at end of file diff --git a/administrator/components/com_content/toolbar.content.php b/administrator/components/com_content/toolbar.content.php deleted file mode 100644 index eec4b1230c36d..0000000000000 --- a/administrator/components/com_content/toolbar.content.php +++ /dev/null @@ -1,48 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_content/views/article/tmpl/default.php b/administrator/components/com_content/views/article/tmpl/default.php new file mode 100644 index 0000000000000..cfa42e29b1811 --- /dev/null +++ b/administrator/components/com_content/views/article/tmpl/default.php @@ -0,0 +1,280 @@ + + +getNullDate(); + + // used to hide "Reset Hits" when hits = 0 + if ( !$this->row->hits ) { + $visibility = 'style="display: none; visibility: hidden;"'; + } else { + $visibility = ''; + } +?> + +[ '. $text.' ]', 'addedit.png' ); + JToolBarHelper::preview( 'index.php?option=com_content&id='.$cid.'&tmpl=component', true ); + JToolBarHelper::save(); + JToolBarHelper::apply(); + if ( $edit ) { + // for existing articles the button is renamed `close` + JToolBarHelper::cancel( 'cancel', 'Close' ); + } else { + JToolBarHelper::cancel(); + } + JToolBarHelper::help( 'screen.content.edit' ); +?> + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + +
    + + + + + + + lists['state']; ?> +
    + + + + + + + lists['frontpage']; ?> +
    + + + lists['sectionid']; ?> + + + + lists['catid']; ?> +
    + + + + +
    + display( 'text', $this->row->text , '100%', '550', '75', '20' ) ; + ?> +
    +
    +
    + +
    +
    + + row->id ) { + ?> + + + + + + + + + + + + + + + + + + + + + + + + + +
    + : + + row->id; ?> +
    + + + row->state > 0 ? JText::_( 'Published' ) : ($this->row->state < 0 ? JText::_( 'Archived' ) : JText::_( 'Draft Unpublished' ) );?> +
    + + + row->hits;?> + > + + +
    + + + row->version;?> +
    + + + row->created == $nullDate ) { + echo JText::_( 'New document' ); + } else { + echo JHTML::_('date', $this->row->created, JText::_('DATE_FORMAT_LC2') ); + } + ?> +
    + + + row->modified == $nullDate ) { + echo JText::_( 'Not modified' ); + } else { + echo JHTML::_('date', $this->row->modified, JText::_('DATE_FORMAT_LC2')); + } + ?> +
    +
    +
    + + + startPane("menu-pane"); + $groups = $this->params->getGroups(); + if(count($groups)) { + foreach($groups as $groupname => $group) { + if($groupname == '_default') { + $title = 'Article'; + } else { + $title = ucfirst($groupname); + } + if($this->params->getNumParams($groupname)) { + echo $pane->startPanel(JText :: _('Parameters - '.$title), $groupname.'-page'); + echo $this->params->render('params', $groupname); + echo $pane->endPanel(); + } + + } + } + echo $pane->endPane(); ?> +
    +
    +
    + + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_content/views/article/tmpl/index.html b/administrator/components/com_content/views/article/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/article/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/article/view.html.php b/administrator/components/com_content/views/article/view.html.php new file mode 100644 index 0000000000000..fae380d9465d4 --- /dev/null +++ b/administrator/components/com_content/views/article/view.html.php @@ -0,0 +1,295 @@ +getNullDate(); + $contentSection = ''; + $sectionid = 0; + $model =& $this->getModel(); + + //get the content + $row =& $this->get('data'); + $edit = JRequest::getVar('edit',true); + + if ($edit) { + $sectionid = $row->sectionid; + if ($row->state < 0) { + $mainframe->redirect('index.php?option=com_content', JText::_('You cannot edit an archived item')); + } + } + + // A sectionid of zero means grab from all sections + /* + * Not used? + if ($sectionid == 0) { + $where = ' WHERE section NOT LIKE "%com_%"'; + } else { + // Grab from the specific section + $where = ' WHERE section = '. $db->Quote( $sectionid ); + } + */ + + /* + * If the item is checked out we cannot edit it... unless it was checked + * out by the current user. + */ + // fail if checked out not by 'me' + if ( JTable::isCheckedOut($user->get ('id'), $row->checked_out )) + { + $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('The item'), $row->title); + $mainframe->redirect('index.php?option=com_content', $msg); + } + + if ($edit) + { + $model->checkout( $user->get('id')); + + if (trim($row->images)) { + $row->images = explode("\n", $row->images); + } else { + $row->images = array (); + } + + $query = 'SELECT name' . + ' FROM #__users'. + ' WHERE id = '. (int) $row->created_by; + $db->setQuery($query); + $row->creator = $db->loadResult(); + + // test to reduce unneeded query + if ($row->created_by == $row->modified_by) { + $row->modifier = $row->creator; + } else { + $query = 'SELECT name' . + ' FROM #__users' . + ' WHERE id = '. (int) $row->modified_by; + $db->setQuery($query); + $row->modifier = $db->loadResult(); + } + + $query = 'SELECT COUNT(content_id)' . + ' FROM #__content_frontpage' . + ' WHERE content_id = '. (int) $row->id; + $db->setQuery($query); + $row->frontpage = $db->loadResult(); + if (!$row->frontpage) { + $row->frontpage = 0; + } + } + else + { + if (!$sectionid && JRequest::getInt('filter_sectionid')) { + $sectionid =JRequest::getInt('filter_sectionid'); + } + + if (JRequest::getInt('catid')) + { + $row->catid = JRequest::getInt('catid'); + $category = & JTable::getInstance('category'); + $category->load($row->catid); + $sectionid = $category->section; + } else { + $row->catid = NULL; + } + $createdate =& JFactory::getDate(); + $row->sectionid = $sectionid; + $row->version = 0; + $row->state = 1; + $row->ordering = 0; + $row->images = array (); + $row->publish_up = $createdate->toMySQL(); + $row->publish_down = JText::_('Never'); + $row->creator = ''; + $row->created = $createdate->toMySQL(); + $row->modified = $nullDate; + $row->modifier = ''; + $row->frontpage = 0; + } + + $javascript = "onchange=\"changeDynaList( 'catid', sectioncategories, document.adminForm.sectionid.options[document.adminForm.sectionid.selectedIndex].value, 0, 0);\""; + + $query = 'SELECT s.id, s.title' . + ' FROM #__sections AS s' . + ' ORDER BY s.ordering'; + $db->setQuery($query); + + $sections[] = JHTML::_('select.option', '-1', '- '.JText::_('Select Section').' -', 'id', 'title'); + $sections[] = JHTML::_('select.option', '0', JText::_('Uncategorized'), 'id', 'title'); + $sections = array_merge($sections, $db->loadObjectList()); + $lists['sectionid'] = JHTML::_('select.genericlist', $sections, 'sectionid', 'class="inputbox" size="1" '.$javascript, 'id', 'title', intval($row->sectionid)); + + foreach ($sections as $section) + { + $section_list[] = (int) $section->id; + // get the type name - which is a special category + if ($row->sectionid) { + if ($section->id == $row->sectionid) { + $contentSection = $section->title; + } + } else { + if ($section->id == $sectionid) { + $contentSection = $section->title; + } + } + } + + $sectioncategories = array (); + $sectioncategories[-1] = array (); + $sectioncategories[-1][] = JHTML::_('select.option', '-1', JText::_( 'Select Category' ), 'id', 'title'); + $section_list = implode('\', \'', $section_list); + + $query = 'SELECT id, title, section' . + ' FROM #__categories' . + ' WHERE section IN ( \''.$section_list.'\' )' . + ' ORDER BY ordering'; + $db->setQuery($query); + $cat_list = $db->loadObjectList(); + + // Uncategorized category mapped to uncategorized section + $uncat = new stdClass(); + $uncat->id = 0; + $uncat->title = JText::_('Uncategorized'); + $uncat->section = 0; + $cat_list[] = $uncat; + foreach ($sections as $section) + { + $sectioncategories[$section->id] = array (); + $rows2 = array (); + foreach ($cat_list as $cat) + { + if ($cat->section == $section->id) { + $rows2[] = $cat; + } + } + foreach ($rows2 as $row2) { + $sectioncategories[$section->id][] = JHTML::_('select.option', $row2->id, $row2->title, 'id', 'title'); + } + } + $sectioncategories['-1'][] = JHTML::_('select.option', '-1', JText::_( 'Select Category' ), 'id', 'title'); + $categories = array(); + foreach ($cat_list as $cat) { + if($cat->section == $row->sectionid) + $categories[] = $cat; + } + + $categories[] = JHTML::_('select.option', '-1', JText::_( 'Select Category' ), 'id', 'title'); + $lists['catid'] = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1"', 'id', 'title', intval($row->catid)); + + // build the html select list for ordering + $query = 'SELECT ordering AS value, title AS text' . + ' FROM #__content' . + ' WHERE catid = ' . (int) $row->catid . + ' AND state >= 0' . + ' ORDER BY ordering'; + if($edit) + $lists['ordering'] = JHTML::_('list.specificordering', $row, $id, $query, 1); + else + $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query, 1); + + // build the html radio buttons for frontpage + $lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', $row->frontpage); + + // build the html radio buttons for published + $lists['state'] = JHTML::_('select.booleanlist', 'state', '', $row->state); + + /* + * We need to unify the introtext and fulltext fields and have the + * fields separated by the {readmore} tag, so lets do that now. + */ + if (JString::strlen($row->fulltext) > 1) { + $row->text = $row->introtext . "
    " . $row->fulltext; + } else { + $row->text = $row->introtext; + } + + // Parameters + $file = JPATH_COMPONENT.DS.'models'.DS.'article.xml'; + $params = new JParameter( '', $file ); + $params->loadSetupDirectory(JPATH_COMPONENT.DS.'params', 'article_(.*)\.xml'); + $active = (intval($row->created_by) ? intval($row->created_by) : $user->get('id')); + $params->set('created_by', $active); + $params->set('access', $row->access); + $params->set('created_by_alias', $row->created_by_alias); + $params->set('created', JHTML::_('date', $row->created, '%Y-%m-%d %H:%M:%S')); + $params->set('publish_up', JHTML::_('date', $row->publish_up, '%Y-%m-%d %H:%M:%S')); + $params->set('publish_down', $row->publish_down); + if (JHTML::_('date', $row->publish_down, '%Y') <= 1969 || $row->publish_down == $db->getNullDate()) { + $params->set('publish_down', JText::_('Never')); + } else { + $params->set('publish_down', JHTML::_('date', $row->publish_down, '%Y-%m-%d %H:%M:%S')); + } + + $params->bind($row->attribs); + + // Metadata Group + $params->set('description', $row->metadesc); + $params->set('keywords', $row->metakey); + $params->bind($row->metadata); + + $this->assignRef('lists', $lists); + $this->assignRef('row', $row); + $this->assignRef('option', $option); + $this->assignRef('params', $params); + $this->assignRef('contentSection', $contentSection); + $this->assignRef('sectioncategories', $sectioncategories); + + parent::display($tpl); + } + + function _validateDate($date) + { + $db =& JFactory::getDBO(); + + if (JHTML::_('date', $date, '%Y') == 1969 || $date == $db->getNullDate()) { + $newDate = JText::_('Never'); + } else { + $newDate = JHTML::_('date', $date, '%Y-%m-%d %H:%M:%S'); + } + + return $newDate; + } +} diff --git a/administrator/components/com_content/views/articles/index.html b/administrator/components/com_content/views/articles/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/articles/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/articles/tmpl/default.php b/administrator/components/com_content/views/articles/tmpl/default.php new file mode 100644 index 0000000000000..55439745de468 --- /dev/null +++ b/administrator/components/com_content/views/articles/tmpl/default.php @@ -0,0 +1,237 @@ + + +getNullDate(); + + //Ordering allowed ? + $ordering = ($this->filter->order == 'section_name' || $this->filter->order == 'cc.name'); + JHTML::_('behavior.tooltip'); +?> + +
    + + + + + +
    + : + + + + + filter->sectionid, 'onchange="document.adminForm.submit();"'); + echo JHTML::_('contentgrid.category', 'filter_catid', $this->filter->catid, $this->filter->sectionid); + echo JHTML::_('contentgrid.author', 'filter_authorid', $this->filter->authorid); + echo JHTML::_('grid.state', $this->filter->state, 'Published', 'Unpublished', 'Archived'); + ?> +
    + + + + + + + + + + + + + + + + + + + + + + + + + + rows ); $i < $n; $i++) + { + $row = &$this->rows[$i]; + + $link = 'index.php?option=com_content§ionid='. $this->redirect .'&task=edit&cid[]='. $row->id; + + $row->sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->sectionid ); + $row->cat_link = JRoute::_( 'index.php?option=com_categories&task=edit&cid[]='. $row->catid ); + + $publish_up = new JDate($row->publish_up); + $publish_down = new JDate($row->publish_down); + $publish_up->setOffset($config->getValue('config.offset')); + $publish_down->setOffset($config->getValue('config.offset')); + if ( $now->toUnix() <= $publish_up->toUnix() && $row->state == 1 ) { + $img = 'publish_y.png'; + $alt = JText::_( 'Published' ); + } else if ( ( $now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate ) && $row->state == 1 ) { + $img = 'publish_g.png'; + $alt = JText::_( 'Published' ); + } else if ( $now->toUnix() > $publish_down->toUnix() && $row->state == 1 ) { + $img = 'publish_r.png'; + $alt = JText::_( 'Expired' ); + } else if ( $row->state == 0 ) { + $img = 'publish_x.png'; + $alt = JText::_( 'Unpublished' ); + } else if ( $row->state == -1 ) { + $img = 'disabled.png'; + $alt = JText::_( 'Archived' ); + } + $times = ''; + if (isset($row->publish_up)) { + if ($row->publish_up == $nullDate) { + $times .= JText::_( 'Start: Always' ); + } else { + $times .= JText::_( 'Start' ) .": ". $publish_up->toFormat(); + } + } + if (isset($row->publish_down)) { + if ($row->publish_down == $nullDate) { + $times .= "
    ". JText::_( 'Finish: No Expiry' ); + } else { + $times .= "
    ". JText::_( 'Finish' ) .": ". $publish_down->toFormat(); + } + } + + if ( $user->authorize( 'com_users', 'manage' ) ) { + if ( $row->created_by_alias ) { + $author = $row->created_by_alias; + } else { + $linkA = 'index.php?option=com_users&task=edit&cid[]='. $row->created_by; + $author = ''. $row->author .''; + } + } else { + if ( $row->created_by_alias ) { + $author = $row->created_by_alias; + } else { + $author = $row->author; + } + } + + $access = JHTML::_('grid.access', $row, $i, $row->state ); + $checked = JHTML::_('grid.checkedout', $row, $i ); + ?> + "> + + + + + + + + + + + + + + + + + + +
    + + + + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + rows ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset( $i ); ?> + + + + get ('id'), $row->checked_out ) ) { + echo $row->title; + } else if ($row->state == -1) { + echo htmlspecialchars($row->title, ENT_QUOTES, 'UTF-8'); + echo ' [ '. JText::_( 'Archived' ) .' ]'; + } else { + ?> + + title, ENT_QUOTES); ?> + + + + <?php echo $alt; ?> + + + <?php echo ( $row->frontpage ) ? JText::_( 'Yes' ) : JText::_( 'No' );?> + + pagination->orderUpIcon( $i, ($row->catid == @$this->rows[$i-1]->catid), 'orderup', 'Move Up', $ordering); ?> + pagination->orderDownIcon( $i, $n, ($row->catid == @$this->rows[$i+1]->catid), 'orderdown', 'Move Down', $ordering ); ?> + + class="text_area" style="text-align: center" /> + + + + + section_name; ?> + + + name; ?> + + + + created, JText::_('DATE_FORMAT_LC4') ); ?> + + hits ?> + + id; ?> +
    + + + + + + + + + +
    diff --git a/administrator/components/com_content/views/articles/tmpl/index.html b/administrator/components/com_content/views/articles/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/articles/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/articles/view.html.php b/administrator/components/com_content/views/articles/view.html.php new file mode 100644 index 0000000000000..766284796ec27 --- /dev/null +++ b/administrator/components/com_content/views/articles/view.html.php @@ -0,0 +1,71 @@ +get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter' ); + + $redirect = $filter->sectionid; + + JToolBarHelper::title( JText::_( 'Article Manager' ), 'addedit.png' ); + if ($filter->state == 'A' || $filter->state == NULL) { + JToolBarHelper::unarchiveList(); + } + if ($filter->state != 'A') { + JToolBarHelper::archiveList(); + } + JToolBarHelper::publishList(); + JToolBarHelper::unpublishList(); + JToolBarHelper::customX( 'movesect', 'move.png', 'move_f2.png', 'Move' ); + JToolBarHelper::customX( 'copy', 'copy.png', 'copy_f2.png', 'Copy' ); + JToolBarHelper::trash(); + JToolBarHelper::editListX(); + JToolBarHelper::addNewX(); + JToolBarHelper::preferences('com_content', '550'); + JToolBarHelper::help( 'screen.content' ); + + JSubMenuHelper::addEntry(JText::_('Articles'), 'index.php?option=com_content', true ); + JSubMenuHelper::addEntry(JText::_('Front Page'), 'index.php?option=com_content&controller=frontpage' ); + + $this->assignRef('redirect', $redirect); + $this->assignRef('rows', $rows); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_content/views/copyselect/index.html b/administrator/components/com_content/views/copyselect/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/copyselect/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/copyselect/tmpl/default.php b/administrator/components/com_content/views/copyselect/tmpl/default.php new file mode 100644 index 0000000000000..59657e17372ef --- /dev/null +++ b/administrator/components/com_content/views/copyselect/tmpl/default.php @@ -0,0 +1,71 @@ + + + + +
    + + + + + + +
    + : +
    + sectCatList; ?> +

    +
    + : +
    + "; + foreach ( $this->items as $item ) { + echo "
  • ". $item->title ."
  • "; + } + echo ""; + ?> +
    +

    + + + + +cid as $id) { + echo "\n"; +} +?> + +
    \ No newline at end of file diff --git a/administrator/components/com_content/views/copyselect/tmpl/index.html b/administrator/components/com_content/views/copyselect/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/copyselect/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/copyselect/view.html.php b/administrator/components/com_content/views/copyselect/view.html.php new file mode 100644 index 0000000000000..ef9cefadecabf --- /dev/null +++ b/administrator/components/com_content/views/copyselect/view.html.php @@ -0,0 +1,81 @@ +redirect('index.php?option='.$option, $msg, 'error'); + } + + //seperate contentids + $cids = implode(',', $cid); + ## Articles query + $query = 'SELECT a.title' . + ' FROM #__content AS a' . + ' WHERE ( a.id IN ( '. $cids .' ) )' . + ' ORDER BY a.title'; + $db->setQuery($query); + $items = $db->loadObjectList(); + + ## Section & Category query + $query = 'SELECT CONCAT_WS(",",s.id,c.id) AS `value`, CONCAT_WS(" / ", s.title, c.title) AS `text`' . + ' FROM #__sections AS s' . + ' INNER JOIN #__categories AS c ON c.section = s.id' . + ' WHERE s.scope = "content"' . + ' ORDER BY s.title, c.title'; + $db->setQuery($query); + + // Add a row for uncategorized content + $uncat = JHTML::_('select.option', '0,0', JText::_('UNCATEGORIZED')); + $rows = $db->loadObjectList(); + array_unshift($rows, $uncat); + // build the html select list + $sectCatList = JHTML::_('select.genericlist', $rows, 'sectcat', 'class="inputbox" size="10"', 'value', 'text', NULL); + + $this->assignRef('option', $option); + $this->assignRef('cid', $cid); + $this->assignRef('sectCatList', $sectCatList); + $this->assignRef('sectionid', $sectionid); + $this->assignRef('items', $items); + + // Render article preview + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_content/views/element/index.html b/administrator/components/com_content/views/element/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_content/views/element/index.html +++ b/administrator/components/com_content/views/element/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_content/views/element/tmpl/default.php b/administrator/components/com_content/views/element/tmpl/default.php new file mode 100644 index 0000000000000..65682f0f6cf56 --- /dev/null +++ b/administrator/components/com_content/views/element/tmpl/default.php @@ -0,0 +1,103 @@ + + + +
    + + + + + + +
    + : + + + + + filter->sectionid, 'onchange="document.adminForm.submit();"'); + echo JHTML::_('contentgrid.category', 'filter_catid', $this->filter->catid, $this->filter->sectionid); + ?> +
    + + + + + + + + + + + + + + + + + + + + rows ); $i < $n; $i++) + { + $row = &$this->rows[$i]; + + $link = ''; + $date = JHTML::_('date', $row->created, JText::_('DATE_FORMAT_LC4') ); + $access = JHTML::_('grid.access', $row, $i, $row->state ); + ?> + "> + + + + + + + + + + +
    + + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset( $i ); ?> + + title); ?>', '');"> + title, ENT_QUOTES, 'UTF-8'); ?> + + groupname;?> + + id; ?> + + section_name; ?> + + cctitle; ?> + + +
    + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_content/views/element/tmpl/index.html b/administrator/components/com_content/views/element/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/element/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/element/view.php b/administrator/components/com_content/views/element/view.php index 63753643450d5..feca7d28bdcc0 100644 --- a/administrator/components/com_content/views/element/view.php +++ b/administrator/components/com_content/views/element/view.php @@ -26,173 +26,27 @@ */ class ContentViewElement extends JView { - function display() + function display($tpl = null) { global $mainframe; - // Initialize variables - $db = &JFactory::getDBO(); - $nullDate = $db->getNullDate(); - $document = & JFactory::getDocument(); $document->setTitle('Article Selection'); - JHTML::_('behavior.modal'); - $template = $mainframe->getTemplate(); $document->addStyleSheet("templates/$template/css/general.css"); - $limitstart = JRequest::getVar('limitstart', '0', '', 'int'); - - $lists = $this->_getLists(); - - //Ordering allowed ? - $ordering = ($lists['order'] == 'section_name' && $lists['order_Dir'] == 'ASC'); - - $rows = &$this->get('List'); - $page = &$this->get('Pagination'); - JHTML::_('behavior.tooltip'); - ?> -
    - - - - - - -
    - : - - - - - -
    - - - - - - - - - - - - - - - - - - - - created, JText::_('DATE_FORMAT_LC4') ); - $access = JHTML::_('grid.access', $row, $i, $row->state ); - ?> - "> - - - - - - - - - - -
    - - - - - - - - - - - - - -
    - getListFooter(); ?> -
    - getRowOffset( $i ); ?> - - title); ?>', '');"> - title, ENT_QUOTES, 'UTF-8'); ?> - - groupname;?> - - id; ?> - - section_name; ?> - - cctitle; ?> - - -
    - - - - -
    - getUserStateFromRequest('articleelement.filter_order', 'filter_order', '', 'cmd'); - $filter_order_Dir = $mainframe->getUserStateFromRequest('articleelement.filter_order_Dir', 'filter_order_Dir', '', 'word'); - $filter_state = $mainframe->getUserStateFromRequest('articleelement.filter_state', 'filter_state', '', 'word'); - $catid = $mainframe->getUserStateFromRequest('articleelement.catid', 'catid', 0, 'int'); - $filter_authorid = $mainframe->getUserStateFromRequest('articleelement.filter_authorid', 'filter_authorid', 0, 'int'); - $filter_sectionid = $mainframe->getUserStateFromRequest('articleelement.filter_sectionid', 'filter_sectionid', -1, 'int'); - $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); - $limitstart = $mainframe->getUserStateFromRequest('articleelement.limitstart', 'limitstart', 0, 'int'); - $search = $mainframe->getUserStateFromRequest('articleelement.search', 'search', '', 'string'); - $search = JString::strtolower($search); - - // get list of categories for dropdown filter - $query = 'SELECT cc.id AS value, cc.title AS text, section FROM #__categories AS cc' . - ' INNER JOIN #__sections AS s ON s.id = cc.section' . - ' ORDER BY s.ordering, cc.ordering'; - $lists['catid'] = ContentHelper::filterCategory($query, $catid); - - // get list of sections for dropdown filter - $javascript = 'onchange="document.adminForm.submit();"'; - $lists['sectionid'] = JHTML::_('list.section', 'filter_sectionid', $filter_sectionid, $javascript); + JHTML::_('behavior.modal'); - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; + $rows = & $this->get( 'List'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter' ); - // search filter - $lists['search'] = $search; + $this->assignRef('rows', $rows); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); - return $lists; + parent::display($tpl); } } \ No newline at end of file diff --git a/administrator/components/com_content/views/frontpage/index.html b/administrator/components/com_content/views/frontpage/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/frontpage/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/frontpage/tmpl/default.php b/administrator/components/com_content/views/frontpage/tmpl/default.php new file mode 100644 index 0000000000000..1aba2f5a35542 --- /dev/null +++ b/administrator/components/com_content/views/frontpage/tmpl/default.php @@ -0,0 +1,237 @@ + + +getNullDate(); + + global $controller; + + JHTML::_('behavior.tooltip'); + //Ordering allowed ? + $ordering = ($this->filter->order == 'fpordering'); +?> + +
    + + + + + +
    + : + + + + + filter->sectionid, 'onchange="document.adminForm.submit();"' ); + echo JHTML::_('contentgrid.category', 'filter_catid', $this->filter->catid, $this->filter->sectionid); + echo JHTML::_('contentgrid.author', 'filter_authorid', $this->filter->authorid); + echo JHTML::_('grid.state', $this->filter->state ); + ?> +
    + + + + + + + + + + + + + + + + + + + + + + + + rows ); $i < $n; $i++) + { + $row = &$this->rows[$i]; + + $link = JRoute::_( 'index.php?option=com_content&task=edit&cid[]='. $row->id ); + + $publish_up =& JFactory::getDate($row->publish_up); + $publish_down =& JFactory::getDate($row->publish_down); + $publish_up->setOffset($config->getValue('config.offset')); + $publish_down->setOffset($config->getValue('config.offset')); + if ( $now->toUnix() <= $publish_up->toUnix() && $row->state == 1 ) { + $img = 'publish_y.png'; + $alt = JText::_( 'Published' ); + } else if ( ( $now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate ) && $row->state == 1 ) { + $img = 'publish_g.png'; + $alt = JText::_( 'Published' ); + } else if ( $now->toUnix() > $publish_down->toUnix() && $row->state == 1 ) { + $img = 'publish_r.png'; + $alt = JText::_( 'Expired' ); + } else if ( $row->state == 0 ) { + $img = 'publish_x.png'; + $alt = JText::_( 'Unpublished' ); + } else if ( $row->state == -1 ) { + $img = 'disabled.png'; + $alt = JText::_( 'Archived' ); + } + $times = ''; + if (isset($row->publish_up)) { + if ($row->publish_up == $nullDate) { + $times .= JText::_( 'Start: Always' ); + } else { + $times .= JText::_( 'Start' ) .": ". $publish_up->toFormat(); + } + } + if (isset($row->publish_down)) { + if ($row->publish_down == $nullDate) { + $times .= "
    ". JText::_( 'Finish: No Expiry' ); + } else { + $times .= "
    ". JText::_( 'Finish' ) .": ". $publish_down->toFormat(); + } + } + + $access = JHTML::_('grid.access', $row, $i ); + $checked = JHTML::_('grid.checkedout', $row, $i ); + + if ( $user->authorize( 'com_users', 'manage' ) ) { + if ( $row->created_by_alias ) { + $author = $row->created_by_alias; + } else { + $linkA = JRoute::_( 'index.php?option=com_users&task=edit&cid[]='. $row->created_by ); + $author='' . + ''. $row->author .''; + } + } else { + if ( $row->created_by_alias ) { + $author = $row->created_by_alias; + } else { + $author = $row->author; + } + } + + // section handling + if ($row->sectionid) { + $row->sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->sectionid ); + $title_sec = JText::_( 'Edit Section' ); + } + + // category handling + if ($row->catid) { + $row->cat_link = JRoute::_( 'index.php?option=com_categories&task=edit&cid[]='. $row->catid ); + $title_cat = JText::_( 'Edit Category' ); + } + ?> + "> + + + + + + + + + + + + + + + +
    + + + + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + rows ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset( $i ); ?> + + + + get ('id'), $row->checked_out ) ) { + echo $row->title; + } else { + ?> + + + title; ?> + + + + + <?php echo $alt;?> + + pagination->orderUpIcon( $i, true, 'orderup', 'Move Up', $ordering ); ?> + pagination->orderDownIcon( $i, $n, true, 'orderdown', 'Move Down', $ordering ); ?> + + class="text_area" style="text-align: center" /> + + + + id;?> + + sectionid) : ?> + + + sect_name; ?> + + + catid) : ?> + + + name; ?> + + + +
    + + + + + + + + + +
    diff --git a/administrator/components/com_content/views/frontpage/tmpl/index.html b/administrator/components/com_content/views/frontpage/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/frontpage/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/frontpage/view.html.php b/administrator/components/com_content/views/frontpage/view.html.php new file mode 100644 index 0000000000000..61c969e1988b6 --- /dev/null +++ b/administrator/components/com_content/views/frontpage/view.html.php @@ -0,0 +1,63 @@ +get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter'); + + $this->assignRef('user', JFactory::getUser()); + $this->assignRef('rows', $rows); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_content/views/index.html b/administrator/components/com_content/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_content/views/index.html +++ b/administrator/components/com_content/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_content/views/pagebreak/index.html b/administrator/components/com_content/views/pagebreak/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/pagebreak/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/pagebreak/tmpl/default.php b/administrator/components/com_content/views/pagebreak/tmpl/default.php new file mode 100644 index 0000000000000..57aea0226309f --- /dev/null +++ b/administrator/components/com_content/views/pagebreak/tmpl/default.php @@ -0,0 +1,51 @@ + + + + +
    + + + + + + + + + +
    + + + +
    + + + +
    +
    + \ No newline at end of file diff --git a/administrator/components/com_content/views/pagebreak/tmpl/index.html b/administrator/components/com_content/views/pagebreak/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/pagebreak/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/pagebreak/view.html.php b/administrator/components/com_content/views/pagebreak/view.html.php new file mode 100644 index 0000000000000..306934a0cbb5b --- /dev/null +++ b/administrator/components/com_content/views/pagebreak/view.html.php @@ -0,0 +1,42 @@ +setTitle(JText::_('PGB ARTICLE PAGEBRK')); + + $eName = JRequest::getVar('e_name'); + $eName = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName ); + + $this->assignRef('eName', $eName); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_content/views/prevuuw/index.html b/administrator/components/com_content/views/prevuuw/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/prevuuw/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/prevuuw/tmpl/default.php b/administrator/components/com_content/views/prevuuw/tmpl/default.php new file mode 100644 index 0000000000000..6629160de25a6 --- /dev/null +++ b/administrator/components/com_content/views/prevuuw/tmpl/default.php @@ -0,0 +1,24 @@ + + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_content/views/prevuuw/tmpl/index.html b/administrator/components/com_content/views/prevuuw/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_content/views/prevuuw/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_content/views/prevuuw/view.html.php b/administrator/components/com_content/views/prevuuw/view.html.php new file mode 100644 index 0000000000000..5e05152f5845a --- /dev/null +++ b/administrator/components/com_content/views/prevuuw/view.html.php @@ -0,0 +1,63 @@ +setQuery($query); + $template = $db->loadResult(); + + // check if template editor stylesheet exists + if (!file_exists( JPATH_SITE.DS.'templates'.DS.$template.DS.'css'.DS.'editor.css' )) { + $template = 'system'; + } + + // Set page title + $document->setTitle(JText::_('Article Preview')); + $document->addStyleSheet('/templates/'.$template.'/css/editor.css'); + $document->setBase(JURI::root()); + $document->setLink(JURI::root()); + + // Render article preview + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_cpanel/admin.cpanel.html.php b/administrator/components/com_cpanel/admin.cpanel.html.php deleted file mode 100644 index dbfc05e805cf6..0000000000000 --- a/administrator/components/com_cpanel/admin.cpanel.html.php +++ /dev/null @@ -1,47 +0,0 @@ -startPane("content-pane"); - - foreach ($modules as $module) { - $title = $module->title ; - echo $pane->startPanel( $title, 'cpanel-panel-'.$module->name ); - echo JModuleHelper::renderModule($module); - echo $pane->endPanel(); - } - - echo $pane->endPane(); - } -} \ No newline at end of file diff --git a/administrator/components/com_cpanel/controller.php b/administrator/components/com_cpanel/controller.php new file mode 100644 index 0000000000000..81911e916e572 --- /dev/null +++ b/administrator/components/com_cpanel/controller.php @@ -0,0 +1,29 @@ +execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_cpanel/index.html b/administrator/components/com_cpanel/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_cpanel/index.html +++ b/administrator/components/com_cpanel/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_cpanel/views/cpanel/index.html b/administrator/components/com_cpanel/views/cpanel/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_cpanel/views/cpanel/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_cpanel/views/cpanel/tmpl/default.php b/administrator/components/com_cpanel/views/cpanel/tmpl/default.php new file mode 100644 index 0000000000000..99343e7375f47 --- /dev/null +++ b/administrator/components/com_cpanel/views/cpanel/tmpl/default.php @@ -0,0 +1,15 @@ + + +startPane("content-pane"); + + foreach ($this->modules as $module) { + echo $pane->startPanel( $module->title, 'cpanel-panel-'.$module->name ); + echo JModuleHelper::renderModule($module); + echo $pane->endPanel(); + } + + echo $pane->endPane(); +?> \ No newline at end of file diff --git a/administrator/components/com_cpanel/views/cpanel/tmpl/index.html b/administrator/components/com_cpanel/views/cpanel/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_cpanel/views/cpanel/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_cpanel/views/cpanel/view.html.php b/administrator/components/com_cpanel/views/cpanel/view.html.php new file mode 100644 index 0000000000000..6d9b5df794499 --- /dev/null +++ b/administrator/components/com_cpanel/views/cpanel/view.html.php @@ -0,0 +1,52 @@ +assignRef('modules', $modules); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_cpanel/views/index.html b/administrator/components/com_cpanel/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_cpanel/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_frontpage/admin.frontpage.php b/administrator/components/com_frontpage/admin.frontpage.php deleted file mode 100644 index 1d2719dcc65fd..0000000000000 --- a/administrator/components/com_frontpage/admin.frontpage.php +++ /dev/null @@ -1,369 +0,0 @@ -authorize( 'com_frontpage', 'manage' )) { - $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); -} - -// Set the table directory -JTable::addIncludePath(JPATH_COMPONENT.DS.DS.'tables'); - -// Set the helper directory -JHTML::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_content'.DS.'helper' ); - -$cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); -JArrayHelper::toInteger($cid, array(0)); - -switch ( JRequest::getCmd( 'task' ) ) -{ - case 'publish': - changeFrontPage( $cid, 1, $option ); - break; - - case 'unpublish': - changeFrontPage( $cid, 0, $option ); - break; - - case 'archive': - changeFrontPage( $cid, -1, $option ); - break; - - case 'remove': - removeFrontPage( $cid, $option ); - break; - - case 'orderup': - orderFrontPage( $cid[0], -1, $option ); - break; - - case 'orderdown': - orderFrontPage( $cid[0], 1, $option ); - break; - - case 'saveorder': - saveOrder( $cid ); - break; - - case 'accesspublic': - accessMenu( $cid[0], 0 ); - break; - - case 'accessregistered': - accessMenu( $cid[0], 1 ); - break; - - case 'accessspecial': - accessMenu( $cid[0], 2 ); - break; - - default: - viewFrontPage( $option ); - break; -} - - -/** -* Compiles a list of frontpage items -*/ -function viewFrontPage( $option ) -{ - global $mainframe; - - $db =& JFactory::getDBO(); - $filter_order = $mainframe->getUserStateFromRequest( $option.'.filter_order', 'filter_order', 'fpordering', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); - $filter_state = $mainframe->getUserStateFromRequest( $option.'.filter_state', 'filter_state', '', 'word' ); - $catid = $mainframe->getUserStateFromRequest( $option.'.catid', 'catid', 0, 'int' ); - $filter_authorid = $mainframe->getUserStateFromRequest( $option.'.filter_authorid', 'filter_authorid', 0, 'int' ); - $filter_sectionid = $mainframe->getUserStateFromRequest( $option.'.filter_sectionid', 'filter_sectionid', -1, 'int' ); - $search = $mainframe->getUserStateFromRequest( $option.'.search', 'search', '', 'string' ); - $search = JString::strtolower( $search ); - - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); - $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); - - JToolBarHelper::title( JText::_( 'Frontpage Manager' ), 'frontpage.png' ); - JToolBarHelper::archiveList(); - JToolBarHelper::publishList(); - JToolBarHelper::unpublishList(); - JToolBarHelper::custom('remove','delete.png','delete_f2.png','Remove', true); - JToolBarHelper::help( 'screen.frontpage' ); - - $where = array( - "c.state >= 0" - ); - - // used by filter - if ( $filter_sectionid >= 0 ) { - $where[] = 'c.sectionid = '.(int) $filter_sectionid; - } - if ( $catid > 0 ) { - $where[] = 'c.catid = '.(int) $catid; - } - if ( $filter_authorid > 0 ) { - $where[] = 'c.created_by = '. (int) $filter_authorid; - } - if ( $filter_state ) { - if ( $filter_state == 'P' ) { - $where[] = 'c.state = 1'; - } else if ($filter_state == 'U' ) { - $where[] = 'c.state = 0'; - } - } - - if ($search) { - $where[] = 'LOWER( c.title ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); - } - - $where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' ); - $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', fpordering'; - - // get the total number of records - $query = 'SELECT count(*)' - . ' FROM #__content AS c' - . ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' - . ' LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope="content"' - . ' INNER JOIN #__content_frontpage AS f ON f.content_id = c.id' - . $where - ; - $db->setQuery( $query ); - $total = $db->loadResult(); - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $total, $limitstart, $limit ); - - $query = 'SELECT c.*, g.name AS groupname, cc.title as name, s.title AS sect_name, u.name AS editor, f.ordering AS fpordering, v.name AS author' - . ' FROM #__content AS c' - . ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' - . ' LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope="content"' - . ' INNER JOIN #__content_frontpage AS f ON f.content_id = c.id' - . ' INNER JOIN #__groups AS g ON g.id = c.access' - . ' LEFT JOIN #__users AS u ON u.id = c.checked_out' - . ' LEFT JOIN #__users AS v ON v.id = c.created_by' - . $where - . $orderby - ; - $db->setQuery( $query, $pageNav->limitstart,$pageNav->limit ); - $rows = $db->loadObjectList(); - if ($db->getErrorNum()) { - echo $db->stderr(); - return false; - } - - // get list of categories for dropdown filter - $query = 'SELECT cc.id AS value, cc.title AS text, section' - . ' FROM #__categories AS cc' - . ' INNER JOIN #__sections AS s ON s.id = cc.section ' - . ' ORDER BY s.ordering, cc.ordering' - ; - $db->setQuery( $query ); - $categories[] = JHTML::_('select.option', '-1', '- '. JText::_( 'Select Category' ) .' -' ); - $categories = array_merge( $categories, $db->loadObjectList() ); - $lists['catid'] = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $catid ); - - // get list of sections for dropdown filter - $javascript = 'onchange="document.adminForm.submit();"'; - $lists['sectionid'] = JHTML::_('list.section', 'filter_sectionid', $filter_sectionid, $javascript ); - - // get list of Authors for dropdown filter - $query = 'SELECT c.created_by, u.name' - . ' FROM #__content AS c' - . ' INNER JOIN #__sections AS s ON s.id = c.sectionid' - . ' LEFT JOIN #__users AS u ON u.id = c.created_by' - . ' WHERE c.state <> -1' - . ' AND c.state <> -2' - . ' GROUP BY u.name' - . ' ORDER BY u.name' - ; - $db->setQuery( $query ); - $authors[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select Author' ) .' -', 'created_by', 'name' ); - $authors = array_merge( $authors, $db->loadObjectList() ); - $lists['authorid'] = JHTML::_('select.genericlist', $authors, 'filter_authorid', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'created_by', 'name', $filter_authorid ); - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - require_once(JPATH_COMPONENT.DS.'views'.DS.'frontpage.php'); - FrontpageView::showList( $rows, $pageNav, $option, $lists ); -} - -/** -* Changes the state of one or more content pages -* @param array An array of unique category id numbers -* @param integer 0 if unpublishing, 1 if publishing -*/ -function changeFrontPage( $cid=null, $state=0, $option ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - JArrayHelper::toInteger($cid); - - if (count( $cid ) < 1) { - $action = $state == 1 ? 'publish' : ($state == -1 ? 'archive' : 'unpublish'); - JError::raiseError(500, JText::_( 'Select an item to' .$action, true ) ); - } - - $cids = implode( ',', $cid ); - - $query = 'UPDATE #__content' - . ' SET state = '.(int) $state - . ' WHERE id IN ( '. $cids .' )' - . ' AND ( checked_out = 0 OR ( checked_out = ' .(int) $user->get('id'). ' ) )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - JError::raiseError(500, $db->getErrorMsg() ); - } - - if (count( $cid ) == 1) { - $row =& JTable::getInstance('content'); - $row->checkin( $cid[0] ); - } - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - $mainframe->redirect( 'index.php?option='.$option ); -} - -function removeFrontPage( &$cid, $option ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - if (!is_array( $cid ) || count( $cid ) < 1) { - JError::raiseError(500, JText::_( 'Select an item to delete', true ) ); - } - $fp =& JTable::getInstance('frontpage', 'Table'); - foreach ($cid as $id) { - if (!$fp->delete( $id )) { - JError::raiseError(500, $fp->getError() ); - } - $obj =& JTable::getInstance('content'); - $obj->load( $id ); - $obj->mask = 0; - if (!$obj->store()) { - JError::raiseError(500, $fp->getError() ); - } - } - $fp->reorder(); - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - $mainframe->redirect( 'index.php?option='.$option ); -} - -/** -* Moves the order of a record -* @param integer The increment to reorder by -*/ -function orderFrontPage( $uid, $inc, $option ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - - $fp =& JTable::getInstance('frontpage','Table'); - $fp->load( $uid ); - $fp->move( $inc ); - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - $mainframe->redirect( 'index.php?option='.$option ); -} - -/** -* @param integer The id of the article -* @param integer The new access level -* @param string The URL option -*/ -function accessMenu( $uid, $access ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db = & JFactory::getDBO(); - $row =& JTable::getInstance('content'); - $row->load( $uid ); - $row->access = $access; - - if ( !$row->check() ) { - return $row->getError(); - } - if ( !$row->store() ) { - return $row->getError(); - } - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - $mainframe->redirect( 'index.php?option=com_frontpage' ); -} - -function saveOrder( &$cid ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $total = count( $cid ); - $order = JRequest::getVar( 'order', array(0), 'post', 'array' ); - - for( $i=0; $i < $total; $i++ ) - { - $query = 'UPDATE #__content_frontpage' - . ' SET ordering = ' . (int) $order[$i] - . ' WHERE content_id = ' . (int) $cid[$i]; - $db->setQuery( $query ); - if (!$db->query()) { - JError::raiseError(500, $db->getErrorMsg() ); - } - } - - $cache = & JFactory::getCache('com_content'); - $cache->clean(); - - $msg = JText::_( 'New ordering saved' ); - $mainframe->redirect( 'index.php?option=com_frontpage', $msg ); -} \ No newline at end of file diff --git a/administrator/components/com_frontpage/index.html b/administrator/components/com_frontpage/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/administrator/components/com_frontpage/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_frontpage/tables/index.html b/administrator/components/com_frontpage/tables/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/administrator/components/com_frontpage/tables/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_frontpage/views/frontpage.php b/administrator/components/com_frontpage/views/frontpage.php deleted file mode 100644 index 8c0f5fb02bd85..0000000000000 --- a/administrator/components/com_frontpage/views/frontpage.php +++ /dev/null @@ -1,263 +0,0 @@ -getNullDate(); - $config =& JFactory::getConfig(); - $now =& JFactory::getDate(); - - //Ordering allowed ? - $ordering = (($lists['order'] == 'fpordering')); - - JHTML::_('behavior.tooltip'); - ?> -
    - - - - - - -
    - : - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - id ); - - $publish_up =& JFactory::getDate($row->publish_up); - $publish_down =& JFactory::getDate($row->publish_down); - $publish_up->setOffset($config->getValue('config.offset')); - $publish_down->setOffset($config->getValue('config.offset')); - if ( $now->toUnix() <= $publish_up->toUnix() && $row->state == 1 ) { - $img = 'publish_y.png'; - $alt = JText::_( 'Published' ); - } else if ( ( $now->toUnix() <= $publish_down->toUnix() || $row->publish_down == $nullDate ) && $row->state == 1 ) { - $img = 'publish_g.png'; - $alt = JText::_( 'Published' ); - } else if ( $now->toUnix() > $publish_down->toUnix() && $row->state == 1 ) { - $img = 'publish_r.png'; - $alt = JText::_( 'Expired' ); - } else if ( $row->state == 0 ) { - $img = 'publish_x.png'; - $alt = JText::_( 'Unpublished' ); - } else if ( $row->state == -1 ) { - $img = 'disabled.png'; - $alt = JText::_( 'Archived' ); - } - $times = ''; - if (isset($row->publish_up)) { - if ($row->publish_up == $nullDate) { - $times .= JText::_( 'Start: Always' ); - } else { - $times .= JText::_( 'Start' ) .": ". $publish_up->toFormat(); - } - } - if (isset($row->publish_down)) { - if ($row->publish_down == $nullDate) { - $times .= "
    ". JText::_( 'Finish: No Expiry' ); - } else { - $times .= "
    ". JText::_( 'Finish' ) .": ". $publish_down->toFormat(); - } - } - - $access = JHTML::_('grid.access', $row, $i ); - $checked = JHTML::_('grid.checkedout', $row, $i ); - - if ( $user->authorize( 'com_users', 'manage' ) ) { - if ( $row->created_by_alias ) { - $author = $row->created_by_alias; - } else { - $linkA = JRoute::_( 'index.php?option=com_users&task=edit&cid[]='. $row->created_by ); - $author='' . - ''. $row->author .''; - } - } else { - if ( $row->created_by_alias ) { - $author = $row->created_by_alias; - } else { - $author = $row->author; - } - } - - // section handling - if ($row->sectionid) { - $row->sect_link = JRoute::_( 'index.php?option=com_sections&task=edit&cid[]='. $row->sectionid ); - $title_sec = JText::_( 'Edit Section' ); - } - - // category handling - if ($row->catid) { - $row->cat_link = JRoute::_( 'index.php?option=com_categories&task=edit&cid[]='. $row->catid ); - $title_cat = JText::_( 'Edit Category' ); - } - ?> - "> - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - -
    - getListFooter(); ?> -
    - getRowOffset( $i ); ?> - - - - get ('id'), $row->checked_out ) ) { - echo $row->title; - } else { - ?> - - - title; ?> - - - - - <?php echo $alt;?> - - orderUpIcon( $i, true, 'orderup', 'Move Up', $ordering ); ?> - orderDownIcon( $i, $n, true, 'orderdown', 'Move Down', $ordering ); ?> - - class="text_area" style="text-align: center" /> - - - - id;?> - - sectionid) : ?> - - - sect_name; ?> - - - catid) : ?> - - - name; ?> - - - -
    - - - - - - - - -
    - \ No newline at end of file diff --git a/administrator/components/com_installer/index.html b/administrator/components/com_installer/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/index.html +++ b/administrator/components/com_installer/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/admin.installer.php b/administrator/components/com_installer/installer.php similarity index 92% rename from administrator/components/com_installer/admin.installer.php rename to administrator/components/com_installer/installer.php index 1a9bafb9032cc..09bf30b5faf40 100644 --- a/administrator/components/com_installer/admin.installer.php +++ b/administrator/components/com_installer/installer.php @@ -37,7 +37,7 @@ JSubMenuHelper::addEntry(JText::_( $name ), '#" onclick="javascript:document.adminForm.type.value=\''.$extension.'\';submitbutton(\'manage\');', ($extension == $ext)); } -require_once( JPATH_COMPONENT.DS.'controller.php' ); +require_once JPATH_COMPONENT.DS.'controller.php'; $controller = new InstallerController( array('default_task' => 'installform') ); //die(JRequest::getCmd('task')); diff --git a/administrator/components/com_installer/models/components.php b/administrator/components/com_installer/models/components.php index be5e56786cc55..389824e44e0e7 100644 --- a/administrator/components/com_installer/models/components.php +++ b/administrator/components/com_installer/models/components.php @@ -11,9 +11,12 @@ * source software licenses. See COPYRIGHT.php for copyright notices and * details. */ + +// no direct access +defined('_JEXEC') or die('Restricted access'); // Import library dependencies -require_once(dirname(__FILE__).DS.'extension.php'); +require_once dirname(__FILE__).DS.'extension.php'; /** * Installer Components Model diff --git a/administrator/components/com_installer/models/index.html b/administrator/components/com_installer/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/models/index.html +++ b/administrator/components/com_installer/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/models/languages.php b/administrator/components/com_installer/models/languages.php index 22c24c384df03..4d63137aeb069 100644 --- a/administrator/components/com_installer/models/languages.php +++ b/administrator/components/com_installer/models/languages.php @@ -12,8 +12,11 @@ * details. */ +// no direct access +defined('_JEXEC') or die('Restricted access'); + // Import library dependencies -require_once(dirname(__FILE__).DS.'extension.php'); +require_once dirname(__FILE__).DS.'extension.php'; jimport( 'joomla.filesystem.folder' ); /** diff --git a/administrator/components/com_installer/models/modules.php b/administrator/components/com_installer/models/modules.php index e128949ce2f68..be9dffd865180 100644 --- a/administrator/components/com_installer/models/modules.php +++ b/administrator/components/com_installer/models/modules.php @@ -12,8 +12,11 @@ * details. */ +// no direct access +defined('_JEXEC') or die('Restricted access'); + // Import library dependencies -require_once(dirname(__FILE__).DS.'extension.php'); +require_once dirname(__FILE__).DS.'extension.php'; /** * Extension Manager Modules Model diff --git a/administrator/components/com_installer/models/plugins.php b/administrator/components/com_installer/models/plugins.php index 8e131a21ae1c7..3c4dce64cb959 100644 --- a/administrator/components/com_installer/models/plugins.php +++ b/administrator/components/com_installer/models/plugins.php @@ -12,8 +12,11 @@ * details. */ +// no direct access +defined('_JEXEC') or die('Restricted access'); + // Import library dependencies -require_once(dirname(__FILE__).DS.'extension.php'); +require_once dirname(__FILE__).DS.'extension.php'; /** * Installer Plugins Model diff --git a/administrator/components/com_installer/models/templates.php b/administrator/components/com_installer/models/templates.php index 081a75f7e1f88..5a9f8afa0cf7c 100644 --- a/administrator/components/com_installer/models/templates.php +++ b/administrator/components/com_installer/models/templates.php @@ -12,8 +12,11 @@ * details. */ +// no direct access +defined('_JEXEC') or die('Restricted access'); + // Import library dependencies -require_once(dirname(__FILE__).DS.'extension.php'); +require_once dirname(__FILE__).DS.'extension.php'; jimport( 'joomla.filesystem.folder' ); /** diff --git a/administrator/components/com_installer/views/components/index.html b/administrator/components/com_installer/views/components/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/components/index.html +++ b/administrator/components/com_installer/views/components/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/components/tmpl/default.php b/administrator/components/com_installer/views/components/tmpl/default.php index 19b98207226c5..24ff3f9711996 100644 --- a/administrator/components/com_installer/views/components/tmpl/default.php +++ b/administrator/components/com_installer/views/components/tmpl/default.php @@ -1,4 +1,4 @@ -
    + showMessage) : ?> loadTemplate('message'); ?> diff --git a/administrator/components/com_installer/views/components/tmpl/default_item.php b/administrator/components/com_installer/views/components/tmpl/default_item.php index 41a82c22c612b..83ba5a9b8b5d5 100644 --- a/administrator/components/com_installer/views/components/tmpl/default_item.php +++ b/administrator/components/com_installer/views/components/tmpl/default_item.php @@ -8,7 +8,7 @@ item->option) : ?> X - <?php echo $this->item->alt; ?> + <?php echo $this->item->alt; ?> item->version != '' ? $this->item->version : ' '; ?> diff --git a/administrator/components/com_installer/views/components/tmpl/index.html b/administrator/components/com_installer/views/components/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/components/tmpl/index.html +++ b/administrator/components/com_installer/views/components/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/components/view.php b/administrator/components/com_installer/views/components/view.php index 4144def8d56ae..1869d26f76e54 100644 --- a/administrator/components/com_installer/views/components/view.php +++ b/administrator/components/com_installer/views/components/view.php @@ -27,6 +27,11 @@ class InstallerViewComponents extends InstallerViewDefault { + protected $items; + protected $pagination; + protected $item; + + function display($tpl=null) { /* @@ -66,4 +71,4 @@ function loadItem($index=0) $this->assignRef('item', $item); } -} \ No newline at end of file +} diff --git a/administrator/components/com_installer/views/default/index.html b/administrator/components/com_installer/views/default/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/default/index.html +++ b/administrator/components/com_installer/views/default/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/default/tmpl/index.html b/administrator/components/com_installer/views/default/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/default/tmpl/index.html +++ b/administrator/components/com_installer/views/default/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/default/view.php b/administrator/components/com_installer/views/default/view.php index 868c493e7c994..4eaf0351a6d25 100644 --- a/administrator/components/com_installer/views/default/view.php +++ b/administrator/components/com_installer/views/default/view.php @@ -26,6 +26,12 @@ */ class InstallerViewDefault extends JView { + protected $ftp; + protected $paths; + protected $state; + protected $showMessage; + + function __construct($config = null) { parent::__construct($config); @@ -70,4 +76,4 @@ function display($tpl=null) function loadItem($index=0) { } -} \ No newline at end of file +} diff --git a/administrator/components/com_installer/views/index.html b/administrator/components/com_installer/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/index.html +++ b/administrator/components/com_installer/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/install/index.html b/administrator/components/com_installer/views/install/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/install/index.html +++ b/administrator/components/com_installer/views/install/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/install/tmpl/default_form.php b/administrator/components/com_installer/views/install/tmpl/default_form.php index 0320177d90dcc..ea3484882e55f 100644 --- a/administrator/components/com_installer/views/install/tmpl/default_form.php +++ b/administrator/components/com_installer/views/install/tmpl/default_form.php @@ -26,7 +26,7 @@ function submitbutton4(pressbutton) { //--> - + ftp) : ?> loadTemplate('ftp'); ?> diff --git a/administrator/components/com_installer/views/install/tmpl/index.html b/administrator/components/com_installer/views/install/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/install/tmpl/index.html +++ b/administrator/components/com_installer/views/install/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/install/view.php b/administrator/components/com_installer/views/install/view.php index 1cfdea44cb8e1..c56323b54046d 100644 --- a/administrator/components/com_installer/views/install/view.php +++ b/administrator/components/com_installer/views/install/view.php @@ -27,6 +27,8 @@ class InstallerViewInstall extends InstallerViewDefault { + protected $paths; + protected $state; function display($tpl=null) { /* @@ -43,4 +45,4 @@ function display($tpl=null) parent::display($tpl); } -} \ No newline at end of file +} diff --git a/administrator/components/com_installer/views/languages/index.html b/administrator/components/com_installer/views/languages/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/languages/index.html +++ b/administrator/components/com_installer/views/languages/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/languages/tmpl/default.php b/administrator/components/com_installer/views/languages/tmpl/default.php index d1db4ba519259..9b44717710ae8 100644 --- a/administrator/components/com_installer/views/languages/tmpl/default.php +++ b/administrator/components/com_installer/views/languages/tmpl/default.php @@ -1,4 +1,4 @@ - + ftp) : ?> loadTemplate('ftp'); ?> diff --git a/administrator/components/com_installer/views/languages/tmpl/index.html b/administrator/components/com_installer/views/languages/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/languages/tmpl/index.html +++ b/administrator/components/com_installer/views/languages/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/languages/view.php b/administrator/components/com_installer/views/languages/view.php index d168ab7c8cbce..584a04c8b3149 100644 --- a/administrator/components/com_installer/views/languages/view.php +++ b/administrator/components/com_installer/views/languages/view.php @@ -28,6 +28,10 @@ class InstallerViewLanguages extends InstallerViewDefault { + protected $items; + protected $pagination; + protected $lists; + protected $item; function display($tpl=null) { /* @@ -70,4 +74,4 @@ function loadItem($index=0) $this->assignRef('item', $item); } -} \ No newline at end of file +} diff --git a/administrator/components/com_installer/views/modules/index.html b/administrator/components/com_installer/views/modules/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/modules/index.html +++ b/administrator/components/com_installer/views/modules/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/modules/tmpl/default.php b/administrator/components/com_installer/views/modules/tmpl/default.php index 7f6a7c3bd0404..ca71dd2a7d76f 100644 --- a/administrator/components/com_installer/views/modules/tmpl/default.php +++ b/administrator/components/com_installer/views/modules/tmpl/default.php @@ -1,4 +1,4 @@ - + ftp) : ?> loadTemplate('ftp'); ?> diff --git a/administrator/components/com_installer/views/modules/tmpl/index.html b/administrator/components/com_installer/views/modules/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/modules/tmpl/index.html +++ b/administrator/components/com_installer/views/modules/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/modules/view.php b/administrator/components/com_installer/views/modules/view.php index 8d95013799222..8a9aa2d02633b 100644 --- a/administrator/components/com_installer/views/modules/view.php +++ b/administrator/components/com_installer/views/modules/view.php @@ -29,6 +29,11 @@ class InstallerViewModules extends InstallerViewDefault { + protected $item; + protected $items; + protected $pagination; + protected $lists; + function display($tpl=null) { /* @@ -72,4 +77,4 @@ function loadItem($index=0) $this->assignRef('item', $item); } -} \ No newline at end of file +} diff --git a/administrator/components/com_installer/views/plugins/index.html b/administrator/components/com_installer/views/plugins/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/plugins/index.html +++ b/administrator/components/com_installer/views/plugins/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/plugins/tmpl/default.php b/administrator/components/com_installer/views/plugins/tmpl/default.php index 82543450de83c..866e89b59a60e 100644 --- a/administrator/components/com_installer/views/plugins/tmpl/default.php +++ b/administrator/components/com_installer/views/plugins/tmpl/default.php @@ -1,4 +1,4 @@ - + ftp) : ?> loadTemplate('ftp'); ?> diff --git a/administrator/components/com_installer/views/plugins/tmpl/index.html b/administrator/components/com_installer/views/plugins/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/plugins/tmpl/index.html +++ b/administrator/components/com_installer/views/plugins/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/plugins/view.php b/administrator/components/com_installer/views/plugins/view.php index 36e893d0a35b1..a4f8e1c0b9ef3 100644 --- a/administrator/components/com_installer/views/plugins/view.php +++ b/administrator/components/com_installer/views/plugins/view.php @@ -28,6 +28,10 @@ class InstallerViewPlugins extends InstallerViewDefault { + protected $item; + protected $items; + protected $pagination; + protected $fields; function display($tpl=null) { /* @@ -68,4 +72,4 @@ function loadItem($index=0) $this->assignRef('item', $item); } -} \ No newline at end of file +} diff --git a/administrator/components/com_installer/views/templates/index.html b/administrator/components/com_installer/views/templates/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/templates/index.html +++ b/administrator/components/com_installer/views/templates/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/templates/tmpl/default.php b/administrator/components/com_installer/views/templates/tmpl/default.php index 7fae6f35c1f5a..7c2510388ab9f 100644 --- a/administrator/components/com_installer/views/templates/tmpl/default.php +++ b/administrator/components/com_installer/views/templates/tmpl/default.php @@ -1,4 +1,4 @@ - + ftp) : ?> loadTemplate('ftp'); ?> @@ -22,12 +22,12 @@ - + - pagination->getListFooter(); ?> + pagination->getListFooter(); ?> diff --git a/administrator/components/com_installer/views/templates/tmpl/index.html b/administrator/components/com_installer/views/templates/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_installer/views/templates/tmpl/index.html +++ b/administrator/components/com_installer/views/templates/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_installer/views/templates/view.php b/administrator/components/com_installer/views/templates/view.php index a026679751585..6134b784d97e4 100644 --- a/administrator/components/com_installer/views/templates/view.php +++ b/administrator/components/com_installer/views/templates/view.php @@ -27,6 +27,10 @@ class InstallerViewTemplates extends InstallerViewDefault { + protected $item; + protected $items; + protected $pagination; + protected $lists; function display($tpl=null) { /* @@ -70,4 +74,4 @@ function loadItem($index=0) $this->assignRef('item', $item); } -} \ No newline at end of file +} diff --git a/administrator/components/com_languages/admin.languages.html.php b/administrator/components/com_languages/admin.languages.html.php deleted file mode 100644 index 6cc07a8644ac8..0000000000000 --- a/administrator/components/com_languages/admin.languages.html.php +++ /dev/null @@ -1,157 +0,0 @@ - - - - -
    - - - - - -

    message); ?>

    - - - - - - - - - - - - - -
    - - - -
    - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - "> - - - - - - - - - - - -
    - - -   - - - - - - - - - - - - -
    - getListFooter(); ?> -
    - getRowOffset( $i ); ?> - - - - name;?> - - published == 1) { ?> - <?php echo JText::_( 'Default' ); ?> - -   - - - version; ?> - - creationdate; ?> - - author; ?> - - authorEmail; ?> -
    - - - - - - -
    - authorize( 'com_languages', 'manage' )) { - $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); -} - -require_once( JApplicationHelper::getPath( 'admin_html' ) ); - -$task = strtolower( JRequest::getCmd( 'task' ) ); -$cid = JRequest::getVar( 'cid', array(0), '', 'array' ); -$cid = array(JFilterInput::clean(@$cid[0], 'cmd')); - -$client = JRequest::getVar('client', 0, '', 'int'); -if ($client == 1) { - JSubMenuHelper::addEntry(JText::_('Site'),'#" onclick="javascript:document.adminForm.client.value=\'0\';submitbutton(\'\');'); - JSubMenuHelper::addEntry(JText::_('Administrator'), '#" onclick="javascript:document.adminForm.client.value=\'1\';submitbutton(\'\');', true ); -} else { - JSubMenuHelper::addEntry(JText::_('Site'), '#" onclick="javascript:document.adminForm.client.value=\'0\';submitbutton(\'\');', true ); - JSubMenuHelper::addEntry(JText::_('Administrator'), '#" onclick="javascript:document.adminForm.client.value=\'1\';submitbutton(\'\');'); -} - -switch ($task) -{ - case 'publish': - publishLanguage( $cid[0]); - break; - - default: - viewLanguages(); - break; -} - -/** -* Compiles a list of installed languages -*/ -function viewLanguages() -{ - global $mainframe, $option; - - // Initialize some variables - $db =& JFactory::getDBO(); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $rows = array (); - - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); - $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); - - $rowid = 0; - - // Set FTP credentials, if given - jimport('joomla.client.helper'); - $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); - - //load folder filesystem class - jimport('joomla.filesystem.folder'); - $path = JLanguage::getLanguagePath($client->path); - $dirs = JFolder::folders( $path ); - - foreach ($dirs as $dir) - { - $files = JFolder::files( $path.DS.$dir, '^([-_A-Za-z]*)\.xml$' ); - foreach ($files as $file) - { - $data = JApplicationHelper::parseXMLLangMetaFile($path.DS.$dir.DS.$file); - - $row = new StdClass(); - $row->id = $rowid; - $row->language = substr($file,0,-4); - - if (!is_array($data)) { - continue; - } - foreach($data as $key => $value) { - $row->$key = $value; - } - - // if current than set published - $params = JComponentHelper::getParams('com_languages'); - if ( $params->get($client->name, 'en-GB') == $row->language) { - $row->published = 1; - } else { - $row->published = 0; - } - - $row->checked_out = 0; - $row->mosname = JString::strtolower( str_replace( " ", "_", $row->name ) ); - $rows[] = $row; - $rowid++; - } - } - - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $rowid, $limitstart, $limit ); - - $rows = array_slice( $rows, $pageNav->limitstart, $pageNav->limit ); - - HTML_languages::showLanguages( $rows, $pageNav, $option, $client, $ftp ); -} - -/** -* Publish, or make current, the selected language -*/ -function publishLanguage( $language ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize some variables - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - - $params = JComponentHelper::getParams('com_languages'); - $params->set($client->name, $language); - - $table =& JTable::getInstance('component'); - $table->loadByOption( 'com_languages' ); - - $table->params = $params->toString(); - - // pre-save checks - if (!$table->check()) { - JError::raiseWarning( 500, $table->getError() ); - return false; - } - - // save the changes - if (!$table->store()) { - JError::raiseWarning( 500, $table->getError() ); - return false; - } - - $mainframe->redirect('index.php?option=com_languages&client='.$client->id); -} \ No newline at end of file diff --git a/administrator/components/com_languages/controller.php b/administrator/components/com_languages/controller.php new file mode 100644 index 0000000000000..f0a8d30c95974 --- /dev/null +++ b/administrator/components/com_languages/controller.php @@ -0,0 +1,63 @@ +set($client->name, $cid[0]); + + $table =& JTable::getInstance('component'); + $table->loadByOption( 'com_languages' ); + + $table->params = $params->toString(); + + // pre-save checks + if (!$table->check()) { + JError::raiseWarning( 500, $table->getError() ); + return false; + } + + // save the changes + if (!$table->store()) { + JError::raiseWarning( 500, $table->getError() ); + return false; + } + + $this->setredirect('index.php?option=com_languages&client='.$client->id); + } +} \ No newline at end of file diff --git a/administrator/components/com_languages/index.html b/administrator/components/com_languages/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_languages/index.html +++ b/administrator/components/com_languages/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_languages/toolbar.languages.html.php b/administrator/components/com_languages/languages.php similarity index 53% rename from administrator/components/com_languages/toolbar.languages.html.php rename to administrator/components/com_languages/languages.php index 5b05582153ff6..b1c9e285f1cb4 100644 --- a/administrator/components/com_languages/toolbar.languages.html.php +++ b/administrator/components/com_languages/languages.php @@ -1,6 +1,6 @@ authorize( 'com_languages', 'manage' )) { + $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); +} + +// Require the base controller +require_once JPATH_COMPONENT.DS.'controller.php'; + +$controller = new LanguagesController(); + +// Perform the Request task +$controller->execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_languages/models/index.html b/administrator/components/com_languages/models/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_languages/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_languages/models/languages.php b/administrator/components/com_languages/models/languages.php new file mode 100644 index 0000000000000..98c6a7d8722a2 --- /dev/null +++ b/administrator/components/com_languages/models/languages.php @@ -0,0 +1,198 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $this->_client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', 0, '', 'int')); + } + + /** + * Method to get Languagess item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $this->_loadData(); + } + + return $this->_data; + } + + /** + * Method to get the total number of Languages items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $this->getData(); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the Languagess + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get the client object + * + * @access public + * @return object + */ + function getClient() + { + return $this->_client; + } + + function _loadData() + { + // Initialize some variables + $rows = array (); + $rowid = -1; + $rowstart = $this->getState('limitstart') + 0; + $rowend = $rowstart + $this->getState('limit') - 1; + + //load folder filesystem class + jimport('joomla.filesystem.folder'); + $path = JLanguage::getLanguagePath($this->_client->path); + $dirs = JFolder::folders( $path ); + + foreach ($dirs as $dir) + { + $files = JFolder::files( $path.DS.$dir, '^([-_A-Za-z]*)\.xml$' ); + foreach ($files as $file) + { + $rowid++; + // Only include the current page + if ($rowid < $rowstart) { + continue; + } + + if ($rowid > $rowend) { + continue; + } + + $data = JApplicationHelper::parseXMLLangMetaFile($path.DS.$dir.DS.$file); + + $row = new StdClass(); + $row->id = $rowid; + $row->language = substr($file,0,-4); + + if (!is_array($data)) { + continue; + } + foreach($data as $key => $value) { + $row->$key = $value; + } + + // if current than set published + $params = JComponentHelper::getParams('com_languages'); + if ( $params->get($this->_client->name, 'en-GB') == $row->language) { + $row->published = 1; + } else { + $row->published = 0; + } + + $row->checked_out = 0; + $row->mosname = JString::strtolower( str_replace( " ", "_", $row->name ) ); + $rows[] = $row; + } + } + $this->_data = $rows; + $this->_total = $rowid+1; + } +} \ No newline at end of file diff --git a/administrator/components/com_languages/views/index.html b/administrator/components/com_languages/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_languages/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_languages/views/languages/index.html b/administrator/components/com_languages/views/languages/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_languages/views/languages/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_languages/views/languages/tmpl/default.php b/administrator/components/com_languages/views/languages/tmpl/default.php new file mode 100644 index 0000000000000..e40855a2dc0d1 --- /dev/null +++ b/administrator/components/com_languages/views/languages/tmpl/default.php @@ -0,0 +1,126 @@ + + +
    + + ftp): ?> +
    + + + + + +

    message); ?>

    + + + + + + + + + + + + + +
    + + + +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + rows ); $i < $n; $i++) { + $row = &$this->rows[$i]; + ?> + "> + + + + + + + + + + + +
    + + +   + + + + + + + + + + + + +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset( $i ); ?> + + + + name;?> + + published == 1) { ?> + <?php echo JText::_( 'Default' ); ?> + +   + + + version; ?> + + creationdate; ?> + + author; ?> + + authorEmail; ?> +
    + + + + + + +
    diff --git a/administrator/components/com_languages/views/languages/tmpl/index.html b/administrator/components/com_languages/views/languages/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_languages/views/languages/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_languages/views/languages/view.html.php b/administrator/components/com_languages/views/languages/view.html.php new file mode 100644 index 0000000000000..f20acaf855176 --- /dev/null +++ b/administrator/components/com_languages/views/languages/view.html.php @@ -0,0 +1,71 @@ +get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter'); + $client = & $this->get( 'Client'); + + if ($client->id == 1) { + JSubMenuHelper::addEntry(JText::_('Site'),'#" onclick="javascript:document.adminForm.client.value=\'0\';submitbutton(\'\');'); + JSubMenuHelper::addEntry(JText::_('Administrator'), '#" onclick="javascript:document.adminForm.client.value=\'1\';submitbutton(\'\');', true ); + } else { + JSubMenuHelper::addEntry(JText::_('Site'), '#" onclick="javascript:document.adminForm.client.value=\'0\';submitbutton(\'\');', true ); + JSubMenuHelper::addEntry(JText::_('Administrator'), '#" onclick="javascript:document.adminForm.client.value=\'1\';submitbutton(\'\');'); + } + + $this->assignRef('user', JFactory::getUser()); + $this->assignRef('rows', $rows); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + $this->assignRef('ftp', $ftp); + $this->assignRef('client', $client); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_login/admin.login.php b/administrator/components/com_login/controller.php similarity index 52% rename from administrator/components/com_login/admin.login.php rename to administrator/components/com_login/controller.php index 596f8d4df46fd..3f43211cd6728 100644 --- a/administrator/components/com_login/admin.login.php +++ b/administrator/components/com_login/controller.php @@ -1,84 +1,62 @@ - 'rounded', 'id' => 'section-box')); - echo $module; - } - - function login() - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken('request') or jexit( 'Invalid Token' ); - - $credentials = array(); - - $credentials['username'] = JRequest::getVar('username', '', 'method', 'username'); - $credentials['password'] = JRequest::getVar('passwd', '', 'post', 'string', JREQUEST_ALLOWRAW); - - $result = $mainframe->login($credentials); - - if (!JError::isError($result)) { - $mainframe->redirect('index.php'); - } - - LoginController::display(); - } - - function logout() - { - global $mainframe; - - $result = $mainframe->logout(); - - if (!JError::isError($result)) { - $mainframe->redirect('index.php?option=com_login'); - } - - LoginController::display(); - } +login($credentials); + + if (!JError::isError($result)) { + $mainframe->redirect('index.php'); + } + + LoginController::display(); + } + + function logout() + { + global $mainframe; + + $result = $mainframe->logout(); + + if (!JError::isError($result)) { + $mainframe->redirect('index.php?option=com_login'); + } + + LoginController::display(); + } } \ No newline at end of file diff --git a/administrator/components/com_login/index.html b/administrator/components/com_login/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_login/index.html +++ b/administrator/components/com_login/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_languages/toolbar.languages.php b/administrator/components/com_login/login.php similarity index 65% rename from administrator/components/com_languages/toolbar.languages.php rename to administrator/components/com_login/login.php index 571e8a1802584..f16c009c751e7 100644 --- a/administrator/components/com_languages/toolbar.languages.php +++ b/administrator/components/com_login/login.php @@ -1,25 +1,25 @@ -execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_login/views/index.html b/administrator/components/com_login/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_login/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_login/views/login/index.html b/administrator/components/com_login/views/login/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_login/views/login/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_login/views/login/tmpl/default.php b/administrator/components/com_login/views/login/tmpl/default.php new file mode 100644 index 0000000000000..02927ff85b6f0 --- /dev/null +++ b/administrator/components/com_login/views/login/tmpl/default.php @@ -0,0 +1,3 @@ + + +module, array('style' => 'rounded', 'id' => 'section-box')); ?> diff --git a/administrator/components/com_login/views/login/tmpl/index.html b/administrator/components/com_login/views/login/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_login/views/login/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_login/views/login/view.html.php b/administrator/components/com_login/views/login/view.html.php new file mode 100644 index 0000000000000..64a5c7558b895 --- /dev/null +++ b/administrator/components/com_login/views/login/view.html.php @@ -0,0 +1,40 @@ +assignRef('module', $module); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_massmail/admin.massmail.html.php b/administrator/components/com_massmail/admin.massmail.html.php deleted file mode 100644 index 6fcdd97befc60..0000000000000 --- a/administrator/components/com_massmail/admin.massmail.html.php +++ /dev/null @@ -1,139 +0,0 @@ - - - -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - -
    - - -
    - -
    - - - -
    -
    -
    - -
    -
    - - - - - - - - - - - -
    - - - -
    - - - -
    -
    -
    -
    - - - - -
    - authorize( 'com_massmail', 'manage' )) { - $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); -} - -require_once( JApplicationHelper::getPath( 'admin_html' ) ); - -switch ($task) -{ - case 'send': - sendMail(); - break; - - case 'cancel': - $mainframe->redirect( 'index.php' ); - break; - - default: - messageForm( $option ); - break; -} - -function messageForm( $option ) -{ - $acl =& JFactory::getACL(); - - $gtree = array( - JHTML::_('select.option', 0, '- '. JText::_( 'All User Groups' ) .' -' ) - ); - - // get list of groups - $lists = array(); - $gtree = array_merge( $gtree, $acl->get_group_children_tree( null, 'users', false ) ); - $lists['gid'] = JHTML::_('select.genericlist', $gtree, 'mm_group', 'size="10"', 'value', 'text', 0 ); - - HTML_massmail::messageForm( $lists, $option ); -} - -function sendMail() -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - $acl =& JFactory::getACL(); - - $mode = JRequest::getVar( 'mm_mode', 0, 'post', 'int' ); - $subject = JRequest::getVar( 'mm_subject', '', 'post', 'string' ); - $gou = JRequest::getVar( 'mm_group', '0', 'post', 'int' ); - $recurse = JRequest::getVar( 'mm_recurse', 'NO_RECURSE', 'post', 'word' ); - $bcc = JRequest::getVar( 'mm_bcc', 0, 'post', 'int' ); - - // pulls message inoformation either in text or html format - if ( $mode ) { - $message_body = JRequest::getVar( 'mm_message', '', 'post', 'string', JREQUEST_ALLOWRAW ); - } else { - // automatically removes html formatting - $message_body = JRequest::getVar( 'mm_message', '', 'post', 'string' ); - } - - // Check for a message body and subject - if (!$message_body || !$subject) { - $mainframe->redirect( 'index.php?option=com_massmail', JText::_( 'Please fill in the form correctly' ) ); - } - - // get users in the group out of the acl - $to = $acl->get_group_objects( $gou, 'ARO', $recurse ); - JArrayHelper::toInteger($to['users']); - - // Get sending email address - /* - $query = 'SELECT email' - . ' FROM #__users' - . ' WHERE id = '.(int) $user->get('id') - ; - $db->setQuery( $query ); - $user->set( 'email', $db->loadResult() ); - */ - - // Get all users email and group except for senders - $query = 'SELECT email' - . ' FROM #__users' - . ' WHERE id != '.(int) $user->get('id') - . ( $gou !== 0 ? ' AND id IN (' . implode( ',', $to['users'] ) . ')' : '' ) - ; - - $db->setQuery( $query ); - $rows = $db->loadObjectList(); - - // Check to see if there are any users in this group before we continue - if ( ! count($rows) ) { - $msg = JText::_('No users could be found in this group.'); - $mainframe->redirect( 'index.php?option=com_massmail', $msg ); - } - - $mailer =& JFactory::getMailer(); - $params =& JComponentHelper::getParams( 'com_massmail' ); - - // Build e-mail message format - $mailer->setSender(array($mainframe->getCfg('mailfrom'), $mainframe->getCfg('fromname'))); - $mailer->setSubject($params->get('mailSubjectPrefix') . stripslashes( $subject)); - $mailer->setBody($message_body . $params->get('mailBodySuffix')); - $mailer->IsHTML($mode); - - // Add recipients - - if ( $bcc ) { - foreach ($rows as $row) { - $mailer->addBCC($row->email); - } - $mailer->addRecipient($mainframe->getCfg('mailfrom')); - }else { - foreach ($rows as $row) { - $mailer->addRecipient($row->email); - } - } - - // Send the Mail - $rs = $mailer->Send(); - - // Check for an error - if ( JError::isError($rs) ) { - $msg = $rs->getError(); - } else { - $msg = $rs ? JText::sprintf( 'E-mail sent to', count( $rows ) ) : JText::_('The mail could not be sent'); - } - - // Redirect with the message - $mainframe->redirect( 'index.php?option=com_massmail', $msg ); - -} diff --git a/administrator/components/com_massmail/controller.php b/administrator/components/com_massmail/controller.php new file mode 100644 index 0000000000000..6e71d2be26173 --- /dev/null +++ b/administrator/components/com_massmail/controller.php @@ -0,0 +1,130 @@ +redirect( 'index.php?option=com_massmail', JText::_( 'Please fill in the form correctly' ) ); + } + + // get users in the group out of the acl + $to = $acl->get_group_objects( $grp, 'ARO', $recurse ); + JArrayHelper::toInteger($to['users']); + + // Get all users email and group except for senders + $query = 'SELECT email' + . ' FROM #__users' + . ' WHERE id != '.(int) $user->get('id') + . ( $grp !== 0 ? ' AND id IN (' . implode( ',', $to['users'] ) . ')' : '' ) + ; + + $db->setQuery( $query ); + $rows = $db->loadObjectList(); + + // Check to see if there are any users in this group before we continue + if ( ! count($rows) ) { + $msg = JText::_('No users could be found in this group.'); + $mainframe->redirect( 'index.php?option=com_massmail', $msg ); + } + + $mailer =& JFactory::getMailer(); + $params =& JComponentHelper::getParams( 'com_massmail' ); + + // Build e-mail message format + $mailer->setSender(array($mainframe->getCfg('mailfrom'), $mainframe->getCfg('fromname'))); + $mailer->setSubject($params->get('mailSubjectPrefix') . stripslashes( $subject)); + $mailer->setBody($message_body . $params->get('mailBodySuffix')); + $mailer->IsHTML($mode); + + // Add recipients + if ( $bcc ) { + foreach ($rows as $row) { + $mailer->addBCC($row->email); + } + $mailer->addRecipient($mainframe->getCfg('mailfrom')); + }else { + foreach ($rows as $row) { + $mailer->addRecipient($row->email); + } + } + + // Send the Mail + $rs = $mailer->Send(); + + // Check for an error + if ( JError::isError($rs) ) { + $msg = $rs->getError(); + } else { + $msg = $rs ? JText::sprintf( 'E-mail sent to', count( $rows ) ) : JText::_('The mail could not be sent'); + } + + // Redirect with the message + $mainframe->redirect( 'index.php?option=com_massmail', $msg ); + + } + + function cancel() + { + global $mainframe; + + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $mainframe->redirect( 'index.php' ); + } +} \ No newline at end of file diff --git a/administrator/components/com_massmail/index.html b/administrator/components/com_massmail/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_massmail/index.html +++ b/administrator/components/com_massmail/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_massmail/massmail.php b/administrator/components/com_massmail/massmail.php new file mode 100644 index 0000000000000..1c8579c5e5834 --- /dev/null +++ b/administrator/components/com_massmail/massmail.php @@ -0,0 +1,33 @@ +authorize( 'com_massmail', 'manage' )) { + $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); +} + +// Require the base controller +require_once JPATH_COMPONENT.DS.'controller.php'; + +$controller = new MassmailController( ); + +// Perform the Request task +$controller->execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_massmail/massmail.xml b/administrator/components/com_massmail/massmail.xml index dd3684b0a17fb..565d67254630f 100644 --- a/administrator/components/com_massmail/massmail.xml +++ b/administrator/components/com_massmail/massmail.xml @@ -3,7 +3,7 @@ Mass Mail Joomla! Project April 2006 - Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. + (C) 2005 - 2007 Open Source Matters. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL admin@joomla.org www.joomla.org diff --git a/administrator/components/com_massmail/toolbar.massmail.html.php b/administrator/components/com_massmail/toolbar.massmail.html.php deleted file mode 100644 index b531812b9f70a..0000000000000 --- a/administrator/components/com_massmail/toolbar.massmail.html.php +++ /dev/null @@ -1,35 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_massmail/views/massmail/index.html b/administrator/components/com_massmail/views/massmail/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_massmail/views/massmail/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_massmail/views/massmail/tmpl/default.php b/administrator/components/com_massmail/views/massmail/tmpl/default.php new file mode 100644 index 0000000000000..05232c3b15a97 --- /dev/null +++ b/administrator/components/com_massmail/views/massmail/tmpl/default.php @@ -0,0 +1,113 @@ + + + + + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + +
    + gtree, 'mm_group', 'size="10"', 'value', 'text', 0 ); ?> +
    + + + +
    +
    +
    + +
    +
    + + + + + + + + + + + +
    + + + +
    + + + +
    +
    +
    +
    + + + + +
    diff --git a/administrator/components/com_massmail/views/massmail/tmpl/index.html b/administrator/components/com_massmail/views/massmail/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_massmail/views/massmail/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_massmail/views/massmail/view.html.php b/administrator/components/com_massmail/views/massmail/view.html.php new file mode 100644 index 0000000000000..170991608f1aa --- /dev/null +++ b/administrator/components/com_massmail/views/massmail/view.html.php @@ -0,0 +1,52 @@ +get_group_children_tree( null, 'users', false ) ); + + $this->assignRef('gtree', $gtree); + + parent::display( $tpl ); + } + +} \ No newline at end of file diff --git a/administrator/components/com_media/assets/index.html b/administrator/components/com_media/assets/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/assets/index.html +++ b/administrator/components/com_media/assets/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/assets/mediamanager.css b/administrator/components/com_media/assets/mediamanager.css index ef565b89c1d4b..64ba2d5a7fdd0 100644 --- a/administrator/components/com_media/assets/mediamanager.css +++ b/administrator/components/com_media/assets/mediamanager.css @@ -10,7 +10,6 @@ */ /** * MediaManager javascript behvaior styling * - * @author Johan Janssens * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/components/com_media/assets/popup-imagelist.css b/administrator/components/com_media/assets/popup-imagelist.css index a0ed95ffa97a0..a01d7171bedec 100644 --- a/administrator/components/com_media/assets/popup-imagelist.css +++ b/administrator/components/com_media/assets/popup-imagelist.css @@ -12,7 +12,6 @@ /** * ImageManager imagelist styling * - * @author Johan Janssens * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/components/com_media/assets/popup-imagemanager.css b/administrator/components/com_media/assets/popup-imagemanager.css index 2f7be2809f360..8b9644a40b3d8 100644 --- a/administrator/components/com_media/assets/popup-imagemanager.css +++ b/administrator/components/com_media/assets/popup-imagemanager.css @@ -12,7 +12,6 @@ /** * ImageManager javascript behavior styling * - * @author Johan Janssens * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/components/com_media/controller.php b/administrator/components/com_media/controller.php index dd39aa233a893..8e6671800af31 100644 --- a/administrator/components/com_media/controller.php +++ b/administrator/components/com_media/controller.php @@ -31,7 +31,7 @@ class MediaController extends JController */ function display() { - global $mainframe; + $appl = JFactory::getApplication(); $vName = JRequest::getCmd('view', 'media'); switch ($vName) @@ -50,7 +50,7 @@ function display() case 'mediaList': $mName = 'list'; - $vLayout = $mainframe->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word'); + $vLayout = $appl->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word'); break; @@ -62,11 +62,11 @@ function display() break; } - $document = &JFactory::getDocument(); + $document = JFactory::getDocument(); $vType = $document->getType(); // Get/Create the view - $view = &$this->getView( $vName, $vType); + $view = $this->getView( $vName, $vType); // Get/Create the model if ($model = &$this->getModel($mName)) { diff --git a/administrator/components/com_media/controllers/folder.php b/administrator/components/com_media/controllers/folder.php index 116642675b001..424588a5d3c89 100644 --- a/administrator/components/com_media/controllers/folder.php +++ b/administrator/components/com_media/controllers/folder.php @@ -119,7 +119,8 @@ function create() { jimport('joomla.filesystem.*'); JFolder::create($path); - JFile::write($path.DS."index.html", "\n\n\n"); + $file = "\n\n\n"; + JFile::write($path.DS.'index.html', $file); } JRequest::setVar('folder', ($parent) ? $parent.'/'.$folder : $folder); } diff --git a/administrator/components/com_media/controllers/index.html b/administrator/components/com_media/controllers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/controllers/index.html +++ b/administrator/components/com_media/controllers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/helpers/index.html b/administrator/components/com_media/helpers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/helpers/index.html +++ b/administrator/components/com_media/helpers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/images/index.html b/administrator/components/com_media/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/images/index.html +++ b/administrator/components/com_media/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/images/mime-icon-16/index.html b/administrator/components/com_media/images/mime-icon-16/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/images/mime-icon-16/index.html +++ b/administrator/components/com_media/images/mime-icon-16/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/images/mime-icon-32/index.html b/administrator/components/com_media/images/mime-icon-32/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/images/mime-icon-32/index.html +++ b/administrator/components/com_media/images/mime-icon-32/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/index.html b/administrator/components/com_media/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/index.html +++ b/administrator/components/com_media/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/media.php b/administrator/components/com_media/media.php index abff274104b94..77e9cf46f75d6 100644 --- a/administrator/components/com_media/media.php +++ b/administrator/components/com_media/media.php @@ -24,18 +24,18 @@ $params =& JComponentHelper::getParams('com_media'); // Load the admin HTML view -require_once( JPATH_COMPONENT.DS.'helpers'.DS.'media.php' ); +require_once JPATH_COMPONENT.DS.'helpers'.DS.'media.php'; // Set the path definitions $view = JRequest::getCmd('view',null); $popup_upload = JRequest::getCmd('pop_up',null); $path = "file_path"; if(substr(strtolower($view),0,6) == "images" || $popup_upload == 1) $path = "image_path"; -define('COM_MEDIA_BASE', JPATH_ROOT.DS.$params->get($path, 'images/stories')); -define('COM_MEDIA_BASEURL', JURI::root().$params->get($path, 'images/stories')); +define('COM_MEDIA_BASE', JPATH_ROOT.DS.$params->get($path, 'images/stories')); +define('COM_MEDIA_BASEURL', JURI::root().$params->get($path, 'images/stories')); // Require the base controller -require_once (JPATH_COMPONENT.DS.'controller.php'); +require_once JPATH_COMPONENT.DS.'controller.php'; $cmd = JRequest::getCmd('task', null); @@ -50,7 +50,7 @@ // If the controller file path exists, include it ... else lets die with a 500 error if (file_exists($controllerPath)) { - require_once($controllerPath); + require_once $controllerPath; } else { JError::raiseError(500, 'Invalid Controller'); } diff --git a/administrator/components/com_media/models/index.html b/administrator/components/com_media/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/models/index.html +++ b/administrator/components/com_media/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/models/list.php b/administrator/components/com_media/models/list.php index fe5870c8478ea..b45bbaaac1919 100644 --- a/administrator/components/com_media/models/list.php +++ b/administrator/components/com_media/models/list.php @@ -107,7 +107,7 @@ function getList() foreach ($fileList as $file) { if (is_file($basePath.DS.$file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html') { - $tmp = new JObject(); + $tmp = new JStdClass(); $tmp->name = $file; $tmp->path = str_replace(DS, '/', JPath::clean($basePath.DS.$file)); $tmp->path_relative = str_replace($mediaBase, '', $tmp->path); @@ -175,7 +175,7 @@ function getList() // Iterate over the folders if they exist if ($folderList !== false) { foreach ($folderList as $folder) { - $tmp = new JObject(); + $tmp = new JStdClass(); $tmp->name = basename($folder); $tmp->path = str_replace(DS, '/', JPath::clean($basePath.DS.$folder)); $tmp->path_relative = str_replace($mediaBase, '', $tmp->path); @@ -191,4 +191,4 @@ function getList() return $list; } -} \ No newline at end of file +} diff --git a/administrator/components/com_media/views/images/index.html b/administrator/components/com_media/views/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/views/images/index.html +++ b/administrator/components/com_media/views/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/views/images/tmpl/default.php b/administrator/components/com_media/views/images/tmpl/default.php index 4331518dd4bf3..f259ace37155e 100644 --- a/administrator/components/com_media/views/images/tmpl/default.php +++ b/administrator/components/com_media/views/images/tmpl/default.php @@ -3,7 +3,7 @@ var image_base_path = 'get('image_path', 'images/stories');?>/'; -
    + @@ -18,7 +18,7 @@
    - +
    diff --git a/administrator/components/com_media/views/images/tmpl/index.html b/administrator/components/com_media/views/images/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/views/images/tmpl/index.html +++ b/administrator/components/com_media/views/images/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/views/images/view.html.php b/administrator/components/com_media/views/images/view.html.php index ed61b658eaab6..2fb641d0e455c 100644 --- a/administrator/components/com_media/views/images/view.html.php +++ b/administrator/components/com_media/views/images/view.html.php @@ -37,7 +37,7 @@ function display($tpl = null) $append = ''; if($app->getClientId() == 1) $append = 'administrator/'; - JHTML::_('script' , 'popup-imagemanager.js', $append .'components/com_media/assets/'); + JHTML::_('script', 'popup-imagemanager.js', $append .'components/com_media/assets/'); JHTML::_('stylesheet', 'popup-imagemanager.css', $append .'components/com_media/assets/'); if ($config->get('enable_flash', 1)) { JHTML::_('behavior.uploader', 'file-upload', array('onAllComplete' => 'function(){ ImageManager.refreshFrame(); }')); diff --git a/administrator/components/com_media/views/imageslist/index.html b/administrator/components/com_media/views/imageslist/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/views/imageslist/index.html +++ b/administrator/components/com_media/views/imageslist/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/views/imageslist/tmpl/default_folder.php b/administrator/components/com_media/views/imageslist/tmpl/default_folder.php index 21bf71dd947a9..ecb5587ca02fa 100644 --- a/administrator/components/com_media/views/imageslist/tmpl/default_folder.php +++ b/administrator/components/com_media/views/imageslist/tmpl/default_folder.php @@ -1,6 +1,6 @@ diff --git a/administrator/components/com_media/views/imageslist/tmpl/index.html b/administrator/components/com_media/views/imageslist/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/views/imageslist/tmpl/index.html +++ b/administrator/components/com_media/views/imageslist/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/views/imageslist/view.html.php b/administrator/components/com_media/views/imageslist/view.html.php index 6c4632bcf4bfa..68fed91275c88 100644 --- a/administrator/components/com_media/views/imageslist/view.html.php +++ b/administrator/components/com_media/views/imageslist/view.html.php @@ -54,7 +54,7 @@ function setFolder($index = 0) if (isset($this->folders[$index])) { $this->_tmp_folder = &$this->folders[$index]; } else { - $this->_tmp_folder = new JObject; + $this->_tmp_folder = new JStdClass; } } @@ -63,7 +63,7 @@ function setImage($index = 0) if (isset($this->images[$index])) { $this->_tmp_img = &$this->images[$index]; } else { - $this->_tmp_img = new JObject; + $this->_tmp_img = new JStdClass(); } } } diff --git a/administrator/components/com_media/views/media/index.html b/administrator/components/com_media/views/media/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/views/media/index.html +++ b/administrator/components/com_media/views/media/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/views/media/tmpl/default.php b/administrator/components/com_media/views/media/tmpl/default.php index 0e5f35e7a5e10..77433e603e31b 100644 --- a/administrator/components/com_media/views/media/tmpl/default.php +++ b/administrator/components/com_media/views/media/tmpl/default.php @@ -1,80 +1,80 @@
    - - - + + - + + +
    + [  config->get('upload_maxsize') / 1000000); ?>M ] +
    + + + +
    +
      +
    • +
    +
    + + + +
    -
    - -
    - loadTemplate('folders'); ?> -
    -
    - require_ftp): ?> - -
    - - - - - - - - - - - - - -
    - - - -
    - - - -
    -
    - - +
    +
    + +
    + loadTemplate('folders'); ?> +
    +
    + require_ftp): ?> +
    +
    + + + + + + + + + + + + + +
    + + + +
    + + + +
    +
    +
    + -
    -
    - -
    - / - - - -
    -
    - -
    -
    + +
    + +
    + / + + + +
    +
    + +
    +
    -
    - - - -
    +
    + + + +
    - -
    -
    - [  config->get('upload_maxsize') / 1000000); ?>M ] -
    - - - -
    -
      -
    • -
    -
    - -
    -
    diff --git a/administrator/components/com_media/views/media/tmpl/default_folders.php b/administrator/components/com_media/views/media/tmpl/default_folders.php index 90646536ca579..ba243d1d12c2b 100644 --- a/administrator/components/com_media/views/media/tmpl/default_folders.php +++ b/administrator/components/com_media/views/media/tmpl/default_folders.php @@ -1,6 +1,6 @@
      folders_id; ?>> folders['children'] as $folder) : ?> -
    • name; ?>getFolderLevel($folder); ?>
    • +
    • name; ?>getFolderLevel($folder); ?>
    diff --git a/administrator/components/com_media/views/media/tmpl/index.html b/administrator/components/com_media/views/media/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/views/media/tmpl/index.html +++ b/administrator/components/com_media/views/media/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/views/medialist/index.html b/administrator/components/com_media/views/medialist/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/views/medialist/index.html +++ b/administrator/components/com_media/views/medialist/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/views/medialist/tmpl/details.php b/administrator/components/com_media/views/medialist/tmpl/details.php index 5f1316465fe98..4778c20c1397e 100644 --- a/administrator/components/com_media/views/medialist/tmpl/details.php +++ b/administrator/components/com_media/views/medialist/tmpl/details.php @@ -1,5 +1,5 @@ -
    +
    diff --git a/administrator/components/com_media/views/medialist/tmpl/details_folder.php b/administrator/components/com_media/views/medialist/tmpl/details_folder.php index d4335f42e6541..3444d74425504 100644 --- a/administrator/components/com_media/views/medialist/tmpl/details_folder.php +++ b/administrator/components/com_media/views/medialist/tmpl/details_folder.php @@ -1,11 +1,11 @@ diff --git a/administrator/components/com_media/views/medialist/tmpl/details_img.php b/administrator/components/com_media/views/medialist/tmpl/details_img.php index 31cc4e1aa2c52..fe26e366f7ae6 100644 --- a/administrator/components/com_media/views/medialist/tmpl/details_img.php +++ b/administrator/components/com_media/views/medialist/tmpl/details_img.php @@ -4,7 +4,7 @@ <?php echo $this->_tmp_img->name; ?> - <?php echo MediaHelper::parseSize($this->_tmp_img->size); ?> diff --git a/administrator/components/com_media/views/medialist/tmpl/details_up.php b/administrator/components/com_media/views/medialist/tmpl/details_up.php index 2df669820c3ea..93bff9b8ef85f 100644 --- a/administrator/components/com_media/views/medialist/tmpl/details_up.php +++ b/administrator/components/com_media/views/medialist/tmpl/details_up.php @@ -1,11 +1,11 @@ diff --git a/administrator/components/com_media/views/medialist/tmpl/index.html b/administrator/components/com_media/views/medialist/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_media/views/medialist/tmpl/index.html +++ b/administrator/components/com_media/views/medialist/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_media/views/medialist/tmpl/thumbs.php b/administrator/components/com_media/views/medialist/tmpl/thumbs.php index 195d775d192e8..31256a4f66eb2 100644 --- a/administrator/components/com_media/views/medialist/tmpl/thumbs.php +++ b/administrator/components/com_media/views/medialist/tmpl/thumbs.php @@ -1,5 +1,5 @@ - +
    loadTemplate('up'); ?> diff --git a/administrator/components/com_media/views/medialist/tmpl/thumbs_doc.php b/administrator/components/com_media/views/medialist/tmpl/thumbs_doc.php index 7286125f7b009..67d6192ced136 100644 --- a/administrator/components/com_media/views/medialist/tmpl/thumbs_doc.php +++ b/administrator/components/com_media/views/medialist/tmpl/thumbs_doc.php @@ -7,7 +7,7 @@
    - <?php echo JText::_( 'Delete' ); ?> + <?php echo JText::_( 'Delete' ); ?>
    diff --git a/administrator/components/com_media/views/medialist/tmpl/thumbs_folder.php b/administrator/components/com_media/views/medialist/tmpl/thumbs_folder.php index 5f95b40b571ad..3f3ac0aa6d439 100644 --- a/administrator/components/com_media/views/medialist/tmpl/thumbs_folder.php +++ b/administrator/components/com_media/views/medialist/tmpl/thumbs_folder.php @@ -2,15 +2,15 @@ diff --git a/administrator/components/com_media/views/medialist/tmpl/thumbs_img.php b/administrator/components/com_media/views/medialist/tmpl/thumbs_img.php index 459f5b2aec1cb..f7feaee07de70 100644 --- a/administrator/components/com_media/views/medialist/tmpl/thumbs_img.php +++ b/administrator/components/com_media/views/medialist/tmpl/thumbs_img.php @@ -9,7 +9,7 @@
    - <?php echo JText::_( 'Delete' ); ?> + <?php echo JText::_( 'Delete' ); ?>
    diff --git a/administrator/components/com_media/views/medialist/tmpl/thumbs_up.php b/administrator/components/com_media/views/medialist/tmpl/thumbs_up.php index ea1a0838c5faa..eaff69212c636 100644 --- a/administrator/components/com_media/views/medialist/tmpl/thumbs_up.php +++ b/administrator/components/com_media/views/medialist/tmpl/thumbs_up.php @@ -2,7 +2,7 @@
    @@ -10,6 +10,6 @@  
    - .. + ..
    diff --git a/administrator/components/com_media/views/medialist/view.html.php b/administrator/components/com_media/views/medialist/view.html.php index 8e409527b339b..907b5ebc7b219 100644 --- a/administrator/components/com_media/views/medialist/view.html.php +++ b/administrator/components/com_media/views/medialist/view.html.php @@ -66,7 +66,7 @@ function setFolder($index = 0) if (isset($this->folders[$index])) { $this->_tmp_folder = &$this->folders[$index]; } else { - $this->_tmp_folder = new JObject; + $this->_tmp_folder = new JStdClass(); } } @@ -75,7 +75,7 @@ function setImage($index = 0) if (isset($this->images[$index])) { $this->_tmp_img = &$this->images[$index]; } else { - $this->_tmp_img = new JObject; + $this->_tmp_img = new JStdClass; } } @@ -84,7 +84,7 @@ function setDoc($index = 0) if (isset($this->documents[$index])) { $this->_tmp_doc = &$this->documents[$index]; } else { - $this->_tmp_doc = new JObject; + $this->_tmp_doc = new JStdClass; } } } diff --git a/administrator/components/com_menus/admin.menus.php b/administrator/components/com_menus/admin.menus.php index 76d190fe04309..7685de452b1e8 100644 --- a/administrator/components/com_menus/admin.menus.php +++ b/administrator/components/com_menus/admin.menus.php @@ -15,10 +15,10 @@ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); -require_once( JPATH_COMPONENT.DS.'controller.php' ); -require_once( JPATH_COMPONENT.DS.'helpers'.DS.'helper.php' ); +require_once JPATH_COMPONENT.DS.'controller.php'; +require_once JPATH_COMPONENT.DS.'helpers'.DS.'helper.php'; -$controller = new MenusController( array('default_task' => 'viewMenus') ); +$controller = new MenusController(array('default_task' => 'viewMenus')); $controller->registerTask('apply', 'save'); -$controller->execute( JRequest::getCmd( 'task' ) ); +$controller->execute(JRequest::getCmd('task' )); $controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_menus/assets/images/index.html b/administrator/components/com_menus/assets/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/assets/images/index.html +++ b/administrator/components/com_menus/assets/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/assets/index.html b/administrator/components/com_menus/assets/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/assets/index.html +++ b/administrator/components/com_menus/assets/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/assets/rtl_images/index.html b/administrator/components/com_menus/assets/rtl_images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/assets/rtl_images/index.html +++ b/administrator/components/com_menus/assets/rtl_images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/classes/index.html b/administrator/components/com_menus/classes/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/classes/index.html +++ b/administrator/components/com_menus/classes/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/helpers/index.html b/administrator/components/com_menus/helpers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/helpers/index.html +++ b/administrator/components/com_menus/helpers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/index.html b/administrator/components/com_menus/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/index.html +++ b/administrator/components/com_menus/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/models/index.html b/administrator/components/com_menus/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/models/index.html +++ b/administrator/components/com_menus/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/models/item.php b/administrator/components/com_menus/models/item.php index 48915e240d314..684082bf421c0 100644 --- a/administrator/components/com_menus/models/item.php +++ b/administrator/components/com_menus/models/item.php @@ -29,6 +29,8 @@ class MenusModelItem extends JModel /** @var object JTable object */ var $_url = null; + protected $_xml; + /** * Overridden constructor * @access protected @@ -97,12 +99,12 @@ function &getItem() $url = str_replace('index.php?', '', $table->link); $url = str_replace('&', '&', $url); $table->linkparts = null; - if(strpos($url, '&') !== false) - { - $url = str_replace('&','&',$url); + if(strpos($url, '&') !== false) { + $url = str_replace('&','&',$url); } - parse_str($url, $table->linkparts); + parse_str($url, $parts); + $table->linkparts = $parts; $db = &$this->getDBO(); if ($component = @$table->linkparts['option']) { @@ -129,7 +131,7 @@ function &getExpansion() if ($return['option']) { - require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_menus'.DS.'classes'.DS.'ilink.php'); + require_once JPATH_ADMINISTRATOR.DS.'components'.DS.'com_menus'.DS.'classes'.DS.'ilink.php'; $handler = new iLink($return['option'], $item->id, $menutype); $return['html'] = $handler->getTree(); return $return; @@ -147,7 +149,7 @@ function &getUrlParams() if ($state =& $this->_getStateXML()) { - if (is_a($state, 'JSimpleXMLElement')) + if ($state INSTANCEOF JSimpleXMLElement) { $sp =& $state->getElementByPath('url'); $params->setXML($sp); @@ -167,7 +169,7 @@ function &getStateParams() if ($state =& $this->_getStateXML()) { - if (is_a($state, 'JSimpleXMLElement')) + if ($state INSTANCEOF JSimpleXMLElement) { $sp =& $state->getElementByPath('params'); $params->setXML($sp); @@ -184,7 +186,7 @@ function &getAdvancedParams() if ($state =& $this->_getStateXML()) { - if (is_a($state, 'JSimpleXMLElement')) + if ($state INSTANCEOF JSimpleXMLElement) { $ap =& $state->getElementByPath('advanced'); $params->setXML($ap); @@ -282,7 +284,7 @@ function getStateName() { $state =& $this->_getStateXML(); - if ( ! is_a($state, 'JSimpleXMLElement')) + if (!($state INSTANCEOF JSimpleXMLElement)) { return null; } @@ -308,7 +310,7 @@ function getStateDescription() $state =& $this->_getStateXML(); - if ( ! is_a($state, 'JSimpleXMLElement')) + if (!($state INSTANCEOF JSimpleXMLElement)) { return null; } @@ -618,14 +620,14 @@ function &_getStateXML() * HANDLE NO OPTION CASE */ $menus =& $document->getElementByPath('menu'); - if (is_a($menus, 'JSimpleXMLElement') && $menus->attributes('options') == 'none') { + if ($menus INSTANCEOF JSimpleXMLElement && $menus->attributes('options') == 'none') { $xml =& $menus->getElementByPath('state'); } else { $xml =& $document->getElementByPath('state'); } // Handle error case... path doesn't exist - if (!is_a($xml, 'JSimpleXMLElement')) { + if (!($xml INSTANCEOF JSimpleXMLElement)) { return $document; } diff --git a/administrator/components/com_menus/models/list.php b/administrator/components/com_menus/models/list.php index 6415a4e961c24..499e41975d59f 100644 --- a/administrator/components/com_menus/models/list.php +++ b/administrator/components/com_menus/models/list.php @@ -95,7 +95,7 @@ function &getItems() $query = 'SELECT m.*, u.name AS editor, g.name AS groupname, c.publish_up, c.publish_down, com.name AS com_name' . ' FROM #__menu AS m' . ' LEFT JOIN #__users AS u ON u.id = m.checked_out' . - ' LEFT JOIN #__groups AS g ON g.id = m.access' . + ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = m.access' . ' LEFT JOIN #__content AS c ON c.id = m.componentid AND m.type = "content_typed"' . ' LEFT JOIN #__components AS com ON com.id = m.componentid AND m.type = "component"' . ' WHERE m.menutype = '.$db->Quote($menutype) . @@ -168,7 +168,7 @@ function &getItems() if(isset($query['query'])) { if(strpos($query['query'], '&') !== false) { - $query['query'] = str_replace('&','&',$query['query']); + $query['query'] = str_replace('&','&',$query['query']); } parse_str($query['query'], $view); } @@ -346,35 +346,35 @@ function toTrash($items) $db =& $this->getDBO(); $nd = $db->getNullDate(); $state = -2; - $row =& $this->getTable(); - $default = 0; + $row =& $this->getTable(); + $default = 0; // Add all children to the list foreach ($items as $id) { - //Check if it's the default item - $row->load( $id ); - if ($row->home != 1) { - $this->_addChildren($id, $items); - } else { - unset($items[$default]); - JError::raiseWarning( 'SOME_ERROR_CODE', JText::_('You cannot trash the default menu item')); - } - $default++; + //Check if it's the default item + $row->load( $id ); + if ($row->home != 1) { + $this->_addChildren($id, $items); + } else { + unset($items[$default]); + JError::raiseWarning( 'SOME_ERROR_CODE', JText::_('You cannot trash the default menu item')); + } + $default++; + } + if (count($items) > 0) { + // Sent menu items to the trash + JArrayHelper::toInteger($items, array(0)); + $where = ' WHERE (id = ' . implode( ' OR id = ', $items ) . ') AND home = 0'; + $query = 'UPDATE #__menu' . + ' SET published = '.(int) $state.', parent = 0, ordering = 0, checked_out = 0, checked_out_time = '.$db->Quote($nd) . + $where; + $db->setQuery( $query ); + if (!$db->query()) { + $this->setError( $db->getErrorMsg() ); + return false; + } } - if (count($items) > 0) { - // Sent menu items to the trash - JArrayHelper::toInteger($items, array(0)); - $where = ' WHERE (id = ' . implode( ' OR id = ', $items ) . ') AND home = 0'; - $query = 'UPDATE #__menu' . - ' SET published = '.(int) $state.', parent = 0, ordering = 0, checked_out = 0, checked_out_time = '.$db->Quote($nd) . - $where; - $db->setQuery( $query ); - if (!$db->query()) { - $this->setError( $db->getErrorMsg() ); - return false; - } - } // Clear the content cache // TODO: Is this necessary? diff --git a/administrator/components/com_menus/models/metadata/index.html b/administrator/components/com_menus/models/metadata/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/models/metadata/index.html +++ b/administrator/components/com_menus/models/metadata/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/views/index.html b/administrator/components/com_menus/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/views/index.html +++ b/administrator/components/com_menus/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/views/item/index.html b/administrator/components/com_menus/views/item/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/views/item/index.html +++ b/administrator/components/com_menus/views/item/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/views/item/tmpl/form.php b/administrator/components/com_menus/views/item/tmpl/form.php index ee20f5d0bcdd4..da6c10c097bd2 100644 --- a/administrator/components/com_menus/views/item/tmpl/form.php +++ b/administrator/components/com_menus/views/item/tmpl/form.php @@ -22,7 +22,7 @@ function submitbutton(pressbutton) { } //--> - +
    - + <?php echo $this->_tmp_folder->name; ?> - _tmp_folder->name; ?> + _tmp_folder->name; ?>   @@ -14,7 +14,7 @@ - <?php echo JText::_( 'Delete' ); ?> + <?php echo JText::_( 'Delete' ); ?>
    - escape( $this->_tmp_img->name); ?> + escape( $this->_tmp_img->name); ?> _tmp_img->width; ?> x _tmp_img->height; ?> @@ -13,7 +13,7 @@ _tmp_img->size); ?> - <?php echo JText::_( 'Delete' ); ?> + <?php echo JText::_( 'Delete' ); ?>
    - + .. - .. + ..    
    params->get( 'show_position' ) ) : ?> diff --git a/components/com_contact/views/category/tmpl/index.html b/components/com_contact/views/category/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_contact/views/category/tmpl/index.html +++ b/components/com_contact/views/category/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_contact/views/category/view.html.php b/components/com_contact/views/category/view.html.php index 3e6060853117f..379f4e1cee3af 100644 --- a/components/com_contact/views/category/view.html.php +++ b/components/com_contact/views/category/view.html.php @@ -27,12 +27,12 @@ function display($tpl = null) { global $mainframe, $option; - $user = &JFactory::getUser(); - $uri =& JFactory::getURI(); - $model = &$this->getModel(); - $document =& JFactory::getDocument(); + $user = &JFactory::getUser(); + $uri = &JFactory::getURI(); + $model = &$this->getModel(); + $document = &JFactory::getDocument(); - $pparams = &$mainframe->getParams('com_contact'); + $pparams = &$mainframe->getParams('com_contact'); // Selected Request vars $categoryId = JRequest::getVar('catid', 0, '', 'int'); @@ -102,14 +102,20 @@ function display($tpl = null) $category =& JTable::getInstance( 'category' ); } - // Set the page title and pathway - if ($category->title) - { - // Add the category breadcrumbs item - $document->setTitle(JText::_('Contact').' - '.$category->title); + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $pparams->set('page_title', $category->title); + } } else { - $document->setTitle(JText::_('Contact')); + $pparams->set('page_title', $category->title); } + $document->setTitle( $pparams->get( 'page_title' ) ); // Prepare category description $category->description = JHTML::_('content.prepare', $category->description); diff --git a/components/com_contact/views/contact/index.html b/components/com_contact/views/contact/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_contact/views/contact/index.html +++ b/components/com_contact/views/contact/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_contact/views/contact/tmpl/default.php b/components/com_contact/views/contact/tmpl/default.php index 91790081e0a57..7e24f1bfdc0a2 100644 --- a/components/com_contact/views/contact/tmpl/default.php +++ b/components/com_contact/views/contact/tmpl/default.php @@ -6,10 +6,10 @@ $cparams = JComponentHelper::getParams ('com_media'); ?> -params->get( 'show_page_title' ) && !$this->contact->params->get( 'popup' ) ) : ?> -
    - params->get( 'page_title' ); ?> -
    +params->get( 'show_page_title', 1 ) && !$this->contact->params->get( 'popup' ) && $this->params->get('page_title') != $this->contact->name ) : ?> +
    + params->get( 'page_title' ); ?> +
    @@ -137,8 +137,8 @@ function submitbutton(pressbutton) { echo $this->pane->startPane("menu-pane"); echo $this->pane->startPanel(JText :: _('Parameters - Basic'), "param-page"); echo $this->urlparams->render('urlparams'); - if(count($this->params->getParams('params'))) : - echo $this->params->render('params'); + if($this->params->getNumParams()) : + echo $this->params->render(); endif; if(!count($this->params->getNumParams('params')) && !count($this->urlparams->getNumParams('urlparams'))) : @@ -146,21 +146,27 @@ function submitbutton(pressbutton) { endif; echo $this->pane->endPanel(); - if($params = $this->advanced->render('params')) : - echo $this->pane->startPanel(JText :: _('Parameters - Advanced'), "advanced-page"); - echo $params; - echo $this->pane->endPanel(); - endif; - - if ($this->comp && ($params = $this->comp->render('params'))) : + $groups = $this->params->getGroups(); + if(count($groups)) { + foreach($groups as $groupname => $group) { + if($groupname != 'state' && $groupname != '_default') { + if($this->params->getNumParams($groupname)) { + echo $this->pane->startPanel(JText :: _('Parameters - '.ucfirst($groupname)), $groupname.'-page'); + echo $this->params->render('params', $groupname); + echo $this->pane->endPanel(); + } + } + } + } + if ($this->comp) : echo $this->pane->startPanel(JText :: _('Parameters - Component'), "component-page"); - echo $params; + echo $this->comp->render('params'); echo $this->pane->endPanel(); endif; - if ($this->sysparams && ($params = $this->sysparams->render('params'))) : + if ($this->params->getNumParams('state')) : echo $this->pane->startPanel(JText :: _('Parameters - System'), "system-page"); - echo $params; + echo $this->params->render('params', 'state'); echo $this->pane->endPanel(); endif; echo $this->pane->endPane(); diff --git a/administrator/components/com_menus/views/item/tmpl/index.html b/administrator/components/com_menus/views/item/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/views/item/tmpl/index.html +++ b/administrator/components/com_menus/views/item/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/views/item/tmpl/type.php b/administrator/components/com_menus/views/item/tmpl/type.php index 371eea8f3d562..5b555d7f34048 100644 --- a/administrator/components/com_menus/views/item/tmpl/type.php +++ b/administrator/components/com_menus/views/item/tmpl/type.php @@ -7,7 +7,7 @@ }); //--> - + diff --git a/administrator/components/com_menus/views/item/view.php b/administrator/components/com_menus/views/item/view.php index 5aaff95c2f4d6..f741b8083d663 100644 --- a/administrator/components/com_menus/views/item/view.php +++ b/administrator/components/com_menus/views/item/view.php @@ -25,7 +25,10 @@ */ class MenusViewItem extends JView { - var $_name = 'item'; + protected $_name = 'item'; + protected $item; + protected $components; + protected $expansion; function edit($tpl = null) { @@ -63,9 +66,11 @@ function edit($tpl = null) // Initialize variables $urlparams = $this->get( 'UrlParams' ); - $params = $this->get( 'StateParams' ); + $params = $this->get( 'StateParams' ); $sysparams = $this->get( 'SystemParams' ); + $params->setXML($sysparams); $advanced = $this->get( 'AdvancedParams' ); + $params->setXML($advanced); $component = $this->get( 'ComponentParams' ); $name = $this->get( 'StateName' ); $description = $this->get( 'StateDescription' ); @@ -104,9 +109,7 @@ function edit($tpl = null) $this->assignRef('lists' , $lists); $this->assignRef('item' , $item); $this->assignRef('urlparams', $urlparams); - $this->assignRef('sysparams', $sysparams); $this->assignRef('params' , $params); - $this->assignRef('advanced' , $advanced); $this->assignRef('comp' , $component); $this->assignRef('menutypes', $menuTypes); $this->assignRef('name' , $name); @@ -183,4 +186,4 @@ function type($tpl = null) parent::display($tpl); } -} \ No newline at end of file +} diff --git a/administrator/components/com_menus/views/list/index.html b/administrator/components/com_menus/views/list/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/views/list/index.html +++ b/administrator/components/com_menus/views/list/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/views/list/tmpl/copy.php b/administrator/components/com_menus/views/list/tmpl/copy.php index 1599c04f0fd47..bd98ba5d51c8c 100644 --- a/administrator/components/com_menus/views/list/tmpl/copy.php +++ b/administrator/components/com_menus/views/list/tmpl/copy.php @@ -17,7 +17,7 @@ function submitbutton(pressbutton) { } - +
    @@ -19,20 +19,20 @@ -
  • -
  • - +
  • +
  • +
    diff --git a/administrator/components/com_menus/views/list/tmpl/default.php b/administrator/components/com_menus/views/list/tmpl/default.php index e9dec0f37e5bf..1037dd36e351c 100644 --- a/administrator/components/com_menus/views/list/tmpl/default.php +++ b/administrator/components/com_menus/views/list/tmpl/default.php @@ -1,6 +1,6 @@ - +
    diff --git a/administrator/components/com_menus/views/list/tmpl/index.html b/administrator/components/com_menus/views/list/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/views/list/tmpl/index.html +++ b/administrator/components/com_menus/views/list/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/views/list/tmpl/move.php b/administrator/components/com_menus/views/list/tmpl/move.php index f78f5c706ba54..473da3b76c007 100644 --- a/administrator/components/com_menus/views/list/tmpl/move.php +++ b/administrator/components/com_menus/views/list/tmpl/move.php @@ -17,7 +17,7 @@ function submitbutton(pressbutton) { } - +
    diff --git a/administrator/components/com_menus/views/list/view.php b/administrator/components/com_menus/views/list/view.php index 601b036a0c879..9253d3ebe5a16 100644 --- a/administrator/components/com_menus/views/list/view.php +++ b/administrator/components/com_menus/views/list/view.php @@ -1,188 +1,197 @@ -_layout = 'default'; - - /* - * Set toolbar items for the page - */ - $menutype = $mainframe->getUserStateFromRequest( 'com_menus.menutype', 'menutype', 'mainmenu', 'string' ); - - JToolBarHelper::title( JText::_( 'MENU ITEM MANAGER' ) .': ['.$menutype.']', 'menu.png' ); - - $bar =& JToolBar::getInstance('toolbar'); - $bar->appendButton( 'Link', 'menus', 'Menus', "index.php?option=com_menus" ); - - JToolBarHelper::makeDefault( 'setdefault' ); - JToolBarHelper::publishList(); - JToolBarHelper::unpublishList(); - JToolBarHelper::customX( 'move', 'move.png', 'move_f2.png', 'Move', true ); - JToolBarHelper::customX( 'copy', 'copy.png', 'copy_f2.png', 'Copy', true ); - JToolBarHelper::trash(); - JToolBarHelper::editListX(); - JToolBarHelper::addNewX('newItem'); - JToolBarHelper::help( 'screen.menus' ); - - $document = & JFactory::getDocument(); - $document->setTitle(JText::_('View Menu Items')); - - $limitstart = JRequest::getVar('limitstart', '0', '', 'int'); - $items = &$this->get('Items'); - $pagination = &$this->get('Pagination'); - $lists = &$this->_getViewLists(); - $user = &JFactory::getUser(); - - // Ensure ampersands and double quotes are encoded in item titles - foreach ($items as $i => $item) { - $treename = $item->treename; - $treename = JFilterOutput::ampReplace($treename); - $treename = str_replace('"', '"', $treename); - $items[$i]->treename = $treename; - } - - //Ordering allowed ? - $ordering = ($lists['order'] == 'm.ordering'); - - JHTML::_('behavior.tooltip'); - - $this->assignRef('items', $items); - $this->assignRef('pagination', $pagination); - $this->assignRef('lists', $lists); - $this->assignRef('user', $user); - $this->assignRef('menutype', $menutype); - $this->assignRef('ordering', $ordering); - $this->assignRef('limitstart', $limitstart); - - parent::display($tpl); - } - - function copyForm($tpl=null) - { - global $mainframe; - - $this->_layout = 'copy'; - - /* - * Set toolbar items for the page - */ - JToolBarHelper::title( JText::_( 'Copy Menu Items' ) ); - JToolBarHelper::custom( 'doCopy', 'copy.png', 'copy_f2.png', 'Copy', false ); - JToolBarHelper::cancel('cancelItem'); +_layout = 'default'; + + /* + * Set toolbar items for the page + */ + $menutype = $mainframe->getUserStateFromRequest( 'com_menus.menutype', 'menutype', 'mainmenu', 'string' ); + + JToolBarHelper::title( JText::_( 'MENU ITEM MANAGER' ) .': ['.$menutype.']', 'menu.png' ); + + $bar =& JToolBar::getInstance('toolbar'); + $bar->appendButton( 'Link', 'menus', 'Menus', "index.php?option=com_menus" ); + + JToolBarHelper::makeDefault( 'setdefault' ); + JToolBarHelper::publishList(); + JToolBarHelper::unpublishList(); + JToolBarHelper::customX( 'move', 'move.png', 'move_f2.png', 'Move', true ); + JToolBarHelper::customX( 'copy', 'copy.png', 'copy_f2.png', 'Copy', true ); + JToolBarHelper::trash(); + JToolBarHelper::editListX(); + JToolBarHelper::addNewX('newItem'); JToolBarHelper::help( 'screen.menus' ); - - $document = & JFactory::getDocument(); - $document->setTitle('Copy Menu Items'); - - $menutype = $mainframe->getUserStateFromRequest( 'com_menus.menutype', 'menutype', 'mainmenu', 'string' ); - - // Build the menutypes select list - $menuTypes = MenusHelper::getMenuTypes(); - foreach ( $menuTypes as $menuType ) { - $menu[] = JHTML::_('select.option', $menuType, $menuType ); - } - $MenuList = JHTML::_('select.genericlist', $menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null ); - - $items = &$this->get('ItemsFromRequest'); - - $this->assignRef('menutype', $menutype); - $this->assignRef('items', $items); - $this->assignRef('menutypes', $menuTypes); - $this->assignRef('MenuList', $MenuList); - - parent::display($tpl); - } - - function moveForm($tpl=null) - { - global $mainframe; - - $this->_layout = 'move'; - - /* - * Set toolbar items for the page - */ - JToolBarHelper::title( JText::_( 'Menu Items' ) . ': [ '. JText::_( 'Move' ) .' ]' ); - JToolBarHelper::custom( 'doMove', 'move.png', 'move_f2.png', 'Move', false ); - JToolBarHelper::cancel('cancelItem'); + + $document = & JFactory::getDocument(); + $document->setTitle(JText::_('View Menu Items')); + + $limitstart = JRequest::getVar('limitstart', '0', '', 'int'); + $items = &$this->get('Items'); + $pagination = &$this->get('Pagination'); + $lists = &$this->_getViewLists(); + $user = &JFactory::getUser(); + + // Ensure ampersands and double quotes are encoded in item titles + foreach ($items as $i => $item) { + $treename = $item->treename; + $treename = JFilterOutput::ampReplace($treename); + $treename = str_replace('"', '"', $treename); + $items[$i]->treename = $treename; + } + + //Ordering allowed ? + $ordering = ($lists['order'] == 'm.ordering'); + + JHTML::_('behavior.tooltip'); + + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + $this->assignRef('lists', $lists); + $this->assignRef('user', $user); + $this->assignRef('menutype', $menutype); + $this->assignRef('ordering', $ordering); + $this->assignRef('limitstart', $limitstart); + + parent::display($tpl); + } + + function copyForm($tpl=null) + { + global $mainframe; + + $this->_layout = 'copy'; + + /* + * Set toolbar items for the page + */ + JToolBarHelper::title( JText::_( 'Copy Menu Items' ) ); + JToolBarHelper::custom( 'doCopy', 'copy.png', 'copy_f2.png', 'Copy', false ); + JToolBarHelper::cancel('cancelItem'); JToolBarHelper::help( 'screen.menus' ); - - $document = & JFactory::getDocument(); - $document->setTitle('Copy Menu Items'); - - $menutype = $mainframe->getUserStateFromRequest( 'com_menus.menutype', 'menutype', 'mainmenu', 'string' ); - - // Build the menutypes select list - $menuTypes = MenusHelper::getMenuTypes(); - foreach ( $menuTypes as $menuType ) { - $menu[] = JHTML::_('select.option', $menuType, $menuType ); - } - $MenuList = JHTML::_('select.genericlist', $menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null ); - - $items = &$this->get('ItemsFromRequest'); - - $this->assignRef('menutype', $menutype); - $this->assignRef('items', $items); - $this->assignRef('menutypes', $menuTypes); - $this->assignRef('MenuList', $MenuList); - - parent::display($tpl); - } - - function &_getViewLists() - { - global $mainframe; - $db =& JFactory::getDBO(); - - $menutype = $mainframe->getUserStateFromRequest( "com_menus.menutype", 'menutype', 'mainmenu', 'string' ); - $filter_order = $mainframe->getUserStateFromRequest( "com_menus.$menutype.filter_order", 'filter_order', 'm.ordering', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( "com_menus.$menutype.filter_order_Dir", 'filter_order_Dir', 'ASC', 'word' ); - $filter_state = $mainframe->getUserStateFromRequest( "com_menus.$menutype.filter_state", 'filter_state', '', 'word' ); - $levellimit = $mainframe->getUserStateFromRequest( "com_menus.$menutype.levellimit", 'levellimit', 10, 'int' ); - $search = $mainframe->getUserStateFromRequest( "com_menus.$menutype.search", 'search', '', 'string' ); - $search = JString::strtolower( $search ); - - // level limit filter - $lists['levellist'] = JHTML::_('select.integerlist', 1, 20, 1, 'levellimit', 'size="1" onchange="document.adminForm.submit();"', $levellimit ); - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - return $lists; - } -} \ No newline at end of file + + $document = & JFactory::getDocument(); + $document->setTitle('Copy Menu Items'); + + $menutype = $mainframe->getUserStateFromRequest( 'com_menus.menutype', 'menutype', 'mainmenu', 'string' ); + + // Build the menutypes select list + $menuTypes = MenusHelper::getMenuTypes(); + foreach ( $menuTypes as $menuType ) { + $menu[] = JHTML::_('select.option', $menuType, $menuType ); + } + $MenuList = JHTML::_('select.genericlist', $menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null ); + + $items = &$this->get('ItemsFromRequest'); + + $this->assignRef('menutype', $menutype); + $this->assignRef('items', $items); + $this->assignRef('menutypes', $menuTypes); + $this->assignRef('MenuList', $MenuList); + + parent::display($tpl); + } + + function moveForm($tpl=null) + { + global $mainframe; + + $this->_layout = 'move'; + + /* + * Set toolbar items for the page + */ + JToolBarHelper::title( JText::_( 'Menu Items' ) . ': [ '. JText::_( 'Move' ) .' ]' ); + JToolBarHelper::custom( 'doMove', 'move.png', 'move_f2.png', 'Move', false ); + JToolBarHelper::cancel('cancelItem'); + JToolBarHelper::help( 'screen.menus' ); + + $document = & JFactory::getDocument(); + $document->setTitle('Copy Menu Items'); + + $menutype = $mainframe->getUserStateFromRequest( 'com_menus.menutype', 'menutype', 'mainmenu', 'string' ); + + // Build the menutypes select list + $menuTypes = MenusHelper::getMenuTypes(); + foreach ( $menuTypes as $menuType ) { + $menu[] = JHTML::_('select.option', $menuType, $menuType ); + } + $MenuList = JHTML::_('select.genericlist', $menu, 'menu', 'class="inputbox" size="10"', 'value', 'text', null ); + + $items = &$this->get('ItemsFromRequest'); + + $this->assignRef('menutype', $menutype); + $this->assignRef('items', $items); + $this->assignRef('menutypes', $menuTypes); + $this->assignRef('MenuList', $MenuList); + + parent::display($tpl); + } + + function &_getViewLists() + { + global $mainframe; + $db =& JFactory::getDBO(); + + $menutype = $mainframe->getUserStateFromRequest( "com_menus.menutype", 'menutype', 'mainmenu', 'string' ); + $filter_order = $mainframe->getUserStateFromRequest( "com_menus.$menutype.filter_order", 'filter_order', 'm.ordering', 'cmd' ); + $filter_order_Dir = $mainframe->getUserStateFromRequest( "com_menus.$menutype.filter_order_Dir", 'filter_order_Dir', 'ASC', 'word' ); + $filter_state = $mainframe->getUserStateFromRequest( "com_menus.$menutype.filter_state", 'filter_state', '', 'word' ); + $levellimit = $mainframe->getUserStateFromRequest( "com_menus.$menutype.levellimit", 'levellimit', 10, 'int' ); + $search = $mainframe->getUserStateFromRequest( "com_menus.$menutype.search", 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + // level limit filter + $lists['levellist'] = JHTML::_('select.integerlist', 1, 20, 1, 'levellimit', 'size="1" onchange="document.adminForm.submit();"', $levellimit ); + + // state filter + $lists['state'] = JHTML::_('grid.state', $filter_state ); + + // table ordering + $lists['order_Dir'] = $filter_order_Dir; + $lists['order'] = $filter_order; + + // search filter + $lists['search']= $search; + + return $lists; + } +} diff --git a/administrator/components/com_menus/views/menus/index.html b/administrator/components/com_menus/views/menus/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/views/menus/index.html +++ b/administrator/components/com_menus/views/menus/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/views/menus/tmpl/copy.php b/administrator/components/com_menus/views/menus/tmpl/copy.php index 16bf13bfdf4e4..75473f780569e 100644 --- a/administrator/components/com_menus/views/menus/tmpl/copy.php +++ b/administrator/components/com_menus/views/menus/tmpl/copy.php @@ -19,7 +19,7 @@ function submitbutton(pressbutton) { } //--> - +
    diff --git a/administrator/components/com_menus/views/menus/tmpl/default.php b/administrator/components/com_menus/views/menus/tmpl/default.php index f83abde4cacd6..95b632a3dcd36 100644 --- a/administrator/components/com_menus/views/menus/tmpl/default.php +++ b/administrator/components/com_menus/views/menus/tmpl/default.php @@ -26,7 +26,7 @@ function menu_listItemTask( id, task, option ) //--> - +
    @@ -95,7 +95,7 @@ function menu_listItemTask( id, task, option ) '; - echo ''; - echo ''; - echo ''; - } -} \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/admin.newsfeeds.php b/administrator/components/com_newsfeeds/admin.newsfeeds.php deleted file mode 100644 index 47a86157aef09..0000000000000 --- a/administrator/components/com_newsfeeds/admin.newsfeeds.php +++ /dev/null @@ -1,463 +0,0 @@ -authorize( 'com_newsfeeds', 'manage' )) { - $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); -} - -// Set the table directory -JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_newsfeeds'.DS.'tables'); - -require_once( JApplicationHelper::getPath( 'admin_html' ) ); - -$task = JRequest::getCmd('task'); - -switch ($task) { - - case 'add' : - editNewsFeed(false); - break; - case 'edit': - editNewsFeed(true); - break; - - case 'save': - case 'apply': - saveNewsFeed( ); - break; - - case 'publish': - publishNewsFeeds( ); - break; - - case 'unpublish': - unPublishNewsFeeds( ); - break; - - case 'remove': - removeNewsFeeds( ); - break; - - case 'cancel': - cancelNewsFeed( ); - break; - - case 'orderup': - moveUpNewsFeed( ); - break; - - case 'orderdown': - moveDownNewsFeed( ); - break; - - case 'saveorder': - saveOrder( ); - break; - - default: - showNewsFeeds( ); - break; -} - -/** -* List the records -*/ -function showNewsFeeds( ) -{ - global $mainframe, $option; - - $db =& JFactory::getDBO(); - - $filter_order = $mainframe->getUserStateFromRequest( "$option.filter_order", 'filter_order', 'a.ordering', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( "$option.filter_order_Dir", 'filter_order_Dir', '', 'word' ); - $filter_state = $mainframe->getUserStateFromRequest( "$option.filter_state", 'filter_state', '', 'word' ); - $filter_catid = $mainframe->getUserStateFromRequest( "$option.filter_catid", 'filter_catid', 0, 'int' ); - $search = $mainframe->getUserStateFromRequest( "$option.search", 'search', '', 'string' ); - $search = JString::strtolower( $search ); - - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); - $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); - - $where = array(); - if ( $filter_catid ) { - $where[] = 'a.catid = '.(int) $filter_catid; - } - if ($search) { - $where[] = 'LOWER(a.name) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); - } - if ( $filter_state ) { - if ( $filter_state == 'P' ) { - $where[] = 'a.published = 1'; - } else if ($filter_state == 'U' ) { - $where[] = 'a.published = 0'; - } - } - - $where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' ); - if ($filter_order == 'a.ordering'){ - $orderby = ' ORDER BY catname, a.ordering'; - } else { - $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', catname, a.ordering'; - } - - // get the total number of records - $query = 'SELECT COUNT(*) ' - . ' FROM #__newsfeeds AS a' - . $where - ; - $db->setQuery( $query ); - $total = $db->loadResult(); - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $total, $limitstart, $limit ); - - // get the subset (based on limits) of required records - $query = 'SELECT a.*, c.title AS catname, u.name AS editor' - . ' FROM #__newsfeeds AS a' - . ' LEFT JOIN #__categories AS c ON c.id = a.catid' - . ' LEFT JOIN #__users AS u ON u.id = a.checked_out' - . $where - . $orderby - ; - $db->setQuery( $query, $pageNav->limitstart, $pageNav->limit ); - - $rows = $db->loadObjectList(); - if ($db->getErrorNum()) { - echo $db->stderr(); - return false; - } - - // build list of categories - $javascript = 'onchange="document.adminForm.submit();"'; - $lists['catid'] = JHTML::_('list.category', 'filter_catid', 'com_newsfeeds', $filter_catid, $javascript ); - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - HTML_newsfeeds::showNewsFeeds( $rows, $lists, $pageNav, $option ); -} - -/** -* Creates a new or edits and existing user record -*/ -function editNewsFeed($edit) -{ - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - $catid = JRequest::getVar( 'catid', 0, '', 'int' ); - $cid = JRequest::getVar( 'cid', array(0), '', 'array' ); - $option = JRequest::getCmd( 'option' ); - JArrayHelper::toInteger($cid, array(0)); - - $row =& JTable::getInstance( 'newsfeed', 'Table' ); - // load the row from the db table - if($edit) - $row->load( $cid[0] ); - - if ($edit) { - // do stuff for existing records - $row->checkout( $user->get('id') ); - } else { - // do stuff for new records - $row->ordering = 0; - $row->numarticles = 5; - $row->cache_time = 3600; - $row->published = 1; - } - - // build the html select list for ordering - $query = 'SELECT a.ordering AS value, a.name AS text' - . ' FROM #__newsfeeds AS a' - . ' ORDER BY a.ordering' - ; - - if($edit) - $lists['ordering'] = JHTML::_('list.specificordering', $row, $cid[0], $query ); - else - $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query ); - - // build list of categories - $lists['category'] = JHTML::_('list.category', 'catid', $option, intval( $row->catid ) ); - // build the html select list - $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published ); - - HTML_newsfeeds::editNewsFeed( $row, $lists, $option ); -} - -/** -* Saves the record from an edit form submit -*/ -function saveNewsFeed( ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $task = JRequest::getVar( 'task'); - - $row =& JTable::getInstance( 'newsfeed', 'Table' ); - if (!$row->bind(JRequest::get('post'))) { - JError::raiseError(500, $row->getError() ); - } - - // Sets rtl value when rtl checkbox ticked - $isRtl = JRequest::getInt('rtl'); - if ($isRtl) { - $row->rtl = 1; - } - - // pre-save checks - if (!$row->check()) { - JError::raiseError(500, $row->getError() ); - } - - // if new item, order last in appropriate group - if (!$row->id) { - $where = "catid = " . (int) $row->catid; - $row->ordering = $row->getNextOrder( $where ); - } - - // save the changes - if (!$row->store()) { - JError::raiseError(500, $row->getError() ); - } - $row->checkin(); - - switch ($task) - { - case 'apply': - $msg = JText::_( 'Changes to Newsfeed saved' ); - $link = 'index.php?option=com_newsfeeds&task=edit&cid[]='. $row->id ; - break; - - case 'save': - default: - $msg = JText::_( 'Newsfeed saved' ); - $link = 'index.php?option=com_newsfeeds'; - break; - } - - $mainframe->redirect( $link, $msg ); -} - -/** -* Publishes one or more modules -*/ -function publishNewsFeeds( ) { - changePublishNewsFeeds( 1 ); -} - -/** -* Unpublishes one or more modules -*/ -function unPublishNewsFeeds( ) { - changePublishNewsFeeds( 0 ); -} - -/** -* Publishes or Unpublishes one or more modules -* @param integer 0 if unpublishing, 1 if publishing -*/ -function changePublishNewsFeeds( $publish ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - $cid = JRequest::getVar('cid', array(), '', 'array'); - $option = JRequest::getCmd('option'); - JArrayHelper::toInteger($cid); - - if (empty( $cid )) { - JError::raiseWarning( 500, 'No items selected' ); - $mainframe->redirect( 'index.php?option='. $option ); - } - - $cids = implode( ',', $cid ); - - $query = 'UPDATE #__newsfeeds' - . ' SET published = '.(int) $publish - . ' WHERE id IN ( '. $cids .' )' - . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id') .' ) )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - JError::raiseError(500, $db->getErrorMsg() ); - } - - if (count( $cid ) == 1) { - $row =& JTable::getInstance( 'newsfeed', 'Table' ); - $row->checkin( $cid[0] ); - } - - $mainframe->redirect( 'index.php?option='. $option ); -} - -/** -* Removes records -*/ -function removeNewsFeeds( ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $cid = JRequest::getVar('cid', array(), '', 'array'); - $option = JRequest::getCmd('option'); - JArrayHelper::toInteger($cid); - - if (count($cid) < 1) { - JError::raiseWarning(500, JText::_( 'Select an item to delete', true ) ); - $mainframe->redirect( 'index.php?option='. $option ); - } - - $cids = implode( ',', $cid ); - $query = 'DELETE FROM #__newsfeeds' - . ' WHERE id IN ( '. $cids .' )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - echo "\n"; - } - - $mainframe->redirect( 'index.php?option='. $option ); -} - -/** -* Cancels an edit operation -*/ -function cancelNewsFeed( ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $option = JRequest::getCmd('option'); - - $row =& JTable::getInstance( 'newsfeed', 'Table' ); - $row->bind(JRequest::get('post')); - $row->checkin(); - $mainframe->redirect( 'index.php?option='. $option ); -} - -/** -* Moves the record up one position -*/ -function moveUpNewsFeed( ) { - orderNewsFeed( -1 ); -} - -/** -* Moves the record down one position -*/ -function moveDownNewsFeed( ) { - orderNewsFeed( 1 ); -} - -/** -* Moves the order of a record -* @param integer The direction to reorder, +1 down, -1 up -*/ -function orderNewsFeed( $inc ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $cid = JRequest::getVar('cid', array(0), '', 'array'); - $option = JRequest::getCmd('option'); - JArrayHelper::toInteger($cid, array(0)); - - $limit = JRequest::getVar( 'limit', 0, '', 'int' ); - $limitstart = JRequest::getVar( 'limitstart', 0, '', 'int' ); - $catid = JRequest::getVar( 'catid', 0, '', 'int' ); - - $row =& JTable::getInstance( 'newsfeed', 'Table' ); - $row->load( $cid[0] ); - $row->move( $inc, 'catid = '.(int) $row->catid.' AND published != 0' ); - - $mainframe->redirect( 'index.php?option='. $option ); -} - -/** -* Saves user reordering entry -*/ -function saveOrder( ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); - JArrayHelper::toInteger($cid); - - $total = count( $cid ); - $order = JRequest::getVar( 'order', array(0), 'post', 'array' ); - JArrayHelper::toInteger($order, array(0)); - - $row =& JTable::getInstance( 'newsfeed', 'Table' ); - $groupings = array(); - - // update ordering values - for( $i=0; $i < $total; $i++ ) { - $row->load( (int) $cid[$i] ); - // track categories - $groupings[] = $row->catid; - - if ($row->ordering != $order[$i]) { - $row->ordering = $order[$i]; - if (!$row->store()) { - JError::raiseError(500, $db->getErrorMsg() ); - } - } - } - - // execute updateOrder for each parent group - $groupings = array_unique( $groupings ); - foreach ($groupings as $group){ - $row->reorder('catid = '.(int) $group); - } - - $msg = 'New ordering saved'; - $mainframe->redirect( 'index.php?option=com_newsfeeds', $msg ); -} diff --git a/administrator/components/com_newsfeeds/controller.php b/administrator/components/com_newsfeeds/controller.php new file mode 100644 index 0000000000000..bb55755599d8c --- /dev/null +++ b/administrator/components/com_newsfeeds/controller.php @@ -0,0 +1,203 @@ +registerTask( 'add', 'display' ); + $this->registerTask( 'edit', 'display' ); + } + + function display( ) + { + switch($this->getTask()) + { + case 'add': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'newsfeed'); + JRequest::setVar( 'edit', false ); + + // Checkout the newsfeed + $model = $this->getModel('newsfeed'); + $model->checkout(); + } break; + case 'edit': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'newsfeed'); + JRequest::setVar( 'edit', true ); + + // Checkout the newsfeed + $model = $this->getModel('newsfeed'); + $model->checkout(); + } break; + } + + parent::display(); + } + + function save() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $post = JRequest::get('post'); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $post['id'] = (int) $cid[0]; + + $model = $this->getModel('newsfeed'); + + if ($model->store($post)) { + $msg = JText::_( 'Newsfeed Saved' ); + } else { + $msg = JText::_( 'Error Saving Newsfeed' ); + } + + // Check the table in so it can be edited.... we are done with it anyway + $model->checkin(); + $link = 'index.php?option=com_newsfeeds'; + $this->setRedirect($link, $msg); + } + + function remove() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to delete' ) ); + } + + $model = $this->getModel('newsfeed'); + if(!$model->delete($cid)) { + echo "\n"; + } + + $this->setRedirect( 'index.php?option=com_newsfeeds' ); + } + + + function publish() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to publish' ) ); + } + + $model = $this->getModel('newsfeed'); + if(!$model->publish($cid, 1)) { + echo "\n"; + } + + $this->setRedirect( 'index.php?option=com_newsfeeds' ); + } + + + function unpublish() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to unpublish' ) ); + } + + $model = $this->getModel('newsfeed'); + if(!$model->publish($cid, 0)) { + echo "\n"; + } + + $this->setRedirect( 'index.php?option=com_newsfeeds' ); + } + + function cancel() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + // Checkin the newsfeed + $model = $this->getModel('newsfeed'); + $model->checkin(); + + $this->setRedirect( 'index.php?option=com_newsfeeds' ); + } + + + function orderup() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $model = $this->getModel('newsfeed'); + $model->move(-1); + + $this->setRedirect( 'index.php?option=com_newsfeeds'); + } + + function orderdown() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $model = $this->getModel('newsfeed'); + $model->move(1); + + $this->setRedirect( 'index.php?option=com_newsfeeds'); + } + + function saveorder() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + $order = JRequest::getVar( 'order', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + JArrayHelper::toInteger($order); + + $model = $this->getModel('newsfeed'); + $model->saveorder($cid, $order); + + $msg = 'New ordering saved'; + $this->setRedirect( 'index.php?option=com_newsfeeds', $msg ); + } +} \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/elements/index.html b/administrator/components/com_newsfeeds/elements/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_newsfeeds/elements/index.html +++ b/administrator/components/com_newsfeeds/elements/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/index.html b/administrator/components/com_newsfeeds/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_newsfeeds/index.html +++ b/administrator/components/com_newsfeeds/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/models/index.html b/administrator/components/com_newsfeeds/models/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_newsfeeds/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/models/newsfeed.php b/administrator/components/com_newsfeeds/models/newsfeed.php new file mode 100644 index 0000000000000..2725fc86285bb --- /dev/null +++ b/administrator/components/com_newsfeeds/models/newsfeed.php @@ -0,0 +1,385 @@ +setId((int)$array[0]); + } + + /** + * Method to set the newsfeed identifier + * + * @access public + * @param int Newsfeed identifier + */ + function setId($id) + { + // Set newsfeed id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a newsfeed + * + * @since 1.5 + */ + function &getData() + { + // Load the newsfeed data + if ($this->_loadData()) + { + // Initialize some variables + $user = &JFactory::getUser(); + + // Check to see if the category is published + if (!$this->_data->cat_pub) { + JError::raiseError( 404, JText::_("Resource Not Found") ); + return; + } + + // Check whether category access level allows access + if ($this->_data->cat_access > $user->get('aid', 0)) { + JError::raiseError( 403, JText::_('ALERTNOTAUTH') ); + return; + } + } + else $this->_initData(); + + return $this->_data; + } + + /** + * Tests if newsfeed is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.5 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_loadData()) + { + if ($uid) { + return ($this->_data->checked_out && $this->_data->checked_out != $uid); + } else { + return $this->_data->checked_out; + } + } + } + + /** + * Method to checkin/unlock the newsfeed + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function checkin() + { + if ($this->_id) + { + $newsfeed = & $this->getTable(); + if(! $newsfeed->checkin($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return false; + } + + /** + * Method to checkout/lock the newsfeed + * + * @access public + * @param int $uid User ID of the user checking the newsfeed out + * @return boolean True on success + * @since 1.5 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the newsfeed with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $newsfeed = & $this->getTable(); + if(!$newsfeed->checkout($uid, $this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + return false; + } + + /** + * Method to store the newsfeed + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function store($data) + { + $row =& $this->getTable(); + + // Bind the form fields to the web link table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // if new item, order last in appropriate group + if (!$row->id) { + $where = 'catid = ' . (int) $row->catid ; + $row->ordering = $row->getNextOrder( $where ); + } + + // Make sure the web link table is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the web link table to the database + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to remove a newsfeed + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__newsfeeds' + . ' WHERE id IN ( '.$cids.' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to (un)publish a newsfeed + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function publish($cid = array(), $publish = 1) + { + $user =& JFactory::getUser(); + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__newsfeeds' + . ' SET published = '.(int) $publish + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to move a newsfeed + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function move($direction) + { + $row =& $this->getTable(); + if (!$row->load($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if (!$row->move( $direction, ' catid = '.(int) $row->catid.' AND published >= 0 ' )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to move a newsfeed + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function saveorder($cid = array(), $order) + { + $row =& $this->getTable(); + $groupings = array(); + + // update ordering values + for( $i=0; $i < count($cid); $i++ ) + { + $row->load( (int) $cid[$i] ); + // track categories + $groupings[] = $row->catid; + + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + } + + // execute updateOrder for each parent group + $groupings = array_unique( $groupings ); + foreach ($groupings as $group){ + $row->reorder('catid = '.(int) $group); + } + + return true; + } + + /** + * Method to load newsfeed data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = 'SELECT c.*, cc.title AS category,'. + ' cc.published AS cat_pub, cc.access AS cat_access'. + ' FROM #__newsfeeds AS c' . + ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . + ' WHERE c.id = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the newsfeed data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $newsfeed = new stdClass(); + $newsfeed->id = 0; + $newsfeed->catid = 0; + $newsfeed->name = null; + $newsfeed->alias = null; + $newsfeed->link = null; + $newsfeed->filename = null; + $newsfeed->numarticles = 0; + $newsfeed->cache_time = 0; + $newsfeed->rtl = 0; + $newsfeed->published = 0; + $newsfeed->checked_out = 0; + $newsfeed->checked_out_time = 0; + $newsfeed->ordering = 0; + $newsfeed->archived = 0; + $newsfeed->approved = 0; + $newsfeed->category = null; + $this->_data = $newsfeed; + return (boolean) $this->_data; + } + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/models/newsfeeds.php b/administrator/components/com_newsfeeds/models/newsfeeds.php new file mode 100644 index 0000000000000..68285692ff800 --- /dev/null +++ b/administrator/components/com_newsfeeds/models/newsfeeds.php @@ -0,0 +1,204 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'a.ordering', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter->catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' ); + $filter->search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $this->_filter = $filter; + } + + /** + * Method to get newsfeeds item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_data; + } + + /** + * Method to get the total number of newsfeed items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the newsfeeds + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the newsfeeds + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = ' SELECT a.*, cc.title AS catname, u.name AS editor ' + . ' FROM #__newsfeeds AS a ' + . ' LEFT JOIN #__categories AS cc ON cc.id = a.catid ' + . ' LEFT JOIN #__users AS u ON u.id = a.checked_out ' + . $where + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy() + { + global $mainframe, $option; + + if ($this->_filter->order == 'a.ordering'){ + $orderby = ' ORDER BY catname, a.ordering '.$this->_filter->order_Dir; + } else { + $orderby = ' ORDER BY '.$this->_filter->order.' '.$this->_filter->order_Dir.' , catname, a.ordering '; + } + return $orderby; + } + + function _buildContentWhere() + { + global $mainframe, $option; + + $search = JString::strtolower( $this->_filter->search ); + + $where = array(); + + if ($this->_filter->catid > 0) { + $where[] = 'a.catid = '.(int) $this->_filter->catid; + } + if ($search) { + $where[] = 'LOWER(a.name) LIKE '.$this->_db->Quote('%'.$this->_db->getEscaped( $search, true ).'%', false); + } + if ( $this->_filter->state ) { + if ( $this->_filter->state == 'P' ) { + $where[] = 'a.published = 1'; + } else if ($this->_filter->state == 'U' ) { + $where[] = 'a.published = 0'; + } + } + + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + + return $where; + } +} \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/newsfeeds.php b/administrator/components/com_newsfeeds/newsfeeds.php new file mode 100644 index 0000000000000..52f7f74ee774d --- /dev/null +++ b/administrator/components/com_newsfeeds/newsfeeds.php @@ -0,0 +1,33 @@ +authorize( 'com_newsfeeds', 'manage' )) { + $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); +} + +// Require the base controller +require_once JPATH_COMPONENT.DS.'controller.php'; + +$controller = new NewsfeedsController(); + +// Perform the Request task +$controller->execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/newsfeeds.xml b/administrator/components/com_newsfeeds/newsfeeds.xml index d9857e83e0a81..0c9efbcc3578e 100644 --- a/administrator/components/com_newsfeeds/newsfeeds.xml +++ b/administrator/components/com_newsfeeds/newsfeeds.xml @@ -3,7 +3,7 @@ NewsfeedsJoomla! ProjectApril 2006 - (C) 2005 - 2008 Open Source Matters. All rights reserved. + (C) 2005 - 2007 Open Source Matters. All rights reserved.http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLadmin@joomla.orgwww.joomla.org diff --git a/administrator/components/com_newsfeeds/tables/index.html b/administrator/components/com_newsfeeds/tables/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_newsfeeds/tables/index.html +++ b/administrator/components/com_newsfeeds/tables/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/tables/newsfeed.php b/administrator/components/com_newsfeeds/tables/newsfeed.php index 844f0069defdb..89f35a215a7f3 100644 --- a/administrator/components/com_newsfeeds/tables/newsfeed.php +++ b/administrator/components/com_newsfeeds/tables/newsfeed.php @@ -76,4 +76,4 @@ function check() return true; } -} +} \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/toolbar.newsfeeds.html.php b/administrator/components/com_newsfeeds/toolbar.newsfeeds.html.php deleted file mode 100644 index a27090ec35027..0000000000000 --- a/administrator/components/com_newsfeeds/toolbar.newsfeeds.html.php +++ /dev/null @@ -1,54 +0,0 @@ -[ '. $text.' ]' ); - JToolBarHelper::save(); - JToolBarHelper::apply(); - if ($edit) { - // for existing items the button is renamed `close` - JToolBarHelper::cancel( 'cancel', 'Close' ); - } else { - JToolBarHelper::cancel(); - } - JToolBarHelper::help( 'screen.newsfeeds.edit' ); - } -} \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/views/index.html b/administrator/components/com_newsfeeds/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_newsfeeds/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/views/newsfeed/index.html b/administrator/components/com_newsfeeds/views/newsfeed/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_newsfeeds/views/newsfeed/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/default.php b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/default.php new file mode 100644 index 0000000000000..4a7abb72d7e67 --- /dev/null +++ b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/default.php @@ -0,0 +1,148 @@ + + + + + + + + + +
    +
    + + +
    - + - +
    modules ) : ?> diff --git a/administrator/components/com_menus/views/menus/tmpl/edit.php b/administrator/components/com_menus/views/menus/tmpl/edit.php index c3121eb7ed52f..a6ce2981e6840 100644 --- a/administrator/components/com_menus/views/menus/tmpl/edit.php +++ b/administrator/components/com_menus/views/menus/tmpl/edit.php @@ -31,7 +31,7 @@ function submitbutton(pressbutton) { } //--> - + diff --git a/administrator/components/com_menus/views/menus/tmpl/index.html b/administrator/components/com_menus/views/menus/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_menus/views/menus/tmpl/index.html +++ b/administrator/components/com_menus/views/menus/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_menus/views/menus/view.php b/administrator/components/com_menus/views/menus/view.php index 90a42411b651e..ffa18a520e6c1 100644 --- a/administrator/components/com_menus/views/menus/view.php +++ b/administrator/components/com_menus/views/menus/view.php @@ -1,142 +1,149 @@ -_layout = 'default'; - - // Set toolbar items for the page - JToolBarHelper::title( JText::_( 'Menu Manager' ), 'menumgr.png' ); - JToolBarHelper::customX( 'copyMenu', 'copy.png', 'copy_f2.png', 'Copy', true ); - JToolBarHelper::customX( 'deleteMenu', 'delete.png', 'delete_f2.png', 'Delete', true ); - JToolBarHelper::editListX('editMenu'); - JToolBarHelper::addNewX('addMenu'); - JToolBarHelper::help( 'screen.menumanager' ); - - $document = & JFactory::getDocument(); - $document->setTitle(JText::_('View Menus')); - - $limitstart = JRequest::getVar('limitstart', '0', '', 'int'); - - $menus = &$this->get('Menus'); - $pagination = &$this->get('Pagination'); - - $this->assignRef('menus', $menus); - $this->assignRef('pagination', $pagination); - $this->assignRef('limitstart', $limitstart); - - JHTML::_('behavior.tooltip'); - - parent::display($tpl); - } - - function copyForm($tpl=null) - { - global $mainframe; - - $this->_layout = 'copy'; - - // view data - $table = $this->get('Table'); - $items = $this->get('MenuItems'); - - /* - * Set toolbar items for the page - */ - JToolBarHelper::title( JText::_( 'Copy Menu' ) ); - JToolBarHelper::custom( 'doCopyMenu', 'copy.png', 'copy_f2.png', 'Copy', false ); - JToolBarHelper::cancel(); +_layout = 'default'; + + // Set toolbar items for the page + JToolBarHelper::title( JText::_( 'Menu Manager' ), 'menumgr.png' ); + JToolBarHelper::customX( 'copyMenu', 'copy.png', 'copy_f2.png', 'Copy', true ); + JToolBarHelper::customX( 'deleteMenu', 'delete.png', 'delete_f2.png', 'Delete', true ); + JToolBarHelper::editListX('editMenu'); + JToolBarHelper::addNewX('addMenu'); JToolBarHelper::help( 'screen.menumanager' ); - - $document = & JFactory::getDocument(); - $document->setTitle('Copy Menu Items'); - - $this->assignRef('items', $items); - $this->assignRef('table', $table); - - parent::display($tpl); - } - - function deleteForm($tpl=null) - { - global $mainframe; - - $this->_layout = 'delete'; - - /* - * Set toolbar items for the page - */ - JToolBarHelper::title( JText::_( 'Menu' ) . ': [ '. JText::_( 'Delete' ) .' ]' ); - JToolBarHelper::custom( 'doDeleteMenu', 'delete.png', 'delete_f2.png', 'Delete', false ); - JToolBarHelper::cancel(); - JToolBarHelper::help( 'screen.menumanager.delete' ); - - // view data - $table = $this->get('Table'); - $modules = $this->get('Modules'); - $menuItems = $this->get('MenuItems'); - - $document = & JFactory::getDocument(); - $document->setTitle('Confirm Delete Menu Type: ' . $table->menutype ); - - - $this->assignRef('table', $table); - $this->assignRef('modules', $modules); - $this->assignRef('menuItems', $menuItems); - - parent::display($tpl); - } - - function editForm($edit,$tpl=null) - { - JRequest::setVar( 'hidemainmenu', 1 ); - - global $mainframe; - - $this->_layout = 'edit'; - if($edit) - $table = &$this->get('Table'); - else - $table=& JTable::getInstance('menuTypes'); - /* - * Set toolbar items for the page - */ - $text = ( ($table->id != 0) ? JText::_( 'Edit' ) : JText::_( 'New' ) ); - JToolBarHelper::title( JText::_( 'Menu Details' ).': [ '. $text.' ]', 'menumgr.png' ); - JToolBarHelper::custom( 'savemenu', 'save.png', 'save_f2.png', 'Save', false ); - JToolBarHelper::cancel(); - JToolBarHelper::help( 'screen.menumanager.new' ); - - $this->assignRef('row', $table); - $this->assign('isnew', ($table->id == 0)); - - JHTML::_('behavior.tooltip'); - - parent::display($tpl); - } -} \ No newline at end of file + + $document = & JFactory::getDocument(); + $document->setTitle(JText::_('View Menus')); + + $limitstart = JRequest::getVar('limitstart', '0', '', 'int'); + + $menus = &$this->get('Menus'); + $pagination = &$this->get('Pagination'); + + $this->assignRef('menus', $menus); + $this->assignRef('pagination', $pagination); + $this->assignRef('limitstart', $limitstart); + + JHTML::_('behavior.tooltip'); + + parent::display($tpl); + } + + function copyForm($tpl=null) + { + global $mainframe; + + $this->_layout = 'copy'; + + // view data + $table = $this->get('Table'); + $items = $this->get('MenuItems'); + + /* + * Set toolbar items for the page + */ + JToolBarHelper::title( JText::_( 'Copy Menu' ) ); + JToolBarHelper::custom( 'doCopyMenu', 'copy.png', 'copy_f2.png', 'Copy', false ); + JToolBarHelper::cancel(); + JToolBarHelper::help( 'screen.menumanager' ); + + $document = & JFactory::getDocument(); + $document->setTitle('Copy Menu Items'); + + $this->assignRef('items', $items); + $this->assignRef('table', $table); + + parent::display($tpl); + } + + function deleteForm($tpl=null) + { + global $mainframe; + + $this->_layout = 'delete'; + + /* + * Set toolbar items for the page + */ + JToolBarHelper::title( JText::_( 'Menu' ) . ': [ '. JText::_( 'Delete' ) .' ]' ); + JToolBarHelper::custom( 'doDeleteMenu', 'delete.png', 'delete_f2.png', 'Delete', false ); + JToolBarHelper::cancel(); + JToolBarHelper::help( 'screen.menumanager.delete' ); + + // view data + $table = $this->get('Table'); + $modules = $this->get('Modules'); + $menuItems = $this->get('MenuItems'); + + $document = & JFactory::getDocument(); + $document->setTitle('Confirm Delete Menu Type: ' . $table->menutype ); + + + $this->assignRef('table', $table); + $this->assignRef('modules', $modules); + $this->assignRef('menuItems', $menuItems); + + parent::display($tpl); + } + + function editForm($edit,$tpl=null) + { + JRequest::setVar( 'hidemainmenu', 1 ); + + global $mainframe; + + $this->_layout = 'edit'; + if($edit) + $table = &$this->get('Table'); + else + $table=& JTable::getInstance('menuTypes'); + /* + * Set toolbar items for the page + */ + $text = ( ($table->id != 0) ? JText::_( 'Edit' ) : JText::_( 'New' ) ); + JToolBarHelper::title( JText::_( 'Menu Details' ).': [ '. $text.' ]', 'menumgr.png' ); + JToolBarHelper::custom( 'savemenu', 'save.png', 'save_f2.png', 'Save', false ); + JToolBarHelper::cancel(); + JToolBarHelper::help( 'screen.menumanager.new' ); + + $this->assignRef('row', $table); + $this->assign('isnew', ($table->id == 0)); + + JHTML::_('behavior.tooltip'); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_messages/admin.messages.html.php b/administrator/components/com_messages/admin.messages.html.php deleted file mode 100644 index 5a87a1487f47e..0000000000000 --- a/administrator/components/com_messages/admin.messages.html.php +++ /dev/null @@ -1,296 +0,0 @@ - - - -
    - - - - -
    - : - - - - - -
    - -
    - - - - - - - - - - - - - - - - - - state ? 'tick.png' : 'publish_x.png'; - $alt = $row->state ? JText::_( 'Read' ) : JText::_( 'Read' ); - - if ( $user->authorize( 'com_users', 'manage' ) ) { - $linkA = 'index.php?option=com_users&task=editA&id='. $row->user_id_from; - $author = ''. $row->user_from .''; - } else { - $author = $row->user_from; - } - - ?> - "> - - - - - - - - - -
    - - - - - - - - - - - -
    - getListFooter(); ?> -
    - limitstart;?> - - message_id ); ?> - - - subject; ?> - - - <?php echo $alt; ?> - - - - date_time, JText::_('DATE_FORMAT_LC2')); ?> -
    -
    - - - - - - - - - - -
    - -
    - - - - - - - - - - - - - -
    - : - - -
    - : - - -
    - : - - - -
    -
    - - - - -
    - -
    - - - - - - - - - - - - - - - - - - -
    - : - - user_from;?> -
    - : - - date_time;?> -
    - : - - subject;?> -
    - : - -
    message, ENT_COMPAT, 'UTF-8' );?>
    -
    - - - - - - - - -
    - - -
    - - - - - - - - - - - - - - -
    - : - - -
    - : - - -
    - : - - -
    - - - - - -
    - getUserStateFromRequest( $context.'.filter_order', 'filter_order', 'a.date_time', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $context.'.filter_order_Dir','filter_order_Dir', 'DESC', 'word' ); - $filter_state = $mainframe->getUserStateFromRequest( $context.'.filter_state', 'filter_state', '', 'word' ); - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); - $limitstart = $mainframe->getUserStateFromRequest( $context.'.limitstart', 'limitstart', 0, 'int' ); - $search = $mainframe->getUserStateFromRequest( $context.'search', 'search', '', 'string' ); - $search = JString::strtolower( $search ); - - $where = array(); - $where[] = ' a.user_id_to='.(int) $user->get('id'); - - if ($search != '') { - $searchEscaped = $db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); - $where[] = '( u.username LIKE '.$searchEscaped.' OR email LIKE '.$searchEscaped.' OR u.name LIKE '.$searchEscaped.' )'; - } - if ( $filter_state ) { - if ( $filter_state == 'P' ) { - $where[] = 'a.state = 1'; - } else if ($filter_state == 'U' ) { - $where[] = 'a.state = 0'; - } - } - - $where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' ); - $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', a.date_time DESC'; - - $query = 'SELECT COUNT(*)' - . ' FROM #__messages AS a' - . ' INNER JOIN #__users AS u ON u.id = a.user_id_from' - . $where - ; - $db->setQuery( $query ); - $total = $db->loadResult(); - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $total, $limitstart, $limit ); - - $query = 'SELECT a.*, u.name AS user_from' - . ' FROM #__messages AS a' - . ' INNER JOIN #__users AS u ON u.id = a.user_id_from' - . $where - . $orderby - ; - $db->setQuery( $query, $pageNav->limitstart, $pageNav->limit ); - $rows = $db->loadObjectList(); - if ($db->getErrorNum()) { - echo $db->stderr(); - return false; - } - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state, 'Read', 'Unread' ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - HTML_messages::showMessages( $rows, $pageNav, $option, $lists ); -} - -function editConfig( $option ) -{ - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - $query = 'SELECT cfg_name, cfg_value' - . ' FROM #__messages_cfg' - . ' WHERE user_id = '.(int) $user->get('id') - ; - $db->setQuery( $query ); - $data = $db->loadObjectList( 'cfg_name' ); - - // initialize values if they do not exist - if (!isset($data['lock']->cfg_value)) { - $data['lock']->cfg_value = 0; - } - if (!isset($data['mail_on_new']->cfg_value)) { - $data['mail_on_new']->cfg_value = 0; - } - if (!isset($data['auto_purge']->cfg_value)) { - $data['auto_purge']->cfg_value = 7; - } - - $vars = array(); - $vars['lock'] = JHTML::_('select.booleanlist', "vars[lock]", '', $data['lock']->cfg_value, 'yes', 'no', 'varslock' ); - $vars['mail_on_new'] = JHTML::_('select.booleanlist', "vars[mail_on_new]", '', $data['mail_on_new']->cfg_value, 'yes', 'no', 'varsmail_on_new' ); - $vars['auto_purge'] = $data['auto_purge']->cfg_value; - - HTML_messages::editConfig( $vars, $option ); - -} - -function saveConfig( $option ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - $query = 'DELETE FROM #__messages_cfg' - . ' WHERE user_id = '.(int) $user->get('id') - ; - $db->setQuery( $query ); - $db->query(); - - $vars = JRequest::getVar( 'vars', array(), 'post', 'array' ); - foreach ($vars as $k=>$v) { - $v = $db->getEscaped( $v ); - $query = 'INSERT INTO #__messages_cfg' - . ' ( user_id, cfg_name, cfg_value )' - . ' VALUES ( '.(int) $user->get('id').', '.$db->Quote($k).', '.$db->Quote($v).' )' - ; - $db->setQuery( $query ); - $db->query(); - } - $mainframe->redirect( "index.php?option=$option" ); -} - -function newMessage( $option, $user, $subject ) -{ - $db =& JFactory::getDBO(); - $acl =& JFactory::getACL(); - - // get available backend user groups - $gid = $acl->get_group_id( 'Public Backend', 'ARO' ); - $gids = $acl->get_group_children( $gid, 'ARO', 'RECURSE' ); - JArrayHelper::toInteger($gids, array(0)); - $gids = implode( ',', $gids ); - - // get list of usernames - $recipients = array( JHTML::_('select.option', '0', '- '. JText::_( 'Select User' ) .' -' ) ); - $query = 'SELECT id AS value, username AS text FROM #__users' - . ' WHERE gid IN ( '.$gids.' )' - . ' ORDER BY name' - ; - $db->setQuery( $query ); - $recipients = array_merge( $recipients, $db->loadObjectList() ); - - $recipientslist = - JHTML::_('select.genericlist', $recipients, 'user_id_to', 'class="inputbox" size="1"', 'value', 'text', $user); - HTML_messages::newMessage($option, $recipientslist, $subject ); -} - -function saveMessage( $option ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - require_once(dirname(__FILE__).DS.'tables'.DS.'message.php'); - - $db =& JFactory::getDBO(); - $row = new TableMessage( $db ); - - if (!$row->bind(JRequest::get('post'))) { - JError::raiseError(500, $row->getError() ); - } - - if (!$row->check()) { - JError::raiseError(500, $row->getError() ); - } - - if (!$row->send()) { - $mainframe->redirect( "index.php?option=com_messages", $row->getError() ); - } - $mainframe->redirect( "index.php?option=com_messages" ); -} - -function viewMessage( $uid='0', $option ) -{ - $db =& JFactory::getDBO(); - - $query = 'SELECT a.*, u.name AS user_from' - . ' FROM #__messages AS a' - . ' INNER JOIN #__users AS u ON u.id = a.user_id_from' - . ' WHERE a.message_id = '.(int) $uid - . ' ORDER BY date_time DESC' - ; - $db->setQuery( $query ); - $row = $db->loadObject(); - - $query = 'UPDATE #__messages' - . ' SET state = 1' - . ' WHERE message_id = '.(int) $uid - ; - $db->setQuery( $query ); - $db->query(); - - HTML_messages::viewMessage( $row, $option ); -} - -function removeMessage( $cid, $option ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - - JArrayHelper::toInteger($cid); - - if (count( $cid ) < 1) { - JError::raiseError(500, JText::_( 'Select an item to delete' ) ); - } - - if (count( $cid )) - { - $cids = implode( ',', $cid ); - $query = 'DELETE FROM #__messages' - . ' WHERE message_id IN ( '. $cids .' )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - echo "\n"; - } - } - - $limit = JRequest::getVar( 'limit', 10, '', 'int' ); - $limitstart = JRequest::getVar( 'limitstart', 0, '', 'int' ); - - $mainframe->redirect( 'index.php?option='.$option.'&limit='.$limit.'&limitstart='.$limitstart ); -} \ No newline at end of file diff --git a/administrator/components/com_messages/controller.php b/administrator/components/com_messages/controller.php new file mode 100644 index 0000000000000..b1a73f07418a6 --- /dev/null +++ b/administrator/components/com_messages/controller.php @@ -0,0 +1,116 @@ +registerTask( 'add', 'display' ); + $this->registerTask( 'reply', 'display' ); + $this->registerTask( 'view', 'display' ); + } + + function display( ) + { + switch($this->getTask()) + { + case 'view' : + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'message'); + JRequest::setVar( 'edit', false ); + } break; + case 'add' : + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'message'); + JRequest::setVar( 'edit', true ); + JRequest::setVar( 'reply', false ); + } break; + case 'reply' : + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'message'); + JRequest::setVar( 'edit', true ); + JRequest::setVar( 'reply', true ); + } break; + case 'config' : + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'config'); + } break; + } + + parent::display(); + } + + function save( ) + { + global $mainframe; + + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $post = JRequest::get('post'); + $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); + $post['id'] = (int) $cid[0]; + + $model = $this->getModel('message'); + + if ($model->send($post)) { + $msg = JText::_( 'Message Sent' ); + } else { + $msg = JText::_( 'Error Sending Message' ); + } + + $this->setRedirect('index.php?option=com_messages', $msg); + } + + function remove( ) + { + global $mainframe; + + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to delete' ) ); + } + + $model = $this->getModel('message'); + if(!$model->delete($cid)) { + echo "\n"; + } + + $this->setRedirect( 'index.php?option=com_messages' ); + } +} \ No newline at end of file diff --git a/administrator/components/com_messages/index.html b/administrator/components/com_messages/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_messages/index.html +++ b/administrator/components/com_messages/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/includes/footer.php b/administrator/components/com_messages/messages.php similarity index 65% rename from includes/footer.php rename to administrator/components/com_messages/messages.php index 869de8148cde2..f74c3deaba967 100644 --- a/includes/footer.php +++ b/administrator/components/com_messages/messages.php @@ -1,27 +1,25 @@ - -
    - © getCfg('sitename'); ?> -
    - -
    - URL; ?> -
    \ No newline at end of file +execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_messages/models/config.php b/administrator/components/com_messages/models/config.php new file mode 100644 index 0000000000000..3d67a609f90b3 --- /dev/null +++ b/administrator/components/com_messages/models/config.php @@ -0,0 +1,123 @@ +_data)) + { + $this->_loadData(); + } + + return $this->_data; + } + + function _loadData() + { + $user =& JFactory::getUser(); + + $query = 'SELECT cfg_name, cfg_value' + . ' FROM #__messages_cfg' + . ' WHERE user_id = '.(int) $user->get('id') + ; + $this->_db->setQuery( $query ); + $data = $this->_db->loadObjectList( 'cfg_name' ); + + // initialize values if they do not exist + $this->_data['lock'] = isset($data['lock']->cfg_value) ? $data['lock']->cfg_value : 0; + $this->_data['mail_on_new'] = isset($data['mail_on_new']->cfg_value) ? $data['mail_on_new']->cfg_value : 0; + $this->_data['auto_purge'] = isset($data['auto_purge']->cfg_value) ? $data['auto_purge']->cfg_value : 7; + } + + /** + * Method to store the config info + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function store($vars) + { + $user =& JFactory::getUser(); + + $query = 'DELETE FROM #__messages_cfg' + . ' WHERE user_id = '.(int) $user->get('id') + ; + $this->_db->setQuery( $query ); + if ($this->_db->query() === false) + return false; + + // Multi-row INSERT query + $values = array(); + foreach ($vars as $k=>$v) { + $values[] = '( '.(int) $user->get('id').', '.$this->_db->Quote($k).', '.$this->_db->Quote($this->_db->getEscaped( $v )).' )'; + } + if (count($values)) { + $query = 'INSERT INTO #__messages_cfg' + . ' ( user_id, cfg_name, cfg_value )' + . ' VALUES ' + . implode( ', ', $values ) + ; + $this->_db->setQuery( $query ); + if ($this->_db->query() === false) + return false; + } + + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_messages/models/index.html b/administrator/components/com_messages/models/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_messages/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_messages/models/message.php b/administrator/components/com_messages/models/message.php new file mode 100644 index 0000000000000..2b9f96c99d83a --- /dev/null +++ b/administrator/components/com_messages/models/message.php @@ -0,0 +1,219 @@ +setId((int)$array[0]); + } + + /** + * Method to set the message identifier + * + * @access public + * @param int Message identifier + */ + function setId($id) + { + // Set message id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a message + * + * @since 1.5 + */ + function &getData() + { + // Load the message data + if (!$this->_loadData()) + { + $this->_initData(); + } + + return $this->_data; + } + + /** + * Method to store the message + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function send($data) + { + $row =& $this->getTable(); + + // Bind the form fields to the web link table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Make sure the data is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the data to the database + if (!$row->send()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to remove a message + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__messages' + . ' WHERE message_id IN ( '.$cids.' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to load message data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = 'SELECT a.*, u.name AS user_from' + . ' FROM #__messages AS a' + . ' INNER JOIN #__users AS u ON u.id = a.user_id_from' + . ' WHERE a.message_id = '.(int) $this->_id + . ' ORDER BY date_time DESC' + ; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the message data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $message = new stdClass(); + $message->id = 0; + $message->user_id_from = 0; + $message->user_id_to = 0; + $message->folder_id = 0; + $message->date_time = null; + $message->state = 0; + $message->priority = 0; + $message->subject = null; + $message->message = null; + $this->_data = $message; + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to set the message as read + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function markAsRead() + { + $query = 'UPDATE #__messages' + . ' SET state = 1' + . ' WHERE message_id = '.(int) $this->_id + ; + $this->_db->setQuery( $query ); + if ($this->_db->query() === false) + return false; + + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_messages/models/messages.php b/administrator/components/com_messages/models/messages.php new file mode 100644 index 0000000000000..7f8808f9646c5 --- /dev/null +++ b/administrator/components/com_messages/models/messages.php @@ -0,0 +1,197 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $context.'.limitstart', 'limitstart', 0, 'int' ); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $context.'.filter_order', 'filter_order', 'a.date_time', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $context.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $context.'.filter_state', 'filter_state', '', 'word' ); + $filter->search = $mainframe->getUserStateFromRequest( $context.'.search', 'search', '', 'string' ); + $this->_filter = $filter; + } + + /** + * Method to get contacts item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_data; + } + + /** + * Method to get the total number of contact items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the contacts + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the contacts + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = 'SELECT a.*, u.name AS user_from' + . ' FROM #__messages AS a' + . ' INNER JOIN #__users AS u ON u.id = a.user_id_from' + . $where + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy() + { + $orderby = ' ORDER BY '. $this->_filter->order .' '. $this->_filter->order_Dir .', a.date_time DESC'; + + return $orderby; + } + + function _buildContentWhere() + { + $search = JString::strtolower( $this->_filter->search ); + $user =& JFactory::getUser(); + + $where = array(); + $where[] = ' a.user_id_to='.(int) $user->get('id'); + + if ($search != '') { + $searchEscaped = $db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); + $where[] = '( u.username LIKE '.$searchEscaped.' OR email LIKE '.$searchEscaped.' OR u.name LIKE '.$searchEscaped.' )'; + } + + if ( $this->_filter->state ) { + if ( $this->_filter->state == 'P' ) { + $where[] = 'a.published = 1'; + } else if ($this->_filter->state == 'U' ) { + $where[] = 'a.published = 0'; + } + } + + $where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' ); + + return $where; + } +} \ No newline at end of file diff --git a/administrator/components/com_messages/tables/index.html b/administrator/components/com_messages/tables/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_messages/tables/index.html +++ b/administrator/components/com_messages/tables/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_messages/tables/message.php b/administrator/components/com_messages/tables/message.php index bfcba47494ab5..dc86fbff58615 100644 --- a/administrator/components/com_messages/tables/message.php +++ b/administrator/components/com_messages/tables/message.php @@ -130,16 +130,9 @@ function send($fromId = null, $toId = null, $subject = null, $message = null, $m $message = $message ? $message : $this->message; } - $query = 'SELECT cfg_name, cfg_value' . - ' FROM #__messages_cfg' . - ' WHERE user_id = '.(int) $toId; - $db->setQuery($query); + $toUser =& JFactory::getUser($toId); - $config = $db->loadObjectList('cfg_name'); - $locked = @ $config['lock']->cfg_value; - $domail = @ $config['mail_on_new']->cfg_value; - - if (!$locked) + if (!$toUser->getParam('message_locked', 0)) { $this->user_id_from = $fromId; $this->user_id_to = $toId; @@ -150,7 +143,7 @@ function send($fromId = null, $toId = null, $subject = null, $message = null, $m if ($this->store()) { - if ($domail) + if ($toUser->getParam('message_mail_on_new', 0)) { $query = 'SELECT name, email' . ' FROM #__users' . diff --git a/administrator/components/com_messages/toolbar.messages.html.php b/administrator/components/com_messages/toolbar.messages.html.php deleted file mode 100644 index a332c0d05f3e7..0000000000000 --- a/administrator/components/com_messages/toolbar.messages.html.php +++ /dev/null @@ -1,54 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_messages/views/message/index.html b/administrator/components/com_messages/views/message/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_messages/views/message/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_messages/views/message/tmpl/default.php b/administrator/components/com_messages/views/message/tmpl/default.php new file mode 100644 index 0000000000000..0907e366b01ad --- /dev/null +++ b/administrator/components/com_messages/views/message/tmpl/default.php @@ -0,0 +1,49 @@ + + + + +
    + + + + + + + + + + + + + + + + + + +
    + : + + row->user_from;?> +
    + : + + row->date_time;?> +
    + : + + row->subject;?> +
    + : + +
    row->message, ENT_COMPAT, 'UTF-8' );?>
    +
    + + + + + + + + +
    diff --git a/administrator/components/com_messages/views/message/tmpl/default_form.php b/administrator/components/com_messages/views/message/tmpl/default_form.php new file mode 100644 index 0000000000000..137f4cee68dfe --- /dev/null +++ b/administrator/components/com_messages/views/message/tmpl/default_form.php @@ -0,0 +1,58 @@ + + + + + +
    + + + + + + + + + + + + + + +
    + : + + recipients, 'user_id_to', 'class="inputbox" size="1"', 'value', 'text', $this->reply_user); ?> +
    + : + + +
    + : + + +
    + + + + + +
    diff --git a/administrator/components/com_messages/views/message/tmpl/index.html b/administrator/components/com_messages/views/message/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_messages/views/message/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_messages/views/message/view.html.php b/administrator/components/com_messages/views/message/view.html.php new file mode 100644 index 0000000000000..10b948a29668f --- /dev/null +++ b/administrator/components/com_messages/views/message/view.html.php @@ -0,0 +1,93 @@ +get_group_id( 'Public Backend', 'ARO' ); + $gids = $acl->get_group_children( $gid, 'ARO', 'RECURSE' ); + JArrayHelper::toInteger($gids, array(0)); + $gids = implode( ',', $gids ); + + // get list of usernames + $recipients = array( JHTML::_('select.option', '0', '- '. JText::_( 'Select User' ) .' -' ) ); + $query = 'SELECT id AS value, username AS text FROM #__users' + . ' WHERE gid IN ( '.$gids.' )' + . ' ORDER BY name' + ; + $db->setQuery( $query ); + $recipients = array_merge( $recipients, $db->loadObjectList() ); + + $this->assignRef('recipients', $recipients); + $this->assignRef('user', $user); + $this->assignRef('reply_user', $reply_user); + $this->assignRef('subject', $subject); + + $tpl = 'form'; + } + else + { + // Set toolbar items for the page + JToolBarHelper::title( JText::_( 'View Private Message' ), 'inbox.png' ); + JToolBarHelper::customX('reply', 'restore.png', 'restore_f2.png', 'Reply', false ); + JToolBarHelper::deleteList(); + JToolBarHelper::cancel(); + JToolBarHelper::help( 'screen.messages.view' ); + + $model = $this->getModel(); + $model->markAsRead(); + + $row =& $this->get('data'); + $this->assignRef('row', $row); + } + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_messages/views/messages/index.html b/administrator/components/com_messages/views/messages/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_messages/views/messages/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_messages/views/messages/tmpl/default.php b/administrator/components/com_messages/views/messages/tmpl/default.php new file mode 100644 index 0000000000000..a8f375c286d02 --- /dev/null +++ b/administrator/components/com_messages/views/messages/tmpl/default.php @@ -0,0 +1,103 @@ + + +
    + + + + + + +
    + : + + + + + filter->state, 'Read', 'Unread' ); + ?> +
    + +
    + + + + + + + + + + + + + + + + + + rows ); $i < $n; $i++) { + $row =& $this->rows[$i]; + $img = $row->state ? 'tick.png' : 'publish_x.png'; + $alt = $row->state ? JText::_( 'Read' ) : JText::_( 'Read' ); + + if ( $this->user->authorize( 'com_users', 'manage' ) ) { + $linkA = 'index.php?option=com_users&view=user&task=edit&cid[]='. $row->user_id_from; + $author = ''. $row->user_from .''; + } else { + $author = $row->user_from; + } + + ?> + "> + + + + + + + + + +
    + + + + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->limitstart;?> + + message_id ); ?> + + + subject; ?> + + + <?php echo $alt; ?> + + + + date_time, JText::_('DATE_FORMAT_LC2')); ?> +
    +
    + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_messages/views/messages/tmpl/index.html b/administrator/components/com_messages/views/messages/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_messages/views/messages/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_messages/views/messages/view.html.php b/administrator/components/com_messages/views/messages/view.html.php new file mode 100644 index 0000000000000..0f0dd1c6f01bd --- /dev/null +++ b/administrator/components/com_messages/views/messages/view.html.php @@ -0,0 +1,56 @@ +get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter'); + + $this->assignRef('user', $user); + $this->assignRef('rows', $rows); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_modules/admin.modules.html.php b/administrator/components/com_modules/admin.modules.html.php deleted file mode 100644 index 8551a8c1b021b..0000000000000 --- a/administrator/components/com_modules/admin.modules.html.php +++ /dev/null @@ -1,604 +0,0 @@ - -
    - - - - - - -
    - : - - - - - -
    - - - - - - - - - - - id == 0 ) { - ?> - - - - - - - - - - - - - - - id .'&task=edit&cid[]='. $row->id ); - - $access = JHTML::_('grid.access', $row, $i ); - $checked = JHTML::_('grid.checkedout', $row, $i ); - $published = JHTML::_('grid.published', $row, $i ); - ?> - "> - - - - - - id == 0 ) { - ?> - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - -
    - getListFooter(); ?> -
    - getRowOffset( $i ); ?> - - - - get ('id'), $row->checked_out ) ) { - echo $row->title; - } else { - ?> - - - title; ?> - - - - - - orderUpIcon( $i, ($row->position == @$rows[$i-1]->position), 'orderup', 'Move Up', $ordering ); ?> - orderDownIcon( $i, $n, ($row->position == @$rows[$i+1]->position),'orderdown', 'Move Down', $ordering ); ?> - - class="text_area" style="text-align: center" /> - - - - position; ?> - - pages )) { - echo JText::_( 'None' ); - } else if ($row->pages > 0) { - echo JText::_( 'Varies' ); - } else { - echo JText::_( 'All' ); - } - ?> - - module ? $row->module : JText::_( 'User' );?> - - id;?> -
    - - - - - - - - -
    - $row is passed with the id - * property set to 0. - * @param JTableCategory The category object - * @param array

    The modules of the left side. The array elements are in the form - * $leftorder[order] = label - * where order is the module order from the db table and label is a - * text label associciated with the order.

    - * @param array See notes for leftorder - * @param array An array of select lists - * @param object Parameters - */ - function edit( &$model, &$row, &$orders2, &$lists, &$params, $client ) - { - JRequest::setVar( 'hidemainmenu', 1 ); - - // clean item data - JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'content' ); - - // Check for component metadata.xml file - //$path = JApplicationHelper::getPath( 'mod'.$client->id.'_xml', $row->module ); - //$params = new JParameter( $row->params, $path ); - $document =& JFactory::getDocument(); - - JHTML::_('behavior.combobox'); - - jimport('joomla.html.pane'); - $pane =& JPane::getInstance('sliders'); - $editor =& JFactory::getEditor(); - - JHTML::_('behavior.tooltip'); - ?> - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - : - - - module); ?> - -
    - - - -
    - : - - -
    - : - - -
    - - - - -
    - - - -
    - - - -
    - : - - id; ?> -
    - : - - description); ?> -
    -
    -
    - - - - - - - - - - - -
    - : - - client_id != 1) : ?> - pages == 'all') { ?> - - - - pages == 'none') { ?> - - - - - - - - - -
    - : - - -
    - client_id != 1) : ?> - pages == 'all') { ?> - - pages == 'none') { ?> - - - - -
    -
    - -
    -
    - - - startPane("menu-pane"); - echo $pane->startPanel(JText :: _('Module Parameters'), "param-page"); - $p = $params; - if($params = $p->render('params')) : - echo $params; - else : - echo "
    ".JText::_('There are no parameters for this item')."
    "; - endif; - echo $pane->endPanel(); - - if ($p->getNumParams('advanced')) { - echo $pane->startPanel(JText :: _('Advanced Parameters'), "advanced-page"); - if($params = $p->render('params', 'advanced')) : - echo $params; - else : - echo "
    ".JText::_('There are no advanced parameters for this item')."
    "; - endif; - echo $pane->endPanel(); - } - - if ($p->getNumParams('legacy')) { - echo $pane->startPanel(JText :: _('Legacy Parameters'), "legacy-page"); - if($params = $p->render('params', 'legacy')) : - echo $params; - else : - echo "
    ".JText::_('There are no legacy parameters for this item')."
    "; - endif; - echo $pane->endPanel(); - } - - - if ($p->getNumParams('other')) { - echo $pane->startPanel(JText :: _('Other Parameters'), "other-page"); - if($params = $p->render('params', 'other')) : - echo $params; - else : - echo "
    ".JText::_('There are no other parameters for this item')."
    "; - endif; - echo $pane->endPanel(); - } - echo $pane->endPane(); - ?> -
    -
    -
    - - module || $row->module == 'custom' || $row->module == 'mod_custom' ) { - ?> -
    - - - display( 'content', $row->content, '100%', '400', '60', '20', array('pagebreak', 'readmore') ) ; - ?> - -
    - - - - - - - - - - -
    - - - - - - - - - - -
    - -
    - - - - - - - - - - - - - - module .'&created=1&client='. $client->id; - if ( !$k ) { - ?> - " valign="top"> - - - - - - - -
    - -
      -
    - name); ?> -
    - - - - - - - -
    - id; + $db->setQuery( $query ); + $assigned[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select Template' ) .' -' ); + $assigned = array_merge( $assigned, $db->loadObjectList() ); + return JHTML::_('select.genericlist', $assigned, 'filter_assigned', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected ); + } + + function position($client, $selected = null) + { + $db =& JFactory::getDBO(); + + // get list of Positions for dropdown filter + $query = 'SELECT m.position AS value, m.position AS text' + . ' FROM #__modules as m' + . ' WHERE m.client_id = '.(int) $client->id + . ' GROUP BY m.position' + . ' ORDER BY m.position' + ; + $positions[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select Position' ) .' -' ); + $db->setQuery( $query ); + $positions = array_merge( $positions, $db->loadObjectList() ); + return JHTML::_('select.genericlist', $positions, 'filter_position', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected ); + } + + function type($client, $selected = null) + { + $db =& JFactory::getDBO(); + + // get list of Positions for dropdown filter + $query = 'SELECT module AS value, module AS text' + . ' FROM #__modules' + . ' WHERE client_id = '.(int) $client->id + . ' GROUP BY module' + . ' ORDER BY module' + ; + $db->setQuery( $query ); + $types[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select Type' ) .' -' ); + $types = array_merge( $types, $db->loadObjectList() ); + return JHTML::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected ); + } +} diff --git a/administrator/components/com_modules/classes/index.html b/administrator/components/com_modules/classes/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_modules/classes/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_modules/controller.php b/administrator/components/com_modules/controller.php index 25f83511674ce..c5483e81ddc8f 100644 --- a/administrator/components/com_modules/controller.php +++ b/administrator/components/com_modules/controller.php @@ -17,15 +17,6 @@ jimport( 'joomla.application.component.controller' ); -$client = JRequest::getVar('client', 0, '', 'int'); -if ($client == 1) { - JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_modules&client_id=0'); - JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_modules&client=1', true ); -} else { - JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_modules&client_id=0', true ); - JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_modules&client=1'); -} - class ModulesController extends JController { /** @@ -45,135 +36,6 @@ function __construct( $config = array() ) $this->registerTask( 'accessspecial', 'access' ); } - /** - * Compiles a list of installed or defined modules - */ - function view() - { - global $mainframe; - - // Initialize some variables - $db =& JFactory::getDBO(); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $option = 'com_modules'; - - $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'm.position', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); - $filter_state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); - $filter_position = $mainframe->getUserStateFromRequest( $option.'filter_position', 'filter_position', '', 'cmd' ); - $filter_type = $mainframe->getUserStateFromRequest( $option.'filter_type', 'filter_type', '', 'cmd' ); - $filter_assigned = $mainframe->getUserStateFromRequest( $option.'filter_assigned', 'filter_assigned', '', 'cmd' ); - $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); - $search = JString::strtolower( $search ); - - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); - $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); - - $where[] = 'm.client_id = '.(int) $client->id; - - $joins[] = 'LEFT JOIN #__users AS u ON u.id = m.checked_out'; - $joins[] = 'LEFT JOIN #__groups AS g ON g.id = m.access'; - $joins[] = 'LEFT JOIN #__modules_menu AS mm ON mm.moduleid = m.id'; - - // used by filter - if ( $filter_assigned ) { - $joins[] = 'LEFT JOIN #__templates_menu AS t ON t.menuid = mm.menuid'; - $where[] = 't.template = '.$db->Quote($filter_assigned); - } - if ( $filter_position ) { - $where[] = 'm.position = '.$db->Quote($filter_position); - } - if ( $filter_type ) { - $where[] = 'm.module = '.$db->Quote($filter_type); - } - if ( $search ) { - $where[] = 'LOWER( m.title ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); - } - if ( $filter_state ) { - if ( $filter_state == 'P' ) { - $where[] = 'm.published = 1'; - } else if ($filter_state == 'U' ) { - $where[] = 'm.published = 0'; - } - } - - $where = ' WHERE ' . implode( ' AND ', $where ); - $join = ' ' . implode( ' ', $joins ); - $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', m.ordering ASC'; - - // get the total number of records - $query = 'SELECT COUNT(DISTINCT m.id)' - . ' FROM #__modules AS m' - . $join - . $where - ; - $db->setQuery( $query ); - $total = $db->loadResult(); - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $total, $limitstart, $limit ); - - $query = 'SELECT m.*, u.name AS editor, g.name AS groupname, MIN(mm.menuid) AS pages' - . ' FROM #__modules AS m' - . $join - . $where - . ' GROUP BY m.id' - . $orderby - ; - $db->setQuery( $query, $pageNav->limitstart, $pageNav->limit ); - $rows = $db->loadObjectList(); - if ($db->getErrorNum()) { - echo $db->stderr(); - return false; - } - - // get list of Positions for dropdown filter - $query = 'SELECT m.position AS value, m.position AS text' - . ' FROM #__modules as m' - . ' WHERE m.client_id = '.(int) $client->id - . ' GROUP BY m.position' - . ' ORDER BY m.position' - ; - $positions[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select Position' ) .' -' ); - $db->setQuery( $query ); - $positions = array_merge( $positions, $db->loadObjectList() ); - $lists['position'] = JHTML::_('select.genericlist', $positions, 'filter_position', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', "$filter_position" ); - - // get list of Positions for dropdown filter - $query = 'SELECT module AS value, module AS text' - . ' FROM #__modules' - . ' WHERE client_id = '.(int) $client->id - . ' GROUP BY module' - . ' ORDER BY module' - ; - $db->setQuery( $query ); - $types[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select Type' ) .' -' ); - $types = array_merge( $types, $db->loadObjectList() ); - $lists['type'] = JHTML::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', "$filter_type" ); - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state ); - - // template assignment filter - $query = 'SELECT DISTINCT(template) AS text, template AS value'. - ' FROM #__templates_menu' . - ' WHERE client_id = '.(int) $client->id; - $db->setQuery( $query ); - $assigned[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select Template' ) .' -' ); - $assigned = array_merge( $assigned, $db->loadObjectList() ); - $lists['assigned'] = JHTML::_('select.genericlist', $assigned, 'filter_assigned', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', "$filter_assigned" ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - require_once( JApplicationHelper::getPath( 'admin_html' ) ); - HTML_modules::view( $rows, $client, $pageNav, $lists ); - } - /** * Compiles information to add or edit a module * @param string The current GET/POST option @@ -184,63 +46,24 @@ function copy() // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - // Initialize some variables - $db =& JFactory::getDBO(); $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $this->setRedirect( 'index.php?option=com_modules&client='.$client->id ); $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger( $cid ); $n = count( $cid ); if ($n == 0) { return JError::raiseWarning( 500, JText::_( 'No items selected' ) ); } - $row =& JTable::getInstance('module'); - $tuples = array(); - - foreach ($cid as $id) - { - // load the row from the db table - $row->load( (int) $id ); - $row->title = JText::sprintf( 'Copy of', $row->title ); - $row->id = 0; - $row->iscore = 0; - $row->published = 0; - - if (!$row->check()) { - return JError::raiseWarning( 500, $row->getError() ); - } - if (!$row->store()) { - return JError::raiseWarning( 500, $row->getError() ); - } - $row->checkin(); - - $row->reorder( 'position='.$db->Quote( $row->position ).' AND client_id='.(int) $client->id ); - - $query = 'SELECT menuid' - . ' FROM #__modules_menu' - . ' WHERE moduleid = '.(int) $cid[0] - ; - $db->setQuery( $query ); - $rows = $db->loadResultArray(); - - foreach ($rows as $menuid) { - $tuples[] = '('.(int) $row->id.','.(int) $menuid.')'; - } - } + $model = $this->getModel('module'); - if (!empty( $tuples )) - { - // Module-Menu Mapping: Do it in one query - $query = 'INSERT INTO #__modules_menu (moduleid,menuid) VALUES '.implode( ',', $tuples ); - $db->setQuery( $query ); - if (!$db->query()) { - return JError::raiseWarning( 500, $row->getError() ); - } + if ($model->copy($cid)) { + $msg = JText::sprintf( 'Items Copied', $n ); + } else { + $msg = JText::_( 'Error Copying Module(s)' ); } - $msg = JText::sprintf( 'Items Copied', $n ); $this->setRedirect( 'index.php?option=com_modules&client='. $client->id, $msg ); } @@ -252,249 +75,53 @@ function save() // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - global $mainframe; - $cache = & JFactory::getCache(); $cache->clean( 'com_content' ); - // Initialize some variables - $db =& JFactory::getDBO(); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $this->setRedirect( 'index.php?option=com_modules&client='.$client->id ); - $post = JRequest::get( 'post' ); // fix up special html fields $post['content'] = JRequest::getVar( 'content', '', 'post', 'string', JREQUEST_ALLOWRAW ); $post['client_id'] = $client->id; - $row =& JTable::getInstance('module'); - - if (!$row->bind( $post, 'selections' )) { - return JError::raiseWarning( 500, $row->getError() ); - } - - if (!$row->check()) { - return JError::raiseWarning( 500, $row->getError() ); - } - - // if new item, order last in appropriate group - if (!$row->id) { - $where = 'position='.$db->Quote( $row->position ).' AND client_id='.(int) $client->id ; - $row->ordering = $row->getNextOrder( $where ); - } + $model = $this->getModel('module'); - if (!$row->store()) { - return JError::raiseWarning( 500, $row->getError() ); - } - $row->checkin(); - - $menus = JRequest::getVar( 'menus', '', 'post', 'word' ); - $selections = JRequest::getVar( 'selections', array(), 'post', 'array' ); - JArrayHelper::toInteger($selections); - - // delete old module to menu item associations - $query = 'DELETE FROM #__modules_menu' - . ' WHERE moduleid = '.(int) $row->id - ; - $db->setQuery( $query ); - if (!$db->query()) { - return JError::raiseWarning( 500, $row->getError() ); + if ($model->store($post)) { + $msg = JText::_( 'Module Saved' ); + } else { + $msg = JText::_( 'Error Saving Module' ); } - // check needed to stop a module being assigned to `All` - // and other menu items resulting in a module being displayed twice - if ( $menus == 'all' ) { - // assign new module to `all` menu item associations - $query = 'INSERT INTO #__modules_menu' - . ' SET moduleid = '.(int) $row->id.' , menuid = 0' - ; - $db->setQuery( $query ); - if (!$db->query()) { - return JError::raiseWarning( 500, $row->getError() ); - } - } - else - { - foreach ($selections as $menuid) - { - // this check for the blank spaces in the select box that have been added for cosmetic reasons - if ( (int) $menuid >= 0 ) { - // assign new module to menu item associations - $query = 'INSERT INTO #__modules_menu' - . ' SET moduleid = '.(int) $row->id .', menuid = '.(int) $menuid - ; - $db->setQuery( $query ); - if (!$db->query()) { - return JError::raiseWarning( 500, $row->getError() ); - } - } - } - } + // Check the table in so it can be edited.... we are done with it anyway + $model->checkin(); + $client = $model->getClient(); $this->setMessage( JText::_( 'Item saved' ) ); switch ($this->getTask()) { + case 'save': + $this->setRedirect( 'index.php?option=com_modules&client='. $client->id ); + break; + case 'apply': - $this->setRedirect( 'index.php?option=com_modules&client='. $client->id .'&task=edit&id='. $row->id ); + $this->setRedirect( 'index.php?option=com_modules&client='. $client->id .'&task=edit&id='. $model->_id ); break; } } /** - * Compiles information to add or edit a module - * @param string The current GET/POST option - * @param integer The unique id of the record to edit + * Compiles information to edit a module */ - function edit( ) + function edit() { - // Initialize some variables - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $module = JRequest::getVar( 'module', '', '', 'cmd' ); - $id = JRequest::getVar( 'id', 0, 'method', 'int' ); - $cid = JRequest::getVar( 'cid', array( $id ), 'method', 'array' ); - JArrayHelper::toInteger($cid, array(0)); - - $model = &$this->getModel('module'); - $model->setState( 'id', $cid[0] ); - $model->setState( 'clientId', $client->id ); - - $lists = array(); - $row =& JTable::getInstance('module'); - // load the row from the db table - $row->load( (int) $cid[0] ); - // fail if checked out not by 'me' - if ($row->isCheckedOut( $user->get('id') )) { - $this->setRedirect( 'index.php?option=com_modules&client='.$client->id ); - return JError::raiseWarning( 500, JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The module' ), $row->title ) ); - } - - $row->content = htmlspecialchars( str_replace( '&', '&', $row->content ), ENT_COMPAT, 'UTF-8' ); - - if ( $cid[0] ) { - $row->checkout( $user->get('id') ); - } - // if a new record we must still prime the JTableModel object with a default - // position and the order; also add an extra item to the order list to - // place the 'new' record in last position if desired - if ($cid[0] == 0) { - $row->position = 'left'; - $row->showtitle = true; - $row->published = 1; - //$row->ordering = $l; - - $row->module = $module; - } - - if ($client->id == 1) - { - $where = 'client_id = 1'; - $lists['client_id'] = 1; - $path = 'mod1_xml'; - } - else - { - $where = 'client_id = 0'; - $lists['client_id'] = 0; - $path = 'mod0_xml'; - } - - $query = 'SELECT position, ordering, showtitle, title' - . ' FROM #__modules' - . ' WHERE '. $where - . ' ORDER BY ordering' - ; - $db->setQuery( $query ); - if ( !($orders = $db->loadObjectList()) ) { - echo $db->stderr(); - return false; - } - - $orders2 = array(); - - $l = 0; - $r = 0; - for ($i=0, $n=count( $orders ); $i < $n; $i++) { - $ord = 0; - if (array_key_exists( $orders[$i]->position, $orders2 )) { - $ord =count( array_keys( $orders2[$orders[$i]->position] ) ) + 1; - } - - $orders2[$orders[$i]->position][] = JHTML::_('select.option', $ord, $ord.'::'.addslashes( $orders[$i]->title ) ); - } - - // get selected pages for $lists['selections'] - if ( $cid[0] ) { - $query = 'SELECT menuid AS value' - . ' FROM #__modules_menu' - . ' WHERE moduleid = '.(int) $row->id - ; - $db->setQuery( $query ); - $lookup = $db->loadObjectList(); - if (empty( $lookup )) { - $lookup = array( JHTML::_('select.option', '-1' ) ); - $row->pages = 'none'; - } elseif (count($lookup) == 1 && $lookup[0]->value == 0) { - $row->pages = 'all'; - } else { - $row->pages = null; - } - } else { - $lookup = array( JHTML::_('select.option', 0, JText::_( 'All' ) ) ); - $row->pages = 'all'; - } - - if ( $row->access == 99 || $row->client_id == 1 || $lists['client_id'] ) { - $lists['access'] = 'Administrator'; - $lists['showtitle'] = 'N/A '; - $lists['selections'] = 'N/A'; - } else { - if ( $client->id == '1' ) { - $lists['access'] = 'N/A'; - $lists['selections'] = 'N/A'; - } else { - $lists['access'] = JHTML::_('list.accesslevel', $row ); - - $selections = JHTML::_('menu.linkoptions'); - $lists['selections'] = JHTML::_('select.genericlist', $selections, 'selections[]', 'class="inputbox" size="15" multiple="multiple"', 'value', 'text', $lookup, 'selections' ); - } - $lists['showtitle'] = JHTML::_('select.booleanlist', 'showtitle', 'class="inputbox"', $row->showtitle ); - } - - // build the html select list for published - $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published ); + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'module'); + JRequest::setVar( 'edit', true ); - $row->description = ''; + // Checkout the module + $model = $this->getModel('module'); + $model->checkout(); - $lang =& JFactory::getLanguage(); - if ( $client->id != '1' ) { - $lang->load( trim($row->module), JPATH_SITE ); - } else { - $lang->load( trim($row->module) ); - } - - // xml file for module - if ($row->module == 'custom') { - $xmlfile = JApplicationHelper::getPath( $path, 'mod_custom' ); - } else { - $xmlfile = JApplicationHelper::getPath( $path, $row->module ); - } - - $data = JApplicationHelper::parseXMLInstallFile($xmlfile); - if ($data) - { - foreach($data as $key => $value) { - $row->$key = $value; - } - } - - // get params definitions - $params = new JParameter( $row->params, $xmlfile, 'module' ); - - require_once( JApplicationHelper::getPath( 'admin_html' ) ); - HTML_modules::edit( $model, $row, $orders2, $lists, $params, $client ); + parent::display(); } /** @@ -502,48 +129,16 @@ function edit( ) */ function add() { - global $mainframe; - - // Initialize some variables - $modules = array(); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - - // path to search for modules - if ($client->id == '1') { - $path = JPATH_ADMINISTRATOR.DS.'modules'; - $langbase = JPATH_ADMINISTRATOR; - } else { - $path = JPATH_ROOT.DS.'modules'; - $langbase = JPATH_ROOT; - } - - jimport('joomla.filesystem.folder'); - $dirs = JFolder::folders( $path ); - $lang =& JFactory::getLanguage(); - - foreach ($dirs as $dir) - { - if (substr( $dir, 0, 4 ) == 'mod_') - { - $files = JFolder::files( $path.DS.$dir, '^([_A-Za-z0-9]*)\.xml$' ); - $module = new stdClass; - $module->file = $files[0]; - $module->module = str_replace( '.xml', '', $files[0] ); - $module->path = $path.DS.$dir; - $modules[] = $module; - - $lang->load( $module->module, $langbase ); - } - } - - require_once( JPATH_COMPONENT.DS.'helpers'.DS.'xml.php' ); - ModulesHelperXML::parseXMLModuleFile( $modules, $client ); + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'selecttype'); + JRequest::setVar( 'edit', false ); - // sort array of objects alphabetically by name - JArrayHelper::sortObjects( $modules, 'name' ); + // Checkout the module + $model = $this->getModel('module'); + $model->checkout(); - require_once( JApplicationHelper::getPath( 'admin_html' ) ); - HTML_modules::add( $modules, $client ); + parent::display(); + return; } /** @@ -554,52 +149,27 @@ function add() */ function remove() { - global $mainframe; - // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - // Initialize some variables - $db =& JFactory::getDBO(); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $this->setRedirect( 'index.php?option=com_modules&client='.$client->id ); - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); JArrayHelper::toInteger( $cid ); + $n = count( $cid ); - if (empty( $cid )) { + if ($n == 0) { return JError::raiseWarning( 500, 'No items selected' ); } - $cids = implode( ',', $cid ); - - // pasamio: Disabled this as it breaks the uninstall ability! - /*$query = 'SELECT id, module, title, iscore, params' - . ' FROM #__modules WHERE id IN ('.$cids.')' - ; - $db->setQuery( $query ); - if (!($rows = $db->loadObjectList())) { - return JError::raiseError( 500, $db->getErrorMsg() ); - }*/ - - // remove mappings first (lest we leave orphans) - $query = 'DELETE FROM #__modules_menu' - . ' WHERE moduleid IN ( '.$cids.' )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - return JError::raiseError( 500, $db->getErrorMsg() ); - } - // remove module - $query = 'DELETE FROM #__modules' - . ' WHERE id IN ('.$cids.')' - ; - $db->setQuery( $query ); - if (!$db->query()) { - return JError::raiseError( 500, $db->getErrorMsg() ); + $model = $this->getModel('module'); + + if ($model->delete($cid)) { + $msg = JText::sprintf( 'Items removed', $n ); + } else { + $msg = JText::_( 'Error Deleting' ); } - $this->setMessage( JText::sprintf( 'Items removed', count( $cid ) ) ); + $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); + $this->setRedirect( 'index.php?option=com_modules&client='.$client->id, $msg ); } /** @@ -607,46 +177,29 @@ function remove() */ function publish() { - global $mainframe; - // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); // Initialize some variables - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $this->setRedirect( 'index.php?option=com_modules&client='.$client->id ); + $task = $this->getTask(); + $publish = ($task == 'publish'); $cache = & JFactory::getCache(); $cache->clean( 'com_content' ); $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); JArrayHelper::toInteger($cid); - - $task = $this->getTask(); - $publish = ($task == 'publish'); - if (empty( $cid )) { return JError::raiseWarning( 500, 'No items selected' ); } - $cids = implode( ',', $cid ); - - $query = 'UPDATE #__modules' - . ' SET published = ' . intval( $publish ) - . ' WHERE id IN ( '.$cids.' )' - . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - return JError::raiseWarning( 500, $db->getErrorMsg() ); + $model = $this->getModel('module'); + if(!$model->publish($cid, $publish)) { + echo "\n"; } - if (count( $cid ) == 1) { - $row =& JTable::getInstance('module'); - $row->checkin( $cid[0] ); - } + $this->setRedirect( 'index.php?option=com_modules&client='.$client->id ); } /** @@ -654,20 +207,14 @@ function publish() */ function cancel() { - global $mainframe; - // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - // Initialize some variables - $db =& JFactory::getDBO(); + $model = $this->getModel('module'); + $model->checkin(); + $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); $this->setRedirect( 'index.php?option=com_modules&client='.$client->id ); - - $row =& JTable::getInstance('module'); - // ignore array elements - $row->bind(JRequest::get('post'), 'selections params' ); - $row->checkin(); } /** @@ -675,16 +222,9 @@ function cancel() */ function reorder() { - global $mainframe; - // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - // Initialize some variables - $db =& JFactory::getDBO(); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $this->setRedirect( 'index.php?option=com_modules&client='.$client->id ); - $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); JArrayHelper::toInteger($cid); @@ -695,10 +235,14 @@ function reorder() return JError::raiseWarning( 500, 'No items selected' ); } - $row =& JTable::getInstance('module'); - $row->load( (int) $cid[0] ); + $model = $this->getModel('module'); + + if (!$model->move($inc)) { + $msg = $model->getError(); + } - $row->move( $inc, 'position = '.$db->Quote( $row->position ).' AND client_id='.(int) $client->id ); + $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); + $this->setRedirect( 'index.php?option=com_modules&client='.$client->id, $msg ); } /** @@ -706,25 +250,20 @@ function reorder() */ function access() { - global $mainframe; - // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); // Initialize some variables - $db =& JFactory::getDBO(); $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $this->setRedirect( 'index.php?option=com_modules&client='.$client->id ); $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); JArrayHelper::toInteger($cid); - $task = JRequest::getCmd( 'task' ); - if (empty( $cid )) { return JError::raiseWarning( 500, 'No items selected' ); } + $task = JRequest::getCmd( 'task' ); switch ( $task ) { case 'accesspublic': @@ -740,16 +279,13 @@ function access() break; } - $row =& JTable::getInstance('module'); - $row->load( (int) $cid[0] ); - $row->access = $access; - - if ( !$row->check() ) { - JError::raiseWarning( 500, $row->getError() ); - } - if ( !$row->store() ) { - JError::raiseWarning( 500, $row->getError() ); + $msg = ''; + $model = $this->getModel('module'); + if(!$model->setAccess($cid, $access)) { + $msg = $model->getError(); } + + $this->setRedirect( 'index.php?option=com_modules&client='.$client->id, $msg ); } /** @@ -761,9 +297,6 @@ function saveOrder() JRequest::checkToken() or jexit( 'Invalid Token' ); // Initialize some variables - $db =& JFactory::getDBO(); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $this->setRedirect( 'index.php?option=com_modules&client='.$client->id ); $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); JArrayHelper::toInteger($cid); @@ -772,44 +305,24 @@ function saveOrder() return JError::raiseWarning( 500, 'No items selected' ); } - $total = count( $cid ); - $row =& JTable::getInstance('module'); - $groupings = array(); - $order = JRequest::getVar( 'order', array(0), 'post', 'array' ); JArrayHelper::toInteger($order); - // update ordering values - for ($i = 0; $i < $total; $i++) - { - $row->load( (int) $cid[$i] ); - // track postions - $groupings[] = $row->position; - - if ($row->ordering != $order[$i]) - { - $row->ordering = $order[$i]; - if (!$row->store()) { - return JError::raiseWarning( 500, $db->getErrorMsg() ); - } - } - } + $model = $this->getModel('module'); + $model->saveorder($cid, $order); - // execute updateOrder for each parent group - $groupings = array_unique( $groupings ); - foreach ($groupings as $group){ - $row->reorder('position = '.$db->Quote($group).' AND client_id = '.(int) $client->id); - } - - $this->setMessage (JText::_( 'New ordering saved' )); + $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); + $msg = JText::_( 'New ordering saved' ); + $this->setRedirect( 'index.php?option=com_modules&client='.$client->id, $msg ); } function preview() { + JRequest::setVar( 'view', 'prevuuw'); + $document =& JFactory::getDocument(); $document->setTitle(JText::_('Module Preview')); - require_once( JApplicationHelper::getPath( 'admin_html' ) ); - HTML_modules::preview( ); + parent::display(); } } \ No newline at end of file diff --git a/administrator/components/com_modules/helpers/index.html b/administrator/components/com_modules/helpers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_modules/helpers/index.html +++ b/administrator/components/com_modules/helpers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_modules/index.html b/administrator/components/com_modules/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_modules/index.html +++ b/administrator/components/com_modules/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_modules/models/index.html b/administrator/components/com_modules/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_modules/models/index.html +++ b/administrator/components/com_modules/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_modules/models/module.php b/administrator/components/com_modules/models/module.php index 344ce15ff4b2d..69799bb99bda9 100644 --- a/administrator/components/com_modules/models/module.php +++ b/administrator/components/com_modules/models/module.php @@ -25,18 +25,85 @@ class ModulesModelModule extends JModel { var $_xml; - function &getModule() + /** + * module id + * + * @var int + */ + var $_id = null; + + /** + * module data + * + * @var array + */ + var $_data = null; + + /** + * client object + * + * @var object + */ + var $_client = null; + + /** + * Constructor + * + * @since 1.5 + */ + function __construct() { - static $instance; + parent::__construct(); - if (!$instance) - { - $instance = $this->getTable( 'Module', 'JTable' ); - if ($id = $this->getState( 'id' )) { - $instance->load( (int) $id ); - } - } - return $instance; + $id = JRequest::getVar('id',null); + $array = JRequest::getVar('cid', array($id), '', 'array'); + $edit = JRequest::getVar('edit',true); + if($edit) + $this->setId((int)$array[0]); + + $this->_client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); + } + + /** + * Method to set the module identifier + * + * @access public + * @param int module identifier + */ + function setId($id) + { + // Set module id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a module + * + * @since 1.6 + */ + function &getData() + { + // Load the data + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Method to get the client object + * + * @since 1.6 + */ + function &getClient() + { + return $this->_client; + } + + function &getModule() + { + return $this->getData(); } function &_getXML() @@ -45,7 +112,7 @@ function &_getXML() { $clientId = $this->getState( 'clientId', 0 ); $path = ($clientId == 1) ? 'mod1_xml' : 'mod0_xml'; - $module = &$this->getModule(); + $module = &$this->getData(); if ($module->module == 'custom') { $xmlpath = JApplicationHelper::getPath( $path, 'mod_custom' ); @@ -67,7 +134,7 @@ function &_getXML() function &getParams() { // Get the state parameters - $module =& $this->getModule(); + $module =& $this->getData(); $params = new JParameter($module->params); if ($xml =& $this->_getXML()) @@ -86,27 +153,19 @@ function getPositions() { jimport('joomla.filesystem.folder'); - $client =& JApplicationHelper::getClientInfo($this->getState('clientId')); - if ($client === false) { - return false; - } - - //Get the database object - $db =& JFactory::getDBO(); - // template assignment filter $query = 'SELECT DISTINCT(template) AS text, template AS value'. ' FROM #__templates_menu' . - ' WHERE client_id = '.(int) $client->id; - $db->setQuery( $query ); - $templates = $db->loadObjectList(); + ' WHERE client_id = '.(int) $this->_client->id; + $this->_db->setQuery( $query ); + $templates = $this->_db->loadObjectList(); // Get a list of all module positions as set in the database $query = 'SELECT DISTINCT(position)'. ' FROM #__modules' . - ' WHERE client_id = '.(int) $client->id; - $db->setQuery( $query ); - $positions = $db->loadResultArray(); + ' WHERE client_id = '.(int) $this->_client->id; + $this->_db->setQuery( $query ); + $positions = $this->_db->loadResultArray(); $positions = (is_array($positions)) ? $positions : array(); // Get a list of all template xml files for a given application @@ -120,7 +179,7 @@ function getPositions() if ($xml->loadFile($path.DS.'templateDetails.xml')) { $p =& $xml->document->getElementByPath('positions'); - if (is_a($p, 'JSimpleXMLElement') && count($p->children())) + if ($p INSTANCEOF JSimpleXMLElement && count($p->children())) { foreach ($p->children() as $child) { @@ -132,39 +191,439 @@ function getPositions() } } - if(defined('_JLEGACY') && _JLEGACY == '1.0') - { - $positions[] = 'left'; - $positions[] = 'right'; - $positions[] = 'top'; - $positions[] = 'bottom'; - $positions[] = 'inset'; - $positions[] = 'banner'; - $positions[] = 'header'; - $positions[] = 'footer'; - $positions[] = 'newsflash'; - $positions[] = 'legals'; - $positions[] = 'pathway'; - $positions[] = 'breadcrumb'; - $positions[] = 'user1'; - $positions[] = 'user2'; - $positions[] = 'user3'; - $positions[] = 'user4'; - $positions[] = 'user5'; - $positions[] = 'user6'; - $positions[] = 'user7'; - $positions[] = 'user8'; - $positions[] = 'user9'; - $positions[] = 'advert1'; - $positions[] = 'advert2'; - $positions[] = 'advert3'; - $positions[] = 'debug'; - $positions[] = 'syndicate'; - } - $positions = array_unique($positions); sort($positions); return $positions; } + + /** + * Tests if module is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.6 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_id) + { + $module =& JTable::getInstance('module'); + if (!$module->load($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return $module->isCheckedOut($uid); + } + } + + /** + * Method to checkin/unlock the module + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function checkin() + { + if ($this->_id) + { + $module =& JTable::getInstance('module'); + if(! $module->checkin($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + return false; + } + + /** + * Method to checkout/lock the module + * + * @access public + * @param int $uid User ID of the user checking out + * @return boolean True on success + * @since 1.6 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the article with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $module =& JTable::getInstance('module'); + if(!$module->checkout($uid, $this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + return false; + } + + /** + * Method to store the module + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function store($data) + { + $row =& JTable::getInstance('module'); + + // Bind the form fields to the web link table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Make sure the data table is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // if new item, order last in appropriate group + if (!$row->id) { + $where = 'position='.$this->_db->Quote( $row->position ).' AND client_id='.(int) $this->_client->id ; + $row->ordering = $row->getNextOrder( $where ); + } + + // Store the web link table to the database + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + $menus = JRequest::getVar( 'menus', '', 'post', 'word' ); + $selections = JRequest::getVar( 'selections', array(), 'post', 'array' ); + JArrayHelper::toInteger($selections); + + // delete old module to menu item associations + $query = 'DELETE FROM #__modules_menu' + . ' WHERE moduleid = '.(int) $row->id + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + return JError::raiseWarning( 500, $row->getError() ); + } + + // check needed to stop a module being assigned to `All` + // and other menu items resulting in a module being displayed twice + if ( $menus == 'all' ) { + // assign new module to `all` menu item associations + $query = 'INSERT INTO #__modules_menu' + . ' SET moduleid = '.(int) $row->id.' , menuid = 0' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + return JError::raiseWarning( 500, $row->getError() ); + } + } + else + { + $sign = ($menus == 'deselect') ? -1 : 1; + foreach ($selections as $menuid) + { + /* + * This checks for the blank spaces in the select box that have + * been added for cosmetic reasons. + */ + $menuid = (int) $menuid; + if ($menuid >= 0) { + // assign new module to menu item associations + $query = 'INSERT INTO #__modules_menu' + . ' SET moduleid = ' . (int) $row->id . ', menuid = ' . ($sign * $menuid) + ; + $this->_db->setQuery($query); + if (!$this->_db->query()) { + return JError::raiseWarning(500, $row->getError()); + } + } + } + } + + return true; + } + + /** + * Method to remove a module + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + // remove mappings first (lest we leave orphans) + $query = 'DELETE FROM #__modules_menu' + . ' WHERE moduleid IN ( '.$cids.' )' + ; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + } + // remove module + $query = 'DELETE FROM #__modules' + . ' WHERE id IN ( '.$cids.' )' + ; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to (un)publish a module + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function publish($cid = array(), $publish = 1) + { + $user =& JFactory::getUser(); + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__modules' + . ' SET published = '.(int) $publish + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to set the access + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function setAccess($cid = array(), $access = 0) + { + if (count( $cid )) + { + $user =& JFactory::getUser(); + + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__modules' + . ' SET access = '.(int) $access + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to copy modules + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function copy($cid = array()) + { + $row =& JTable::getInstance('module'); + $tuples = array(); + + foreach ($cid as $id) + { + // load the row from the db table + $row->load( (int) $id ); + $row->title = JText::sprintf( 'Copy of', $row->title ); + $row->id = 0; + $row->iscore = 0; + $row->published = 0; + + if (!$row->check()) { + return JError::raiseWarning( 500, $row->getError() ); + } + if (!$row->store()) { + return JError::raiseWarning( 500, $row->getError() ); + } + $row->checkin(); + + $row->reorder( 'position='.$this->_db->Quote( $row->position ).' AND client_id='.(int) $client->id ); + + $query = 'SELECT menuid' + . ' FROM #__modules_menu' + . ' WHERE moduleid = '.(int) $cid[0] + ; + $this->_db->setQuery( $query ); + $rows = $this->_db->loadResultArray(); + + foreach ($rows as $menuid) { + $tuples[] = '('.(int) $row->id.','.(int) $menuid.')'; + } + } + + if (!empty( $tuples )) + { + // Module-Menu Mapping: Do it in one query + $query = 'INSERT INTO #__modules_menu (moduleid,menuid) VALUES '.implode( ',', $tuples ); + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + return JError::raiseWarning( 500, $row->getError() ); + } + } + + return true; + } + + /** + * Method to move a module + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function move($direction) + { + $row =& JTable::getInstance('module'); + if (!$row->load($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if (!$row->move( $direction, 'position = '.$this->_db->Quote( $row->position ).' AND client_id='.(int) $client->id )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to move a module + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function saveorder($cid = array(), $order) + { + $total = count( $cid ); + + $row =& JTable::getInstance('module'); + $groupings = array(); + + // update ordering values + for ($i = 0; $i < $total; $i++) + { + $row->load( (int) $cid[$i] ); + // track postions + $groupings[] = $row->position; + + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) { + return JError::raiseWarning( 500, $this->_db->getErrorMsg() ); + } + } + } + + // execute updateOrder for each parent group + $groupings = array_unique( $groupings ); + foreach ($groupings as $group){ + $row->reorder('position = '.$this->_db->Quote($group).' AND client_id = '.(int) $client->id); + } + + return true; + } + + /** + * Method to load module data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = 'SELECT m.*'. + ' FROM #__modules AS m' . + ' WHERE m.id = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the module data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $module = new stdClass(); + $module->id = 0; + $module->title = null; + $module->content = null; + $module->ordering = 0; + $module->position = null; + $module->checked_out = 0; + $module->checked_out_time = 0; + $module->published = 0; + $module->module = null; + $module->numnews = 0; + $module->access = 0; + $module->showtitle = 0; + $module->params = null; + $module->iscore = 0; + $module->client_id = 0; + $module->control = null; + $this->_data = $module; + return (boolean) $this->_data; + } + return true; + } } diff --git a/administrator/components/com_modules/models/modules.php b/administrator/components/com_modules/models/modules.php new file mode 100644 index 0000000000000..2327facf945c0 --- /dev/null +++ b/administrator/components/com_modules/models/modules.php @@ -0,0 +1,237 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + // In case limit has been changed, adjust limitstart accordingly + $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'm.position', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter->position = $mainframe->getUserStateFromRequest( $option.'filter_position', 'filter_position', '', 'cmd' ); + $filter->type = $mainframe->getUserStateFromRequest( $option.'filter_type', 'filter_type', '', 'cmd' ); + $filter->assigned = $mainframe->getUserStateFromRequest( $option.'filter_assigned', 'filter_assigned', '', 'cmd' ); + $filter->search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $this->_filter = $filter; + + $this->_client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', 0, '', 'int')); + } + + /** + * Method to get Modules item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + } + + return $this->_data; + } + + /** + * Method to get the total number of Module items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the Modules + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the Modules + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + /** + * Method to get the client object + * + * @access public + * @return object + */ + function getClient() + { + return $this->_client; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $join = ''; + if ( $this->_filter->assigned ) { + $join = ' LEFT JOIN #__templates_menu AS t ON t.menuid = mm.menuid'; + } + + $query = 'SELECT m.*, u.name AS editor, g.name AS groupname, MIN(mm.menuid) AS pages' + . ' FROM #__modules AS m' + . ' LEFT JOIN #__users AS u ON u.id = m.checked_out' + . ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = m.access' + . ' LEFT JOIN #__modules_menu AS mm ON mm.moduleid = m.id' + . $join + . $where + . ' GROUP BY m.id' + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy() + { + $orderby = ' ORDER BY '. $this->_filter->order .' '. $this->_filter->order_Dir .', m.ordering ASC'; + return $orderby; + } + + function _buildContentWhere() + { + $search = JString::strtolower( $this->_filter->search ); + + $where = array(); + $where[] = 'm.client_id = '.(int) $this->_client->id; + + if ( $this->_filter->assigned ) { + $joins[] = 'LEFT JOIN #__templates_menu AS t ON t.menuid = mm.menuid'; + $where[] = 't.template = '.$this->_db->Quote($this->_filter->assigned); + } + if ( $this->_filter->position ) { + $where[] = 'm.position = '.$this->_db->Quote($this->_filter->position); + } + if ( $this->_filter->type ) { + $where[] = 'm.module = '.$this->_db->Quote($this->_filter->type); + } + if ($search) { + $where[] = 'LOWER(m.title) LIKE '.$this->_db->Quote( '%'.$this->_db->getEscaped( $search, true ).'%', false ); + } + if ( $this->_filter->state ) { + if ( $this->_filter->state == 'P' ) { + $where[] = 'm.published = 1'; + } else if ($this->_filter->state == 'U' ) { + $where[] = 'm.published = 0'; + } + } + + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + + return $where; + } +} diff --git a/administrator/components/com_modules/toolbar.modules.php b/administrator/components/com_modules/modules.php similarity index 52% rename from administrator/components/com_modules/toolbar.modules.php rename to administrator/components/com_modules/modules.php index 6e0236b2286b9..a7ce5c9e75ff3 100644 --- a/administrator/components/com_modules/toolbar.modules.php +++ b/administrator/components/com_modules/modules.php @@ -1,6 +1,6 @@ authorize( 'com_modules', 'manage' )) { + $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); +} -$client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); +// Helper classes +JHTML::addIncludePath(JPATH_COMPONENT.DS.'classes'); -switch ($task) { +// Require the base controller +require_once JPATH_COMPONENT.DS.'controller.php'; - case 'editA': - case 'edit': - TOOLBAR_modules::_EDIT( $client ); - break; +$controller = new ModulesController(); - case 'add': - TOOLBAR_modules::_NEW($client); - break; - - default: - TOOLBAR_modules::_DEFAULT($client); - break; -} \ No newline at end of file +// Perform the Request task +$controller->execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_modules/toolbar.modules.html.php b/administrator/components/com_modules/toolbar.modules.html.php deleted file mode 100644 index 07a7f2cdb1260..0000000000000 --- a/administrator/components/com_modules/toolbar.modules.html.php +++ /dev/null @@ -1,68 +0,0 @@ -[ '. JText::_( 'New' ) .' ]', 'module.png' ); - JToolBarHelper::customX( 'edit', 'forward.png', 'forward_f2.png', 'Next', true ); - JToolBarHelper::cancel(); - JToolBarHelper::help( 'screen.modules.new' ); - } - - /** - * Draws the menu for Editing an existing module - */ - function _EDIT( $client ) - { - $moduleType = JRequest::getCmd( 'module' ); - $cid = JRequest::getVar( 'cid', array(0), '', 'array' ); - JArrayHelper::toInteger($cid, array(0)); - - JToolBarHelper::title( JText::_( 'Module' ) . ': [ '. JText::_( 'Edit' ) .' ]', 'module.png' ); - - if($moduleType == 'custom') { - JToolBarHelper::Preview('index.php?option=com_modules&tmpl=component&client='.$client->id.'&pollid='.$cid[0]); - } - - JToolBarHelper::save(); - JToolBarHelper::apply(); - if ( $cid[0] ) { - // for existing items the button is renamed `close` - JToolBarHelper::cancel( 'cancel', 'Close' ); - } else { - JToolBarHelper::cancel(); - } - JToolBarHelper::help( 'screen.modules.edit' ); - } - - function _DEFAULT($client) - { - JToolBarHelper::title( JText::_( 'Module Manager' ), 'module.png' ); - JToolBarHelper::publishList(); - JToolBarHelper::unpublishList(); - JToolBarHelper::custom( 'copy', 'copy.png', 'copy_f2.png', 'Copy', true ); - JToolBarHelper::deleteList(); - JToolBarHelper::editListX(); - JToolBarHelper::addNewX(); - JToolBarHelper::help( 'screen.modules' ); - } -} diff --git a/administrator/components/com_modules/views/index.html b/administrator/components/com_modules/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_modules/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_modules/views/module/index.html b/administrator/components/com_modules/views/module/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_modules/views/module/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_modules/views/module/tmpl/default.php b/administrator/components/com_modules/views/module/tmpl/default.php new file mode 100644 index 0000000000000..8d6e648f54b60 --- /dev/null +++ b/administrator/components/com_modules/views/module/tmpl/default.php @@ -0,0 +1,290 @@ + + + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + : + + + row->module); ?> + +
    + + + +
    + : + + lists['showtitle']; ?> +
    + : + + lists['published']; ?> +
    + + + + +
    + + + +
    + + + lists['access']; ?> +
    + : + + row->id; ?> +
    + : + + row->description); ?> +
    +
    +
    + + + + + + + + + + + +
    + : + + row->client_id != 1) : ?> + pages == 'all') ? 'checked="checked"' : ''; ?> /> + + + pages == 'none') ? 'checked="checked"' : ''; ?> /> + +
    + pages == 'select') ? 'checked="checked"' : ''; ?> /> + +
    + pages == 'deselect') ? 'checked="checked"' : ''; ?> /> + + +
    + : + + lists['selections']; ?> +
    + row->client_id != 1) : ?> + pages == 'all') : ?> + + pages == 'none') : ?> + + + +
    +
    + +
    +
    + + + startPane("menu-pane"); + echo $pane->startPanel(JText :: _('Module Parameters'), "param-page"); + $p = $this->params; + if($this->params = $p->render('params')) : + echo $this->params; + else : + echo "
    ".JText::_('There are no parameters for this item')."
    "; + endif; + echo $pane->endPanel(); + + if ($p->getNumParams('advanced')) { + echo $pane->startPanel(JText :: _('Advanced Parameters'), "advanced-page"); + if($this->params = $p->render('params', 'advanced')) : + echo $this->params; + else : + echo "
    ".JText::_('There are no advanced parameters for this item')."
    "; + endif; + echo $pane->endPanel(); + } + + if ($p->getNumParams('legacy')) { + echo $pane->startPanel(JText :: _('Legacy Parameters'), "legacy-page"); + if($this->params = $p->render('params', 'legacy')) : + echo $this->params; + else : + echo "
    ".JText::_('There are no legacy parameters for this item')."
    "; + endif; + echo $pane->endPanel(); + } + + + if ($p->getNumParams('other')) { + echo $pane->startPanel(JText :: _('Other Parameters'), "other-page"); + if($this->params = $p->render('params', 'other')) : + echo $this->params; + else : + echo "
    ".JText::_('There are no other parameters for this item')."
    "; + endif; + echo $pane->endPanel(); + } + echo $pane->endPane(); + ?> +
    +
    +
    + +row->module || $this->row->module == 'custom' || $this->row->module == 'mod_custom' ) { + ?> +
    + + + display( 'content', $this->row->content, '100%', '400', '60', '20', array('pagebreak', 'readmore') ) ; + ?> + +
    + + + + + + + + + + +
    diff --git a/administrator/components/com_modules/views/module/tmpl/index.html b/administrator/components/com_modules/views/module/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_modules/views/module/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_modules/views/module/view.html.php b/administrator/components/com_modules/views/module/view.html.php new file mode 100644 index 0000000000000..ecc9a10b92861 --- /dev/null +++ b/administrator/components/com_modules/views/module/view.html.php @@ -0,0 +1,222 @@ +get('data'); + $client =& $this->get('client'); + $positions =& $this->get('positions'); + $isNew = ($row->id < 1); + + JToolBarHelper::title( JText::_( 'Module' ) . ': [ '. JText::_( 'Edit' ) .' ]', 'module.png' ); + + if($row->module == 'mod_custom') { + JToolBarHelper::Preview('index.php?option=com_modules&tmpl=component&client='.$client->id.'&pollid='.$row->id); + } + JToolBarHelper::save(); + JToolBarHelper::apply(); + if ( !$isNew ) { + // for existing items the button is renamed `close` + JToolBarHelper::cancel( 'cancel', 'Close' ); + } else { + JToolBarHelper::cancel(); + } + JToolBarHelper::help( 'screen.modules.edit' ); + + $lists = array(); + + $row->content = htmlspecialchars( str_replace( '&', '&', $row->content ), ENT_COMPAT, 'UTF-8' ); + JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'content' ); + + // Edit or Create? + if ($isNew) { + $row->position = 'left'; + $row->showtitle = true; + $row->published = 1; + //$row->ordering = $l; + + $row->module = $module; + } + + if ($client->id == 1) + { + $where = 'client_id = 1'; + $lists['client_id'] = 1; + $path = 'mod1_xml'; + } + else + { + $where = 'client_id = 0'; + $lists['client_id'] = 0; + $path = 'mod0_xml'; + } + + $query = 'SELECT position, ordering, showtitle, title' + . ' FROM #__modules' + . ' WHERE '. $where + . ' ORDER BY ordering' + ; + $db->setQuery( $query ); + if ( !($orders = $db->loadObjectList()) ) { + echo $db->stderr(); + return false; + } + + $orders2 = array(); + + $l = 0; + $r = 0; + for ($i=0, $n=count( $orders ); $i < $n; $i++) { + $ord = 0; + if (array_key_exists( $orders[$i]->position, $orders2 )) { + $ord =count( array_keys( $orders2[$orders[$i]->position] ) ) + 1; + } + + $orders2[$orders[$i]->position][] = JHTML::_('select.option', $ord, $ord.'::'.addslashes( $orders[$i]->title ) ); + } + + // get selected pages for $lists['selections'] + if ( !$isNew ) { + $row->pages = 'select'; + $query = 'SELECT menuid AS value' + . ' FROM #__modules_menu' + . ' WHERE moduleid = '.(int) $row->id + ; + $db->setQuery( $query ); + $lookup = $db->loadObjectList(); + $row->pages = 'select'; + if (empty($lookup)) { + $lookup = array(JHTML::_('select.option', '-1')); + $row->pages = 'none'; + } elseif (count($lookup) == 1 && $lookup[0]->value == 0) { + $row->pages = 'all'; + } else { + /* + * If any menu value is negative, make the type "deselect". This + * has the side-effect of hiding any corruption in the values + * (i.e. a mix of positive and negative). + */ + foreach ($lookup as $key => $modMenu) { + if ($modMenu->value < 0) { + $lookup[$key]->value = -$modMenu->value; + $row->pages = 'deselect'; + } + } + } + } else { + $lookup = array(JHTML::_('select.option', 0, JText::_('All'))); + $row->pages = 'all'; + } + + if ($row->access == 99 || $row->client_id == 1 || $lists['client_id']) { + $lists['access'] = 'Administrator'; + $lists['showtitle'] = 'N/A '; + $lists['selections'] = 'N/A'; + } else { + if ($client->id == '1') { + $lists['access'] = 'N/A'; + $lists['selections'] = 'N/A'; + } else { + $lists['access'] = JHTML::_('list.accesslevel', $row); + + $selections = JHTML::_('menu.linkoptions'); + $lists['selections'] = JHTML::_( + 'select.genericlist', + $selections, + 'selections[]', + 'class="inputbox" size="15" multiple="multiple"', + 'value', + 'text', + $lookup, + 'selections' + ); + } + $lists['showtitle'] = JHTML::_( + 'select.booleanlist', + 'showtitle', + 'class="inputbox"', + $row->showtitle + ); + } + + // build the html select list for published + $lists['published'] = JHTML::_( + 'select.booleanlist', + 'published', + 'class="inputbox"', + $row->published + ); + + $row->description = ''; + + $lang =& JFactory::getLanguage(); + if ( $client->id != '1' ) { + $lang->load( trim($row->module), JPATH_SITE ); + } else { + $lang->load( trim($row->module) ); + } + + // xml file for module + if ($row->module == 'mod_custom') { + $xmlfile = JApplicationHelper::getPath( $path, 'mod_custom' ); + } else { + $xmlfile = JApplicationHelper::getPath( $path, $row->module ); + } + + $data = JApplicationHelper::parseXMLInstallFile($xmlfile); + if ($data) + { + foreach($data as $key => $value) { + $row->$key = $value; + } + } + + // get params definitions + $params = new JParameter( $row->params, $xmlfile, 'module' ); + + // Check for component metadata.xml file + //$path = JApplicationHelper::getPath( 'mod'.$client->id.'_xml', $row->module ); + //$params = new JParameter( $row->params, $path ); + //$document =& JFactory::getDocument(); + + $this->assignRef('lists', $lists); + $this->assignRef('row', $row); + $this->assignRef('orders2', $orders2); + $this->assignRef('client', $client); + $this->assignRef('params', $params); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_modules/views/modules/index.html b/administrator/components/com_modules/views/modules/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_modules/views/modules/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_modules/views/modules/tmpl/default.php b/administrator/components/com_modules/views/modules/tmpl/default.php new file mode 100644 index 0000000000000..2311357dfc7bf --- /dev/null +++ b/administrator/components/com_modules/views/modules/tmpl/default.php @@ -0,0 +1,170 @@ + + +filter->order == 'm.position')); + + JHTML::_('behavior.tooltip'); +?> + +
    method="post" name="adminForm"> + + + + + + +
    + : + + + + + client, $this->filter->assigned); + echo JHTML::_('filter.position', $this->client, $this->filter->position); + echo JHTML::_('filter.type', $this->client, $this->filter->type); + echo JHTML::_('grid.state', $this->filter->state); + ?> +
    + + + + + + + + + + + client->id == 0) { + ?> + + + + + + + + + + + + + + + rows); $i < $n; ++$i) { + $row = &$this->rows[$i]; + + $link = JRoute::_( 'index.php?option=com_modules&client='. $this->client->id .'&task=edit&cid[]='. $row->id ); + + $access = JHTML::_('grid.access', $row, $i); + $checked = JHTML::_('grid.checkedout', $row, $i); + $published = JHTML::_('grid.published', $row, $i); + ?> + + + + + + + client->id == 0) { + ?> + + + + + + + + + +
    + + + + + filter->order_Dir, @$this->filter->order); ?> + + filter->order_Dir, @$this->filter->order); ?> + + filter->order_Dir, @$this->filter->order); ?> + + rows); ?> + + filter->order_Dir, @$this->filter->order); ?> + + filter->order_Dir, @$this->filter->order); ?> + + filter->order_Dir, @$this->filter->order); ?> + + filter->order_Dir, @$this->filter->order); ?> + + filter->order_Dir, @$this->filter->order); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset($i); ?> + + + + get('id'), $row->checked_out)) { + echo $row->title; + } else { + ?> + + + title; ?> + + + + + + pagination->orderUpIcon($i, ($row->position == @$this->rows[$i-1]->position), 'orderup', 'Move Up', $ordering); ?> + pagination->orderDownIcon($i, $n, ($row->position == @$this->rows[$i+1]->position),'orderdown', 'Move Down', $ordering); ?> + + class="text_area" style="text-align: center" /> + + + + position; ?> + + pages)) { + echo JText::_('None'); + } else if ($row->pages != 0) { + echo JText::_('Varies'); + } else { + echo JText::_('All'); + } + ?> + + module ? $row->module : JText::_('User');?> + + id;?> +
    + + + + + + + + +
    diff --git a/administrator/components/com_modules/views/modules/tmpl/index.html b/administrator/components/com_modules/views/modules/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_modules/views/modules/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_modules/views/modules/view.html.php b/administrator/components/com_modules/views/modules/view.html.php new file mode 100644 index 0000000000000..f2f764b4924b0 --- /dev/null +++ b/administrator/components/com_modules/views/modules/view.html.php @@ -0,0 +1,71 @@ +get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter'); + $client = & $this->get( 'Client'); + + if ($client->id == 1) { + JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_modules&client_id=0'); + JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_modules&client=1', true ); + } else { + JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_modules&client_id=0', true ); + JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_modules&client=1'); + } + + $this->assignRef('user', JFactory::getUser()); + $this->assignRef('rows', $rows); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + $this->assignRef('client', $client); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_modules/views/prevuuw/index.html b/administrator/components/com_modules/views/prevuuw/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_modules/views/prevuuw/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_modules/views/prevuuw/tmpl/default.php b/administrator/components/com_modules/views/prevuuw/tmpl/default.php new file mode 100644 index 0000000000000..cd01b7697ed9b --- /dev/null +++ b/administrator/components/com_modules/views/prevuuw/tmpl/default.php @@ -0,0 +1,17 @@ + + + + + + + + + + + +
    diff --git a/administrator/components/com_modules/views/prevuuw/tmpl/index.html b/administrator/components/com_modules/views/prevuuw/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_modules/views/prevuuw/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_users/users.class.php b/administrator/components/com_modules/views/prevuuw/view.html.php similarity index 60% rename from administrator/components/com_users/users.class.php rename to administrator/components/com_modules/views/prevuuw/view.html.php index 993514a9d10f2..c042e22705e20 100644 --- a/administrator/components/com_users/users.class.php +++ b/administrator/components/com_modules/views/prevuuw/view.html.php @@ -1,30 +1,38 @@ -assignRef('editor', $editor); + + parent::display($tpl); + } } \ No newline at end of file diff --git a/administrator/components/com_modules/views/selecttype/index.html b/administrator/components/com_modules/views/selecttype/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_modules/views/selecttype/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_modules/views/selecttype/tmpl/default.php b/administrator/components/com_modules/views/selecttype/tmpl/default.php new file mode 100644 index 0000000000000..7787fd370ae1d --- /dev/null +++ b/administrator/components/com_modules/views/selecttype/tmpl/default.php @@ -0,0 +1,62 @@ + + + + +
    method="post" name="adminForm"> + + + + + + + + + + + + + +modules ); +for ( $i=0; $i < $count; $i++ ) { + $row = &$this->modules[$i]; + + $link = 'index.php?option=com_modules&task=edit&module='. $row->module .'&created=1&client='. $this->client->id; + if ( !$k ) { + ?> + " valign="top"> + + + + + + + +
    + +
      +
    + name); ?> +
    + + + + + + + +
    diff --git a/administrator/components/com_modules/views/selecttype/tmpl/index.html b/administrator/components/com_modules/views/selecttype/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_modules/views/selecttype/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_modules/views/selecttype/view.html.php b/administrator/components/com_modules/views/selecttype/view.html.php new file mode 100644 index 0000000000000..40da34189a217 --- /dev/null +++ b/administrator/components/com_modules/views/selecttype/view.html.php @@ -0,0 +1,80 @@ +[ '. JText::_( 'New' ) .' ]', 'module.png' ); + JToolBarHelper::customX( 'edit', 'forward.png', 'forward_f2.png', 'Next', true ); + JToolBarHelper::cancel(); + JToolBarHelper::help( 'screen.modules.new' ); + + // path to search for modules + if ($client->id == '1') { + $path = JPATH_ADMINISTRATOR.DS.'modules'; + $langbase = JPATH_ADMINISTRATOR; + } else { + $path = JPATH_ROOT.DS.'modules'; + $langbase = JPATH_ROOT; + } + + jimport('joomla.filesystem.folder'); + $dirs = JFolder::folders( $path ); + $lang =& JFactory::getLanguage(); + + foreach ($dirs as $dir) + { + if (substr( $dir, 0, 4 ) == 'mod_') + { + $files = JFolder::files( $path.DS.$dir, '^([_A-Za-z0-9]*)\.xml$' ); + $module = new stdClass; + $module->file = $files[0]; + $module->module = str_replace( '.xml', '', $files[0] ); + $module->path = $path.DS.$dir; + $modules[] = $module; + + $lang->load( $module->module, $langbase ); + } + } + + $this->loadHelper('xml'); + ModulesHelperXML::parseXMLModuleFile( $modules, $client ); + + // sort array of objects alphabetically by name + JArrayHelper::sortObjects( $modules, 'name' ); + + $this->assignRef('modules', $modules); + $this->assignRef('client', $client); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/admin.newsfeeds.html.php b/administrator/components/com_newsfeeds/admin.newsfeeds.html.php deleted file mode 100644 index 9824a115b6120..0000000000000 --- a/administrator/components/com_newsfeeds/admin.newsfeeds.html.php +++ /dev/null @@ -1,357 +0,0 @@ - -
    - - - - - - -
    - : - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - id ); - - $checked = JHTML::_('grid.checkedout', $row, $i ); - $published = JHTML::_('grid.published', $row, $i ); - - $row->cat_link = JRoute::_( 'index.php?option=com_categories§ion=com_newsfeeds&task=edit&cid[]='. $row->catid ); - ?> - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - -
    - getListFooter(); ?> -
    - getRowOffset( $i ); ?> - - - - get ('id'), $row->checked_out ) ) { - echo $row->name; - } else { - ?> - - - name; ?> - - - - - orderUpIcon($i, ($row->catid == @$rows[$i-1]->catid), 'orderup', 'Move Up', $ordering ); ?> - orderDownIcon($i, $n, ($row->catid == @$rows[$i+1]->catid), 'orderdown', 'Move Down', $ordering ); ?> - - class="text_area" style="text-align: center" /> - - - catname;?> - - numarticles;?> - - cache_time;?> - - id; ?> -
    - - - - - -
    - - get('gid') == 25 ) { - $visible = 1; - } - HTML_newsfeeds::writableCell( JPATH_SITE.DS.'cache', 0, ''. JText::_('Cache Directory') .' ', $visible ); - ?> -
    -
    - - - - - - - -
    - - - -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rtl == 1) { - $isRtl = 'checked="checked"'; - } - ?> - - - - - - - -
    - - - -
    - - - -
    - : - - -
    - - - -
    - - - -
    - - - -
    - - - - - -
    - - - -
    - - - /> -
    -
    -
    -
    -
    - - - - - - -
    - '. JText::_( 'Writable' ) .''; - $unwriteable = ''. JText::_( 'Unwritable' ) .''; - - echo '
    '; - echo $text; - if ( $visible ) { - echo $folder . '/'; - } - echo ''; - if ( $relative ) { - echo is_writable( "../$folder" ) ? $writeable : $unwriteable; - } else { - echo is_writable( "$folder" ) ? $writeable : $unwriteable; - } - echo '
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + newsfeed->rtl == 1) { + $isRtl = 'checked="checked"'; + } + ?> + + + + + + + +
    + + + +
    + + + +
    + : + + newsfeed->published ); ?> +
    + + + newsfeed->catid ) ); ?> +
    + + + +
    + + + +
    + + + + + +
    + + + newsfeed, $this->newsfeed->id, $this->order_query, 1 ); ?> +
    + + + /> +
    +
    + + +
    + + + + + + + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/views/newsfeed/tmpl/index.html b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_newsfeeds/views/newsfeed/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/views/newsfeed/view.html.php b/administrator/components/com_newsfeeds/views/newsfeed/view.html.php new file mode 100644 index 0000000000000..22d1d7ba3af5d --- /dev/null +++ b/administrator/components/com_newsfeeds/views/newsfeed/view.html.php @@ -0,0 +1,85 @@ +getModel(); + + // Set toolbar items for the page + $edit = JRequest::getVar('edit',true); + $text = ( $edit ? JText::_( 'Edit' ) : JText::_( 'New' ) ); + + JToolBarHelper::title( JText::_( 'Newsfeed' ).': [ '. $text.' ]' ); + JToolBarHelper::save(); + JToolBarHelper::apply(); + if ($edit) { + // for existing items the button is renamed `close` + JToolBarHelper::cancel( 'cancel', 'Close' ); + } else { + JToolBarHelper::cancel(); + } + JToolBarHelper::help( 'screen.newsfeeds.edit' ); + + $newsfeed =& $this->get('data'); + $isNew = ($newsfeed->id < 1); + + // fail if checked out not by 'me' + if ($model->isCheckedOut( $user->get('id') )) { + $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The newsfeed' ), $newsfeed->name ); + $mainframe->redirect( 'index.php?option='. $option, $msg ); + } + + if (!$isNew) { + // do stuff for existing records + $model->checkout( $user->get('id') ); + } else { + // do stuff for new records + $newsfeed->ordering = 0; + $newsfeed->numarticles = 5; + $newsfeed->cache_time = 3600; + $newsfeed->published = 1; + $newsfeed->catid = JRequest::getVar( 'catid', 0, 'post', 'int' ); + } + + // build the html select list for ordering + $order_query = 'SELECT a.ordering AS value, a.name AS text' + . ' FROM #__newsfeeds AS a' + . ' WHERE catid = ' . (int) $newsfeed->catid + . ' ORDER BY a.ordering' + ; + + $this->assignRef('user', $user); + $this->assignRef('order_query', $order_query); + $this->assignRef('newsfeed', $newsfeed); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/index.html b/administrator/components/com_newsfeeds/views/newsfeeds/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_newsfeeds/views/newsfeeds/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php new file mode 100644 index 0000000000000..97cc500081717 --- /dev/null +++ b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php @@ -0,0 +1,153 @@ + + +filter->order == 'a.ordering'); + + JHTML::_('behavior.tooltip'); +?> + +
    + + + + + + +
    + : + + + + + filter->catid, 'onchange="document.adminForm.submit();"' ); + echo JHTML::_('grid.state', $this->filter->state ); + ?> +
    + + + + + + + + + + + + + + + + + + + + + + items ); $i < $n; $i++) + { + $row = &$this->items[$i]; + + $link = JRoute::_( 'index.php?option=com_newsfeeds&task=edit&cid[]='. $row->id ); + + $checked = JHTML::_('grid.checkedout', $row, $i ); + $published = JHTML::_('grid.published', $row, $i ); + + $row->cat_link = JRoute::_( 'index.php?option=com_categories§ion=com_newsfeeds&task=edit&cid[]='. $row->catid ); + ?> + + + + + + + + + + + + + +
    + + + + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + items ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset( $i ); ?> + + + + user->get ('id'), $row->checked_out ) ) { + echo $row->name; + } else { + ?> + + + name; ?> + + + + + pagination->orderUpIcon($i, ($row->catid == @$this->items[$i-1]->catid), 'orderup', 'Move Up', $ordering ); ?> + pagination->orderDownIcon($i, $n, ($row->catid == @$this->items[$i+1]->catid), 'orderdown', 'Move Down', $ordering ); ?> + + class="text_area" style="text-align: center" /> + + + catname;?> + + numarticles;?> + + cache_time;?> + + id; ?> +
    + + + + + +
    +
    + + cache_folder; ?> + + cache_writable ? 'Writable' : 'Unwritable' ); ?> + +
    +
    + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/index.html b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php b/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php new file mode 100644 index 0000000000000..a0974464f3394 --- /dev/null +++ b/administrator/components/com_newsfeeds/views/newsfeeds/view.html.php @@ -0,0 +1,71 @@ +get( 'Data'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter'); + + $cache_path = JPATH_SITE.DS.'cache'; + $cache_writable = is_writable( $cache_path ); + + // Is cache directory writable? + // check to hide certain paths if not super admin + // TODO: Change this when ACLs more solid + $cache_folder = ''; + if ( $user->get('gid') == 25 ) { + $cache_folder = $cache_path; + } + + $this->assignRef('user', $user); + $this->assignRef('cache_folder', $cache_folder); + $this->assignRef('cache_writable', $cache_writable); + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_plugins/controller.php b/administrator/components/com_plugins/controller.php index 19eeeb2184810..68eb0f3ce535b 100644 --- a/administrator/components/com_plugins/controller.php +++ b/administrator/components/com_plugins/controller.php @@ -50,8 +50,8 @@ function display( ) { switch($this->getTask()) { - case 'add' : - case 'edit' : + case 'add': + case 'edit': { JRequest::setVar( 'hidemainmenu', 1 ); JRequest::setVar( 'layout', 'form' ); diff --git a/administrator/components/com_plugins/controllers/index.html b/administrator/components/com_plugins/controllers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_plugins/controllers/index.html +++ b/administrator/components/com_plugins/controllers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_plugins/index.html b/administrator/components/com_plugins/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_plugins/index.html +++ b/administrator/components/com_plugins/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_plugins/plugins.php b/administrator/components/com_plugins/plugins.php index 6a01e5221ffc9..68008ed0d633a 100644 --- a/administrator/components/com_plugins/plugins.php +++ b/administrator/components/com_plugins/plugins.php @@ -23,10 +23,10 @@ $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); } -require_once( JPATH_COMPONENT.DS.'controller.php' ); +require_once JPATH_COMPONENT.DS.'controller.php'; // Create the controller -$controller = new PluginsController( ); +$controller = new PluginsController(); -$controller->execute( JRequest::getCmd( 'task' ) ); +$controller->execute(JRequest::getCmd('task')); $controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_plugins/views/plugin/index.html b/administrator/components/com_plugins/views/plugin/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_plugins/views/plugin/index.html +++ b/administrator/components/com_plugins/views/plugin/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_plugins/views/plugin/tmpl/form.php b/administrator/components/com_plugins/views/plugin/tmpl/form.php index 2c08fe5766e17..c1752359807e6 100644 --- a/administrator/components/com_plugins/views/plugin/tmpl/form.php +++ b/administrator/components/com_plugins/views/plugin/tmpl/form.php @@ -39,7 +39,7 @@ function submitbutton(pressbutton) { } -
    +
    diff --git a/administrator/components/com_plugins/views/plugin/tmpl/index.html b/administrator/components/com_plugins/views/plugin/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_plugins/views/plugin/tmpl/index.html +++ b/administrator/components/com_plugins/views/plugin/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_plugins/views/plugins/index.html b/administrator/components/com_plugins/views/plugins/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_plugins/views/plugins/index.html +++ b/administrator/components/com_plugins/views/plugins/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_plugins/views/plugins/tmpl/default.php b/administrator/components/com_plugins/views/plugins/tmpl/default.php index 9a39014307fc6..7704fc3e458bc 100644 --- a/administrator/components/com_plugins/views/plugins/tmpl/default.php +++ b/administrator/components/com_plugins/views/plugins/tmpl/default.php @@ -13,7 +13,7 @@ ?> - +
    diff --git a/administrator/components/com_plugins/views/plugins/tmpl/index.html b/administrator/components/com_plugins/views/plugins/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_plugins/views/plugins/tmpl/index.html +++ b/administrator/components/com_plugins/views/plugins/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_plugins/views/plugins/view.html.php b/administrator/components/com_plugins/views/plugins/view.html.php index d2441e28d4350..8a3f762d10358 100644 --- a/administrator/components/com_plugins/views/plugins/view.html.php +++ b/administrator/components/com_plugins/views/plugins/view.html.php @@ -27,6 +27,13 @@ */ class PluginsViewPlugins extends JView { + protected $client; + protected $user; + protected $lists; + protected $items; + protected $item; + protected $pagination; + function display( $tpl = null ) { global $mainframe, $option; @@ -86,7 +93,7 @@ function display( $tpl = null ) $query = 'SELECT p.*, u.name AS editor, g.name AS groupname' . ' FROM #__plugins AS p' . ' LEFT JOIN #__users AS u ON u.id = p.checked_out' - . ' LEFT JOIN #__groups AS g ON g.id = p.access' + . ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = p.access' . $where . ' GROUP BY p.id' . $orderby @@ -131,4 +138,4 @@ function display( $tpl = null ) parent::display($tpl); } -} \ No newline at end of file +} diff --git a/administrator/components/com_poll/controller.php b/administrator/components/com_poll/controller.php index c6d7833a1dafc..8e457be4ec429 100644 --- a/administrator/components/com_poll/controller.php +++ b/administrator/components/com_poll/controller.php @@ -42,14 +42,14 @@ function display( ) { switch($this->getTask()) { - case 'add' : + case 'add': { JRequest::setVar( 'hidemainmenu', 1 ); JRequest::setVar( 'layout', 'form' ); JRequest::setVar( 'view', 'poll' ); JRequest::setVar( 'edit', false ); } break; - case 'edit' : + case 'edit': { JRequest::setVar( 'hidemainmenu', 1 ); JRequest::setVar( 'layout', 'form' ); diff --git a/administrator/components/com_poll/elements/index.html b/administrator/components/com_poll/elements/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_poll/elements/index.html +++ b/administrator/components/com_poll/elements/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_poll/index.html b/administrator/components/com_poll/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_poll/index.html +++ b/administrator/components/com_poll/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_poll/poll.php b/administrator/components/com_poll/poll.php index 9d3e0c5f032ba..33b7b87d2632d 100644 --- a/administrator/components/com_poll/poll.php +++ b/administrator/components/com_poll/poll.php @@ -21,13 +21,13 @@ $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); } -require_once( JPATH_COMPONENT.DS.'controller.php' ); +require_once JPATH_COMPONENT.DS.'controller.php'; // Set the table directory -JTable::addIncludePath( JPATH_COMPONENT.DS.'tables' ); +JTable::addIncludePath(JPATH_COMPONENT.DS.'tables'); // Create the controller -$controller = new PollController( ); +$controller = new PollController(); -$controller->execute( JRequest::getCmd( 'task' ) ); +$controller->execute(JRequest::getCmd( 'task' ) ); $controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_poll/tables/index.html b/administrator/components/com_poll/tables/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_poll/tables/index.html +++ b/administrator/components/com_poll/tables/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_poll/views/index.html b/administrator/components/com_poll/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_poll/views/index.html +++ b/administrator/components/com_poll/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_poll/views/poll/index.html b/administrator/components/com_poll/views/poll/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_poll/views/poll/index.html +++ b/administrator/components/com_poll/views/poll/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_poll/views/poll/tmpl/form.php b/administrator/components/com_poll/views/poll/tmpl/form.php index a18b886929014..49e24c1116e0a 100644 --- a/administrator/components/com_poll/views/poll/tmpl/form.php +++ b/administrator/components/com_poll/views/poll/tmpl/form.php @@ -45,7 +45,7 @@ function submitbutton(pressbutton) { } } - +
    diff --git a/administrator/components/com_poll/views/poll/tmpl/index.html b/administrator/components/com_poll/views/poll/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_poll/views/poll/tmpl/index.html +++ b/administrator/components/com_poll/views/poll/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_poll/views/poll/view.html.php b/administrator/components/com_poll/views/poll/view.html.php index 0726eb3fd0a0f..80859beb335dd 100644 --- a/administrator/components/com_poll/views/poll/view.html.php +++ b/administrator/components/com_poll/views/poll/view.html.php @@ -27,9 +27,14 @@ */ class PollViewPoll extends JView { + + protected $polls; + protected $options; + protected $poll; + function display($tpl = null) { - global $mainframe; + $mainframe = JFactory::getApplication(); $db =& JFactory::getDBO(); $user =& JFactory::getUser(); @@ -80,4 +85,4 @@ function display($tpl = null) parent::display($tpl); } -} \ No newline at end of file +} diff --git a/administrator/components/com_poll/views/polls/index.html b/administrator/components/com_poll/views/polls/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_poll/views/polls/index.html +++ b/administrator/components/com_poll/views/polls/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_poll/views/polls/tmpl/default.php b/administrator/components/com_poll/views/polls/tmpl/default.php index e2c63a2a01325..06f651765b6e9 100644 --- a/administrator/components/com_poll/views/polls/tmpl/default.php +++ b/administrator/components/com_poll/views/polls/tmpl/default.php @@ -12,7 +12,7 @@ JToolBarHelper::help( 'screen.polls' ); ?> - + diff --git a/administrator/components/com_weblinks/views/weblink/tmpl/index.html b/administrator/components/com_weblinks/views/weblink/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_weblinks/views/weblink/tmpl/index.html +++ b/administrator/components/com_weblinks/views/weblink/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_weblinks/views/weblink/view.html.php b/administrator/components/com_weblinks/views/weblink/view.html.php index c4f4a701732a4..1eca1edbdf7fa 100644 --- a/administrator/components/com_weblinks/views/weblink/view.html.php +++ b/administrator/components/com_weblinks/views/weblink/view.html.php @@ -63,18 +63,8 @@ function _displayForm($tpl) $weblink =& $this->get('data'); $isNew = ($weblink->id < 1); - // fail if checked out not by 'me' - if ($model->isCheckedOut( $user->get('id') )) { - $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The weblink' ), $weblink->title ); - $mainframe->redirect( 'index.php?option='. $option, $msg ); - } - // Edit or Create? - if (!$isNew) - { - $model->checkout( $user->get('id') ); - } - else + if ($isNew) { // initialise new record $weblink->published = 1; @@ -94,7 +84,7 @@ function _displayForm($tpl) // build list of categories $lists['catid'] = JHTML::_('list.category', 'catid', $option, intval( $weblink->catid ) ); // build the html select list - $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $weblink->published ); + $lists['state'] = JHTML::_('weblink.statelist', 'state', $weblink->state ); //clean weblink data JFilterOutput::objectHTMLSafe( $weblink, ENT_QUOTES, 'description' ); diff --git a/administrator/components/com_weblinks/views/weblinks/index.html b/administrator/components/com_weblinks/views/weblinks/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_weblinks/views/weblinks/index.html +++ b/administrator/components/com_weblinks/views/weblinks/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_weblinks/views/weblinks/tmpl/default.php b/administrator/components/com_weblinks/views/weblinks/tmpl/default.php index 6faefccc806f4..747c7c982ff52 100644 --- a/administrator/components/com_weblinks/views/weblinks/tmpl/default.php +++ b/administrator/components/com_weblinks/views/weblinks/tmpl/default.php @@ -2,30 +2,19 @@ - - +
    diff --git a/administrator/components/com_poll/views/polls/tmpl/index.html b/administrator/components/com_poll/views/polls/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_poll/views/polls/tmpl/index.html +++ b/administrator/components/com_poll/views/polls/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_poll/views/polls/view.html.php b/administrator/components/com_poll/views/polls/view.html.php index 7fa10b98ccddd..bdb9718b8e332 100644 --- a/administrator/components/com_poll/views/polls/view.html.php +++ b/administrator/components/com_poll/views/polls/view.html.php @@ -27,6 +27,11 @@ */ class PollViewPolls extends JView { + protected $user; + protected $lists; + protected $items; + protected $pagination; + function display( $tpl = null ) { global $mainframe, $option; @@ -106,4 +111,4 @@ function display( $tpl = null ) parent::display($tpl); } -} \ No newline at end of file +} diff --git a/administrator/components/com_search/helpers/index.html b/administrator/components/com_search/helpers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_search/helpers/index.html +++ b/administrator/components/com_search/helpers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_search/helpers/site.php b/administrator/components/com_search/helpers/site.php index 9b733eb9dff17..b6562433aa34a 100644 --- a/administrator/components/com_search/helpers/site.php +++ b/administrator/components/com_search/helpers/site.php @@ -32,4 +32,4 @@ function getItems() { return array(); } -} \ No newline at end of file +} diff --git a/administrator/components/com_search/index.html b/administrator/components/com_search/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_search/index.html +++ b/administrator/components/com_search/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_search/models/index.html b/administrator/components/com_search/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_search/models/index.html +++ b/administrator/components/com_search/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_search/models/search.php b/administrator/components/com_search/models/search.php index 23ebecb071c11..4da3349b26dd1 100644 --- a/administrator/components/com_search/models/search.php +++ b/administrator/components/com_search/models/search.php @@ -97,7 +97,7 @@ function getItems( ) if (!class_exists( 'JSite' )) { // This fools the routers in the search plugins into thinking it's in the frontend - require_once( JPATH_COMPONENT.DS.'helpers'.DS.'site.php' ); + require_once JPATH_COMPONENT.DS.'helpers'.DS.'site.php'; } for ($i=0, $n = count($rows); $i < $n; $i++) { diff --git a/administrator/components/com_search/search.php b/administrator/components/com_search/search.php index ce7461e30d651..93c11f7fe8df3 100644 --- a/administrator/components/com_search/search.php +++ b/administrator/components/com_search/search.php @@ -15,7 +15,7 @@ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); -require_once( JPATH_COMPONENT.DS.'controller.php' ); +require_once JPATH_COMPONENT.DS.'controller.php'; $controller = new SearchController(); $controller->execute( JRequest::getCmd( 'task' ) ); diff --git a/administrator/components/com_search/views/index.html b/administrator/components/com_search/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_search/views/index.html +++ b/administrator/components/com_search/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_search/views/search/index.html b/administrator/components/com_search/views/search/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_search/views/search/index.html +++ b/administrator/components/com_search/views/search/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_search/views/search/tmpl/default.php b/administrator/components/com_search/views/search/tmpl/default.php index 4dbeb6fdeeaee..34bc48453efda 100644 --- a/administrator/components/com_search/views/search/tmpl/default.php +++ b/administrator/components/com_search/views/search/tmpl/default.php @@ -1,6 +1,6 @@ - + diff --git a/administrator/components/com_search/views/search/tmpl/index.html b/administrator/components/com_search/views/search/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_search/views/search/tmpl/index.html +++ b/administrator/components/com_search/views/search/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_sections/admin.sections.html.php b/administrator/components/com_sections/admin.sections.html.php deleted file mode 100644 index dd7745ce92451..0000000000000 --- a/administrator/components/com_sections/admin.sections.html.php +++ /dev/null @@ -1,435 +0,0 @@ - - - -
    @@ -16,9 +16,9 @@ showResults ) : ?> - + - +
    - - - - -
    - : - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - id; - - $access = JHTML::_('grid.access', $row, $i ); - $checked = JHTML::_('grid.checkedout', $row, $i ); - $published = JHTML::_('grid.published', $row, $i ); - ?> - "> - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - -
    - getListFooter(); ?> -
    - getRowOffset( $i ); ?> - - - - - get ('id'), $row->checked_out ) ) { - echo $row->title; - } else { - ?> - - title; ?> - - - - - orderUpIcon( $i, true, 'orderup', 'Move Up', $ordering ); ?> - orderDownIcon( $i, $n, true, 'orderdown', 'Move Down', $ordering ); ?> - - class="text_area" style="text-align: center" /> - - - - categories; ?> - - active; ?> - - trash; ?> - - id; ?> -
    - - - - - - - - - - - - $row is passed with the id - * property set to 0. Note that the section property must be defined - * even for a new record. - * @param JTableCategory The category object - * @param string The html for the image list select list - * @param string The html for the image position select list - * @param string The html for the ordering list - * @param string The html for the groups select list - */ - function edit( &$row, $option, &$lists ) - { - JRequest::setVar( 'hidemainmenu', 1 ); - - global $mainframe; - - $editor =& JFactory::getEditor(); - - if ( $row->name != '' ) { - $name = $row->name; - } else { - $name = JText::_( 'New Section' ); - } - if ($row->image == '') { - $row->image = 'blank.png'; - } - - JFilterOutput::objectHTMLSafe( $row, ENT_QUOTES, 'description' ); - ?> - - -
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - : - - - scope; ?> - -
    - - - -
    - - - -
    - : - - -
    - - - -
    - - - - - image != 'blank.png') { - $path.= 'stories/'; - } - ?> - <?php echo JText::_( 'Preview' ); ?> -
    - - - -
    - - - -
    -
    - -
    - - - - - - -
    - display( 'description', $row->description, '550', '300', '60', '20', array('pagebreak', 'readmore') ) ; - ?> -
    -
    -
    -
    - - - - - - - -
    - - -
    - - - - - - - - . - -
    - : -
    - -

    -
    - : -
    - "; - foreach ( $categories as $category ) { - echo "
  • ". $category->title ."
  • "; - echo "\n id\" />"; - } - echo ""; - ?> -
    - : -
    - "; - foreach ( $contents as $content ) { - echo "
  • ". $content->title ."
  • "; - echo "\n id\" />"; - } - echo ""; - ?> -
    - -
    - -
    - -
    -

    - - - - - - - "; - } - ?> - -
    - getUserStateFromRequest( $option.'.filter_order', 'filter_order', 's.ordering', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'.filter_order_Dir', 'filter_order_Dir', '', 'word' ); - $filter_state = $mainframe->getUserStateFromRequest( $option.'.filter_state', 'filter_state', '', 'word' ); - $search = $mainframe->getUserStateFromRequest( $option.'.search', 'search', '', 'string' ); - $search = JString::strtolower( $search ); - - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); - $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); - - $where[] = 's.scope = '.$db->Quote($scope); - - if ( $filter_state ) { - if ( $filter_state == 'P' ) { - $where[] = 's.published = 1'; - } else if ($filter_state == 'U' ) { - $where[] = 's.published = 0'; - } - } - if ($search) { - $where[] = 'LOWER(s.title) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); - } - - $where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' ); - $orderby = ' ORDER BY '.$filter_order.' '. $filter_order_Dir .', s.ordering'; - - // get the total number of records - $query = 'SELECT COUNT(*)' - . ' FROM #__sections AS s' - . $where - ; - $db->setQuery( $query ); - $total = $db->loadResult(); - - jimport('joomla.html.pagination'); - $pageNav = new JPagination( $total, $limitstart, $limit ); - - $query = 'SELECT s.*, g.name AS groupname, u.name AS editor' - . ' FROM #__sections AS s' - . ' LEFT JOIN #__content AS cc ON s.id = cc.sectionid' - . ' LEFT JOIN #__users AS u ON u.id = s.checked_out' - . ' LEFT JOIN #__groups AS g ON g.id = s.access' - . $where - . ' GROUP BY s.id' - . $orderby - ; - $db->setQuery( $query, $pageNav->limitstart, $pageNav->limit ); - $rows = $db->loadObjectList(); - if ($db->getErrorNum()) { - echo $db->stderr(); - return false; - } - - $count = count( $rows ); - // number of Active Categories - for ( $i = 0; $i < $count; $i++ ) { - $query = 'SELECT COUNT( a.id )' - . ' FROM #__categories AS a' - . ' WHERE a.section = '.$db->Quote($rows[$i]->id) - . ' AND a.published <> -2' - ; - $db->setQuery( $query ); - $active = $db->loadResult(); - $rows[$i]->categories = $active; - } - // number of Active Items - for ( $i = 0; $i < $count; $i++ ) { - $query = 'SELECT COUNT( a.id )' - . ' FROM #__content AS a' - . ' WHERE a.sectionid = '.(int) $rows[$i]->id - . ' AND a.state <> -2' - ; - $db->setQuery( $query ); - $active = $db->loadResult(); - $rows[$i]->active = $active; - } - // number of Trashed Items - for ( $i = 0; $i < $count; $i++ ) { - $query = 'SELECT COUNT( a.id )' - . ' FROM #__content AS a' - . ' WHERE a.sectionid = '.(int) $rows[$i]->id - . ' AND a.state = -2' - ; - $db->setQuery( $query ); - $trash = $db->loadResult(); - $rows[$i]->trash = $trash; - } - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - sections_html::show( $rows, $scope, $user->get('id'), $pageNav, $option, $lists ); -} - -/** -* Compiles information to add or edit a section -* @param database A database connector object -* @param string The name of the category section -* @param integer The unique id of the category to edit (0 if new) -* @param string The name of the current user -*/ -function editSection( $edit) -{ - global $mainframe; - - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - $option = JRequest::getCmd( 'option'); - $scope = JRequest::getCmd( 'scope' ); - $cid = JRequest::getVar( 'cid', array(0), '', 'array' ); - JArrayHelper::toInteger($cid, array(0)); - - $row =& JTable::getInstance('section'); - // load the row from the db table - if ($edit) - $row->load( $cid[0] ); - - // fail if checked out not by 'me' - if ($row->isCheckedOut( $user->get('id') )) { - $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The section' ), $row->title ); - $mainframe->redirect( 'index.php?option='. $option .'&scope='. $row->scope, $msg ); - } - - if ( $edit ) { - $row->checkout( $user->get('id') ); - } else { - $row->scope = $scope; - $row->published = 1; - } - - // build the html select list for ordering - $query = 'SELECT ordering AS value, title AS text' - . ' FROM #__sections' - . ' WHERE scope='.$db->Quote($row->scope).' ORDER BY ordering' - ; - if($edit) - $lists['ordering'] = JHTML::_('list.specificordering', $row, $cid[0], $query ); - else - $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query ); - // build the select list for the image positions - $active = ( $row->image_position ? $row->image_position : 'left' ); - $lists['image_position'] = JHTML::_('list.positions', 'image_position', $active, NULL, 0 ); - // build the html select list for images - $lists['image'] = JHTML::_('list.images', 'image', $row->image ); - // build the html select list for the group access - $lists['access'] = JHTML::_('list.accesslevel', $row ); - // build the html radio buttons for published - $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published ); - - sections_html::edit( $row, $option, $lists ); -} - -/** -* Saves the catefory after an edit form submit -* @param database A database connector object -* @param string The name of the category section -*/ -function saveSection( $option, $scope, $task ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $menu = JRequest::getVar( 'menu', 'mainmenu', 'post', 'string' ); - $menuid = JRequest::getVar( 'menuid', 0, 'post', 'int' ); - $oldtitle = JRequest::getVar( 'oldtitle', '', '', 'post', 'string' ); - - $post = JRequest::get('post'); - - // fix up special html fields - $post['description'] = JRequest::getVar( 'description', '', 'post', 'string', JREQUEST_ALLOWRAW ); - - $row =& JTable::getInstance('section'); - if (!$row->bind($post)) { - JError::raiseError(500, $row->getError() ); - } - if (!$row->check()) { - JError::raiseError(500, $row->getError() ); - } - if ( $oldtitle ) { - if ( $oldtitle <> $row->title ) { - $query = 'UPDATE #__menu' - . ' SET name = '.$db->Quote($row->title) - . ' WHERE name = '.$db->Quote($oldtitle) - . ' AND type = "content_section"' - ; - $db->setQuery( $query ); - $db->query(); - } - } - - // if new item order last in appropriate group - if (!$row->id) { - $row->ordering = $row->getNextOrder(); - } - - if (!$row->store()) { - JError::raiseError(500, $row->getError() ); - } - $row->checkin(); - - switch ( $task ) - { - case 'go2menu': - $mainframe->redirect( 'index.php?option=com_menus&menutype='. $menu ); - break; - - case 'go2menuitem': - $mainframe->redirect( 'index.php?option=com_menus&menutype='. $menu .'&task=edit&id='. $menuid ); - break; - - case 'apply': - $msg = JText::_( 'Changes to Section saved' ); - $mainframe->redirect( 'index.php?option='. $option .'&scope='. $scope .'&task=edit&cid[]='. $row->id, $msg ); - break; - - case 'save': - default: - $msg = JText::_( 'Section saved' ); - $mainframe->redirect( 'index.php?option='. $option .'&scope='. $scope, $msg ); - break; - } -} -/** -* Deletes one or more categories from the categories table -* @param database A database connector object -* @param string The name of the category section -* @param array An array of unique category id numbers -*/ -function removeSections( $cid, $scope, $option ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - if (count( $cid ) < 1) { - JError::raiseError(500, JText::_( 'Select a section to delete', true ) ); - } - - JArrayHelper::toInteger( $cid ); - $cids = implode( ',', $cid ); - - $query = 'SELECT s.id, s.title, COUNT(c.id) AS numcat' - . ' FROM #__sections AS s' - . ' LEFT JOIN #__categories AS c ON c.section=s.id' - . ' WHERE s.id IN ( '.$cids.' )' - . ' GROUP BY s.id' - ; - $db->setQuery( $query ); - if (!($rows = $db->loadObjectList())) { - echo "\n"; - } - - $name = array(); - $err = array(); - $cid = array(); - foreach ($rows as $row) { - if ($row->numcat == 0) { - $cid[] = (int) $row->id; - $name[] = $row->title; - } else { - $err[] = $row->title; - } - } - - if (count( $cid )) - { - $cids = implode( ',', $cid ); - $query = 'DELETE FROM #__sections' - . ' WHERE id IN ( '.$cids.' )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - echo "\n"; - } - } - - if (count( $err )) - { - $cids = implode( ', ', $err ); - $msg = JText::sprintf( 'DESCCANNOTBEREMOVED', $cids ); - $mainframe->redirect( 'index.php?option='. $option .'&scope='. $scope, $msg ); - } - - $names = implode( ', ', $name ); - $msg = JText::sprintf( 'Sections successfully deleted', $names ); - $mainframe->redirect( 'index.php?option='. $option .'&scope='. $scope, $msg ); -} - -/** -* Publishes or Unpublishes one or more categories -* @param database A database connector object -* @param string The name of the category section -* @param integer A unique category id (passed from an edit form) -* @param array An array of unique category id numbers -* @param integer 0 if unpublishing, 1 if publishing -* @param string The name of the current user -*/ -function publishSections( $scope, $cid=null, $publish=1, $option ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - JArrayHelper::toInteger($cid); - - if ( count( $cid ) < 1 ) { - $action = $publish ? 'publish' : 'unpublish'; - JError::raiseError(500, JText::_( 'Select a section to '.$action, true ) ); - } - - $cids = implode( ',', $cid ); - $count = count( $cid ); - $query = 'UPDATE #__sections' - . ' SET published = '.(int) $publish - . ' WHERE id IN ( '.$cids.' )' - . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' - ; - $db->setQuery( $query ); - if (!$db->query()) { - JError::raiseError(500, $db->getErrorMsg() ); - } - - if ( $count == 1 ) { - $row =& JTable::getInstance('section'); - $row->checkin( $cid[0] ); - } - - // check if section linked to menu items if unpublishing - if ( $publish == 0 ) { - $query = 'SELECT id' - . ' FROM #__menu' - . ' WHERE type = "content_section"' - . ' AND componentid IN ( '.$cids.' )' - ; - $db->setQuery( $query ); - $menus = $db->loadObjectList(); - - if ($menus) { - foreach ($menus as $menu) { - $query = 'UPDATE #__menu' - . ' SET published = '.(int) $publish - . ' WHERE id = '.(int) $menu->id - ; - $db->setQuery( $query ); - $db->query(); - } - } - } - - $mainframe->redirect( 'index.php?option='. $option .'&scope='. $scope ); -} - -/** -* Cancels an edit operation -* @param database A database connector object -* @param string The name of the category section -* @param integer A unique category id -*/ -function cancelSection( $option, $scope ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $row =& JTable::getInstance('section'); - $row->bind(JRequest::get('post')); - $row->checkin(); - - $mainframe->redirect( 'index.php?option='. $option .'&scope='. $scope ); -} - -/** -* Moves the order of a record -* @param integer The increment to reorder by -*/ -function orderSection( $uid, $inc, $option, $scope ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $row =& JTable::getInstance('section'); - $row->load( $uid ); - $row->move( $inc, 'scope = '.$db->Quote($row->scope) ); - - $mainframe->redirect( 'index.php?option='. $option .'&scope='. $scope ); -} - -/** -* Form for copying item(s) to a specific menu -*/ -function copySectionSelect( $option, $cid, $section ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - - JArrayHelper::toInteger($cid); - - if ( count( $cid ) < 1) { - JError::raiseError(500, JText::_( 'Select an item to move', true ) ); - } - - ## query to list selected categories - $cids = implode( ',', $cid ); - $query = 'SELECT a.title, a.id' - . ' FROM #__categories AS a' - . ' WHERE a.section IN ( '.$cids.' )' - ; - $db->setQuery( $query ); - $categories = $db->loadObjectList(); - - ## query to list items from categories - $query = 'SELECT a.title, a.id' - . ' FROM #__content AS a' - . ' WHERE a.sectionid IN ( '.$cids.' )' - . ' ORDER BY a.sectionid, a.catid, a.title' - ; - $db->setQuery( $query ); - $contents = $db->loadObjectList(); - - sections_html::copySectionSelect( $option, $cid, $categories, $contents, $section ); -} - - -/** -* Save the item(s) to the menu selected -*/ -function copySectionSave( $sectionid, $scope ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $title = JRequest::getString( 'title' ); - $contentid = JRequest::getVar( 'content' ); - $categoryid = JRequest::getVar( 'category' ); - JArrayHelper::toInteger($contentid); - JArrayHelper::toInteger($categoryid); - - // copy section - $section =& JTable::getInstance('section'); - foreach( $sectionid as $id ) { - $section->load( $id ); - $section->id = NULL; - $section->title = $title; - $section->name = $title; - if ( !$section->check() ) { - copySectionSelect('com_sections', $sectionid, $scope ); - JError::raiseWarning(500, $section->getError() ); - return; - } - - if ( !$section->store() ) { - JError::raiseError(500, $section->getError() ); - } - $section->checkin(); - $section->reorder( 'scope = '.$db->Quote($section->scope) ); - // stores original catid - $newsectids[]["old"] = $id; - // pulls new catid - $newsectids[]["new"] = $section->id; - } - $sectionMove = $section->id; - - // copy categories - $category =& JTable::getInstance('category'); - foreach( $categoryid as $id ) { - $category->load( $id ); - $category->id = NULL; - $category->section = $sectionMove; - foreach( $newsectids as $newsectid ) { - if ( $category->section == $newsectid["old"] ) { - $category->section = $newsectid["new"]; - } - } - if (!$category->check()) { - JError::raiseError(500, $category->getError() ); - } - - if (!$category->store()) { - JError::raiseError(500, $category->getError() ); - } - $category->checkin(); - $category->reorder( 'section = '.$db->Quote($category->section) ); - // stores original catid - $newcatids[]["old"] = $id; - // pulls new catid - $newcatids[]["new"] = $category->id; - } - - $content =& JTable::getInstance('content'); - foreach( $contentid as $id) { - $content->load( $id ); - $content->id = NULL; - $content->hits = 0; - foreach( $newsectids as $newsectid ) { - if ( $content->sectionid == $newsectid["old"] ) { - $content->sectionid = $newsectid["new"]; - } - } - foreach( $newcatids as $newcatid ) { - if ( $content->catid == $newcatid["old"] ) { - $content->catid = $newcatid["new"]; - } - } - if (!$content->check()) { - JError::raiseError(500, $content->getError() ); - } - - if (!$content->store()) { - JError::raiseError(500, $content->getError() ); - } - $content->checkin(); - } - $sectionOld =& JTable::getInstance('section'); - $sectionOld->load( $sectionMove ); - - $msg = JText::sprintf( 'DESCCATANDITEMSCOPIED', $sectionOld-> name, $title ); - $mainframe->redirect( 'index.php?option=com_sections&scope=content', $msg ); -} - -/** -* changes the access level of a record -* @param integer The increment to reorder by -*/ -function accessMenu( $uid, $access, $option ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $row =& JTable::getInstance('section'); - $row->load( $uid ); - $row->access = $access; - - if ( !$row->check() ) { - return $row->getError(); - } - if ( !$row->store() ) { - return $row->getError(); - } - - $mainframe->redirect( 'index.php?option='. $option .'&scope='. $row->scope ); -} - -function saveOrder( &$cid ) -{ - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $row =& JTable::getInstance('section'); - - $total = count( $cid ); - $order = JRequest::getVar( 'order', array(0), 'post', 'array' ); - JArrayHelper::toInteger($order, array(0)); - - // update ordering values - for( $i=0; $i < $total; $i++ ) - { - $row->load( (int) $cid[$i] ); - if ($row->ordering != $order[$i]) { - $row->ordering = $order[$i]; - if (!$row->store()) { - JError::raiseError(500, $db->getErrorMsg() ); - } - } - } - - $row->reorder( ); - - $msg = JText::_( 'New ordering saved' ); - $mainframe->redirect( 'index.php?option=com_sections&scope=content', $msg ); -} \ No newline at end of file diff --git a/administrator/components/com_sections/config.xml b/administrator/components/com_sections/config.xml new file mode 100644 index 0000000000000..e15e4bedcd853 --- /dev/null +++ b/administrator/components/com_sections/config.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/administrator/components/com_sections/controller.php b/administrator/components/com_sections/controller.php new file mode 100644 index 0000000000000..3b2587ba865b7 --- /dev/null +++ b/administrator/components/com_sections/controller.php @@ -0,0 +1,519 @@ +registerTask( 'add', 'display' ); + $this->registerTask( 'edit', 'display' ); + $this->registerTask( 'copyselect', 'display' ); + $this->registerTask( 'apply', 'save' ); + $this->registerTask( 'go2menu', 'save' ); + $this->registerTask( 'go2menuitem', 'save' ); + } + + function display( ) + { + switch($this->getTask()) + { + case 'add': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'section'); + JRequest::setVar( 'edit', false ); + + // Checkout the section + $model = $this->getModel('section'); + $model->checkout(); + } break; + case 'edit': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'section'); + JRequest::setVar( 'edit', true ); + + // Checkout the section + $model = $this->getModel('section'); + $model->checkout(); + } break; + case 'copyselect': + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view' , 'copyselect'); + } break; + } + + parent::display(); + } + + function save() + { + global $mainframe, $option; + + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $db =& JFactory::getDBO(); + $menu = JRequest::getVar( 'menu', 'mainmenu', 'post', 'string' ); + $menuid = JRequest::getVar( 'menuid', 0, 'post', 'int' ); + $oldtitle = JRequest::getVar( 'oldtitle', '', '', 'post', 'string' ); + $task = JRequest::getVar( 'task', '', '', 'post', 'string' ); + $scope = JRequest::getVar( 'scope', '' ); + + $post = JRequest::get('post'); + + // fix up special html fields + $post['description'] = JRequest::getVar( 'description', '', 'post', 'string', JREQUEST_ALLOWRAW ); + + $row =& JTable::getInstance('section'); + if (!$row->bind($post)) { + JError::raiseError(500, $row->getError() ); + } + if (!$row->check()) { + JError::raiseError(500, $row->getError() ); + } + if ( $oldtitle ) { + if ( $oldtitle <> $row->title ) { + $query = 'UPDATE #__menu' + . ' SET name = '.$db->Quote($row->title) + . ' WHERE name = '.$db->Quote($oldtitle) + . ' AND type = "content_section"' + ; + $db->setQuery( $query ); + $db->query(); + } + } + + // if new item order last in appropriate group + if (!$row->id) { + $row->ordering = $row->getNextOrder(); + } + + if (!$row->store()) { + JError::raiseError(500, $row->getError() ); + } + $row->checkin(); + + switch ( $task ) + { + case 'go2menu': + $mainframe->redirect( 'index.php?option=com_menus&menutype='. $menu ); + break; + + case 'go2menuitem': + $mainframe->redirect( 'index.php?option=com_menus&menutype='. $menu .'&task=edit&id='. $menuid ); + break; + + case 'apply': + $msg = JText::_( 'Changes to Section saved' ); + $mainframe->redirect( 'index.php?option='. $option .'&scope='. $scope .'&task=edit&cid[]='. $row->id, $msg ); + break; + + case 'save': + default: + $msg = JText::_( 'Section saved' ); + $mainframe->redirect( 'index.php?option='. $option .'&scope='. $scope, $msg ); + break; + } + } + + function copyselect() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('section'); + if(!$model->setAccess($cid, 2)) { + $msg = $model->getError(); + } + + $scope = JRequest::getCmd( 'scope' ); + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope, $msg ); + } + + function copysave() + { + global $mainframe; + + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $db =& JFactory::getDBO(); + $scope = JRequest::getString( 'scope' ); + $sectionid = JRequest::getVar( 'cid' ); + $contentid = JRequest::getVar( 'content' ); + $categoryid = JRequest::getVar( 'category' ); + JArrayHelper::toInteger($sectionid); + JArrayHelper::toInteger($contentid); + JArrayHelper::toInteger($categoryid); + + // copy section + $copied = array(); + $section =& JTable::getInstance('section'); + foreach( $sectionid as $id ) { + $section->load( $id ); + $section->id = NULL; + + // Adds name to list + $copied[] = $section->name; + + // Make new section names less ambiguous + $section->title = JTEXT::sprintf('Copy of', $section->title); + $section->name = JTEXT::sprintf('Copy of', $section->name); + + if ( !$section->check() ) { + copySectionSelect('com_sections', $sectionid, $scope ); + JError::raiseWarning(500, $section->getError() ); + return; + } + + if ( !$section->store() ) { + JError::raiseError(500, $section->getError() ); + } + $section->checkin(); + $section->reorder( 'scope = '.$db->Quote($section->scope) ); + // stores original catid + $newsectids[]["old"] = $id; + // pulls new catid + $newsectids[]["new"] = $section->id; + } + + // copy categories + $category =& JTable::getInstance('category'); + foreach( $categoryid as $id ) { + $category->load( $id ); + $category->id = NULL; + // Make new category names less ambiguous + $category->title = JTEXT::sprintf('Copy of', $category->title); + $category->name = JTEXT::sprintf('Copy of', $category->name); + + foreach( $newsectids as $newsectid ) { + if ( $category->section == $newsectid["old"] ) { + $category->section = $newsectid["new"]; + } + } + if (!$category->check()) { + JError::raiseError(500, $category->getError() ); + } + + if (!$category->store()) { + JError::raiseError(500, $category->getError() ); + } + $category->checkin(); + $category->reorder( 'section = '.$db->Quote($category->section) ); + // stores original catid + $newcatids[]["old"] = $id; + // pulls new catid + $newcatids[]["new"] = $category->id; + } + + $content =& JTable::getInstance('content'); + foreach( $contentid as $id) { + $content->load( $id ); + $content->id = NULL; + $content->hits = 0; + // Make new article names less ambiguous + $content->title = JText::sprintf('Copy of', $content->title); + foreach( $newsectids as $newsectid ) { + if ( $content->sectionid == $newsectid["old"] ) { + $content->sectionid = $newsectid["new"]; + } + } + foreach( $newcatids as $newcatid ) { + if ( $content->catid == $newcatid["old"] ) { + $content->catid = $newcatid["new"]; + } + } + if (!$content->check()) { + JError::raiseError(500, $content->getError() ); + } + + if (!$content->store()) { + JError::raiseError(500, $content->getError() ); + } + $content->checkin(); + } + $msg = JText::sprintf( 'DESCCATANDITEMSCOPIED', implode(', ', $copied) ); + $mainframe->redirect( 'index.php?option=com_sections&scope=content', $msg ); + } + + function remove() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $db =& JFactory::getDBO(); + $scope = JRequest::getCmd( 'scope' ); + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select a section to delete', true ) ); + } + + $cids = implode( ',', $cid ); + + $query = 'SELECT s.id, s.name, COUNT(c.id) AS numcat' + . ' FROM #__sections AS s' + . ' LEFT JOIN #__categories AS c ON c.section=s.id' + . ' WHERE s.id IN ( '.$cids.' )' + . ' GROUP BY s.id' + ; + $db->setQuery( $query ); + if (!($rows = $db->loadObjectList())) { + echo "\n"; + } + + $err = array(); + $cid = array(); + foreach ($rows as $row) { + if ($row->numcat == 0) { + $cid[] = (int) $row->id; + $name[] = $row->name; + } else { + $err[] = $row->name; + } + } + + if (count( $cid )) + { + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__sections' + . ' WHERE id IN ( '.$cids.' )' + ; + $db->setQuery( $query ); + if (!$db->query()) { + echo "\n"; + } + } + + if (count( $err )) + { + $cids = implode( ', ', $err ); + $msg = JText::sprintf( 'DESCCANNOTBEREMOVED', $cids ); + } + else + { + $names = implode( ', ', $name ); + $msg = JText::sprintf( 'Sections successfully deleted', $names ); + } + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope, $msg ); + } + + + function publish() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to publish' ) ); + } + + $model = $this->getModel('section'); + if(!$model->publish($cid, 1)) { + echo "\n"; + } + + $scope = JRequest::getCmd( 'scope' ); + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope ); + } + + + function unpublish() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to unpublish' ) ); + } + + $model = $this->getModel('section'); + if(!$model->publish($cid, 0)) { + echo "\n"; + } + + $scope = JRequest::getCmd( 'scope' ); + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope ); + } + + function cancel() + { + // Checkin the section + $model = $this->getModel('section'); + $model->checkin(); + + $scope = JRequest::getCmd( 'scope' ); + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope ); + } + + + function orderup() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $model = $this->getModel('section'); + $model->move(-1); + + $scope = JRequest::getCmd( 'scope' ); + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope ); + } + + function orderdown() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $model = $this->getModel('section'); + $model->move(1); + + $scope = JRequest::getCmd( 'scope' ); + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope ); + } + + function saveorder() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + $order = JRequest::getVar( 'order', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + JArrayHelper::toInteger($order); + + $model = $this->getModel('section'); + $model->saveorder($cid, $order); + + $msg = 'New ordering saved'; + $scope = JRequest::getCmd( 'scope' ); + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope, $msg ); + } + + function accesspublic() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('section'); + if(!$model->setAccess($cid, 0)) { + $msg = $model->getError(); + } + + $scope = JRequest::getCmd( 'scope' ); + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope, $msg ); + } + + function accessregistered() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('section'); + if(!$model->setAccess($cid, 1)) { + $msg = $model->getError(); + } + + $scope = JRequest::getCmd( 'scope' ); + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope, $msg ); + } + + function accessspecial() + { + // Check for request forgeries. + $token = JUtility::getToken(); + if (!JRequest::getInt($token, 0, 'post')) { + JError::raiseError(403, 'Request Forbidden'); + } + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + $msg = ''; + $model = $this->getModel('section'); + if(!$model->setAccess($cid, 2)) { + $msg = $model->getError(); + } + + $scope = JRequest::getCmd( 'scope' ); + $this->setRedirect( 'index.php?option=com_sections&scope='.$scope, $msg ); + } +} \ No newline at end of file diff --git a/administrator/components/com_sections/index.html b/administrator/components/com_sections/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_sections/index.html +++ b/administrator/components/com_sections/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_sections/models/index.html b/administrator/components/com_sections/models/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_sections/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_sections/models/section.php b/administrator/components/com_sections/models/section.php new file mode 100644 index 0000000000000..6bc9842213a46 --- /dev/null +++ b/administrator/components/com_sections/models/section.php @@ -0,0 +1,396 @@ +setId((int)$array[0]); + } + + /** + * Method to set the section identifier + * + * @access public + * @param int Section identifier + */ + function setId($id) + { + // Set section id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a section + * + * @since 1.5 + */ + function &getData() + { + // Load the section data + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Tests if section is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.5 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_loadData()) + { + if ($uid) { + return ($this->_data->checked_out && $this->_data->checked_out != $uid); + } else { + return $this->_data->checked_out; + } + } + } + + /** + * Method to checkin/unlock the section + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function checkin() + { + if ($this->_id) + { + $section = & $this->getTable(); + if(! $section->checkin($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return true; + } + return false; + } + + /** + * Method to checkout/lock the section + * + * @access public + * @param int $uid User ID of the user checking the section out + * @return boolean True on success + * @since 1.5 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the section with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $section = & $this->getTable(); + if(!$section->checkout($uid, $this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + return true; + } + return false; + } + + /** + * Method to store the section + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function store($data) + { + $row =& $this->getTable(); + + // Bind the form fields to the web link table + if (!$row->bind($data)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // if new item, order last in appropriate group + if (!$row->id) { + $where = 'catid = ' . (int) $row->catid ; + $row->ordering = $row->getNextOrder( $where ); + } + + // Make sure the web link table is valid + if (!$row->check()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // Store the web link table to the database + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to remove a section + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function delete($cid = array()) + { + $result = false; + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + $query = 'DELETE FROM #__sections' + . ' WHERE id IN ( '.$cids.' )'; + $this->_db->setQuery( $query ); + if(!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to (un)publish a section + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function publish($cid = array(), $publish = 1) + { + $user =& JFactory::getUser(); + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__sections' + . ' SET published = '.(int) $publish + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + + /** + * Method to move a section + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function move($direction) + { + $row =& $this->getTable(); + if (!$row->load($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if (!$row->move( $direction, ' published >= 0 ' )) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + + /** + * Method to move a section + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function saveorder($cid = array(), $order) + { + $row =& $this->getTable(); + $groupings = array(); + + // update ordering values + for( $i=0; $i < count($cid); $i++ ) + { + $row->load( (int) $cid[$i] ); + + if ($row->ordering != $order[$i]) + { + $row->ordering = $order[$i]; + if (!$row->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + } + + // execute updateOrder + $row->reorder(' 1 '); + + return true; + } + + /** + * Method to load section data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = 'SELECT s.* '. + ' FROM #__sections AS s' . + ' WHERE s.id = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the section data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $section = new stdClass(); + $section->id = 0; + $section->name = null; + $section->alias = null; + $section->title = null; + $section->image = null; + $section->image_position = null; + $section->scope = null; + $section->description = null; + $section->count = 0; + $section->params = null; + $section->published = 0; + $section->checked_out = 0; + $section->checked_out_time = 0; + $section->ordering = 0; + $section->archived = 0; + $section->approved = 0; + $section->categories = 0; + $section->active = 0; + $section->trash = 0; + $this->_data = $section; + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to set the section access + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function setAccess($cid = array(), $access = 0) + { + if (count( $cid )) + { + $user =& JFactory::getUser(); + + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__sections' + . ' SET access = '.(int) $access + . ' WHERE id IN ( '.$cids.' )' + . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_sections/models/sections.php b/administrator/components/com_sections/models/sections.php new file mode 100644 index 0000000000000..49ecd7e1f7d1f --- /dev/null +++ b/administrator/components/com_sections/models/sections.php @@ -0,0 +1,243 @@ +getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); + $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 's.ordering', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter->search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $this->_filter = $filter; + } + + /** + * Method to get Sections item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + $this->getSectionTotals(); + } + + return $this->_data; + } + + /** + * Method to get the total number of section items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get the section totals + * + * @access public + */ + function getSectionTotals() + { + $db =& JFactory::getDBO(); + + $count = count( $this->_data ); + // number of Active Categories + for ( $i = 0; $i < $count; $i++ ) { + $query = 'SELECT COUNT( a.id )' + . ' FROM #__categories AS a' + . ' WHERE a.section = '.$db->Quote($this->_data[$i]->id) + . ' AND a.published <> -2' + ; + $db->setQuery( $query ); + $active = $db->loadResult(); + $this->_data[$i]->categories = $active; + } + // number of Active Items + for ( $i = 0; $i < $count; $i++ ) { + $query = 'SELECT COUNT( a.id )' + . ' FROM #__content AS a' + . ' WHERE a.sectionid = '.(int) $this->_data[$i]->id + . ' AND a.state <> -2' + ; + $db->setQuery( $query ); + $active = $db->loadResult(); + $this->_data[$i]->active = $active; + } + // number of Trashed Items + for ( $i = 0; $i < $count; $i++ ) { + $query = 'SELECT COUNT( a.id )' + . ' FROM #__content AS a' + . ' WHERE a.sectionid = '.(int) $this->_data[$i]->id + . ' AND a.state = -2' + ; + $db->setQuery( $query ); + $trash = $db->loadResult(); + $this->_data[$i]->trash = $trash; + } + } + + /** + * Method to get a pagination object for the Sections + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the sections + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + function _buildQuery() + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = ' SELECT s.*, u.name AS editor, g.name AS groupname ' + . ' FROM #__sections AS s ' + . ' LEFT JOIN #__users AS u ON u.id = s.checked_out ' + . ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = s.access' + . $where + . $orderby + ; + + return $query; + } + + function _buildContentOrderBy() + { + if ($this->_filter->order == 's.ordering'){ + $orderby = ' ORDER BY s.ordering '.$this->_filter->order_Dir; + } else { + $orderby = ' ORDER BY '.$this->_filter->order.' '.$this->_filter->order_Dir.' , s.ordering '; + } + + return $orderby; + } + + function _buildContentWhere() + { + $search = JString::strtolower( $this->_filter->search ); + + $where = array(); + + if ($search) { + $where[] = 'LOWER(s.title) LIKE '.$this->_db->Quote('%'.$this->_db->getEscaped( $search, true ).'%'); + } + if ( $this->_filter->state ) { + if ( $this->_filter->state == 'P' ) { + $where[] = 's.published = 1'; + } else if ($this->_filter->state == 'U' ) { + $where[] = 's.published = 0'; + } + } + + $where = ( count( $where ) ? ' WHERE '. implode( ' AND ', $where ) : '' ); + + return $where; + } +} \ No newline at end of file diff --git a/administrator/components/com_newsfeeds/toolbar.newsfeeds.php b/administrator/components/com_sections/sections.php similarity index 70% rename from administrator/components/com_newsfeeds/toolbar.newsfeeds.php rename to administrator/components/com_sections/sections.php index 5f0649039dde8..0bdff16f5837e 100644 --- a/administrator/components/com_newsfeeds/toolbar.newsfeeds.php +++ b/administrator/components/com_sections/sections.php @@ -15,18 +15,11 @@ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); -require_once( JApplicationHelper::getPath( 'toolbar_html' ) ); +// Require the base controller +require_once JPATH_COMPONENT.DS.'controller.php'; -switch ($task) -{ - case 'add' : - TOOLBAR_newsfeeds::_EDIT(false); - break; - case 'edit': - TOOLBAR_newsfeeds::_EDIT(true); - break; +$controller = new SectionsController( ); - default: - TOOLBAR_newsfeeds::_DEFAULT(); - break; -} \ No newline at end of file +// Perform the Request task +$controller->execute( JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_sections/sections.xml b/administrator/components/com_sections/sections.xml new file mode 100644 index 0000000000000..0a82b433ae5a3 --- /dev/null +++ b/administrator/components/com_sections/sections.xml @@ -0,0 +1,12 @@ + + + Sections + Joomla! Project + December 2007 + (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + This component manages sections + diff --git a/administrator/components/com_sections/tables/index.html b/administrator/components/com_sections/tables/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_sections/tables/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_sections/tables/section.php b/administrator/components/com_sections/tables/section.php new file mode 100644 index 0000000000000..c85c596198b16 --- /dev/null +++ b/administrator/components/com_sections/tables/section.php @@ -0,0 +1,82 @@ +name); + + if(empty($this->alias) || $this->alias === $alias ) { + $this->alias = $alias; + } + + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_sections/toolbar.sections.html.php b/administrator/components/com_sections/toolbar.sections.html.php deleted file mode 100644 index a61e3768a5c60..0000000000000 --- a/administrator/components/com_sections/toolbar.sections.html.php +++ /dev/null @@ -1,66 +0,0 @@ -[ '. $text.' ]', 'sections.png' ); - JToolBarHelper::save(); - JToolBarHelper::apply(); - if ( $edit ) { - // for existing items the button is renamed `close` - JToolBarHelper::cancel( 'cancel', 'Close' ); - } else { - JToolBarHelper::cancel(); - } - JToolBarHelper::help( 'screen.sections.edit' ); - } - /** - * Draws the menu for Copying existing sections - * @param int The published state (to display the inverse button) - */ - function _COPY() { - JToolBarHelper::title( JText::_( 'Section' ) .': [ '. JText::_( 'Copy' ).' ]', 'section.png' ); - //JToolBarHelper::title( JText::_( 'Copy Section' ), 'sections.png' ); - JToolBarHelper::save( 'copysave' ); - JToolBarHelper::cancel(); - } - /** - * Draws the menu for Editing an existing category - */ - function _DEFAULT(){ - JToolBarHelper::title( JText::_( 'Section Manager' ), 'sections.png' ); - JToolBarHelper::publishList(); - JToolBarHelper::unpublishList(); - JToolBarHelper::customX( 'copyselect', 'copy.png', 'copy_f2.png', 'Copy', true ); - JToolBarHelper::deleteList(); - JToolBarHelper::editListX(); - JToolBarHelper::addNewX(); - JToolBarHelper::help( 'screen.sections' ); - } -} \ No newline at end of file diff --git a/administrator/components/com_sections/views/copyselect/index.html b/administrator/components/com_sections/views/copyselect/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_sections/views/copyselect/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_sections/views/copyselect/tmpl/default.php b/administrator/components/com_sections/views/copyselect/tmpl/default.php new file mode 100644 index 0000000000000..ca0fe8f1ab792 --- /dev/null +++ b/administrator/components/com_sections/views/copyselect/tmpl/default.php @@ -0,0 +1,97 @@ + + + + + + +[ '. JText::_( 'Copy' ).' ]', 'section.png' ); + JToolBarHelper::save( 'copysave' ); + JToolBarHelper::cancel(); +?> + +
    + + + + + + + + . + +
    + : +
    + "; + foreach ( $this->sections as $section ) { + ?> +
  • title; ?>
  • + + "; + ?> +
    + : +
    + "; + foreach ( $this->categories as $category ) { + ?> +
  • title; ?>
  • + + "; + ?> +
    + : +
    + "; + foreach ( $this->contents as $content ) { + ?> +
  • title; ?>
  • + + "; + ?> +
    + +
    + +
    + +
    +

    + + + + + +cid as $id ) { + ?> + + + +
    \ No newline at end of file diff --git a/administrator/components/com_sections/views/copyselect/tmpl/index.html b/administrator/components/com_sections/views/copyselect/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_sections/views/copyselect/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_sections/views/copyselect/view.html.php b/administrator/components/com_sections/views/copyselect/view.html.php new file mode 100644 index 0000000000000..e2ac2f2441c97 --- /dev/null +++ b/administrator/components/com_sections/views/copyselect/view.html.php @@ -0,0 +1,77 @@ +setQuery( $query ); + $sections = $db->loadObjectList(); + + ## query to list selected categories + $cids = implode( ',', $cid ); + $query = 'SELECT a.title, a.id' + . ' FROM #__categories AS a' + . ' WHERE a.section IN ( '.$cids.' )' + ; + $db->setQuery( $query ); + $categories = $db->loadObjectList(); + + ## query to list items from categories + $query = 'SELECT a.title, a.id' + . ' FROM #__content AS a' + . ' WHERE a.sectionid IN ( '.$cids.' )' + . ' ORDER BY a.sectionid, a.catid, a.title' + ; + $db->setQuery( $query ); + $contents = $db->loadObjectList(); + + $this->assignRef('sections', $sections); + $this->assignRef('categories', $categories); + $this->assignRef('contents', $contents); + $this->assignRef('cid', $cid); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_sections/views/index.html b/administrator/components/com_sections/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_sections/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_sections/views/section/index.html b/administrator/components/com_sections/views/section/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_sections/views/section/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_sections/views/section/tmpl/default.php b/administrator/components/com_sections/views/section/tmpl/default.php new file mode 100644 index 0000000000000..7db5c3b61b7b5 --- /dev/null +++ b/administrator/components/com_sections/views/section/tmpl/default.php @@ -0,0 +1,163 @@ + + + + + + +[ '. $text.' ]', 'sections.png' ); + JToolBarHelper::save(); + JToolBarHelper::apply(); + if ( $edit ) { + // for existing items the button is renamed `close` + JToolBarHelper::cancel( 'cancel', 'Close' ); + } else { + JToolBarHelper::cancel(); + } + JToolBarHelper::help( 'screen.sections.edit' ); +?> + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + : + + + row->scope; ?> + +
    + + + +
    + + + +
    + : + + lists['published']; ?> +
    + + + lists['ordering']; ?> +
    + + + lists['access']; ?> + + row->image != 'blank.png') { + $path.= 'stories/'; + } + ?> + <?php echo JText::_( 'Preview' ); ?> +
    + + + lists['image']; ?> +
    + + + lists['image_position']; ?> +
    +
    + +
    + + + + + + +
    + display( 'description', $this->row->description, '550', '300', '60', '20', array('pagebreak', 'readmore') ) ; + ?> +
    +
    +
    +
    + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_sections/views/section/tmpl/index.html b/administrator/components/com_sections/views/section/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_sections/views/section/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_sections/views/section/view.html.php b/administrator/components/com_sections/views/section/view.html.php new file mode 100644 index 0000000000000..23a10d0c5efdd --- /dev/null +++ b/administrator/components/com_sections/views/section/view.html.php @@ -0,0 +1,90 @@ +getModel(); + + //get the section + $row =& $this->get('data'); + $edit = JRequest::getVar('edit',true); + + // fail if checked out not by 'me' + if ($model->isCheckedOut( $user->get('id') )) { + $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The section' ), $row->title ); + $mainframe->redirect( 'index.php?option='. $option .'&scope='. $row->scope, $msg ); + } + + if ( $edit ) { + $model->checkout( $user->get('id') ); + } else { + $row->scope = $scope; + $row->published = 1; + } + + // build the html select list for ordering + $query = 'SELECT ordering AS value, title AS text' + . ' FROM #__sections' + . ' WHERE scope='.$db->Quote($row->scope).' ORDER BY ordering' + ; + if($edit) + $lists['ordering'] = JHTML::_('list.specificordering', $row, $cid[0], $query ); + else + $lists['ordering'] = JHTML::_('list.specificordering', $row, '', $query ); + + // build the select list for the image positions + $active = ( $row->image_position ? $row->image_position : 'left' ); + $lists['image_position'] = JHTML::_('list.positions', 'image_position', $active, NULL, 0 ); + // build the html select list for images + $lists['image'] = JHTML::_('list.images', 'image', $row->image ); + // build the html select list for the group access + $lists['access'] = JHTML::_('list.accesslevel', $row ); + // build the html radio buttons for published + $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published ); + + $this->assignRef('user', $user); + $this->assignRef('lists', $lists); + $this->assignRef('row', $row); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_sections/views/sections/index.html b/administrator/components/com_sections/views/sections/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_sections/views/sections/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_sections/views/sections/tmpl/default.php b/administrator/components/com_sections/views/sections/tmpl/default.php new file mode 100644 index 0000000000000..d3db09375332e --- /dev/null +++ b/administrator/components/com_sections/views/sections/tmpl/default.php @@ -0,0 +1,146 @@ + + +filter->order == 's.ordering'); + + JHTML::_('behavior.tooltip'); +?> + +
    + + + + + + +
    + : + + + + + filter->state ); + ?> +
    + + + + + + + + + + + + + + + + + + + + + + +rows ); $i < $n; $i++ ) { + $row = &$this->rows[$i]; + + $link = 'index.php?option=com_sections&scope=content&task=edit&cid[]='. $row->id; + + $access = JHTML::_('grid.access', $row, $i ); + $checked = JHTML::_('grid.checkedout', $row, $i ); + $published = JHTML::_('grid.published', $row, $i ); + ?> + "> + + + + + + + + + + + + + + +
    + + + + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + rows ); ?> + + filter->order_Dir, @$this->filter->order ); ?> + + + + + + + + filter->order_Dir, @$this->filter->order ); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset( $i ); ?> + + + + + user->get ('id'), $row->checked_out ) ) { + echo $row->title; + } else { + ?> + + title; ?> + + + + + pagination->orderUpIcon( $i, true, 'orderup', 'Move Up', $ordering ); ?> + pagination->orderDownIcon( $i, $n, true, 'orderdown', 'Move Down', $ordering ); ?> + + class="text_area" style="text-align: center" /> + + + + categories; ?> + + active; ?> + + trash; ?> + + id; ?> +
    + + + + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_sections/views/sections/tmpl/index.html b/administrator/components/com_sections/views/sections/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_sections/views/sections/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_sections/views/sections/view.html.php b/administrator/components/com_sections/views/sections/view.html.php new file mode 100644 index 0000000000000..52b6368392e16 --- /dev/null +++ b/administrator/components/com_sections/views/sections/view.html.php @@ -0,0 +1,68 @@ +get( 'Data'); + $pagination = & $this->get( 'Pagination' ); + $filter = & $this->get( 'Filter'); + + $this->assignRef('user', $user); + $this->assignRef('scope', $scope); + $this->assignRef('rows', $rows); + $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_templates/admin.templates.html.php b/administrator/components/com_templates/admin.templates.html.php deleted file mode 100644 index 43de3adbf5069..0000000000000 --- a/administrator/components/com_templates/admin.templates.html.php +++ /dev/null @@ -1,620 +0,0 @@ -authorUrl) && $row->authorUrl != '') { - $row->authorUrl = str_replace('http://', '', $row->authorUrl); - } - - JHTML::_('behavior.tooltip'); -?> -
    - - - - - - - id == 1) { -?> - - - - - - - - - - - - - - - - - authorEmail . '
    ' . @ $row->authorUrl; -?> - - - - - id == 1) { -?> - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - getListFooter(); ?> -
    - getRowOffset( $i ); ?> - - get ('id'), $row->checked_out )) { -?> -   - - - - id == 1 ? JURI::root().'administrator' : $mainframe->getSiteURL() ).'/templates/'.$row->directory.'/template_thumbnail.png'; ?> - - name;?> - - published == 1) { -?> - <?php echo JText::_( 'Published' ); ?> - -   - - - published == 1) { -?> - <?php echo JText::_( 'Default' ); ?> - -   - - - assigned == 1) { -?> - <?php echo JText::_( 'Assigned' ); ?> - -   - - - version; ?> - - creationdate; ?> - - - author != '' ? $row->author : ' '; ?> - -
    - - - - - - -
    - id ? JURI::base() : $mainframe->getSiteURL(); -?> - - - - - - - - - - -
    - - - '_blank')); ?> -
    - 'previewFrame')) ?> -
    - -
    - - -
    - - - - - -

    message); ?>

    - - - - - - - - - - - - - -
    - - - -
    - - - -
    -
    - - -
    -
    - - - - - - - - - - - -
    - : - - - name); ?> - -
    - : - - description); ?> -
    -
    - -
    - - - - - - - - pages != 'all' && $client->id != 1) : ?> - - - - - -
    - : - - id == 1) { - echo JText::_('Cannot assign administrator template'); - } elseif ($row->pages == 'all') { - echo JText::_('Cannot assign default template'); - echo ''; - } elseif ($row->pages == 'none') { ?> - - - - - - -
    - : - - - pages == 'none') { ?> - - -
    -
    -
    - -
    -
    - - path.$templatefile) ? JText::sprintf('PARAMSWRITABLE', $templatefile):JText::sprintf('PARAMSUNWRITABLE', $templatefile); ?> - - - - -
    - render(); - } else { - echo '' . JText :: _('No Parameters') . ''; - } -?> -
    -
    -
    -
    - - - - - - -
    - path .DS. 'templates' .DS. $template .DS. 'index.php'; -?> -
    - - -
    - - - - - -

    message); ?>

    - - - - - - - - - - - - - -
    - - - -
    - - - -
    -
    - - - - - - - - - -
    - -
    - -
    - -
    - - - - - - - -
    - -
    - - - - - -
    -   -
    - - - - - - - - - - - - - -
    - - - - - / -
    - - - - - '. JText::_( 'Writable' ) .'' : ' '. JText::_( 'Unwritable' ) .'' ?> -
    - - - - - - -
    - path . $filename; - -?> -
    - - -
    - - - - - -

    message); ?>

    - - - - - - - - - - - - - -
    - - - -
    - - - -
    -
    - - - - - - - - - -
    - -
    - -
    - - - - - - - - -
    - authorize('com_templates', 'manage')) { - $mainframe->redirect('index.php', JText::_('ALERTNOTAUTH')); -} - -// Set the table directory -JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_templates'.DS.'tables'); - -// Import file dependencies -require_once (JPATH_COMPONENT.DS.'helpers'.DS.'template.php'); -require_once (JPATH_COMPONENT.DS.'controller.php'); - -$task = JRequest::getCmd('task'); - -$client = JRequest::getVar('client', 0, '', 'int'); - -if ($client == 1) { - JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_templates&client=0'); - JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_templates&client=1', true); -} elseif ($client == 0 && !$task) { - JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_templates&client=0', true); - JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_templates&client=1'); -} else { - JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_templates&client=0'); - JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_templates&client=1'); -} - -switch ($task) -{ - case 'edit' : - TemplatesController::editTemplate(); - break; - - case 'save' : - case 'apply' : - TemplatesController::saveTemplate(); - break; - - case 'edit_source' : - TemplatesController::editTemplateSource(); - break; - - case 'save_source' : - case 'apply_source' : - TemplatesController::saveTemplateSource(); - break; - - case 'choose_css' : - TemplatesController::chooseTemplateCSS(); - break; - - case 'edit_css' : - TemplatesController::editTemplateCSS(); - break; - - case 'save_css' : - case 'apply_css' : - TemplatesController::saveTemplateCSS(); - break; - - case 'publish' : - case 'default' : - TemplatesController::publishTemplate(); - break; - - case 'cancel' : - TemplatesController::cancelTemplate(); - break; - - case 'save_positions' : - TemplatesController::savePositions(); - break; - - case 'preview' : - TemplatesController::previewTemplate(); - break; - - default : - TemplatesController::viewTemplates(); - break; -} \ No newline at end of file diff --git a/administrator/components/com_templates/controller.php b/administrator/components/com_templates/controller.php index 98402289fb6f7..82261b2803f1f 100644 --- a/administrator/components/com_templates/controller.php +++ b/administrator/components/com_templates/controller.php @@ -5,439 +5,200 @@ * @subpackage Templates * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php - * Joomla! is free software. This version may have been modified pursuant to the - * GNU General Public License, and as distributed it includes or is derivative - * of works licensed under the GNU General Public License or other free or open - * source software licenses. See COPYRIGHT.php for copyright notices and - * details. + * Joomla! is free software. This version may have been modified pursuant + * to the GNU General Public License, and as distributed it includes or + * is derivative of works licensed under the GNU General Public License or + * other free or open source software licenses. + * See COPYRIGHT.php for copyright notices and details. */ -/** - * @package Joomla - * @subpackage Templates - */ -class TemplatesController +// no direct access +defined( '_JEXEC' ) or die( 'Restricted access' ); + +jimport( 'joomla.application.component.controller' ); + +class TemplatesController extends JController { /** - * Compiles a list of installed, version 4.5+ templates - * - * Based on xml files found. If no xml file found the template - * is ignored - */ - function viewTemplates() + * Constructor + */ + function __construct( $config = array() ) { - global $mainframe, $option; - - // Initialize some variables - $db =& JFactory::getDBO(); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); + parent::__construct( $config ); - // Initialize the pagination variables - $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); - $limitstart = $mainframe->getUserStateFromRequest($option.'.'.$client->id.'.limitstart', 'limitstart', 0, 'int'); - - $select[] = JHTML::_('select.option', '0', JText::_('Site')); - $select[] = JHTML::_('select.option', '1', JText::_('Administrator')); - $lists['client'] = JHTML::_('select.genericlist', $select, 'client', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $client->id); - - $tBaseDir = $client->path.DS.'templates'; - - //get template xml file info - $rows = array(); - $rows = TemplatesHelper::parseXMLTemplateFiles($tBaseDir); - - // set dynamic template information - for($i = 0; $i < count($rows); $i++) { - $rows[$i]->assigned = TemplatesHelper::isTemplateAssigned($rows[$i]->directory); - $rows[$i]->published = TemplatesHelper::isTemplateDefault($rows[$i]->directory, $client->id); - } - - jimport('joomla.html.pagination'); - $page = new JPagination(count($rows), $limitstart, $limit); - - $rows = array_slice($rows, $page->limitstart, $page->limit); - - require_once (JPATH_COMPONENT.DS.'admin.templates.html.php'); - TemplatesView::showTemplates($rows, $lists, $page, $option, $client); + // Register Extra tasks + $this->registerTask( 'apply', 'save' ); + $this->registerTask( 'apply_source', 'save_source' ); + $this->registerTask( 'apply_css', 'save_css' ); + $this->registerTask( 'default', 'publish' ); } /** - * Show the template with module position in an iframe + * Edit Template */ - function previewTemplate() + function edit() { - $template = JRequest::getVar('id', '', 'method', 'cmd'); - $option = JRequest::getCmd('option'); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - - if (!$template) - { - return JError::raiseWarning( 500, JText::_('Template not specified') ); - } - - // Set FTP credentials, if given - jimport('joomla.client.helper'); - JClientHelper::setCredentialsFromRequest('ftp'); - - require_once (JPATH_COMPONENT.DS.'admin.templates.html.php'); - TemplatesView::previewTemplate($template, true, $client, $option); + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'template'); + parent::display(); } /** - * Publish, or make current, the selected template + * Save Template */ - function publishTemplate() - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - // Initialize some variables - $db = & JFactory::getDBO(); - $cid = JRequest::getVar('cid', array(), 'method', 'array'); - $cid = array(JFilterInput::clean(@$cid[0], 'cmd')); - $option = JRequest::getCmd('option'); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - - if ($cid[0]) - { - $query = 'DELETE FROM #__templates_menu' . - ' WHERE client_id = '.(int) $client->id . - ' AND (menuid = 0 OR template = '.$db->Quote($cid[0]).')'; - $db->setQuery($query); - $db->query(); - - $query = 'INSERT INTO #__templates_menu' . - ' SET client_id = '.(int) $client->id .', template = '.$db->Quote($cid[0]).', menuid = 0'; - $db->setQuery($query); - $db->query(); - } - - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id); - } - - function editTemplate() + function save() { - jimport('joomla.filesystem.path'); - - // Initialize some variables - $db = & JFactory::getDBO(); - $cid = JRequest::getVar('cid', array(), 'method', 'array'); - $cid = array(JFilterInput::clean(@$cid[0], 'cmd')); - $template = $cid[0]; - $option = JRequest::getCmd('option'); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - - if (!$cid[0]) { - return JError::raiseWarning( 500, JText::_('Template not specified') ); - } - - $tBaseDir = JPath::clean($client->path.DS.'templates'); - - if (!is_dir( $tBaseDir . DS . $template )) { - return JError::raiseWarning( 500, JText::_('Template not found') ); - } - $lang =& JFactory::getLanguage(); - $lang->load( 'tpl_'.$template, JPATH_ADMINISTRATOR ); - - $ini = $client->path.DS.'templates'.DS.$template.DS.'params.ini'; - $xml = $client->path.DS.'templates'.DS.$template.DS.'templateDetails.xml'; - $row = TemplatesHelper::parseXMLTemplateFile($tBaseDir, $template); - - jimport('joomla.filesystem.file'); - // Read the ini file - if (JFile::exists($ini)) { - $content = JFile::read($ini); - } else { - $content = null; - } - - $params = new JParameter($content, $xml, 'template'); - - $assigned = TemplatesHelper::isTemplateAssigned($row->directory); - $default = TemplatesHelper::isTemplateDefault($row->directory, $client->id); - - if($client->id == '1') { - $lists['selections'] = JText::_('Cannot assign an administrator template'); - } else { - $lists['selections'] = TemplatesHelper::createMenuList($template); - } - - if ($default) { - $row->pages = 'all'; - } elseif (!$assigned) { - $row->pages = 'none'; - } else { - $row->pages = null; - } - - // Set FTP credentials, if given - jimport('joomla.client.helper'); - $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); - - require_once (JPATH_COMPONENT.DS.'admin.templates.html.php'); - TemplatesView::editTemplate($row, $lists, $params, $option, $client, $ftp, $template); - } - - function saveTemplate() - { - global $mainframe; - // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); - // Initialize some variables - $db = & JFactory::getDBO(); - - $template = JRequest::getVar('id', '', 'method', 'cmd'); $option = JRequest::getVar('option', '', '', 'cmd'); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $menus = JRequest::getVar('selections', array(), 'post', 'array'); $params = JRequest::getVar('params', array(), 'post', 'array'); - $default = JRequest::getBool('default'); - JArrayHelper::toInteger($menus); - if (!$template) { - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::_('No template specified.')); - } - - // Set FTP credentials, if given - jimport('joomla.client.helper'); - JClientHelper::setCredentialsFromRequest('ftp'); - $ftp = JClientHelper::getCredentials('ftp'); + $model = $this->getModel('template'); + $client =& $model->getClient(); + $template =& $model->getTemplate(); - $file = $client->path.DS.'templates'.DS.$template.DS.'params.ini'; - - jimport('joomla.filesystem.file'); - if (JFile::exists($file) && count($params)) - { - $txt = null; - foreach ($params as $k => $v) { - $txt .= "$k=$v\n"; - } - - // Try to make the params file writeable - if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) { - JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the template parameter file writable')); - } - - $return = JFile::write($file, $txt); - - // Try to make the params file unwriteable - if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) { - JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the template parameter file unwritable')); - } - - if (!$return) { - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::sprintf('Failed to open file for writing.', $file)); - } - } - - // Reset all existing assignments - $query = 'DELETE FROM #__templates_menu' . - ' WHERE client_id = 0' . - ' AND template = '.$db->Quote( $template ); - $db->setQuery($query); - $db->query(); - - if ($default) { - $menus = array( 0 ); + if (!$template) { + $this->setRedirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::_('No template specified.')); + return; } - foreach ($menus as $menuid) - { - // If 'None' is not in array - if ((int) $menuid >= 0) - { - // check if there is already a template assigned to this menu item - $query = 'DELETE FROM #__templates_menu' . - ' WHERE client_id = 0' . - ' AND menuid = '.(int) $menuid; - $db->setQuery($query); - $db->query(); - - $query = 'INSERT INTO #__templates_menu' . - ' SET client_id = 0, template = '. $db->Quote( $template ) .', menuid = '.(int) $menuid; - $db->setQuery($query); - $db->query(); - } + if ($model->store($params)) { + $msg = JText::_( 'Template Saved' ); + } else { + $msg = JText::_( 'Error Saving Template' ) . $model->getError(); } $task = JRequest::getCmd('task'); if($task == 'apply') { - $mainframe->redirect('index.php?option='.$option.'&task=edit&cid[]='.$template.'&client='.$client->id); + $this->setRedirect('index.php?option='.$option.'&task=edit&cid[]='.$template.'&client='.$client->id, $msg); } else { - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id); + $this->setRedirect('index.php?option='.$option.'&client='.$client->id, $msg); } } - function cancelTemplate() + function cancel() { - global $mainframe; - // Initialize some variables $option = JRequest::getCmd('option'); $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - // Set FTP credentials, if given - jimport('joomla.client.helper'); - JClientHelper::setCredentialsFromRequest('ftp'); - - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id); + $this->setRedirect('index.php?option='.$option.'&client='.$client->id); } - function editTemplateSource() + /** + * Sets default Template + */ + function publish() { - global $mainframe; + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); // Initialize some variables - $option = JRequest::getCmd('option'); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $template = JRequest::getVar('id', '', 'method', 'cmd'); - $file = $client->path.DS.'templates'.DS.$template.DS.'index.php'; - - // Read the source file - jimport('joomla.filesystem.file'); - $content = JFile::read($file); + $db = & JFactory::getDBO(); + $cid = JRequest::getVar('cid', array(), 'method', 'array'); + $cid = array(JFilterInput::clean(@$cid[0], 'cmd')); + $option = JRequest::getCmd('option'); + $model = $this->getModel('templates'); + $client = $model->getClient(); - if ($content !== false) + if ($cid[0]) { - // Set FTP credentials, if given - jimport('joomla.client.helper'); - $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); - - $content = htmlspecialchars($content, ENT_COMPAT, 'UTF-8'); - require_once (JPATH_COMPONENT.DS.'admin.templates.html.php'); - TemplatesView::editTemplateSource($template, $content, $option, $client, $ftp); - } else { - $msg = JText::sprintf('Operation Failed Could not open', $file); - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id, $msg); + $model->setDefault($cid[0]); } + + $this->setRedirect('index.php?option='.$option.'&client='.$client->id); } - function saveTemplateSource() + /** + * Preview Template + */ + function preview() { - global $mainframe; + JRequest::setVar( 'view', 'prevuuw'); + parent::display(); + } + + /** + * Edit Template Source + */ + function edit_source() + { + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'source'); + parent::display(); + } + /** + * Save Template Source + */ + function save_source() + { // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); // Initialize some variables $option = JRequest::getCmd('option'); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $template = JRequest::getVar('id', '', 'method', 'cmd'); $filecontent = JRequest::getVar('filecontent', '', 'post', 'string', JREQUEST_ALLOWRAW); + $model = $this->getModel('source'); + $client =& $model->getClient(); + $template =& $model->getTemplate(); + if (!$template) { - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::_('No template specified.')); + $this->setRedirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::_('No template specified.')); + return; } if (!$filecontent) { - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::_('Content empty.')); + $this->setRedirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::_('Content empty.')); + return; } - // Set FTP credentials, if given - jimport('joomla.client.helper'); - JClientHelper::setCredentialsFromRequest('ftp'); - $ftp = JClientHelper::getCredentials('ftp'); - - $file = $client->path.DS.'templates'.DS.$template.DS.'index.php'; - - // Try to make the template file writeable - if (!$ftp['enabled'] && !JPath::setPermissions($file, '0755')) { - JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the template file writable')); - } - - jimport('joomla.filesystem.file'); - $return = JFile::write($file, $filecontent); - - // Try to make the template file unwriteable - if (!$ftp['enabled'] && !JPath::setPermissions($file, '0555')) { - JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the template file unwritable')); + if ($model->store($filecontent)) { + $msg = JText::_( 'Template source saved' ); + } else { + $msg = $model->getError(); } - if ($return) + $task = JRequest::getCmd('task'); + switch($task) { - $task = JRequest::getCmd('task'); - switch($task) - { - case 'apply_source': - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id.'&task=edit_source&id='.$template, JText::_('Template source saved')); - break; - - case 'save_source': - default: - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id.'&task=edit&cid[]='.$template, JText::_('Template source saved')); - break; - } - } - else { - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::sprintf('Failed to open file for writing.', $file)); + case 'apply_source': + $this->setRedirect('index.php?option='.$option.'&client='.$client->id.'&task=edit_source&id='.$template, $msg); + break; + + case 'save_source': + default: + $this->setRedirect('index.php?option='.$option.'&client='.$client->id.'&task=edit&cid[]='.$template, $msg); + break; } } - function chooseTemplateCSS() + /** + * Choose Template CSS + */ + function choose_css() { - global $mainframe; - - // Initialize some variables - $option = JRequest::getCmd('option'); - $template = JRequest::getVar('id', '', 'method', 'cmd'); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - - // Determine template CSS directory - $dir = $client->path.DS.'templates'.DS.$template.DS.'css'; - - // List template .css files - jimport('joomla.filesystem.folder'); - $files = JFolder::files($dir, '\.css$', false, false); - - // Set FTP credentials, if given - jimport('joomla.client.helper'); - JClientHelper::setCredentialsFromRequest('ftp'); - - require_once (JPATH_COMPONENT.DS.'admin.templates.html.php'); - TemplatesView::chooseCSSFiles($template, $dir, $files, $option, $client); + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'csschoose'); + parent::display(); } - function editTemplateCSS() + /** + * Edit Template CSS + */ + function edit_css() { - global $mainframe; - - // Initialize some variables - $option = JRequest::getCmd('option'); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $template = JRequest::getVar('id', '', 'method', 'cmd'); - $filename = JRequest::getVar('filename', '', 'method', 'cmd'); - - jimport('joomla.filesystem.file'); - - if (JFile::getExt($filename) !== 'css') { - $msg = JText::_('Wrong file type given, only CSS files can be edited.'); - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id.'&task=choose_css&id='.$template, $msg, 'error'); - } - - $content = JFile::read($client->path.DS.'templates'.DS.$template.DS.'css'.DS.$filename); - - if ($content !== false) - { - // Set FTP credentials, if given - jimport('joomla.client.helper'); - $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); - - $content = htmlspecialchars($content, ENT_COMPAT, 'UTF-8'); - require_once (JPATH_COMPONENT.DS.'admin.templates.html.php'); - TemplatesView::editCSSSource($template, $filename, $content, $option, $client, $ftp); - } - else - { - $msg = JText::sprintf('Operation Failed Could not open', $client->path.$filename); - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id, $msg); - } + JRequest::setVar( 'hidemainmenu', 1 ); + JRequest::setVar( 'view', 'cssedit'); + parent::display(); } - function saveTemplateCSS() + /** + * Save Template CSS + */ + function save_css() { global $mainframe; @@ -446,56 +207,40 @@ function saveTemplateCSS() // Initialize some variables $option = JRequest::getCmd('option'); - $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); - $template = JRequest::getVar('id', '', 'post', 'cmd'); - $filename = JRequest::getVar('filename', '', 'post', 'cmd'); $filecontent = JRequest::getVar('filecontent', '', 'post', 'string', JREQUEST_ALLOWRAW); + $model = $this->getModel('cssedit'); + $client =& $model->getClient(); + $template =& $model->getTemplate(); + $filename =& $model->getFilename(); + if (!$template) { - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::_('No template specified.')); + $this->setRedirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::_('No template specified.')); + return; } if (!$filecontent) { - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::_('Content empty.')); + $this->setRedirect('index.php?option='.$option.'&client='.$client->id, JText::_('Operation Failed').': '.JText::_('Content empty.')); + return; } - // Set FTP credentials, if given - jimport('joomla.client.helper'); - JClientHelper::setCredentialsFromRequest('ftp'); - $ftp = JClientHelper::getCredentials('ftp'); - - $file = $client->path.DS.'templates'.DS.$template.DS.'css'.DS.$filename; - - // Try to make the css file writeable - if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) { - JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the css file writable')); - } - - jimport('joomla.filesystem.file'); - $return = JFile::write($file, $filecontent); - - // Try to make the css file unwriteable - if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) { - JError::raiseNotice('SOME_ERROR_CODE', JText::_('Could not make the css file unwritable')); + if ($model->store($filecontent)) { + $msg = JText::_('File Saved'); + } else { + $msg = $model->getError(); } - if ($return) + $task = JRequest::getCmd('task'); + switch($task) { - $task = JRequest::getCmd('task'); - switch($task) - { - case 'apply_css': - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id.'&task=edit_css&id='.$template.'&filename='.$filename, JText::_('File Saved')); - break; - - case 'save_css': - default: - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id.'&task=edit&cid[]='.$template, JText::_('File Saved')); - break; - } - } - else { - $mainframe->redirect('index.php?option='.$option.'&client='.$client->id.'&id='.$template.'&task=choose_css', JText::_('Operation Failed').': '.JText::sprintf('Failed to open file for writing.', $file)); + case 'apply_css': + $this->setRedirect('index.php?option='.$option.'&client='.$client->id.'&task=edit_css&id='.$template.'&filename='.$filename, $msg ); + break; + + case 'save_css': + default: + $this->setRedirect('index.php?option='.$option.'&client='.$client->id.'&task=edit&cid[]='.$template, $msg); + break; } } -} +} \ No newline at end of file diff --git a/administrator/components/com_templates/helpers/index.html b/administrator/components/com_templates/helpers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_templates/helpers/index.html +++ b/administrator/components/com_templates/helpers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_templates/index.html b/administrator/components/com_templates/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_templates/index.html +++ b/administrator/components/com_templates/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_templates/models/cssedit.php b/administrator/components/com_templates/models/cssedit.php new file mode 100644 index 0000000000000..7bb6ad635b0d2 --- /dev/null +++ b/administrator/components/com_templates/models/cssedit.php @@ -0,0 +1,208 @@ +setId($id); + $this->_filename = JRequest::getVar('filename', '', 'method', 'cmd'); + $this->_client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); + } + + /** + * Method to set the Template identifier + * + * @access public + * @param int Template identifier + */ + function setId($id) + { + // Set Template id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a Template + * + * @since 1.6 + */ + function &getData() + { + // Load the data + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Method to get the client object + * + * @since 1.6 + */ + function &getClient() + { + return $this->_client; + } + + function &getTemplate() + { + return $this->_id; + } + + function &getFilename() + { + return $this->_filename; + } + + /** + * Method to store the Template + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function store($filecontent) + { + // Set FTP credentials, if given + jimport('joomla.client.helper'); + JClientHelper::setCredentialsFromRequest('ftp'); + $ftp = JClientHelper::getCredentials('ftp'); + + $file = $this->_client->path.DS.'templates'.DS.$this->_id.DS.'css'.DS.$this->_filename; + + // Try to make the css file writeable + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) { + $this->setError( JText::_('Could not make the css file writable')); + return false; + } + + jimport('joomla.filesystem.file'); + $return = JFile::write($file, $filecontent); + + // Try to make the css file unwriteable + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) { + $this->setError( JText::_('Could not make the css file unwritable')); + return false; + } + + if (!$return) + { + $this->setError( JText::_('Operation Failed').': '.JText::sprintf('Failed to open file for writing.', $file)); + return false; + } + + return true; + } + + /** + * Method to load Template data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + jimport('joomla.filesystem.file'); + + if (JFile::getExt($this->_filename) !== 'css') { + return JError::raiseWarning( 500, JText::_('Wrong file type given, only CSS files can be edited.') ); + } + + $content = JFile::read($this->_client->path.DS.'templates'.DS.$this->_id.DS.'css'.DS.$this->_filename); + + if ($content === false) + { + $this->setError(JText::sprintf('Operation Failed Could not open', $this->_client->path.DS.'templates'.DS.$this->_id.DS.'css'.DS.$this->_filename)); + return false; + } + + $content = htmlspecialchars($content, ENT_COMPAT, 'UTF-8'); + + $this->_data = $content; + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the Template data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $template = new stdClass(); + $this->_data = $template; + return (boolean) $this->_data; + } + return true; + } +} diff --git a/administrator/components/com_templates/models/index.html b/administrator/components/com_templates/models/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/models/source.php b/administrator/components/com_templates/models/source.php new file mode 100644 index 0000000000000..c8685ed151f58 --- /dev/null +++ b/administrator/components/com_templates/models/source.php @@ -0,0 +1,192 @@ +setId($id); + $this->_client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); + } + + /** + * Method to set the Template identifier + * + * @access public + * @param int Template identifier + */ + function setId($id) + { + // Set Template id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a Template + * + * @since 1.6 + */ + function &getData() + { + // Load the data + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Method to get the client object + * + * @since 1.6 + */ + function &getClient() + { + return $this->_client; + } + + function &getTemplate() + { + return $this->_id; + } + + /** + * Method to store the Template + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function store($filecontent) + { + // Set FTP credentials, if given + jimport('joomla.client.helper'); + JClientHelper::setCredentialsFromRequest('ftp'); + $ftp = JClientHelper::getCredentials('ftp'); + + $file = $this->_client->path.DS.'templates'.DS.$this->_id.DS.'index.php'; + + // Try to make the template file writeable + if (!$ftp['enabled'] && !JPath::setPermissions($file, '0755')) { + $this->setError( JText::_('Could not make the template file writable')); + return false; + } + + jimport('joomla.filesystem.file'); + $return = JFile::write($file, $filecontent); + + // Try to make the template file unwriteable + if (!$ftp['enabled'] && !JPath::setPermissions($file, '0555')) { + $this->setError( JText::_('Could not make the template file unwritable')); + return false; + } + + if (!$return) + { + $this->setError( JText::_('Operation Failed').': '.JText::sprintf('Failed to open file for writing.', $file)); + return false; + } + + return true; + } + + /** + * Method to load Template data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $file = $this->_client->path.DS.'templates'.DS.$this->_id.DS.'index.php'; + + // Read the source file + jimport('joomla.filesystem.file'); + $content = JFile::read($file); + + if ($content === false) + { + $this->setError(JText::sprintf('Operation Failed Could not open', $file)); + return false; + } + $content = htmlspecialchars($content, ENT_COMPAT, 'UTF-8'); + + $this->_data = $content; + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the Template data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $template = new stdClass(); + $this->_data = $template; + return (boolean) $this->_data; + } + return true; + } +} diff --git a/administrator/components/com_templates/models/template.php b/administrator/components/com_templates/models/template.php new file mode 100644 index 0000000000000..68fcf03864faf --- /dev/null +++ b/administrator/components/com_templates/models/template.php @@ -0,0 +1,277 @@ +setId($cid[0]); + + $this->_client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int')); + } + + /** + * Method to set the Template identifier + * + * @access public + * @param int Template identifier + */ + function setId($id) + { + // Set Template id and wipe data + $this->_id = $id; + $this->_data = null; + } + + /** + * Method to get a Template + * + * @since 1.6 + */ + function &getData() + { + // Load the data + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Method to get the client object + * + * @since 1.6 + */ + function &getClient() + { + return $this->_client; + } + + function &getParams() + { + $this->getData(); + return $this->_params; + } + + function &getTemplate() + { + return $this->_id; + } + + /** + * Method to store the Template + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function store($params) + { + $menus = JRequest::getVar('selections', array(), 'post', 'array'); + $default = JRequest::getBool('default'); + JArrayHelper::toInteger($menus); + + // Set FTP credentials, if given + jimport('joomla.client.helper'); + JClientHelper::setCredentialsFromRequest('ftp'); + $ftp = JClientHelper::getCredentials('ftp'); + + $file = $this->_client->path.DS.'templates'.DS.$this->_id.DS.'params.ini'; + + jimport('joomla.filesystem.file'); + if (JFile::exists($file) && count($params)) + { + $txt = null; + foreach ($params as $k => $v) { + $txt .= "$k=$v\n"; + } + + // Try to make the params file writeable + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0755')) { + $this->setError( JText::_('Could not make the template parameter file writable')); + return false; + } + + $return = JFile::write($file, $txt); + + // Try to make the params file unwriteable + if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0555')) { + $this->setError( JText::_('Could not make the template parameter file unwritable')); + return false; + } + + if (!$return) { + $this->setError( JText::_('Operation Failed').': '.JText::sprintf('Failed to open file for writing.', $file)); + return false; + } + } + + // Reset all existing assignments + $query = 'DELETE FROM #__templates_menu' . + ' WHERE client_id = 0' . + ' AND template = '.$this->_db->Quote( $this->_id ); + $this->_db->setQuery($query); + $this->_db->query(); + + if ($default) { + $menus = array( 0 ); + } + + foreach ($menus as $menuid) + { + // If 'None' is not in array + if ((int) $menuid >= 0) + { + // check if there is already a template assigned to this menu item + $query = 'DELETE FROM #__templates_menu' . + ' WHERE client_id = 0' . + ' AND menuid = '.(int) $menuid; + $this->_db->setQuery($query); + if (!$this->_db->query()) { + return JError::raiseWarning( 500, $this->_db->getError() ); + } + + $query = 'INSERT INTO #__templates_menu' . + ' SET client_id = 0, template = '. $this->_db->Quote( $this->_id ) .', menuid = '.(int) $menuid; + $this->_db->setQuery($query); + if (!$this->_db->query()) { + return JError::raiseWarning( 500, $this->_db->getError() ); + } + } + } + + return true; + } + + /** + * Method to load Template data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + require_once JPATH_COMPONENT.DS.'helpers'.DS.'template.php'; + + $tBaseDir = JPath::clean($this->_client->path.DS.'templates'); + + if (!is_dir( $tBaseDir . DS . $this->_id )) { + return JError::raiseWarning( 500, JText::_('Template not found') ); + } + $lang =& JFactory::getLanguage(); + $lang->load( 'tpl_'.$this->_id, JPATH_ADMINISTRATOR ); + + $ini = $this->_client->path.DS.'templates'.DS.$this->_id.DS.'params.ini'; + $xml = $this->_client->path.DS.'templates'.DS.$this->_id.DS.'templateDetails.xml'; + $row = TemplatesHelper::parseXMLTemplateFile($tBaseDir, $this->_id); + + jimport('joomla.filesystem.file'); + // Read the ini file + if (JFile::exists($ini)) { + $content = JFile::read($ini); + } else { + $content = null; + } + + $this->_params = new JParameter($content, $xml, 'template'); + + $assigned = TemplatesHelper::isTemplateAssigned($row->directory); + $default = TemplatesHelper::isTemplateDefault($row->directory, $this->_client->id); + if ($default) { + $row->pages = 'all'; + } elseif (!$assigned) { + $row->pages = 'none'; + } else { + $row->pages = null; + } + + $this->_data = $row; + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the Template data + * + * @access private + * @return boolean True on success + * @since 1.6 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $template = new stdClass(); + $template->name = null; + $template->description = null; + $template->pages = null; + $this->_data = $template; + return (boolean) $this->_data; + } + return true; + } +} diff --git a/administrator/components/com_templates/models/templates.php b/administrator/components/com_templates/models/templates.php new file mode 100644 index 0000000000000..8e8279817e117 --- /dev/null +++ b/administrator/components/com_templates/models/templates.php @@ -0,0 +1,176 @@ +_client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', 0, '', 'int')); + $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'); + $limitstart = $mainframe->getUserStateFromRequest($option.'.'.$this->_client->id.'.limitstart', 'limitstart', 0, 'int'); + + $this->setState('limit', $limit); + $this->setState('limitstart', $limitstart); + } + + /** + * Method to get Templates item data + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $this->_loadData(); + } + + return $this->_data; + } + + /** + * Method to get the total number of Module items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $this->_loadData(); + } + + return $this->_total; + } + + /** + * Method to get a pagination object for the Templates + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get the client object + * + * @access public + * @return object + */ + function getClient() + { + return $this->_client; + } + + function setDefault($id) + { + $query = 'DELETE FROM #__templates_menu' . + ' WHERE client_id = '.(int) $this->_client->id . + ' AND (menuid = 0 OR template = '.$this->_db->Quote($id).')'; + $this->_db->setQuery($query); + $this->_db->query(); + + $query = 'INSERT INTO #__templates_menu' . + ' SET client_id = '.(int) $this->_client->id .', template = '.$this->_db->Quote($id).', menuid = 0'; + $this->_db->setQuery($query); + $this->_db->query(); + } + + function _loadData() + { + require_once JPATH_COMPONENT.DS.'helpers'.DS.'template.php'; + + $tBaseDir = $this->_client->path.DS.'templates'; + + //get template xml file info + $rows = array(); + $rows = TemplatesHelper::parseXMLTemplateFiles($tBaseDir); + $this->_total = count($rows); + + // set dynamic template information + for($i = 0; $i < $this->_total; $i++) { + $rows[$i]->assigned = TemplatesHelper::isTemplateAssigned($rows[$i]->directory); + $rows[$i]->published = TemplatesHelper::isTemplateDefault($rows[$i]->directory, $this->_client->id); + } + + if ($this->getState('limit') > 0) + $this->_data = array_slice($rows, $this->getState('limitstart'), $this->getState('limit')); + else + $this->_data = $rows; + } +} diff --git a/administrator/components/com_sections/toolbar.sections.php b/administrator/components/com_templates/templates.php similarity index 53% rename from administrator/components/com_sections/toolbar.sections.php rename to administrator/components/com_templates/templates.php index dcaee8960a2e6..6a7a170703841 100644 --- a/administrator/components/com_sections/toolbar.sections.php +++ b/administrator/components/com_templates/templates.php @@ -1,8 +1,8 @@ authorize( 'com_Templates', 'manage' )) { + $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); +} -switch ( $task ) -{ - case 'add' : - TOOLBAR_sections::_EDIT(false); - break; - case 'edit' : - case 'editA': - TOOLBAR_sections::_EDIT(true); - break; +// Require the base controller +require_once JPATH_COMPONENT.DS.'controller.php'; - case 'copyselect': - case 'copysave': - TOOLBAR_sections::_COPY(); - break; +$controller = new TemplatesController(); - default: - TOOLBAR_sections::_DEFAULT(); - break; -} \ No newline at end of file +// Perform the Request task +$controller->execute(JRequest::getCmd('task')); +$controller->redirect(); \ No newline at end of file diff --git a/administrator/components/com_templates/toolbar.templates.html.php b/administrator/components/com_templates/toolbar.templates.html.php deleted file mode 100644 index 48dc44df92ee0..0000000000000 --- a/administrator/components/com_templates/toolbar.templates.html.php +++ /dev/null @@ -1,77 +0,0 @@ -id == '1') { - JToolBarHelper::makeDefault('publish'); - } else { - JToolBarHelper::makeDefault(); - } - JToolBarHelper::editListX( 'edit', 'Edit' ); - //JToolBarHelper::addNew(); - JToolBarHelper::help( 'screen.templates' ); - } - function _VIEW(&$client){ - - JToolBarHelper::title( JText::_( 'Template Manager' ), 'thememanager' ); - JToolBarHelper::back(); - } - - function _EDIT_SOURCE(&$client){ - - JToolBarHelper::title( JText::_( 'Template HTML Editor' ), 'thememanager' ); - JToolBarHelper::save( 'save_source' ); - JToolBarHelper::apply( 'apply_source' ); - JToolBarHelper::cancel('edit'); - JToolBarHelper::help( 'screen.templates' ); - } - - function _EDIT(&$client){ - JToolBarHelper::title( JText::_( 'Template' ) . ': [ '. JText::_( 'Edit' ) .' ]', 'thememanager' ); - JToolBarHelper::custom('preview', 'preview.png', 'preview_f2.png', 'Preview', false, false); - JToolBarHelper::custom( 'edit_source', 'html.png', 'html_f2.png', 'Edit HTML', false, false ); - JToolBarHelper::custom( 'choose_css', 'css.png', 'css_f2.png', 'Edit CSS', false, false ); - JToolBarHelper::save( 'save' ); - JToolBarHelper::apply(); - JToolBarHelper::cancel( 'cancel', 'Close' ); - JToolBarHelper::help( 'screen.templates' ); - } - - function _CHOOSE_CSS(&$client){ - JToolBarHelper::title( JText::_( 'Template CSS Editor' ), 'thememanager' ); - JToolBarHelper::custom( 'edit_css', 'edit.png', 'edit_f2.png', 'Edit', true ); - JToolBarHelper::cancel('edit'); - JToolBarHelper::help( 'screen.templates' ); - } - - function _EDIT_CSS(&$client){ - JToolBarHelper::title( JText::_( 'Template Manager' ), 'thememanager' ); - JToolBarHelper::save( 'save_css' ); - JToolBarHelper::apply( 'apply_css'); - JToolBarHelper::cancel('choose_css'); - JToolBarHelper::help( 'screen.templates' ); - } -} \ No newline at end of file diff --git a/administrator/components/com_templates/toolbar.templates.php b/administrator/components/com_templates/toolbar.templates.php deleted file mode 100644 index e69157cfec705..0000000000000 --- a/administrator/components/com_templates/toolbar.templates.php +++ /dev/null @@ -1,48 +0,0 @@ - \ No newline at end of file diff --git a/administrator/components/com_templates/views/csschoose/tmpl/default.php b/administrator/components/com_templates/views/csschoose/tmpl/default.php new file mode 100644 index 0000000000000..7990bf79e8541 --- /dev/null +++ b/administrator/components/com_templates/views/csschoose/tmpl/default.php @@ -0,0 +1,51 @@ + + +
    + + + + + +
    +   +
    + + + + + + +files); $i < $n; $i++) { + $file = & $this->files[$i]; +?> + + + + + + +
    + + + + + / +
    + + + + + '. JText::_( 'Writable' ) .'' : ' '. JText::_( 'Unwritable' ) .'' ?> +
    + + + + + + +
    diff --git a/administrator/components/com_templates/views/csschoose/tmpl/index.html b/administrator/components/com_templates/views/csschoose/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/csschoose/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/csschoose/view.html.php b/administrator/components/com_templates/views/csschoose/view.html.php new file mode 100644 index 0000000000000..ec8be2537dfd8 --- /dev/null +++ b/administrator/components/com_templates/views/csschoose/view.html.php @@ -0,0 +1,62 @@ +path.DS.'templates'.DS.$template.DS.'css'; + + // List template .css files + jimport('joomla.filesystem.folder'); + $files = JFolder::files($dir, '\.css$', false, false); + + // Set FTP credentials, if given + jimport('joomla.client.helper'); + JClientHelper::setCredentialsFromRequest('ftp'); + + $this->assignRef('option', $option); + $this->assignRef('client', $client); + $this->assignRef('template', $template); + $this->assignRef('files', $files); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_templates/views/cssedit/index.html b/administrator/components/com_templates/views/cssedit/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/cssedit/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/cssedit/tmpl/default.php b/administrator/components/com_templates/views/cssedit/tmpl/default.php new file mode 100644 index 0000000000000..bbcc8bf3d0671 --- /dev/null +++ b/administrator/components/com_templates/views/cssedit/tmpl/default.php @@ -0,0 +1,61 @@ + + +client->path .DS. 'templates' .DS. $this->template .DS. 'css' .DS. $this->filename; +?> +
    + +ftp): ?> +
    + + + + + ftp)): ?> +

    ftp->message); ?>

    + + + + + + + + + + + + + +
    + + + +
    + + + +
    +
    + + + + + + + + + +
    + +
    + +
    + + + + + + + + +
    diff --git a/administrator/components/com_templates/views/cssedit/tmpl/index.html b/administrator/components/com_templates/views/cssedit/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/cssedit/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/cssedit/view.html.php b/administrator/components/com_templates/views/cssedit/view.html.php new file mode 100644 index 0000000000000..ff77be0d4a272 --- /dev/null +++ b/administrator/components/com_templates/views/cssedit/view.html.php @@ -0,0 +1,61 @@ +get('Data'); + $client =& $this->get('Client'); + $template =& $this->get('Template'); + $filename =& $this->get('Filename'); + + // Set FTP credentials, if given + jimport('joomla.client.helper'); + $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); + + $this->assignRef('option', $option); + $this->assignRef('client', $client); + $this->assignRef('ftp', $ftp); + $this->assignRef('template', $template); + $this->assignRef('filename', $filename); + $this->assignRef('content', $content); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_templates/views/index.html b/administrator/components/com_templates/views/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/prevuuw/index.html b/administrator/components/com_templates/views/prevuuw/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/prevuuw/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/prevuuw/tmpl/default.php b/administrator/components/com_templates/views/prevuuw/tmpl/default.php new file mode 100644 index 0000000000000..6fbaef530a2f2 --- /dev/null +++ b/administrator/components/com_templates/views/prevuuw/tmpl/default.php @@ -0,0 +1,26 @@ + + + + + + + + + + + + +
    + + + url.'index.php?tp='.$this->tp.'&template='.$this->template, JText::_( 'Open in new window' ), array('target' => '_blank')); ?> +
    + url.'index.php?tp='.$this->tp.'&template='.$this->template,'previewFrame', array('class' => 'previewFrame')) ?> +
    diff --git a/administrator/components/com_templates/views/prevuuw/tmpl/index.html b/administrator/components/com_templates/views/prevuuw/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/prevuuw/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/prevuuw/view.html.php b/administrator/components/com_templates/views/prevuuw/view.html.php new file mode 100644 index 0000000000000..5d83faa73fbad --- /dev/null +++ b/administrator/components/com_templates/views/prevuuw/view.html.php @@ -0,0 +1,58 @@ +id ? JURI::base() : $mainframe->getSiteURL(); + + if (!$template) + { + return JError::raiseWarning( 500, JText::_('Template not specified') ); + } + + // Set FTP credentials, if given + jimport('joomla.client.helper'); + JClientHelper::setCredentialsFromRequest('ftp'); + + $this->assignRef('template', $template); + $this->assignRef('tp', $tp); + $this->assignRef('url', $url); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_templates/views/source/index.html b/administrator/components/com_templates/views/source/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/source/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/source/tmpl/default.php b/administrator/components/com_templates/views/source/tmpl/default.php new file mode 100644 index 0000000000000..92718803cd193 --- /dev/null +++ b/administrator/components/com_templates/views/source/tmpl/default.php @@ -0,0 +1,62 @@ + + +template_path = $this->client->path .DS. 'templates' .DS. $this->template .DS. 'index.php'; +?> +
    + +ftp): ?> +
    + + + + + ftp)): ?> +

    ftp->message); ?>

    + + + + + + + + + + + + + +
    + + + +
    + + + +
    +
    + + + + + + + + + +
    + template_path; ?> +
    + +
    + +
    + + + + + + + +
    diff --git a/administrator/components/com_templates/views/source/tmpl/index.html b/administrator/components/com_templates/views/source/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/source/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/source/view.html.php b/administrator/components/com_templates/views/source/view.html.php new file mode 100644 index 0000000000000..0dba9d6275f49 --- /dev/null +++ b/administrator/components/com_templates/views/source/view.html.php @@ -0,0 +1,60 @@ +get('Data'); + $client =& $this->get('Client'); + $template =& $this->get('Template'); + + // Set FTP credentials, if given + jimport('joomla.client.helper'); + $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); + + $this->assignRef('option', $option); + $this->assignRef('client', $client); + $this->assignRef('ftp', $ftp); + $this->assignRef('template', $template); + $this->assignRef('content', $content); + + parent::display($tpl); + } +} \ No newline at end of file diff --git a/administrator/components/com_templates/views/template/index.html b/administrator/components/com_templates/views/template/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/template/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/template/tmpl/default.php b/administrator/components/com_templates/views/template/tmpl/default.php new file mode 100644 index 0000000000000..33c11adebe7fb --- /dev/null +++ b/administrator/components/com_templates/views/template/tmpl/default.php @@ -0,0 +1,165 @@ + + + + +
    + +ftp): ?> +
    + + + + + ftp)): ?> +

    ftp->message); ?>

    + + + + + + + + + + + + + +
    + + + +
    + + + +
    +
    + + +
    +
    + + + + + + + + + + + +
    + : + + + row->name); ?> + +
    + : + + row->description); ?> +
    +
    + +
    + + + + + + + + row->pages != 'all' && $this->client->id != 1) : ?> + + + + + +
    + : + + client->id == 1) { + echo JText::_('Cannot assign administrator template'); + } elseif ($this->row->pages == 'all') { + echo JText::_('Cannot assign default template'); + echo ''; + } elseif ($this->row->pages == 'none') { ?> + + + + + + +
    + : + + lists['selections']; ?> + row->pages == 'none') { ?> + + +
    +
    +
    + +
    +
    + + templatefile = DS.'templates'.DS.$this->template.DS.'params.ini'; + echo is_writable($this->client->path.$this->templatefile) ? JText::sprintf('PARAMSWRITABLE', $this->templatefile):JText::sprintf('PARAMSUNWRITABLE', $this->templatefile); ?> + + + + +
    + params)) { + echo $this->params->render(); + } else { + echo '' . JText :: _('No Parameters') . ''; + } + ?> +
    +
    +
    +
    + + + + + + +
    diff --git a/administrator/components/com_templates/views/template/tmpl/index.html b/administrator/components/com_templates/views/template/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/template/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/template/view.html.php b/administrator/components/com_templates/views/template/view.html.php new file mode 100644 index 0000000000000..16ac597e79f08 --- /dev/null +++ b/administrator/components/com_templates/views/template/view.html.php @@ -0,0 +1,75 @@ +loadHelper('template'); + + JToolBarHelper::title( JText::_( 'Template' ) . ': [ '. JText::_( 'Edit' ) .' ]', 'thememanager' ); + JToolBarHelper::custom('preview', 'preview.png', 'preview_f2.png', 'Preview', false, false); + JToolBarHelper::custom( 'edit_source', 'html.png', 'html_f2.png', 'Edit HTML', false, false ); + JToolBarHelper::custom( 'choose_css', 'css.png', 'css_f2.png', 'Edit CSS', false, false ); + JToolBarHelper::save( 'save' ); + JToolBarHelper::apply(); + JToolBarHelper::cancel( 'cancel', 'Close' ); + JToolBarHelper::help( 'screen.templates' ); + + $row =& $this->get('Data'); + $params =& $this->get('Params'); + $client =& $this->get('Client'); + $template =& $this->get('Template'); + + if (!$template) { + return JError::raiseWarning( 500, JText::_('Template not specified') ); + } + + if($client->id == '1') { + $lists['selections'] = JText::_('Cannot assign an administrator template'); + } else { + $lists['selections'] = TemplatesHelper::createMenuList($template); + } + + // Set FTP credentials, if given + jimport('joomla.client.helper'); + $ftp =& JClientHelper::setCredentialsFromRequest('ftp'); + + $this->assignRef('lists', $lists); + $this->assignRef('row', $row); + $this->assignRef('option', $option); + $this->assignRef('client', $client); + $this->assignRef('ftp', $ftp); + $this->assignRef('template', $template); + $this->assignRef('params', $params); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_templates/views/templates/index.html b/administrator/components/com_templates/views/templates/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/templates/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/templates/tmpl/default.php b/administrator/components/com_templates/views/templates/tmpl/default.php new file mode 100644 index 0000000000000..bfb014dd44b89 --- /dev/null +++ b/administrator/components/com_templates/views/templates/tmpl/default.php @@ -0,0 +1,158 @@ + + + + +
    + + + + + + + client->id == 1) { + ?> + + + + + + + + + + + + + + + + +rows); $i < $n; $i++) { + $row = & $this->rows[$i]; + + $author_info = @ $row->authorEmail . '
    ' . @ $row->authorUrl; + $img_path = ($this->client->id == 1 ? JURI::root().'administrator' : JFactory::getApplication()->getSiteURL() ).'/templates/'.$row->directory.'/template_thumbnail.png'; +?> + + + + + client->id == 1) { + ?> + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + pagination->getListFooter(); ?> +
    + pagination->getRowOffset( $i ); ?> + + get ('id'), $row->checked_out )) { + ?> +   + + + + + + name;?> + + + published == 1) { + ?> + <?php echo JText::_( 'Published' ); ?> + +   + + + published == 1) { + ?> + <?php echo JText::_( 'Default' ); ?> + +   + + + assigned == 1) { + ?> + <?php echo JText::_( 'Assigned' ); ?> + +   + + + version; ?> + + creationdate; ?> + + + author != '' ? $row->author : ' '; ?> + +
    + + + + + + +
    diff --git a/administrator/components/com_templates/views/templates/tmpl/index.html b/administrator/components/com_templates/views/templates/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_templates/views/templates/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_templates/views/templates/view.html.php b/administrator/components/com_templates/views/templates/view.html.php new file mode 100644 index 0000000000000..c235c3df86d2a --- /dev/null +++ b/administrator/components/com_templates/views/templates/view.html.php @@ -0,0 +1,76 @@ +get( 'Data'); + $total = & $this->get( 'Total'); + $pagination = & $this->get( 'Pagination' ); + $client = & $this->get( 'Client'); + + $task = JRequest::getCmd('task'); + + if ($client->id == 1) { + JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_templates&client=0'); + JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_templates&client=1', true); + } elseif ($client->id == 0 && !$task) { + JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_templates&client=0', true); + JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_templates&client=1'); + } else { + JSubMenuHelper::addEntry(JText::_('Site'), 'index.php?option=com_templates&client=0'); + JSubMenuHelper::addEntry(JText::_('Administrator'), 'index.php?option=com_templates&client=1'); + } + + // Set toolbar items for the page + JToolBarHelper::title( JText::_( 'Template Manager' ), 'thememanager' ); + + if ($client->id == '1') { + JToolBarHelper::makeDefault('publish'); + } else { + JToolBarHelper::makeDefault(); + } + JToolBarHelper::editListX( 'edit', 'Edit' ); + //JToolBarHelper::addNew(); + JToolBarHelper::help( 'screen.templates' ); + + //$select[] = JHTML::_('select.option', '0', JText::_('Site')); + //$select[] = JHTML::_('select.option', '1', JText::_('Administrator')); + //$lists['client'] = JHTML::_('select.genericlist', $select, 'client', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $client->id); + + $this->assignRef('rows', $rows); + $this->assignRef('pagination', $pagination); + $this->assignRef('client', $client); + + parent::display($tpl); + } +} diff --git a/administrator/components/com_trash/admin.trash.html.php b/administrator/components/com_trash/admin.trash.html.php index 83736bdaa1a68..b81400fbd8d4d 100644 --- a/administrator/components/com_trash/admin.trash.html.php +++ b/administrator/components/com_trash/admin.trash.html.php @@ -29,7 +29,7 @@ class HTML_trash function showListContent( $option, &$contents, &$pageNav, &$lists ) { ?> -
    + @@ -153,7 +153,7 @@ function checkAll_xtd ( n ) { } } - +
    @@ -252,7 +252,7 @@ function checkAll_xtd ( n ) { */ function showDelete( $option, $cid, $items, $type, $return ) { ?> - +
    @@ -308,7 +308,7 @@ function showDelete( $option, $cid, $items, $type, $return ) { */ function showRestore( $option, $cid, $items, $type, $return ) { ?> - +
    diff --git a/administrator/components/com_trash/admin.trash.php b/administrator/components/com_trash/admin.trash.php index be0f19eb3a5b1..c9a0d722483ac 100644 --- a/administrator/components/com_trash/admin.trash.php +++ b/administrator/components/com_trash/admin.trash.php @@ -23,7 +23,7 @@ $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); } -require_once( JApplicationHelper::getPath( 'admin_html' ) ); +require_once JApplicationHelper::getPath('admin_html'); $cid = JRequest::getVar( 'cid', array(0), 'post', 'array' ); $mid = JRequest::getVar( 'mid', array(0), 'post', 'array' ); @@ -98,7 +98,7 @@ function viewTrashContent( $option ) . ' FROM #__content AS c' . ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . ' LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = "content"' - . ' LEFT JOIN #__groups AS g ON g.id = c.access' + . ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = c.access' . ' LEFT JOIN #__users AS u ON u.id = c.checked_out' . $where ; @@ -113,7 +113,7 @@ function viewTrashContent( $option ) . ' FROM #__content AS c' . ' LEFT JOIN #__categories AS cc ON cc.id = c.catid' . ' LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope="content"' - . ' LEFT JOIN #__groups AS g ON g.id = c.access' + . ' LEFT JOIN #__core_acl_axo_groups AS g ON g.value = c.access' . ' LEFT JOIN #__users AS u ON u.id = c.checked_out' . $where . $orderby @@ -259,7 +259,7 @@ function deleteTrash( $cid, $option ) { $obj =& JTable::getInstance('content'); - require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_frontpage'.DS.'tables'.DS.'frontpage.php'); + require_once JPATH_ADMINISTRATOR.DS.'components'.DS.'com_frontpage'.DS.'tables'.DS.'frontpage.php'; $fp = new TableFrontPage( $db ); foreach ( $cid as $id ) { $id = intval( $id ); diff --git a/administrator/components/com_trash/index.html b/administrator/components/com_trash/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_trash/index.html +++ b/administrator/components/com_trash/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_trash/toolbar.trash.php b/administrator/components/com_trash/toolbar.trash.php index bc7c796492391..84088e2c5e266 100644 --- a/administrator/components/com_trash/toolbar.trash.php +++ b/administrator/components/com_trash/toolbar.trash.php @@ -15,7 +15,7 @@ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); -require_once( JApplicationHelper::getPath( 'toolbar_html' ) ); +require_once JApplicationHelper::getPath('toolbar_html'); switch ($task) { diff --git a/administrator/components/com_users/config.xml b/administrator/components/com_users/config.xml index e7ad51902f14c..09da3b00d2302 100644 --- a/administrator/components/com_users/config.xml +++ b/administrator/components/com_users/config.xml @@ -1,23 +1,23 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/administrator/components/com_users/controller.php b/administrator/components/com_users/controller.php index 79bdefdcff982..f6e59d1dd641a 100644 --- a/administrator/components/com_users/controller.php +++ b/administrator/components/com_users/controller.php @@ -1,464 +1,469 @@ -registerTask( 'add' , 'display' ); - $this->registerTask( 'edit' , 'display' ); - $this->registerTask( 'apply', 'save' ); - $this->registerTask( 'flogout', 'logout'); - $this->registerTask( 'unblock', 'block' ); - } - - /** - * Displays a view - */ - function display( ) - { - switch($this->getTask()) - { - case 'add' : - { JRequest::setVar( 'hidemainmenu', 1 ); - JRequest::setVar( 'layout', 'form' ); - JRequest::setVar( 'view', 'user' ); - JRequest::setVar( 'edit', false ); - } break; - case 'edit' : - { - JRequest::setVar( 'hidemainmenu', 1 ); - JRequest::setVar( 'layout', 'form' ); - JRequest::setVar( 'view', 'user' ); - JRequest::setVar( 'edit', true ); - } break; - } - - parent::display(); - } - - /** - * Saves the record - */ - function save() - { - global $mainframe; - - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $option = JRequest::getCmd( 'option'); - - // Initialize some variables - $db = & JFactory::getDBO(); - $me = & JFactory::getUser(); - $acl =& JFactory::getACL(); - $MailFrom = $mainframe->getCfg('mailfrom'); - $FromName = $mainframe->getCfg('fromname'); - $SiteName = $mainframe->getCfg('sitename'); - - // Create a new JUser object - $user = new JUser(JRequest::getVar( 'id', 0, 'post', 'int')); - $original_gid = $user->get('gid'); - - $post = JRequest::get('post'); - $post['username'] = JRequest::getVar('username', '', 'post', 'username'); - $post['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW); - $post['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW); - - if (!$user->bind($post)) - { - $mainframe->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message'); - $mainframe->enqueueMessage($user->getError(), 'error'); - //$mainframe->redirect( 'index.php?option=com_users', $user->getError() ); - //return false; - return $this->execute('edit'); - } - - $objectID = $acl->get_object_id( 'users', $user->get('id'), 'ARO' ); - $groups = $acl->get_object_groups( $objectID, 'ARO' ); - $this_group = strtolower( $acl->get_group_name( $groups[0], 'ARO' ) ); - - - if ( $user->get('id') == $me->get( 'id' ) && $user->get('block') == 1 ) - { - $msg = JText::_( 'You cannot block Yourself!' ); - $mainframe->enqueueMessage($msg, 'message'); - return $this->execute('edit'); - } - else if ( ( $this_group == 'super administrator' ) && $user->get('block') == 1 ) { - $msg = JText::_( 'You cannot block a Super Administrator' ); - $mainframe->enqueueMessage($msg, 'message'); - return $this->execute('edit'); - } - else if ( ( $this_group == 'administrator' ) && ( $me->get( 'gid' ) == 24 ) && $user->get('block') == 1 ) - { - $msg = JText::_( 'WARNBLOCK' ); - $mainframe->enqueueMessage($msg, 'message'); - return $this->execute('edit'); - } - else if ( ( $this_group == 'super administrator' ) && ( $me->get( 'gid' ) != 25 ) ) - { - $msg = JText::_( 'You cannot edit a super administrator account' ); - $mainframe->enqueueMessage($msg, 'message'); - return $this->execute('edit'); - } - // Are we dealing with a new user which we need to create? - $isNew = ($user->get('id') < 1); - if (!$isNew) - { - // if group has been changed and where original group was a Super Admin - if ( $user->get('gid') != $original_gid && $original_gid == 25 ) - { - // count number of active super admins - $query = 'SELECT COUNT( id )' - . ' FROM #__users' - . ' WHERE gid = 25' - . ' AND block = 0' - ; - $db->setQuery( $query ); - $count = $db->loadResult(); - - if ( $count <= 1 ) - { - // disallow change if only one Super Admin exists - $this->setRedirect( 'index.php?option=com_users', JText::_('WARN_ONLY_SUPER') ); - return false; - } - } - } - - /* - * Lets save the JUser object - */ - if (!$user->save()) - { - - $mainframe->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message'); - $mainframe->enqueueMessage($user->getError(), 'error'); - return $this->execute('edit'); - } - - /* - * Time for the email magic so get ready to sprinkle the magic dust... - */ - if ($isNew) - { - $adminEmail = $me->get('email'); - $adminName = $me->get('name'); - - $subject = JText::_('NEW_USER_MESSAGE_SUBJECT'); - $message = sprintf ( JText::_('NEW_USER_MESSAGE'), $user->get('name'), $SiteName, JURI::root(), $user->get('username'), $user->password_clear ); - - if ($MailFrom != '' && $FromName != '') - { - $adminName = $FromName; - $adminEmail = $MailFrom; - } - JUtility::sendMail( $adminEmail, $adminName, $user->get('email'), $subject, $message ); - } - - // If updating self, load the new user object into the session - if ($user->get('id') == $me->get('id')) - { - // Get an ACL object - $acl = &JFactory::getACL(); - - // Get the user group from the ACL - $grp = $acl->getAroGroup($user->get('id')); - - // Mark the user as logged in - $user->set('guest', 0); - $user->set('aid', 1); - - // Fudge Authors, Editors, Publishers and Super Administrators into the special access group - if ($acl->is_group_child_of($grp->name, 'Registered') || - $acl->is_group_child_of($grp->name, 'Public Backend')) { - $user->set('aid', 2); - } - - // Set the usertype based on the ACL group name - $user->set('usertype', $grp->name); - - $session = &JFactory::getSession(); - $session->set('user', $user); - } - - switch ( $this->getTask() ) - { - case 'apply': - $msg = JText::sprintf( 'Successfully Saved changes to User', $user->get('name') ); - $this->setRedirect( 'index.php?option=com_users&view=user&task=edit&cid[]='. $user->get('id'), $msg ); - break; - - case 'save': - default: - $msg = JText::sprintf( 'Successfully Saved User', $user->get('name') ); - $this->setRedirect( 'index.php?option=com_users', $msg ); - break; - } - } - - /** - * Removes the record(s) from the database - */ - function remove() - { - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $currentUser =& JFactory::getUser(); - $acl =& JFactory::getACL(); - $cid = JRequest::getVar( 'cid', array(), '', 'array' ); - - JArrayHelper::toInteger( $cid ); - - if (count( $cid ) < 1) { - JError::raiseError(500, JText::_( 'Select a User to delete', true ) ); - } - - foreach ($cid as $id) - { - // check for a super admin ... can't delete them - $objectID = $acl->get_object_id( 'users', $id, 'ARO' ); - $groups = $acl->get_object_groups( $objectID, 'ARO' ); - $this_group = strtolower( $acl->get_group_name( $groups[0], 'ARO' ) ); - - $success = false; - if ( $this_group == 'super administrator' ) - { - $msg = JText::_( 'You cannot delete a Super Administrator' ); - } - else if ( $id == $currentUser->get( 'id' ) ) - { - $msg = JText::_( 'You cannot delete Yourself!' ); - } - else if ( ( $this_group == 'administrator' ) && ( $currentUser->get( 'gid' ) == 24 ) ) - { - $msg = JText::_( 'WARNDELETE' ); - } - else - { - $user =& JUser::getInstance((int)$id); - $count = 2; - - if ( $user->get( 'gid' ) == 25 ) - { - // count number of active super admins - $query = 'SELECT COUNT( id )' - . ' FROM #__users' - . ' WHERE gid = 25' - . ' AND block = 0' - ; - $db->setQuery( $query ); - $count = $db->loadResult(); - } - - if ( $count <= 1 && $user->get( 'gid' ) == 25 ) - { - // cannot delete Super Admin where it is the only one that exists - $msg = "You cannot delete this Super Administrator as it is the only active Super Administrator for your site"; - } - else - { - // delete user - $user->delete(); - $msg = ''; - - JRequest::setVar( 'task', 'remove' ); - JRequest::setVar( 'cid', $id ); - - // delete user acounts active sessions - $this->logout(); - } - } - } - - $this->setRedirect( 'index.php?option=com_users', $msg); - } - - /** - * Cancels an edit operation - */ - function cancel( ) - { - $this->setRedirect( 'index.php?option=com_users' ); - } - - /** - * Disables the user account - */ - function block( ) - { - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - $db =& JFactory::getDBO(); - $acl =& JFactory::getACL(); - $currentUser =& JFactory::getUser(); - - $cid = JRequest::getVar( 'cid', array(), '', 'array' ); - $block = $this->getTask() == 'block' ? 1 : 0; - - JArrayHelper::toInteger( $cid ); - - if (count( $cid ) < 1) { - JError::raiseError(500, JText::_( 'Select a User to '.$this->getTask(), true ) ); - } - foreach ($cid as $id) - { - // check for a super admin ... can't delete them - $objectID = $acl->get_object_id( 'users', $id, 'ARO' ); - $groups = $acl->get_object_groups( $objectID, 'ARO' ); - $this_group = strtolower( $acl->get_group_name( $groups[0], 'ARO' ) ); - - $success = false; - if ( $this_group == 'super administrator' ) - { - $msg = JText::_( 'You cannot block a Super Administrator' ); - } - else if ( $id == $currentUser->get( 'id' ) ) - { - $msg = JText::_( 'You cannot block Yourself!' ); - } - else if ( ( $this_group == 'administrator' ) && ( $currentUser->get( 'gid' ) == 24 ) ) - { - $msg = JText::_( 'WARNBLOCK' ); - } - else - { - $user =& JUser::getInstance((int)$id); - $count = 2; - - if ( $user->get( 'gid' ) == 25 ) - { - // count number of active super admins - $query = 'SELECT COUNT( id )' - . ' FROM #__users' - . ' WHERE gid = 25' - . ' AND block = 0' - ; - $db->setQuery( $query ); - $count = $db->loadResult(); - } - - if ( $count <= 1 && $user->get( 'gid' ) == 25 ) - { - // cannot delete Super Admin where it is the only one that exists - $msg = "You cannot block this Super Administrator as it is the only active Super Administrator for your site"; - } - else - { - $user =& JUser::getInstance((int)$id); - $user->block = $block; - $user->save(); - - if($block) - { - JRequest::setVar( 'task', 'block' ); - JRequest::setVar( 'cid', array($id) ); - - // delete user acounts active sessions - $this->logout(); - } - } - } - } - - $this->setRedirect( 'index.php?option=com_users', $msg); - } - - /** - * Force log out a user - */ - function logout( ) - { - // Check for request forgeries - JRequest::checkToken() or jexit( 'Invalid Token' ); - - global $mainframe; - - $db =& JFactory::getDBO(); - $task = $this->getTask(); - $cids = JRequest::getVar( 'cid', array(), '', 'array' ); - $client = JRequest::getVar( 'client', 0, '', 'int' ); - $id = JRequest::getVar( 'id', 0, '', 'int' ); - - JArrayHelper::toInteger($cids); - - if ( count( $cids ) < 1 ) { - $this->setRedirect( 'index.php?option=com_users', JText::_( 'User Deleted' ) ); - return false; - } - - foreach($cids as $cid) - { - $options = array(); - - if ($task == 'logout' || $task == 'block') { - $options['clientid'][] = 0; //site - $options['clientid'][] = 1; //administrator - } else if ($task == 'flogout') { - $options['clientid'][] = $client; - } - - $mainframe->logout((int)$cid, $options); - } - - - $msg = JText::_( 'User Session Ended' ); - switch ( $task ) - { - case 'flogout': - $this->setRedirect( 'index.php', $msg ); - break; - - case 'remove': - case 'block': - return; - break; - - default: - $this->setRedirect( 'index.php?option=com_users', $msg ); - break; - } - } - - function contact() - { - $contact_id = JRequest::getVar( 'contact_id', '', 'post', 'int' ); - $this->setRedirect( 'index.php?option=com_contact&atask=edit&cid[]='. $contact_id ); - } -} +registerTask( 'add' , 'display' ); + $this->registerTask( 'edit' , 'display' ); + $this->registerTask( 'apply', 'save' ); + $this->registerTask( 'flogout', 'logout'); + $this->registerTask( 'unblock', 'block' ); + } + + /** + * Displays a view + */ + function display( ) + { + jimport( 'joomla.application.component.model' ); + JModel::addIncludePath( JPATH_COMPONENT.DS.'models' ); + + $document = &JFactory::getDocument(); + $vName = JRequest::getCmd( 'view', 'users' ); + $vFormat = $document->getType(); + $lName = JRequest::getCmd( 'layout', 'default' ); + + if ($view = &$this->getView( $vName, $vFormat )) + { + switch ($vName) + { + case 'user': + case 'users': + $model = $this->getModel( 'user' ); + break; + } + + // Push the model into the view (as default) + $view->setModel( $model, true); + $view->setLayout($lName); + + // push document object into the view + $view->assignRef('document', $document); + $view->display(); + + //JSubMenuHelper::addEntry( JText::_( 'Link Users' ), 'index.php?option=com_users&view=users', $vName == 'users' ); + } + } + + /** + * Saves the record + */ + function save() + { + global $mainframe; + + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $option = JRequest::getCmd( 'option'); + + // Initialize some variables + $db = & JFactory::getDBO(); + $me = & JFactory::getUser(); + $acl =& JFactory::getACL(); + $MailFrom = $mainframe->getCfg('mailfrom'); + $FromName = $mainframe->getCfg('fromname'); + $SiteName = $mainframe->getCfg('sitename'); + + // Create a new JUser object + $user = new JUser(JRequest::getVar( 'id', 0, 'post', 'int')); + $original_gid = $user->get('gid'); + + $post = JRequest::get('post'); + $post['username'] = JRequest::getVar('username', '', 'post', 'username'); + $post['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW); + $post['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW); + + if (!$user->bind($post)) + { + $mainframe->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message'); + $mainframe->enqueueMessage($user->getError(), 'error'); + //$mainframe->redirect( 'index.php?option=com_users', $user->getError() ); + //return false; + return $this->execute('edit'); + } + + $objectID = $acl->get_object_id( 'users', $user->get('id'), 'ARO' ); + $groups = $acl->get_object_groups( $objectID, 'ARO' ); + $this_group = strtolower( $acl->get_group_name( $groups[0], 'ARO' ) ); + + + if ( $user->get('id') == $me->get( 'id' ) && $user->get('block') == 1 ) + { + $msg = JText::_( 'You cannot block Yourself!' ); + $mainframe->enqueueMessage($msg, 'message'); + return $this->execute('edit'); + } + else if ( ( $this_group == 'super administrator' ) && $user->get('block') == 1 ) { + $msg = JText::_( 'You cannot block a Super Administrator' ); + $mainframe->enqueueMessage($msg, 'message'); + return $this->execute('edit'); + } + else if ( ( $this_group == 'administrator' ) && ( $me->get( 'gid' ) == 24 ) && $user->get('block') == 1 ) + { + $msg = JText::_( 'WARNBLOCK' ); + $mainframe->enqueueMessage($msg, 'message'); + return $this->execute('edit'); + } + else if ( ( $this_group == 'super administrator' ) && ( $me->get( 'gid' ) != 25 ) ) + { + $msg = JText::_( 'You cannot edit a super administrator account' ); + $mainframe->enqueueMessage($msg, 'message'); + return $this->execute('edit'); + } + // Are we dealing with a new user which we need to create? + $isNew = ($user->get('id') < 1); + if (!$isNew) + { + // if group has been changed and where original group was a Super Admin + if ( $user->get('gid') != $original_gid && $original_gid == 25 ) + { + // count number of active super admins + $query = 'SELECT COUNT( id )' + . ' FROM #__users' + . ' WHERE gid = 25' + . ' AND block = 0' + ; + $db->setQuery( $query ); + $count = $db->loadResult(); + + if ( $count <= 1 ) + { + // disallow change if only one Super Admin exists + $this->setRedirect( 'index.php?option=com_users', JText::_('WARN_ONLY_SUPER') ); + return false; + } + } + } + + /* + * Lets save the JUser object + */ + if (!$user->save()) + { + + $mainframe->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message'); + $mainframe->enqueueMessage($user->getError(), 'error'); + return $this->execute('edit'); + } + + /* + * Time for the email magic so get ready to sprinkle the magic dust... + */ + if ($isNew) + { + $adminEmail = $me->get('email'); + $adminName = $me->get('name'); + + $subject = JText::_('NEW_USER_MESSAGE_SUBJECT'); + $message = sprintf ( JText::_('NEW_USER_MESSAGE'), $user->get('name'), $SiteName, JURI::root(), $user->get('username'), $user->password_clear ); + + if ($MailFrom != '' && $FromName != '') + { + $adminName = $FromName; + $adminEmail = $MailFrom; + } + JUtility::sendMail( $adminEmail, $adminName, $user->get('email'), $subject, $message ); + } + + // If updating self, load the new user object into the session + if ($user->get('id') == $me->get('id')) + { + // Get an ACL object + $acl = &JFactory::getACL(); + + // Get the user group from the ACL + $grp = $acl->getAroGroup($user->get('id')); + + // Mark the user as logged in + $user->set('guest', 0); + $user->set('aid', 1); + + // Fudge Authors, Editors, Publishers and Super Administrators into the special access group + if ($acl->is_group_child_of($grp->name, 'Registered') || + $acl->is_group_child_of($grp->name, 'Public Backend')) { + $user->set('aid', 2); + } + + // Set the usertype based on the ACL group name + $user->set('usertype', $grp->name); + + $session = &JFactory::getSession(); + $session->set('user', $user); + } + + switch ( $this->getTask() ) + { + case 'apply': + $msg = JText::sprintf( 'Successfully Saved changes to User', $user->get('name') ); + $this->setRedirect( 'index.php?option=com_users&view=user&task=edit&cid[]='. $user->get('id'), $msg ); + break; + + case 'save': + default: + $msg = JText::sprintf( 'Successfully Saved User', $user->get('name') ); + $this->setRedirect( 'index.php?option=com_users', $msg ); + break; + } + } + + /** + * Removes the record(s) from the database + */ + function remove() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $db =& JFactory::getDBO(); + $currentUser =& JFactory::getUser(); + $acl =& JFactory::getACL(); + $cid = JRequest::getVar( 'cid', array(), '', 'array' ); + + JArrayHelper::toInteger( $cid ); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select a User to delete', true ) ); + } + + foreach ($cid as $id) + { + // check for a super admin ... can't delete them + $objectID = $acl->get_object_id( 'users', $id, 'ARO' ); + $groups = $acl->get_object_groups( $objectID, 'ARO' ); + $this_group = strtolower( $acl->get_group_name( $groups[0], 'ARO' ) ); + + $success = false; + if ( $this_group == 'super administrator' ) + { + $msg = JText::_( 'You cannot delete a Super Administrator' ); + } + else if ( $id == $currentUser->get( 'id' ) ) + { + $msg = JText::_( 'You cannot delete Yourself!' ); + } + else if ( ( $this_group == 'administrator' ) && ( $currentUser->get( 'gid' ) == 24 ) ) + { + $msg = JText::_( 'WARNDELETE' ); + } + else + { + $user =& JUser::getInstance((int)$id); + $count = 2; + + if ( $user->get( 'gid' ) == 25 ) + { + // count number of active super admins + $query = 'SELECT COUNT( id )' + . ' FROM #__users' + . ' WHERE gid = 25' + . ' AND block = 0' + ; + $db->setQuery( $query ); + $count = $db->loadResult(); + } + + if ( $count <= 1 && $user->get( 'gid' ) == 25 ) + { + // cannot delete Super Admin where it is the only one that exists + $msg = "You cannot delete this Super Administrator as it is the only active Super Administrator for your site"; + } + else + { + // delete user + $user->delete(); + $msg = ''; + + JRequest::setVar( 'task', 'remove' ); + JRequest::setVar( 'cid', $id ); + + // delete user acounts active sessions + $this->logout(); + } + } + } + + $this->setRedirect( 'index.php?option=com_users', $msg); + } + + /** + * Cancels an edit operation + */ + function cancel( ) + { + $this->setRedirect( 'index.php?option=com_users' ); + } + + /** + * Disables the user account + */ + function block( ) + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $db =& JFactory::getDBO(); + $acl =& JFactory::getACL(); + $currentUser =& JFactory::getUser(); + + $cid = JRequest::getVar( 'cid', array(), '', 'array' ); + $block = $this->getTask() == 'block' ? 1 : 0; + + JArrayHelper::toInteger( $cid ); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select a User to '.$this->getTask(), true ) ); + } + foreach ($cid as $id) + { + // check for a super admin ... can't delete them + $objectID = $acl->get_object_id( 'users', $id, 'ARO' ); + $groups = $acl->get_object_groups( $objectID, 'ARO' ); + $this_group = strtolower( $acl->get_group_name( $groups[0], 'ARO' ) ); + + $success = false; + if ( $this_group == 'super administrator' ) + { + $msg = JText::_( 'You cannot block a Super Administrator' ); + } + else if ( $id == $currentUser->get( 'id' ) ) + { + $msg = JText::_( 'You cannot block Yourself!' ); + } + else if ( ( $this_group == 'administrator' ) && ( $currentUser->get( 'gid' ) == 24 ) ) + { + $msg = JText::_( 'WARNBLOCK' ); + } + else + { + $user =& JUser::getInstance((int)$id); + $count = 2; + + if ( $user->get( 'gid' ) == 25 ) + { + // count number of active super admins + $query = 'SELECT COUNT( id )' + . ' FROM #__users' + . ' WHERE gid = 25' + . ' AND block = 0' + ; + $db->setQuery( $query ); + $count = $db->loadResult(); + } + + if ( $count <= 1 && $user->get( 'gid' ) == 25 ) + { + // cannot delete Super Admin where it is the only one that exists + $msg = "You cannot block this Super Administrator as it is the only active Super Administrator for your site"; + } + else + { + $user =& JUser::getInstance((int)$id); + $user->block = $block; + $user->save(); + + if($block) + { + JRequest::setVar( 'task', 'block' ); + JRequest::setVar( 'cid', array($id) ); + + // delete user acounts active sessions + $this->logout(); + } + } + } + } + + $this->setRedirect( 'index.php?option=com_users', $msg); + } + + /** + * Force log out a user + */ + function logout( ) + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + global $mainframe; + + $db =& JFactory::getDBO(); + $task = $this->getTask(); + $cids = JRequest::getVar( 'cid', array(), '', 'array' ); + $client = JRequest::getVar( 'client', 0, '', 'int' ); + $id = JRequest::getVar( 'id', 0, '', 'int' ); + + JArrayHelper::toInteger($cids); + + if ( count( $cids ) < 1 ) { + $this->setRedirect( 'index.php?option=com_users', JText::_( 'User Deleted' ) ); + return false; + } + + foreach($cids as $cid) + { + $options = array(); + + if ($task == 'logout' || $task == 'block') { + $options['clientid'][] = 0; //site + $options['clientid'][] = 1; //administrator + } else if ($task == 'flogout') { + $options['clientid'][] = $client; + } + + $mainframe->logout((int)$cid, $options); + } + + + $msg = JText::_( 'User Session Ended' ); + switch ( $task ) + { + case 'flogout': + $this->setRedirect( 'index.php', $msg ); + break; + + case 'remove': + case 'block': + return; + break; + + default: + $this->setRedirect( 'index.php?option=com_users', $msg ); + break; + } + } + + function contact() + { + $contact_id = JRequest::getVar( 'contact_id', '', 'post', 'int' ); + $this->setRedirect( 'index.php?option=com_contact&atask=edit&cid[]='. $contact_id ); + } +} diff --git a/administrator/components/com_users/controllers/index.html b/administrator/components/com_users/controllers/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_users/controllers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_users/controllers/user.php b/administrator/components/com_users/controllers/user.php new file mode 100644 index 0000000000000..b4f4f56029c9d --- /dev/null +++ b/administrator/components/com_users/controllers/user.php @@ -0,0 +1,243 @@ +registerTask( 'save2copy', 'save' ); + $this->registerTask( 'save2new', 'save' ); + $this->registerTask( 'apply', 'save' ); + $this->registerTask( 'unpublish', 'publish' ); + $this->registerTask( 'trash', 'publish' ); + $this->registerTask( 'orderup', 'ordering' ); + $this->registerTask( 'orderdown', 'ordering' ); + } + + /** + * Display the view + */ + function display() + { + JError::raiseWarning( 500, 'This controller does not implement a display method' ); + } + + /** + * Proxy for getModel + */ + function &getModel() + { + return parent::getModel( 'User', 'UserModel', array( 'ignore_request' => true ) ); + } + + /** + * Method to edit a object + * + * Sets object ID in the session from the request, checks the item out, and then redirects to the edit page. + * + * @access public + * @return void + */ + function edit() + { + $cid = JRequest::getVar( 'cid', array(), '', 'array' ); + $id = JRequest::getInt( 'id', @$cid[0] ); + + $session = &JFactory::getSession(); + $session->set( 'users.user.id', $id ); + + if ($id) { + // Checkout item + //$model = $this->getModel(); + //$model->checkout( $id ); + } + $this->setRedirect( JRoute::_( 'index.php?option=com_users&view=user&layout=edit', false ) ); + } + + /** + * Method to cancel an edit + * + * Checks the item in, sets item ID in the session to null, and then redirects to the list page. + * + * @access public + * @return void + */ + function cancel() + { + $session = &JFactory::getSession(); + // Clear the session of the item + $session->set( 'users.user.id', null ); + + $this->setRedirect( JRoute::_('index.php?option=com_users&view=users', false ) ); + } + + /** + * Save the record + */ + function save() + { + // Check for request forgeries. + JRequest::checkToken(); + + // Get posted form variables. + $input = JRequest::get('post'); + + // Override the automatic filters + $input['username'] = JRequest::getVar('username', '', 'post', 'username'); + $input['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW); + $input['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW); + + if (!empty( $input['password'] ) AND !empty( $input['password2'] )) { + if ($input['password'] !== $input['password2']) { + $this->setMessage( JText::_( '@todo Find string for p[asswords dont match' ) ); + $this->setRedirect(JRoute::_('index.php?option=com_users&view=user&layout=edit', false)); + return; + } + } + + // Clear static values + // @todo Look at moving these to the table bind method (but check how new user values are handled) + unset( $input['registerDate'] ); + unset( $input['lastvisitDate'] ); + unset( $input['activation'] ); + + // Get the id of the item out of the session. + $session = &JFactory::getSession(); + $id = (int) $session->get('users.user.id'); + $input['id'] = $id; + + // Get the extensions model and set the post request in its state. + $model = &$this->getModel(); + $result = $model->save( $input ); + $msg = JError::isError( $result ) ? $result->message : 'Saved'; + + if ($this->_task == 'apply') { + $session->set( 'users.redirect.id', $model->getState( 'id' ) ); + $this->setRedirect(JRoute::_('index.php?option=com_users&view=user&layout=edit', false), JText::_($msg)); + } + else if ($this->_task == 'save2new') { + $session->set( 'users.user.id', null ); + $model->checkin($id); + + $this->setRedirect(JRoute::_('index.php?option=com_users&view=user&layout=edit', false), JText::_($msg)); + } + else { + $session->set( 'users.user.id', null ); + $model->checkin($id); + + $this->setRedirect(JRoute::_('index.php?option=com_users&view=users', false), JText::_($msg)); + } + } + + /** + * Deletes a user + */ + function delete() + { + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + // Get items from the request. + $cid = JRequest::getVar('cid', array(), '', 'array'); + + if (empty( $cid )) { + JError::raiseWarning(500, JText::_( 'No items selected' )); + } + else { + // Get the model. + $model = $this->getModel(); + + // Make sure the item ids are integers + jimport( 'joomla.utilities.arrayhelper' ); + JArrayHelper::toInteger( $cid ); + + // Remove the items. + if (!$model->delete($cid)) { + JError::raiseWarning( 500, $model->getError() ); + } + } + + $this->setRedirect( 'index.php?option=com_users&view=users' ); + } + + /** + * Force logout a user + * + * @request array 'cid' An array of ids + * @request mixed 'client' The client id. If empty, all logout of all clients + */ + function logout() + { + // Check for request forgeries + JRequest::checkToken() or die( 'Invalid Token' ); + + // Get items from the request. + $cid = JRequest::getVar('cid', array(), '', 'array'); + $client = JRequest::getVar( 'client' ); + + if (empty( $cid )) { + JError::raiseWarning(500, JText::_( 'No items selected' )); + } + else { + if (is_numeric( $client )) { + $options['clientid'][] = $client; + } + else { + // Log the user out of all clients + $options['clientid'][] = 0; + $options['clientid'][] = 1; + } + + // Make sure the item ids are integers + jimport( 'joomla.utilities.arrayhelper' ); + JArrayHelper::toInteger( $cid ); + + foreach ($cids as $cid) { + $mainframe->logout( $cid, $options ); + } + + $this->setMessage( JText::_( 'User session ended' ) ); + } + + $this->setRedirect( 'index.php?option=com_users&view=users' ); + } + + /** + * Method to run batch opterations. + * + * @access public + * @return void + * @since 1.0 + */ + function batch() + { + // Get variables from the request. + $vars = JRequest::getVar( 'batch', array(), 'post', 'array' ); + $cid = JRequest::getVar( 'cid', null, 'post', 'array' ); + + $model = &$this->getModel(); + $model->batch( $vars, $cid ); + + $this->setRedirect( 'index.php?option=com_users&view=users' ); + } +} diff --git a/administrator/components/com_users/helpers/html/fx.php b/administrator/components/com_users/helpers/html/fx.php new file mode 100644 index 0000000000000..b70738997717d --- /dev/null +++ b/administrator/components/com_users/helpers/html/fx.php @@ -0,0 +1,56 @@ +addScriptDeclaration( << +CODE + ); + } +} \ No newline at end of file diff --git a/administrator/components/com_users/helpers/html/index.html b/administrator/components/com_users/helpers/html/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_users/helpers/html/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_users/helpers/html/user.php b/administrator/components/com_users/helpers/html/user.php new file mode 100644 index 0000000000000..78e030b6200dc --- /dev/null +++ b/administrator/components/com_users/helpers/html/user.php @@ -0,0 +1,51 @@ + 1 ) ); + $model->setState( 'type', $type ); + + // Set the model state to get the groups tree + $model->setState( 'select', 'a.id AS value, a.name AS text' ); + $model->setState( 'show.tree', 1 ); + $model->setState( 'order by', 'a.lft' ); + $model->setState( 'parent_id', $parentId ); + + // Get a list without resolving foreign keys + $options = $model->getItems( 0 ); + + // Find the level of the parent + $parentLevel = ($parentId > 0) ? $model->getLevel( $parentId, $type ) : 0; + + // Pad out the options to create a visual tree + foreach ($options as $i => $option) { + $options[$i]->text = str_pad( $option->text, strlen( $option->text ) + 2*($option->level - $parentLevel), '- ', STR_PAD_LEFT ); + } + //array_unshift( $options, JHTML::_( 'select.option', 0, 'Select Group' ) ); + + return JHTML::_( 'select.options', $options, 'value', 'text', $selected ); + } +} \ No newline at end of file diff --git a/administrator/components/com_users/helpers/index.html b/administrator/components/com_users/helpers/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_users/helpers/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_users/index.html b/administrator/components/com_users/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_users/index.html +++ b/administrator/components/com_users/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_users/models/_prototype.php b/administrator/components/com_users/models/_prototype.php new file mode 100644 index 0000000000000..16647f56e75ae --- /dev/null +++ b/administrator/components/com_users/models/_prototype.php @@ -0,0 +1,284 @@ +getState(); + $hash = md5( intval( $resolveFKs ).serialize( $state->getProperties( 1 ) ) ); + + if (!isset( $instances[$hash] )) + { + $query = $this->_getListQuery( $state, $resolveFKs ); + $sql = $query->toString(); + $this->_total = $this->_getListCount( $sql ); + if ($this->_total < $state->get( 'limitstart' )) { + $state->set( 'limitstart', 0 ); + } + $result = $this->_getList( $sql, $state->get( 'limitstart' ), $state->get( 'limit' )); + $instances[$hash] = $result; + } + else { + // TODO: Ideal for true caching + $result = $instances[$hash]; + } + + return $result; + } + + /** + * @return object A pagination object + */ + function &getPagination() + { + static $instance; + + if (!$instance) { + jimport( 'joomla.html.pagination' ); + $state = &$this->getState(); + $instance = new JPagination( $this->_total, $state->get( 'limitstart'), $state->get( 'limit' ) ); + } + return $instance; + } + + /** + * @param boolean True to resolve foreign data relationship + * + * @return JStdClass + */ + function &getItem( $resolveFKs = true ) + { + static $instances; + + $state = $this->getState(); + $key = md5( intval( $resolveFKs ).serialize( $state->getProperties( 1 ) ) ); + + if (!isset( $instances[$key] )) + { + $session = &JFactory::getSession(); + $id = (int) $session->get( 'users.'.$this->getName().'.id', $this->getState('id') ); + + $state->set( 'where', 'a.id='.(int) $id ); + $query = $this->_getListQuery( $state, $resolveFKs ); + $sql = $query->toString(); + $temp = $this->_getList( $sql ); + if (isset( $temp[0] )) { + $instances[$key] = JArrayHelper::toObject( JArrayHelper::fromObject( $temp[0] ), 'JStdClass' ); + } + else { + $temp = $this->getTable(); + $instances[$key] = JArrayHelper::toObject( $temp->getProperties( 1 ), 'JStdClass' ); + } + } + return $instances[$key]; + } + + /** + * Method to checkin a table row + * + * @access public + * @param integer $id The ID of the row + * @return mixed True on success or JExeception object on failure + * @since 1.0 + */ + function checkout($id = null) + { + $result = true; + + $id = (int) (empty($id)) ? $this->getState('id') : $id; + if ($id) { + $table = &$this->getTable(); + $user = &JFactory::getUser(); + if (!$table->checkout($user->get('id'), $id)) { + $result = new JException( $table->getError() ); + } + } + } + + /** + * Method to checkin a table row + * + * @access public + * @param integer $id The ID of the row + * @return mixed True on success or JExeception object on failure + * @since 1.0 + */ + function checkin($id = null) + { + $result = true; + + $id = (int) (empty($id)) ? $this->getState('id') : $id; + if ($id) { + $table = &$this->getTable(); + if (!$table->checkin($id)) { + $result = new JException( $table->getError() ); + } + } + } + + /** + * Method to save a taxonomy entry. + * + * @access public + * @param array values... + * @return mixed True on success or JExeception object on failure + * @since 1.0 + */ + function save($input = array()) + { + $result = true; + $user = &JFactory::getUser(); + $table = &$this->getTable(); + + if (!$table->save( $input )) { + $result = JError::raiseWarning( 500, $table->getError() ); + } + // Set the new id (if new) + $this->setState( 'id', $table->id ); + + return $result; + } + + /** + * Method to delete a list of credit packs. + * + * @access public + * @param array values... + * @return boolean True on success + * @since 1.0 + */ + function delete( $ids ) + { + $table = &$this->getTable(); + if (is_array($ids)) { + foreach ($ids as $id) { + $table->delete((int) $id); + } + return true; + } + else { + return $table->delete((int) $ids); + } + } + + /** + * Method to change the publish state of an item + * + * @access public + * @param array $ids The IDs of the taxonomy rows to publish. + * @param int $value The value to set + * @return mixed True on success or JExeception object on failure + * @since 1.0 + */ + function publish( $ids, $value = 1 ) + { + $result = true; + $user = &JFactory::getUser(); + $table = &$this->getTable(); + + if (!$table->publish( $ids, $value, $user->get('id'))) { + $result = JError::raiseWarning(500, $table->getError()); + } + return $result; + } + + /** + * Set access level + * + * @param mixed An integer ID, or an array of ID's + * @param int Option - the access level + */ + function access( $ids, $level = null ) + { + $table = $this->getTable(); + $qt = 'SELECT g.id' . + ' FROM #__core_acl_axo_groups AS g' . + ' LEFT JOIN '.$table->getTableName().' AS a ON a.id = %d' . + ' WHERE g.level > a.access' . + ' ORDER BY g.id ASC'; + + if (!is_array( $ids )) { + $ids = array( $ids ); + } + JArrayHelper::toInteger( $ids ); + $db = &$this->getDBO(); + + foreach ($ids as $id) { + if ($level == null) { + $db->setQuery( sprintf( $qt, $id ), 0, 1 ); + $newlevel = $db->loadResult(); + } + else { + $newlevel = $level; + } + $db->setQuery( + 'UPDATE '.$table->getTableName() . + ' SET access = '.(int) $newlevel . + ' WHERE id = '.$id + ); + if (!$db->query()) { + return new JException( $db->getErrorMsg() ); + } + } + return count( $ids ); + } + + /** + * @param array An array of primary keys + * @param int Increment, usually +1 or -1 + * @return boolean + */ + function ordering( $input, $inc=0 ) + { + $app = &JFactory::getApplication(); + + $db = &$this->getDBO(); + $user = &JFactory::getUser(); + $table = &$this->getTable(); + + JArrayHelper::toInteger( $input ); + + if (!empty( $input )) { + $cids = 'id=' . implode( ' OR id=', $input ); + $hasCO = property_exists( $table, 'checked_out' ); + + $query = 'UPDATE ' . $table->getTableName() + . ' SET ordering = ordering + ' . (int) $inc + . ' WHERE (' . $cids . ')' + . ($hasCO ? ' AND (checked_out = 0 OR checked_out = ' . (int) $user->get( 'id' ) . ')' : '' ) + ; + $db->setQuery( $query ); + if (!$db->query()) { + $this->setError( $db->getErrorMsg() ); + } + else { + return true; + } + } + } +} diff --git a/administrator/components/com_users/models/author.xml b/administrator/components/com_users/models/author.xml index ddaf3e811142d..bc901691f6543 100644 --- a/administrator/components/com_users/models/author.xml +++ b/administrator/components/com_users/models/author.xml @@ -1,10 +1,10 @@ - - - Author User Type - - - - - - - + +
    + Author User Type + + + + + + + diff --git a/administrator/components/com_users/models/index.html b/administrator/components/com_users/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_users/models/index.html +++ b/administrator/components/com_users/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_users/models/registered.xml b/administrator/components/com_users/models/registered.xml index 7d420535894ec..684e739f31186 100644 --- a/administrator/components/com_users/models/registered.xml +++ b/administrator/components/com_users/models/registered.xml @@ -1,8 +1,8 @@ - -
    - Registered User Type - - - - - + +
    + Registered User Type + + + + + diff --git a/administrator/components/com_users/models/user.php b/administrator/components/com_users/models/user.php new file mode 100644 index 0000000000000..ed12f11cb21c4 --- /dev/null +++ b/administrator/components/com_users/models/user.php @@ -0,0 +1,202 @@ +__state_set)) + { + $app = &JFactory::getApplication(); + + $cid = JRequest::getVar( 'cid', array(0), '', 'array' ); + $id = JRequest::getInt( 'id', $cid[0] ); + $this->setState( 'id', $id ); + + $search = $app->getUserStateFromRequest( 'users.user.search', 'search' ); + $this->setState( 'search', $search ); + + //$published = $app->getUserStateFromRequest( 'users.user.published', 'published', 1 ); + //$this->setState( 'published', ($published == '*' ? null : $published) ); + + $value = $app->getUserStateFromRequest( 'users.user.groupId', 'filter_group_id' ); + $this->setState( 'group_id', $value ); + + $value = $app->getUserStateFromRequest( 'users.user.loggedIn', 'filter_logged_in' ); + $this->setState( 'logged_in', $value ); + + $value = $app->getUserStateFromRequest( 'users.user.enabled', 'filter_enabled', '*' ); + $this->setState( 'enabled', $value ); + + $value = $app->getUserStateFromRequest( 'users.user.activated', 'filter_activated', '*' ); + $this->setState( 'activated', $value ); + + // List state information + $limit = $app->getUserStateFromRequest( 'global.list.limit', 'limit', $app->getCfg( 'list_limit' ) ); + $this->setState( 'limit', $limit ); + + $limitstart = $app->getUserStateFromRequest( 'users.user.limitstart', 'limitstart', 0 ); + $this->setState( 'limitstart', $limitstart ); + + $orderCol = $app->getUserStateFromRequest( 'users.user.ordercol', 'filter_order', 'a.name' ); + $orderDirn = $app->getUserStateFromRequest( 'users.user.orderdirn', 'filter_order_Dir', 'asc' ); + if ($orderCol) { + $this->setState( 'order by', $orderCol.' '.($orderDirn == 'asc' ? 'asc' : 'desc') ); + } + $this->setState( 'orderCol', $orderCol ); + $this->setState( 'orderDirn', $orderDirn ); + + $this->__state_set = true; + } + return parent::getState($key, $default); + } + + + /** + * Proxy for getTable + */ + function &getTable() + { + return parent::getTable( 'User', 'JTable' ); + } + + /** + * Gets a list of categories objects + * + * Filters may be fields|published|order by|searchName|where + * @param array Named array of field-value filters + * @param boolean True if foreign keys are to be resolved + */ + function _getListQuery( $filters, $resolveFKs=false ) + { + $groupId = $filters->get( 'group_id' ); + $loggedIn = $filters->get( 'logged_in' ); + $enabled = $filters->get( 'enabled' ); + $activated = $filters->get( 'activated' ); + // arbitrary where + $select = $filters->get( 'select' ); + $search = $filters->get( 'search' ); + $where = $filters->get( 'where' ); + $orderBy = $filters->get( 'order by' ); + + $db = &$this->getDBO(); + $query = new JQuery; + + $query->select( $select !== null ? $select : 'a.*' ); + $query->from( '#__users AS a' ); + + if ($resolveFKs) { + /* + // checked out + $query->select( 'co.name AS editor' ); + $query->join( 'LEFT', '#__users AS co ON co.id=a.checked_out' ); + + // access level + $config = &JComponentHelper::getParams( 'com_users' ); + if ($config->get( 'acl_mode' ) == 0) { + $query->select( 'g.name AS access_name' ); + $query->join( 'LEFT', '#__core_acl_axo_groups AS g ON g.value=a.access' ); + } + else { + $query->select( 'g.name AS access_name' ); + $query->join( 'LEFT', '#__core_acl_axo_groups AS g ON g.value=CAST(a.access AS CHAR)' ); + } +*/ + $NL = $db->Quote( "\n" ); + $query->select( 'GROUP_CONCAT( DISTINCT( g.name ) SEPARATOR '.$NL.') AS groups' ); + $query->join( 'INNER', '#__core_acl_aro AS aro ON aro.value = a.id' ); + $query->join( 'INNER', '#__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.id' ); + $query->join( 'INNER', '#__core_acl_aro_groups AS g ON g.id = gm.group_id' ); + $query->group( 'a.id' ); + + /* @todo Check for performance on this join - there is an index on userid ?? */ + $query->select( 's.userid AS loggedin' ); + if ($loggedIn) { + $query->join( 'INNER', '#__session AS s ON s.userid = a.id' ); + } + else { + $query->join( 'LEFT', '#__session AS s ON s.userid = a.id' ); + } + } + + // options + if ($search) { + $match = $db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); + $query->where( '(a.name LIKE '.$match.' OR a.username LIKE '.$match.')' ); + } + + if ($groupId) { + if (!$resolveFKs) { + $query->join( 'INNER', '#__core_acl_aro AS aro ON aro.value = a.id' ); + $query->join( 'INNER', '#__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.id' ); + } + $query->where( 'gm.group_id = '.(int) $groupId ); + } + + if (is_numeric( $enabled )) { + $query->where( 'a.block = '.$enabled ); + } + + if (is_numeric( $activated )) { + if ($activated == 1) { + $query->where( 'a.activation = '.$db->Quote( '' ) ); + } + else { + $query->where( 'a.activation <> '.$db->Quote( '' ) ); + } + } + + if ($where) { + $query->where( $where ); + } + + if ($orderBy) { + $query->order( $this->_db->getEscaped( $orderBy ) ); + } + + //echo str_replace('#__','jos_',nl2br($query->toString())); + return $query; + } + + /** + * Perform batch operations + * + * @param array An array of variable for the batch operation + * @param array An array of IDs on which to operate + */ + function batch( $vars, $ids ) + { + $db = $this->getDBO(); + $result = true; + + JArrayHelper::toInteger( $ids ); + + // Do stuff + + return $result; + } +} \ No newline at end of file diff --git a/administrator/components/com_users/models/user.xml b/administrator/components/com_users/models/user.xml index 69678c5d3e65a..4f103fa8277c4 100644 --- a/administrator/components/com_users/models/user.xml +++ b/administrator/components/com_users/models/user.xml @@ -1,10 +1,10 @@ - -
    - - - - - - - - + +
    + + + + + + + + diff --git a/administrator/components/com_users/params/author.xml b/administrator/components/com_users/params/author.xml new file mode 100644 index 0000000000000..bc901691f6543 --- /dev/null +++ b/administrator/components/com_users/params/author.xml @@ -0,0 +1,10 @@ + +
    + Author User Type + + + + + + + diff --git a/administrator/components/com_users/params/general_messages.xml b/administrator/components/com_users/params/general_messages.xml new file mode 100644 index 0000000000000..aac33d23b57da --- /dev/null +++ b/administrator/components/com_users/params/general_messages.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/administrator/components/com_users/params/index.html b/administrator/components/com_users/params/index.html new file mode 100644 index 0000000000000..0dc101b533592 --- /dev/null +++ b/administrator/components/com_users/params/index.html @@ -0,0 +1 @@ + diff --git a/administrator/components/com_users/params/registered.xml b/administrator/components/com_users/params/registered.xml new file mode 100644 index 0000000000000..684e739f31186 --- /dev/null +++ b/administrator/components/com_users/params/registered.xml @@ -0,0 +1,8 @@ + +
    + Registered User Type + + + + + diff --git a/administrator/components/com_users/params/user.xml b/administrator/components/com_users/params/user.xml new file mode 100644 index 0000000000000..4f103fa8277c4 --- /dev/null +++ b/administrator/components/com_users/params/user.xml @@ -0,0 +1,10 @@ + +
    + + + + + + + + diff --git a/administrator/components/com_users/tables/group.php b/administrator/components/com_users/tables/group.php new file mode 100644 index 0000000000000..ca2c4d8f3fd20 --- /dev/null +++ b/administrator/components/com_users/tables/group.php @@ -0,0 +1,97 @@ +_db; + + $parent_id = (int) $parent_id; + + // get all children of this node + $query = 'SELECT id FROM '. $this->_tbl .' WHERE parent_id='. $parent_id; + + $db->setQuery( $query ); + $children = $db->loadResultArray(); + + // the right value of this node is the left value + 1 + $right = $left + 1; + + $n = count( $children ); + foreach ($children as $id) + { + // recursive execution of this function for each + // child of this node + // $right is the current right value, which is + // incremented by the rebuild_tree function + $right = $this->rebuild( $id, $right ); + + if ($right === FALSE) { + return FALSE; + } + } + + // we've got the left value, and now that we've processed + // the children of this node we also know the right value + $query = 'UPDATE '. $this->_tbl .' SET lft='. $left .', rgt='. $right .' WHERE id='. $parent_id; + + $db->setQuery( $query ); + if (!$db->query()) { + return false; + } + + // return the right value of this node + 1 + return $right + 1; + } +} + diff --git a/administrator/components/com_users/tables/index.html b/administrator/components/com_users/tables/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_users/tables/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_users/users.php b/administrator/components/com_users/users.php index 4400c608a942f..db15b8e03a20b 100644 --- a/administrator/components/com_users/users.php +++ b/administrator/components/com_users/users.php @@ -1,34 +1,134 @@ -authorize( 'com_users', 'manage' )) { - $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); -} - -// Require the base controller -require_once (JPATH_COMPONENT.DS.'controller.php'); - -// Create the controller -$controller = new UsersController( ); - -// Perform the Request task -$controller->execute( JRequest::getCmd('task')); -$controller->redirect(); \ No newline at end of file +authorize( 'com_users', 'manage' )) { + $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); +} + +// Import library dependencies +jimport('joomla.application.component.controller'); +jimport('joomla.application.component.model'); +JTable::addIncludePath( JPATH_COMPONENT.DS.'tables' ); + +/** + * Component Controller + * + * @package Users + * @subpackage com_user + */ +class UserController extends JController +{ + function display() + { + $document = &JFactory::getDocument(); + + // Set the default view name and format from the Request + $vName = JRequest::getWord( 'view', 'users' ); + $vFormat = $document->getType(); + $lName = JRequest::getWord( 'layout', 'default' ); + + if ($view = &$this->getView( $vName, $vFormat )) + { + switch ($vName) + { + case 'user': + case 'users': + $model = $this->getModel( 'user' ); + break; + + case 'group': + case 'groups': + $acl = &JFactory::getACL(); + $parentId = $acl->get_group_id( 'USERS' ); + $model = $this->getModel( 'group' ); + $model->setState( 'type', 'aro' ); + $model->setState( 'parent_id', $parentId ); + $model->setState( 'show.tree', 1 ); + break; + + case 'level': + case 'levels': + $model = $this->getModel( 'group' ); + $model->setState( 'type', 'axo' ); + break; + + } + + // Push the model into the view (as default) + $view->setModel( $model, true ); + $view->setLayout( $lName ); + $view->assignRef( 'document', $document ); + + JHTML::addIncludePath( JPATH_COMPONENT.DS.'helpers'.DS.'html' ); + $view->display(); + } + + // Set up the Linkbar + JSubMenuHelper::addEntry( JText::_( 'Link Users' ), 'index.php?option=com_users&view=users', $vName == 'users' ); + JSubMenuHelper::addEntry( JText::_( 'Link Groups' ), 'index.php?option=com_users&view=groups', $vName == 'groups' ); + JSubMenuHelper::addEntry( JText::_( 'Link Access Levels' ), 'index.php?option=com_users&view=levels', $vName == 'levels' ); + } +} + +// Determine the request protocol +$protocol = JRequest::getWord( 'protocol' ); + +// Get task command from the request +$cmd = JRequest::getVar( 'task', null ); + +// If it was a multiple option post get the selected option +if (is_array( $cmd )) { + $cmd = array_pop( array_keys( $cmd ) ); +} + +// Filter the command and instantiate the appropriate controller +$cmd = JFilterInput::clean($cmd,'cmd'); +if (strpos($cmd, '.') != false) { + // We have a defined controller/task pair -- lets split them out + list($controllerName, $task) = explode('.', $cmd); + + // Define the controller name and path + $controllerName = strtolower($controllerName); + $controllerFile = ($protocol) ? $controllerName.'.'.$protocol : $controllerName; + $controllerPath = JPATH_COMPONENT.DS.'controllers'.DS.$controllerFile.'.php'; + + // If the controller file path exists, include it ... else lets die with a 500 error + if (file_exists( $controllerPath )) { + require_once $controllerPath; + } + else { + JError::raiseError(500, 'Invalid Controller'); + } +} +else { + // Base controller, just set the task :) + $controllerName = null; + $task = $cmd; +} + +// Set the name for the controller and instantiate it +$controllerClass = 'UserController'.ucfirst( $controllerName ); + +if (class_exists( $controllerClass )) { + $controller = new $controllerClass(); +} +else { + JError::raiseError(500, 'Invalid Controller Class'); +} + +// Perform the Request task +$controller->execute( $task ); + +// Redirect if set by the controller +$controller->redirect(); diff --git a/administrator/components/com_users/users.xml b/administrator/components/com_users/users.xml index 00e8de09aa64b..310edb4c3f3cd 100644 --- a/administrator/components/com_users/users.xml +++ b/administrator/components/com_users/users.xml @@ -1,12 +1,12 @@ - - - User Manager - Joomla! Project - April 2006 - (C) 2005 - 2008 Open Source Matters. All rights reserved. - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - admin@joomla.org - www.joomla.org - 1.5.0 - User Manager - + + + User Manager + Joomla! Project + April 2006 + (C) 2005 - 2008 Open Source Matters. All rights reserved. + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + admin@joomla.org + www.joomla.org + 1.5.0 + User Manager + diff --git a/administrator/components/com_users/views/index.html b/administrator/components/com_users/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_users/views/index.html +++ b/administrator/components/com_users/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_users/views/user/index.html b/administrator/components/com_users/views/user/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_users/views/user/index.html +++ b/administrator/components/com_users/views/user/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_users/views/user/tmpl/edit.php b/administrator/components/com_users/views/user/tmpl/edit.php new file mode 100644 index 0000000000000..41e5b54d3a9c1 --- /dev/null +++ b/administrator/components/com_users/views/user/tmpl/edit.php @@ -0,0 +1,44 @@ + +item, ENT_QUOTES, '' ); +?> + + +@todo Form validation moving to unobtrusive js methods +
    +
    + loadTemplate( 'main' ); ?> +
    + +
    + loadTemplate( 'parameters' ); ?> + loadTemplate( 'contact' ); ?> + loadTemplate( 'groups' ); ?> +
    + +
    + + + + + diff --git a/administrator/components/com_users/views/user/tmpl/edit_contact.php b/administrator/components/com_users/views/user/tmpl/edit_contact.php new file mode 100644 index 0000000000000..fcc92cafaba9b --- /dev/null +++ b/administrator/components/com_users/views/user/tmpl/edit_contact.php @@ -0,0 +1,95 @@ + +
    + + contact ) { ?> +
    + + + +
    +
    + + : +
    + . +
    +

    +
    + + + + + + + + + + + + + + + + + + + + + + + contact[0]->image) { ?> + + + + + + + + + +
    + + + + contact[0]->name;?> + +
    + + + + contact[0]->con_position;?> + +
    + + + + contact[0]->telephone;?> + +
    + + + + contact[0]->fax;?> + +
    + + + + contact[0]->misc;?> + +
    + + + <?php echo JText::_( 'Contact' ); ?> +
      +
    +
    + + +

    + ' Contact -> Manage Contacts' ); ?>' +
    +
    +
    + + diff --git a/administrator/components/com_users/views/user/tmpl/edit_groups.php b/administrator/components/com_users/views/user/tmpl/edit_groups.php new file mode 100644 index 0000000000000..5cd5dc7cf8bd4 --- /dev/null +++ b/administrator/components/com_users/views/user/tmpl/edit_groups.php @@ -0,0 +1,24 @@ + +get_group_id( 'USERS' ); +?> +
    + + @todo Limit by ACL + + + + + +
    + + + +
    +
    \ No newline at end of file diff --git a/administrator/components/com_users/views/user/tmpl/edit_main.php b/administrator/components/com_users/views/user/tmpl/edit_main.php new file mode 100644 index 0000000000000..a5dccaa1d81ce --- /dev/null +++ b/administrator/components/com_users/views/user/tmpl/edit_main.php @@ -0,0 +1,101 @@ + + +
    + item->get( 'id' )) : ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + + +
    + + @todo ACL this field + + item->get( 'block' ) ); ?> +
    + + @todo ACL this field + + item->get( 'sendEmail' ) ); ?> +
    + + + item->get('registerDate');?> +
    + + + item->get('lastvisitDate'); + if ($lvisit == '0000-00-00 00:00:00') { + $lvisit = JText::_( 'Never'); + } + echo $lvisit; + ?> +
    +
    diff --git a/administrator/components/com_users/views/user/tmpl/edit_parameters.php b/administrator/components/com_users/views/user/tmpl/edit_parameters.php new file mode 100644 index 0000000000000..6f7489b803a8d --- /dev/null +++ b/administrator/components/com_users/views/user/tmpl/edit_parameters.php @@ -0,0 +1,32 @@ + +
    + + + + + +
    + user->getParameters(true); + echo $pane->startPane("menu-pane"); + $groups = $params->getGroups(); + if(count($groups)) { + foreach($groups as $groupname => $group) { + if($groupname == '_default') { + $title = 'General'; + } else { + $title = ucfirst($groupname); + } + if($params->getNumParams($groupname)) { + echo $pane->startPanel(JText :: _('Parameters - '.$title), $groupname.'-page'); + echo $params->render('params', $groupname); + echo $pane->endPanel(); + } + } + } + echo $pane->endPane(); + ?> +
    +
    diff --git a/administrator/components/com_users/views/user/tmpl/form.php b/administrator/components/com_users/views/user/tmpl/form.php deleted file mode 100644 index a59b349b9f957..0000000000000 --- a/administrator/components/com_users/views/user/tmpl/form.php +++ /dev/null @@ -1,301 +0,0 @@ - - - - -[ '. $text .' ]' , 'user.png' ); - JToolBarHelper::save(); - JToolBarHelper::apply(); - if ( $edit ) { - // for existing items the button is renamed `close` - JToolBarHelper::cancel( 'cancel', 'Close' ); - } else { - JToolBarHelper::cancel(); - } - JToolBarHelper::help( 'screen.users.edit' ); - $cparams = JComponentHelper::getParams ('com_media'); -?> - -user->get('lastvisitDate'); - if ($lvisit == "0000-00-00 00:00:00") { - $lvisit = JText::_( 'Never'); - } -?> - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - user->authorize( 'com_users', 'block user' )) { ?> - - - - - user->authorize( 'com_users', 'email_events' )) { ?> - - - - - user->get('id') ) { ?> - - - - - - - - - -
    - - - -
    - - - -
    - - - -
    - - - user->get('password')) : ?> - - - - -
    - - - user->get('password')) : ?> - - - - -
    - - - lists['gid']; ?> -
    - - - lists['block']; ?> -
    - - - lists['sendEmail']; ?> -
    - - - user->get('registerDate');?> -
    - - - -
    -
    -
    -
    -
    - - - - - -
    - user->getParameters(true); - echo $params->render( 'params' ); - ?> -
    -
    -
    - - contact ) { ?> - - - - -
    -
    - - : -
    - . -
    -

    -
    - - - - - - - - - - - - - - - - - - - - - - - contact[0]->image) { ?> - - - - - - - - - -
    - - - - contact[0]->name;?> - -
    - - - - contact[0]->con_position;?> - -
    - - - - contact[0]->telephone;?> - -
    - - - - contact[0]->fax;?> - -
    - - - - contact[0]->misc;?> - -
    - - - <?php echo JText::_( 'Contact' ); ?> -
      -
    -
    - - -

    - ' Contact -> Manage Contacts' ); ?>' -
    -
    -
    - -
    -
    -
    - - - - - - - user->authorize( 'com_users', 'email_events' )) { ?> - - - -
    \ No newline at end of file diff --git a/administrator/components/com_users/views/user/tmpl/index.html b/administrator/components/com_users/views/user/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_users/views/user/tmpl/index.html +++ b/administrator/components/com_users/views/user/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_users/views/user/view.html.php b/administrator/components/com_users/views/user/view.html.php index 5d9bc9b6b9059..373befdcae883 100644 --- a/administrator/components/com_users/views/user/view.html.php +++ b/administrator/components/com_users/views/user/view.html.php @@ -1,139 +1,69 @@ -bind($post); - } - - if ( $user->get('id')) - { - $query = 'SELECT *' - . ' FROM #__contact_details' - . ' WHERE user_id = '.(int) $cid[0] - ; - $db->setQuery( $query ); - $contact = $db->loadObjectList(); - } - else - { - $contact = NULL; - // Get the default group id for a new user - $config = &JComponentHelper::getParams( 'com_users' ); - $newGrp = $config->get( 'new_usertype' ); - $user->set( 'gid', $acl->get_group_id( $newGrp, null, 'ARO' ) ); - } - - $userObjectID = $acl->get_object_id( 'users', $user->get('id'), 'ARO' ); - $userGroups = $acl->get_object_groups( $userObjectID, 'ARO' ); - $userGroupName = strtolower( $acl->get_group_name( $userGroups[0], 'ARO' ) ); - - $myObjectID = $acl->get_object_id( 'users', $myuser->get('id'), 'ARO' ); - $myGroups = $acl->get_object_groups( $myObjectID, 'ARO' ); - $myGroupName = strtolower( $acl->get_group_name( $myGroups[0], 'ARO' ) );; - - // ensure user can't add/edit group higher than themselves - /* NOTE : This check doesn't work commented out for the time being - if ( is_array( $myGroups ) && count( $myGroups ) > 0 ) - { - $excludeGroups = (array) $acl->get_group_children( $myGroups[0], 'ARO', 'RECURSE' ); - } - else - { - $excludeGroups = array(); - } - - if ( in_array( $userGroups[0], $excludeGroups ) ) - { - echo 'not auth'; - $mainframe->redirect( 'index.php?option=com_users', JText::_('NOT_AUTH') ); - } - */ - - /* - if ( $userGroupName == 'super administrator' ) - { - // super administrators can't change - $lists['gid'] = ''. JText::_( 'Super Administrator' ) .''; - } - else if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' ) { - */ - - if ( $userGroupName == $myGroupName && $myGroupName == 'administrator' ) - { - // administrators can't change each other - $lists['gid'] = ''. JText::_( 'Administrator' ) .''; - } - else - { - $gtree = $acl->get_group_children_tree( null, 'USERS', false ); - - // remove users 'above' me - //$i = 0; - //while ($i < count( $gtree )) { - // if ( in_array( $gtree[$i]->value, (array)$excludeGroups ) ) { - // array_splice( $gtree, $i, 1 ); - // } else { - // $i++; - // } - //} - - $lists['gid'] = JHTML::_('select.genericlist', $gtree, 'gid', 'size="10"', 'value', 'text', $user->get('gid') ); - } - - // build the html select list - $lists['block'] = JHTML::_('select.booleanlist', 'block', 'class="inputbox" size="1"', $user->get('block') ); - - // build the html select list - $lists['sendEmail'] = JHTML::_('select.booleanlist', 'sendEmail', 'class="inputbox" size="1"', $user->get('sendEmail') ); - - $this->assignRef('lists', $lists); - $this->assignRef('user', $user); - $this->assignRef('contact', $contact); - - parent::display($tpl); - } -} \ No newline at end of file +get( 'State' ); + $this->assignRef( 'state', $state ); + + $item = &$this->get( 'Item' ); + $this->assignRef( 'item', $item ); + + if ($state->get( 'id' )) { + // Existing + } + else { + // New + $config = &JComponentHelper::getParams( 'com_users' ); + $acl = &JFactory::getACL(); + $newGrp = $config->get( 'new_usertype' ); + $item->set( 'gid', $acl->get_group_id( $newGrp, null, 'ARO' ) ); + } + + $this->_setToolBar(); + parent::display($tpl); + } + + /** + * Display the toolbar + * + * @access private + */ + function _setToolBar() + { + $isNew = ($this->item->get( 'id' ) == 0); + JToolBarHelper::title( JText::_( ($isNew ? 'Add User' : 'Edit User' ) ), 'user' ); + if (!$isNew) { + JToolBarHelper::custom( 'user.save2copy', 'copy.png', 'copy_f2.png', 'Save To Copy', false ); + } + JToolBarHelper::custom( 'user.save2new', 'new.png', 'new_f2.png', 'Save And New', false ); + JToolBarHelper::save( 'user.save' ); + JToolBarHelper::apply( 'user.apply' ); + JToolBarHelper::cancel( 'user.cancel' ); + JToolBarHelper::help( 'screen.users.edit' ); + } +} + diff --git a/administrator/components/com_users/views/users/index.html b/administrator/components/com_users/views/users/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_users/views/users/index.html +++ b/administrator/components/com_users/views/users/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_users/views/users/tmpl/default.php b/administrator/components/com_users/views/users/tmpl/default.php index 9c07bc8cb7433..0a32894f2d0c2 100644 --- a/administrator/components/com_users/views/users/tmpl/default.php +++ b/administrator/components/com_users/views/users/tmpl/default.php @@ -1,138 +1,159 @@ - - - - - - -
    - - - - - -
    - : - - - - - lists['type'];?> - lists['logged'];?> -
    - - - - - - - - - - - - - - - - - - - - - - - items ); $i < $n; $i++) - { - $row =& $this->items[$i]; - - $img = $row->block ? 'publish_x.png' : 'tick.png'; - $task = $row->block ? 'unblock' : 'block'; - $alt = $row->block ? JText::_( 'Enabled' ) : JText::_( 'Blocked' ); - $link = 'index.php?option=com_users&view=user&task=edit&cid[]='. $row->id. ''; - - if ($row->lastvisitDate == "0000-00-00 00:00:00") { - $lvisit = JText::_( 'Never' ); - } else { - $lvisit = $row->lastvisitDate; //= JHTML::_('date', $row->lastvisitDate, JText::_('DATE_FORMAT_LC4')); - } - ?> - "> - - - - - - - - - - - - - -
    - - - - - lists['order_Dir'], @$this->lists['order'] ); ?> - - lists['order_Dir'], @$this->lists['order'] ); ?> - - - - lists['order_Dir'], @$this->lists['order'] ); ?> - - lists['order_Dir'], @$this->lists['order'] ); ?> - - lists['order_Dir'], @$this->lists['order'] ); ?> - - lists['order_Dir'], @$this->lists['order'] ); ?> - - lists['order_Dir'], @$this->lists['order'] ); ?> -
    - pagination->getListFooter(); ?> -
    - pagination->limitstart;?> - - id ); ?> - - - name; ?> - - username; ?> - - loggedin ? '': ''; ?> - - - <?php echo $alt; ?> - - groupname ); ?> - - - email; ?> - - - - id; ?> -
    - - - - - - - + +get_group_id( 'USERS' ); +?> +@todo Decide on ACL - if a user has access to the user manager, should they have a limit on the people they can create vs the overhead of adding rules (examine the most common use cases)
    +@todo Add toolbar action to resend activation notice or reset password
    +@todo Add toolbar action for configuration popup (take out of Global Configuration) + + + + + + + +
    + : + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + items ); $i < $n; $i++) : + $row =& $this->items[$i]; + + $img = $row->block ? 'publish_x.png' : 'tick.png'; + $task = $row->block ? 'unblock' : 'block'; + $alt = $row->block ? JText::_( 'Enabled' ) : JText::_( 'Blocked' ); + ?> + + + + + + + + + + + + + + +
    + + + + + state->get('orderDirn'), $this->state->get('orderCol') ); ?> + (state->get('orderDirn'), $this->state->get('orderCol') ); ?>) + + + + state->get('orderDirn'), $this->state->get('orderCol') ); ?> + + state->get('orderDirn'), $this->state->get('orderCol') ); ?> + + state->get('orderDirn'), $this->state->get('orderCol') ); ?> + + state->get('orderDirn'), $this->state->get('orderCol') ); ?> + + state->get('orderDirn'), $this->state->get('orderCol') ); ?> + + state->get('orderDirn'), $this->state->get('orderCol') ); ?> +
    + pagination->getListFooter(); ?> +
    + pagination->limitstart;?> + + id ); ?> + + + name; ?> + (username; ?>) + @todo + + loggedin ? '': ''; ?> + + + <?php echo $alt; ?> + + activation ? '' : ''; ?> + + groups ) AS $group) : + echo JText::_( $group ).'
    '; + endforeach; + ?> +
    + + email; ?> + + lastvisitDate == "0000-00-00 00:00:00") : + echo JText::_( 'Never' ); + else : + echo $row->lastvisitDate; //= JHTML::_('date', $row->lastvisitDate, JText::_('DATE_FORMAT_LC4')); + endif; + ?> + + id; ?> +
    + +
    + +
    + @todo Batch move/append/remove users amongst groups
    +
    +
    + + + + + + + +
    \ No newline at end of file diff --git a/administrator/components/com_users/views/users/tmpl/index.html b/administrator/components/com_users/views/users/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_users/views/users/tmpl/index.html +++ b/administrator/components/com_users/views/users/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_users/views/users/view.html.php b/administrator/components/com_users/views/users/view.html.php index 71827b9d7a798..5b53c5e23d407 100644 --- a/administrator/components/com_users/views/users/view.html.php +++ b/administrator/components/com_users/views/users/view.html.php @@ -1,165 +1,80 @@ -getUserStateFromRequest( "$option.filter_order", 'filter_order', 'a.name', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( "$option.filter_order_Dir", 'filter_order_Dir', '', 'word' ); - $filter_type = $mainframe->getUserStateFromRequest( "$option.filter_type", 'filter_type', 0, 'string' ); - $filter_logged = $mainframe->getUserStateFromRequest( "$option.filter_logged", 'filter_logged', 0, 'int' ); - $search = $mainframe->getUserStateFromRequest( "$option.search", 'search', '', 'string' ); - $search = JString::strtolower( $search ); - - $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); - $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); - - $where = array(); - if (isset( $search ) && $search!= '') - { - $searchEscaped = $db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); - $where[] = 'a.username LIKE '.$searchEscaped.' OR a.email LIKE '.$searchEscaped.' OR a.name LIKE '.$searchEscaped; - } - if ( $filter_type ) - { - if ( $filter_type == 'Public Frontend' ) - { - $where[] = ' a.usertype = \'Registered\' OR a.usertype = \'Author\' OR a.usertype = \'Editor\' OR a.usertype = \'Publisher\' '; - } - else if ( $filter_type == 'Public Backend' ) - { - $where[] = 'a.usertype = \'Manager\' OR a.usertype = \'Administrator\' OR a.usertype = \'Super Administrator\' '; - } - else - { - $where[] = 'a.usertype = LOWER( '.$db->Quote($filter_type).' ) '; - } - } - if ( $filter_logged == 1 ) - { - $where[] = 's.userid = a.id'; - } - else if ($filter_logged == 2) - { - $where[] = 's.userid IS NULL'; - } - - // exclude any child group id's for this user - $pgids = $acl->get_group_children( $currentUser->get('gid'), 'ARO', 'RECURSE' ); - - if (is_array( $pgids ) && count( $pgids ) > 0) - { - JArrayHelper::toInteger($pgids); - $where[] = 'a.gid NOT IN (' . implode( ',', $pgids ) . ')'; - } - $filter = ''; - if ($filter_logged == 1 || $filter_logged == 2) - { - $filter = ' INNER JOIN #__session AS s ON s.userid = a.id'; - } - - $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir; - $where = ( count( $where ) ? ' WHERE (' . implode( ') AND (', $where ) . ')' : '' ); - - $query = 'SELECT COUNT(a.id)' - . ' FROM #__users AS a' - . $filter - . $where - ; - $db->setQuery( $query ); - $total = $db->loadResult(); - - jimport('joomla.html.pagination'); - $pagination = new JPagination( $total, $limitstart, $limit ); - - $query = 'SELECT a.*, g.name AS groupname' - . ' FROM #__users AS a' - . ' INNER JOIN #__core_acl_aro AS aro ON aro.value = a.id' - . ' INNER JOIN #__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.id' - . ' INNER JOIN #__core_acl_aro_groups AS g ON g.id = gm.group_id' - . $filter - . $where - . ' GROUP BY a.id' - . $orderby - ; - $db->setQuery( $query, $pagination->limitstart, $pagination->limit ); - $rows = $db->loadObjectList(); - - $n = count( $rows ); - $template = 'SELECT COUNT(s.userid)' - . ' FROM #__session AS s' - . ' WHERE s.userid = %d' - ; - for ($i = 0; $i < $n; $i++) - { - $row = &$rows[$i]; - $query = sprintf( $template, intval( $row->id ) ); - $db->setQuery( $query ); - $row->loggedin = $db->loadResult(); - } - - // get list of Groups for dropdown filter - $query = 'SELECT name AS value, name AS text' - . ' FROM #__core_acl_aro_groups' - . ' WHERE name != "ROOT"' - . ' AND name != "USERS"' - ; - $db->setQuery( $query ); - $types[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select Group' ) .' -' ); - foreach( $db->loadObjectList() as $obj ) - { - $types[] = JHTML::_('select.option', $obj->value, JText::_( $obj->text ) ); - } - $lists['type'] = JHTML::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "$filter_type" ); - - // get list of Log Status for dropdown filter - $logged[] = JHTML::_('select.option', 0, '- '. JText::_( 'Select Log Status' ) .' -'); - $logged[] = JHTML::_('select.option', 1, JText::_( 'Logged In' ) ); - $lists['logged'] = JHTML::_('select.genericlist', $logged, 'filter_logged', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', "$filter_logged" ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; - - $this->assignRef('user', JFactory::getUser()); - $this->assignRef('lists', $lists); - $this->assignRef('items', $rows); - $this->assignRef('pagination', $pagination); - - parent::display($tpl); - } -} \ No newline at end of file +get( 'State' ); + $this->assignRef( 'state', $state ); + + $items = &$this->get( 'Items' ); + $this->assignRef( 'items', $items ); + + $pagination = &$this->get( 'Pagination' ); + $this->assignRef( 'pagination', $pagination ); + + // Logged in filter + $options = array(); + $options[] = JHTML::_( 'select.option', '0', 'Select Login Status' ); + $options[] = JHTML::_( 'select.option', '1', 'Logged In' ); + $this->assign( 'f_logged_in', $options ); + + // Enabled filter + $options = array(); + $options[] = JHTML::_( 'select.option', '*', 'Select Enabled Status' ); + $options[] = JHTML::_( 'select.option', '1', 'No' ); + $options[] = JHTML::_( 'select.option', '0', 'Yes' ); + $this->assign( 'f_enabled', $options ); + + // Activated filter + $options = array(); + $options[] = JHTML::_( 'select.option', '*', 'Select Activated Status' ); + $options[] = JHTML::_( 'select.option', '1', 'No' ); + $options[] = JHTML::_( 'select.option', '0', 'Yes' ); + $this->assign( 'f_activated', $options ); + + $this->_setToolBar(); + parent::display($tpl); + } + + /** + * Display the toolbar + * + * @access private + */ + function _setToolBar() + { + JToolBarHelper::title( JText::_( 'user Manager' ), 'user.png' ); + JToolBarHelper::custom( 'user.logout', 'cancel.png', 'cancel_f2.png', 'Logout' ); + JToolBarHelper::deleteList( '', 'user.delete' ); + JToolBarHelper::custom( 'user.edit', 'edit.png', 'edit_f2.png', 'Edit', true ); + JToolBarHelper::custom( 'user.edit', 'new.png', 'new_f2.png', 'New', false ); + JToolBarHelper::help( 'screen.users' ); + } +} + diff --git a/administrator/components/com_weblinks/classes/index.html b/administrator/components/com_weblinks/classes/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_weblinks/classes/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_weblinks/classes/weblink.php b/administrator/components/com_weblinks/classes/weblink.php new file mode 100644 index 0000000000000..e8d0a2f267b3c --- /dev/null +++ b/administrator/components/com_weblinks/classes/weblink.php @@ -0,0 +1,63 @@ +state == 1 ? JText::_( 'Published' ) : ($row->state == -1 ? JText::_( 'Reported' ) : JText::_( 'Unpublished' )); + $img = JHTML::_('image.administrator', $row->state == 1 ? $imgY : ($row->state == -1 ? $imgR : $imgX), null, null, null, $alt); + $task = $row->state == 1 ? 'unpublish' : 'publish'; + $action = $row->state == 1 ? JText::_( 'Unpublish Item' ) : JText::_( 'Publish item' ); + + $href = ' + ' + . $img .'' + ; + + return $href; + } + + function statefilter( $filter_state='' ) + { + $state[] = JHTML::_('select.option', '', '- '. JText::_( 'Select State' ) .' -' ); + $state[] = JHTML::_('select.option', 'P', JText::_( 'Published' ) ); + $state[] = JHTML::_('select.option', 'U', JText::_( 'Unpublished' ) ); + $state[] = JHTML::_('select.option', 'R', JText::_( 'Reported' ) ); + + return JHTML::_('select.genericlist', $state, 'filter_state', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_state ); + } + + /** + * Select list of weblink states + */ + function statelist( $name, $active = NULL, $javascript = NULL ) + { + $state[] = JHTML::_('select.option', 1, JText::_( 'Published' ) ); + $state[] = JHTML::_('select.option', 0, JText::_( 'Unpublished' ) ); + $state[] = JHTML::_('select.option', -1, JText::_( 'Reported' ) ); + + return JHTML::_('select.genericlist', $state, $name, 'class="inputbox" size="1"'. $javascript, 'value', 'text', $active ); + } +} diff --git a/administrator/components/com_weblinks/config.xml b/administrator/components/com_weblinks/config.xml index 81f9574f96c60..66af1488853a9 100644 --- a/administrator/components/com_weblinks/config.xml +++ b/administrator/components/com_weblinks/config.xml @@ -1,6 +1,7 @@ + - + @@ -15,20 +16,36 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/administrator/components/com_weblinks/controller.php b/administrator/components/com_weblinks/controller.php index a41b5b5994c19..eb476b2391423 100644 --- a/administrator/components/com_weblinks/controller.php +++ b/administrator/components/com_weblinks/controller.php @@ -37,9 +37,12 @@ function __construct($config = array()) function display( ) { + $app =& JFactory::getApplication(); + $user =& JFactory::getUser(); + switch($this->getTask()) { - case 'add' : + case 'add': { JRequest::setVar( 'hidemainmenu', 1 ); JRequest::setVar( 'layout', 'form' ); @@ -50,7 +53,7 @@ function display( ) $model = $this->getModel('weblink'); $model->checkout(); } break; - case 'edit' : + case 'edit': { JRequest::setVar( 'hidemainmenu', 1 ); JRequest::setVar( 'layout', 'form' ); @@ -59,6 +62,11 @@ function display( ) // Checkout the weblink $model = $this->getModel('weblink'); + // fail if checked out not by 'me' + if ($model->isCheckedOut( $user->get('id') )) { + $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The weblink' ), $weblink->title ); + $app->redirect( 'index.php?option=com_weblinks', $msg ); + } $model->checkout(); } break; } @@ -151,6 +159,26 @@ function unpublish() $this->setRedirect( 'index.php?option=com_weblinks' ); } + function report() + { + // Check for request forgeries + JRequest::checkToken() or jexit( 'Invalid Token' ); + + $cid = JRequest::getVar( 'cid', array(), 'post', 'array' ); + JArrayHelper::toInteger($cid); + + if (count( $cid ) < 1) { + JError::raiseError(500, JText::_( 'Select an item to report' ) ); + } + + $model = $this->getModel('weblink'); + if(!$model->report($cid, 0)) { + echo "\n"; + } + + $this->setRedirect( 'index.php?option=com_weblinks' ); + } + function cancel() { // Check for request forgeries diff --git a/administrator/components/com_weblinks/elements/index.html b/administrator/components/com_weblinks/elements/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/administrator/components/com_weblinks/elements/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/administrator/components/com_weblinks/elements/snapshotsource.php b/administrator/components/com_weblinks/elements/snapshotsource.php new file mode 100644 index 0000000000000..a15fd8a2fb927 --- /dev/null +++ b/administrator/components/com_weblinks/elements/snapshotsource.php @@ -0,0 +1,34 @@ +getData(); + return JHTML::_('select.genericlist', $sites, ''.$control_name.'['.$name.']', 'class="inputbox"', 'name', 'name', $value, $control_name.$name ); + } +} \ No newline at end of file diff --git a/administrator/components/com_weblinks/index.html b/administrator/components/com_weblinks/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_weblinks/index.html +++ b/administrator/components/com_weblinks/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_weblinks/models/index.html b/administrator/components/com_weblinks/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_weblinks/models/index.html +++ b/administrator/components/com_weblinks/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_weblinks/models/snapshotsources.php b/administrator/components/com_weblinks/models/snapshotsources.php new file mode 100644 index 0000000000000..3a406b9385ee5 --- /dev/null +++ b/administrator/components/com_weblinks/models/snapshotsources.php @@ -0,0 +1,164 @@ + 'snapshotsources')); + } + + /** + * Method to get a currency + */ + function &getData() + { + // Load the rates data + if (!$this->_loadData()) + $this->_initData(); + + return $this->_data; + } + + /** + * Method to load snapshots data + * + * @access private + * @return boolean True on success + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (!$this->_data) + { + $options = array('lite' => '1'); + $xmlDoc = & JFactory::getXMLparser('dom', $options); + if ( $xmlDoc == false ) { + $this->setError(JText::_('Error: Cannot create XML doc')); + return false; + } + + $content = $xmlDoc->getTextFromFile(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_weblinks'.DS.'models'.DS.'snapshotsources.xml'); + if (!$content) { + $this->setError(JText::_('Error: Cannot load document')); + return false; + } + + $status = $xmlDoc->parseXML($content); + if ( $status == false ) { + $this->setError(JText::_('Error: Cannot parse XML doc')); + return false; + } + + $config = &$xmlDoc->documentElement; + if ($config->nodeName != 'config') { + $this->setError(JText::_('Error: Root incorrect')); + return false; + } + + $sitesNode = &$config->firstChild; + if ($sitesNode->nodeName != 'sites') { + $this->setError(JText::_('Error: Sites incorrect')); + return false; + } + + $sites = array(); + $siteNode = & $sitesNode->firstChild; + while ($siteNode) { + if ($siteNode->nodeName != 'site') { + $this->setError(JText::_('Error: Invalid site format')); + return false; + } + $siteInfo = & $siteNode->attributes; + $site = new stdClass(); + $site->name = $siteInfo['name']; + $siteItem = & $siteNode->firstChild; + while ($siteItem) { + switch ($siteItem->nodeName) { + case 'url': + $site->url = $siteItem->firstChild->nodeValue; + break; + case 'website': + $site->website = $siteItem->firstChild->nodeValue; + break; + case 'website-url': + $site->website_url = $siteItem->firstChild->nodeValue; + break; + case 'pic': + $site->pic = $siteItem->firstChild->nodeValue; + break; + case 'submit': + $site->submit = $siteItem->firstChild->nodeValue; + break; + case 'valid': + $site->valid = $siteItem->firstChild->nodeValue; + break; + default: + $this->setError(JText::_('Error: Invalid site parameter')); + return false; + break; + } + $siteItem = & $siteItem->nextSibling; + } + $sites[] = $site; + $siteNode = & $siteNode->nextSibling; + } + + $this->_data = $sites; + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the currency data + * + * @access private + * @return boolean True on success + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $this->_data = null; + return (boolean) $this->_data; + } + return true; + } +} \ No newline at end of file diff --git a/administrator/components/com_weblinks/models/snapshotsources.xml b/administrator/components/com_weblinks/models/snapshotsources.xml new file mode 100644 index 0000000000000..0cf569b89aa3c --- /dev/null +++ b/administrator/components/com_weblinks/models/snapshotsources.xml @@ -0,0 +1,93 @@ + + + + + http://open.thumbshots.org/image.pxf?url=%u + www.thumbshot.org + http://www.thumbshots.org/freethumbshots.pxf + Free thumbnail preview by Thumbshots.org + + + + + http://www.thumbshots.de/cgi-bin/show.cgi?url=%u + www.thumbshots.de + http://www.thumbshots.de/ + Free thumbnail preview by Thumbshot.de + http://www.thumbshot.de/cgi-bin/update.cgi?url=% + Bilder Update + + + http://webdesignbook.net/snapper.php?w=%w&h=%h&url=%u + webdesignbook.net + http://webdesignbook.net/ + + http://webdesignbook.net/snapper.php?w=%w&h=%h&url=%u + CREATOR: gd-jpeg + + + http://img.simpleapi.net/small/%u + www.simpleapi.net + http://www.simpleapi.net + + http://www.simpleapi.net/%u + SimpleAPI + + + http://www.m-software.de/screenshot/Screenshot.png?scale=6&width=%w&height=%h&url=%u + www.m-software.de + http://www.m-software.de + Free thumbnail preview by M-Software.de + http://www.m-software.de/screenshot/Screenshot.png?scale=6&width=%w&height=%h&url=%u + PNG + + + http://www.artviper.net/screenshots/screener.php?&frameborder=5&q=70&w=%w&h=%h&sdx=1024&sdy=768&url=%u + www.artviper.net + http://www.artviper.net/tools.php + Thumbnails by ArtViper.net + http://www.artviper.net/screenshots/screener.php?&frameborder=5&q=70&w=120&h=90&sdx=1024&sdy=768&forceUpdate=1&url=%u + CREATOR + + + http://www.thumbzor.com/tel.php?url=%u + www.thumbzor.com + http://www.thumbzor.com/ + Free thumbnail preview by Thumbzor.com + http://www.thumbzor.com/reactualise.php?&action=reactualise&url=%u + Nous avons bien pris en compte votre demande + + + http://www.toolbarn.com/thumbs/%u + www.toolbarn.com + http://www.toolbarn.com/web-tools/webpage-thumbnail/ + + http://www.toolbarn.com/web-tools/webpage-thumbnail/?url=%u + + + + http://www.websitethumbnails.net/view.php?url=%u + www.websitethumbnails.net + http://www.websitethumbnails.net/ + + http://www.websitethumbnails.net/?add=%u + Thanks! We will add + + + http://image.picoshot.com/thumbnail.php?url=%u + picoshot.com + http://picoshot.com/ + + http://picoshot.com/update_reply.php?domain=%u + Thank You. The URL has been added + + + http://www.webseitentuning.de/bild/klein/%u + www.webseitentuning.de + http://www.webseitentuning.de/ + + http://www.webseitentuning.de/preview.php?submitButtonName=Screenshot%32erstellen&url=%u + Thumbshot von %u + + + diff --git a/administrator/components/com_weblinks/models/weblink.php b/administrator/components/com_weblinks/models/weblink.php index 8525748699238..afe636dba54da 100644 --- a/administrator/components/com_weblinks/models/weblink.php +++ b/administrator/components/com_weblinks/models/weblink.php @@ -2,7 +2,7 @@ /** * @version $Id$ * @package Joomla - * @subpackage Content + * @subpackage Weblinks * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant to the @@ -108,13 +108,14 @@ function &getData() */ function isCheckedOut( $uid=0 ) { - if ($this->_loadData()) + if ($this->_id) { - if ($uid) { - return ($this->_data->checked_out && $this->_data->checked_out != $uid); - } else { - return $this->_data->checked_out; + $weblink = & $this->getTable(); + if (!$weblink->load($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; } + return $weblink->isCheckedOut($uid); } } @@ -252,7 +253,7 @@ function publish($cid = array(), $publish = 1) $cids = implode( ',', $cid ); $query = 'UPDATE #__weblinks' - . ' SET published = '.(int) $publish + . ' SET state = '.(int) $publish . ' WHERE id IN ( '.$cids.' )' . ' AND ( checked_out = 0 OR ( checked_out = '.(int) $user->get('id').' ) )' ; @@ -266,6 +267,36 @@ function publish($cid = array(), $publish = 1) return true; } + /** + * Method to report a weblink + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function report($cid = array(), $report = -1) + { + $user =& JFactory::getUser(); + + if (count( $cid )) + { + JArrayHelper::toInteger($cid); + $cids = implode( ',', $cid ); + + $query = 'UPDATE #__weblinks' + . ' SET state = '.(int) $report + . ' WHERE id IN ( '.$cids.' )' + ; + $this->_db->setQuery( $query ); + if (!$this->_db->query()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + } + + return true; + } + /** * Method to move a weblink * @@ -364,24 +395,24 @@ function _initData() if (empty($this->_data)) { $weblink = new stdClass(); - $weblink->id = 0; + $weblink->id = 0; $weblink->catid = 0; $weblink->sid = 0; $weblink->title = null; - $weblink->alias = null; + $weblink->alias = null; $weblink->url = null; - $weblink->description = null; + $weblink->description = null; $weblink->date = null; $weblink->hits = 0; - $weblink->published = 0; - $weblink->checked_out = 0; + $weblink->state = 0; + $weblink->checked_out = 0; $weblink->checked_out_time = 0; $weblink->ordering = 0; $weblink->archived = 0; $weblink->approved = 0; - $weblink->params = null; + $weblink->params = null; $weblink->category = null; - $this->_data = $weblink; + $this->_data = $weblink; return (boolean) $this->_data; } return true; diff --git a/administrator/components/com_weblinks/models/weblink.xml b/administrator/components/com_weblinks/models/weblink.xml index 4102b32058a2e..0685a1ac51c8a 100644 --- a/administrator/components/com_weblinks/models/weblink.xml +++ b/administrator/components/com_weblinks/models/weblink.xml @@ -1,8 +1,7 @@ - - + diff --git a/administrator/components/com_weblinks/models/weblinks.php b/administrator/components/com_weblinks/models/weblinks.php index a024b874a5cdd..e862eee1bd4c5 100644 --- a/administrator/components/com_weblinks/models/weblinks.php +++ b/administrator/components/com_weblinks/models/weblinks.php @@ -47,6 +47,13 @@ class WeblinksModelWeblinks extends JModel */ var $_pagination = null; + /** + * Filter object + * + * @var object + */ + var $_filter = null; + /** * Constructor * @@ -67,6 +74,14 @@ function __construct() $this->setState('limit', $limit); $this->setState('limitstart', $limitstart); + + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'a.ordering', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $filter->state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); + $filter->catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' ); + $filter->search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $this->_filter = $filter; } /** @@ -123,6 +138,17 @@ function getPagination() return $this->_pagination; } + /** + * Method to get filter object for the weblinks + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + function _buildQuery() { // Get the WHERE and ORDER BY clauses for the query @@ -142,15 +168,10 @@ function _buildQuery() function _buildContentOrderBy() { - global $mainframe, $option; - - $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'a.ordering', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); - - if ($filter_order == 'a.ordering'){ - $orderby = ' ORDER BY category, a.ordering '.$filter_order_Dir; + if ($this->_filter->order == 'a.ordering'){ + $orderby = ' ORDER BY category, a.ordering '.$this->_filter->order_Dir; } else { - $orderby = ' ORDER BY '.$filter_order.' '.$filter_order_Dir.' , category, a.ordering '; + $orderby = ' ORDER BY '.$this->_filter->order.' '.$this->_filter->order_Dir.' , category, a.ordering '; } return $orderby; @@ -158,28 +179,23 @@ function _buildContentOrderBy() function _buildContentWhere() { - global $mainframe, $option; - $db =& JFactory::getDBO(); - $filter_state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); - $filter_catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' ); - $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'a.ordering', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); - $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); - $search = JString::strtolower( $search ); + $search = JString::strtolower( $this->_filter->search ); $where = array(); - if ($filter_catid > 0) { - $where[] = 'a.catid = '.(int) $filter_catid; + if ($this->_filter->catid > 0) { + $where[] = 'a.catid = '.(int) $this->_filter->catid; } if ($search) { $where[] = 'LOWER(a.title) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); } - if ( $filter_state ) { - if ( $filter_state == 'P' ) { - $where[] = 'a.published = 1'; - } else if ($filter_state == 'U' ) { - $where[] = 'a.published = 0'; + if ( $this->_filter->state ) { + if ( $this->_filter->state == 'P' ) { + $where[] = 'a.state = 1'; + } else if ($this->_filter->state == 'U' ) { + $where[] = 'a.state = 0'; + } else if ($this->_filter->state == 'R' ) { + $where[] = 'a.state = -1'; } } diff --git a/administrator/components/com_weblinks/tables/index.html b/administrator/components/com_weblinks/tables/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_weblinks/tables/index.html +++ b/administrator/components/com_weblinks/tables/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_weblinks/tables/weblink.php b/administrator/components/com_weblinks/tables/weblink.php index 29d91d39c675e..7f7772c3a7377 100644 --- a/administrator/components/com_weblinks/tables/weblink.php +++ b/administrator/components/com_weblinks/tables/weblink.php @@ -74,7 +74,7 @@ class TableWeblink extends JTable /** * @var int */ - var $published = null; + var $state = null; /** * @var boolean diff --git a/administrator/components/com_weblinks/views/index.html b/administrator/components/com_weblinks/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_weblinks/views/index.html +++ b/administrator/components/com_weblinks/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_weblinks/views/weblink/index.html b/administrator/components/com_weblinks/views/weblink/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_weblinks/views/weblink/index.html +++ b/administrator/components/com_weblinks/views/weblink/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_weblinks/views/weblink/tmpl/form.php b/administrator/components/com_weblinks/views/weblink/tmpl/form.php index 35b16a48a7fec..96bf2b6dac240 100644 --- a/administrator/components/com_weblinks/views/weblink/tmpl/form.php +++ b/administrator/components/com_weblinks/views/weblink/tmpl/form.php @@ -45,7 +45,7 @@ function submitbutton(pressbutton) { } -
    +
    @@ -73,10 +73,10 @@ function submitbutton(pressbutton) {
    - : + : - lists['published']; ?> + lists['state']; ?>
    @@ -41,23 +30,23 @@ - @@ -78,9 +67,9 @@ $link = JRoute::_( 'index.php?option=com_weblinks&view=weblink&task=edit&cid[]='. $row->id ); $checked = JHTML::_('grid.checkedout', $row, $i ); - $published = JHTML::_('grid.published', $row, $i ); + $state = JHTML::_('weblink.state', $row, $i ); - $ordering = ($this->lists['order'] == 'a.ordering'); + $ordering = ($this->filter->order == 'a.ordering'); $row->cat_link = JRoute::_( 'index.php?option=com_categories§ion=com_weblinks&task=edit&type=other&cid[]='. $row->catid ); ?> @@ -105,7 +94,7 @@ ?> ']; -var cmThemeOfficeMainHSplit = [_cmNoAction, '']; -var cmThemeOfficeMainVSplit = [_cmNoAction, ' ']; diff --git a/administrator/includes/js/ThemeOffice/theme_rtl.js b/administrator/includes/js/ThemeOffice/theme_rtl.js deleted file mode 100644 index c7aea987d3ca0..0000000000000 --- a/administrator/includes/js/ThemeOffice/theme_rtl.js +++ /dev/null @@ -1,45 +0,0 @@ - -// directory of where all the images are -var cmThemeOfficeBase = '../includes/js/ThemeOffice/'; - -var cmThemeOffice = -{ - // main menu display attributes - // - // Note. When the menu bar is horizontal, - // mainFolderLeft and mainFolderRight are - // put in . When the menu - // bar is vertical, they would be put in - // a separate TD cell. - - // HTML code to the left of the folder item - mainFolderLeft: ' ', - // HTML code to the right of the folder item - mainFolderRight: ' ', - // HTML code to the left of the regular item - mainItemLeft: ' ', - // HTML code to the right of the regular item - mainItemRight: ' ', - - // sub menu display attributes - - // 0, HTML code to the left of the folder item - folderLeft: '', - // 1, HTML code to the right of the folder item - folderRight: '', - // 2, HTML code to the left of the regular item - itemLeft: '', - // 3, HTML code to the right of the regular item - itemRight: '', - // 4, cell spacing for main menu - mainSpacing: 0, - // 5, cell spacing for sub menus - subSpacing: 0, - // 6, auto dispear time for submenus in milli-seconds - delay: 500 -}; - -// for horizontal menu split -var cmThemeOfficeHSplit = [_cmNoAction, '']; -var cmThemeOfficeMainHSplit = [_cmNoAction, '']; -var cmThemeOfficeMainVSplit = [_cmNoAction, ' ']; diff --git a/administrator/includes/js/index.html b/administrator/includes/js/index.html deleted file mode 100644 index 0e44bd0ebe788..0000000000000 --- a/administrator/includes/js/index.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/administrator/components/com_config/toolbar.config.php b/administrator/includes/menu.php similarity index 60% rename from administrator/components/com_config/toolbar.config.php rename to administrator/includes/menu.php index 1dfc15ce9cbdd..a4d0aefe7f42e 100644 --- a/administrator/components/com_config/toolbar.config.php +++ b/administrator/includes/menu.php @@ -1,25 +1,28 @@ - \ No newline at end of file diff --git a/administrator/includes/pcl/pclerror.lib.php b/administrator/includes/pcl/pclerror.lib.php deleted file mode 100644 index 925e4eb92fe91..0000000000000 --- a/administrator/includes/pcl/pclerror.lib.php +++ /dev/null @@ -1,138 +0,0 @@ -"; - $v_message .= "

    PclError Library has detected a fatal error on file '$p_file', line $p_line

    "; - $v_message .= "

    $p_error_string

    "; - $v_message .= ""; - die($v_message); - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclErrorReset() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function PclErrorReset() - { - global $g_pcl_error_string; - global $g_pcl_error_code; - - $g_pcl_error_code = 1; - $g_pcl_error_string = ""; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclErrorCode() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function PclErrorCode() - { - global $g_pcl_error_string; - global $g_pcl_error_code; - - return($g_pcl_error_code); - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclErrorString() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function PclErrorString() - { - global $g_pcl_error_string; - global $g_pcl_error_code; - - return($g_pcl_error_string." [code $g_pcl_error_code]"); - } - // -------------------------------------------------------------------------------- - - -// ----- End of double include look -} -?> \ No newline at end of file diff --git a/administrator/includes/pcl/pcltar.lib.php b/administrator/includes/pcl/pcltar.lib.php deleted file mode 100644 index 755b089575136..0000000000000 --- a/administrator/includes/pcl/pcltar.lib.php +++ /dev/null @@ -1,3570 +0,0 @@ -"; - // -------------------------------------------------------------------------------- - function PclTarList($p_tarname, $p_mode="") - { - TrFctStart(__FILE__, __LINE__, "PclTarList", "tar=$p_tarname, mode='$p_mode'"); - $v_result=1; - - // ----- Extract the tar format from the extension - if (($p_mode == "") || (($p_mode!="tar") && ($p_mode!="tgz"))) - { - if (($p_mode = PclTarHandleExtension($p_tarname)) == "") - { - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - } - - // ----- Call the extracting fct - $p_list = array(); - if (($v_result = PclTarHandleExtract($p_tarname, 0, $p_list, "list", "", $p_mode, "")) != 1) - { - unset($p_list); - TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); - return(0); - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $p_list); - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarExtract() - // Description : - // Extract all the files present in the archive $p_tarname, in the directory - // $p_path. The relative path of the archived files are keep and become - // relative to $p_path. - // If a file with the same name already exists it will be replaced. - // If the path to the file does not exist, it will be created. - // Depending on the $p_tarname extension (.tar, .tar.gz or .tgz) the - // function will determine the type of the archive. - // Parameters : - // $p_tarname : Name of an existing tar file. - // $p_path : Path where the files will be extracted. The files will use - // their memorized path from $p_path. - // If $p_path is "", files will be extracted in "./". - // $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_path and $p_remove_path are commulative. - // $p_mode : 'tar' or 'tgz', if not set, will be determined by $p_tarname extension - // Return Values : - // Same as PclTarList() - // -------------------------------------------------------------------------------- - function PclTarExtract($p_tarname, $p_path="./", $p_remove_path="", $p_mode="") - { - TrFctStart(__FILE__, __LINE__, "PclTarExtract", "tar='$p_tarname', path='$p_path', remove_path='$p_remove_path', mode='$p_mode'"); - $v_result=1; - - // ----- Extract the tar format from the extension - if (($p_mode == "") || (($p_mode!="tar") && ($p_mode!="tgz"))) - { - if (($p_mode = PclTarHandleExtension($p_tarname)) == "") - { - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - } - - // ----- Call the extracting fct - if (($v_result = PclTarHandleExtract($p_tarname, 0, $p_list, "complete", $p_path, $p_mode, $p_remove_path)) != 1) - { - TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); - return(0); - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $p_list); - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarExtractList() - // Description : - // Extract the files present in the archive $p_tarname and specified in - // $p_filelist, in the directory - // $p_path. The relative path of the archived files are keep and become - // relative to $p_path. - // If a directory is sp�cified in the list, all the files from this directory - // will be extracted. - // If a file with the same name already exists it will be replaced. - // If the path to the file does not exist, it will be created. - // Depending on the $p_tarname extension (.tar, .tar.gz or .tgz) the - // function will determine the type of the archive. - // Parameters : - // $p_tarname : Name of an existing tar file - // $p_filelist : An array containing file or directory names, or - // a string containing one filename or directory name, or - // a string containing a list of filenames and/or directory - // names separated by spaces. - // $p_path : Path where the files will be extracted. The files will use - // their memorized path from $p_path. - // If $p_path is "", files will be extracted in "./". - // $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_path and $p_remove_path are commulative. - // $p_mode : 'tar' or 'tgz', if not set, will be determined by $p_tarname extension - // Return Values : - // Same as PclTarList() - // -------------------------------------------------------------------------------- - function PclTarExtractList($p_tarname, $p_filelist, $p_path="./", $p_remove_path="", $p_mode="") - { - TrFctStart(__FILE__, __LINE__, "PclTarExtractList", "tar=$p_tarname, list, path=$p_path, remove_path='$p_remove_path', mode='$p_mode'"); - $v_result=1; - - // ----- Extract the tar format from the extension - if (($p_mode == "") || (($p_mode!="tar") && ($p_mode!="tgz"))) - { - if (($p_mode = PclTarHandleExtension($p_tarname)) == "") - { - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - } - - // ----- Look if the $p_filelist is really an array - if (is_array($p_filelist)) - { - // ----- Call the extracting fct - if (($v_result = PclTarHandleExtract($p_tarname, $p_filelist, $p_list, "partial", $p_path, $v_tar_mode, $p_remove_path)) != 1) - { - TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); - return(0); - } - } - - // ----- Look if the $p_filelist is a string - else if (is_string($p_filelist)) - { - // ----- Create a list with the elements from the string - $v_list = explode(" ", $p_filelist); - - // ----- Call the extracting fct - if (($v_result = PclTarHandleExtract($p_tarname, $v_list, $p_list, "partial", $p_path, $v_tar_mode, $p_remove_path)) != 1) - { - TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); - return(0); - } - } - - // ----- Invalid variable - else - { - // ----- Error log - PclErrorLog(-3, "Invalid variable type p_filelist"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $p_list); - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarExtractIndex() - // Description : - // Extract the files present in the archive $p_tarname and specified at - // the indexes in $p_index, in the directory - // $p_path. The relative path of the archived files are keep and become - // relative to $p_path. - // If a directory is specified in the list, the directory only is created. All - // the file stored in this archive for this directory - // are not extracted. - // If a file with the same name already exists it will be replaced. - // If the path to the file does not exist, it will be created. - // Depending on the $p_tarname extension (.tar, .tar.gz or .tgz) the - // function will determine the type of the archive. - // Parameters : - // $p_tarname : Name of an existing tar file - // $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 will be extracted. The files will use - // their memorized path from $p_path. - // If $p_path is "", files will be extracted in "./". - // $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_path and $p_remove_path are commulative. - // $p_mode : 'tar' or 'tgz', if not set, will be determined by $p_tarname extension - // Return Values : - // Same as PclTarList() - // -------------------------------------------------------------------------------- - function PclTarExtractIndex($p_tarname, $p_index, $p_path="./", $p_remove_path="", $p_mode="") - { - TrFctStart(__FILE__, __LINE__, "PclTarExtractIndex", "tar=$p_tarname, index='$p_index', path=$p_path, remove_path='$p_remove_path', mode='$p_mode'"); - $v_result=1; - - // ----- Extract the tar format from the extension - if (($p_mode == "") || (($p_mode!="tar") && ($p_mode!="tgz"))) - { - if (($p_mode = PclTarHandleExtension($p_tarname)) == "") - { - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - } - - // ----- Look if the $p_index is really an integer - if (is_integer($p_index)) - { - // ----- Call the extracting fct - if (($v_result = PclTarHandleExtractByIndexList($p_tarname, "$p_index", $p_list, $p_path, $p_remove_path, $v_tar_mode)) != 1) - { - TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); - return(0); - } - } - - // ----- Look if the $p_filelist is a string - else if (is_string($p_index)) - { - // ----- Call the extracting fct - if (($v_result = PclTarHandleExtractByIndexList($p_tarname, $p_index, $p_list, $p_path, $p_remove_path, $v_tar_mode)) != 1) - { - TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); - return(0); - } - } - - // ----- Invalid variable - else - { - // ----- Error log - PclErrorLog(-3, "Invalid variable type $p_index"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $p_list); - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarDelete() - // Description : - // This function deletes from the archive $p_tarname the files which are listed - // in $p_filelist. $p_filelist can be a string with file names separated by - // spaces, or an array containing the file names. - // Parameters : - // $p_tarname : Name of an existing tar file - // $p_filelist : An array or a string containing file names to remove from the - // archive. - // $p_mode : 'tar' or 'tgz', if not set, will be determined by $p_tarname extension - // Return Values : - // List of the files which are kept in the archive (same format as PclTarList()) - // -------------------------------------------------------------------------------- - function PclTarDelete($p_tarname, $p_filelist, $p_mode="") - { - TrFctStart(__FILE__, __LINE__, "PclTarDelete", "tar='$p_tarname', list='$p_filelist', mode='$p_mode'"); - $v_result=1; - - // ----- Extract the tar format from the extension - if (($p_mode == "") || (($p_mode!="tar") && ($p_mode!="tgz"))) - { - if (($p_mode = PclTarHandleExtension($p_tarname)) == "") - { - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - } - - // ----- Look if the $p_filelist is really an array - if (is_array($p_filelist)) - { - // ----- Call the extracting fct - if (($v_result = PclTarHandleDelete($p_tarname, $p_filelist, $p_list, $p_mode)) != 1) - { - TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); - return(0); - } - } - - // ----- Look if the $p_filelist is a string - else if (is_string($p_filelist)) - { - // ----- Create a list with the elements from the string - $v_list = explode(" ", $p_filelist); - - // ----- Call the extracting fct - if (($v_result = PclTarHandleDelete($p_tarname, $v_list, $p_list, $p_mode)) != 1) - { - TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); - return(0); - } - } - - // ----- Invalid variable - else - { - // ----- Error log - PclErrorLog(-3, "Invalid variable type p_filelist"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $p_list); - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarUpdate() - // Description : - // This function updates the files in $p_filelist which are already in the - // $p_tarname archive with an older last modified date. If the file does not - // exist, it is added at the end of the archive. - // Parameters : - // $p_tarname : Name of an existing tar file - // $p_filelist : An array or a string containing file names to update from the - // archive. - // $p_mode : 'tar' or 'tgz', if not set, will be determined by $p_tarname extension - // Return Values : - // List of the files contained in the archive. The field status contains - // "updated", "not_updated", "added" or "ok" for the files not concerned. - // -------------------------------------------------------------------------------- - function PclTarUpdate($p_tarname, $p_filelist, $p_mode="", $p_add_dir="", $p_remove_dir="") - { - TrFctStart(__FILE__, __LINE__, "PclTarUpdate", "tar='$p_tarname', list='$p_filelist', mode='$p_mode'"); - $v_result=1; - - // ----- Extract the tar format from the extension - if (($p_mode == "") || (($p_mode!="tar") && ($p_mode!="tgz"))) - { - if (($p_mode = PclTarHandleExtension($p_tarname)) == "") - { - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - } - - // ----- Look if the $p_filelist is really an array - if (is_array($p_filelist)) - { - // ----- Call the extracting fct - if (($v_result = PclTarHandleUpdate($p_tarname, $p_filelist, $p_list, $p_mode, $p_add_dir, $p_remove_dir)) != 1) - { - TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); - return(0); - } - } - - // ----- Look if the $p_filelist is a string - else if (is_string($p_filelist)) - { - // ----- Create a list with the elements from the string - $v_list = explode(" ", $p_filelist); - - // ----- Call the extracting fct - if (($v_result = PclTarHandleUpdate($p_tarname, $v_list, $p_list, $p_mode, $p_add_dir, $p_remove_dir)) != 1) - { - TrFctEnd(__FILE__, __LINE__, 0, PclErrorString()); - return(0); - } - } - - // ----- Invalid variable - else - { - // ----- Error log - PclErrorLog(-3, "Invalid variable type p_filelist"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $p_list); - return $p_list; - } - // -------------------------------------------------------------------------------- - - - // -------------------------------------------------------------------------------- - // Function : PclTarMerge() - // Description : - // This function add the content of $p_tarname_add at the end of $p_tarname. - // Parameters : - // $p_tarname : Name of an existing tar file - // $p_tarname_add : Name of an existing tar file taht will be added at the end - // of $p_tarname. - // $p_mode : 'tar' or 'tgz', if not set, will be determined by $p_tarname extension - // $p_mode_add : 'tar' or 'tgz', if not set, will be determined by $p_tarname_add - // extension - // Return Values : - // List of the files contained in the archive. The field status contains - // "updated", "not_updated", "added" or "ok" for the files not concerned. - // -------------------------------------------------------------------------------- - function PclTarMerge($p_tarname, $p_tarname_add, $p_mode="", $p_mode_add="") - { - TrFctStart(__FILE__, __LINE__, "PclTarMerge", "tar='$p_tarname', tar_add='$p_tarname_add', mode='$p_mode', mode_add='$p_mode_add'"); - $v_result=1; - - // ----- Check the parameters - if (($p_tarname == "") || ($p_tarname_add == "")) - { - // ----- Error log - PclErrorLog(-3, "Invalid empty archive name"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Extract the tar format from the extension - if (($p_mode == "") || (($p_mode!="tar") && ($p_mode!="tgz"))) - { - if (($p_mode = PclTarHandleExtension($p_tarname)) == "") - { - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - } - if (($p_mode_add == "") || (($p_mode_add!="tar") && ($p_mode_add!="tgz"))) - { - if (($p_mode_add = PclTarHandleExtension($p_tarname_add)) == "") - { - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return 0; - } - } - - // ----- Clear filecache - clearstatcache(); - - // ----- Check the file size - if ((!is_file($p_tarname)) || - (((($v_size = filesize($p_tarname)) % 512) != 0) && ($p_mode=="tar"))) - { - // ----- Error log - if (!is_file($p_tarname)) - PclErrorLog(-4, "Archive '$p_tarname' does not exist"); - else - PclErrorLog(-6, "Archive '$p_tarname' has invalid size ".filesize($p_tarname)."(not a 512 block multiple)"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - if ((!is_file($p_tarname_add)) || - (((($v_size_add = filesize($p_tarname_add)) % 512) != 0) && ($p_mode_add=="tar"))) - { - // ----- Error log - if (!is_file($p_tarname_add)) - PclErrorLog(-4, "Archive '$p_tarname_add' does not exist"); - else - PclErrorLog(-6, "Archive '$p_tarname_add' has invalid size ".filesize($p_tarname_add)."(not a 512 block multiple)"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Look for compressed archive - if ($p_mode == "tgz") - { - // ----- Open the file in read mode - if (($p_tar = @gzopen($p_tarname, "rb")) == 0) - { - // ----- Error log - PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Open a temporary file in write mode - $v_temp_tarname = uniqid("pcltar-").".tmp"; - TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); - if (($v_temp_tar = @gzopen($v_temp_tarname, "wb")) == 0) - { - // ----- Close tar file - gzclose($p_tar); - - // ----- Error log - PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Read the first 512 bytes block - $v_buffer = gzread($p_tar, 512); - - // ----- Read the following blocks but not the last one - if (!gzeof($p_tar)) - { - TrFctMessage(__FILE__, __LINE__, 3, "More than one 512 block file"); - $i=1; - - // ----- Read new 512 block and write the already read - do{ - // ----- Write the already read block - $v_binary_data = pack("a512", "$v_buffer"); - gzputs($v_temp_tar, $v_binary_data); - - $i++; - TrFctMessage(__FILE__, __LINE__, 3, "Reading block $i"); - - // ----- Read next block - $v_buffer = gzread($p_tar, 512); - - } while (!gzeof($p_tar)); - - TrFctMessage(__FILE__, __LINE__, 3, "$i 512 bytes blocks"); - } - } - - // ----- Look for uncompressed tar file - else if ($p_mode=="tar") - { - // ----- Open the tar file - if (($p_tar = fopen($p_tarname, "r+b")) == 0) - { - // ----- Error log - PclErrorLog(-1, "Unable to open file '$p_tarname' in binary write mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Go to the beginning of last block - TrFctMessage(__FILE__, __LINE__, 4, "Position before :".($p_mode=="tar"?ftell($p_tar):gztell($p_tar))); - fseek($p_tar, $v_size-512); - TrFctMessage(__FILE__, __LINE__, 4, "Position after :".($p_mode=="tar"?ftell($p_tar):gztell($p_tar))); - } - - // ----- Look for unknown type - else - { - // ----- Error log - PclErrorLog(-3, "Invalid tar mode $p_mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Look for type of archive to add - if ($p_mode_add == "tgz") - { - TrFctMessage(__FILE__, __LINE__, 4, "Opening file $p_tarname_add"); - - // ----- Open the file in read mode - if (($p_tar_add = @gzopen($p_tarname_add, "rb")) == 0) - { - // ----- Error log - PclErrorLog(-2, "Unable to open file '$p_tarname_add' in binary read mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Read the first 512 bytes block - $v_buffer = gzread($p_tar_add, 512); - - // ----- Read the following blocks but not the last one - if (!gzeof($p_tar_add)) - { - TrFctMessage(__FILE__, __LINE__, 3, "More than one 512 block file"); - $i=1; - - // ----- Read new 512 block and write the already read - do{ - // ----- Write the already read block - $v_binary_data = pack("a512", "$v_buffer"); - if ($p_mode=="tar") - fputs($p_tar, $v_binary_data); - else - gzputs($v_temp_tar, $v_binary_data); - - $i++; - TrFctMessage(__FILE__, __LINE__, 3, "Reading block $i"); - - // ----- Read next block - $v_buffer = gzread($p_tar_add, 512); - - } while (!gzeof($p_tar_add)); - - TrFctMessage(__FILE__, __LINE__, 3, "$i 512 bytes blocks"); - } - - // ----- Close the files - gzclose($p_tar_add); - } - - // ----- Look for uncompressed tar file - else if ($p_mode=="tar") - { - // ----- Open the file in read mode - if (($p_tar_add = @fopen($p_tarname_add, "rb")) == 0) - { - // ----- Error log - PclErrorLog(-2, "Unable to open file '$p_tarname_add' in binary read mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Read the first 512 bytes block - $v_buffer = fread($p_tar_add, 512); - - // ----- Read the following blocks but not the last one - if (!feof($p_tar_add)) - { - TrFctMessage(__FILE__, __LINE__, 3, "More than one 512 block file"); - $i=1; - - // ----- Read new 512 block and write the already read - do{ - // ----- Write the already read block - $v_binary_data = pack("a512", "$v_buffer"); - if ($p_mode=="tar") - fputs($p_tar, $v_binary_data); - else - gzputs($v_temp_tar, $v_binary_data); - - $i++; - TrFctMessage(__FILE__, __LINE__, 3, "Reading block $i"); - - // ----- Read next block - $v_buffer = fread($p_tar_add, 512); - - } while (!feof($p_tar_add)); - - TrFctMessage(__FILE__, __LINE__, 3, "$i 512 bytes blocks"); - } - - // ----- Close the files - fclose($p_tar_add); - } - - // ----- Call the footer of the tar archive - $v_result = PclTarHandleFooter($p_tar, $p_mode); - - // ----- Look for closing compressed archive - if ($p_mode == "tgz") - { - // ----- Close the files - gzclose($p_tar); - gzclose($v_temp_tar); - - // ----- Unlink tar file - if (!@unlink($p_tarname)) - { - // ----- Error log - PclErrorLog(-11, "Error while deleting archive name $p_tarname"); - } - - // ----- Rename tar file - if (!@rename($v_temp_tarname, $p_tarname)) - { - // ----- Error log - PclErrorLog(-12, "Error while renaming temporary file $v_temp_tarname to archive name $p_tarname"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - - // ----- Look for closing uncompressed tar file - else if ($p_mode=="tar") - { - // ----- Close the tarfile - fclose($p_tar); - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - -// -------------------------------------------------------------------------------- -// ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS ***** -// ***** ***** -// ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY ***** -// -------------------------------------------------------------------------------- - - - - // -------------------------------------------------------------------------------- - // Function : PclTarHandleCreate() - // Description : - // Parameters : - // $p_tarname : Name of the tar file - // $p_list : An array containing the file or directory names to add in the tar - // $p_mode : "tar" for normal tar archive, "tgz" for gzipped tar archive - // Return Values : - // -------------------------------------------------------------------------------- - function PclTarHandleCreate($p_tarname, $p_list, $p_mode, $p_add_dir="", $p_remove_dir="") - { - TrFctStart(__FILE__, __LINE__, "PclTarHandleCreate", "tar=$p_tarname, list, mode=$p_mode, add_dir='$p_add_dir', remove_dir='$p_remove_dir'"); - $v_result=1; - $v_list_detail = array(); - - // ----- Check the parameters - if (($p_tarname == "") || (($p_mode != "tar") && ($p_mode != "tgz"))) - { - // ----- Error log - if ($p_tarname == "") - PclErrorLog(-3, "Invalid empty archive name"); - else - PclErrorLog(-3, "Unknown mode '$p_mode'"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Look for tar file - if ($p_mode == "tar") - { - // ----- Open the tar file - if (($p_tar = fopen($p_tarname, "wb")) == 0) - { - // ----- Error log - PclErrorLog(-1, "Unable to open file [$p_tarname] in binary write mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Call the adding fct inside the tar - if (($v_result = PclTarHandleAddList($p_tar, $p_list, $p_mode, $v_list_detail, $p_add_dir, $p_remove_dir)) == 1) - { - // ----- Call the footer of the tar archive - $v_result = PclTarHandleFooter($p_tar, $p_mode); - } - - // ----- Close the tarfile - fclose($p_tar); - } - // ----- Look for tgz file - else - { - // ----- Open the tar file - if (($p_tar = @gzopen($p_tarname, "wb")) == 0) - { - // ----- Error log - PclErrorLog(-1, "Unable to open file [$p_tarname] in binary write mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Call the adding fct inside the tar - if (($v_result = PclTarHandleAddList($p_tar, $p_list, $p_mode, $v_list_detail, $p_add_dir, $p_remove_dir)) == 1) - { - // ----- Call the footer of the tar archive - $v_result = PclTarHandleFooter($p_tar, $p_mode); - } - - // ----- Close the tarfile - gzclose($p_tar); - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarHandleAppend() - // Description : - // Parameters : - // $p_tarname : Name of the tar file - // $p_list : An array containing the file or directory names to add in the tar - // $p_mode : "tar" for normal tar archive, "tgz" for gzipped tar archive - // Return Values : - // -------------------------------------------------------------------------------- - function PclTarHandleAppend($p_tarname, $p_list, $p_mode, &$p_list_detail, $p_add_dir, $p_remove_dir) - { - TrFctStart(__FILE__, __LINE__, "PclTarHandleAppend", "tar=$p_tarname, list, mode=$p_mode"); - $v_result=1; - - // ----- Check the parameters - if ($p_tarname == "") - { - // ----- Error log - PclErrorLog(-3, "Invalid empty archive name"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - clearstatcache(); - - // ----- Check the file size - if ((!is_file($p_tarname)) || - (((($v_size = filesize($p_tarname)) % 512) != 0) && ($p_mode=="tar"))) - { - // ----- Error log - if (!is_file($p_tarname)) - PclErrorLog(-4, "Archive '$p_tarname' does not exist"); - else - PclErrorLog(-6, "Archive '$p_tarname' has invalid size ".filesize($p_tarname)."(not a 512 block multiple)"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Look for compressed archive - if ($p_mode == "tgz") - { - // ----- Open the file in read mode - if (($p_tar = @gzopen($p_tarname, "rb")) == 0) - { - // ----- Error log - PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Open a temporary file in write mode - $v_temp_tarname = uniqid("pcltar-").".tmp"; - TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); - if (($v_temp_tar = @gzopen($v_temp_tarname, "wb")) == 0) - { - // ----- Close tar file - gzclose($p_tar); - - // ----- Error log - PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Read the first 512 bytes block - $v_buffer = gzread($p_tar, 512); - - // ----- Read the following blocks but not the last one - if (!gzeof($p_tar)) - { - TrFctMessage(__FILE__, __LINE__, 3, "More than one 512 block file"); - $i=1; - - // ----- Read new 512 block and write the already read - do{ - // ----- Write the already read block - $v_binary_data = pack("a512", "$v_buffer"); - gzputs($v_temp_tar, $v_binary_data); - - $i++; - TrFctMessage(__FILE__, __LINE__, 3, "Reading block $i"); - - // ----- Read next block - $v_buffer = gzread($p_tar, 512); - - } while (!gzeof($p_tar)); - - TrFctMessage(__FILE__, __LINE__, 3, "$i 512 bytes blocks"); - } - - // ----- Call the adding fct inside the tar - if (($v_result = PclTarHandleAddList($v_temp_tar, $p_list, $p_mode, $p_list_detail, $p_add_dir, $p_remove_dir)) == 1) - { - // ----- Call the footer of the tar archive - $v_result = PclTarHandleFooter($v_temp_tar, $p_mode); - } - - // ----- Close the files - gzclose($p_tar); - gzclose($v_temp_tar); - - // ----- Unlink tar file - if (!@unlink($p_tarname)) - { - // ----- Error log - PclErrorLog(-11, "Error while deleting archive name $p_tarname"); - } - - // ----- Rename tar file - if (!@rename($v_temp_tarname, $p_tarname)) - { - // ----- Error log - PclErrorLog(-12, "Error while renaming temporary file $v_temp_tarname to archive name $p_tarname"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - - // ----- Look for uncompressed tar file - else if ($p_mode=="tar") - { - // ----- Open the tar file - if (($p_tar = fopen($p_tarname, "r+b")) == 0) - { - // ----- Error log - PclErrorLog(-1, "Unable to open file '$p_tarname' in binary write mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Go to the beginning of last block - TrFctMessage(__FILE__, __LINE__, 4, "Position before :".($p_mode=="tar"?ftell($p_tar):gztell($p_tar))); - fseek($p_tar, $v_size-512); - TrFctMessage(__FILE__, __LINE__, 4, "Position after :".($p_mode=="tar"?ftell($p_tar):gztell($p_tar))); - - // ----- Call the adding fct inside the tar - if (($v_result = PclTarHandleAddList($p_tar, $p_list, $p_mode, $p_list_detail, $p_add_dir, $p_remove_dir)) == 1) - { - // ----- Call the footer of the tar archive - $v_result = PclTarHandleFooter($p_tar, $p_mode); - } - - // ----- Close the tarfile - fclose($p_tar); - } - - // ----- Look for unknown type - else - { - // ----- Error log - PclErrorLog(-3, "Invalid tar mode $p_mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarHandleAddList() - // 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_tar : File descriptor of the tar archive - // $p_list : An array containing the file or directory names to add in the tar - // $p_mode : "tar" for normal tar archive, "tgz" for gzipped tar archive - // $p_list_detail : 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 PclTarHandleAddList($p_tar, $p_list, $p_mode, &$p_list_detail, $p_add_dir, $p_remove_dir) - { - TrFctStart(__FILE__, __LINE__, "PclTarHandleAddList", "tar='$p_tar', list, mode='$p_mode', add_dir='$p_add_dir', remove_dir='$p_remove_dir'"); - $v_result=1; - $v_header = array(); - - // ----- Recuperate the current number of elt in list - $v_nb = sizeof($p_list_detail); - - // ----- Check the parameters - if ($p_tar == 0) - { - // ----- Error log - PclErrorLog(-3, "Invalid file descriptor in file ".__FILE__.", line ".__LINE__); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Check the arguments - if (sizeof($p_list) == 0) - { - // ----- Error log - PclErrorLog(-3, "Invalid file list parameter (invalid or empty list)"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Loop on the files - for ($j=0; ($j 99) - { - // ----- Error log - PclErrorLog(-5, "File name is too long (max. 99) : '$p_filename'"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - TrFctMessage(__FILE__, __LINE__, 4, "File position before header =".($p_mode=="tar"?ftell($p_tar):gztell($p_tar))); - - // ----- Add the file - if (($v_result = PclTarHandleAddFile($p_tar, $p_filename, $p_mode, $v_header, $p_add_dir, $p_remove_dir)) != 1) - { - // ----- Return status - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - - // ----- Store the file infos - $p_list_detail[$v_nb++] = $v_header; - - // ----- Look for directory - if (is_dir($p_filename)) - { - TrFctMessage(__FILE__, __LINE__, 2, "$p_filename is a directory"); - - // ----- Look for path - if ($p_filename != ".") - $v_path = $p_filename."/"; - else - $v_path = ""; - - // ----- Read the directory for files and sub-directories - $p_hdir = opendir($p_filename); - $p_hitem = readdir($p_hdir); // '.' directory - $p_hitem = readdir($p_hdir); // '..' directory - while ($p_hitem = readdir($p_hdir)) - { - // ----- Look for a file - if (is_file($v_path.$p_hitem)) - { - TrFctMessage(__FILE__, __LINE__, 4, "Add the file '".$v_path.$p_hitem."'"); - - // ----- Add the file - if (($v_result = PclTarHandleAddFile($p_tar, $v_path.$p_hitem, $p_mode, $v_header, $p_add_dir, $p_remove_dir)) != 1) - { - // ----- Return status - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - - // ----- Store the file infos - $p_list_detail[$v_nb++] = $v_header; - } - - // ----- Recursive call to PclTarHandleAddFile() - else - { - TrFctMessage(__FILE__, __LINE__, 4, "'".$v_path.$p_hitem."' is a directory"); - - // ----- Need an array as parameter - $p_temp_list[0] = $v_path.$p_hitem; - $v_result = PclTarHandleAddList($p_tar, $p_temp_list, $p_mode, $p_list_detail, $p_add_dir, $p_remove_dir); - } - } - - // ----- Free memory for the recursive loop - unset($p_temp_list); - unset($p_hdir); - unset($p_hitem); - } - else - { - TrFctMessage(__FILE__, __LINE__, 4, "File position after blocks =".($p_mode=="tar"?ftell($p_tar):gztell($p_tar))); - } - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarHandleAddFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function PclTarHandleAddFile($p_tar, $p_filename, $p_mode, &$p_header, $p_add_dir, $p_remove_dir) - { - TrFctStart(__FILE__, __LINE__, "PclTarHandleAddFile", "tar='$p_tar', filename='$p_filename', p_mode='$p_mode', add_dir='$p_add_dir', remove_dir='$p_remove_dir'"); - $v_result=1; - - // ----- Check the parameters - if ($p_tar == 0) - { - // ----- Error log - PclErrorLog(-3, "Invalid file descriptor in file ".__FILE__.", line ".__LINE__); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Skip empty file names - if ($p_filename == "") - { - // ----- Error log - PclErrorLog(-3, "Invalid file list parameter (invalid or empty list)"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Calculate the stored filename - $v_stored_filename = $p_filename; - 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); - } - - if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir) - { - $v_stored_filename = substr($p_filename, strlen($p_remove_dir)); - TrFctMessage(__FILE__, __LINE__, 3, "Remove path '$p_remove_dir' in file '$p_filename' = '$v_stored_filename'"); - } - } - 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; - TrFctMessage(__FILE__, __LINE__, 3, "Add path '$p_add_dir' in file '$p_filename' = '$v_stored_filename'"); - } - - // ----- Check the path length - if (strlen($v_stored_filename) > 99) - { - // ----- Error log - PclErrorLog(-5, "Stored file name is too long (max. 99) : '$v_stored_filename'"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Look for a file - if (is_file($p_filename)) - { - // ----- Open the source file - if (($v_file = fopen($p_filename, "rb")) == 0) - { - // ----- Error log - PclErrorLog(-2, "Unable to open file '$p_filename' in binary read mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Call the header generation - if (($v_result = PclTarHandleHeader($p_tar, $p_filename, $p_mode, $p_header, $v_stored_filename)) != 1) - { - // ----- Return status - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - - TrFctMessage(__FILE__, __LINE__, 4, "File position after header =".($p_mode=="tar"?ftell($p_tar):gztell($p_tar))); - - // ----- Read the file by 512 octets blocks - $i=0; - while (($v_buffer = fread($v_file, 512)) != "") - { - $v_binary_data = pack("a512", "$v_buffer"); - if ($p_mode == "tar") - fputs($p_tar, $v_binary_data); - else - gzputs($p_tar, $v_binary_data); - $i++; - } - TrFctMessage(__FILE__, __LINE__, 2, "$i 512 bytes blocks"); - - // ----- Close the file - fclose($v_file); - - TrFctMessage(__FILE__, __LINE__, 4, "File position after blocks =".($p_mode=="tar"?ftell($p_tar):gztell($p_tar))); - } - - // ----- Look for a directory - else - { - // ----- Call the header generation - if (($v_result = PclTarHandleHeader($p_tar, $p_filename, $p_mode, $p_header, $v_stored_filename)) != 1) - { - // ----- Return status - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - - TrFctMessage(__FILE__, __LINE__, 4, "File position after header =".($p_mode=="tar"?ftell($p_tar):gztell($p_tar))); - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarHandleHeader() - // Description : - // This function creates in the TAR $p_tar, the TAR header for the file - // $p_filename. - // - // 1. The informations needed to compose the header are recuperated and formatted - // 2. Two binary strings are composed for the first part of the header, before - // and after checksum field. - // 3. The checksum is calculated from the two binary strings - // 4. The header is write in the tar file (first binary string, binary string - // for checksum and last binary string). - // Parameters : - // $p_tar : a valid file descriptor, opened in write mode, - // $p_filename : The name of the file the header is for, - // $p_mode : The mode of the archive ("tar" or "tgz"). - // $p_header : A pointer to a array where will be set the file properties - // Return Values : - // -------------------------------------------------------------------------------- - function PclTarHandleHeader($p_tar, $p_filename, $p_mode, &$p_header, $p_stored_filename) - { - TrFctStart(__FILE__, __LINE__, "PclTarHandleHeader", "tar=$p_tar, file='$p_filename', mode='$p_mode', stored_filename='$p_stored_filename'"); - $v_result=1; - - // ----- Check the parameters - if (($p_tar == 0) || ($p_filename == "")) - { - // ----- Error log - PclErrorLog(-3, "Invalid file descriptor in file ".__FILE__.", line ".__LINE__); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Filename (reduce the path of stored name) - if ($p_stored_filename == "") - $p_stored_filename = $p_filename; - $v_reduce_filename = PclTarHandlePathReduction($p_stored_filename); - TrFctMessage(__FILE__, __LINE__, 2, "Filename (reduced) '$v_reduce_filename', strlen ".strlen($v_reduce_filename)); - - // ----- Get file info - $v_info = stat($p_filename); - $v_uid = sprintf("%6s ", DecOct($v_info[4])); - $v_gid = sprintf("%6s ", DecOct($v_info[5])); - TrFctMessage(__FILE__, __LINE__, 3, "uid=$v_uid, gid=$v_gid"); - $v_perms = sprintf("%6s ", DecOct(fileperms($p_filename))); - TrFctMessage(__FILE__, __LINE__, 3, "file permissions $v_perms"); - - // ----- File mtime - $v_mtime_data = filemtime($p_filename); - TrFctMessage(__FILE__, __LINE__, 2, "File mtime : $v_mtime_data"); - $v_mtime = sprintf("%11s", DecOct($v_mtime_data)); - - // ----- File typeflag - // '0' or '\0' is the code for regular file - // '5' is directory - if (is_dir($p_filename)) - { - $v_typeflag = "5"; - $v_size = 0; - } - else - { - $v_typeflag = ""; - - // ----- Get the file size - clearstatcache(); - $v_size = filesize($p_filename); - } - - TrFctMessage(__FILE__, __LINE__, 2, "File size : $v_size"); - $v_size = sprintf("%11s ", DecOct($v_size)); - - TrFctMessage(__FILE__, __LINE__, 2, "File typeflag : $v_typeflag"); - - // ----- Linkname - $v_linkname = ""; - - // ----- Magic - $v_magic = ""; - - // ----- Version - $v_version = ""; - - // ----- uname - $v_uname = ""; - - // ----- gname - $v_gname = ""; - - // ----- devmajor - $v_devmajor = ""; - - // ----- devminor - $v_devminor = ""; - - // ----- prefix - $v_prefix = ""; - - // ----- Compose the binary string of the header in two parts arround the checksum position - $v_binary_data_first = pack("a100a8a8a8a12A12", $v_reduce_filename, $v_perms, $v_uid, $v_gid, $v_size, $v_mtime); - $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", $v_typeflag, $v_linkname, $v_magic, $v_version, $v_uname, $v_gname, $v_devmajor, $v_devminor, $v_prefix, ""); - - // ----- Calculate the checksum - $v_checksum = 0; - // ..... First part of the header - for ($i=0; $i<148; $i++) - { - $v_checksum += ord(substr($v_binary_data_first,$i,1)); - } - // ..... Ignore the checksum value and replace it by ' ' (space) - for ($i=148; $i<156; $i++) - { - $v_checksum += ord(' '); - } - // ..... Last part of the header - for ($i=156, $j=0; $i<512; $i++, $j++) - { - $v_checksum += ord(substr($v_binary_data_last,$j,1)); - } - TrFctMessage(__FILE__, __LINE__, 3, "Calculated checksum : $v_checksum"); - - // ----- Write the first 148 bytes of the header in the archive - if ($p_mode == "tar") - fputs($p_tar, $v_binary_data_first, 148); - else - gzputs($p_tar, $v_binary_data_first, 148); - - // ----- Write the calculated checksum - $v_checksum = sprintf("%6s ", DecOct($v_checksum)); - $v_binary_data = pack("a8", $v_checksum); - if ($p_mode == "tar") - fputs($p_tar, $v_binary_data, 8); - else - gzputs($p_tar, $v_binary_data, 8); - - // ----- Write the last 356 bytes of the header in the archive - if ($p_mode == "tar") - fputs($p_tar, $v_binary_data_last, 356); - else - gzputs($p_tar, $v_binary_data_last, 356); - - // ----- Set the properties in the header "structure" - $p_header[filename] = $v_reduce_filename; - $p_header[mode] = $v_perms; - $p_header[uid] = $v_uid; - $p_header[gid] = $v_gid; - $p_header[size] = $v_size; - $p_header[mtime] = $v_mtime; - $p_header[typeflag] = $v_typeflag; - $p_header[status] = "added"; - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarHandleFooter() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function PclTarHandleFooter($p_tar, $p_mode) - { - TrFctStart(__FILE__, __LINE__, "PclTarHandleFooter", "tar='$p_tar', p_mode=$p_mode"); - $v_result=1; - - // ----- Write the last 0 filled block for end of archive - $v_binary_data = pack("a512", ""); - if ($p_mode == "tar") - fputs($p_tar, $v_binary_data); - else - gzputs($p_tar, $v_binary_data); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarHandleExtract() - // Description : - // Parameters : - // $p_tarname : Filename of the tar (or tgz) archive - // $p_file_list : An array which contains the list of files to extract, this - // array may be empty when $p_mode is 'complete' - // $p_list_detail : An array where will be placed the properties of each extracted/listed file - // $p_mode : 'complete' will extract all files from the archive, - // 'partial' will look for files in $p_file_list - // 'list' will only list the files from the archive without any extract - // $p_path : Path to add while writing the extracted files - // $p_tar_mode : 'tar' for GNU TAR archive, 'tgz' for compressed archive - // $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 : - // -------------------------------------------------------------------------------- - function PclTarHandleExtract($p_tarname, $p_file_list, &$p_list_detail, $p_mode, $p_path, $p_tar_mode, $p_remove_path) - { - TrFctStart(__FILE__, __LINE__, "PclTarHandleExtract", "archive='$p_tarname', list, mode=$p_mode, path=$p_path, tar_mode=$p_tar_mode, remove_path='$p_remove_path'"); - $v_result=1; - $v_nb = 0; - $v_extract_all = TRUE; - $v_listing = FALSE; - - // ----- Check the path - /* - if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../"))) - $p_path = "./".$p_path; - */ - - $isWin = (substr(PHP_OS, 0, 3) == 'WIN'); - - if(!$isWin) - { - if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../"))) - $p_path = "./".$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); - - // ----- Study the mode - switch ($p_mode) { - case "complete" : - // ----- Flag extract of all files - $v_extract_all = TRUE; - $v_listing = FALSE; - break; - case "partial" : - // ----- Flag extract of specific files - $v_extract_all = FALSE; - $v_listing = FALSE; - break; - case "list" : - // ----- Flag list of all files - $v_extract_all = FALSE; - $v_listing = TRUE; - break; - default : - // ----- Error log - PclErrorLog(-3, "Invalid extract mode ($p_mode)"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Open the tar file - if ($p_tar_mode == "tar") - { - TrFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode"); - $v_tar = fopen($p_tarname, "rb"); - } - else - { - TrFctMessage(__FILE__, __LINE__, 3, "Open file in gzip binary read mode"); - $v_tar = @gzopen($p_tarname, "rb"); - } - - // ----- Check that the archive is open - if ($v_tar == 0) - { - // ----- Error log - PclErrorLog(-2, "Unable to open archive '$p_tarname' in binary read mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Read the blocks - While (!($v_end_of_file = ($p_tar_mode == "tar"?feof($v_tar):gzeof($v_tar)))) - { - TrFctMessage(__FILE__, __LINE__, 3, "Looking for next header ..."); - - // ----- Clear cache of file infos - clearstatcache(); - - // ----- Reset extract tag - $v_extract_file = FALSE; - $v_extraction_stopped = 0; - - // ----- Read the 512 bytes header - if ($p_tar_mode == "tar") - $v_binary_data = fread($v_tar, 512); - else - $v_binary_data = gzread($v_tar, 512); - - // ----- Read the header properties - if (($v_result = PclTarHandleReadHeader($v_binary_data, $v_header)) != 1) - { - // ----- Close the archive file - if ($p_tar_mode == "tar") - fclose($v_tar); - else - gzclose($v_tar); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - - // ----- Look for empty blocks to skip - if ($v_header["filename"] == "") - { - TrFctMessage(__FILE__, __LINE__, 2, "Empty block found. End of archive ?"); - continue; - } - - TrFctMessage(__FILE__, __LINE__, 2, "Found file '" . $v_header["filename"] . "', size '$v_header[size]'"); - - // ----- Look for partial extract - if ((!$v_extract_all) && (is_array($p_file_list))) - { - TrFctMessage(__FILE__, __LINE__, 2, "Look if the file '$v_header[filename]' need to be extracted"); - - // ----- By default no unzip if the file is not found - $v_extract_file = FALSE; - - // ----- Look into the file list - for ($i=0; $i strlen($p_file_list[$i])) && (substr($v_header["filename"], 0, strlen($p_file_list[$i])) == $p_file_list[$i])) - { - // ----- The file is in the directory, so extract it - TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' is in directory '$p_file_list[$i]' : extract it"); - $v_extract_file = TRUE; - - // ----- End of loop - break; - } - } - - // ----- It is a file, so compare the file names - else if ($p_file_list[$i] == $v_header["filename"]) - { - // ----- File found - TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' should be extracted"); - $v_extract_file = TRUE; - - // ----- End of loop - break; - } - } - - // ----- Trace - if (!$v_extract_file) - { - TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' should not be extracted"); - } - } - else - { - // ----- All files need to be extracted - $v_extract_file = TRUE; - } - - // ----- Look if this file need to be extracted - if (($v_extract_file) && (!$v_listing)) - { - // ----- Look for path to remove - if (($p_remove_path != "") - && (substr($v_header["filename"], 0, $p_remove_path_size) == $p_remove_path)) - { - TrFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '$v_header[filename]'"); - // ----- Remove the path - $v_header["filename"] = substr($v_header["filename"], $p_remove_path_size); - TrFctMessage(__FILE__, __LINE__, 3, "Reslting file is '$v_header[filename]'"); - } - - // ----- Add the path to the file - if (($p_path != "./") && ($p_path != "/")) - { - // ----- Look for the path end '/' - while (substr($p_path, -1) == "/") - { - TrFctMessage(__FILE__, __LINE__, 3, "Destination path [$p_path] ends by '/'"); - $p_path = substr($p_path, 0, strlen($p_path)-1); - TrFctMessage(__FILE__, __LINE__, 3, "Modified to [$p_path]"); - } - - // ----- Add the path - if (substr($v_header["filename"], 0, 1) == "/") - $v_header["filename"] = $p_path.$v_header["filename"]; - else - $v_header["filename"] = $p_path."/".$v_header["filename"]; - } - - // ----- Trace - TrFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '$v_header[filename]', size '$v_header[size]'"); - - // ----- Check that the file does not exists - if (file_exists($v_header["filename"])) - { - TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' already exists"); - - // ----- Look if file is a directory - if (is_dir($v_header["filename"])) - { - TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is a directory"); - - // ----- Change the file status - $v_header["status"] = "already_a_directory"; - - // ----- Skip the extract - $v_extraction_stopped = 1; - $v_extract_file = 0; - } - // ----- Look if file is write protected - else if (!is_writeable($v_header["filename"])) - { - TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is write protected"); - - // ----- Change the file status - $v_header["status"] = "write_protected"; - - // ----- Skip the extract - $v_extraction_stopped = 1; - $v_extract_file = 0; - } - // ----- Look if the extracted file is older - else if (filemtime($v_header["filename"]) > $v_header["mtime"]) - { - TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", $v_header[mtime]).")"); - - // ----- Change the file status - $v_header["status"] = "newer_exist"; - - // ----- Skip the extract - $v_extraction_stopped = 1; - $v_extract_file = 0; - } - } - - // ----- Check the directory availability and create it if necessary - else - { - if ($v_header["typeflag"]=="5") - $v_dir_to_check = $v_header["filename"]; - else if (!strstr($v_header["filename"], "/")) - $v_dir_to_check = ""; - else - $v_dir_to_check = dirname($v_header["filename"]); - - if (($v_result = PclTarHandlerDirCheck($v_dir_to_check)) != 1) - { - TrFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '$v_header[filename]'"); - - // ----- Change the file status - $v_header["status"] = "path_creation_fail"; - - // ----- Skip the extract - $v_extraction_stopped = 1; - $v_extract_file = 0; - } - } - - // ----- Do the extraction - if (($v_extract_file) && ($v_header["typeflag"]!="5")) - { - // ----- Open the destination file in write mode - if (($v_dest_file = @fopen($v_header["filename"], "wb")) == 0) - { - TrFctMessage(__FILE__, __LINE__, 2, "Error while opening '$v_header[filename]' in write binary mode"); - - // ----- Change the file status - $v_header["status"] = "write_error"; - - // ----- Jump to next file - TrFctMessage(__FILE__, __LINE__, 2, "Jump to next file"); - if ($p_tar_mode == "tar") - fseek($v_tar, ftell($v_tar)+(ceil(($v_header[size]/512))*512)); - else - gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512)); - } - else - { - TrFctMessage(__FILE__, __LINE__, 2, "Start extraction of '$v_header[filename]'"); - - // ----- Read data - $n = floor($v_header["size"]/512); - for ($i=0; $i<$n; $i++) - { - TrFctMessage(__FILE__, __LINE__, 3, "Read complete 512 bytes block number ".($i+1)); - if ($p_tar_mode == "tar") - $v_content = fread($v_tar, 512); - else - $v_content = gzread($v_tar, 512); - fwrite($v_dest_file, $v_content, 512); - } - if (($v_header["size"] % 512) != 0) - { - TrFctMessage(__FILE__, __LINE__, 3, "Read last ".($v_header["size"] % 512)." bytes in a 512 block"); - if ($p_tar_mode == "tar") - $v_content = fread($v_tar, 512); - else - $v_content = gzread($v_tar, 512); - fwrite($v_dest_file, $v_content, ($v_header["size"] % 512)); - } - - // ----- Close the destination file - fclose($v_dest_file); - - // ----- Change the file mode, mtime - touch($v_header["filename"], $v_header["mtime"]); - //chmod($v_header[filename], DecOct($v_header[mode])); - } - - // ----- Check the file size - clearstatcache(); - if (filesize($v_header["filename"]) != $v_header["size"]) - { - // ----- Close the archive file - if ($p_tar_mode == "tar") - fclose($v_tar); - else - gzclose($v_tar); - - // ----- Error log - PclErrorLog(-7, "Extracted file '$v_header[filename]' does not have the correct file size '".filesize($v_filename)."' ('$v_header[size]' expected). Archive may be corrupted."); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Trace - TrFctMessage(__FILE__, __LINE__, 2, "Extraction done"); - } - - else - { - TrFctMessage(__FILE__, __LINE__, 2, "Extraction of file '$v_header[filename]' skipped."); - - // ----- Jump to next file - TrFctMessage(__FILE__, __LINE__, 2, "Jump to next file"); - if ($p_tar_mode == "tar") - fseek($v_tar, ftell($v_tar)+(ceil(($v_header["size"]/512))*512)); - else - gzseek($v_tar, gztell($v_tar)+(ceil(($v_header["size"]/512))*512)); - } - } - - // ----- Look for file that is not to be unzipped - else - { - // ----- Trace - TrFctMessage(__FILE__, __LINE__, 2, "Jump file '$v_header[filename]'"); - TrFctMessage(__FILE__, __LINE__, 4, "Position avant jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]"); - - // ----- Jump to next file - if ($p_tar_mode == "tar") - fseek($v_tar, ($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))+(ceil(($v_header[size]/512))*512)); - else - gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512)); - - TrFctMessage(__FILE__, __LINE__, 4, "Position apr�s jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]"); - } - - if ($p_tar_mode == "tar") - $v_end_of_file = feof($v_tar); - else - $v_end_of_file = gzeof($v_tar); - - // ----- File name and properties are logged if listing mode or file is extracted - if ($v_listing || $v_extract_file || $v_extraction_stopped) - { - TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file '$v_header[filename]'"); - - // ----- Log extracted files - if (($v_file_dir = dirname($v_header["filename"])) == $v_header["filename"]) - $v_file_dir = ""; - if ((substr($v_header["filename"], 0, 1) == "/") && ($v_file_dir == "")) - $v_file_dir = "/"; - - // ----- Add the array describing the file into the list - $p_list_detail[$v_nb] = $v_header; - - // ----- Increment - $v_nb++; - } - } - - // ----- Close the tarfile - if ($p_tar_mode == "tar") - fclose($v_tar); - else - gzclose($v_tar); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarHandleExtractByIndexList() - // Description : - // Extract the files which are at the indexes specified. If the 'file' at the - // index is a directory, the directory only is created, not all the files stored - // for that directory. - // Parameters : - // $p_index_string : String of indexes of files to extract. The form of the - // string is "0,4-6,8-12" with only numbers and '-' for - // for range, and ',' to separate ranges. No spaces or ';' - // are allowed. - // Return Values : - // -------------------------------------------------------------------------------- - function PclTarHandleExtractByIndexList($p_tarname, $p_index_string, &$p_list_detail, $p_path, $p_remove_path, $p_tar_mode) - { - TrFctStart(__FILE__, __LINE__, "PclTarHandleExtractByIndexList", "archive='$p_tarname', index_string='$p_index_string', list, path=$p_path, remove_path='$p_remove_path', tar_mode=$p_tar_mode"); - $v_result=1; - $v_nb = 0; - - // ----- TBC : I should check the string by a regexp - - // ----- Check the path - if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path, 0, 2) != "./"))) - $p_path = "./".$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 tar file - if ($p_tar_mode == "tar") - { - TrFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode"); - $v_tar = @fopen($p_tarname, "rb"); - } - else - { - TrFctMessage(__FILE__, __LINE__, 3, "Open file in gzip binary read mode"); - $v_tar = @gzopen($p_tarname, "rb"); - } - - // ----- Check that the archive is open - if ($v_tar == 0) - { - // ----- Error log - PclErrorLog(-2, "Unable to open archive '$p_tarname' in binary read mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Manipulate the index list - $v_list = explode(",", $p_index_string); - sort($v_list); - - // ----- Loop on the index list - $v_index=0; - for ($i=0; ($i $p_index_stop) - { - TrFctMessage(__FILE__, __LINE__, 2, "Stop extraction, past stop index"); - break; - } - - // ----- Clear cache of file infos - clearstatcache(); - - // ----- Reset extract tag - $v_extract_file = FALSE; - $v_extraction_stopped = 0; - - // ----- Read the 512 bytes header - if ($p_tar_mode == "tar") - $v_binary_data = fread($v_tar, 512); - else - $v_binary_data = gzread($v_tar, 512); - - // ----- Read the header properties - if (($v_result = PclTarHandleReadHeader($v_binary_data, $v_header)) != 1) - { - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - - // ----- Look for empty blocks to skip - if ($v_header[filename] == "") - { - TrFctMessage(__FILE__, __LINE__, 2, "Empty block found. End of archive ?"); - continue; - } - - TrFctMessage(__FILE__, __LINE__, 2, "Found file '$v_header[filename]', size '$v_header[size]'"); - - // ----- Look if file is in the range to be extracted - if (($p_index_current >= $p_index_start) && ($p_index_current <= $p_index_stop)) - { - TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' is in the range to be extracted"); - $v_extract_file = TRUE; - } - else - { - TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' is out of the range"); - $v_extract_file = FALSE; - } - - // ----- Look if this file need to be extracted - if ($v_extract_file) - { - if (($v_result = PclTarHandleExtractFile($v_tar, $v_header, $p_path, $p_remove_path, $p_tar_mode)) != 1) - { - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - } - - // ----- Look for file that is not to be extracted - else - { - // ----- Trace - TrFctMessage(__FILE__, __LINE__, 2, "Jump file '$v_header[filename]'"); - TrFctMessage(__FILE__, __LINE__, 4, "Position avant jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]"); - - // ----- Jump to next file - if ($p_tar_mode == "tar") - fseek($v_tar, ($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))+(ceil(($v_header[size]/512))*512)); - else - gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512)); - - TrFctMessage(__FILE__, __LINE__, 4, "Position apr�s jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]"); - } - - if ($p_tar_mode == "tar") - $v_end_of_file = feof($v_tar); - else - $v_end_of_file = gzeof($v_tar); - - // ----- File name and properties are logged if listing mode or file is extracted - if ($v_extract_file) - { - TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file '$v_header[filename]'"); - - // ----- Log extracted files - if (($v_file_dir = dirname($v_header[filename])) == $v_header[filename]) - $v_file_dir = ""; - if ((substr($v_header[filename], 0, 1) == "/") && ($v_file_dir == "")) - $v_file_dir = "/"; - - // ----- Add the array describing the file into the list - $p_list_detail[$v_nb] = $v_header; - - // ----- Increment - $v_nb++; - } - - // ----- Increment the current file index - $p_index_current++; - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarHandleExtractFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function PclTarHandleExtractFile($p_tar, &$v_header, $p_path, $p_remove_path, $p_tar_mode) - { - TrFctStart(__FILE__, __LINE__, "PclTarHandleExtractFile", "archive_descr='$p_tar', path=$p_path, remove_path='$p_remove_path', tar_mode=$p_tar_mode"); - $v_result=1; - - // TBC : I should replace all $v_tar by $p_tar in this function .... - $v_tar = $p_tar; - $v_extract_file = 1; - - $p_remove_path_size = strlen($p_remove_path); - - // ----- Look for path to remove - if (($p_remove_path != "") - && (substr($v_header[filename], 0, $p_remove_path_size) == $p_remove_path)) - { - TrFctMessage(__FILE__, __LINE__, 3, "Found path '$p_remove_path' to remove in file '$v_header[filename]'"); - // ----- Remove the path - $v_header[filename] = substr($v_header[filename], $p_remove_path_size); - TrFctMessage(__FILE__, __LINE__, 3, "Resulting file is '$v_header[filename]'"); - } - - // ----- Add the path to the file - if (($p_path != "./") && ($p_path != "/")) - { - // ----- Look for the path end '/' - while (substr($p_path, -1) == "/") - { - TrFctMessage(__FILE__, __LINE__, 3, "Destination path [$p_path] ends by '/'"); - $p_path = substr($p_path, 0, strlen($p_path)-1); - TrFctMessage(__FILE__, __LINE__, 3, "Modified to [$p_path]"); - } - - // ----- Add the path - if (substr($v_header[filename], 0, 1) == "/") - $v_header[filename] = $p_path.$v_header[filename]; - else - $v_header[filename] = $p_path."/".$v_header[filename]; - } - - // ----- Trace - TrFctMessage(__FILE__, __LINE__, 2, "Extracting file (with path) '$v_header[filename]', size '$v_header[size]'"); - - // ----- Check that the file does not exists - if (file_exists($v_header[filename])) - { - TrFctMessage(__FILE__, __LINE__, 2, "File '$v_header[filename]' already exists"); - - // ----- Look if file is a directory - if (is_dir($v_header[filename])) - { - TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is a directory"); - - // ----- Change the file status - $v_header[status] = "already_a_directory"; - - // ----- Skip the extract - $v_extraction_stopped = 1; - $v_extract_file = 0; - } - // ----- Look if file is write protected - else if (!is_writeable($v_header[filename])) - { - TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is write protected"); - - // ----- Change the file status - $v_header[status] = "write_protected"; - - // ----- Skip the extract - $v_extraction_stopped = 1; - $v_extract_file = 0; - } - // ----- Look if the extracted file is older - else if (filemtime($v_header[filename]) > $v_header[mtime]) - { - TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", $v_header[mtime]).")"); - - // ----- Change the file status - $v_header[status] = "newer_exist"; - - // ----- Skip the extract - $v_extraction_stopped = 1; - $v_extract_file = 0; - } - } - - // ----- Check the directory availability and create it if necessary - else - { - if ($v_header[typeflag]=="5") - $v_dir_to_check = $v_header[filename]; - else if (!strstr($v_header[filename], "/")) - $v_dir_to_check = ""; - else - $v_dir_to_check = dirname($v_header[filename]); - - if (($v_result = PclTarHandlerDirCheck($v_dir_to_check)) != 1) - { - TrFctMessage(__FILE__, __LINE__, 2, "Unable to create path for '$v_header[filename]'"); - - // ----- Change the file status - $v_header[status] = "path_creation_fail"; - - // ----- Skip the extract - $v_extraction_stopped = 1; - $v_extract_file = 0; - } - } - - // ----- Do the real bytes extraction (if not a directory) - if (($v_extract_file) && ($v_header[typeflag]!="5")) - { - // ----- Open the destination file in write mode - if (($v_dest_file = @fopen($v_header[filename], "wb")) == 0) - { - TrFctMessage(__FILE__, __LINE__, 2, "Error while opening '$v_header[filename]' in write binary mode"); - - // ----- Change the file status - $v_header[status] = "write_error"; - - // ----- Jump to next file - TrFctMessage(__FILE__, __LINE__, 2, "Jump to next file"); - if ($p_tar_mode == "tar") - fseek($v_tar, ftell($v_tar)+(ceil(($v_header[size]/512))*512)); - else - gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512)); - } - else - { - TrFctMessage(__FILE__, __LINE__, 2, "Start extraction of '$v_header[filename]'"); - - // ----- Read data - $n = floor($v_header[size]/512); - for ($i=0; $i<$n; $i++) - { - TrFctMessage(__FILE__, __LINE__, 3, "Read complete 512 bytes block number ".($i+1)); - if ($p_tar_mode == "tar") - $v_content = fread($v_tar, 512); - else - $v_content = gzread($v_tar, 512); - fwrite($v_dest_file, $v_content, 512); - } - if (($v_header[size] % 512) != 0) - { - TrFctMessage(__FILE__, __LINE__, 3, "Read last ".($v_header[size] % 512)." bytes in a 512 block"); - if ($p_tar_mode == "tar") - $v_content = fread($v_tar, 512); - else - $v_content = gzread($v_tar, 512); - fwrite($v_dest_file, $v_content, ($v_header[size] % 512)); - } - - // ----- Close the destination file - fclose($v_dest_file); - - // ----- Change the file mode, mtime - touch($v_header[filename], $v_header[mtime]); - //chmod($v_header[filename], DecOct($v_header[mode])); - } - - // ----- Check the file size - clearstatcache(); - if (filesize($v_header[filename]) != $v_header[size]) - { - // ----- Error log - PclErrorLog(-7, "Extracted file '$v_header[filename]' does not have the correct file size '".filesize($v_filename)."' ('$v_header[size]' expected). Archive may be corrupted."); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Trace - TrFctMessage(__FILE__, __LINE__, 2, "Extraction done"); - } - else - { - TrFctMessage(__FILE__, __LINE__, 2, "Extraction of file '$v_header[filename]' skipped."); - - // ----- Jump to next file - TrFctMessage(__FILE__, __LINE__, 2, "Jump to next file"); - if ($p_tar_mode == "tar") - fseek($v_tar, ftell($v_tar)+(ceil(($v_header[size]/512))*512)); - else - gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512)); - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTarHandleDelete() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function PclTarHandleDelete($p_tarname, $p_file_list, &$p_list_detail, $p_tar_mode) - { - TrFctStart(__FILE__, __LINE__, "PclTarHandleDelete", "archive='$p_tarname', list, tar_mode=$p_tar_mode"); - $v_result=1; - $v_nb=0; - - // ----- Look for regular tar file - if ($p_tar_mode == "tar") - { - // ----- Open file - TrFctMessage(__FILE__, __LINE__, 3, "Open file in binary read mode"); - if (($v_tar = @fopen($p_tarname, "rb")) == 0) - { - // ----- Error log - PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Open a temporary file in write mode - $v_temp_tarname = uniqid("pcltar-").".tmp"; - TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); - if (($v_temp_tar = @fopen($v_temp_tarname, "wb")) == 0) - { - // ----- Close tar file - fclose($v_tar); - - // ----- Error log - PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - } - - // ----- Look for compressed tar file - else - { - // ----- Open the file in read mode - TrFctMessage(__FILE__, __LINE__, 3, "Open file in gzip binary read mode"); - if (($v_tar = @gzopen($p_tarname, "rb")) == 0) - { - // ----- Error log - PclErrorLog(-2, "Unable to open file '$p_tarname' in binary read mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - - // ----- Open a temporary file in write mode - $v_temp_tarname = uniqid("pcltar-").".tmp"; - TrFctMessage(__FILE__, __LINE__, 2, "Creating temporary archive file $v_temp_tarname"); - if (($v_temp_tar = @gzopen($v_temp_tarname, "wb")) == 0) - { - // ----- Close tar file - gzclose($v_tar); - - // ----- Error log - PclErrorLog(-1, "Unable to open file '$v_temp_tarname' in binary write mode"); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, PclErrorCode(), PclErrorString()); - return PclErrorCode(); - } - } - - // ----- Read the blocks - While (!($v_end_of_file = ($p_tar_mode == "tar"?feof($v_tar):gzeof($v_tar)))) - { - TrFctMessage(__FILE__, __LINE__, 3, "Looking for next header ..."); - - // ----- Clear cache of file infos - clearstatcache(); - - // ----- Reset delete tag - $v_delete_file = FALSE; - - // ----- Read the first 512 block header - if ($p_tar_mode == "tar") - $v_binary_data = fread($v_tar, 512); - else - $v_binary_data = gzread($v_tar, 512); - - // ----- Read the header properties - if (($v_result = PclTarHandleReadHeader($v_binary_data, $v_header)) != 1) - { - // ----- Close the archive file - if ($p_tar_mode == "tar") - { - fclose($v_tar); - fclose($v_temp_tar); - } - else - { - gzclose($v_tar); - gzclose($v_temp_tar); - } - @unlink($v_temp_tarname); - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - - // ----- Look for empty blocks to skip - if ($v_header[filename] == "") - { - TrFctMessage(__FILE__, __LINE__, 2, "Empty block found. End of archive ?"); - continue; - } - - TrFctMessage(__FILE__, __LINE__, 2, "Found file '$v_header[filename]', size '$v_header[size]'"); - - // ----- Look for filenames to delete - for ($i=0, $v_delete_file=FALSE; ($i $v_header[mtime]) - { - TrFctMessage(__FILE__, __LINE__, 3, "File '$p_file_list[$i]' need to be updated"); - $v_update_file = TRUE; - } - else - { - TrFctMessage(__FILE__, __LINE__, 3, "File '$p_file_list[$i]' does not need to be updated"); - $v_update_file = FALSE; - } - - // ----- Flag the name in order not to add the file at the end - $v_found_list[$i] = 1; - } - else - { - TrFctMessage(__FILE__, __LINE__, 4, "File '$p_file_list[$i]' is not '$v_header[filename]'"); - } - } - - // ----- Copy files that do not need to be updated - if (!$v_update_file) - { - TrFctMessage(__FILE__, __LINE__, 2, "Keep file '$v_header[filename]'"); - - // ----- Write the file header - if ($p_tar_mode == "tar") - { - fputs($v_temp_tar, $v_binary_data, 512); - } - else - { - gzputs($v_temp_tar, $v_binary_data, 512); - } - - // ----- Write the file data - $n = ceil($v_header[size]/512); - for ($j=0; $j<$n; $j++) - { - TrFctMessage(__FILE__, __LINE__, 3, "Read complete 512 bytes block number ".($j+1)); - if ($p_tar_mode == "tar") - { - $v_content = fread($v_tar, 512); - fwrite($v_temp_tar, $v_content, 512); - } - else - { - $v_content = gzread($v_tar, 512); - gzwrite($v_temp_tar, $v_content, 512); - } - } - - // ----- File name and properties are logged if listing mode or file is extracted - TrFctMessage(__FILE__, __LINE__, 2, "Memorize info about file '$v_header[filename]'"); - - // ----- Add the array describing the file into the list - $p_list_detail[$v_nb] = $v_header; - $p_list_detail[$v_nb][status] = ($v_found_file?"not_updated":"ok"); - - // ----- Increment - $v_nb++; - } - - // ----- Look for file that need to be updated - else - { - // ----- Trace - TrFctMessage(__FILE__, __LINE__, 2, "Start update of file '$v_current_filename'"); - - // ----- Store the old file size - $v_old_size = $v_header[size]; - - // ----- Add the file - if (($v_result = PclTarHandleAddFile($v_temp_tar, $v_current_filename, $p_tar_mode, $v_header, $p_add_dir, $p_remove_dir)) != 1) - { - // ----- Close the tarfile - if ($p_tar_mode == "tar") - { - fclose($v_tar); - fclose($v_temp_tar); - } - else - { - gzclose($v_tar); - gzclose($v_temp_tar); - } - @unlink($p_temp_tarname); - - // ----- Return status - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - - // ----- Trace - TrFctMessage(__FILE__, __LINE__, 2, "Skip old file '$v_header[filename]'"); - - // ----- Jump to next file - if ($p_tar_mode == "tar") - fseek($v_tar, ftell($v_tar)+(ceil(($v_old_size/512))*512)); - else - gzseek($v_tar, gztell($v_tar)+(ceil(($v_old_size/512))*512)); - - // ----- Add the array describing the file into the list - $p_list_detail[$v_nb] = $v_header; - $p_list_detail[$v_nb][status] = "updated"; - - // ----- Increment - $v_nb++; - } - - // ----- Look for end of file - if ($p_tar_mode == "tar") - $v_end_of_file = feof($v_tar); - else - $v_end_of_file = gzeof($v_tar); - } - - // ----- Look for files that does not exists in the archive and need to be added - for ($i=0; $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] == "..") - { - // ----- Ignore it and ignore the $i-1 - $i--; - } - else if (($v_list[$i] == "") && ($i!=(sizeof($v_list)-1)) && ($i!=0)) - { - // ----- Ignore only the double '//' in path, - // but not the first and last '/' - } - else - { - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); - } - } - } - - // ----- Return - TrFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; - } - // -------------------------------------------------------------------------------- - - -// ----- End of double include look -} -?> \ No newline at end of file diff --git a/administrator/includes/pcl/pcltrace.lib.php b/administrator/includes/pcl/pcltrace.lib.php deleted file mode 100644 index f6cec8dae28a4..0000000000000 --- a/administrator/includes/pcl/pcltrace.lib.php +++ /dev/null @@ -1,459 +0,0 @@ -"; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo "
    : - + lists['catid']; - echo $this->lists['state']; + echo JHTML::_('list.category', 'filter_catid', 'com_weblinks', intval( $this->filter->catid ), 'onchange="document.adminForm.submit();"' ); + echo JHTML::_('weblink.statefilter', $this->filter->state ); ?>
    - lists['order_Dir'], $this->lists['order'] ); ?> + filter->order_Dir, $this->filter->order ); ?> - lists['order_Dir'], $this->lists['order'] ); ?> + filter->order_Dir, $this->filter->order ); ?> - lists['order_Dir'], $this->lists['order'] ); ?> + + filter->order_Dir, $this->filter->order ); ?> items ); ?> - lists['order_Dir'], $this->lists['order'] ); ?> + filter->order_Dir, $this->filter->order ); ?> - lists['order_Dir'], $this->lists['order'] ); ?> + filter->order_Dir, $this->filter->order ); ?> - lists['order_Dir'], $this->lists['order'] ); ?> + filter->order_Dir, $this->filter->order ); ?>
    - + pagination->orderUpIcon( $i, ($row->catid == @$this->items[$i-1]->catid),'orderup', 'Move Up', $ordering ); ?> @@ -136,7 +125,7 @@ - - + + \ No newline at end of file diff --git a/administrator/components/com_weblinks/views/weblinks/tmpl/index.html b/administrator/components/com_weblinks/views/weblinks/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/com_weblinks/views/weblinks/tmpl/index.html +++ b/administrator/components/com_weblinks/views/weblinks/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/components/com_weblinks/views/weblinks/view.html.php b/administrator/components/com_weblinks/views/weblinks/view.html.php index 3de1d9039566b..fc5a62e878820 100644 --- a/administrator/components/com_weblinks/views/weblinks/view.html.php +++ b/administrator/components/com_weblinks/views/weblinks/view.html.php @@ -29,41 +29,26 @@ class WeblinksViewWeblinks extends JView { function display($tpl = null) { - global $mainframe, $option; - - $db =& JFactory::getDBO(); - $uri =& JFactory::getURI(); - - $filter_state = $mainframe->getUserStateFromRequest( $option.'filter_state', 'filter_state', '', 'word' ); - $filter_catid = $mainframe->getUserStateFromRequest( $option.'filter_catid', 'filter_catid', 0, 'int' ); - $filter_order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'a.ordering', 'cmd' ); - $filter_order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); - $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); - $search = JString::strtolower( $search ); + // Set toolbar items for the page + JToolBarHelper::title( JText::_( 'Weblink Manager' ), 'generic.png' ); + JToolBarHelper::publishList(); + JToolBarHelper::unpublishList(); + JToolBarHelper::deleteList(); + JToolBarHelper::editListX(); + JToolBarHelper::addNewX(); + JToolBarHelper::preferences('com_weblinks', '480'); + JToolBarHelper::help( 'screen.weblink' ); // Get data from the model $items = & $this->get( 'Data'); $total = & $this->get( 'Total'); $pagination = & $this->get( 'Pagination' ); - - // build list of categories - $javascript = 'onchange="document.adminForm.submit();"'; - $lists['catid'] = JHTML::_('list.category', 'filter_catid', $option, intval( $filter_catid ), $javascript ); - - // state filter - $lists['state'] = JHTML::_('grid.state', $filter_state ); - - // table ordering - $lists['order_Dir'] = $filter_order_Dir; - $lists['order'] = $filter_order; - - // search filter - $lists['search']= $search; + $filter = & $this->get( 'Filter'); $this->assignRef('user', JFactory::getUser()); - $this->assignRef('lists', $lists); $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); + $this->assignRef('filter', $filter); parent::display($tpl); } diff --git a/administrator/components/com_weblinks/weblinks.php b/administrator/components/com_weblinks/weblinks.php index f6c92da2fecb9..ce0e3a63d2f9e 100644 --- a/administrator/components/com_weblinks/weblinks.php +++ b/administrator/components/com_weblinks/weblinks.php @@ -23,8 +23,11 @@ $mainframe->redirect( 'index.php', JText::_('ALERTNOTAUTH') ); } +// Helper classes +JHTML::addIncludePath(JPATH_COMPONENT.DS.'classes'); + // Require the base controller -require_once (JPATH_COMPONENT.DS.'controller.php'); +require_once JPATH_COMPONENT.DS.'controller.php'; $controller = new WeblinksController( ); diff --git a/administrator/components/index.html b/administrator/components/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/components/index.html +++ b/administrator/components/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/help/en-GB/css/index.html b/administrator/help/en-GB/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/help/en-GB/css/index.html +++ b/administrator/help/en-GB/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/help/en-GB/index.html b/administrator/help/en-GB/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/help/en-GB/index.html +++ b/administrator/help/en-GB/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/help/en-GB/screen.banner.categories.edit.html b/administrator/help/en-GB/screen.banner.categories.edit.html new file mode 100644 index 0000000000000..0ef2629df1f35 --- /dev/null +++ b/administrator/help/en-GB/screen.banner.categories.edit.html @@ -0,0 +1,14 @@ + + + +Banner Category Manager - New/Edit + + + + + +

    Banner Category Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.banner.categories.html b/administrator/help/en-GB/screen.banner.categories.html new file mode 100644 index 0000000000000..fb17744ec4c35 --- /dev/null +++ b/administrator/help/en-GB/screen.banner.categories.html @@ -0,0 +1,14 @@ + + + +Banner Category Manager + + + + + +

    Banner Category Manager

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.banners.client.edit.html b/administrator/help/en-GB/screen.banners.client.edit.html index fd75a557ba344..bd03279f57c8e 100644 --- a/administrator/help/en-GB/screen.banners.client.edit.html +++ b/administrator/help/en-GB/screen.banners.client.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Banner: Client Manager : New / Edit +Banner Client Manager - New/Edit -

    Banner: Client Manager : New / Edit

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Banner Client Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.banners.client.html b/administrator/help/en-GB/screen.banners.client.html index ca882d4f71a73..218ac93ce5da9 100644 --- a/administrator/help/en-GB/screen.banners.client.html +++ b/administrator/help/en-GB/screen.banners.client.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Banner: Client Manager +Banner Client Manager -

    Banner: Client Manager

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Banner Client Manager

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.banners.edit.html b/administrator/help/en-GB/screen.banners.edit.html index da998a8349556..cc01e255893b9 100644 --- a/administrator/help/en-GB/screen.banners.edit.html +++ b/administrator/help/en-GB/screen.banners.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Banner Manager : New / Edit +Banner Manager - New/Edit -

    Banner Manager : New / Edit

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Banner Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.cache.html b/administrator/help/en-GB/screen.cache.html new file mode 100644 index 0000000000000..266afc8a4511a --- /dev/null +++ b/administrator/help/en-GB/screen.cache.html @@ -0,0 +1,14 @@ + + + +Clean Cache + + + + + +

    Clean Cache

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.categories.edit.html b/administrator/help/en-GB/screen.categories.edit.html index 590f2e515aa85..5392d7782607b 100644 --- a/administrator/help/en-GB/screen.categories.edit.html +++ b/administrator/help/en-GB/screen.categories.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Category Manager : New / Edit +Category Manager - New/Edit -

    Category Manager : New / Edit

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Category Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.contact_details.categories.edit.html b/administrator/help/en-GB/screen.contact_details.categories.edit.html new file mode 100644 index 0000000000000..1dbb16e4ece5d --- /dev/null +++ b/administrator/help/en-GB/screen.contact_details.categories.edit.html @@ -0,0 +1,14 @@ + + + +Contact Category Manager - New/Edit + + + + + +

    Contact Category Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.contact_details.categories.html b/administrator/help/en-GB/screen.contact_details.categories.html new file mode 100644 index 0000000000000..ceea68fbd8b5a --- /dev/null +++ b/administrator/help/en-GB/screen.contact_details.categories.html @@ -0,0 +1,14 @@ + + + +Contact Category Manager + + + + + +

    Contact Category Manager

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.contactmanager.edit.html b/administrator/help/en-GB/screen.contactmanager.edit.html index ec1a6a350ff0d..75a9a09967b79 100644 --- a/administrator/help/en-GB/screen.contactmanager.edit.html +++ b/administrator/help/en-GB/screen.contactmanager.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Contact Manager : New / Edit +Contact Manager - New/Edit -

    Contact Manager : New / Edit

    +

    Contact Manager - New/Edit

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.content.categories.edit.html b/administrator/help/en-GB/screen.content.categories.edit.html new file mode 100644 index 0000000000000..3d5dc00bbf8cd --- /dev/null +++ b/administrator/help/en-GB/screen.content.categories.edit.html @@ -0,0 +1,14 @@ + + + +Content Category Manager - New/Edit + + + + + +

    Content Category Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.content.categories.html b/administrator/help/en-GB/screen.content.categories.html new file mode 100644 index 0000000000000..892f721399275 --- /dev/null +++ b/administrator/help/en-GB/screen.content.categories.html @@ -0,0 +1,14 @@ + + + +Content Category Manager + + + + + +

    Content Category Manager

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.content.edit.html b/administrator/help/en-GB/screen.content.edit.html index c08dff1e55fa1..7cce5c6ea9725 100644 --- a/administrator/help/en-GB/screen.content.edit.html +++ b/administrator/help/en-GB/screen.content.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Article Manager : New / Edit +Article Manager - New/Edit -

    Article Manager : New / Edit

    +

    Article Manager - New/Edit

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.installer.html b/administrator/help/en-GB/screen.installer.html index 0a3e3f3c24656..6de5f4d09fbb5 100644 --- a/administrator/help/en-GB/screen.installer.html +++ b/administrator/help/en-GB/screen.installer.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Extension Manager: Install +Extension Manager - Install -

    Extension Manager: Install

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Extension Manager - Install

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.menumanager.new.html b/administrator/help/en-GB/screen.menumanager.new.html index 4176fa5c8d631..743892b652ad5 100644 --- a/administrator/help/en-GB/screen.menumanager.new.html +++ b/administrator/help/en-GB/screen.menumanager.new.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Menu Manager : New / Edit Menu +Menu Manager - New/Edit -

    Menu Manager : New / Edit Menu

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Menu Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    diff --git a/administrator/help/en-GB/screen.menus.edit.html b/administrator/help/en-GB/screen.menus.edit.html index 66fd6abfdfd93..caa9b7612085d 100644 --- a/administrator/help/en-GB/screen.menus.edit.html +++ b/administrator/help/en-GB/screen.menus.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Menus: Edit Menu Item +Menu Item Manager - New/Edit -

    Menus: Edit Menu Item

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Menu Item Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.menus.html b/administrator/help/en-GB/screen.menus.html index d43b3b3a6e66a..99c559aa59dd6 100644 --- a/administrator/help/en-GB/screen.menus.html +++ b/administrator/help/en-GB/screen.menus.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Menu Manager / Main Menu and other Menus +Menu Item Manager -

    Menu Manager / Main Menu and other Menus

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Menu Item Manager

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.messages.edit.html b/administrator/help/en-GB/screen.messages.edit.html new file mode 100644 index 0000000000000..aecc6cc20dea3 --- /dev/null +++ b/administrator/help/en-GB/screen.messages.edit.html @@ -0,0 +1,14 @@ + + + +Private Messages - Edit + + + + + +

    Private Messages - Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.messages.inbox.html b/administrator/help/en-GB/screen.messages.inbox.html index dabb22244127b..4a63549a3e465 100644 --- a/administrator/help/en-GB/screen.messages.inbox.html +++ b/administrator/help/en-GB/screen.messages.inbox.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Messages Inbox +Private Messages - Inbox -

    Messages Inbox

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Private Messages - Inbox

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.messages.read.html b/administrator/help/en-GB/screen.messages.read.html new file mode 100644 index 0000000000000..4f653d291adf6 --- /dev/null +++ b/administrator/help/en-GB/screen.messages.read.html @@ -0,0 +1,14 @@ + + + +Private Messages - Read + + + + + +

    Private Messages - Read

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.modules.edit.html b/administrator/help/en-GB/screen.modules.edit.html index e7cc9b693419a..9d69b6add9508 100644 --- a/administrator/help/en-GB/screen.modules.edit.html +++ b/administrator/help/en-GB/screen.modules.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Modules: Edit +Module - Edit -

    Modules: Edit

    +

    Module - Edit

    The local copy of this help file is no longer maintained. Please use the online version.

    diff --git a/administrator/help/en-GB/screen.modules.new.html b/administrator/help/en-GB/screen.modules.new.html index c13a0bb49e4f6..eba0eb9a6c259 100644 --- a/administrator/help/en-GB/screen.modules.new.html +++ b/administrator/help/en-GB/screen.modules.new.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Modules: New +Module - New -

    Modules: New

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Module - New

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    diff --git a/administrator/help/en-GB/screen.modulesadministrator.edit.html b/administrator/help/en-GB/screen.modulesadministrator.edit.html new file mode 100644 index 0000000000000..2cfbc4af824c6 --- /dev/null +++ b/administrator/help/en-GB/screen.modulesadministrator.edit.html @@ -0,0 +1,14 @@ + + + +Modules Administrator + + + + + +

    Modules Administrator

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.modulessite.edit.html b/administrator/help/en-GB/screen.modulessite.edit.html new file mode 100644 index 0000000000000..330af3e453ee7 --- /dev/null +++ b/administrator/help/en-GB/screen.modulessite.edit.html @@ -0,0 +1,14 @@ + + + +Modules Site + + + + + +

    Modules Site

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.newsfeeds.categories.edit.html b/administrator/help/en-GB/screen.newsfeeds.categories.edit.html new file mode 100644 index 0000000000000..1f1bdd42e2a92 --- /dev/null +++ b/administrator/help/en-GB/screen.newsfeeds.categories.edit.html @@ -0,0 +1,14 @@ + + + +News Feeds Category Manager - New/Edit + + + + + +

    News Feeds Category Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.newsfeeds.categories.html b/administrator/help/en-GB/screen.newsfeeds.categories.html new file mode 100644 index 0000000000000..b6f836a89aebf --- /dev/null +++ b/administrator/help/en-GB/screen.newsfeeds.categories.html @@ -0,0 +1,14 @@ + + + +News Feeds Category Manager + + + + + +

    News Feeds Category Manager

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.newsfeeds.edit.html b/administrator/help/en-GB/screen.newsfeeds.edit.html index 85fc29f9ed463..98bac9ff9c62c 100644 --- a/administrator/help/en-GB/screen.newsfeeds.edit.html +++ b/administrator/help/en-GB/screen.newsfeeds.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -News Feeds Manager : New / Edit +News Feeds Manager - New/Edit -

    News Feeds Manager : New / Edit

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    News Feeds Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.plugins.edit.html b/administrator/help/en-GB/screen.plugins.edit.html index 354276df69b04..9ba759e68ba9f 100644 --- a/administrator/help/en-GB/screen.plugins.edit.html +++ b/administrator/help/en-GB/screen.plugins.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Plugins: New / Edit +Plugins - New/Edit -

    Plugins: New / Edit

    +

    Plugins - New/Edit

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.polls.edit.html b/administrator/help/en-GB/screen.polls.edit.html index 6cb20ade4f250..45970820b09bc 100644 --- a/administrator/help/en-GB/screen.polls.edit.html +++ b/administrator/help/en-GB/screen.polls.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Poll Manager : New / Edit +Poll Manager - New/Edit -

    Poll Manager : New / Edit

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Poll Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    - + diff --git a/administrator/help/en-GB/screen.sections.edit.html b/administrator/help/en-GB/screen.sections.edit.html index 44d87c98ff77d..570de0e8c5a02 100644 --- a/administrator/help/en-GB/screen.sections.edit.html +++ b/administrator/help/en-GB/screen.sections.edit.html @@ -2,13 +2,13 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -Sections Manager : New / Edit +Sections Manager - New/Edit -

    Sections Manager : New / Edit

    -

    The local copy of this help file is no longer maintained. Please use the online version.

    +

    Sections Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    diff --git a/administrator/help/en-GB/screen.users.html b/administrator/help/en-GB/screen.users.html new file mode 100644 index 0000000000000..ea4eef239bceb --- /dev/null +++ b/administrator/help/en-GB/screen.users.html @@ -0,0 +1,14 @@ + + + +User Manager + + + + + +

    User Manager

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.weblinks.categories.edit.html b/administrator/help/en-GB/screen.weblinks.categories.edit.html new file mode 100644 index 0000000000000..ef2475a279f70 --- /dev/null +++ b/administrator/help/en-GB/screen.weblinks.categories.edit.html @@ -0,0 +1,14 @@ + + + +Web Link Category Manager - New/Edit + + + + + +

    Web Link Category Manager - New/Edit

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/en-GB/screen.weblinks.categories.html b/administrator/help/en-GB/screen.weblinks.categories.html new file mode 100644 index 0000000000000..c1f0484d9695c --- /dev/null +++ b/administrator/help/en-GB/screen.weblinks.categories.html @@ -0,0 +1,14 @@ + + + +Web Link Category Manager + + + + + +

    Web Link Category Manager

    +

    The local copy of this help file is no longer maintained. Please use the online version.

    + + diff --git a/administrator/help/index.html b/administrator/help/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/help/index.html +++ b/administrator/help/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/images/index.html b/administrator/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/images/index.html +++ b/administrator/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/includes/js/ThemeOffice/mainmenu.png b/administrator/images/mainmenu.png similarity index 100% rename from includes/js/ThemeOffice/mainmenu.png rename to administrator/images/mainmenu.png diff --git a/administrator/includes/application.php b/administrator/includes/application.php index 992b8396f1a84..372c4e4f3ce21 100644 --- a/administrator/includes/application.php +++ b/administrator/includes/application.php @@ -1,287 +1,301 @@ -getName(), '', JURI::base(true))); - } - - /** - * Initialise the application. - * - * @access public - * @param array An optional associative array of configuration settings. - */ - function initialise($options = array()) - { - // if a language was specified it has priority - // otherwise use user or default language settings - if (empty($options['language'])) - { - $user = & JFactory::getUser(); - $lang = $user->getParam( 'admin_language' ); - - // Make sure that the user's language exists - if ( $lang && JLanguage::exists($lang) ) { - $options['language'] = $lang; - } else { - $params = JComponentHelper::getParams('com_languages'); - $client =& JApplicationHelper::getClientInfo($this->getClientId()); - $options['language'] = $params->get($client->name, 'en-GB'); - } - } - - // One last check to make sure we have something - if ( ! JLanguage::exists($options['language']) ) { - $options['language'] = 'en-GB'; - } - - parent::initialise($options); - } - - /** - * Route the application - * - * @access public - */ - function route() - { - - } - - /** - * Return a reference to the JRouter object. - * - * @access public - * @return JRouter. - * @since 1.5 - */ - function &getRouter() - { - $router =& parent::getRouter('administrator'); - return $router; - } - - /** - * Dispatch the application - * - * @access public - */ - function dispatch($component) - { - $document =& JFactory::getDocument(); - $user =& JFactory::getUser(); - - switch($document->getType()) - { - case 'html' : - { - $document->setMetaData( 'keywords', $this->getCfg('MetaKeys') ); - - if ( $user->get('id') ) { - $document->addScript( JURI::root(true).'/includes/js/joomla.javascript.js'); - } - - JHTML::_('behavior.mootools'); - } break; - - default : break; - } - - $document->setTitle( $this->getCfg('sitename' ). ' - ' .JText::_( 'Administration' )); - $document->setDescription( $this->getCfg('MetaDesc') ); - - $contents = JComponentHelper::renderComponent($component); - $document->setBuffer($contents, 'component'); - } - - /** - * Display the application. - * - * @access public - */ - function render() - { - $component = JRequest::getCmd('option'); - $template = $this->getTemplate(); - $file = JRequest::getCmd('tmpl', 'index'); - - if($component == 'com_login') { - $file = 'login'; - } - - $params = array( - 'template' => $template, - 'file' => $file.'.php', - 'directory' => JPATH_THEMES - ); - - $document =& JFactory::getDocument(); - $data = $document->render($this->getCfg('caching'), $params ); - JResponse::setBody($data); - } - - /** - * Login authentication function - * - * @param array Array( 'username' => string, 'password' => string ) - * @param array Array( 'remember' => boolean ) - * @access public - * @see JApplication::login - */ - function login($credentials, $options = array()) - { - //The minimum group - $options['group'] = 'Public Backend'; - - //Make sure users are not autoregistered - $options['autoregister'] = false; - - //Set the application login entry point - if(!array_key_exists('entry_url', $options)) { - $options['entry_url'] = JURI::base().'index.php?option=com_user&task=login'; - } - - $result = parent::login($credentials, $options); - - if(!JError::isError($result)) - { - $lang = JRequest::getCmd('lang'); - $lang = preg_replace( '/[^A-Z-]/i', '', $lang ); - $this->setUserState( 'application.lang', $lang ); - - JAdministrator::purgeMessages(); - } - - return $result; - } - - /** - * Get the template - * - * @return string The template name - * @since 1.0 - */ - function getTemplate() - { - static $template; - - if (!isset($template)) - { - // Load the template name from the database - $db =& JFactory::getDBO(); - $query = 'SELECT template' - . ' FROM #__templates_menu' - . ' WHERE client_id = 1' - . ' AND menuid = 0' - ; - $db->setQuery( $query ); - $template = $db->loadResult(); - - $template = JFilterInput::clean($template, 'cmd'); - - if (!file_exists(JPATH_THEMES.DS.$template.DS.'index.php')) { - $template = 'khepri'; - } - } - - return $template; - } - - /** - * Purge the jos_messages table of old messages - * - * static method - * @since 1.5 - */ - function purgeMessages() - { - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - $userid = $user->get('id'); - - $query = 'SELECT *' - . ' FROM #__messages_cfg' - . ' WHERE user_id = ' . (int) $userid - . ' AND cfg_name = "auto_purge"' - ; - $db->setQuery( $query ); - $config = $db->loadObject( ); - - // check if auto_purge value set - if (is_object( $config ) and $config->cfg_name == 'auto_purge' ) - { - $purge = $config->cfg_value; - } - else - { - // if no value set, default is 7 days - $purge = 7; - } - // calculation of past date - - // if purge value is not 0, then allow purging of old messages - if ($purge > 0) - { - // purge old messages at day set in message configuration - $past =& JFactory::getDate(time() - $purge * 86400); - $pastStamp = $past->toMySQL(); - - $query = 'DELETE FROM #__messages' - . ' WHERE date_time < ' . $db->Quote( $pastStamp ) - . ' AND user_id_to = ' . (int) $userid - ; - $db->setQuery( $query ); - $db->query(); - } - } - - /** - * Deprecated, use JURI::root() instead. - * - * @since 1.5 - * @deprecated As of version 1.5 - * @see JURI::root() - */ - function getSiteURL() - { - return JURI::root(); - } -} +getName(), '', JURI::base(true))); + } + + /** + * Initialise the application. + * + * @access public + * @param array An optional associative array of configuration settings. + */ + function initialise($options = array()) + { + // if a language was specified it has priority + // otherwise use user or default language settings + if (empty($options['language'])) + { + $user = & JFactory::getUser(); + $lang = $user->getParam( 'admin_language' ); + + // Make sure that the user's language exists + if ( $lang && JLanguage::exists($lang) ) { + $options['language'] = $lang; + } else { + $params = JComponentHelper::getParams('com_languages'); + $client =& JApplicationHelper::getClientInfo($this->getClientId()); + $options['language'] = $params->get($client->name, 'en-GB'); + } + } + + // One last check to make sure we have something + if ( ! JLanguage::exists($options['language']) ) { + $options['language'] = 'en-GB'; + } + + parent::initialise($options); + } + + /** + * Route the application + * + * @access public + */ + function route() + { + + } + + /** + * Return a reference to the JRouter object. + * + * @access public + * @return JRouter. + * @since 1.5 + */ + function &getRouter() + { + $router =& parent::getRouter('administrator'); + return $router; + } + + /** + * Dispatch the application + * + * @param string $component Name of component to load + * @access public + * @since 1.6 + */ + function dispatch($component = NULL) + { + $document =& JFactory::getDocument(); + $user =& JFactory::getUser(); + + // Get our component + if ($user->get('guest')) { + $component = 'com_login'; + } + + if ( ! $component ) + { + $component = JApplicationHelper::getComponentName('com_cpanel'); + } + + switch($document->getType()) + { + case 'html' : + { + $document->setMetaData( 'keywords', $this->getCfg('MetaKeys') ); + + if ( $user->get('id') ) { + $document->addScript( JURI::root(true).'/media/system/js/legacy.js'); + } + + JHTML::_('behavior.mootools'); + } break; + + default : break; + } + + $document->setTitle( htmlspecialchars_decode($this->getCfg('sitename' )). ' - ' .JText::_( 'Administration' )); + $document->setDescription( $this->getCfg('MetaDesc') ); + + $contents = JComponentHelper::renderComponent($component); + $document->setBuffer($contents, 'component'); + } + + /** + * Display the application. + * + * @access public + */ + function render() + { + $component = JRequest::getCmd('option', 'com_login'); + $template = $this->getTemplate(); + $file = JRequest::getCmd('tmpl', 'index'); + + if($component == 'com_login') { + $file = 'login'; + } + + $params = array( + 'template' => $template, + 'file' => $file.'.php', + 'directory' => JPATH_THEMES + ); + + $document =& JFactory::getDocument(); + $data = $document->render($this->getCfg('caching'), $params ); + JResponse::setBody($data); + } + + /** + * Login authentication function + * + * @param array Array( 'username' => string, 'password' => string ) + * @param array Array( 'remember' => boolean ) + * @access public + * @see JApplication::login + */ + function login($credentials, $options = array()) + { + //The minimum group + $options['group'] = 'Public Backend'; + + //Make sure users are not autoregistered + $options['autoregister'] = false; + + //Set the application login entry point + if(!array_key_exists('entry_url', $options)) { + $options['entry_url'] = JURI::base().'index.php?option=com_user&task=login'; + } + + $result = parent::login($credentials, $options); + + if(!JError::isError($result)) + { + $lang = JRequest::getCmd('lang'); + $lang = preg_replace( '/[^A-Z-]/i', '', $lang ); + $this->setUserState( 'application.lang', $lang ); + + JAdministrator::purgeMessages(); + } + + return $result; + } + + /** + * Get the template + * + * @return string The template name + * @since 1.0 + */ + function getTemplate() + { + static $template; + + if (!isset($template)) + { + // Load the template name from the database + $db =& JFactory::getDBO(); + $query = 'SELECT template' + . ' FROM #__templates_menu' + . ' WHERE client_id = 1' + . ' AND menuid = 0' + ; + $db->setQuery( $query ); + $template = $db->loadResult(); + + $template = JFilterInput::clean($template, 'cmd'); + + if (!file_exists(JPATH_THEMES.DS.$template.DS.'index.php')) { + $template = 'khepri'; + } + } + + return $template; + } + + /** + * Purge the jos_messages table of old messages + * + * static method + * @since 1.5 + */ + function purgeMessages() + { + $db =& JFactory::getDBO(); + $user =& JFactory::getUser(); + + $userid = $user->get('id'); + + $query = 'SELECT *' + . ' FROM #__messages_cfg' + . ' WHERE user_id = ' . (int) $userid + . ' AND cfg_name = "auto_purge"' + ; + $db->setQuery( $query ); + $config = $db->loadObject( ); + + // check if auto_purge value set + if (is_object( $config ) and $config->cfg_name == 'auto_purge' ) + { + $purge = $config->cfg_value; + } + else + { + // if no value set, default is 7 days + $purge = 7; + } + // calculation of past date + + // if purge value is not 0, then allow purging of old messages + if ($purge > 0) + { + // purge old messages at day set in message configuration + $past =& JFactory::getDate(time() - $purge * 86400); + $pastStamp = $past->toMySQL(); + + $query = 'DELETE FROM #__messages' + . ' WHERE date_time < ' . $db->Quote( $pastStamp ) + . ' AND user_id_to = ' . (int) $userid + ; + $db->setQuery( $query ); + $db->query(); + } + } + + /** + * Deprecated, use JURI::root() instead. + * + * @since 1.5 + * @deprecated As of version 1.5 + * @see JURI::root() + */ + function getSiteURL() + { + return JURI::root(); + } +} diff --git a/administrator/includes/framework.php b/administrator/includes/framework.php index 9302d64602e09..1e33adace1390 100644 --- a/administrator/includes/framework.php +++ b/administrator/includes/framework.php @@ -34,10 +34,10 @@ */ // System includes -require_once( JPATH_LIBRARIES .DS.'joomla'.DS.'import.php'); +require_once JPATH_LIBRARIES .DS.'joomla'.DS.'import.php'; // Pre-Load configuration -require_once( JPATH_CONFIGURATION .DS.'configuration.php' ); +require_once JPATH_CONFIGURATION .DS.'configuration.php'; // System configuration $CONFIG = new JConfig(); @@ -78,4 +78,3 @@ jimport( 'joomla.language.language'); jimport( 'joomla.utilities.string' ); -?> \ No newline at end of file diff --git a/administrator/includes/helper.php b/administrator/includes/helper.php index 44ecedb8b1512..66d81f5ce7f11 100644 --- a/administrator/includes/helper.php +++ b/administrator/includes/helper.php @@ -26,25 +26,27 @@ class JAdministratorHelper { /** * Return the application option string [main component] + * + * Use JApplicationHelper::getComponent() instead * * @access public * @return string Option - * @since 1.5 + * @since 1.5 + * @deprecated 1.6 */ function findOption() { - $option = strtolower(JRequest::getCmd('option')); + $option = NULL; - $user =& JFactory::getUser(); + $user = JFactory::getUser(); if ($user->get('guest')) { $option = 'com_login'; } - if(empty($option)) { - $option = 'com_cpanel'; + if(empty($option)) { + $option = JApplicationHelper::getComponent('com_cpanel'); } - JRequest::setVar('option', $option); return $option; } } diff --git a/administrator/includes/index.html b/administrator/includes/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/includes/index.html +++ b/administrator/includes/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/includes/js/ThemeOffice/index.html b/administrator/includes/js/ThemeOffice/index.html deleted file mode 100644 index 0e44bd0ebe788..0000000000000 --- a/administrator/includes/js/ThemeOffice/index.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/administrator/includes/js/ThemeOffice/theme.js b/administrator/includes/js/ThemeOffice/theme.js deleted file mode 100644 index 6cf00e6dab190..0000000000000 --- a/administrator/includes/js/ThemeOffice/theme.js +++ /dev/null @@ -1,45 +0,0 @@ - -// directory of where all the images are -var cmThemeOfficeBase = '../includes/js/ThemeOffice/'; - -var cmThemeOffice = -{ - // main menu display attributes - // - // Note. When the menu bar is horizontal, - // mainFolderLeft and mainFolderRight are - // put in . When the menu - // bar is vertical, they would be put in - // a separate TD cell. - - // HTML code to the left of the folder item - mainFolderLeft: ' ', - // HTML code to the right of the folder item - mainFolderRight: ' ', - // HTML code to the left of the regular item - mainItemLeft: ' ', - // HTML code to the right of the regular item - mainItemRight: ' ', - - // sub menu display attributes - - // 0, HTML code to the left of the folder item - folderLeft: '', - // 1, HTML code to the right of the folder item - folderRight: '', - // 2, HTML code to the left of the regular item - itemLeft: '', - // 3, HTML code to the right of the regular item - itemRight: '', - // 4, cell spacing for main menu - mainSpacing: 0, - // 5, cell spacing for sub menus - subSpacing: 0, - // 6, auto dispear time for submenus in milli-seconds - delay: 500 -}; - -// for horizontal menu split -var cmThemeOfficeHSplit = [_cmNoAction, '
    "; -echo "
    Trace
    "; -echo ""; - -// ----- Content header -echo ""; - -// ----- Display -$v_again=0; -for ($i=0; $i"; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; -} - -// ----- Content footer -echo "
    "; - $n = ($g_pcl_trace_entries[$i]["index"]+1)*10; - echo ""; - - echo ""; - switch ($g_pcl_trace_entries[$i]["type"]) { -case 1: - echo ""; -break; -case 2: - echo ""; -break; -case 3: -case 4: - echo ""; -break; -default: -echo ""; - } - echo "
    "; - - for ($j=0; $j<=$g_pcl_trace_entries[$i]["index"]; $j++) - { -if ($j==$g_pcl_trace_entries[$i]["index"]) -{ - if (($g_pcl_trace_entries[$i]["type"] == 1) || ($g_pcl_trace_entries[$i]["type"] == 2)) - echo ""; -} -else - echo ""; - } - //echo ""; - echo "
    +
    |
     
    ".$g_pcl_trace_entries[$i]["name"]."(".$g_pcl_trace_entries[$i]["param"].")".$g_pcl_trace_entries[$i]["name"]."()=".$g_pcl_trace_entries[$i]["param"]."
    "; - echo "".$g_pcl_trace_entries[$i]["message"].""; - echo "
    ".$g_pcl_trace_entries[$i]["name"]."(".$g_pcl_trace_entries[$i]["param"].")
    ".basename($g_pcl_trace_entries[$i]["file"])."".$g_pcl_trace_entries[$i]["line"]."
    "; - -// ----- Trace footer -echo "
    "; -echo "
    "; -echo "
     
    "; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : PclTraceAction() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - function PclTraceAction($p_entry) - { -global $g_pcl_trace_level; -global $g_pcl_trace_mode; -global $g_pcl_trace_filename; -global $g_pcl_trace_name; -global $g_pcl_trace_index; -global $g_pcl_trace_entries; - -if ($g_pcl_trace_mode == "normal") -{ - for ($i=0; $i<$p_entry["index"]; $i++) -echo "---"; - if ($p_entry["type"] == 1) -echo "".$p_entry["name"]."(".$p_entry["param"].") : ".$p_entry["message"]." [".$p_entry["file"].", ".$p_entry["line"]."]
    "; - else if ($p_entry["type"] == 2) -echo "".$p_entry["name"]."()=".$p_entry["param"]." : ".$p_entry["message"]." [".$p_entry["file"].", ".$p_entry["line"]."]
    "; - else -echo $p_entry["message"]." [".$p_entry["file"].", ".$p_entry["line"]."]
    "; -} - } - // -------------------------------------------------------------------------------- - -// ----- End of double include look -} -?> \ No newline at end of file diff --git a/administrator/includes/pcl/pclzip.lib.php b/administrator/includes/pcl/pclzip.lib.php deleted file mode 100644 index bcee984616b0b..0000000000000 --- a/administrator/includes/pcl/pclzip.lib.php +++ /dev/null @@ -1,4981 +0,0 @@ -zipname = $p_zipname; -$this->zip_fd = 0; - -// ----- 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, $p_add_dir="", $p_remove_dir="") - function create($p_filelist /*, options */) - { -//--(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_add_path = ""; -$v_remove_path = ""; -$v_remove_all_path = false; -$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' )); -if ($v_result != 1) { - //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0); - return 0; -} - -// ----- Set the arguments -if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { - $v_add_path = $v_options[PCLZIP_OPT_ADD_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]; -} - } - - // ----- 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_add_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, "add_path='$v_add_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_all_path?'true':'false')."'"); - -// ----- Look if the $p_filelist is really an array -$p_result_list = array(); -if (is_array($p_filelist)) -{ - // ----- Call the create fct - $v_result = $this->privCreate($p_filelist, $p_result_list, $v_add_path, $v_remove_path, $v_remove_all_path, $v_options); -} - -// ----- Look if the $p_filelist is a string -else if (is_string($p_filelist)) -{ - // ----- Create a list with the elements from the string - $v_list = explode(PCLZIP_SEPARATOR, $p_filelist); - - // ----- Call the create fct - $v_result = $this->privCreate($v_list, $p_result_list, $v_add_path, $v_remove_path, $v_remove_all_path, $v_options); -} - -// ----- Invalid variable -else -{ - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); - $v_result = PCLZIP_ERR_INVALID_PARAMETER; -} - -if ($v_result != 1) -{ - // ----- Return - //--(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, $p_add_dir="", $p_remove_dir="") - function add($p_filelist /* options */) - { -//--(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_add_path = ""; -$v_remove_path = ""; -$v_remove_all_path = false; -$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' )); -if ($v_result != 1) { - //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0); - return 0; -} - -// ----- Set the arguments -if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { - $v_add_path = $v_options[PCLZIP_OPT_ADD_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]; -} - } - - // ----- 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_add_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, "add_path='$v_add_path', remove_path='$v_remove_path', remove_all_path='".($v_remove_all_path?'true':'false')."'"); - -// ----- Look if the $p_filelist is really an array -$p_result_list = array(); -if (is_array($p_filelist)) -{ - // ----- Call the create fct - $v_result = $this->privAdd($p_filelist, $p_result_list, $v_add_path, $v_remove_path, $v_remove_all_path, $v_options); -} - -// ----- Look if the $p_filelist is a string -else if (is_string($p_filelist)) -{ - // ----- Create a list with the elements from the string - $v_list = explode(PCLZIP_SEPARATOR, $p_filelist); - - // ----- Call the create fct - $v_result = $this->privAdd($v_list, $p_result_list, $v_add_path, $v_remove_path, $v_remove_all_path, $v_options); -} - -// ----- Invalid variable -else -{ - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); - $v_result = PCLZIP_ERR_INVALID_PARAMETER; -} - -if ($v_result != 1) -{ - // ----- Return - //--(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($p_path="./", $p_remove_path="") - function extract(/* options */) - { -//--(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_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' )); -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 */) - { -//--(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_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' )); -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 : - // Parameters : - // None - // Options : - // PCLZIP_OPT_BY_INDEX : - // 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(/* options */) - { -//--(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 no arguments -if ($v_size <= 0) { -// ----- Error log -PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing arguments"); - -// ----- Return -//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo()); -return 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; -} - -// ----- Check that at least one rule is set -if ( (!isset($v_options[PCLZIP_OPT_BY_NAME])) -&& (!isset($v_options[PCLZIP_OPT_BY_EREG])) -&& (!isset($v_options[PCLZIP_OPT_BY_PREG])) -&& (!isset($v_options[PCLZIP_OPT_BY_INDEX]))) { -// ----- Error log -PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "At least one filtering rule must be set"); - -// ----- Return -//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo()); -return 0; -} - -// ----- Call the delete fct -$v_list = array(); -if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) -{ - unset($v_list); - //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo()); - return(0); -} - -// ----- 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(); - -// ----- Check archive -if (!$this->privCheckFormat()) { - //--(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) - { -// ----- 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) - { -//--(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'; -} - -// ----- 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' ); - -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 requested - 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; - -// ----- 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 : - // ----- 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= $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 : privCreate() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privCreate($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) - { -//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privCreate", "list, result_list, add_dir='$p_add_dir', remove_dir='$p_remove_dir'"); -$v_result=1; -$v_list_detail = array(); - -// ----- 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_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options); - -// ----- Close -$this->privCloseFd(); - -// ----- Return -//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); -return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAdd() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - function privAdd($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) - { -//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAdd", "list, result_list, add_dir='$p_add_dir', remove_dir='$p_remove_dir'"); -$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_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options); - - // ----- 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 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(); - - 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_list, $v_header_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1) -{ - fclose($v_zip_temp_fd); - $this->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($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; $iprivWriteCentralFileHeader($v_header_list[$i])) != 1) { - fclose($v_zip_temp_fd); - $this->privCloseFd(); - @unlink($v_zip_temp_name); - - // ----- 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); - - // ----- 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); - -// ----- 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) - { -//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddList", "list, add_dir='$p_add_dir', remove_dir='$p_remove_dir'"); -$v_result=1; - -// ----- Add the files -$v_header_list = array(); -if (($v_result = $this->privAddFileList($p_list, $v_header_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $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; $iprivWriteCentralFileHeader($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 : - // $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 - // run the lib 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 privAddFileList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) - { -//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFileList", "list, add_dir='$p_add_dir', remove_dir='$p_remove_dir'"); -$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 0xFF) - { -// ----- Error log -PclZip::privErrorLog(-5, "File name is too long (max. 255) : '$p_filename'"); - -// ----- Return -//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo()); -return PclZip::errorCode(); - } - */ - - // ----- Look if it is a file or a dir with no all pathnre move - if ((is_file($p_filename)) || ((is_dir($p_filename)) && !$p_remove_all_dir)) { -// ----- Add the file -if (($v_result = $this->privAddFile($p_filename, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1) -{ - // ----- Return status - //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; -} - -// ----- Store the file infos -$p_result_list[$v_nb++] = $v_header; - } - - // ----- Look for directory - if (is_dir($p_filename)) - { -//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "$p_filename is a directory"); - -// ----- Look for path -if ($p_filename != ".") - $v_path = $p_filename."/"; -else - $v_path = ""; - -// ----- Read the directory for files and sub-directories -$p_hdir = opendir($p_filename); -$p_hitem = readdir($p_hdir); // '.' directory -$p_hitem = readdir($p_hdir); // '..' directory -while (($p_hitem = readdir($p_hdir)) !== false) -{ - //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Looking for $p_hitem in the directory"); - - // ----- Look for a file - if (is_file($v_path.$p_hitem)) - { -//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Add the file '".$v_path.$p_hitem."'"); - -// ----- Add the file -if (($v_result = $this->privAddFile($v_path.$p_hitem, $v_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options)) != 1) -{ - // ----- Return status - //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); - return $v_result; -} - -// ----- Store the file infos -$p_result_list[$v_nb++] = $v_header; - } - - // ----- Recursive call to privAddFileList() - else - { -//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Add the directory '".$v_path.$p_hitem."'"); - -// ----- Need an array as parameter -$p_temp_list[0] = $v_path.$p_hitem; -$v_result = $this->privAddFileList($p_temp_list, $p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, $p_options); - -// ----- Update the number of elements of the list -$v_nb = sizeof($p_result_list); - } -} - -// ----- Free memory for the recursive loop -unset($p_temp_list); -unset($p_hdir); -unset($p_hitem); - } -} - -//--(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_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) - { -//--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::privAddFile", "filename='$p_filename', add_dir='$p_add_dir', remove_dir='$p_remove_dir'"); -$v_result=1; - -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(); -} - -// ----- 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); -} -// ----- 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, $p_filename); - if ($v_compare > 0) -// if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir) - { - -if ($v_compare == 2) { - $v_stored_filename = ""; - //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Path to remove is the current folder"); -} -else { - $v_stored_filename = substr($p_filename, strlen($p_remove_dir)); - //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "Remove path '$p_remove_dir' in file '$p_filename' = '$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); - -//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Filename (reduced) '$v_stored_filename', strlen ".strlen($v_stored_filename)); - -/* filename length moved after call-back in release 1.3 -// ----- Check the path length -if (strlen($v_stored_filename) > 0xFF) -{ - // ----- Error log - PclZip::privErrorLog(-5, "Stored file name is too long (max. 255) : '$v_stored_filename'"); - - // ----- Return - //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, PclZip::errorCode(), PclZip::errorInfo()); - return PclZip::errorCode(); -} -*/ - -// ----- 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['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)) - { -// ----- 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]) { - // ----- Read the file content - $v_content_compressed = @fread($v_file, $p_header['size']); - - // ----- Calculate the CRC - $p_header['crc'] = crc32($v_content_compressed); -} -else { - // ----- 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; - -// ----- 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 content -$v_binary_data = pack('a'.$p_header['compressed_size'], $v_content_compressed); -@fwrite($this->zip_fd, $v_binary_data, $p_header['compressed_size']); - -// ----- Close the file -@fclose($v_file); - } - - // ----- Look for a directory - else - { -// ----- Set the file properties -$p_header['filename'] .= '/'; -$p_header['filename_len']++; -$p_header['size'] = 0; -$p_header['external'] = 0x41FF0010; // 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 pre-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 : 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; - -// TBC -//for(reset($p_header); $key = key($p_header); next($p_header)) { -// //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "header[$key] = ".$p_header[$key]); -//} - -// ----- 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'], $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; - -// ----- 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) -{ - // ----- 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) -{ - //--(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'])) -{ - // ----- 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) - { -//--(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(); - -// ----- 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; - -// ----- 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) -{ - //--(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(); - - //--(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(); - -// ----- 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(); - -//--(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 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=$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; - } - - - // ----- 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(); - - // ----- 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(); -//--(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(); - -//--(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(); -//--(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(); -//--(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(); -//--(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(); - -//--(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(); - -// ----- Return -//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); -return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - 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 -// TBC - -// ----- Look for all path to remove -if ($p_remove_all_path == true) { -// ----- Get the basename of the path -$p_entry['filename'] = basename($p_entry['filename']); -} - -// ----- Look for path to remove -else if ($p_remove_path != "") -{ - //if (strcmp($p_remove_path, $p_entry['filename'])==0) - 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']; -} - -// ----- 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') { - -// ----- 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"; - -// ----- Return -////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); -//return $v_result; - } - // ----- 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"; - -// ----- Return -////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); -//return $v_result; - } - - // ----- 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 -$p_entry['status'] = "newer_exist"; - -// ----- Return -////--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); -//return $v_result; - } -} - -// ----- 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['compressed_size'] == $p_entry['size']) -{ - //--(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, "Reading '".$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); -$v_binary_data = pack('a'.$v_read_size, $v_buffer); -@fwrite($v_dest_file, $v_binary_data, $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 -{ - // ----- Trace - //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a 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"; - -//--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_result); -return $v_result; - } - - //--(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); - - // ----- 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 -// 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 -// TBC - -// ----- Trace -//--(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']) - { -// ----- Trace -//--(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 - { -// ----- Trace -//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 2, "Extracting a compressed file"); - -// ----- Reading the file -$v_data = fread($this->zip_fd, $p_entry['compressed_size']); - -// ----- Decompress the file -$p_string = gzinflate($v_data); - } - - // ----- 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['compression'] = $v_data['compression']; -//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Compression method : \''.bin2hex($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 : \''.$p_header['crc'].'\''); -$p_header['flag'] = $v_data['flag']; -//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, 'Flag : \''.$p_header['flag'].'\''); - -// ----- 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']).'\''); -} - -// ----- Other informations -//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Compression type : ".$v_data['compression']); -//--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 3, "Version : ".$v_data['version']); - -// 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 : \''.$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; - //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, 'Force folder external : \''.$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 : 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, "Fail to find the right signature"); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Fail to find the right signature"); - - // ----- 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 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=$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; - } - } - } - - // ----- 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; $izip_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 -if (($v_result = $this->privReadFileHeader($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; -} - -// ----- 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; $iprivWriteCentralFileHeader($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'"); -/* - * MODIFIED FOR JOOMLA - * @since 1.5 December 12, 2005 - */ -jimport('joomla.filesystem.folder'); -if (!JFolder::create($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 = 1; - $this->error_string = ''; -} - } - // -------------------------------------------------------------------------------- - - } - // 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 - 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] == "..") -{ - // ----- Ignore it and ignore the $i-1 - $i--; -} -else if (($v_list[$i] == "") && ($i!=(sizeof($v_list)-1)) && ($i!=0)) -{ - // ----- Ignore only the double '//' in path, - // but not the first and last '/' -} -else -{ - $v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:""); -} - } -} - -// ----- 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; - -// ----- 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."'"); - -switch ($p_option) { - case PCLZIP_OPT_PATH : -$v_result = 'PCLZIP_OPT_PATH'; - break; - case PCLZIP_OPT_ADD_PATH : -$v_result = 'PCLZIP_OPT_ADD_PATH'; - break; - case PCLZIP_OPT_REMOVE_PATH : -$v_result = 'PCLZIP_OPT_REMOVE_PATH'; - break; - case PCLZIP_OPT_REMOVE_ALL_PATH : -$v_result = 'PCLZIP_OPT_REMOVE_ALL_PATH'; - break; - case PCLZIP_OPT_EXTRACT_AS_STRING : -$v_result = 'PCLZIP_OPT_EXTRACT_AS_STRING'; - break; - case PCLZIP_OPT_SET_CHMOD : -$v_result = 'PCLZIP_OPT_SET_CHMOD'; - break; - case PCLZIP_OPT_BY_NAME : -$v_result = 'PCLZIP_OPT_BY_NAME'; - break; - case PCLZIP_OPT_BY_INDEX : -$v_result = 'PCLZIP_OPT_BY_INDEX'; - break; - case PCLZIP_OPT_BY_EREG : -$v_result = 'PCLZIP_OPT_BY_EREG'; - break; - case PCLZIP_OPT_BY_PREG : -$v_result = 'PCLZIP_OPT_BY_PREG'; - break; - - - case PCLZIP_CB_PRE_EXTRACT : -$v_result = 'PCLZIP_CB_PRE_EXTRACT'; - break; - case PCLZIP_CB_POST_EXTRACT : -$v_result = 'PCLZIP_CB_POST_EXTRACT'; - break; - case PCLZIP_CB_PRE_ADD : -$v_result = 'PCLZIP_CB_PRE_ADD'; - break; - case PCLZIP_CB_POST_ADD : -$v_result = 'PCLZIP_CB_POST_ADD'; - break; - - default : -$v_result = 'Unknown'; -} - -// ----- Return -//--(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; - } - // -------------------------------------------------------------------------------- - -?> \ No newline at end of file diff --git a/administrator/includes/pcl/zip.lib.php b/administrator/includes/pcl/zip.lib.php deleted file mode 100644 index 2e4090a66da93..0000000000000 --- a/administrator/includes/pcl/zip.lib.php +++ /dev/null @@ -1,74 +0,0 @@ - -// -// http://www.zend.com/codex.php?id=470&single=1 -// by Denis125 -// -// A patch from Peter Listiak for last modified -// date and time of the compressed file -// -// Official ZIP file format: http://www.pkware.com/appnote.txt - -class zipfile { - var $datasec = array(); - var $ctrl_dir = array(); - var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; - var $old_offset = 0; - - function unix2DosTime($unixtime = 0) { - $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime); - if ($timearray['year'] < 1980) { - $timearray['year']= 1980; - $timearray['mon'] = 1; - $timearray['mday']= 1; - $timearray['hours'] = 0; - $timearray['minutes'] = 0; - $timearray['seconds'] = 0; - } - return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); - } - - function addFile($data, $name, $time = 0) { - $name = str_replace('\\', '/', $name); - - $dtime= dechex($this->unix2DosTime($time)); - $hexdtime = '\x' . $dtime[6] . $dtime[7] . '\x' . $dtime[4] . $dtime[5] . '\x' . $dtime[2] . $dtime[3] . '\x' . $dtime[0] . $dtime[1]; - eval('$hexdtime = "' . $hexdtime . '";'); - - $fr = "\x50\x4b\x03\x04\x14\x00\x00\x00\x08\x00" . $hexdtime; - - $unc_len = strlen($data); - $crc = crc32($data); - $zdata = gzcompress($data); - $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); - $c_len = strlen($zdata); - $fr .= pack('V', $crc) . pack('V', $c_len) . pack('V', $unc_len) . pack('v', strlen($name)) . pack('v', 0) . $name . $zdata . pack('V', $crc) . pack('V', $c_len) . pack('V', $unc_len); - - $this -> datasec[] = $fr; - $new_offset = strlen(implode('', $this->datasec)); - - $cdrec = "\x50\x4b\x01\x02\x00\x00\x14\x00\x00\x00\x08\x00" . $hexdtime . pack('V', $crc) . pack('V', $c_len) . pack('V', $unc_len) . pack('v', strlen($name)) . pack('v', 0) . pack('v', 0) . pack('v', 0) . pack('v', 0) . pack('V', 32) . pack('V', $this -> old_offset ); - $this -> old_offset = $new_offset; - $cdrec .= $name; - $this -> ctrl_dir[] = $cdrec; - } - - function file() { - $data = implode('', $this -> datasec); - $ctrldir = implode('', $this -> ctrl_dir); - return $data . $ctrldir . $this -> eof_ctrl_dir . pack('v', sizeof($this -> ctrl_dir)) . pack('v', sizeof($this -> ctrl_dir)) . pack('V', strlen($ctrldir)) . pack('V', strlen($data)) . "\x00\x00"; - } -} -?> \ No newline at end of file diff --git a/administrator/includes/router.php b/administrator/includes/router.php index 10623574892c1..158fd9d6ee72e 100644 --- a/administrator/includes/router.php +++ b/administrator/includes/router.php @@ -18,7 +18,6 @@ /** * Class to create and parse routes * - * @author Johan Janssens * @package Joomla * @since 1.5 */ diff --git a/administrator/includes/toolbar.php b/administrator/includes/toolbar.php index 7bf037509d515..cec31e50a0d56 100644 --- a/administrator/includes/toolbar.php +++ b/administrator/includes/toolbar.php @@ -1,505 +1,505 @@ -\n"; - $html .= "$title\n"; - $html .= "
    \n"; - - $mainframe->set('JComponentTitle', $html); - } - - /** - * Writes a spacer cell - * @param string The width for the cell - * @since 1.0 - */ - function spacer($width = '') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a spacer - $bar->appendButton( 'Separator', 'spacer', $width ); - } - - /** - * Write a divider between menu buttons - * @since 1.0 - */ - function divider() - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a divider - $bar->appendButton( 'Separator', 'divider' ); - } - - /** - * Writes a custom option and task button for the button bar - * @param string The task to perform (picked up by the switch($task) blocks - * @param string The image to display - * @param string The image to display when moused over - * @param string The alt text for the icon image - * @param boolean True if required to check that a standard list item is checked - * @param boolean True if required to include callinh hideMainMenu() - * @since 1.0 - */ - function custom($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true, $x = false) - { - $bar = & JToolBar::getInstance('toolbar'); - - //strip extension - $icon = preg_replace('#\.[^.]*$#', '', $icon); - - // Add a standard button - $bar->appendButton( 'Standard', $icon, $alt, $task, $listSelect, $x ); - } - - /** - * Writes a custom option and task button for the button bar. - * Extended version of custom() calling hideMainMenu() before submitbutton(). - * @param string The task to perform (picked up by the switch($task) blocks - * @param string The image to display - * @param string The image to display when moused over - * @param string The alt text for the icon image - * @param boolean True if required to check that a standard list item is checked - * @since 1.0 - * (NOTE this is being deprecated) - */ - function customX($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true) - { - $bar = & JToolBar::getInstance('toolbar'); - - //strip extension - $icon = preg_replace('#\.[^.]*$#', '', $icon); - - // Add a standard button - $bar->appendButton( 'Standard', $icon, $alt, $task, $listSelect, true ); - } - - /** - * Writes a preview button for a given option (opens a popup window) - * @param string The name of the popup file (excluding the file extension) - * @since 1.0 - */ - function preview($url = '', $updateEditors = false) - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a preview button - $bar->appendButton( 'Popup', 'preview', 'Preview', "$url&task=preview" ); - } - - /** - * Writes a preview button for a given option (opens a popup window) - * @param string The name of the popup file (excluding the file extension for an xml file) - * @param boolean Use the help file in the component directory - * @since 1.0 - */ - function help($ref, $com = false) - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a help button - $bar->appendButton( 'Help', $ref, $com ); - } - - /** - * Writes a cancel button that will go back to the previous page without doing - * any other operation - * @since 1.0 - */ - function back($alt = 'Back', $href = 'javascript:history.back();') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a back button - $bar->appendButton( 'Link', 'back', $alt, $href ); - } - - /** - * Writes a media_manager button - * @param string The sub-drectory to upload the media to - * @since 1.0 - */ - function media_manager($directory = '', $alt = 'Upload') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an upload button - $bar->appendButton( 'Popup', 'upload', $alt, "index.php?option=com_media&tmpl=component&task=popupUpload&directory=$directory", 550, 80 ); - } - - /** - * Writes the common 'new' icon for the button bar - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function addNew($task = 'add', $alt = 'New') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a new button - $bar->appendButton( 'Standard', 'new', $alt, $task, false, false ); - } - - /** - * Writes the common 'new' icon for the button bar. - * Extended version of addNew() calling hideMainMenu() before submitbutton(). - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function addNewX($task = 'add', $alt = 'New') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a new button (hide menu) - $bar->appendButton( 'Standard', 'new', $alt, $task, false, true ); - } - - /** - * Writes a common 'publish' button - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function publish($task = 'publish', $alt = 'Publish') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a publish button - //$bar->appendButton( 'Publish', false, $alt, $task ); - $bar->appendButton( 'Standard', 'publish', $alt, $task, false, false ); - } - - /** - * Writes a common 'publish' button for a list of records - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function publishList($task = 'publish', $alt = 'Publish') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a publish button (list) - $bar->appendButton( 'Standard', 'publish', $alt, $task, true, false ); - } - - /** - * Writes a common 'default' button for a record - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function makeDefault($task = 'default', $alt = 'Default') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a default button - $bar->appendButton( 'Standard', 'default', $alt, $task, true, false ); - } - - /** - * Writes a common 'assign' button for a record - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function assign($task = 'assign', $alt = 'Assign') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an assign button - $bar->appendButton( 'Standard', 'assign', $alt, $task, true, false ); - } - - /** - * Writes a common 'unpublish' button - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function unpublish($task = 'unpublish', $alt = 'Unpublish') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an unpublish button - $bar->appendButton( 'Standard', 'unpublish', $alt, $task, false, false ); - } - - /** - * Writes a common 'unpublish' button for a list of records - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function unpublishList($task = 'unpublish', $alt = 'Unpublish') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an unpublish button (list) - - $bar->appendButton( 'Standard', 'unpublish', $alt, $task, true, false ); - } - - /** - * Writes a common 'archive' button for a list of records - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function archiveList($task = 'archive', $alt = 'Archive') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an archive button - $bar->appendButton( 'Standard', 'archive', $alt, $task, true, false ); - } - - /** - * Writes an unarchive button for a list of records - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function unarchiveList($task = 'unarchive', $alt = 'Unarchive') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an unarchive button (list) - $bar->appendButton( 'Standard', 'unarchive', $alt, $task, true, false ); - } - - /** - * Writes a common 'edit' button for a list of records - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function editList($task = 'edit', $alt = 'Edit') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an edit button - $bar->appendButton( 'Standard', 'edit', $alt, $task, true, false ); - } - - /** - * Writes a common 'edit' button for a list of records. - * Extended version of editList() calling hideMainMenu() before submitbutton(). - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function editListX($task = 'edit', $alt = 'Edit') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an edit button (hide) - $bar->appendButton( 'Standard', 'edit', $alt, $task, true, true ); - } - - /** - * Writes a common 'edit' button for a template html - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function editHtml($task = 'edit_source', $alt = 'Edit HTML') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an edit html button - $bar->appendButton( 'Standard', 'edithtml', $alt, $task, true, false ); - } - - /** - * Writes a common 'edit' button for a template html. - * Extended version of editHtml() calling hideMainMenu() before submitbutton(). - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function editHtmlX($task = 'edit_source', $alt = 'Edit HTML') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an edit html button (hide) - $bar->appendButton( 'Standard', 'edithtml', $alt, $task, true, true ); - } - - /** - * Writes a common 'edit' button for a template css - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function editCss($task = 'edit_css', $alt = 'Edit CSS') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an edit css button (hide) - $bar->appendButton( 'Standard', 'editcss', $alt, $task, true, false ); - } - - /** - * Writes a common 'edit' button for a template css. - * Extended version of editCss() calling hideMainMenu() before submitbutton(). - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function editCssX($task = 'edit_css', $alt = 'Edit CSS') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an edit css button (hide) - $bar->appendButton( 'Standard', 'editcss', $alt, $task, true, true ); - } - - /** - * Writes a common 'delete' button for a list of records - * @param string Postscript for the 'are you sure' message - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function deleteList($msg = '', $task = 'remove', $alt = 'Delete') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a delete button - if ($msg) { - $bar->appendButton( 'Confirm', $msg, 'delete', $alt, $task, true, false ); - } else { - $bar->appendButton( 'Standard', 'delete', $alt, $task, true, false ); - } - } - - /** - * Writes a common 'delete' button for a list of records. - * Extended version of deleteList() calling hideMainMenu() before submitbutton(). - * @param string Postscript for the 'are you sure' message - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function deleteListX($msg = '', $task = 'remove', $alt = 'Delete') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a delete button (hide) - if ($msg) { - $bar->appendButton( 'Confirm', $msg, 'delete', $alt, $task, true, true ); - } else { - $bar->appendButton( 'Standard', 'delete', $alt, $task, true, true ); - } - } - - /** - * Write a trash button that will move items to Trash Manager - * @since 1.0 - */ - function trash($task = 'remove', $alt = 'Trash', $check = true) - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a trash button - $bar->appendButton( 'Standard', 'trash', $alt, $task, $check, false ); - } - - /** - * Writes a save button for a given option - * Apply operation leads to a save action only (does not leave edit mode) - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function apply($task = 'apply', $alt = 'Apply') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add an apply button - $bar->appendButton( 'Standard', 'apply', $alt, $task, false, false ); - } - - /** - * Writes a save button for a given option - * Save operation leads to a save and then close action - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function save($task = 'save', $alt = 'Save') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a save button - $bar->appendButton( 'Standard', 'save', $alt, $task, false, false ); - } - - /** - * Writes a cancel button and invokes a cancel operation (eg a checkin) - * @param string An override for the task - * @param string An override for the alt text - * @since 1.0 - */ - function cancel($task = 'cancel', $alt = 'Cancel') - { - $bar = & JToolBar::getInstance('toolbar'); - // Add a cancel button - $bar->appendButton( 'Standard', 'cancel', $alt, $task, false, false ); - } - - /** - * Writes a configuration button and invokes a cancel operation (eg a checkin) - * @param string The name of the component, eg, com_content - * @param int The height of the popup - * @param int The width of the popup - * @param string The name of the button - * @param string An alternative path for the configuation xml relative to JPATH_SITE - * @since 1.0 - */ - function preferences($component, $height='150', $width='570', $alt = 'Preferences', $path = '') - { - $user =& JFactory::getUser(); - if ($user->get('gid') != 25) { - return; - } - - $component = urlencode( $component ); - $path = urlencode( $path ); - $bar = & JToolBar::getInstance('toolbar'); - // Add a configuration button + +jimport('joomla.html.toolbar'); + +/** +* Utility class for the button bar +* +* @package Joomla +*/ +abstract class JToolBarHelper +{ + + /** + * Title cell + * For the title and toolbar to be rendered correctly, + * this title fucntion must be called before the starttable function and the toolbars icons + * this is due to the nature of how the css has been used to postion the title in respect to the toolbar + * @param string The title + * @param string The name of the image + * @since 1.5 + */ + public static function title($title, $icon = 'generic.png') + { + $mainframe = JFactory::getApplication(); + + //strip the extension + $icon = preg_replace('#\.[^.]*$#', '', $icon); + + $html = "
    \n"; + $html .= "$title\n"; + $html .= "
    \n"; + + $mainframe->set('JComponentTitle', $html); + } + + /** + * Writes a spacer cell + * @param string The width for the cell + * @since 1.0 + */ + public static function spacer($width = '') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a spacer + $bar->appendButton( 'Separator', 'spacer', $width ); + } + + /** + * Write a divider between menu buttons + * @since 1.0 + */ + public static function divider() + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a divider + $bar->appendButton( 'Separator', 'divider' ); + } + + /** + * Writes a custom option and task button for the button bar + * @param string The task to perform (picked up by the switch($task) blocks + * @param string The image to display + * @param string The image to display when moused over + * @param string The alt text for the icon image + * @param boolean True if required to check that a standard list item is checked + * @param boolean True if required to include callinh hideMainMenu() + * @since 1.0 + */ + public static function custom($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true, $x = false) + { + $bar = & JToolBar::getInstance('toolbar'); + + //strip extension + $icon = preg_replace('#\.[^.]*$#', '', $icon); + + // Add a standard button + $bar->appendButton( 'Standard', $icon, $alt, $task, $listSelect, $x ); + } + + /** + * Writes a custom option and task button for the button bar. + * Extended version of custom() calling hideMainMenu() before submitbutton(). + * @param string The task to perform (picked up by the switch($task) blocks + * @param string The image to display + * @param string The image to display when moused over + * @param string The alt text for the icon image + * @param boolean True if required to check that a standard list item is checked + * @since 1.0 + * (NOTE this is being deprecated) + */ + public static function customX($task = '', $icon = '', $iconOver = '', $alt = '', $listSelect = true) + { + $bar = & JToolBar::getInstance('toolbar'); + + //strip extension + $icon = preg_replace('#\.[^.]*$#', '', $icon); + + // Add a standard button + $bar->appendButton( 'Standard', $icon, $alt, $task, $listSelect, true ); + } + + /** + * Writes a preview button for a given option (opens a popup window) + * @param string The name of the popup file (excluding the file extension) + * @since 1.0 + */ + public static function preview($url = '', $updateEditors = false) + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a preview button + $bar->appendButton( 'Popup', 'preview', 'Preview', "$url&task=preview" ); + } + + /** + * Writes a preview button for a given option (opens a popup window) + * @param string The name of the popup file (excluding the file extension for an xml file) + * @param boolean Use the help file in the component directory + * @since 1.0 + */ + public static function help($ref, $com = false) + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a help button + $bar->appendButton( 'Help', $ref, $com ); + } + + /** + * Writes a cancel button that will go back to the previous page without doing + * any other operation + * @since 1.0 + */ + public static function back($alt = 'Back', $href = 'javascript:history.back();') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a back button + $bar->appendButton( 'Link', 'back', $alt, $href ); + } + + /** + * Writes a media_manager button + * @param string The sub-drectory to upload the media to + * @since 1.0 + */ + public static function media_manager($directory = '', $alt = 'Upload') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an upload button + $bar->appendButton( 'Popup', 'upload', $alt, "index.php?option=com_media&tmpl=component&task=popupUpload&directory=$directory", 550, 80 ); + } + + /** + * Writes the common 'new' icon for the button bar + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function addNew($task = 'add', $alt = 'New') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a new button + $bar->appendButton( 'Standard', 'new', $alt, $task, false, false ); + } + + /** + * Writes the common 'new' icon for the button bar. + * Extended version of addNew() calling hideMainMenu() before submitbutton(). + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function addNewX($task = 'add', $alt = 'New') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a new button (hide menu) + $bar->appendButton( 'Standard', 'new', $alt, $task, false, true ); + } + + /** + * Writes a common 'publish' button + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function publish($task = 'publish', $alt = 'Publish') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a publish button + //$bar->appendButton( 'Publish', false, $alt, $task ); + $bar->appendButton( 'Standard', 'publish', $alt, $task, false, false ); + } + + /** + * Writes a common 'publish' button for a list of records + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function publishList($task = 'publish', $alt = 'Publish') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a publish button (list) + $bar->appendButton( 'Standard', 'publish', $alt, $task, true, false ); + } + + /** + * Writes a common 'default' button for a record + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function makeDefault($task = 'default', $alt = 'Default') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a default button + $bar->appendButton( 'Standard', 'default', $alt, $task, true, false ); + } + + /** + * Writes a common 'assign' button for a record + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function assign($task = 'assign', $alt = 'Assign') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an assign button + $bar->appendButton( 'Standard', 'assign', $alt, $task, true, false ); + } + + /** + * Writes a common 'unpublish' button + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function unpublish($task = 'unpublish', $alt = 'Unpublish') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an unpublish button + $bar->appendButton( 'Standard', 'unpublish', $alt, $task, false, false ); + } + + /** + * Writes a common 'unpublish' button for a list of records + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function unpublishList($task = 'unpublish', $alt = 'Unpublish') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an unpublish button (list) + + $bar->appendButton( 'Standard', 'unpublish', $alt, $task, true, false ); + } + + /** + * Writes a common 'archive' button for a list of records + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function archiveList($task = 'archive', $alt = 'Archive') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an archive button + $bar->appendButton( 'Standard', 'archive', $alt, $task, true, false ); + } + + /** + * Writes an unarchive button for a list of records + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function unarchiveList($task = 'unarchive', $alt = 'Unarchive') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an unarchive button (list) + $bar->appendButton( 'Standard', 'unarchive', $alt, $task, true, false ); + } + + /** + * Writes a common 'edit' button for a list of records + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function editList($task = 'edit', $alt = 'Edit') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an edit button + $bar->appendButton( 'Standard', 'edit', $alt, $task, true, false ); + } + + /** + * Writes a common 'edit' button for a list of records. + * Extended version of editList() calling hideMainMenu() before submitbutton(). + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function editListX($task = 'edit', $alt = 'Edit') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an edit button (hide) + $bar->appendButton( 'Standard', 'edit', $alt, $task, true, true ); + } + + /** + * Writes a common 'edit' button for a template html + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function editHtml($task = 'edit_source', $alt = 'Edit HTML') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an edit html button + $bar->appendButton( 'Standard', 'edithtml', $alt, $task, true, false ); + } + + /** + * Writes a common 'edit' button for a template html. + * Extended version of editHtml() calling hideMainMenu() before submitbutton(). + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function editHtmlX($task = 'edit_source', $alt = 'Edit HTML') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an edit html button (hide) + $bar->appendButton( 'Standard', 'edithtml', $alt, $task, true, true ); + } + + /** + * Writes a common 'edit' button for a template css + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function editCss($task = 'edit_css', $alt = 'Edit CSS') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an edit css button (hide) + $bar->appendButton( 'Standard', 'editcss', $alt, $task, true, false ); + } + + /** + * Writes a common 'edit' button for a template css. + * Extended version of editCss() calling hideMainMenu() before submitbutton(). + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function editCssX($task = 'edit_css', $alt = 'Edit CSS') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an edit css button (hide) + $bar->appendButton( 'Standard', 'editcss', $alt, $task, true, true ); + } + + /** + * Writes a common 'delete' button for a list of records + * @param string Postscript for the 'are you sure' message + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function deleteList($msg = '', $task = 'remove', $alt = 'Delete') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a delete button + if ($msg) { + $bar->appendButton( 'Confirm', $msg, 'delete', $alt, $task, true, false ); + } else { + $bar->appendButton( 'Standard', 'delete', $alt, $task, true, false ); + } + } + + /** + * Writes a common 'delete' button for a list of records. + * Extended version of deleteList() calling hideMainMenu() before submitbutton(). + * @param string Postscript for the 'are you sure' message + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function deleteListX($msg = '', $task = 'remove', $alt = 'Delete') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a delete button (hide) + if ($msg) { + $bar->appendButton( 'Confirm', $msg, 'delete', $alt, $task, true, true ); + } else { + $bar->appendButton( 'Standard', 'delete', $alt, $task, true, true ); + } + } + + /** + * Write a trash button that will move items to Trash Manager + * @since 1.0 + */ + public static function trash($task = 'remove', $alt = 'Trash', $check = true) + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a trash button + $bar->appendButton( 'Standard', 'trash', $alt, $task, $check, false ); + } + + /** + * Writes a save button for a given option + * Apply operation leads to a save action only (does not leave edit mode) + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function apply($task = 'apply', $alt = 'Apply') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add an apply button + $bar->appendButton( 'Standard', 'apply', $alt, $task, false, false ); + } + + /** + * Writes a save button for a given option + * Save operation leads to a save and then close action + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function save($task = 'save', $alt = 'Save') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a save button + $bar->appendButton( 'Standard', 'save', $alt, $task, false, false ); + } + + /** + * Writes a cancel button and invokes a cancel operation (eg a checkin) + * @param string An override for the task + * @param string An override for the alt text + * @since 1.0 + */ + public static function cancel($task = 'cancel', $alt = 'Cancel') + { + $bar = & JToolBar::getInstance('toolbar'); + // Add a cancel button + $bar->appendButton( 'Standard', 'cancel', $alt, $task, false, false ); + } + + /** + * Writes a configuration button and invokes a cancel operation (eg a checkin) + * @param string The name of the component, eg, com_content + * @param int The height of the popup + * @param int The width of the popup + * @param string The name of the button + * @param string An alternative path for the configuation xml relative to JPATH_SITE + * @since 1.0 + */ + public static function preferences($component, $height='150', $width='570', $alt = 'Preferences', $path = '') + { + $user =& JFactory::getUser(); + if ($user->get('gid') != 25) { + return; + } + + $component = urlencode( $component ); + $path = urlencode( $path ); + $bar = & JToolBar::getInstance('toolbar'); + // Add a configuration button $bar->appendButton( 'Popup', 'config', $alt, 'index.php?option=com_config&controller=component&component='.$component.'&path='.$path, $width, $height ); - } -} - -/** -* Utility class for the submenu -* -* @package Joomla -*/ -class JSubMenuHelper -{ - function addEntry($name, $link = '', $active = false) - { - $menu = &JToolBar::getInstance('submenu'); - $menu->appendButton($name, $link, $active); - } -} + } +} + +/** +* Utility class for the submenu +* +* @package Joomla +*/ +abstract class JSubMenuHelper +{ + public static function addEntry($name, $link = '', $active = false) + { + $menu = &JToolBar::getInstance('submenu'); + $menu->appendButton($name, $link, $active); + } +} ?> diff --git a/administrator/index.php b/administrator/index.php index 8120329d3660b..ec98a7f3ed2ce 100644 --- a/administrator/index.php +++ b/administrator/index.php @@ -18,10 +18,10 @@ define('DS', DIRECTORY_SEPARATOR); -require_once( JPATH_BASE .DS.'includes'.DS.'defines.php' ); -require_once( JPATH_BASE .DS.'includes'.DS.'framework.php' ); -require_once( JPATH_BASE .DS.'includes'.DS.'helper.php' ); -require_once( JPATH_BASE .DS.'includes'.DS.'toolbar.php' ); +require_once JPATH_BASE .DS.'includes'.DS.'defines.php'; +require_once JPATH_BASE .DS.'includes'.DS.'framework.php'; +require_once JPATH_BASE .DS.'includes'.DS.'helper.php'; +require_once JPATH_BASE .DS.'includes'.DS.'toolbar.php'; JDEBUG ? $_PROFILER->mark( 'afterLoad' ) : null; @@ -62,9 +62,9 @@ * DISPATCH THE APPLICATION * * NOTE : - */ -$option = JAdministratorHelper::findOption(); -$mainframe->dispatch($option); + */ + +$mainframe->dispatch(); // trigger the onAfterDispatch events JDEBUG ? $_PROFILER->mark('afterDispatch') : null; @@ -85,4 +85,3 @@ * RETURN THE RESPONSE */ echo JResponse::toString($mainframe->getCfg('gzip')); -?> \ No newline at end of file diff --git a/administrator/index2.php b/administrator/index2.php deleted file mode 100644 index 86f8fc24583a0..0000000000000 --- a/administrator/index2.php +++ /dev/null @@ -1,15 +0,0 @@ - \ No newline at end of file diff --git a/administrator/index3.php b/administrator/index3.php deleted file mode 100644 index 5afd5283f197a..0000000000000 --- a/administrator/index3.php +++ /dev/null @@ -1,16 +0,0 @@ - \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.com_acl.ini b/administrator/language/en-GB/en-GB.com_acl.ini new file mode 100644 index 0000000000000..5ae2d6b68ad4a --- /dev/null +++ b/administrator/language/en-GB/en-GB.com_acl.ini @@ -0,0 +1,82 @@ +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ACCESS CONTROL: RULES=Access Control: Rules + +ACL COL ALLOWED=Allowed +ACL COL APPLIES TO ITEMS=Applies to Items +ACL COL ENABLED=Enabled +ACL COL LEVEL NAME=Access Level Name +ACL COL LEVEL VALUE=Value +ACL COL NOTE=Note +ACL COL PERMISSIONS=Have Permissions +ACL COL USER GROUPS=User Groups +ACL COL APPLIES TO LEVELS=Applies to Access Levels + +ACL NEW RULE=New Rule +CLICK TO TOGGLE SETTING=Click to toggle setting + +COL ID=ID +SEARCH CLEAR=Clear +SEARCH GO=Go +SEARCH IN NOTE=Search in note + + +ACCESS CONTROL: ACCESS LEVELS=Access Control: Access Levels +ACCESS CONTROL: USER GROUPS=Access Control: User Groups +ACCESS CONTROL: ADD GROUP=Access Control: Add Group +ACCESS CONTROL: EDIT GROUP=Access Control: Edit Group +ACCESS CONTROL: ADD LEVEL=Access Control: Add Level +ACCESS CONTROL: EDIT LEVEL=Access Control: Edit Level + +# +# Note: when we decide on 'type' names, do not change the keys, just the value +# +ACCESS CONTROL: ADD RULE TYPE 1=Access Control: Add Rule Type 1 +ACCESS CONTROL: ADD RULE TYPE 2=Access Control: Add Rule Type 2 +ACCESS CONTROL: ADD RULE TYPE 3=Access Control: Add Rule Type 3 +ACCESS CONTROL: EDIT RULE TYPE 1=Access Control: Edit Rule Type 1 +ACCESS CONTROL: EDIT RULE TYPE 2=Access Control: Edit Rule Type 2 +ACCESS CONTROL: EDIT RULE TYPE 3=Access Control: Edit Rule Type 3 +ACCESS CONTROL: RULES TYPE 1=Access Control: Rules Type 1 +ACCESS CONTROL: RULES TYPE 2=Access Control: Rules Type 2 +ACCESS CONTROL: RULES TYPE 3=Access Control: Rules Type 3 + +ACL ALLOW=Allow +ACL APPLY PERMISSIONS=Step 2: Select Permissions to Apply +ACL APPLY USER GROUPS=Step 1: Select User Groups +ACL APPLY TO ACCESS GROUPS=Step 3: Select Access Levels that Apply +ACL APPLY TO ITEMS=Step 3: Select Items that Apply +ACL ENABLED=Enabled +ACL NOTE=Note +ACL RETURN VALUE=Return Value +ACL SECTION=Section +ACL UPDATED DATE=Updated Date +RECORD #%D=Record #%d + + +ACL COL GROUP NAME=Group Name +ACL COL USERS IN GROUP=Users In Group +ACL LEFT ID RIGHT ID=Left ID:%d, Right ID:%d +ACL SEARCH IN NAME=Search in name + +ACL LINK ACCESS LEVELS=Access Levels +ACL LINK USER GROUPS=User Groups +ACL LINK RULES TYPE 1=Rules Type 1 +ACL LINK RULES TYPE 2=Rules Type 2 +ACL LINK RULES TYPE 3=Rules Type 3 + +ACL GROUP ALIAS=Group Alias +ACL GROUP NAME=Group Name +ACL PARENT GROUP=Parent Group + + + +ACL LEVEL NAME=ACL Level Name + +ACL RULES TYPE 1 DESC=Type 1 Rules allow you to perform certain actions on certain things (for example to Manage the Banners Component). Type 1 Rules are inherited by child groups (for example, any permission that a Manager is allowed, so to is an Administrator automatically allowed the same permission). +ACL RULES TYPE 2 DESC=Type 2 Rules allow you to specify certain actions on various items (for example, you can specify that users in the Author Group can Add articles in the News Category). NOTE: Type 2 Rules are inherited by child groups. +ACL RULES TYPE 3 DESC=Type 3 Rules allow you to specify certain actions on various Access Levels (for example, you can specify that users in the Registered Group can View articles in both Public and Registered Access levels). NOTE: Type 3 Rules are not inherited by child groups. Also NOTE that by default, Public Users can view all Public Content (no need to define that rule). diff --git a/administrator/language/en-GB/en-GB.com_admin.ini b/administrator/language/en-GB/en-GB.com_admin.ini index 2c888fe53bd1d..bcfa82ec4754e 100644 --- a/administrator/language/en-GB/en-GB.com_admin.ini +++ b/administrator/language/en-GB/en-GB.com_admin.ini @@ -1,55 +1,55 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -CACHE DIRECTORY=Cache Directory -CHANGELOG=Changelog -CLEAR RESULTS=Clear Results -CONFIGURATION FILE=Configuration File -CONTROL PANEL=Control Panel -CREDITS=Credits -DATABASE COLLATION=Database Collation -DATABASE VERSION=Database Version -DESCDIRWRITABLE=For all Joomla! functions and features to work properly, all of the following directories should be writable: -DIRECTORY=Directory -DISABLED FUNCTIONS=Disabled Functions -DISPLAY ERRORS=Display Errors -FILE UPLOADS=File Uploads -GLOSSARY=Glossary -ICONV AVAILABLE=Iconv Available -INDEX=Index -INFORMATION=Information -LATEST VERSION CHECK=Latest Version Check -LICENSE=License -MAGIC QUOTES=Magic Quotes -MBSTRING ENABLED=Mbstring Enabled -JOOMLA! VERSION=Joomla! Version -OPEN BASEDIR=Open basedir -OPEN IN NEW WINDOW=Open in new Window -OUTPUT BUFFERING=Output Buffering -PHP BUILT ON=PHP Built on -PHP INFO=PHP Info -PHP INFORMATION=PHP Information -PHP SETTINGS=PHP Settings -PHP VERSION=PHP Version -REGISTER GLOBALS=Register Globals -RELEVANT PHP SETTINGS=Relevant PHP Settings -SAFE MODE=Safe Mode -SESSION AUTO START=Session Auto Start -SESSION SAVE PATH=Session Save Path -SETTING=Setting -SHORT OPEN TAGS=Short Open Tags -SITE PREVIEW=Site Preview -STATUS=Status -SUPPORT=Support -SYSTEM INFO=System Info -SYSTEM INFORMATION=System Information -USER AGENT=User Agent -VALUE=Value -WEB SERVER=Web Server -WEBSERVER TO PHP INTERFACE=Web Server to PHP interface -WYSIWYG EDITOR=WYSIWYG Editor -XML ENABLED=XML Enabled -ZLIB ENABLED=Zlib Enabled +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CACHE DIRECTORY=Cache Directory +CHANGELOG=Changelog +CLEAR RESULTS=Clear Results +CONFIGURATION FILE=Configuration File +CONTROL PANEL=Control Panel +CREDITS=Credits +DATABASE COLLATION=Database Collation +DATABASE VERSION=Database Version +DESCDIRWRITABLE=For all Joomla! functions and features to work properly, all of the following directories should be writable: +DIRECTORY=Directory +DISABLED FUNCTIONS=Disabled Functions +DISPLAY ERRORS=Display Errors +FILE UPLOADS=File Uploads +GLOSSARY=Glossary +ICONV AVAILABLE=Iconv Available +INDEX=Index +INFORMATION=Information +LATEST VERSION CHECK=Latest Version Check +LICENSE=License +MAGIC QUOTES=Magic Quotes +MBSTRING ENABLED=Mbstring Enabled +JOOMLA! VERSION=Joomla! Version +OPEN BASEDIR=Open basedir +OPEN IN NEW WINDOW=Open in new Window +OUTPUT BUFFERING=Output Buffering +PHP BUILT ON=PHP Built on +PHP INFO=PHP Info +PHP INFORMATION=PHP Information +PHP SETTINGS=PHP Settings +PHP VERSION=PHP Version +REGISTER GLOBALS=Register Globals +RELEVANT PHP SETTINGS=Relevant PHP Settings +SAFE MODE=Safe Mode +SESSION AUTO START=Session Auto Start +SESSION SAVE PATH=Session Save Path +SETTING=Setting +SHORT OPEN TAGS=Short Open Tags +SITE PREVIEW=Site Preview +STATUS=Status +SUPPORT=Support +SYSTEM INFO=System Info +SYSTEM INFORMATION=System Information +USER AGENT=User Agent +VALUE=Value +WEB SERVER=Web Server +WEBSERVER TO PHP INTERFACE=Web Server to PHP interface +WYSIWYG EDITOR=WYSIWYG Editor +XML ENABLED=XML Enabled +ZLIB ENABLED=Zlib Enabled diff --git a/administrator/language/en-GB/en-GB.com_banners.ini b/administrator/language/en-GB/en-GB.com_banners.ini index 3de675b225aac..36344a36e1fd5 100644 --- a/administrator/language/en-GB/en-GB.com_banners.ini +++ b/administrator/language/en-GB/en-GB.com_banners.ini @@ -1,58 +1,59 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -BANNER=Banner -BANNER CLIENT=Banner Client -BANNER CLIENT MANAGER=Banner Client Manager -BANNER IMAGE=Banner Image -BANNER MANAGER=Banner Manager -BANNER NAME=Banner Name -BANNER IMAGE SELECTOR=Banner Image Selector -CLEAR RESULTS=Clear Results -CLICK URL=Click URL -CLICKS=Clicks -CLIENT=Client -CLIENT NAME=Client Name -CLIENTS=Clients -CONTACT EMAIL=Contact E-mail -CONTACT NAME=Contact Name -CUSTOM BANNER CODE=Custom Banner Code -DESCRIPTION/NOTES=Description/Notes -EXTRA INFO=Extra Information -IMPRESSIONS=Impressions -IMPRESSIONS LEFT=Impressions Left -IMPRESSIONS MADE=Impressions Made -IMPRESSIONS PURCHASED=Impressions Purchased -LATEST VERSION CHECK=Latest Version Check -NO. OF ACTIVE BANNERS=# Banners -PLEASE FILL IN THE CLIENT NAME.=Please fill in the Client Name. -PLEASE FILL IN THE CONTACT EMAIL.=Please fill in the Contact E-mail. -PLEASE FILL IN THE CONTACT NAME.=Please fill in the Contact Name. -PLEASE FILL IN THE URL FOR THE BANNER.=Please fill in the URL for the Banner. -PLEASE PROVIDE A VALID CONTACT EMAIL.=Please provide a valid Contact E-mail. -PLEASE SELECT A CLIENT.=Please select a Client. -PLEASE SELECT AN IMAGE.=Please select an image. -RESET BANNER CLICKS=Reset Banner Clicks -RESET CLICKS=Reset Clicks -SELECT CLIENT=Select Client -SHOW BANNER=Show Banner -STICKY=Sticky -TAGS=Tags -TAG PREFIX=Tag Prefix -THE CLIENT=The Client -THIS COMPONENT MANAGES BANNERS AND BANNER CLIENTS=This Component manages Banners and Banner Clients. -TAG PREFIX LABEL=Tag Prefix -TAG PREFIX DESC=When matching Tags, only search for Tags with this prefix (improves performance). -TRACK BANNER IMPRESSION DESC=Record the Impressions (views) of the Banners on a daily basis. -TRACK BANNER IMPRESSION LABEL=Track Banner Impression Times -TRACK BANNER CLICK DESC=Record the number of Clicks on the Banners on a daily basis. -TRACK BANNER CLICK LABEL=Track Banner Click Times -UNLIMITED=Unlimited -WARNCANNOTDELCLIENTBANNER=Cannot currently delete this Client as they have an active Banner. -WARNEDITEDBYPERSON=The Client [ %s ] is currently being edited by another person. -YES=Yes -YOU MUST PROVIDE A BANNER NAME.=You must provide a Banner Name. -FILTER RESET=Reset +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +BANNER=Banner +BANNER CLIENT=Banner Client +BANNER CLIENT MANAGER=Banner Client Manager +BANNER IMAGE=Banner Image +BANNER MANAGER=Banner Manager +BANNER NAME=Banner Name +BANNER IMAGE SELECTOR=Banner Image Selector +CLEAR RESULTS=Clear Results +CLICK URL=Click URL +CLICKS=Clicks +CLIENT=Client +CLIENT NAME=Client Name +CLIENTS=Clients +CONTACT EMAIL=Contact E-mail +CONTACT NAME=Contact Name +CUSTOM BANNER CODE=Custom Banner Code +DESCRIPTION/NOTES=Description/Notes +EXTRA INFO=Extra Information +HEIGHT=Height +IMPRESSIONS=Impressions +IMPRESSIONS LEFT=Impressions Left +IMPRESSIONS MADE=Impressions Made +IMPRESSIONS PURCHASED=Impressions Purchased +LATEST VERSION CHECK=Latest Version Check +NO. OF ACTIVE BANNERS=# Banners +PLEASE FILL IN THE CLIENT NAME.=Please fill in the Client Name. +PLEASE FILL IN THE CONTACT EMAIL.=Please fill in the Contact E-mail. +PLEASE FILL IN THE CONTACT NAME.=Please fill in the Contact Name. +PLEASE FILL IN THE URL FOR THE BANNER.=Please fill in the URL for the Banner. +PLEASE PROVIDE A VALID CONTACT EMAIL.=Please provide a valid Contact E-mail. +PLEASE SELECT A CLIENT.=Please select a Client. +PLEASE SELECT AN IMAGE.=Please select an image. +RESET BANNER CLICKS=Reset Banner Clicks +RESET CLICKS=Reset Clicks +SELECT CLIENT=Select Client +SHOW BANNER=Show Banner +STICKY=Sticky +TAGS=Tags +TAG PREFIX=Tag Prefix +THE CLIENT=The Client +THIS COMPONENT MANAGES BANNERS AND BANNER CLIENTS=This Component manages Banners and Banner Clients. +TAG PREFIX LABEL=Tag Prefix +TAG PREFIX DESC=When matching Tags, only search for Tags with this prefix (improves performance). +TRACK BANNER IMPRESSION DESC=Record the Impressions (views) of the Banners on a daily basis. +TRACK BANNER IMPRESSION LABEL=Track Banner Impression Times +TRACK BANNER CLICK DESC=Record the number of Clicks on the Banners on a daily basis. +TRACK BANNER CLICK LABEL=Track Banner Click Times +UNLIMITED=Unlimited +WARNCANNOTDELCLIENTBANNER=Cannot currently delete this Client as they have an active Banner. +WARNEDITEDBYPERSON=The Client [ %s ] is currently being edited by another person. +YES=Yes +YOU MUST PROVIDE A BANNER NAME.=You must provide a Banner Name. +FILTER RESET=Reset diff --git a/administrator/language/en-GB/en-GB.com_banners.menu.ini b/administrator/language/en-GB/en-GB.com_banners.menu.ini index e44094ed34c73..b1eb6abb5927c 100644 --- a/administrator/language/en-GB/en-GB.com_banners.menu.ini +++ b/administrator/language/en-GB/en-GB.com_banners.menu.ini @@ -1,10 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -COM_BANNERS=Banner -COM_BANNERS.BANNERS=Banners -COM_BANNERS.CLIENTS=Clients -COM_BANNERS.CATEGORIES=Categories +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +COM_BANNERS=Banner +COM_BANNERS.BANNERS=Banners +COM_BANNERS.CLIENTS=Clients +COM_BANNERS.CATEGORIES=Categories diff --git a/administrator/language/en-GB/en-GB.com_cache.ini b/administrator/language/en-GB/en-GB.com_cache.ini index 466488df78d9e..ff030ae0ac842 100644 --- a/administrator/language/en-GB/en-GB.com_cache.ini +++ b/administrator/language/en-GB/en-GB.com_cache.ini @@ -1,15 +1,15 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -CACHE MANAGER=Cache Manager -CACHE DIRECTORY IS UNWRITABLE=Cache directory is unwritable -CACHE DIRECTORY IS WRITABLE=Cache directory is writable -NUM=# -CACHE GROUP=Cache Group -NUMBER OF FILES=Number of Files -SIZE=Size -WRITABLE=Writable -UNWRITABLE=Unwritable +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CACHE MANAGER=Cache Manager +CACHE DIRECTORY IS UNWRITABLE=Cache directory is unwritable. +CACHE DIRECTORY IS WRITABLE=Cache directory is writable. +NUM=# +CACHE GROUP=Cache Group +NUMBER OF FILES=Number of Files +SIZE=Size +WRITABLE=Writable +UNWRITABLE=Unwritable diff --git a/administrator/language/en-GB/en-GB.com_categories.ini b/administrator/language/en-GB/en-GB.com_categories.ini index d0ae448544f28..7a1406480f945 100644 --- a/administrator/language/en-GB/en-GB.com_categories.ini +++ b/administrator/language/en-GB/en-GB.com_categories.ini @@ -13,7 +13,7 @@ ALL CONTENT:=All Content: AND ALL THE ITEMS WITHIN THE CATEGORY (ALSO LISTED)=and all the Articles within each Category (also listed) ARTICLES BEING MOVED=Articles being moved ARTICLES BEING COPIED=Articles being copied -A SHORT NAME TO APPEAR IN MENUS=A short name - ideally without spaces; use a dash "-" or underscore "_" instead - used to create Search Engine Friendly (SEF) URL's. If you do happen to leave spaces in, Joomla! will replace them with %20 (which is not very user-friendly). +A SHORT NAME TO APPEAR IN MENUS=A short name; ideally without spaces. Use a dash "-" or underscore "_" instead - used to create Search Engine Friendly (SEF) URL's. If you do happen to leave spaces in, Joomla! will replace them with %20 (which is not user friendly). BACK TO=Back to CATEGORIES ALREADY IN=Categories %s are already in %s CATEGORIES BEING COPIED=Categories being copied @@ -49,7 +49,7 @@ CONTENT: ALL=Content: All COPY CATEGORY=Copy Category COPY OF=Copy of %s COPY TO SECTION=Copy to Section -DESCNEWITEMSLAST=New Categories default to the last place. Ordering can be changed after this Category is saved. +DESCNEWITEMSLAST=New Categories default to the last position. Ordering can be changed after this Category is saved. IMAGE POSITION=Image Position MOVE CATEGORY=Move Category MOVE TO SECTION=Move to Section @@ -76,12 +76,12 @@ SELECT AN ITEM TO MOVE=Select a Category to move SELECT TYPE=Select Type SELECT A SECTION=Select a Section THE CATEGORY=The Category -THIS WILL MOVE THE CATEGORIES LISTED=This will move the Category(s) listed +THIS WILL MOVE THE CATEGORIES LISTED=This will move the Category(ies) listed THERE ARE NO CATEGORIES=There are no Categories TO THE SELECTED SECTION=to the selected Section -UNCATEGORIZED=Uncategorized +UNCATEGORIZED=Uncategorised UNPUBLISH ITEM=Unpublish this Category -WARNNOTREMOVEDRECORDS=Category(s): %s cannot be removed as they contain Articles. There may currently be Articles within the Article Trash Manager which you must delete first. +WARNNOTREMOVEDRECORDS=Category(ies): %s cannot be removed as they contain Articles. There may currently be Articles within the Article Trash Manager which you must delete first. WEB LINKS CATEGORIES=Web Links Categories WEB LINKS MANAGER=Web Links Manager WEBLINK CATEGORY TABLE=Web Link Category Table diff --git a/administrator/language/en-GB/en-GB.com_checkin.ini b/administrator/language/en-GB/en-GB.com_checkin.ini index a4df567d92902..3c8c97a97759d 100644 --- a/administrator/language/en-GB/en-GB.com_checkin.ini +++ b/administrator/language/en-GB/en-GB.com_checkin.ini @@ -1,15 +1,15 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -CHECKED-IN=Checked in -CHECKED OUT ITEMS HAVE NOW BEEN ALL CHECKED IN=All checked out Items have now been checked in. -CHECKING TABLE=Checking table -DATABASE TABLE=Database table -DESCITEMCHECKEDIN=All checked out Items have now been checked in. -GLOBAL CHECK-IN=Global Check-in -ITEMS=Items -NUM OF ITEMS=# of Items +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CHECKED-IN=Checked in +CHECKED OUT ITEMS HAVE NOW BEEN ALL CHECKED IN=All checked out Items have now been checked in. +CHECKING TABLE=Checking table +DATABASE TABLE=Database table +DESCITEMCHECKEDIN=All checked out Items have now been checked in. +GLOBAL CHECK-IN=Global Check-in +ITEMS=Items +NUM OF ITEMS=# of Items TICK=Tick \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.com_config.ini b/administrator/language/en-GB/en-GB.com_config.ini index c405db20c0a37..8c7730c8dbb58 100644 --- a/administrator/language/en-GB/en-GB.com_config.ini +++ b/administrator/language/en-GB/en-GB.com_config.ini @@ -14,8 +14,8 @@ CACHE HANDLER=Cache Handler CACHE SETTINGS=Cache Settings CACHE TIME=Cache Time CACHING=Caching -COMPRESS BUFFERED OUTPUT IF SUPPORTED=Compress buffered output if supported -COULD NOT MAKE CONFIGURATION.PHP WRITABLE=Could not make configuration.php writable +COMPRESS BUFFERED OUTPUT IF SUPPORTED=Compress buffered output if supported. +COULD NOT MAKE CONFIGURATION.PHP WRITABLE=Could not make configuration.php writable. CREATED DATE AND TIME=Created Date and Time DATABASE=Database DATABASE PREFIX=Database Prefix @@ -65,13 +65,13 @@ INTRO TEXT=Intro Text ITEM RATING/VOTING=Article Rating/Voting JCLIENTHELPER::SETCREDENTIALSFROMREQUEST FAILED=Unable to connect to the server with the given credentials. LEGAL EXTENSIONS LABEL=Legal Extensions (File Types) -LEGAL EXTENSIONS DESC= Extensions (File Types) for the files you allow to be uploaded, comma separated. +LEGAL EXTENSIONS DESC= Extensions (File Types) for the files you allow to be uploaded (comma separated). LEGAL IMAGE EXTENSIONS LABEL=Legal Image Extensions (File Types) -LEGAL IMAGE EXTENSIONS DESC=Image Extensions (File Types) you are allowed to upload, comma separated. These are used to check for valid image headers. +LEGAL IMAGE EXTENSIONS DESC=Image Extensions (File Types) you are allowed to upload (comma separated). These are used to check for valid image headers. RESTRICT UPLOADS=Restrict Uploads RESTRICT UPLOADS DESC=Restrict uploads for lower than manager users to just images if Fileinfo or MIME Magic isn't installed. CHECK MIME=Check MIME Types -CHECK MIME DESC=Use MIME Magic or Fileinfo to attempt to verify files. Disable this if you get invalid mime type errors +CHECK MIME DESC=Use MIME Magic or Fileinfo to attempt to verify files. Disable this if you get invalid mime type errors. IGNORED EXTENSIONS LABEL=Ignored Extensions IGNORED EXTENSIONS DESC=Ignored file extensions for MIME type checking and restricted uploads LEGAL MIME TYPES LABEL=Legal MIME Types @@ -99,11 +99,11 @@ PATH TO IMAGE FOLDER=Path to Image Folder PATH TO FILE FOLDER=Path to Media Folder PDF ICON=PDF Icon PHP MAIL FUNCTION=PHP Mail Function -READ MORE LINK=Read more... Link +READ MORE LINK=Read more...link REFRESH=Refresh RSS=RSS SEARCH ENGINE FRIENDLY URLS=Search Engine Friendly URLs -SEARCH ENGINE OPTIMIZATION SETTINGS=Select whether the URLs are optimized for Search Engines +SEARCH ENGINE OPTIMIZATION SETTINGS=Select whether or not the URLs are optimised for Search Engines. SECRET WORD=Secret Word SENDMAIL=Sendmail SENDMAIL PATH=Sendmail Path @@ -117,7 +117,7 @@ SESSION SETTINGS=Session Settings SHOW AUTHOR META TAG=Show Author Meta Tag SHOW THE MOST RECENT=Show the most recent SHOW TITLE META TAG=Show Title Meta Tag -SHOW UNAUTHORIZED LINKS=Show Unauthorized Links +SHOW UNAUTHORIZED LINKS=Show Unauthorised Links SIMPLE=Simple SITE NAME=Site Name SITE OFFLINE=Site Offline @@ -132,71 +132,71 @@ SYSTEM=System SYSTEM DEFAULT=System Default SYSTEM SETTINGS=System Settings THE CONFIGURATION DETAILS HAVE BEEN UPDATED=The Global Configuration details have been updated. -TIPALLOWUSERREG=If set to Yes, new Users allowed to self-register -TIPAUTOLOGOUTTIMEOF=Auto Logout a User after they have been inactive for the entered number of minutes. Do not set too high. -TIPCACHETIME=The maximum length of time, in minutes, for a cache file to be stored before it is refreshed. +TIPALLOWUSERREG=If set to Yes, new Users allowed to self-register. +TIPAUTOLOGOUTTIMEOF=Auto log out a User after they have been inactive for the entered number of minutes. Do not set too high. +TIPCACHETIME=The maximum length of time in minutes for a cache file to be stored before it is refreshed. TIPCACHE=Select whether the cache is enabled or not. TIPCACHEHANDLER=The default caching mechanism is file-based. TIPDATETIMEDISPLAY=Current date and time configured to display -TIPDATABASEHOSTNAME=The hostname for your database entered during the installation process. Do not edit field unless absolutely necessary, for example transfer of the database to a new Host. -TIPDATABASENAME=The name for your database entered during the installation process. Do not edit field unless absolutely necessary, for example transfer of the database to a new Host. -TIPDATABASEPREFIX=The prefix used for your database entered during the installation process. Do not edit field unless absolutely necessary, for example transfer of the database to a new Host. -TIPDTATABASETYPE=The type of database in use entered during the installation process. Do not edit this field unless you are having to migrate to a different type of database perhaps due to changing hosts. -TIPDATABASEUSERNAME=The username for access to your database entered during the installation process. Do not edit field unless absolutely necessary, for example transfer of the database to a new Host. -TIPDEBUGGINGINFO=If enabled, diagnostic information, language translation, and SQL errors if present, will be displayed. The information will be displayed at the foot of every page you view within the Joomla! Back-end and Front-end. It is not advisable to leave the debug mode activated when running a live web site. +TIPDATABASEHOSTNAME=The hostname for your database entered during the installation process. Do not edit this field unless absolutely necessary (e.g. the transfer of the database to a new hosting provider). +TIPDATABASENAME=The name for your database entered during the installation process. Do not edit this field unless absolutely necessary (e.g. the transfer of the database to a new hosting provider). +TIPDATABASEPREFIX=The prefix used for your database entered during the installation process. Do not edit field unless absolutely necessary (e.g. the transfer of the database to a new hosting provider). +TIPDTATABASETYPE=The type of database in use entered during the installation process. Do not edit this field unless you are having to migrate to a different type of database, perhaps due to changing your hosting provider. +TIPDATABASEUSERNAME=The username for access to your database entered during the installation process. Do not edit this field unless absolutely necessary (e.g. the transfer of the database to a new hosting provider). +TIPDEBUGGINGINFO=If enabled, diagnostic information, language translation, and SQL errors (if present) will be displayed. The information will be displayed at the foot of every page you view within the Joomla! back-end and front-end. It is not advisable to leave the debug mode activated when running a live Web site. TIPDEBUGLANGUAGE=Select whether the debugging indicators (•...•) or (?...?) for the Joomla! Language files will be displayed. Debug Language will work without Debug System being activated, but you will not get the aditional detailed references that will help you correct any errors. TIPDEFWYSIWYG=Select the default WYSIWYG Editor for your site. Registered Users will be able to change their preference in their Personal Details if you allow that option. -TIPENABLEWEBSERVICES=Enable the ability of the installation to make RPC (Remote Procedure Calls) using HTTP as the transport medium and XML as the encoding language. This function is required to ensure that many Third Party Extensions work. Default is no. +TIPENABLEWEBSERVICES=Enable the ability of the installation to make RPC (Remote Procedure Calls) using HTTP as the transport medium and XML as the encoding language. This function is required to ensure that many third-party extensions work. Default is No. TIPERRORREPORTING=Select the appropriate level of reporting from the drop down list. See the Help Screen for full details. TIPFILEFOLDER=Path to the file storage folder for media and files accessed through the Media Manager. -TIPFROMNAME=By default this field is populated with the Site Name entered during installation. -TIPFRONTENDUSERPARAMS=If set to Show, Users will be able to select their Language, Editor, and Help Site preferences on their Details screen when logged into the Front-end -TIPENABLEFTP=Enable the built in FTP(File Transfer Protocol) functionality of Joomla! to be used instead of the normal upload functionality of Joomla! +TIPFROMNAME=By default, this field is populated with the site name entered during installation. +TIPFRONTENDUSERPARAMS=If set to Show, Users will be able to select their language, editor, and Help Site preferences on their Details screen when logged into the front-end. +TIPENABLEFTP=Enable the built in FTP (File Transfer Protocol) functionality of Joomla! to be used instead of the normal upload functionality of Joomla!. TIPFTPHOST=Enter the name of the host of your FTP server TIPFTPPASSWORD=Enter your FTP password TIPFTPPORT=Enter the port that FTP should be accessed by. Default is Port 21. TIPFTPROOT=The path to the root directory of the FTP server. The root directory is the base directory to which the FTP server is allowed access. -TIPFTPUSERNAME=The username that should be used to access the FTP server. -TIPGLOBALSITEMETATADESC=Enter a description of the overall web site that is to be used by Search Engines. Generally a maximum of 20 words is optimal. -TIPGLOBALSITEMETAKEY=Enter the keywords and phrases that typify your web site. Separate key words with a comma and group phrases within single quotations. -TIPHELPSERVER=Select the name of the Help Server where your system will collect the Help Screen displays from. Set to local to use those files within the core installation of Joomla! Click the Refresh button to update the Help Server List. +TIPFTPUSERNAME=The username used to access the FTP server. +TIPGLOBALSITEMETATADESC=Enter a description of the overall Web site that is to be used by search engines. Generally, a maximum of 20 words is optimal. +TIPGLOBALSITEMETAKEY=Enter the keywords and phrases that best describe your Web site. Separate keywords with a comma and group phrases within single quotations. +TIPHELPSERVER=Select the name of the Help Server where your system will collect the Help Screen displays from. Set to Local to use those files within the core installation of Joomla!. Click the Refresh button to update the Help Server List. TIPIFSETTOSHOWAUTHOR=If set to Show, the Name of the Author will be displayed. This a global setting but can be changed at Menu and Article levels. TIPIFSETTOSHOWDATETIMECREATED=If set to Show, the date and time an Article was created will be displayed. This a global setting but can be changed at Menu and Article levels. -TIPIFSETTOSHOWDATETIMEMODIFIED=If set to Show, the date and time an Article was last modified will be displayed. This a global setting but can be changed at Menu and Article levels. -TIPIFSETTOSHOWHITS=If set to Show, the number of Hits on a particular Article will be displayed. This a global setting but can be changed at Menu and Article levels. +TIPIFSETTOSHOWDATETIMEMODIFIED=If set to Show, the date and time an Article was last modified will be displayed. This a global setting but can be changed at Menu and Article levels. +TIPIFSETTOSHOWHITS=If set to Show, the number of Hits on a particular Article will be displayed. This a global setting but can be changed at Menu and Article levels. TIPIFSETTOSHOWREADMORELINK=If set to Show, the Read more... Link will show if Main text has been provided for the Article. TIPIFSETTOSHOWVOTING=If set to Show, a Voting system will be enabled for Articles. TIPIFYESTITLECONTENTITEMS=If set to Yes, the Title of Articles will be hyperlinked to the Article itself. TIPIFYESUSERMAILEDLINK=If set to Yes, the User will be e-mailed a link to activate their account before they can log in. TIPIFYOURSITEISOFFLINE=A message that displays in the Front-end if your site is offline. -TIPIMAGEFOLDER=Path to the file storage folder for all image files. This must be a subfolder of the Media folder, and include it in the path. Example: 'images/stories' if the media folder is 'images' -TIPLOGFOLDER=For logging of Joomla!, please specify a folder. -TIPMAILER=Select which mailer you wish to use for the delivery of site e-mails -TIPMAILFROM=The e-mail address that will be used to send the site e-mail from. -TIPLINKS=If set to Yes, links to Registered content will be shown even if you are not logged in. You will need to Login to access the full Item. -TIPNEWUSERTYPE=The default Access Level that will be appliedd to new Users registering via the Front-end. +TIPIMAGEFOLDER=Path to the file storage folder for all image files. This must be a subfolder of the media folder and include it in the path. Example: 'images/stories' if the media folder is 'images' +TIPLOGFOLDER=For logging of Joomla!. Please specify a folder. +TIPMAILER=Select which mailer you wish to use for the delivery of site e-mails. +TIPMAILFROM=The e-mail address that will be used to send site e-mails from. +TIPLINKS=If set to Yes, links to registered content will be shown even if you are not logged in. You will need to log in to access the full item. +TIPNEWUSERTYPE=The default access level that will be applied to new Users registering via the front-end. TIPPRINTPDFEMAIL=Print, PDF, and E-mail will utilise Icons or Text TIPSECRETWORD=This is an auto-generated, unique alphanumeric code for every Joomla! installation. It is used for security functions. -TIPSENDMAILPATH=Enter the path to the Sendmail program directory on the host server +TIPSENDMAILPATH=Enter the path to the sendmail program directory on the host server. TIPSESSIONHANDLER=The mechanism by which Joomla! identifies a User once they are connected to the web site using non-persistent cookies. TIPSETSDEFAULTLENGTHLISTS=Sets the default length of lists in the Control Panel for all Users TIPSETYOURSITEISOFFLINE=Select whether access to the Site Front-end is available. If Yes, the Front-end will display the message below. TIPSHOWAUTHORMETATAGITEMS=Show the Author Meta Tag when viewing Articles TIPFEEDLIMIT=Select the number of content items to show in the Feed(s) TIPSHOWTITLEMETATAGITEMS=Show the Title Meta Tag when viewing Articles -TIPSITENAME=Enter the name of your web site. This will be used in various locations for example, the Back-end browser title bar and Site Offline pages. +TIPSITENAME=Enter the name of your Web site. This will be used in various locations (e.g. the back-end browser title bar and Site Offline pages). TIPSMTPAUTH=Select Yes if your SMTP Host requires SMTP Authentication. TIPSMTPHOST=Enter the name of the SMTP host. TIPSMTPUSER=Enter the username for access to the SMTP host TIPSMTPPASS=Enter the password for access to the SMTP host TIPTMPFOLDER=Please select a writable Temp folder. TIPURLSUFFIX=If yes, the system will add a suffix to the URL based on the document type. -TIPUSEMODREWRITE=Select whether to use the Apache Rewrite Module to catch URLs that meet specific conditions, and rewrite them as directed. +TIPUSEMODREWRITE=Select to use the Apache Rewrite Module to catch URLs that meet specific conditions and rewrite them as directed. URL SUFFIX=URL Suffix USE MOD_REWRITE=Use Apache mod_rewrite USER SETTINGS=User Settings USERS=Users -WARNAPACHEONLY=Apache Users only! Rename htaccess.txt to .htaccess before activating +WARNAPACHEONLY=Apache users only! Rename htaccess.txt to .htaccess before activating. WARNDONOTCHANGEDATABASETABLESPREFIX=WARNING! Do not change unless you have a database built using tables with the prefix you are setting. WARNING=WARNING! WYSIWYG EDITOR=WYSIWYG Editor diff --git a/administrator/language/en-GB/en-GB.com_contact.ini b/administrator/language/en-GB/en-GB.com_contact.ini index 1b03cb1104c70..b335fd3ed3802 100644 --- a/administrator/language/en-GB/en-GB.com_contact.ini +++ b/administrator/language/en-GB/en-GB.com_contact.ini @@ -1,144 +1,144 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -A CONTACTS CATEGORY=A Contact's Category -ACCESS=Access Level -ADDRESS ICON=Address Icon -ALIGNMENT OF THE IMAGE=Alignment of the image -BANNED EMAIL LABEL=Banned E-mail -BANNED EMAIL DESC=E-mails containing any of the listed text will be banned. Separate different words with semi-colons e.g. ban;text;etc -BANNED SUBJECT LABEL=Banned Subject -BANNED SUBJECT DESC=Subjects containing any of the listed text will be banned. Separate different words with semi-colons e.g. ban;text;etc -BANNED TEXT LABEL=Banned Text -BANNED TEXT DESC=Text containing any of the listed text will be banned. Separate different words with semi-colons e.g. ban;text;etc -CATEGORY DESCRIPTION=Category Description -CATEGORY LIST - CATEGORY=Category List - Category -CATEGORY LIST - SECTION=Category List - Section -CHANGED TO CONTACT SAVED=Changes to Contact saved -CHOOSE A CONTACT LAYOUT.=Choose a Contact Layout. -CHOOSE A CONTACT CATEGORY LAYOUT.=Choose a Contact Category Layout. -CONTACT CATEGORY LAYOUT=Contact Category Layout -CONTACTS CATEGORY LAYOUT=Contact Category Layout -CONTACT CATEGORY LAYOUT DESC=The Contact Category Layout displays all the published Contacts in a given Category. -CONTACT DETAILS=Contact Details -CONTACT ITEMS=Contact Items -CONTACT MANAGER=Contact Manager -CONTACT PARAMETERS=Contact Parameters -CONTACT'S POSITION=Contact's Position -CONTACT SAVED=Contact saved -COUNTRY=Country -CUSTOM REPLY=Custom Reply -CUSTOM REPLY DESC=Turns off the automated reply allowing for Plugins to handle integration with other systems. -DESCNEWITEMSLAST=New Contacts default to the last place. Ordering can be changed after this Contact is saved. -DESCPARAMWHENCLICKCONTAC=* These Parameters only control what you see when you click to view a Contact Item. * -DESCRIPTION TEXT=Description Text -DROP DOWN=Drop Down -E-MAIL=E-mail -E-MAIL PARAMETERS=E-mail Parameters -EDIT CONTACT=Edit Contact -EMAIL=E-mail -EMAIL COLUMN=E-mail Column -EMAIL COPY=E-mail Copy -EMAIL DESCRIPTION=E-mail Description -EMAIL FORM=E-mail Form -EMAIL ICON=E-mail Icon -ENABLE VCARD=Enable vCard -ENABLE VCARD SUPPORT FOR CONTACTS=Enable vCard support for Contacts -FAX COLUMN=Fax Column -FAX ICON=Fax Icon -SHOW CATEGORY IN BREADCRUMBS=Show the Category in Breadcrumbs -ICON FOR THE ADDRESS INFO=Icon for the Address information -ICON FOR THE EMAIL INFO=Icon for the E-mail information -ICON FOR THE FAX INFO=Icon for the Fax information -ICON FOR THE MISC INFO=Icon for the Miscellaneous information -ICON FOR THE MOBILE INFO=Icon for the Mobile information -ICON FOR THE TELEPHONE INFO=Icon for the Telephone information -ICONS/TEXT=Icons/Text -IMAGE=Contact Image -IMAGE ALIGN=Image Align -IMAGE INFO=Image Information -INFORMATION=Information -LIMIT BOX=Limit Box -LINKED TO USER=Linked to User -MISC ICON=Miscellaneous Icon -MISC INFO=Miscellaneous Information -MISCELLANEOUS INFO=Miscellaneous Information -MOBILE=Mobile Phone Number -MOBILE ICON=Mobile Icon -NEW CONTACT=New Contact -NO=No -NUM CATEGORY ITEMS=# Category Items -PARAMCONTACTICONS=Use Icons, text, or nothing next to the Contact information displayed -PARAMDROPDOWN=Show/Hide the drop down select list in Contact view -PARAMEMAIL=Show/Hide the e-mail information. If you set to Show, the address will be protected from spambots by JavaScript Cloaking. -PARAMEMAILCOPY=Show/Hide the checkbox to e-mail a copy to the senders address -PARAMCATLIST=Show/Hide the list of Categories in the list view page -PARAMCATLISTCAT=Show/Hide the list of Categories in the table view page -PARAMCATDESC=Show/Hide the Category Description -PARAMNUMCATITEM=Show/Hide the number of Items in each Category -PARAMEMAILDESCTEXT=The Description text for the e-mail form. If left blank, the _EMAIL_DESCRIPTION language definition will be used instead -PARAMPRINT=Show/Hide the Item Print button - only affects this page -PARAMDESCTEXT=Description for this page. If left blank it will load _WEBLINKS_DESC from your language file -PARAMIMAGE=Image for this page, must be located in the /images/stories folder. Default will load web_links.jpg. No Image will mean an image is not loaded -PARAMSHOWLIMIT=Show/Hide the Limit Box -PARAMSPECCAT=Shows Contacts from the selected Category only -POSITION COLUMN=Position Column -POST/ZIP CODE=Postal/Zip Code -POSTAL CODE/ZIP=Postal Code/ZIP -SAVE & NEW=Save & New -SAVE TO COPY=Save To Copy -SELECT AN ITEM TO=Select a Contact to -SELECT CATEGORY=Select Category -SELECT CONTACT=Select Contact -SESSION CHECK LABEL=Session Check -SESSION CHECK DESC=Check for existance of session cookie, this means that Users without cookies enabled will not be able to send e-mails -SHOW CONTACT'S POSITION=Show Contact's Position -SHOW EMAIL ADDRESS=Show E-mail Address -SHOW FAX NUMBER=Show Fax Number -SHOW MOBILE NUMBER=Show Mobile Number -SHOW PAGE TITLE=Show Page Title -SHOW PHONE NUMBER=Show Telephone Number -SHOW TABLE HEADINGS=Show Table Headings -SHOW/HIDE THE CATEGORY IN THE BREADCRUMBS=Show/Hide the category in the breadcrumbs(Pathway) -SHOW/HIDE THE COUNTRY INFO=Show/Hide the Country information -SHOW/HIDE THE CONTACT POSITION=Show/Hide the Contact Position -SHOW/HIDE THE DESCRIPTION TEXT BELOW=Show/Hide the Description Text below -SHOW/HIDE THE EMAIL ADDRESS=Show/Hide the e-mail address -SHOW/HIDE THE EMAIL TO FORM=Show/Hide the e-mail to form -SHOW/HIDE THE FAX INFO=Show/Hide the Fax information -SHOW/HIDE THE FAX NUMBER=Show/Hide the Fax Number -SHOW/HIDE THE IMAGE=Show/Hide the image -SHOW/HIDE THE MISCELLANEOUS INFO=Show/Hide the Misc information -SHOW/HIDE THE MOBILE INFO=Show/Hide the Mobile Phone information -SHOW/HIDE THE MOBILE NUMBER=Show/Hide the Mobile Phone Number -SHOW/HIDE THE NAME INFO=Show/Hide the Name information -SHOW/HIDE THE POSITION COLUMN=Show/Hide the Position column -SHOW/HIDE THE POSITION INFO=Show/Hide information about the Contact's position -SHOW/HIDE THE POST CODE INFO=Show/Hide the Postcode information -SHOW/HIDE THE STATE INFO=Show/Hide the State/County information -SHOW/HIDE THE STREET ADDRESS INFO=Show/Hide the Street address information -SHOW/HIDE THE SUBURB INFO=Show/Hide the City/Town/Suburb information -SHOW/HIDE THE TABLE HEADINGS=Show/Hide the Table Headings -SHOW/HIDE THE TELEPHONE INFO=Show/Hide the Telephone information -SHOW/HIDE THE TELEPHONE NUMBER=Show/Hide the Telephone Number -SHOW/HIDE THE WEBPAGE=Show/Hide the Contact's Web URL -SHOW/HIDE VCARD=Show/Hide vCard -SITE DEFAULT=Site Default -SPECIAL DEFINED CATEGORY=Special defined Category -STANDARD CONTACT LAYOUT=Standard Contact Layout -STANDARD CONTACT LAYOUT DESC=The standard Contact layout displays a single Contact's details. -STATE/COUNTY=State/County -STREET ADDRESS=Street Address -TABLE HEADINGS=Table Headings -THE CONTACT TO LINK TO=The Contact to link to -TELEPHONE COLUMN=Telephone Column -TELEPHONE ICON=Telephone Icon -THIS COMPONENT SHOWS A LISTING OF CONTACT INFORMATION=This Component shows a listing of Contact Information -TOWN/SUBURB=Town/Suburb -VCARD=vCard -WEBPAGE=Web URL -YES=Yes -YOU MUST PROVIDE A NAME.=You must provide a name for this Contact. +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +A CONTACTS CATEGORY=A Contact's Category +ACCESS=Access Level +ADDRESS ICON=Address Icon +ALIGNMENT OF THE IMAGE=Alignment of the image +BANNED EMAIL LABEL=Banned E-mail +BANNED EMAIL DESC=E-mails containing any of the listed text will be banned. Separate different words with semi-colons (e.g. ban;text;etc.). +BANNED SUBJECT LABEL=Banned Subject +BANNED SUBJECT DESC=Subjects containing any of the listed text will be banned. Separate different words with semi-colons (e.g. ban;text;etc.). +BANNED TEXT LABEL=Banned Text +BANNED TEXT DESC=Text containing any of the listed text will be banned. Separate different words with semi-colons (e.g. ban;text;etc.). +CATEGORY DESCRIPTION=Category Description +CATEGORY LIST - CATEGORY=Category List - Category +CATEGORY LIST - SECTION=Category List - Section +CHANGED TO CONTACT SAVED=Changes to Contact saved +CHOOSE A CONTACT LAYOUT.=Choose a Contact Layout. +CHOOSE A CONTACT CATEGORY LAYOUT.=Choose a Contact Category Layout. +CONTACT CATEGORY LAYOUT=Contact Category Layout +CONTACTS CATEGORY LAYOUT=Contact Category Layout +CONTACT CATEGORY LAYOUT DESC=The Contact Category Layout displays all the published Contacts in a given Category. +CONTACT DETAILS=Contact Details +CONTACT ITEMS=Contact Items +CONTACT MANAGER=Contact Manager +CONTACT PARAMETERS=Contact Parameters +CONTACT'S POSITION=Contact's Position +CONTACT SAVED=Contact saved +COUNTRY=Country +CUSTOM REPLY=Custom Reply +CUSTOM REPLY DESC=Turns off the automated reply allowing for Plugins to handle integration with other systems. +DESCNEWITEMSLAST=New Contacts default to the last position. Ordering can be changed after this Contact is saved. +DESCPARAMWHENCLICKCONTAC=* These Parameters only control what you see when you click to view a Contact Item. * +DESCRIPTION TEXT=Description Text +DROP DOWN=Dropdown +E-MAIL=E-mail +E-MAIL PARAMETERS=E-mail Parameters +EDIT CONTACT=Edit Contact +EMAIL=E-mail +EMAIL COLUMN=E-mail Column +EMAIL COPY=E-mail Copy +EMAIL DESCRIPTION=E-mail Description +EMAIL FORM=E-mail Form +EMAIL ICON=E-mail Icon +ENABLE VCARD=Enable vCard +ENABLE VCARD SUPPORT FOR CONTACTS=Enable vCard support for Contacts +FAX COLUMN=Fax Column +FAX ICON=Fax Icon +SHOW CATEGORY IN BREADCRUMBS=Show the Category in Breadcrumbs +ICON FOR THE ADDRESS INFO=Icon for the Address information +ICON FOR THE EMAIL INFO=Icon for the E-mail information +ICON FOR THE FAX INFO=Icon for the Fax information +ICON FOR THE MISC INFO=Icon for the Miscellaneous information +ICON FOR THE MOBILE INFO=Icon for the Mobile information +ICON FOR THE TELEPHONE INFO=Icon for the Telephone information +ICONS/TEXT=Icons/Text +IMAGE=Contact Image +IMAGE ALIGN=Image Align +IMAGE INFO=Image Information +INFORMATION=Information +LIMIT BOX=Limit Box +LINKED TO USER=Linked to User +MISC ICON=Miscellaneous Icon +MISC INFO=Miscellaneous Information +MISCELLANEOUS INFO=Miscellaneous Information +MOBILE=Mobile Phone Number +MOBILE ICON=Mobile Icon +NEW CONTACT=New Contact +NO=No +NUM CATEGORY ITEMS=# Category Items +PARAMCONTACTICONS=Use icons, text or nothing next to the Contact information displayed +PARAMDROPDOWN=Show/Hide the dropdown select list in Contact view +PARAMEMAIL=Show/Hide the e-mail information. If you set to Show, the address will be protected from spambots by JavaScript Cloaking. +PARAMEMAILCOPY=Show/Hide the checkbox to e-mail a copy to the sender's address +PARAMCATLIST=Show/Hide the list of Categories in the list view page +PARAMCATLISTCAT=Show/Hide the list of Categories in the table view page +PARAMCATDESC=Show/Hide the Category Description +PARAMNUMCATITEM=Show/Hide the number of Items in each Category +PARAMEMAILDESCTEXT=The description text for the e-mail form. If left blank, the _EMAIL_DESCRIPTION language definition will be used instead. +PARAMPRINT=Show/Hide the Item Print button (only affects this page). +PARAMDESCTEXT=Description for this page. If left blank, it will load _WEBLINKS_DESC from your language file. +PARAMIMAGE=Image for this page must be located in the /images/stories folder. Default will load web_links.jpg. No Image will mean an image is not loaded +PARAMSHOWLIMIT=Show/Hide the Limit Box +PARAMSPECCAT=Shows Contacts from the selected Category only +POSITION COLUMN=Position Column +POST/ZIP CODE=Postal/Zip Code +POSTAL CODE/ZIP=Postal Code/ZIP +SAVE & NEW=Save & New +SAVE TO COPY=Save To Copy +SELECT AN ITEM TO=Select a Contact to +SELECT CATEGORY=Select Category +SELECT CONTACT=Select Contact +SESSION CHECK LABEL=Session Check +SESSION CHECK DESC=Check for existance of session cookie. This means that Users without cookies enabled will not be able to send emails. +SHOW CONTACT'S POSITION=Show Contact's Position +SHOW EMAIL ADDRESS=Show E-mail Address +SHOW FAX NUMBER=Show Fax Number +SHOW MOBILE NUMBER=Show Mobile Number +SHOW PAGE TITLE=Show Page Title +SHOW PHONE NUMBER=Show Telephone Number +SHOW TABLE HEADINGS=Show Table Headings +SHOW/HIDE THE CATEGORY IN THE BREADCRUMBS=Show/Hide the category in the breadcrumbs (pathway) +SHOW/HIDE THE COUNTRY INFO=Show/Hide the Country information +SHOW/HIDE THE CONTACT POSITION=Show/Hide the Contact Position +SHOW/HIDE THE DESCRIPTION TEXT BELOW=Show/Hide the Description Text below +SHOW/HIDE THE EMAIL ADDRESS=Show/Hide the e-mail address +SHOW/HIDE THE EMAIL TO FORM=Show/Hide the e-mail to form +SHOW/HIDE THE FAX INFO=Show/Hide the Fax information +SHOW/HIDE THE FAX NUMBER=Show/Hide the Fax Number +SHOW/HIDE THE IMAGE=Show/Hide the image +SHOW/HIDE THE MISCELLANEOUS INFO=Show/Hide the misc. information +SHOW/HIDE THE MOBILE INFO=Show/Hide the Mobile Phone information +SHOW/HIDE THE MOBILE NUMBER=Show/Hide the Mobile Phone Number +SHOW/HIDE THE NAME INFO=Show/Hide the Name information +SHOW/HIDE THE POSITION COLUMN=Show/Hide the Position column +SHOW/HIDE THE POSITION INFO=Show/Hide information about the Contact's position +SHOW/HIDE THE POST CODE INFO=Show/Hide the Postcode information +SHOW/HIDE THE STATE INFO=Show/Hide the State/County information +SHOW/HIDE THE STREET ADDRESS INFO=Show/Hide the Street address information +SHOW/HIDE THE SUBURB INFO=Show/Hide the City/Town/Suburb information +SHOW/HIDE THE TABLE HEADINGS=Show/Hide the Table Headings +SHOW/HIDE THE TELEPHONE INFO=Show/Hide the Telephone information +SHOW/HIDE THE TELEPHONE NUMBER=Show/Hide the Telephone Number +SHOW/HIDE THE WEBPAGE=Show/Hide the Contact's Web URL +SHOW/HIDE VCARD=Show/Hide vCard +SITE DEFAULT=Site Default +SPECIAL DEFINED CATEGORY=Special defined Category +STANDARD CONTACT LAYOUT=Standard Contact Layout +STANDARD CONTACT LAYOUT DESC=The standard Contact layout displays a single Contact's details. +STATE/COUNTY=State/County +STREET ADDRESS=Street Address +TABLE HEADINGS=Table Headings +THE CONTACT TO LINK TO=The Contact to link to +TELEPHONE COLUMN=Telephone Column +TELEPHONE ICON=Telephone Icon +THIS COMPONENT SHOWS A LISTING OF CONTACT INFORMATION=This Component shows a listing of Contact Information +TOWN/SUBURB=Town/Suburb +VCARD=vCard +WEBPAGE=Web URL +YES=Yes +YOU MUST PROVIDE A NAME.=You must provide a name for this Contact. diff --git a/administrator/language/en-GB/en-GB.com_contact.menu.ini b/administrator/language/en-GB/en-GB.com_contact.menu.ini index 40e4a2cfe79c0..6b467137abec6 100644 --- a/administrator/language/en-GB/en-GB.com_contact.menu.ini +++ b/administrator/language/en-GB/en-GB.com_contact.menu.ini @@ -1,9 +1,9 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -COM_CONTACT=Contacts -COM_CONTACT.CONTACTS=Contacts +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +COM_CONTACT=Contacts +COM_CONTACT.CONTACTS=Contacts COM_CONTACT.CATEGORIES=Categories \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.com_contactdirectory.ini b/administrator/language/en-GB/en-GB.com_contactdirectory.ini new file mode 100644 index 0000000000000..b8ad912d15d17 --- /dev/null +++ b/administrator/language/en-GB/en-GB.com_contactdirectory.ini @@ -0,0 +1,177 @@ +# $Id: en-GB.com_contactdirectory.ini 10082 2008-08-30 07:19:00Z chantalb $ +# Copyright (C) 2008 Chantal Bisson. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CONTACT_SAVED=Contact Saved +ERROR_SAVING_CONTACT=Error Saving Contact +SELECT_ITEM_DELETE=Select an item to delete +SELECT_ITEM_PUBLISH=Select an item to publish +SELECT_ITEM_UNPUBLISH=Select an item to unpublish +FIELD_SAVED=Field Saved +ERROR_SAVING_FIELD=Error Saving Field +FIELD_DELETED=Field(s) Deleted +ERROR_DELETING_FIELD=Error Deleting Field(s) +NO=No +YES=Yes +TEXT=Text +ICON=Icon +ICON_TEXT=Icon and Text +NONE=None +REQUIRED=Required +CLASS_SUFFIX=Class Suffix +FIELD_TITLE=Field Title +ICON_LABLE=Icon +REQUIRED_DESCRIPTION=Choose if the field is required or not +CLASS_SUFFIX_DESCRIPTION=The class suffix to add to the css tag in order to change the style of the field +FIELD_TITLE_DESCRIPTION=Choose if the title of the field will display text, icon, text and icon or none +ICON_DESCRIPTION=The icon that will be displayed for the field +HIDE=Hide +SHOW=Show +NAME=Name +NAME_DESCRIPTION_CONTACT=Show/Hide the name information in the contact form page +NAME_DESCRIPTION_DIRECTORY=Show/Hide the name information in the contact list views +EMAIL_FORM=Email Form +EMAIL_FORM_DESCRIPTION=Show/Hide the email to form +POSITION=Position +POSITION_DESCRIPTION=The position that the email to form will be displayed +TITLE=Title +TOP=Top +LEFT=Left +MAIN=Main +RIGHT=Right +BOTTOM=Bottom +PUBLIC=Public +PRIVATE=Private +SPECIAL=Special +ACCESS_LEVEL=Acces Level +ACCESS_LEVEL_DESCRIPTION=The access level of the email to form +DESCRIPTION_EMAIL_TEXT=Description text +DESCRIPTION_EMAIL_TEXT_DESCRIPTION=The Description text for the e-mail form. If left blank, the _EMAIL_DESCRIPTION language definition will be used instead +EMAIL_COPY=Email Copy +EMAIL_COPY_DESCRIPTION=Show/Hide the checkbox to e-mail a copy to the senders address +BANNED_EMAIL=Banned E-mail +BANNED_EMAIL_DESCIPTION=E-mails containing any of the listed text will be banned. Separate different words with semi-colons e.g. ban;text;etc +BANNED_SUBJECT=Banned Subject +BANNED_SUBJECT_DESCIPTION=Subjects containing any of the listed text will be banned. Separate different words with semi-colons e.g. ban;text;etc +BANNED_TEXT=Banned Text +BANNED_TEXT_DESCIPTION=Text containing any of the listed text will be banned. Separate different words with semi-colons e.g. ban;text;etc +SHOW_CAPTCHA=Show Captcha +SHOW_CAPTCHA_DESCRIPTION=Show anti-spam verification code +VALIDATION=Validation +VALIDATION_DESCRIPTION=Validation on field input or on Send +ON_FIELD_INPUT=On Field Input +ON_SEND=On Send +CONTACT_MUST_HAVE_A_NAME=Your Contact must have a name. +CONTACT=Contact +FIELD_MUST_HAVE_A_TITLE=Your Field must contain a title. +FIELD=Field +THE_CONTACT=The Contact +NEW=New +EDIT=Edit +CONTACT_ITEM_MUST_HAVE_A_NAME=Contact item must have a name +CATEGORY_SELECTED_VALIDATION=At least one category must be selected +DETAILS=Details +NAME=Name +ALIAS=Alias +PUBLISHED=Published +LINKED_USER=Linked to User +ID=ID +CATEGORIES=Categories +ORDERING_CATEGORY=Ordering %s +INFORMATION=Information +PARAMETERS=Parameters +CONTACT_PARAMETERS=Contact Page Parameters +CONTACT_PARAMETERS_DESCRIPTION=Show/Hide the %s information in the contact form page +DIRECTORY_PARAMETERS=Contact List Parameters +DIRECTORY_PARAMETERS_DESCRIPTION=Show/Hide the %s information in the contact list views +EMAIL_PARAMETERS=E-mail Parameters +CONTACT'S POSITION=Contact's Position +E-MAIL=E-mail +STREET ADDRESS=Street Address +TOWN/SUBURB=Town/Suburb +STATE/COUNTY=State/County +POSTAL CODE/ZIP=Postal Code/ZIP +COUNTRY=Country +TELEPHONE=Telephone +MOBILE PHONE NUMBER=Mobile Phone Number +FAX=Fax +WEB URL=Web URL +CONTACT IMAGE=Contact Image +MISCELLANEOUS INFORMATION=Miscellaneous Information +CONTACT_MANAGER=Contact Manager +EDIT_CONTACTS=Edit contacts +EDIT_USER=Edit User +THE_FIELD=The Field +FIELD=Field +FIELD_ITEM_MUST_HAVE_A_TITLE=Field item must have a title +NOT_AUTHORIZED_CHANGE_TYPE_EMAIL=You are not authorized to change this field\'s type. Type: Text Field +TITLE=Title +ORDERING=Ordering +TYPE=Type +DESCRIPTION=Description +FIELD_PARAMETERS=Field Parameters +TEXT_FIELD=Text Field +TEXT_AREA=Text Area +IMAGE=Image +EMAIL_ADDRESS=Email Address +URL=URL +EDITOR_TEXT_AREA=Editor Text Area +FIELD_MANAGER=Field Manager +NUM=# +ORDER=Order +EDIT_FIELDS=Edit fields +CONTACT_CATEGORY_LAYOUT_DESCRIPTION=The Contact Category Layout displays a list of the published contacts in a category. +CONTACT_CATEGORY_LAYOUT=Contacts Category Layout +STANDARD_CONTACT_LAYOUT=Standard Contact Layout +STANDARD_CONTACT_LAYOUT_DESCRIPTION=The standard Contact layout displays a single Contact's details. +CONTACT_CATEGORIES_LAYOUT_DESCRIPTION=The Contact Categories Layout displays a list of all the published contacts. +CONTACT_CATEGORIES_LAYOUT=Contacts Categories Layout +SELECT_CATEGORY=Select Category +SELECT_CONTACT=Select Contact +SELECT_CATEGORY_DESCRIPTION=A contacts category +SELECT_CONTACT_DESCRIPTION=The contact to link to +CATEGORY_TITLE=Category Title +CATEGORY_TITLE_DESCRIPTION=Show/Hide the Category Title +DESCRIPTION_IMAGE=Description Image +CATEGORY_DESCRIPTION_IMAGE_DESCRIPTION=Show/Hide the Category Description's Image +HTML_LINK_CONTACT=Link to contact +HTML_LINK_CONTACT_DESCIPTION=Add a link to the contact form +CATEGORY_ORDER=Category Order +CATEGORY_ORDER_DESCRIPTION=Order that the items will be displayed in. +ALPHABET_FILTER=Alphabet Filter +ALPHABET_FILTER_DESCRIPTION=Show/Hide the Alphabet Filter +SEARCH_BOX_FILTER=Search Box +SEARCH_BOX_FILTER_DESCRIPTION=Show/Hide the Search Box +LIMIT_BOX=Limit Box +LIMIT_BOX_DESCRIPTION=Show/Hide the Limit Box +CATEGORIES_ORDER_DESCRIPTION=Order that the categories will be displayed in. +CATEGORIES_ORDER=Order Categories +GROUPBY_CATEGORY=Group By Category +GROUPBY_CATEGORY_DESCRIPTION=Group the contact by category. +CONTACTS_ORDER=Order Contacts +CONTACTS_ORDER_DESCRIPTION=Order that the contacts will be displayed in. +HTML_LINK_CATEGORY_DESCRIPTION=Add a link to the category list +HTML_LINK_CATEGORY=Link to category +CATEGORY_DESCRIPTION_DESCRIPTION=Show/Hide the Category Description +TITLE_REVERSE_ALPHABETICAL=Title Reverse-Alphabetical +TITLE_ALPHABETICAL=Title Alphabetical +SHOW_DESCRIPTION=Show Description +SHOW_DESCRIPTION_DESCRIPTION=Show/Hide the page's description +CATEGORIES_DESCRIPTION_DESCRIPTION=The page's description +IMAGE_DESCRIPTION=The image that will be displayed in the description +IMAGE_ALIGN=Image Align +IMAGE_ALIGN_DESCRIPTION=Alignment of the image +IMPORT=Import +STORE_FAILED=Storing failed at %s +FIELD_NOT_VALID=Field name %s does not exist in the database +VALUE_NOT_VALID=Value %s is not valid +CONTACTS_IMPORT_FAILED=Contacts Import Failed +CONTACTS_IMPORT_SUCCESS=Contacts import finished successfuly +IMPORT_CONTACTS=Import Contacts +CONTACTS_IMPORT_FROM_FILE=Import from file: +CONTACTS_IMPORT_FROM_STRING=Import from text: (must be in csv format) +MANDATORY_COL_NAME_CAT=The contact's name and category is mandatory +MANDATORY_COL_NAME=The contact's name is mandatory +MANDATORY_COL_CAT=The contact must be placed in a category +FIELD_REQUIRED=The field %s is mandatory \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.com_content.ini b/administrator/language/en-GB/en-GB.com_content.ini index 1bc54d825ca8f..9f12f4309175f 100644 --- a/administrator/language/en-GB/en-GB.com_content.ini +++ b/administrator/language/en-GB/en-GB.com_content.ini @@ -17,15 +17,16 @@ ARTICLE ID=Article ID ARTICLE MANAGER=Article Manager ARTICLE MUST HAVE A TITLE=Article must have a Title ARTICLE MUST HAVE SOME TEXT=Article must have some text +ARTICLE ORDER=Article Order ARTICLE PARAMETERS=Article Parameters ARTICLE RATING:: INVALID RATING:=Article Rating:: Invalid Rating: ARTICLE SUBMISSION LAYOUT=Article Submission Layout -ARTICLE SUBMISSION LAYOUT DESC=Allows Users to submit an Article. Attention: This will only work for Authors and above! +ARTICLE SUBMISSION LAYOUT DESC=Allows Users to submit an Article. Note: this will only work for Authors and above! ARTICLE TITLE=Article Title ARTICLES BEING COPIED=Articles being copied: ARTICLES BEING MOVED=Articles being moved: AUTHOR NAMES=Author Name -BLACK LIST (DEFAULT)= Black List (Default) +BLACK LIST (DEFAULT)= Blacklist (Default) BOOK=Book CALENDAR=Calendar CAPTION=Caption @@ -60,27 +61,27 @@ FOR EACH FEED ITEM SHOW=For each feed item show FRONT PAGE=Front Page FRONTPAGE=Front Page FRONTPAGE BLOG LAYOUT=Front Page Blog Layout -FRONTPAGE BLOG LAYOUT DESC=The Standard Front Page Blog Layout displays Articles, that have been set as Front Page Articles, in a Blog format. +FRONTPAGE BLOG LAYOUT DESC=The standard Front Page Blog Layout displays Articles that have been set as Front Page Articles in a blog format. GLOSSARY=Glossary IMAGE ALIGN=Image Align INTRO TEXT=Intro Text FULL TEXT=Full Text ITEM RATING=Article Rating ITEM RATING/VOTING=Article Rating/Voting -ITEM(S) SENT TO THE TRASH=%s Article(s) sent to the Trash -ITEM(S) SUCCESSFULLY ARCHIVED=%s Article(s) successfully archived -ITEM(S) SUCCESSFULLY COPIED TO SECTION=%s Article(s) successfully copied to Section: %s, Category: %s -ITEM(S) SUCCESSFULLY MOVED TO SECTION=%s Article(s) successfully moved to Section: %s, Category: %s -ITEM(S) SUCCESSFULLY MOVED TO UNCATEGORIZED=%s Article(s) successfully moved to Uncategorized content -ITEM(S) SUCCESSFULLY PUBLISHED=%s Article(s) successfully published -ITEM(S) SUCCESSFULLY UNPUBLISHED=%s Article(s) successfully unpublished -ITEM(S) SUCCESSFULLY UNARCHIVED=%s Article(s) successfully unarchived -ITEMS BEING COPIED=Articles being copied -ITEMS BEING MOVED=Articles being moved +ITEM(S) SENT TO THE TRASH=%s Article(s) sent to the Trash. +ITEM(S) SUCCESSFULLY ARCHIVED=%s Article(s) successfully archived. +ITEM(S) SUCCESSFULLY COPIED TO SECTION=%s Article(s) successfully copied to Section: %s, Category: %s. +ITEM(S) SUCCESSFULLY MOVED TO SECTION=%s Article(s) successfully moved to Section: %s, Category: %s. +ITEM(S) SUCCESSFULLY MOVED TO UNCATEGORIZED=%s Article(s) successfully moved to Uncategorised content. +ITEM(S) SUCCESSFULLY PUBLISHED=%s Article(s) successfully published. +ITEM(S) SUCCESSFULLY UNPUBLISHED=%s Article(s) successfully unpublished. +ITEM(S) SUCCESSFULLY UNARCHIVED=%s Article(s) successfully unarchived. +ITEMS BEING COPIED=Articles being copied. +ITEMS BEING MOVED=Articles being moved. KEY REFERENCE=Key Reference KEYWORDS=Keywords LINKED TITLES=Title Linkable -MAKE YOUR ITEM TITLES LINKABLE=Make your Article's Title a link to the actual Article. Ideal when only the Intro Text is displayed. +MAKE YOUR ITEM TITLES LINKABLE=Make your Article's Title a link to the actual Article. This is ideal when only the Intro Text is displayed. METADATA INFORMATION=Metadata Information METADESC=Meta Description METAKEYS=Meta Keywords @@ -94,31 +95,33 @@ NEVER=Never NEW DOCUMENT=New Document NO HTML=No html NOT MODIFIED=Not Modified +ORDER THAT THE ARTICLES WILL BE DISPLAYED IN=Order that Articles will be displayed in. PAGEBREAK=Pagebreak PARAMALTREADMORE=Enter the text that you want to appear alongside the dynamic Read more: link instead of the default setting of using the Article Title. -PARAMAUTHOR=Show/Hide the Article Author - only affects this page +PARAMAUTHOR=Show/Hide the Article Author (only affects this page) PARAMCATEG=Show/Hide the Name of the Category the Article belongs to PARAMCATEGLINK=Make the Category Title a link to the actual Category page -PARAMCREATEDATE=Show/Hide the Article Creation Date - only affects this page -PARAMEMAIL=Show/Hide the Article E-mail button - only affects this page +PARAMCREATEDATE=Show/Hide the Article Creation Date (only affects this page) +PARAMEMAIL=Show/Hide the Article E-mail button (only affects this page) PARAMCONTENTLANGUAGE=The Language in which this Article is written -PARAMKEYREF=A text key that an Article may be referenced by (for example a help reference) -PARAMMODIFYDATE=Show/Hide the date upon which the Article was last modified - only affects this page. -PARAMPDF=Show/Hide the PDF button - only affects this page -PARAMPRINT=Show/Hide the Print button - only affects this page -PARAMRATING=Show/Hide the Article Rating - only affects this page +PARAMKEYREF=A text key by which an Article may be referenced (e.g. a help reference) +PARAMMODIFYDATE=Show/Hide the date upon which the Article was last modified (only affects this page). +PARAMPDF=Show/Hide the PDF button (only affects this page) +PARAMPRINT=Show/Hide the Print button (only affects this page) +PARAMRATING=Show/Hide the Article Rating (only affects this page) PARAMSECTION=Show/Hide the title of the Section the Article belongs to PARAMSECTIONLINK=Make the Section Title a link to the actual Section page -PARAMETERS - ADVANCED=Parameters - Advanced -PARAMETERS - ARTICLE=Parameters - Article +PARAMETERS - ADVANCED=Parameters (Advanced) +PARAMETERS - ARTICLE=Parameters (Article) PARAMNAVIGATIONARTICLE=Shows a navigation function between Articles. PART=Part PDF ICON=PDF Icon PGB TOC ALIAS PROMPT=Table of Contents Alias: PGB PAGE TITLE=Page Title: -PGB INS PAGEBRK=Insert Pagebreak -PGB ARTICLE PAGEBRK=Article Pagebreak -PLEASE SELECT SOMETHING=Please select a Section/Category to move the Article(s) to +PGB INS PAGEBRK=Insert Page Break +PGB ARTICLE PAGEBRK=Article Page Break +PLEASE SELECT A SECTION=Please select a Section +PLEASE SELECT SOMETHING=Please select a Section/Category to move the Article(s) to. #If the variable does not work in your language use following line # PLEASE MAKE A SELECTION FROM THE LIST TO=Please select an Article from the list #instead of @@ -152,7 +155,7 @@ SHOW INTRO TEXT=Show Intro Text SHOW NAVIGATION=Show Navigation SHOW PAGE TITLE=Show Page Title SHOW TITLE=Show Title -SHOW UNAUTHORIZED LINKS=Show Unauthorized Links +SHOW UNAUTHORIZED LINKS=Show Unauthorised Links SHOW/HIDE THE INTRO TEXT=Show/Hide the Intro text SHOW/HIDE THE ITEMS TITLE=Show/Hide the Item's Title SHOW/HIDE THE ARTICLES TITLE=Show/Hide the Article's Title @@ -164,18 +167,18 @@ SUCCESSFULLY SAVED CHANGES TO ARTICLE=Successfully saved changes to Article: %s SUCCESSFULLY SAVED ITEM=Successfully saved Article: %s SUCCESSFULLY SAVED ARTICLE=Successfully Saved Article TIMES=Times -TIPFILTERGROUPS=This sets the user groups that you want filters applied to. Other groups will have no filtering done. -TIPFILTERINGOPTIONS=Filtering options to give more control over the HTML that your content providers submit. You can be as strict or as liberal as you require to suit your site needs. The filtering is opt-in and the default settings afford good protection against markup commonly associated with web site attacks. +TIPFILTERGROUPS=This sets the user groups that you want filters applied to. Other groups will have no filtering performed. +TIPFILTERINGOPTIONS=Filtering options to give more control over the HTML your content providers submit. You can be as strict or as liberal as you require to suit your site needs. The filtering is opt-in and the default settings provide good protection against markup commonly associated with Web site attacks. TIPSFILTERTAGS=List additional tags, separating each tag name with a space or comma. TIPSFILTERATTRIBUTES=List additional attributes, separating each attribute name with a space or comma. -TIPSFILTERTYPE=Black List allows all tags and attributes except for those in the black list.
    --The default black list includes the following tags:'applet', 'body', 'bgsound', 'base', 'basefont', 'embed', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'object', 'script', 'style', 'title', 'xml'
    -- The default black list includes the following attributes:\n'action', 'background', 'codebase', 'dynsrc', 'lowsrc'
    --You can black list additional tags and attributes by adding to the Filter Tags and Filter Attributes fields, separating each tag or attribute name with a space or comma.

    White List allows only the tags listed in the Filter Tags and Filter Attributes fields.

    Finally, No HTML removes all HTML tags from the content when it is saved.

    Please note that these settings work regardless of the editor that you are using.
    Even if you are using a WYSIWYG editor, the filtering settings may strip additional tags and attributes prior to saving information in the database. -TIPSHOWFEEDITEM=Show only the introtext or the full text of the article. +TIPSFILTERTYPE=Blacklist allows all tags and attributes except for those in the blacklist.
    --The default blacklist includes the following tags: 'applet', 'body', 'bgsound', 'base', 'basefont', 'embed', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'object', 'script', 'style', 'title', 'xml'
    -- The default blacklist includes the following attributes:\n'action', 'background', 'codebase', 'dynsrc', 'lowsrc'
    --You can blacklist additional tags and attributes by adding to the Filter Tags and Filter Attributes fields, separating each tag or attribute name with a space or comma.

    Whitelist allows only the tags listed in the Filter Tags and Filter Attributes fields.

    No HTML removes all HTML tags from the content when it is saved.

    Please note that these settings work regardless of the editor that you are using.
    Even if you are using a WYSIWYG editor, the filtering settings may strip additional tags and attributes prior to saving information in the database. +TIPSHOWFEEDITEM=Show only the Intro Text or the Full Text of the article. UNARCHIVE=Unarchive -UNCATEGORIZED=Uncategorized +UNCATEGORIZED=Uncategorised VALIDSELECTIONLISTSENDTRASH=Please make a selection from the list to send to Trash. VALIDSELECTSECTCATCOPYITEMS=Please select a Section/Category to copy the Articles to. VALIDTRASHSELECTEDITEMS=Are you sure you want to Trash the selected Articles? This will not permanently delete the Articles. -WHITE LIST=White List +WHITE LIST=Whitelist YOU CANNOT EDIT AN ARCHIVED ITEM=You cannot edit an Archived Article. YOU MUST SELECT A CATEGORY=You must select a Category. -YOU MUST SELECT A SECTION=You must select a Section. \ No newline at end of file +YOU MUST SELECT A SECTION=You must select a Section. diff --git a/administrator/language/en-GB/en-GB.com_frontpage.ini b/administrator/language/en-GB/en-GB.com_frontpage.ini index 1afd96ccb4d92..d9fb3107cd4ec 100644 --- a/administrator/language/en-GB/en-GB.com_frontpage.ini +++ b/administrator/language/en-GB/en-GB.com_frontpage.ini @@ -25,19 +25,19 @@ ORDER ITEMS BY CATEGORY=Order Articles by Category ORDER THAT THE ITEMS WILL BE DISPLAYED IN.=The order that the Articles will be displayed in. PAGINATION=Pagination PAGINATION RESULTS=Pagination Results -PARAMAUTHOR=Show/Hide the Article Author - only affects this page +PARAMAUTHOR=Show/Hide the Article Author (only affects this page) PARAMCATEG=Show/Hide the Category the Article belongs to PARAMCATEGLINK=Make the Category Title a link to the actual Category page -PARAMCOLUMNS=When organising the Intro text, identify how many columns to display per row -PARAMCREATEDATE=Show/Hide the Article Creation Date - only affects this page -PARAMEMAIL=Show/Hide the Article E-mail button - only affects this page -PARAMINTRO=Number of Articles to display with the Introduction text showing. +PARAMCOLUMNS=When organising the Intro Text identify how many columns to display per row. +PARAMCREATEDATE=Show/Hide the Article creation date (only affects this page) +PARAMEMAIL=Show/Hide the Article e-mail button (only affects this page) +PARAMINTRO=Number of Articles to display with the Intro Text showing. PARAMLEADING=Number of Articles to display as a Leading (full width) Article. 0 will mean that no Articles will be displayed as Leading. -PARAMMODIFYDATE=Show/Hide the Article Modification Date - only affects this page -PARAMPAGINATIONRESULTS=Show/Hide Pagination Results Info ( e.g 1-4 of 4 ) -PARAMPDF=Show/Hide the Item PDF button - only affects this page -PARAMPRINT=Show/Hide the Item Print button - only affects this page -PARAMRATING=Show/Hide the Item Rating - only affects this page +PARAMMODIFYDATE=Show/Hide the Article Modification Date (only affects this page) +PARAMPAGINATIONRESULTS=Show/Hide Pagination Results Info (e.g 1-4 of 4 ) +PARAMPDF=Show/Hide the Item PDF button (only affects this page) +PARAMPRINT=Show/Hide the Item Print button (only affects this page) +PARAMRATING=Show/Hide the Item Rating (only affects this page) PARAMSECTION=Show/Hide the name of the Section the Article belongs to PARAMSECTIONLINK=Make the Section Name a link to the actual Section page #If the variable does not work in your language use following line @@ -55,4 +55,4 @@ SELECT CATEGORY=Select Category SHOW/HIDE PAGINATION SUPPORT=Show/Hide Pagination support SHOW/HIDE THE ITEMS TITLE=Show/Hide the Article's Title SHOW/HIDE THE READ MORE LINK=Show/Hide the Read more... link -UNCATEGORIZED=Uncategorized \ No newline at end of file +UNCATEGORIZED=Uncategorised diff --git a/administrator/language/en-GB/en-GB.com_installer.ini b/administrator/language/en-GB/en-GB.com_installer.ini index 1c9fd01a6558d..941055e9ce9ff 100644 --- a/administrator/language/en-GB/en-GB.com_installer.ini +++ b/administrator/language/en-GB/en-GB.com_installer.ini @@ -1,153 +1,157 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ADMIN=Admin -ADMIN MODULES=Admin Modules -ADMIN LANGUAGES=Admin Languages -ADMIN TEMPLATES=Admin Templates -ALL=All -ALREADY EXISTS!=Already Exists! -ANOTHER COMPONENT IS ALREADY USING DIRECTORY=Another Component is already using directory -ANOTHER TEMPLATE IS ALREADY USING DIRECTORY=Another template is already using directory -ANOTHER MODULE IS ALREADY USING DIRECTORY=Another module is already using directory -AUTHOR=Author -AUTHOR INFORMATION=Author Information -BACK TO LANGUAGE MANAGER=Back to Language Manager -BACK TO TEMPLATES=Back to Templates -CANNOT FIND OR READ FILE=It was not possible to find or read the selected file -CANNOT FIND SOURCE FILE=It has not been possible to locate the required source file -CLIENT=Client -COMPATIBILITY=Compatibility -COMPATIBLE EXTENSION=This extension functions with Joomla! 1.5 nativly. -COMPONENT MENU LINK=Component Menu Link -COMPONENT=Component -COMPONENTS=Components -CONTINUE ...=Continue... -COPY FAILED=It was not possible to copy the selected file. -COULD NOT COPY PHP INSTALL FILE.=Could not copy PHP install file. -COULD NOT COPY PHP UNINSTALL FILE.=Could not copy PHP uninstall file. -CURRENTLY INSTALLED=Component -DELETING XML FILE=Deleting XML file -DELETE FAILED=It was not possible to delete the selected file -DESCFTP=For installing or uninstalling Extensions, Joomla! will most likely need your FTP account details. Please enter them in the form fields below. -DESCFTPTITLE=FTP Login Details -DESCLANGUAGES=Only those Languages that may be uninstalled are accessible. The default Language may not be removed. -DESCMODULES=Only those Modules that may be uninstalled are accessible. Some Core Modules may not be removed. -DESCPLUGINS=Only those Plugins that can be uninstalled are accessible. Some Core Plugins cannot be removed. -DESCTEMPLATES=Only those Templates that may be uninstalled are accessible. The default Template may not be removed. -DIRECTORY.=Directory. -DIRECTORY DOES NOT EXIST=Directory does not exist -DIRECTORY DOES NOT EXIST, CANNOT REMOVE FILES=Directory does not exist, cannot remove files. -DISABLE=Disable -ENABLE=Enable -ERROR=Error -ERRORNOTFINDJOOMLAXMLSETUPFILE=Error! Could not find a Joomla! XML setup file in the package. -ERRORNOTFINDXMLSETUPFILE=Error! Could not find an XML setup file in the package. -ERRORREMOVEMANUALLY=If this Extension has created tables or installed additional files, they must be removed manually. -ERRORUNKOWNEXTENSION=The installer could not remove the Extension as requested. A manual removal is required. -EXTENSION MANAGER=Extension Manager -EXTRACT ERROR=Extract Error! -FAILED TO COPY FILE TO=Failed to copy file: %s to %s -FAILED TO MOVE UPLOADED FILE TO=Failed to move uploaded file to /media directory -FILE DOES NOT EXIST=File '%s' does not exist -FOLDER FIELD EMPTY, CANNOT REMOVE FILES=Folder field empty, cannot remove files -INSTALL=Install -INSTALLEXT=Install %s %s -INSTALL AN EXTENSION=Install an Extension -INSTALL DETECTION ERROR=Install %s - (Detection Error!) -INSTALL DIRECTORY=Install Directory -INSTALL FROM DIRECTORY=Install from Directory -INSTALL FROM URL=Install from URL -INSTALL NEW ELEMENT=Install new %s - %s -INSTALL NEW EXTENSION=Install new Extension -INSTALL NEW LANGUAGE - SITE=Install new Language - Site -INSTALL NEW TEMPLATE=Install new Template -INSTALL URL=Install URL -INSTALLATION FILE NOT FOUND=Installation file not found -INSTALLED MODULES=Installed Modules -INSTALLED PLUGINS=Installed Plugins -INSTALLER - ERROR=Installer - Error! -INSTALLER LANG NOT INSTALLED=The language file '%s' could not be installed because the %s language package for '%s' has not been installed or does not exist. -INSTALLER NOT AVAILABLE FOR ELEMENT=Installer not available for element -INSTALLER NOT FOUND FOR ELEMENT=Installer not found for element -INVALID URL=Invalid URL -IS NOT A VALID JOOMLA! INSTALLATION FILE=is not a valid Joomla! installation file -JCLIENTHELPER::SETCREDENTIALSFROMREQUEST FAILED=Unable to connect to the server with the given credentials -LANGUAGE ID EMPTY, CANNOT REMOVE FILES=Language ID empty, cannot remove files -LANGUAGE=Language -LANGUAGES=Languages -METHOD "INSTALL" CANNOT BE CALLED BY CLASS=Method install cannot be called by class -METHOD "UNINSTALL" CANNOT BE CALLED BY CLASS=Method uninstall cannot be called by class -MODULE FILE=Module -MODULE=Module -MODULES=Modules -NO CUSTOM MODULES INSTALLED=No custom Modules installed -NO LANGUAGES INSTALLED=No Languages installed -NO LANGUAGE TAG?=The package did not specify a language tag. Are you trying to install an old language package? -NO INSTALLED TEMPLATES=No Templates installed -NO INSTALL TYPE FOUND=No Install Type Found -NO FILE IS MARKED AS PLUGIN FILE=No file is marked as Plugin file -NO FILE IS MARKED AS MODULE FILE=No file is marked as Module file -NO FILE SELECTED=No file selected -NO FILENAME SPECIFIED=No filename specified -NOT COMPATIBLE EXTENSION=This extension does not function with Joomla! 1.5 nativly. It requires LEGACY-MODE to be ON. Please contact the extension's author. -PACKAGE MANIFEST FILE INVALID OR NOT FOUND=The Package manifest file is invalid or has not been found -PATH DOES NOT HAVE A VALID PACKAGE=Path does not have a valid package -PATH IS NOT A FOLDER=Path does not point to a valid folder or the folder has been deleted. -PLEASE ENTER A PACKAGE DIRECTORY=Please enter a package directory -PLEASE ENTER A URL=Please enter a URL -PLEASE SELECT A DIRECTORY=Please select a directory -PLUGIN=Plugin -PLUGINS=Plugins -RENAMING FAILED=It was not possible to rename the selected file. -SESSION PATH IS WRITABLE=Session path writable -SITE MODULES=Site Modules -SITE LANGUAGES=Site Languages -SITE TEMPLATES=Site Templates -SQLERRORORFILE=SQL error or missing or unreadable SQL file. -SUCCESS=Success -TEMPLATE=Template -TEMPLATE ID IS EMPTY, CANNOT REMOVE FILES=Template ID is empty, cannot remove files -THERE ARE NO CUSTOM COMPONENTS INSTALLED=There are no custom Components installed -THERE IS ALREADY A FILE CALLED=There is already a file called -UNABLE TO DETECT THE TYPE OF INSTALL=Unable to detect the type of install %s -UNABLE TO FIND INSTALL PACKAGE=Unable to find install package -UNABLE TO FIND VALID XML INSTALL=Unable to find valid XML install %s -UNABLE TO OPEN=It was not possible to open the selected file -UNINSTALL=Uninstall -UNINSTALLEXT=Uninstall %s %s -UNINSTALL LANGUAGE=If you uninstall this language, all your extensions language files for this language will be permanently deleted and cannot be used anymore! -UNINSTALLLANGPUBLISHEDALREADY=Cannot remove the default language -UNKNOWN CLIENT TYPE=Unknown Client Type -UNKNOWNARCHIVETYPE=Unknown Archive Type -UNRECOVERABLE ERROR=Unrecoverable Error! -UPLOAD ERROR=Upload %s - (Upload Error!) -UPLOAD FAILED=Upload %s - (Upload Failed!) -UPLOAD FAILED AS=Upload failed as -UPLOAD FILE=Upload File -UPLOAD PACKAGE FILE=Upload Package File -UPLOAD NEW=Upload new %s - (%s) -UPLOAD NEW MODULE - ERROR=Upload new Module - Error! -UPLOADFAILEDNOTEXIST=Upload failed as /media directory does not exist. -UPLOADFAILEDNOTWRITABLE=Upload failed as /media directory is not writable. -UPLOADSUCCESSOR=Upload %s - (%s) -WARNCOOKIESNOTENABLED=It appears that your browser is not configured to allow cookies. This is one of the requirements for the successful use of Joomla! -WARNCORECOMPONENT=%s is a core Component, and cannot be uninstalled. -WARNCORECOMPONENT2=You need to disable it if you do not want to use it -WARNCOREELEMENT=%s is a core element, and cannot be uninstalled. -WARNCOREMODULE=%s is a core Module, and cannot be uninstalled. -WARNFS_ERR01=Warning! - Failed to change file permissions -WARNFS_ERR02=Warning! - Failed to move file -WARNFS_ERR03=Upload failed, the target directory is not writable -WARNFS_ERR04=Upload failed, the target directory does not exist -WARNINSTALLFILE=The installer cannot continue until file uploads are enabled for the server. -WARNINSTALLZLIB=The installer cannot continue until Zlib is installed. -WARNINSTALLUPLOADERROR=There was an error uploading this file to the server. -WARNNONONCORE=There are no non-core, custom Plugins installed. -WARNPERMISSIONS=Failed to change the permissions of the uploaded file. -WARNSAME=There is already a folder called '%s' - Please initially check whether:
    • the Extension is already installed
    • the file names in the XML file are spelled correctly
    • there are no XML files listed inside the extension.xml file
    • all of the files (not including XML files) are correctly listed in the extension.xml file and there are no duplicate entries
    • there is an empty folder listed from a previous installation attempt
    -XML SETUP FILE IS NOT FOR A=The XML setup file is not for a -SERVER_CONNECT_FAILED=Remote Server connection failed \ No newline at end of file +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ADMIN=Admin +ADMIN MODULES=Admin Modules +ADMIN LANGUAGES=Admin Languages +ADMIN TEMPLATES=Admin Templates +ALL=All +ALREADY EXISTS!=Already Exists! +ANOTHER COMPONENT IS ALREADY USING DIRECTORY=Another Component is already using directory +ANOTHER TEMPLATE IS ALREADY USING DIRECTORY=Another template is already using directory +ANOTHER MODULE IS ALREADY USING DIRECTORY=Another module is already using directory +AUTHOR=Author +AUTHOR INFORMATION=Author Information +BACK TO LANGUAGE MANAGER=Back to Language Manager +BACK TO TEMPLATES=Back to Templates +CANNOT FIND OR READ FILE=It was not possible to find or read the selected file +CANNOT FIND SOURCE FILE=It has not been possible to locate the required source file +CLIENT=Client +COMPATIBILITY=Compatibility +COMPATIBLE EXTENSION=This extension functions natively with Joomla! 1.5. +COMPONENT MENU LINK=Component Menu Link +COMPONENT=Component +COMPONENTS=Components +CONTINUE ...=Continue... +COPY FAILED=It was not possible to copy the selected file. +COULD NOT COPY PHP INSTALL FILE.=Could not copy PHP install file. +COULD NOT COPY PHP UNINSTALL FILE.=Could not copy PHP uninstall file. +CURRENTLY INSTALLED=Component +DELETING XML FILE=Deleting XML file +DELETE FAILED=It was not possible to delete the selected file. +DESCFTP=For installing or uninstalling Extensions, Joomla! will most likely need your FTP account details. Please enter them in the form fields below. +DESCFTPTITLE=FTP Login Details +DESCLANGUAGES=Only those Languages that may be uninstalled are accessible. The default Language may not be removed. +DESCMODULES=Only those Modules that may be uninstalled are accessible. Some Core Modules may not be removed. +DESCPLUGINS=Only those Plugins that can be uninstalled are accessible. Some Core Plugins cannot be removed. +DESCTEMPLATES=Only those Templates that may be uninstalled are accessible. The default Template may not be removed. +DIRECTORY.=Directory. +DIRECTORY DOES NOT EXIST=Directory does not exist. +DIRECTORY DOES NOT EXIST, CANNOT REMOVE FILES=Directory does not exist and cannot remove files. +DISABLE=Disable +ENABLE=Enable +ERROR=Error +ERRORNOTFINDJOOMLAXMLSETUPFILE=Error! Could not find a Joomla! XML setup file in the package. +ERRORNOTFINDXMLSETUPFILE=Error! Could not find an XML setup file in the package. +ERRORREMOVEMANUALLY=If this Extension has created tables or installed additional files, they must be removed manually. +ERRORUNKOWNEXTENSION=The installer could not remove the extension as requested. Manual removal is required. +EXTENSION MANAGER=Extension Manager +EXTRACT ERROR=Extraction Error! +FAILED TO COPY FILE TO=Failed to copy file: %s to %s +FAILED TO MOVE UPLOADED FILE TO=Failed to move uploaded file to /media directory. +FILE DOES NOT EXIST=File '%s' does not exist. +FOLDER FIELD EMPTY, CANNOT REMOVE FILES=Folder field empty and cannot remove files +INSTALL=Install +INSTALLEXT=Install %s %s +INSTALL AN EXTENSION=Install an Extension +INSTALL DETECTION ERROR=Install %s - (Detection Error!) +INSTALL DIRECTORY=Install Directory +INSTALL FROM DIRECTORY=Install from Directory +INSTALL FROM URL=Install from URL +INSTALL NEW ELEMENT=Install new %s - %s +INSTALL NEW EXTENSION=Install new Extension +INSTALL NEW LANGUAGE - SITE=Install new language (site) +INSTALL NEW TEMPLATE=Install new Template +INSTALL URL=Install URL +INSTALLATION FILE NOT FOUND=Installation file not found +INSTALLED MODULES=Installed Modules +INSTALLED PLUGINS=Installed Plugins +INSTALLER - ERROR=Installer Error! +INSTALLER LANG NOT INSTALLED=The language file '%s' could not be installed because the %s language package for '%s' has not been installed or does not exist. +INSTALLER NOT AVAILABLE FOR ELEMENT=Installer not available for element +INSTALLER NOT FOUND FOR ELEMENT=Installer not found for element +INVALID URL=Invalid URL +IS NOT A VALID JOOMLA! INSTALLATION FILE=is not a valid Joomla! installation file +JCLIENTHELPER::SETCREDENTIALSFROMREQUEST FAILED=Unable to connect to the server with the given credentials. +LANGUAGE ID EMPTY, CANNOT REMOVE FILES=Language ID empty and cannot remove files +LANGUAGE=Language +LANGUAGES=Languages +METHOD "INSTALL" CANNOT BE CALLED BY CLASS=Method install cannot be called by class +METHOD "UNINSTALL" CANNOT BE CALLED BY CLASS=Method uninstall cannot be called by class +MODULE FILE=Module +MODULE=Module +MODULES=Modules +NO CUSTOM MODULES INSTALLED=No custom Modules installed +NO LANGUAGES INSTALLED=No Languages installed +NO LANGUAGE TAG?=The package did not specify a language tag. Are you trying to install an old language package? +NO INSTALLED TEMPLATES=No Templates installed +NO INSTALL TYPE FOUND=No Install Type Found +NO FILE IS MARKED AS PLUGIN FILE=No file is marked as Plugin file +NO FILE IS MARKED AS MODULE FILE=No file is marked as Module file +NO FILE SELECTED=No file selected +NO FILENAME SPECIFIED=No filename specified +NOT COMPATIBLE EXTENSION=This extension does not function natively with Joomla! 1.5. It requires Legacy Mode to be ON. Please contact the extension's author for additional information. +PACKAGE MANIFEST FILE INVALID OR NOT FOUND=The package manifest file is invalid or has not been found. +PATH DOES NOT HAVE A VALID PACKAGE=Path does not have a valid package. +PATH IS NOT A FOLDER=Path does not point to a valid folder or the folder has been deleted. +PLEASE ENTER A PACKAGE DIRECTORY=Please enter a package directory +PLEASE ENTER A URL=Please enter a URL +PLEASE SELECT A DIRECTORY=Please select a directory +PLUGIN=Plugin +PLUGINS=Plugins +RENAMING FAILED=It was not possible to rename the selected file. +SESSION PATH IS WRITABLE=Session path writable +SITE MODULES=Site Modules +SITE LANGUAGES=Site Languages +SITE TEMPLATES=Site Templates +SQLERRORORFILE=SQL error or missing or unreadable SQL file. +SUCCESS=Success +TEMPLATE=Template +TEMPLATE ID IS EMPTY, CANNOT REMOVE FILES=Template ID is empty, cannot remove files +THERE IS ALREADY A FILE CALLED=There is already a file called +UNABLE TO DETECT THE TYPE OF INSTALL=Unable to detect the type of install %s +UNABLE TO FIND INSTALL PACKAGE=Unable to find install package +UNABLE TO FIND VALID XML INSTALL=Unable to find valid XML install %s +UNABLE TO OPEN=It was not possible to open the selected file +UNINSTALL=Uninstall +UNINSTALLEXT=Uninstall %s %s +UNINSTALL LANGUAGE=If you uninstall this language, all your extensions' language files for this language will be permanently deleted and cannot be used anymore! +UNINSTALLLANGPUBLISHEDALREADY=Cannot remove the default language +UNKNOWN CLIENT TYPE=Unknown Client Type +UNKNOWNARCHIVETYPE=Unknown Archive Type +UNRECOVERABLE ERROR=Unrecoverable Error! +UPLOAD ERROR=Upload %s - (Upload Error!) +UPLOAD FAILED=Upload %s - (Upload Failed!) +UPLOAD FAILED AS=Upload failed as +UPLOAD FILE=Upload File +UPLOAD PACKAGE FILE=Upload Package File +UPLOAD NEW=Upload new %s - (%s) +UPLOAD NEW MODULE - ERROR=Upload new Module - Error! +UPLOADFAILEDNOTEXIST=Upload failed as /media directory does not exist. +UPLOADFAILEDNOTWRITABLE=Upload failed as /media directory is not writable. +UPLOADSUCCESSOR=Upload %s - (%s) +WARNCOOKIESNOTENABLED=It appears that your browser is not configured to allow cookies. This is one of the requirements for the proper functioning of Joomla! +WARNCORECOMPONENT=%s is a core Component and cannot be uninstalled. +WARNCORECOMPONENT2=You need to disable it if you do not want to use it. +WARNCOREELEMENT=%s is a core element and cannot be uninstalled. +WARNCOREMODULE=%s is a core Module and cannot be uninstalled. +WARNFS_ERR01=Warning! Failed to change file permissions. +WARNFS_ERR02=Warning! Failed to move file. +WARNFS_ERR03=Upload failed. The target directory is not writable. +WARNFS_ERR04=Upload failed. The target directory does not exist. +WARNINSTALLFILE=The installer cannot continue until file uploads are enabled for the server. +WARNINSTALLZLIB=The installer cannot continue until Zlib is installed. +WARNINSTALLUPLOADERROR=There was an error uploading this file to the server. +WARNNONONCORE=There are no non-core, custom Plugins installed. +WARNPERMISSIONS=Failed to change the permissions of the uploaded file. +WARNSAME=There is already a folder called '%s'. Please initially check whether:
    • the Extension is already installed
    • the file names in the XML file are spelled correctly
    • there are no XML files listed inside the extension.xml file
    • all of the files (not including XML files) are correctly listed in the extension.xml file and there are no duplicate entries
    • there is an empty folder listed from a previous installation attempt
    +XML SETUP FILE IS NOT FOR A=The XML setup file is not for a +SERVER_CONNECT_FAILED=Remote Server connection failed +THERE ARE NO CUSTOM COMPONENTS INSTALLED=There are no custom components installed. +THERE ARE NO CUSTOM TEMPLATES INSTALLED=There are no custom templates installed. +THERE ARE NO CUSTOM LANGUAGES INSTALLED=There are no custom languages installed. +THERE ARE NO CUSTOM MODULES INSTALLED=There are no custom modules installed. +THERE ARE NO CUSTOM PLUGINS INSTALLED=There are no custom plugins installed. diff --git a/administrator/language/en-GB/en-GB.com_languages.ini b/administrator/language/en-GB/en-GB.com_languages.ini index a7a206bdf3359..960cf96fce9ad 100644 --- a/administrator/language/en-GB/en-GB.com_languages.ini +++ b/administrator/language/en-GB/en-GB.com_languages.ini @@ -18,5 +18,6 @@ OPERATION FAILED: THE FILE IS NOT WRITABLE.=Operation failed! The file is not wr SIZE=Size WARNOPENFILE=Operation failed! Failed to open the file for writing. WRITABLE=Writable -YOU CAN NOT DELETE LANGUAGE IN USE.=You can not delete, this Language is in use. +YOU CAN NOT DELETE LANGUAGE IN USE.=You can not delete because this language is in use. + diff --git a/administrator/language/en-GB/en-GB.com_login.ini b/administrator/language/en-GB/en-GB.com_login.ini index a8f1abfc669e7..53c2929c54540 100644 --- a/administrator/language/en-GB/en-GB.com_login.ini +++ b/administrator/language/en-GB/en-GB.com_login.ini @@ -1,7 +1,7 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + DESCUSEVALIDLOGIN=Use a valid username and password to gain access to the Administrator Back-end. \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.com_massmail.ini b/administrator/language/en-GB/en-GB.com_massmail.ini index e6920531857f0..febf53e2347ed 100644 --- a/administrator/language/en-GB/en-GB.com_massmail.ini +++ b/administrator/language/en-GB/en-GB.com_massmail.ini @@ -17,10 +17,11 @@ PLEASE FILL IN THE SUBJECT=Please enter a subject PLEASE FILLIN THE MESSAGE=Please enter a message PLEASE SELECT A GROUP=Please select a Group RECIPIENTS AS BCC=Recipients as BCC.
    Adds copy to site e-mail. -SEND AS BLIND CARBON COPY=Hides recipients list. +SEND AS BLIND CARBON COPY=Hides recipient list. SEND IN HTML MODE=Send in HTML mode SEND MAIL=Send mail SUBJECT PREFIX=Subject Prefix SUBJECTPREFIXTIP=This gets added in front of each mail subject USERS=Users + diff --git a/administrator/language/en-GB/en-GB.com_media.ini b/administrator/language/en-GB/en-GB.com_media.ini index 16af8af80af82..a6e527c96e4b2 100644 --- a/administrator/language/en-GB/en-GB.com_media.ini +++ b/administrator/language/en-GB/en-GB.com_media.ini @@ -23,7 +23,7 @@ DETAIL VIEW=Detail View DELETE FILE=Delete file DELETE FOLDER=Delete folder DELETE ITEM=Delete item -DESCFTP=For uploading, changing, and deleting media files, Joomla! will most likely need your FTP account details. Please enter them in the form fields below. +DESCFTP=To upload, change and delete media files, Joomla! will most likely need your FTP account details. Please enter them in the form fields below. DESCFTPTITLE=FTP Login Details DIMENSIONS=Dimensions
    W x H px DIRECTORIES=Directories @@ -46,13 +46,13 @@ INSERT IMAGE=Insert Image INSERT YOUR TEXT HERE=Insert your text here JCLIENTHELPER::SETCREDENTIALSFROMREQUEST FAILED=Unable to connect to the server with the given credentials LEGAL EXTENSIONS LABEL=Legal Extensions (File Types) -LEGAL EXTENSIONS DESC= Extensions (File Types) you are allowed to upload, comma separated. +LEGAL EXTENSIONS DESC= Extensions (file types) you are allowed to upload (comma separated). LEGAL IMAGE EXTENSIONS LABEL=Legal Image Extensions (File Types) -LEGAL IMAGE EXTENSIONS DESC= Image Extensions (File Types) you are allowed to upload, comma separated. These are used to check for valid image headers. +LEGAL IMAGE EXTENSIONS DESC= Image Extensions (file types) you are allowed to upload (comma separated). These are used to check for valid image headers. RESTRICT UPLOADS=Restrict Uploads RESTRICT UPLOADS DESC=Restrict uploads for lower than manager users to just images if Fileinfo or MIME Magic isn't installed. CHECK MIME=Check MIME Types -CHECK MIME DESC=Use MIME Magic or Fileinfo to attempt to verify files. Disable this if you get invalid mime type errors +CHECK MIME DESC=Use MIME Magic or Fileinfo to attempt to verify files. Try disabling this if you get invalid mime type errors IGNORED EXTENSIONS LABEL=Ignored Extensions IGNORED EXTENSIONS DESC=Ignored file extensions for MIME type checking and restricted uploads LEGAL MIME TYPES LABEL=Legal MIME Types @@ -61,7 +61,7 @@ ILLEGAL MIME TYPES=Illegal MIME Types ILLEGAL MIME TYPES DESC=A comma separated list of illegal MIME types for upload (blacklist) MAX=Max = MAXIMUM SIZE LABEL=Maximum Size -MAXIMUM SIZE DESC=The maximum size for an upload (in bytes). Use zero for no limit. Be aware, that your server has a maximum limit. +MAXIMUM SIZE DESC=The maximum size for an upload (in bytes). Use zero for no limit. Note: your server has a maximum limit. MEDIA MANAGER=Media Manager NAME=Image Name NO IMAGES FOUND=No Images Found @@ -79,20 +79,20 @@ THERE ARE=There are THIS COMPONENT MANAGES SITE MEDIA=This Component manages site media THIS FILE TYPE IS NOT SUPPORTED=This file type is not supported THUMBNAIL VIEW=Thumbnail View -UNABLE TO DELETE: NOT EMPTY!=Unable to delete: not empty! +UNABLE TO DELETE: NOT EMPTY!=Unable to delete! Not empty! UP=Up UPLOAD=Upload UPLOAD COMPLETE=Upload Complete UPLOAD FAILED=Upload Failed! UPLOAD FILE=Upload File UPLOAD FILES=Upload Files -UPLOAD FAILED. FILE ALREADY EXISTS=Upload FAILED! File already exists -WARNSAFEMODE=Directory creation not allowed while running in SAFE MODE as this can cause problems. -WARNDIRNAME=Directory name must only contain alphanumeric characters and no spaces please. +UPLOAD FAILED. FILE ALREADY EXISTS=Upload FAILED! File already exists. +WARNSAFEMODE=Directory creation not allowed while running in SAFE MODE because this can cause problems. +WARNDIRNAME=Directory name must only contain alphanumeric characters and no spaces. WARNFILENAME=File name must only contain alphanumeric characters, underscores, hyphens and spaces. WARNFILETYPE=This file type is not supported. WARNFILETOOLARGE=This file is too large to upload. WARNINVALIDIMG=Not a valid image. WARNINVALIDMIME=Illegal or invalid mime type detected. WARNNOTADMIN=Uploaded file is not an image file and you are not a manager or higher. -WARNIEXSS=Possible IE XSS Attack found. \ No newline at end of file +WARNIEXSS=Possible IE XSS Attack found. diff --git a/administrator/language/en-GB/en-GB.com_menus.ini b/administrator/language/en-GB/en-GB.com_menus.ini index 3fd86eb6d5a32..2d3dc2303b427 100644 --- a/administrator/language/en-GB/en-GB.com_menus.ini +++ b/administrator/language/en-GB/en-GB.com_menus.ini @@ -25,6 +25,7 @@ AUTO HEIGHT=Auto Height ATOM=ATOM BASIC PARAMETERS=Basic Parameters BLOG=Blog +CANNOT SAVE: EMPTY MENU TYPE=Cannot Save: Empty Menu Type CATEGORY DESCRIPTION=Category Description CATEGORY LIST - SECTION=Category List - Section CATEGORY NAME=Category Title @@ -44,7 +45,7 @@ CONFIRM RESET LAYOUT=Confirm Reset Layout CONFIRM RESET LAYOUT DESC=Create a Confirmed Password Reset Layout view CONTACT TO LINK=Contact to Link CONTENT TO LINK=Content to Link -COPY OF MENU CREATED=A Copy of Menu '%s' created, consisting of %s Menu Item(s) +COPY OF MENU CREATED=A Copy of Menu '%s' created containing of %s Menu Item(s) COPY MENU=Copy Menu COPY MENU ITEMS=Copy Menu Item(s) COPY TO MENU=Copy to Menu @@ -65,7 +66,7 @@ DEFAULT REGISTER LAYOUT DESC=Create a Default User Registration Layout view DEFAULT USER LAYOUT=Default User Layout DEFAULT USER LAYOUT DESC=This layout displays a greeting message when the User accesses the registered zone. It is only associated with the mod_login module. The actual message can be edited in the WELCOME_DESC key of com_user.ini site language file). DELETE MENU=Delete Menu -DESCNEWITEMSLAST=New Menu Items default to the last place. Ordering can be changed after this Menu Item is saved. +DESCNEWITEMSLAST=New Menu Items default to the last position. Ordering can be changed after this Menu Item is saved. DESCRIPTION FOR PAGE=Description for page DESCRIPTION IMAGE=Description Image DESCRIPTION TEXT=Description Text @@ -79,9 +80,9 @@ EMAIL ICON=E-mail Icon EMPTY CATEGORIES=Empty Categories EMPTY CATEGORIES IN SECTION=Empty Categories in Section ERROR SAVING MENU ITEM=Error Saving Menu Item -ERRORMENUNAMEEXISTS=A Menu already exists with that Unique Name - you must enter a unique name +ERRORMENUNAMEEXISTS=A Menu already exists with that unique name. You must enter a unique name. EXTERNAL LINK=External Link -EXTERNAL LINK PARAMETERS...=Create a Menu Item that links to another web site or web page. +EXTERNAL LINK PARAMETERS...=Create a Menu Item that links to another Web site. FEED DESCRIPTION=Feed Description FILTER FIELD=Filter Field FORM=Form @@ -97,7 +98,7 @@ ITEM DESCRIPTION=Item Description ITEM MUST HAVE A TITLE=Item must have a Title ITEM RATING=Item Rating ITEM TITLES=Item Titles -ITEM(S) SENT TO THE TRASH=%s Item(s) sent to the Trash +ITEM(S) SENT TO THE TRASH=%s Item(s) sent to the Trash. ITEMID=ItemID LAYOUT=Layout LEAST HITS=Least Hits @@ -164,11 +165,11 @@ OTHER=Other OTHER CATEGORIES=Other Categories PAGINATION=Pagination PAGINATION RESULTS=Pagination Results -PARAMADD=By default http:// will be added unless it detects http:// or https:// in the URL link you provide, this allow you to switch this ability off +PARAMADD=By default, http:// will be added unless it detects http:// or https:// in the URL you provide. This allows you to switch off this functionality. PARAMETERS - ADVANCED=Parameters Advanced PARAMARTICLES=Show/Hide the # of Articles in the Feed -PARAMAUTHOR=Show/Hide the name of the Article Author - only affects this page -PARAMHORIVERT=Show/Hide the Horizontal & Vertical scroll bars. +PARAMAUTHOR=Show/Hide the name of the Article Author (only affects this page) +PARAMHORIVERT=Show/Hide the horizontal & vertical scrollbars. PARAMCATDESC=Show/Hide the Category Description PARAMCATEG=Show/Hide the Category the Item belongs to PARAMCATEGLINK=Make the Category Title a Link to the actual Category page @@ -176,49 +177,50 @@ PARAMCATITEMS=Show/Hide the number of Items in each Category PARAMCATLIST=Show/Hide the List of Categories in list view page PARAMCATLISTCAT=Show/Hide the List of Categories in table view page PARAMCOLUMNS=When displaying the Intro text, set how many columns to use per row -PARAMSHOWHIDE=Show/Hide the Category Description, it will appear below the Category Name +PARAMSHOWHIDE=Show/Hide the Category Description. It will appear below the Category Name. PARAMSHOWHIDELINKS=Show/Hide the description text of the Links -PARAMCREATEDATE=Show/Hide the Item Creation Date - only affects this page -PARAMDATEFORMAT=The format of the date displayed, using PHPs strftime Command Format - if left blank it will load the format from your Language file -PARAMEMAIL=Show/Hide the Item E-mail button - only affects this page +PARAMCREATEDATE=Show/Hide the Item Creation Date (only affects this page) +PARAMDATEFORMAT=The format of the date displayed (using PHPs strftime command Format). If left blank, it will load the format from your language file. +PARAMEMAIL=Show/Hide the Item E-mail button (only affects this page) PARAMFEEDDESC=Show/Hide the description text of the Feed PARAMHEIGHT=Height of the IFrame window -PARAMHEIGHTAUTO=The height will automatically be set to the size of the external page. This will only work for pages on your own domain. If you see a JavaScript error, make sure this parameter is disabled. This will break XHTML compatability for this page. -PARAMIMAGE=The image for this page, must be located in the /images/stories folder. Select the required image from the drop down list. To display no image at all select None Selected. +PARAMHEIGHTAUTO=The height will automatically be set to the size of the external page. This will only work for pages on your own domain. If you see a JavaScript error, make sure this parameter is disabled. This will break XHTML compatibility for this page. +PARAMIMAGE=The image for this page must be located in the /images/stories folder. Select the required image from the dropdown list. To display no image, select None Selected. PARAMINTRO=Number of Articles to display with the Intro text shown. PARAMITEMDESC=Show/Hide the description or Intro text of an Article. PARAMLEADING=Number of Articles to display as a leading (full width) Article. 0 will mean that no Articles will be displayed as leading. -PARAMMODIFYDATE=Show/Hide the Item Modification Date - only affects this page +PARAMMODIFYDATE=Show/Hide the Item Modification Date (only affects this page) PARAMORDERBY=This overrides the Ordering of the Items. PARAMORDERBYSEC=Order that the Items will be displayed in. PARAMOTHERCAT=Show/Hide the Description for the list of other Categories PARAMOTHERCATSECTION=Show/Hide the List of Categories in list view page PARAMTABLECATSEC=Show/Hide the List of Categories in table view page PARAMPAGINATIONRESULTS=Show/Hide Pagination Results Information ( e.g 1-4 of 4 ) -PARAMPDF=Show/Hide the Item PDF button - only affects this page -PARAMPRINT=Show/Hide the Item Print button - only affects this page -PARAMRATING=Show/Hide the Item Rating - only affects this page +PARAMPDF=Show/Hide the Item PDF button (only affects this page) +PARAMPRINT=Show/Hide the Item Print button (only affects this page) +PARAMRATING=Show/Hide the Item Rating (only affects this page) PARAMSECTIONLINK=Make the Section Title a link to the actual Section page PARAMSECURE=Selects whether or not this link should use SSL and the Secure Site URL PARAMSHOWFEEDLINK=Select whether or not the Feed Links will be displayed. PARAMSPECCAT=Shows Contacts only from the selected Category -PARAMWIDTH=Width of the IFrame Window, you can enter an absolute figure in pixels, or a relative figure by adding a % -PARAMWORDCOUNT=Allows you to limit the amount of visible Item description text. 0 (zero) will show all the text +PARAMWIDTH=Width of the iframe window. You can enter an absolute figure in pixels or a relative figure by adding a %. +PARAMWORDCOUNT=Allows you to limit the amount of visible Item description text. 0 will show all the text. PARAMWHENVIEWCAT=When viewing a Category, Show/Hide the list of other Categories -PARAMETERS - BASIC=Parameters - Basic -PARAMETERS - COMPONENT=Parameters - Component -PARAMETERS - SYSTEM=Parameters - System +PARAMETERS - BASIC=Parameters (Basic) +PARAMETERS - COMPONENT=Parameters (Component) +PARAMETERS - SYSTEM=Parameters (System) PDF ICON=PDF Icon PLEASE ENTER A MENU NAME=Please enter a Unique Name for your Menu PLEASE ENTER A MODULE NAME FOR YOUR MENU=Please enter a Module Title for your Menu -PLEASE ENTER A NAME FOR THE COPY OF THE MENU=Please enter a title for the copy of the Menu -PLEASE ENTER A NAME FOR THE NEW MODULE=Please enter a title for the new Module +PLEASE ENTER A NAME FOR THE COPY OF THE MENU=Please enter a title for the copy of the Menu. +PLEASE ENTER A NAME FOR THE NEW MODULE=Please enter a title for the new Module. PLEASE SELECT A CATEGORY=Please select a Category +PLEASE SELECT AN ARTICLE=Please select an Article POLL=Poll PRIMARY ORDER=Primary Order READ MORE=Read more... RSS=RSS -SCROLL BARS=Scroll Bars +SCROLL BARS=Scrollbars SEARCH=Search SECTION NAME=Section Title SECTION NAME LINKABLE=Section Title Linkable @@ -251,30 +253,31 @@ STEP=Step SUBMIT=Submit TABLE HEADINGS=Table Headings TELEPHONE COLUMN=Telephone Column +THE DEFAULT MENU ITEM MUST BE PUBLISHED=The default menu item must be published. THE MENU NAME CANNOT CONTAIN A '=The Menu Name cannot contain a ' character. THERE ARE NO PARAMETERS FOR THIS ITEM=There are no Parameters for this Menu Item THERE ARE NO ADVANCED PARAMETERS FOR THIS ITEM=There are no Advanced Parameters for this Menu Item -TIPLINKS=If Yes, it will show links to Registered content even if you are not logged in. The User will need to Login to see the Article in full. +TIPLINKS=If Yes, it will show links to Registered content even if you are not logged in. The User will need to Login to see the full Article. TIPIFYESTITLECONTENTITEMS=If Yes, the Title of Articles will be hyperlinked to the Article itself. TIPIFSETTOSHOWAUTHOR=If set to Show, the Name of the Author will be displayed. This a global setting but can be changed at Menu and Item levels. TIPIFSETTOSHOWDATETIMECREATED=If set to Show, the Date and Time an Article was created will be displayed. This a global setting but can be changed at Menu and Item levels. -TIPIFSETTOSHOWDATETIMEMODIFIED=If set to Show, the Date and Time an Article was last modified will be displayed. This a global setting but can be changed at Menu and Item levels. +TIPIFSETTOSHOWDATETIMEMODIFIED=If set to Show, the date and time an Article was last modified will be displayed. This a global setting but can be changed at Menu and Item levels. TIPIFSETTOSHOWREADMORELINK=If set to Show, the Read more... link will show if Main text has been created for the Article. TIPIFSETTOSHOWVOTING=If set to Show, a Voting system will be enabled for Articles TIPPRINTPDFEMAIL=Print, PDF, and E-mail will utilise Icons or Text -TIPIFSETTOSHOWHITS=If set to Show, the Hits for a particular Article will be displayed. This a global setting but can be changed at Menu and Article levels. -TIPNAMEUSEDTOIDENTIFYMENU=This is the identification name used by Joomla! to identify this Menu within the code - it must be unique. We recommend that you do not have any spaces in your Unique Name -TIPPARAMLISTMENUITEM=Parameter list will be available once you save this new Menu Item +TIPIFSETTOSHOWHITS=If set to Show, the hits for a particular Article will be displayed. This a global setting but can be changed at Menu and Article levels. +TIPNAMEUSEDTOIDENTIFYMENU=This is the name used by Joomla! to identify this Menu within the code so it must be unique. We recommend that you do not have any spaces in your unique name +TIPPARAMLISTMENUITEM=Parameter list will be available once you save this new Menu Item. TIPTITLEMAINMENUMODULEREQUIRED=Title that will be given to the mod_mainmenu Module in the Module Manager. If left blank, a Module will not be created and the Menu will not be available for display in the Front-end. -TITLE ALPHABETICAL=Title - Alphabetical -TITLE REVERSE-ALPHABETICAL=Title - Reverse Alphabetical +TITLE ALPHABETICAL=Title (Alphabetical) +TITLE REVERSE-ALPHABETICAL=Title (Reverse Alphabetical) TYPE=Type TYPEARTICLAYDESC=Choose an Article view Layout. TYPEARCHLAYDESC=Choose an Archive view Layout. TYPECATEGLAYDESC=Choose a Category view Layout. TYPECATEGORIESDESC=This View shows all Web Link Categories TYPECATEGORYDESC=This view shows a Web Link Category -TYPEFRONTLAYDESC=Front Page is a specialized view of the Articles Component that shows specially selected Articles that have been set to Show on the Front Page. +TYPEFRONTLAYDESC=Front Page is a specialised view of the Articles Component that shows specially selected Articles that have been set to Show on the Front Page. TYPELOGINDESC=Choose a Login view Layout TYPEREGISTERDESC=Create a new Registration form layout TYPEREMINDDESC=Create a new password Reminder form layout @@ -288,14 +291,16 @@ TYPEWRAPPERDESC=This view displays a Wrapper layout URL TO OPEN IN AN IFRAME=URL to open in an IFrame USE SEARCH AREAS=Use Search Areas USER FORM LAYOUT=User Form Layout -USER FORM LAYOUT DESC=This layout allows a User to edit their account details, choose a new password, their language preference for both the Back-end and Front-end, together with their time zone.
    Users with publishing permissions will also be able to choose a text editor.
    Users with administrator permissions will be able to choose also what Help Site they want to use at back-end. +USER FORM LAYOUT DESC=This layout allows a User to edit their account details, choose a new password, language preference for both back-end and front-end, and also their time zone.
    Users with publishing permissions will also be able to choose a text editor.
    Users with administrator permissions will be able to choose what Help Site they prefer on the back-end. USER SELF-MANAGEMENT=User Self-Management VIEW MENUS=View Menus VIEW MENU ITEMS=View Menu Item(s) WEB LINK=Web Link -WHICH FIELD SHALL THE FILTER APPLY TO=Select which field shall the Filter will be applied to +WHICH FIELD SHALL THE FILTER APPLY TO=Select which field the filter will be applied to WORD COUNT=Word Count WRAPPER=Wrapper WRAPPER URL=Wrapper URL -YOU CANNOT TRASH THE DEFAULT MENU ITEM=You cannot trash the default menu item -YOU CANNOT UNPUBLISH THE DEFAULT MENU ITEM=You cannot unpublish the default Menu Item +YOU CANNOT TRASH THE DEFAULT MENU ITEM=You cannot trash the default menu item. +YOU CANNOT UNPUBLISH THE DEFAULT MENU ITEM=You cannot unpublish the default menu item. +ARTICLE ORDER=Article Order +ORDER THAT THE ARTICLES WILL BE DISPLAYED IN.=Order in which Articles will be displayed. diff --git a/administrator/language/en-GB/en-GB.com_messages.ini b/administrator/language/en-GB/en-GB.com_messages.ini index 3f6c93ba8fb49..8e2acd33c9836 100644 --- a/administrator/language/en-GB/en-GB.com_messages.ini +++ b/administrator/language/en-GB/en-GB.com_messages.ini @@ -12,9 +12,9 @@ FROM=From GENERAL=General LOCK INBOX=Lock Inbox MAIL ME ON NEW MESSAGE=Mail me on new Message -MESSAGE_FAILED=Message Failed. The User has locked their Mail Box. +MESSAGE_FAILED=Message Failed. The User has locked their message box. NEW PRIVATE MESSAGE=New Private Message -PLEASE LOGIN TO READ YOUR MESSAGE=Please login to %s to read your message. +PLEASE LOGIN TO READ YOUR MESSAGE=Please log in to %s to read your message. POSTED=Posted PRIVATE MESSAGING=Private Messaging PRIVATE MESSAGING CONFIGURATION=Private Messaging Configuration @@ -33,3 +33,4 @@ YOU MUST PROVIDE A SUBJECT.=You must enter a subject. YOU MUST SELECT A RECIPIENT.=You must select a recipient. + diff --git a/administrator/language/en-GB/en-GB.com_modules.ini b/administrator/language/en-GB/en-GB.com_modules.ini index 52cc4b02514b5..5b8c93b930bcc 100644 --- a/administrator/language/en-GB/en-GB.com_modules.ini +++ b/administrator/language/en-GB/en-GB.com_modules.ini @@ -15,6 +15,7 @@ COMPONENT LIST=Component List COPY OF=Copy of %s CUSTOM HTML=Custom HTML CUSTOM OUTPUT=Custom Output +DESELECT FROM LIST=Hide from Menu Item(s) in the List EDIT=Edit EDIT MENU=Click to Edit this Menu EDIT MODULE=Click to Edit this Module @@ -27,7 +28,7 @@ LOGGED IN USERS=Logged in Users LOGIN FORM=Login Form MENU TAG ID=Menu Tag ID MODULE=Module -MODULE_POSITION_TIP_TEXT=You may select a Module position from the drop down box of predefined positions or enter your own Module position by typing in the name. +MODULE_POSITION_TIP_TEXT=You may select a Module position from the dropdown box of pre-defined positions or enter your own Module position by typing in the name. MODULE_POSITION_TIP_TITLE=Module Positions MODULE CLASS SUFFIX=Module Class Suffix MODULE MANAGER=Module Manager @@ -45,20 +46,20 @@ NO CACHING=No Caching NUM=# ONLINE USERS=Online Users PAGES=Pages -PARAMMODULECLASSSUFFIX=A suffix to be applied to the CSS class of the Module, this allows individual Module styling +PARAMMODULECLASSSUFFIX=A suffix to be applied to the CSS class of the Module. This allows for individual Module styling. POPULAR ITEMS=Popular Articles PUBLISH=Enable PUBLISH ITEM=Enable Module PUBLISHED=Enabled RESET=Reset -SELECT FROM LIST=Select Menu Item(s) from the List +SELECT FROM LIST=Show on Menu Item(s) in the List SELECT WHETHER TO CACHE THE CONTENT OF THIS MODULE=Select whether to Cache the content of this Module SELECT POSITION=Select Position SELECT TEMPLATE=Select Template SELECT TYPE=Select Type SHOW TITLE=Show Title SITE MODULES=Site Modules -THE TIME BEFORE THE MODULE IS RECACHED=The period of time - in minutes - before the Module is recached +THE TIME BEFORE THE MODULE IS RECACHED=The period of time in minutes before the Module is re-cached. THERE ARE NO PARAMETERS FOR THIS ITEM=There are no Parameters for this Module THIS MODULE DISPLAYS THE BREADCRUMBS=This Module displays the Breadcrumbs THIS MODULE ALLOWS THE DISPLAYING OF A SYNDICATED FEED=This Module allows the display of a Syndicated Feed @@ -70,7 +71,7 @@ UNPUBLISHED=Disabled UNREAD ITEMS=Unread Messages USER STATUS=User Status VARIES=Varies -WARNMAINMENU=You cannot delete the mod_mainmenu Module that displays the mainmenu as it is a Core Menu -WARNMODULES=cannot be deleted they can only be un-installed as they are Joomla! Modules. +WARNMAINMENU=You cannot delete the mod_mainmenu Module because it is a core Menu. +WARNMODULES=cannot be deleted they can only be uninstalled as they are Joomla! Modules. WHO\'S ONLINE=Who's Online YOU CAN ONLY PREVIEW NEW MODULES.=You can only preview new Modules. diff --git a/administrator/language/en-GB/en-GB.com_newsfeeds.ini b/administrator/language/en-GB/en-GB.com_newsfeeds.ini index 11514218f06f4..85b64881d5ac1 100644 --- a/administrator/language/en-GB/en-GB.com_newsfeeds.ini +++ b/administrator/language/en-GB/en-GB.com_newsfeeds.ini @@ -1,75 +1,76 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -A FEED=A feed -ALIGNMENT OF THE IMAGE=Alignment of the image. -CACHE DIRECTORY=Cache Directory -CACHE TIME=Cache Time -CATEGORY DESCRIPTION=Category Description -CATEGORIES GROUP=All Categories -CATEGORIES GROUP DESC=This view shows all News Feed Categories. -CATEGORY GROUP=Category -CATEGORY GROUP DESC=This view shows a News Feed Category. -CATEGORY LIST - CATEGORY=Category List - Category -CATEGORY LIST - SECTION=Category List - Section -CHANGES TO NEWSFEED SAVED=Changes to News Feed saved -DESCNEWITEMSLAST=New News Feeds default to the last place. Ordering can be changed after this News Feed is saved. -DESCRIPTION FOR PAGE=Description for page -DESCRIPTION TEXT=Description Text -EDIT NEWSFEED=Edit News Feed -FEED=Feed -FEED DESCRIPTION=Feed Description -IMAGE ALIGN=Image Align -INDIVIDUAL FEED GROUP=Individual Feed -INDIVIDUAL FEED GROUP DESC=This view shows a single News Feed. -ITEM DESCRIPTION=Item Description -LINK=Link -LINK COLUMN=Link Column -NAME COLUMN=Name Column -NEWS FEED=News Feed Name -NEWSFEED=News Feed -NEWSFEED CATEGORY LAYOUT=Category Layout -NEWSFEED CATEGORY LAYOUT DESC=This layout shows a list of News Feeds in a Category. -NEWSFEED CATEGORY LIST LAYOUT=Category List Layout -NEWSFEED CATEGORY LIST LAYOUT DESC=This layout shows a list of all News Feed Categories. -NEWSFEED LAYOUT=News Feed Layout -NEWSFEED MANAGER=News Feed Manager -NEWSFEED SINGLE LAYOUT=Single Feed Layout -NEWSFEED SINGLE LAYOUT DESC=This layout shows a single News Feed. -NEWSFEED SAVED=News Feed saved -NUM CATEGORY ITEMS=# Category Items -NUM ARTICLES=# Articles -NUM ARTICLES COLUMN=# Articles Column -NUMBER OF ARTICLES=Number of Articles -PARAMARTICLES=Show/Hide the # of Articles in the Feed -PARAMCATDESC=Show/Hide the Category Description -PARAMCATSELECT=A News Feed Category (optional) -PARAMCATITEMS=Show/Hide the number of Items in each Category -PARAMFEEDDESC=Show/Hide the description text of the Feed -PARAMIMAGE=Image for page, must be located in the /images/stories folder. Default will load web_links.jpg, No image will mean an image is not loaded -PARAMITEMDESC=Show/Hide the description or Intro text of an Item -PARAMOTHERCAT=Show/Hide the List of Categories in table view page -PARAMOTHERCATSECTION=Show/Hide the List of Categories in list view page -PARAMWORDCOUNT=Allows you to limit the amount of visible Item Description text. 0 will show all the text -PLEASE FILL IN THE CACHE REFRESH TIME.=Please input the Cache refresh time. -PLEASE FILL IN THE NEWSFEED LINK.=Please input the News Feed Link. -PLEASE FILL IN THE NEWSFEED NAME.=Please input the News Feed Name. -RTL FEED=RTL Feed -SELECT FEED=Select Feed -SHOW/HIDE THE DESCRIPTION BELOW=Show/Hide the Description below -SHOW/HIDE THE FEED LINK COLUMN=Show/Hide the Feed Link column -SHOW/HIDE THE FEED NAME COLUMN=Show/Hide the Feed Name column -SHOW/HIDE THE IMAGE OF THE FEED=Show/Hide the image of the Feed -SHOW LIMIT BOX=Show Limit Box -SHOW/HIDE THE LIMIT BOX=Show/Hide the limit box -SHOW/HIDE THE TABLE HEADINGS=Show/Hide the Table Headings -TABLE HEADINGS=Table Headings -THIS COMPONENT MANAGES RSS/RDF NEWSFEEDS=This Component manages RSS/RDF News Feeds -TIPCACHETIME=The number of minutes before the News Feed cache is refreshed. -UNWRITABLE=Unwritable -VALIDARTICLESDISPLAY=Please input the number of Articles to display. -WORD COUNT=Word Count -WRITABLE=Writable +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +A FEED=A feed +ALIGNMENT OF THE IMAGE=Alignment of the image. +CACHE DIRECTORY=Cache Directory +CACHE TIME=Cache Time +CATEGORY DESCRIPTION=Category Description +CATEGORIES GROUP=All Categories +CATEGORIES GROUP DESC=This view shows all News Feed Categories. +CATEGORY GROUP=Category +CATEGORY GROUP DESC=This view shows a News Feed Category. +CATEGORY LIST - CATEGORY=Category List (Category) +CATEGORY LIST - SECTION=Category List (Section) +CHANGES TO NEWSFEED SAVED=Changes to News Feed saved +DESCNEWITEMSLAST=New News Feeds default to the last position. Ordering can be changed after this News Feed is saved. +DESCRIPTION FOR PAGE=Description for page +DESCRIPTION TEXT=Description Text +EDIT NEWSFEED=Edit News Feed +FEED=Feed +FEED DESCRIPTION=Feed Description +IMAGE ALIGN=Image Align +INDIVIDUAL FEED GROUP=Individual Feed +INDIVIDUAL FEED GROUP DESC=This view shows a single News Feed. +ITEM DESCRIPTION=Item Description +LINK=Link +LINK COLUMN=Link Column +NAME COLUMN=Name Column +NEWS FEED=News Feed Name +NEWSFEED=News Feed +NEWSFEED CATEGORY LAYOUT=Category Layout +NEWSFEED CATEGORY LAYOUT DESC=This layout shows a list of News Feeds in a Category. +NEWSFEED CATEGORY LIST LAYOUT=Category List Layout +NEWSFEED CATEGORY LIST LAYOUT DESC=This layout shows a list of all News Feed Categories. +NEWSFEED LAYOUT=News Feed Layout +NEWSFEED MANAGER=News Feed Manager +NEWSFEED SINGLE LAYOUT=Single Feed Layout +NEWSFEED SINGLE LAYOUT DESC=This layout shows a single News Feed. +NEWSFEED SAVED=News Feed saved +NUM CATEGORY ITEMS=# Category Items +NUM ARTICLES=# Articles +NUM ARTICLES COLUMN=# Articles Column +NUMBER OF ARTICLES=Number of Articles +PARAMARTICLES=Show/Hide the # of Articles in the Feed +PARAMCATDESC=Show/Hide the Category Description +PARAMCATSELECT=A News Feed Category (optional) +PARAMCATITEMS=Show/Hide the number of Items in each Category +PARAMFEEDDESC=Show/Hide the description text of the Feed +PARAMIMAGE=Image for page must be located in the /images/stories folder. Default will load web_links.jpg, No image will mean an image is not loaded. +PARAMITEMDESC=Show/Hide the description or Intro text of an Item +PARAMOTHERCAT=Show/Hide the List of Categories in table view page +PARAMOTHERCATSECTION=Show/Hide the List of Categories in list view page +PARAMWORDCOUNT=Allows you to limit the amount of visible Item Description text. 0 will show all the text. +PLEASE FILL IN THE CACHE REFRESH TIME.=Please input the Cache refresh time. +PLEASE FILL IN THE NEWSFEED LINK.=Please input the News Feed Link. +PLEASE FILL IN THE NEWSFEED NAME.=Please input the News Feed Name. +PLEASE SELECT A FEED=Please select a Feed +RTL FEED=RTL Feed +SELECT FEED=Select Feed +SHOW/HIDE THE DESCRIPTION BELOW=Show/Hide the Description below +SHOW/HIDE THE FEED LINK COLUMN=Show/Hide the Feed Link column +SHOW/HIDE THE FEED NAME COLUMN=Show/Hide the Feed Name column +SHOW/HIDE THE IMAGE OF THE FEED=Show/Hide the image of the Feed +SHOW LIMIT BOX=Show Limit Box +SHOW/HIDE THE LIMIT BOX=Show/Hide the limit box +SHOW/HIDE THE TABLE HEADINGS=Show/Hide the Table Headings +TABLE HEADINGS=Table Headings +THIS COMPONENT MANAGES RSS/RDF NEWSFEEDS=This Component manages RSS/RDF News Feeds +TIPCACHETIME=The number of minutes before the News Feed cache is refreshed. +UNWRITABLE=Unwritable +VALIDARTICLESDISPLAY=Please input the number of Articles to display. +WORD COUNT=Word Count +WRITABLE=Writable diff --git a/administrator/language/en-GB/en-GB.com_newsfeeds.menu.ini b/administrator/language/en-GB/en-GB.com_newsfeeds.menu.ini index 3e29889094f64..597288effa09b 100644 --- a/administrator/language/en-GB/en-GB.com_newsfeeds.menu.ini +++ b/administrator/language/en-GB/en-GB.com_newsfeeds.menu.ini @@ -1,9 +1,9 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -COM_NEWSFEEDS=News Feeds -COM_NEWSFEEDS.FEEDS=Feeds -COM_NEWSFEEDS.CATEGORIES=Categories +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +COM_NEWSFEEDS=News Feeds +COM_NEWSFEEDS.FEEDS=Feeds +COM_NEWSFEEDS.CATEGORIES=Categories diff --git a/administrator/language/en-GB/en-GB.com_plugins.ini b/administrator/language/en-GB/en-GB.com_plugins.ini index 4de63ab5e6216..671c85f264e15 100644 --- a/administrator/language/en-GB/en-GB.com_plugins.ini +++ b/administrator/language/en-GB/en-GB.com_plugins.ini @@ -1,30 +1,30 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -FOLDER=Folder -PLUGIN=Plugin -PLUGIN DETAILS=Plugin Details -PLUGIN FILE=Plugin File -PLUGIN MANAGER=Plugin Manager -PLUGIN MUST HAVE A FILENAME=Plugin must have a Filename -PLUGIN MUST HAVE A NAME=Plugin must have a name -PLUGIN NAME=Plugin Name -PLUGIN PARAMETERS=Plugin Parameters -PUBLISH=Enable -PUBLISH ITEM=Enable Plugin -PUBLISHED=Enabled -NO PARAMETERS=No Parameters -SELECT A PLUGIN TO=Select a Plugin to -SELECT TYPE=Select Type -SITE=Site -SITE PLUGIN=Site Plugin -SUCCESSFULLY SAVED CHANGES TO PLUGIN=Successfully saved changes to Plugin: %s -SUCCESSFULLY SAVED PLUGIN=Successfully saved Plugin: %s -THERE ARE NO PARAMETERS FOR THIS ITEM=There are no Parameters for this Plugin -THIS PLUGIN CANNOT BE REORDERED=This Plugin cannot be reordered -UNPUBLISH=Disable -UNPUBLISH ITEM=Disable Plugin +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +FOLDER=Folder +PLUGIN=Plugin +PLUGIN DETAILS=Plugin Details +PLUGIN FILE=Plugin File +PLUGIN MANAGER=Plugin Manager +PLUGIN MUST HAVE A FILENAME=Plugin must have a Filename +PLUGIN MUST HAVE A NAME=Plugin must have a name +PLUGIN NAME=Plugin Name +PLUGIN PARAMETERS=Plugin Parameters +PUBLISH=Enable +PUBLISH ITEM=Enable Plugin +PUBLISHED=Enabled +NO PARAMETERS=No Parameters +SELECT A PLUGIN TO=Select a Plugin to +SELECT TYPE=Select Type +SITE=Site +SITE PLUGIN=Site Plugin +SUCCESSFULLY SAVED CHANGES TO PLUGIN=Successfully saved changes to Plugin: %s +SUCCESSFULLY SAVED PLUGIN=Successfully saved Plugin: %s +THERE ARE NO PARAMETERS FOR THIS ITEM=There are no Parameters for this Plugin +THIS PLUGIN CANNOT BE REORDERED=This Plugin cannot be reordered +UNPUBLISH=Disable +UNPUBLISH ITEM=Disable Plugin UNPUBLISHED=Disabled \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.com_poll.ini b/administrator/language/en-GB/en-GB.com_poll.ini index d7a0fcfc336ac..b81a755e977d4 100644 --- a/administrator/language/en-GB/en-GB.com_poll.ini +++ b/administrator/language/en-GB/en-GB.com_poll.ini @@ -4,6 +4,7 @@ # License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php # Note : All ini files need to be saved as UTF-8 - No BOM +A POLL=A poll ALL=All CHANGES TO POLL SAVED=Changes to Poll saved (SECONDS BETWEEN VOTES)=(seconds between votes) @@ -16,6 +17,7 @@ OPTIONS=Options # PLEASE MAKE A SELECTION FROM THE LIST TO=Please select a Poll from the list #instead of PLEASE MAKE A SELECTION FROM THE LIST TO=Please select a Poll from the list to %s +PLEASE SELECT A POLL=Please select a poll POLL=Poll POLL LAYOUT=Poll Layout POLL MANAGER=Poll Manager @@ -23,6 +25,7 @@ POLL MUST HAVE A NON-ZERO LAG TIME=Poll must have a non-zero lag time POLL MUST HAVE A TITLE=Poll must have a Title POLL TITLE=Poll Title POLL SAVED=Poll saved +SELECT POLL=Select Poll SHOW ON MENU ITEMS=Show on Menu Items STANDARD POLL LAYOUT DESC=The Poll layout displays the Poll results. THE POLL=The Poll @@ -31,3 +34,5 @@ UNASSIGNED=Unassigned VOTES=Votes + + diff --git a/administrator/language/en-GB/en-GB.com_poll.menu.ini b/administrator/language/en-GB/en-GB.com_poll.menu.ini index 13fb0354688ee..38804c8e7b871 100644 --- a/administrator/language/en-GB/en-GB.com_poll.menu.ini +++ b/administrator/language/en-GB/en-GB.com_poll.menu.ini @@ -1,7 +1,7 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -COM_POLL=Polls +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +COM_POLL=Polls diff --git a/administrator/language/en-GB/en-GB.com_search.ini b/administrator/language/en-GB/en-GB.com_search.ini index 8f38039ae874f..5ae973ee96e3e 100644 --- a/administrator/language/en-GB/en-GB.com_search.ini +++ b/administrator/language/en-GB/en-GB.com_search.ini @@ -1,19 +1,19 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCSEARCH=This Component manages the Search functionality. -GATHER SEARCH STATISTICS=Gather Search Statistics -HIDE SEARCH RESULTS=Hide Search Results -RESULTS RETURNED=Results Returned -SEARCH LOGGING=Search Logging -SEARCH STATISTICS=Search Statistics -SEARCH TEXT=Search Text -SHOW CREATED DATE=Show Created Date -SHOW SEARCH RESULTS=Show Search Results -STANDARD SEARCH FORM=Standard Search Form -STANDARD SEARCH LAYOUT DESC=The standard Search layout displays the Search Form and result. -TIMES REQUESTED=Times Requested +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCSEARCH=This Component manages the Search functionality. +GATHER SEARCH STATISTICS=Gather Search Statistics +HIDE SEARCH RESULTS=Hide Search Results +RESULTS RETURNED=Results Returned +SEARCH LOGGING=Search Logging +SEARCH STATISTICS=Search Statistics +SEARCH TEXT=Search Text +SHOW CREATED DATE=Show Created Date +SHOW SEARCH RESULTS=Show Search Results +STANDARD SEARCH FORM=Standard Search Form +STANDARD SEARCH LAYOUT DESC=The standard Search layout displays the Search Form and result. +TIMES REQUESTED=Times Requested TIPSEARCHSTATISTICS=Enable/Disable collection of site statistics \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.com_search.menu.ini b/administrator/language/en-GB/en-GB.com_search.menu.ini index 3948e0ad9f3b4..3a298646b5db2 100644 --- a/administrator/language/en-GB/en-GB.com_search.menu.ini +++ b/administrator/language/en-GB/en-GB.com_search.menu.ini @@ -1,7 +1,7 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -COM_SEARCH=Search +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +COM_SEARCH=Search diff --git a/administrator/language/en-GB/en-GB.com_statistics.ini b/administrator/language/en-GB/en-GB.com_statistics.ini index a057532da7133..88487ab9e963f 100644 --- a/administrator/language/en-GB/en-GB.com_statistics.ini +++ b/administrator/language/en-GB/en-GB.com_statistics.ini @@ -1,30 +1,30 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -BROWSERS=Browsers -BROWSER, OS, DOMAIN STATISTICS=Browser, OS, Domain Statistics -DISABLED=Disabled -DOMAIN=Domain -DOMAIN STATS=Domain Stats -HIDE SEARCH RESULTS=Hide Search Results -LOGGING IS=Logging is -OPERATING SYSTEM=Operating System -OS STATS=OS Stats -ARTICLE IMPRESSION STATISTICS=Article Impression Statistics -ARTICLE IMPRESSIONS=Article Impressions -RESULTS RETURNED=Results Returned -SEARCH ENGINE TEXT=Search Engine Text -SEARCH TEXT=Search Text -SORT ASCENDING=Sort Ascending -SORT DESCENDING=Sort Descending -TIMES REQUESTED=Times Requested -RESET STATISTICS FAILED=Reset Statistics Failed -RESET STATISTICS SUCCES=Reset Statistics Succeeded -SHOW SEARCH RESULTS=Show Search Results -UNCATEGORIZED=Uncategorized -WARN_RESULTS=Activating this can dramatically slow, and even lock, your site as it is a highly query intensive operation -BROWSER, OS, DOMAIN=Browser, OS, Domain -SEARCH LOGGING=Search Logging +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +BROWSERS=Browsers +BROWSER, OS, DOMAIN STATISTICS=Browser, OS, Domain Statistics +DISABLED=Disabled +DOMAIN=Domain +DOMAIN STATS=Domain Stats +HIDE SEARCH RESULTS=Hide Search Results +LOGGING IS=Logging is +OPERATING SYSTEM=Operating System +OS STATS=OS Stats +ARTICLE IMPRESSION STATISTICS=Article Impression Statistics +ARTICLE IMPRESSIONS=Article Impressions +RESULTS RETURNED=Results Returned +SEARCH ENGINE TEXT=Search Engine Text +SEARCH TEXT=Search Text +SORT ASCENDING=Sort Ascending +SORT DESCENDING=Sort Descending +TIMES REQUESTED=Times Requested +RESET STATISTICS FAILED=Reset Statistics Failed +RESET STATISTICS SUCCES=Reset Statistics Succeeded +SHOW SEARCH RESULTS=Show Search Results +UNCATEGORIZED=Uncategorised +WARN_RESULTS=Activating this can dramatically slow, and even lock up your Web site because it is a highly query-intensive operation. +BROWSER, OS, DOMAIN=Browser, OS, Domain +SEARCH LOGGING=Search Logging diff --git a/administrator/language/en-GB/en-GB.com_templates.ini b/administrator/language/en-GB/en-GB.com_templates.ini index cbdb1367c332e..c7c6236504ea3 100644 --- a/administrator/language/en-GB/en-GB.com_templates.ini +++ b/administrator/language/en-GB/en-GB.com_templates.ini @@ -56,10 +56,10 @@ THE FILE IS NOT WRITABLE.=The File is not writable. THERE ARE NO PARAMETERS FOR THIS ITEM=There are no parameters for this item. THIS FILE IS=This file is YOU CAN NOT DELETE TEMPLATE IN USE.=You can not delete a Template that is in use. -WRONG FILE TYPE GIVEN, ONLY CSS FILES CAN BE EDITED.=Wrong file type given, only CSS files can be edited. +WRONG FILE TYPE GIVEN, ONLY CSS FILES CAN BE EDITED.=Wrong file type given. Only CSS files can be edited. MENU ASSIGNMENT=Menu Assignment -CANNOT ASSIGN DEFAULT TEMPLATE=Cannot assign Default Template +CANNOT ASSIGN DEFAULT TEMPLATE=Cannot assign default template. CANNOT ASSIGN AN ADMINISTRATOR TEMPLATE=Cannot assign an Administrator Template CANNOT ASSIGN ADMINISTRATOR TEMPLATE=Cannot assign an Administrator Template -PARAMSWRITABLE=The Parameter-File %s is Writable! -PARAMSUNWRITABLE=The Parameter-File %s is Unwritable! \ No newline at end of file +PARAMSWRITABLE=The parameter file %s is writable! +PARAMSUNWRITABLE=The parameter file %s is unwritable! diff --git a/administrator/language/en-GB/en-GB.com_trash.ini b/administrator/language/en-GB/en-GB.com_trash.ini index b160f53d84884..90636caac8036 100644 --- a/administrator/language/en-GB/en-GB.com_trash.ini +++ b/administrator/language/en-GB/en-GB.com_trash.ini @@ -8,8 +8,8 @@ PERMDELETETHESEITEMS=* This will Permanently Delet RESTOREITEMS=* This will Restore these Items, DELETE=Delete DELETE ITEMS=Permanently Delete Items -ITEM(S) SUCCESSFULLY DELETED=%s Item(s) permanently deleted -ITEM(S) SUCCESSFULLY RESTORED=%s Item(s) successfully restored +ITEM(S) SUCCESSFULLY DELETED=%s Item(s) permanently deleted. +ITEM(S) SUCCESSFULLY RESTORED=%s Item(s) successfully restored. ITEMS BEING DELETED=Items being deleted ITEMS BEING RESTORED=Items being restored MENU=Menu @@ -22,9 +22,10 @@ PARAMTRASH=This Component manages the Trash functionality. PLEASE MAKE A SELECTION FROM THE LIST TO=Please select an Item from the list to %s PERMANENTLY DELETE=Permanently Delete RESTORE ITEMS=Restore Items -TIPWILLBERETURNED=they will be returned to their original places as Unpublished Items * +TIPWILLBERETURNED=they will be returned to their original places as unpublished Items. * TRASH MANAGER=Trash Manager -UNCATEGORIZED=Uncategorized +UNCATEGORIZED=Uncategorised WARNRESTORE=Are you sure you want to restore the listed Items? WARNWANTDELLISTEDITEMS=Are you sure you want to delete the listed Items?
    This will Permanently Delete them from the database. + diff --git a/administrator/language/en-GB/en-GB.com_user.ini b/administrator/language/en-GB/en-GB.com_user.ini index 863591d7495f1..bc833069d8bb6 100644 --- a/administrator/language/en-GB/en-GB.com_user.ini +++ b/administrator/language/en-GB/en-GB.com_user.ini @@ -6,8 +6,6 @@ ALIGNMENT FOR LOGIN IMAGE=Alignment for Login image ALIGNMENT FOR LOGOUT IMAGE=Alignment for Logout image -E_NOLOGIN_ACCESS=You do not have access to the administrator section of this site. -E_NOLOGIN_BLOCKED=Login denied! Your account has either been blocked or you have not activated it yet. IMAGE FOR THE LOGIN PAGE=Image for the Login page IMAGE FOR THE LOGOUT PAGE=Image for the Logout page LOGIN DESCRIPTION=Login Description @@ -25,13 +23,13 @@ LOGOUT JS MESSAGE=Logout JS Message LOGOUT PAGE TITLE=Logout Page Title LOGOUT REDIRECTION URL=Logout Redirection URL PARAMETERS FOR LOGIN COMPONENT=Parameters for Login Component -PARAMLOGINDESCTEXT=Text to display on the Login Page, if left blank _LOGIN_DESCRIPTION will be used -PARAMLOGINJSMESSAGE=Show/Hide the JavaScript Pop-up indicating login success -PARAMLOGINURL=What page will the User be redirected to after succesful Login. If left blank the default setting is to load the Front Page. -PARAMLOGOUTDESCTEXT=Text to display on the Logout Page, if left blank _LOGOUT_DESCRIPTION will be used +PARAMLOGINDESCTEXT=Text to display on the login page. If left blank, _LOGIN_DESCRIPTION will be used. +PARAMLOGINJSMESSAGE=Show/Hide the JavaScript pop-up indicating login success. +PARAMLOGINURL=What page Users will be redirected to after a succesful login. If left blank, the default setting is the front page. +PARAMLOGOUTDESCTEXT=Text to display on the logout page. If left blank, _LOGOUT_DESCRIPTION will be used. PARAMLOGOUTJSMESSAGE=Show/Hide the JavaScript Pop-up indicating logout success PARAMLOGOUTPAGETITLE=Text to display at the top of the page. If left blank, the Menu name will be used by default. -PARAMLOGOUTURL=What page will the User be redirected to after a successful Logout. If left blank the default setting is to load the Front Page +PARAMLOGOUTURL=What page Users will be redirected to after a successful logout. If left blank, the default setting is to load the front page. SHOW LOGIN PAGE TITLE=Show Login Page Title SHOW LOGOUT PAGE TITLE=Show Logout Page Title SHOW/HIDE THE LOGIN PAGE TITLE=Show/Hide the Login Page Title @@ -39,3 +37,4 @@ SHOW/HIDE THE LOGOUT PAGE TITLE=Show/Hide the Logout Page Title SHOW/HIDE THE LOGIN DESCRIPTION BELOW=Show/Hide the Login Description below SHOW/HIDE THE LOGOUT DESCRIPTION BELOW=Show/Hide the Logout Description below + diff --git a/administrator/language/en-GB/en-GB.com_users.ini b/administrator/language/en-GB/en-GB.com_users.ini index 79f084652b611..10aa32624908c 100644 --- a/administrator/language/en-GB/en-GB.com_users.ini +++ b/administrator/language/en-GB/en-GB.com_users.ini @@ -25,7 +25,7 @@ LOGOUT=Logout MISC=Miscellaneous
    Information NEVER=Never NEW PASSWORD=New Password -NEW_USER_MESSAGE=Hello %s,\n\n\nYou have been added as a User to %s by an Administrator.\n\nThis e-mail contains your username and password to log into %s\n\nUsername - %s\nPassword - %s\n\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only. +NEW_USER_MESSAGE=Hello %s,\n\n\nYou have been added as a User to %s by an Administrator.\n\nThis e-mail contains your username and password to log in to %s\n\nUsername: %s\nPassword: %s\n\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only. NEW_USER_MESSAGE_SUBJECT=New User Details NO CONTACT DETAILS LINKED TO THIS USER=No Contact details linked to this User NOTICE=Notice @@ -50,22 +50,22 @@ SELECT LOG STATUS=Select Log Status SUCCESSFULLY SAVED CHANGES TO USER=Successfully saved changes to User: %s SUCCESSFULLY SAVED USER=Successfully saved User: %s TIME ZONE FOR THIS USER=Time Zone for this User -USER DELETED=User successfully deleted +USER DELETED=User successfully deleted. USER DETAILS=User Details USER EDITOR=User Editor USER MANAGER=User Manager USERS=Users -USER SESSION ENDED=User Session Ended +USER SESSION ENDED=User session ended. VERIFY PASSWORD=Verify Password -WARN_ONLY_SUPER=You cannot change this User's Group as the User is the only active Super Administrator for your site. -WARNDELETE=You cannot delete another Administrator only Super Administrators have this authority. -WARNLOGININVALID=Your Login Name contains invalid characters or is too short. -WARNREG_EMAIL_INUSE=This e-mail address is already registered -WARNREG_MAIL=Please enter a valid e-mail address -WARNREG_INUSE=This username is already in use -WARNSELECTPB=Please Select another Group as Public Back-end is not a selectable option. -WARNSELECTPF=Please Select another Group as Public Front-end is not a selectable option. -WARNSUPERADMINCREATE=You cannot create a User with this User Group level, only Super Administrators have this ability. +WARN_ONLY_SUPER=You cannot change this User's Group because the User is the only active Super Administrator for your site. +WARNDELETE=You cannot delete another Administrator. Only Super Administrators have this ability. +WARNLOGININVALID=Your username contains invalid characters or is too short. +WARNREG_EMAIL_INUSE=This e-mail address is already registered. +WARNREG_MAIL=Please enter a valid e-mail address. +WARNREG_INUSE=This username is already in use. +WARNSELECTPB=Please select another Group. Public Back-end is not a selectable option. +WARNSELECTPF=Please select another Group. Public Front-end is not a selectable option. +WARNSUPERADMINCREATE=You cannot create a User with this User Group level. Only Super Administrators have this ability. WYSIWYG EDITOR FOR THIS USER=WYSIWYG Editor for this User YOU CANNOT DELETE A SUPER ADMINISTRATOR=You cannot delete a Super Administrator. YOU CANNOT BLOCK A SUPER ADMINISTRATOR=You cannot block a Super Administrator. diff --git a/administrator/language/en-GB/en-GB.com_weblinks.ini b/administrator/language/en-GB/en-GB.com_weblinks.ini index 7f5a2e145f987..844438b78729c 100644 --- a/administrator/language/en-GB/en-GB.com_weblinks.ini +++ b/administrator/language/en-GB/en-GB.com_weblinks.ini @@ -1,48 +1,48 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ALIGNMENT OF THE IMAGE=Alignment of the Image -BACK BUTTON=Back Button -CATEGORY LIST - SECTION=Category List - Section -CATEGORY LIST - CATEGORY=Category List - Category -CHANGES TO WEBLINK SAVED=Changes to Web Link saved -DESCRIPTION TEXT=Description Text -DESCNEWITEMSLAST=New Web Links default to the last place. Ordering can be changed after this Web Link is saved. -EDIT WEBLINKS=Edit Web Links -ICON=Icon -IMAGE ALIGN=Image Align -LINK DESCRIPTIONS=Link Descriptions -OTHER CATEGORIES=Other Categories -PARAMBACKBUTTON=Show/Hide a Back Button, that returns you to the previously viewed page -PARAMCATSELECT=A Web Links Category (optional) -PARAMICONIMG=Icon to be used to the left of the URL Links in table view -PARAMSHOWHIDEDESC=Show/Hide the Description text of the Links -PARAMSHOWHIDELINKS=Show/Hide the Links -PARAMOTHERCATSECTION=Show/Hide the list of Categories in list view page -PARAMOTHERCAT=Show/Hide the list of Categories in table view page -PARAMIMAGE=Image for page, must be located in the /images/stories folder. Default will load web_links.jpg. No image will mean an image is not loaded -PARAMLINKICONS=Icon to be used to the left of the URL Links in table view -PARAMWHENVIEWCAT=Show/Hide other Web Link Categories -SHOW/HIDE THE DESCRIPTION BELOW=Show/Hide the Description below -SHOW/HIDE THE HITS COLUMN=Show/Hide the Hits column -SHOW/HIDE THE TABLE HEADINGS=Show/Hide the Table Headings -TABLE HEADINGS=Table Headings -TARGET=Target -TARGET WINDOW WHEN THE LINK IS CLICKED=Target browser window when the Link is clicked -THIS COMPONENT SHOWS A LISTING OF WEBLINKS=This Component shows a listing of Web Links -WEBLINK=Web Link -WEBLINK ITEM MUST HAVE A TITLE=Web Link Item must have a Title -WEBLINK MANAGER=Web Link Manager -WEBLINK SAVED=Web Link saved -WEBLINK CATEGORY LIST LAYOUT=Web Link Category List Layout -WEBLINK CATEGORY LIST LAYOUT DESC=This layout shows a list of all the Web Link Categories. -WEBLINK STANDARD CATEGORY LAYOUT=Category List Layout -WEBLINK STANDARD CATEGORY LAYOUT DESC=This layout shows a list of all the Web Links within a particular Category. -WEBLINK SUBMISSION LAYOUT= Web Link Submission Layout -WEBLINK SUBMISSION LAYOUT DESC=Allow Registered Users to submit a Web Link. -WEBLINKS INTRO=Web Links Introduction -WEBLINKS_INTRO_DESC=This text is shown above the Categories overview. -YOU MUST HAVE A URL.=You must enter a URL. +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ALIGNMENT OF THE IMAGE=Alignment of the Image +BACK BUTTON=Back Button +CATEGORY LIST - SECTION=Category List (Section) +CATEGORY LIST - CATEGORY=Category List (Category) +CHANGES TO WEBLINK SAVED=Changes to Web Link saved +DESCRIPTION TEXT=Description Text +DESCNEWITEMSLAST=New Web Links default to the last position. Ordering can be changed after this Web Link is saved. +EDIT WEBLINKS=Edit Web Links +ICON=Icon +IMAGE ALIGN=Image Align +LINK DESCRIPTIONS=Link Descriptions +OTHER CATEGORIES=Other Categories +PARAMBACKBUTTON=Show/Hide a back button, which returns you to the page previously viewed. +PARAMCATSELECT=A Web Links Category (optional) +PARAMICONIMG=Icon to be used to the left of the URL Links in table view +PARAMSHOWHIDEDESC=Show/Hide the description text of the links +PARAMSHOWHIDELINKS=Show/Hide the links +PARAMOTHERCATSECTION=Show/Hide the list of Categories in list view page +PARAMOTHERCAT=Show/Hide the list of Categories in table view page +PARAMIMAGE=Image for page must be located in the /images/stories folder. Default will load web_links.jpg. No image will mean an image is not loaded. +PARAMLINKICONS=Icon to be used to the left of the URL Links in table view +PARAMWHENVIEWCAT=Show/Hide other Web Link Categories +SHOW/HIDE THE DESCRIPTION BELOW=Show/Hide the description below +SHOW/HIDE THE HITS COLUMN=Show/Hide the hits column +SHOW/HIDE THE TABLE HEADINGS=Show/Hide the table headings +TABLE HEADINGS=Table Headings +TARGET=Target +TARGET WINDOW WHEN THE LINK IS CLICKED=Target browser window when the link is clicked +THIS COMPONENT SHOWS A LISTING OF WEBLINKS=This component shows a listing of Web links +WEBLINK=Web Link +WEBLINK ITEM MUST HAVE A TITLE=Web Link Item must have a title +WEBLINK MANAGER=Web Link Manager +WEBLINK SAVED=Web Link saved +WEBLINK CATEGORY LIST LAYOUT=Web Link Category List Layout +WEBLINK CATEGORY LIST LAYOUT DESC=This layout shows a list of all the Web Link Categories. +WEBLINK STANDARD CATEGORY LAYOUT=Category List Layout +WEBLINK STANDARD CATEGORY LAYOUT DESC=This layout shows a list of all the Web Links within a particular Category. +WEBLINK SUBMISSION LAYOUT= Web Link Submission Layout +WEBLINK SUBMISSION LAYOUT DESC=Allow Registered Users to submit a Web Link. +WEBLINKS INTRO=Web Links Introduction +WEBLINKS_INTRO_DESC=This text is shown above the Categories overview. +YOU MUST HAVE A URL.=You must enter a URL. diff --git a/administrator/language/en-GB/en-GB.com_weblinks.menu.ini b/administrator/language/en-GB/en-GB.com_weblinks.menu.ini index 45c4259301bb0..339b7aa37949a 100644 --- a/administrator/language/en-GB/en-GB.com_weblinks.menu.ini +++ b/administrator/language/en-GB/en-GB.com_weblinks.menu.ini @@ -1,9 +1,9 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -COM_WEBLINKS=Web Links -COM_WEBLINKS.LINKS=Links -COM_WEBLINKS.CATEGORIES=Categories +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +COM_WEBLINKS=Web Links +COM_WEBLINKS.LINKS=Links +COM_WEBLINKS.CATEGORIES=Categories diff --git a/administrator/language/en-GB/en-GB.com_wrapper.ini b/administrator/language/en-GB/en-GB.com_wrapper.ini index 3365c16c8c094..3ba2d401d1922 100644 --- a/administrator/language/en-GB/en-GB.com_wrapper.ini +++ b/administrator/language/en-GB/en-GB.com_wrapper.ini @@ -1,8 +1,8 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -WRAPPER=Wrapper -WRAPPER DESC=Displays an IFrame that will wrap an external page/site into Joomla! \ No newline at end of file +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +WRAPPER=Wrapper +WRAPPER DESC=Displays an iframe to wrap an external page or site into Joomla! diff --git a/administrator/language/en-GB/en-GB.ini b/administrator/language/en-GB/en-GB.ini index 685d2f197f1d3..0c152c48835ad 100644 --- a/administrator/language/en-GB/en-GB.ini +++ b/administrator/language/en-GB/en-GB.ini @@ -75,6 +75,7 @@ TIME=Time TIME:=Time: CLOSE=Close TODAY=Today +WK=wk # Time Zones @@ -88,6 +89,7 @@ TIME ZONE=Time Zone (UTC -07:00) MOUNTAIN TIME (US & CANADA)=(UTC -07:00) Mountain Time (US & Canada) (UTC -06:00) CENTRAL TIME (US & CANADA), MEXICO CITY=(UTC -06:00) Central Time (US & Canada), Mexico City (UTC -05:00) EASTERN TIME (US & CANADA), BOGOTA, LIMA=(UTC -05:00) Eastern Time (US & Canada), Bogota, Lima +(UTC -04:30) VENEZUELA=(UTC -04:30) Venezuela (UTC -04:00) ATLANTIC TIME (CANADA), CARACAS, LA PAZ=(UTC -04:00) Atlantic Time (Canada), Caracas, La Paz (UTC -03:30) ST. JOHN'S, NEWFOUNDLAND, LABRADOR=(UTC -03:30) St. John's, Newfoundland and Labrador (UTC -03:00) BRAZIL, BUENOS AIRES, GEORGETOWN=(UTC -03:00) Brazil, Buenos Aires, Georgetown @@ -130,11 +132,12 @@ PHPMAILER_RECIPIENTS_FAILED=SMTP Error! The following recipients failed: PHPMAILER_DATA_NOT_ACCEPTED=SMTP Error! Data not accepted. PHPMAILER_CONNECT_HOST=SMTP Error! Could not connect to SMTP host. PHPMAILER_FILE_ACCESS=Could not access file: -PHPMAILER_FILE_OPEN=File Error: Could not open file: +PHPMAILER_FILE_OPEN=File Error. Could not open file: PHPMAILER_ENCODING=Unknown encoding: A SHORT ALT ATTRIBUTE FOR IMAGE=A short Alt (alternative) attribute for an image ACCESS=Access Level +ACCESS CONTROL=Access Control ACCESS LEVEL=Access Level ADD=Add ADMINISTRATION=Administration @@ -142,7 +145,7 @@ ADMINISTRATION MESSAGES=Administration Messages ADMINISTRATOR=Administrator ADMINISTRATOR FILES=Administrator Files ADVANCED PARAMETERS=Advanced Parameters -ALERTNOTAUTH=You are not authorized to view this resource. +ALERTNOTAUTH=You are not authorised to view this resource. ALIAS=Alias ALIGN=Align ALL=all @@ -150,7 +153,7 @@ ALPHABETICAL INDEX=Alphabetical Index ALREADY EXISTS=There is already a Read more... link that has been inserted. Only one such link is permitted. Use {pagebreak} to split the page up further. ALT TEXT=Alt Text ANY=Any -AN ERROR HAS OCCURRED=An error has occurred +AN ERROR HAS OCCURRED=An error has occurred. ANOTHER TEMPLATE IS ALREADY USING DIRECTORY=There is already a Template using the named directory. Are you trying to load the same template again? APPLY=Apply ARCHIVE=Archive @@ -184,7 +187,7 @@ CENTER=Center CHANGE CREATOR=Change Creator CHANGES TO X SAVED=Changes to %s saved CHECKED OUT=Checked out -CHECKIN MANAGER=Check-in Manager +CHECKIN MANAGER=Check in Manager CLICK ON ICON TO TOGGLE STATE.=Click on icon to toggle state. CLICK TO CHECK IN=Click to Check-in CLICK TO SORT THIS COLUMN=Click to sort by this column @@ -205,7 +208,7 @@ COPY=Copy COPYRIGHT=Copyright COULD NOT CREATE DIRECTORY=Could not create directory COULD NOT DELETE FOLDER=Could not delete folder -COULD NOT MAKE CONFIGURATION.PHP UNWRITABLE=Could not make configuration.php unwritable +COULD NOT MAKE CONFIGURATION.PHP UNWRITABLE=Could not make configuration.php unwritable. COULD NOT COPY SETUP FILE=Could not copy setup file CREATED DATE=Created Date CREATOR=Creator @@ -216,8 +219,8 @@ DELETE=Delete DELETED=Deleted DELETING=Deleting DESCBEINGEDITTED=%s %s is currently being edited by another administrator -DESCNEWITEMSFIRST=New items default to the first place. Ordering can be changed after this item is saved. -DESCNEWITEMSLAST=New items default to the last place. Ordering can be changed after this item is saved. +DESCNEWITEMSFIRST=New items default to the first position. The ordering can be changed after this item is saved. +DESCNEWITEMSLAST=New items default to the last position. The ordering can be changed after this item is saved. DESCRIPTION=Description DESCUSEVALIDLOGIN=Use a valid username and password to gain access to the Administrator Control Panel. DETAILS=Details @@ -228,6 +231,8 @@ DISPLAY NUM=Display # DO NOT USE=None Selected DONE=Done E_LOGIN_AUTHENTICATE=Username and password do not match +E_NOLOGIN_ACCESS=You do not have access to the administrator section of this site. +E_NOLOGIN_BLOCKED=Login denied! Your account has either been blocked or you have not activated it yet. EDIT=Edit EDIT CATEGORY=Edit Category EDIT CONTENT=Edit Content @@ -248,18 +253,18 @@ END PAGE=End Page ENGLISH=English ERROR=Error ERROR SAVING FILE=Error saving file -ERRORELEMENTNOTFOUND=Error - Element not found +ERRORELEMENTNOTFOUND=Error. Element not found. ERRORNOADMINS=You cannot login. There are no administrators set up. -ERRORNOFILE=Error - File not specified -ERRORXMLNOTFOUND=Error - XML file not found +ERRORNOFILE=Error. File not specified. +ERRORXMLNOTFOUND=Error. XML file not found. EXCLUDE IN FILE SEARCH=Exclude in file search EXISTING MENU LINKS=Existing Menu Links EXPIRED=Expired EXPIRES=Expires EXPORT=Export FAILED=Failed -FAILED TO CREATE DIRECTORY=Failed to create directory -FAILED TO OPEN XML FILE=Failed to open XML file +FAILED TO CREATE DIRECTORY=Failed to create directory. +FAILED TO OPEN XML FILE=Failed to open XML file. FAX=Fax FEED IMAGE=Feed Image FEEDS=Feeds @@ -290,19 +295,19 @@ ICONS=Icons ID=ID IGNORE=Ignore IMAGE=Image -IMAGE ALREADY EXISTS=Image %s already exists +IMAGE ALREADY EXISTS=Image %s already exists. IMAGES=Images IN MENU=In Menu INSTALL=Install -ITEM SAVED=Item saved -ITEMS COPIED=%s Items copied -ITEMS PUBLISHED=%s Items published -ITEMS UNPUBLISHED=%s Items unpublished -ITEMS REMOVED=%s Item(s) removed +ITEM SAVED=Item saved. +ITEMS COPIED=%s Items copied. +ITEMS PUBLISHED=%s Items published. +ITEMS UNPUBLISHED=%s Items unpublished. +ITEMS REMOVED=%s Item(s) removed. UNINSTALL=Uninstall ISFREESOFTWARE=is Free Software released under the GNU/GPL License. ITEM=Item -ITEM CHECKED IN=Item checked in +ITEM CHECKED IN=Item checked in. ITEM DETAILS=Item Details ITEM TITLE=Item Title JOOMLA!=Joomla! @@ -328,7 +333,7 @@ LOGIN=Login LOGIN_BLOCKED=Your login has been blocked. Please contact the administrator. LOGIN_INCOMPLETE=Please complete the Username and Password fields. LOGIN_INCORRECT=An incorrect username or password has been entered. -LOGIN_NOADMINS=You cannot login. There are no administrators set up. +LOGIN_NOADMINS=You cannot log in. There are no administrators set up. LOGGED IN USER=Logged in User LOGGED=Logged LOGOUT=Logout @@ -346,7 +351,7 @@ MAXIMUM=Maximum MEDIA=Media MENU IMAGE=Menu Image MENU ITEM NAME=Menu Item Title -MENU LINKS AVAILABLE WHEN SAVED=Menu Links are available when saved +MENU LINKS AVAILABLE WHEN SAVED=Menu Links are available when saved. MENU MANAGER=Menu Manager MENU ITEM MANAGER=Menu Item Manager MENU SELECTION=Menu Selection @@ -417,9 +422,9 @@ PARAMETER CONTROL=Parameter Control PARAMETERS=Parameters PARAMENABLED=Enable this Plugin. PARAMMENUIMAGE=A small image to be placed to the left or right of your Menu Item. Images must be in images/stories/ -PARAMPAGECLASSSFX=A suffix to be applied to the CSS classes of the page, this allows individual page styling -PARAMPAGETITLE=Text to display as the Page title. If left blank, the Menu title will be used instead -PARAMPAGEHEADER=Text to display at the top of the page. If left blank, the Menu title will be used instead +PARAMPAGECLASSSFX=A suffix to be applied to the CSS classes of the page. This allows individual page styling. +PARAMPAGETITLE=Text to display as the Page title. If left blank, a default title will be used instead. +PARAMPAGEHEADER=Text to display at the top of the page. If left blank, the Menu title will be used instead. PARENT ITEM=Parent Item PARENT WINDOW WITH BROWSER NAVIGATION=Parent Window with Browser Navigation PASSWORD=Password @@ -471,11 +476,11 @@ REFRESH FILES=Refresh Files REGISTER=Register REGISTERED=Registered RELATED LINKS=Related Links -REMEMBER TO RENAME HTACCESS.TXT TO .HTACCESS=Remember to rename htaccess.txt to .htaccess +REMEMBER TO RENAME HTACCESS.TXT TO .HTACCESS=Remember to rename the htaccess.txt file to .htaccess REMIND=Remind REORDER=Reorder RESET=Reset -RESOURCE NOT FOUND= Joomla! was unable to locate the stated resource +RESOURCE NOT FOUND= Joomla! was unable to locate the stated resource. RESTORE=Restore RESULTS=Results RESULTS OF=Results %s - %s of %s @@ -503,7 +508,7 @@ SELECT ITEM=Select Item SELECT SECTION=Select Section SELECT STATE=Select State SERVER OFFSET=Server Offset -SESSION_EXPIRED=Your session has expired, please login again +SESSION_EXPIRED=Your session has expired. Please log in again. SETTINGS=Settings SHOW=Show SHOW PAGE TITLE=Show the Page Title @@ -544,6 +549,8 @@ TIPTITLEFIELD=Title of your information TITLE=Title TITLE ALIAS=Title Alias TO=to +TOOLBAR SAVE AND NEW=Save & New +TOOLBAR SAVE TO COPY=Save To Copy TOOLTIP=Tooltip TOOLS=Tools TOP=Top @@ -565,27 +572,27 @@ UP=up UPLOAD=Upload UPLOAD A FILE=Upload a file UPLOAD OF=Upload of -UPLOAD OF IMAGE FAILED=Upload of %s Failed -UPLOAD OF IMAGE SUCCESSFUL=Upload of %s to %s was successful +UPLOAD OF IMAGE FAILED=Upload of %s failed. +UPLOAD OF IMAGE SUCCESSFUL=Upload of %s to %s was successful. URL=URL USE DEFAULT=Use Default USE GLOBAL=Use Global USER=User USERNAME=Username -VALIDALPHANOSPACES=File must only contain alphanumeric characters and no spaces please. +VALIDALPHANOSPACES=File name must only contain alphanumeric characters and no spaces. VALIDDELETEITEMS=Are you sure you want to delete the selected Items? -VALIDUSERPASS=Incorrect username and/or password, please try again -VALIDUSERPASSACCESS=Incorrect username, password, or access level. Please try again +VALIDUSERPASS=Incorrect username and/or password. Please try again. +VALIDUSERPASSACCESS=Incorrect username, password or access level. Please try again. VERSION=Version VIEW=View VIEW ALL=View All VISIBLE=Visible VOTE=Vote -WARNFS_ERR01=Warning - Failed to change file permissions! -WARNFS_ERR02=Warning - Failed to move file! -WARNFS_ERR03=Upload failed, directory not writable -WARNFS_ERR04=Upload failed, directory does not exist -WARNJAVASCRIPT=Warning! JavaScript must be enabled for proper operation of the Administrator Back-end +WARNFS_ERR01=Warning: Failed to change file permissions! +WARNFS_ERR02=Warning: Failed to move file! +WARNFS_ERR03=Upload failed. Directory not writable. +WARNFS_ERR04=Upload failed. Directory does not exist. +WARNJAVASCRIPT=Warning! JavaScript must be enabled for proper operation of the Administrator back-end. WEB=Web WEBLINK=Web Link WEB LINKS=Web Links @@ -598,3 +605,4 @@ YES=Yes YOU MUST SELECT A CATEGORY=You must select a Category YOU MUST SELECT A SECTION=You must select a Section + diff --git a/administrator/language/en-GB/en-GB.mod_components.ini b/administrator/language/en-GB/en-GB.mod_components.ini index 4f29ffb7ce371..1738bdefe0d74 100644 --- a/administrator/language/en-GB/en-GB.mod_components.ini +++ b/administrator/language/en-GB/en-GB.mod_components.ini @@ -1,11 +1,11 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -COMPONENTS=Components -FULL COMPONENT LIST=Full Component List -NUMBER OF COMPONENTS TO DISPLAY=Number of Components to display -THIS MODULE SHOWS A LIST OF INSTALLED COMPONENTS=This Module shows a list of installed Components - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +COMPONENTS=Components +FULL COMPONENT LIST=Full Component List +NUMBER OF COMPONENTS TO DISPLAY=Number of Components to display +THIS MODULE SHOWS A LIST OF INSTALLED COMPONENTS=This Module shows a list of installed Components + diff --git a/administrator/language/en-GB/en-GB.mod_custom.ini b/administrator/language/en-GB/en-GB.mod_custom.ini index 10ed9ef4c1971..08283b598e67a 100644 --- a/administrator/language/en-GB/en-GB.mod_custom.ini +++ b/administrator/language/en-GB/en-GB.mod_custom.ini @@ -1,9 +1,9 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCMODCUSTOM=This Module allows you to type in HTML using a WYSIWYG editor -MOD_CUSTOM=mod_custom - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCMODCUSTOM=This Module allows you to type in HTML using a WYSIWYG editor +MOD_CUSTOM=mod_custom + diff --git a/administrator/language/en-GB/en-GB.mod_feed.ini b/administrator/language/en-GB/en-GB.mod_feed.ini new file mode 100644 index 0000000000000..be0a8c8cccb5e --- /dev/null +++ b/administrator/language/en-GB/en-GB.mod_feed.ini @@ -0,0 +1,22 @@ +# $Id: en-GB.mod_feed.ini 10554 2008-07-15 17:15:19Z ircmaxell $ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DISPLAY FEED IN RTL DIRECTION=Display feed in RTL direction +DISPLAY NEWS FEED TITLE=Display news feed title +ENTER NUMBER OF RSS ITEMS TO DISPLAY=Enter number of RSS items to display +ENTER THE URL OF THE RSS/RDF FEED=Enter the URL of the RSS/RDF feed +FEED DESCRIPTION=Feed Description +FEED TITLE=Feed Title +FEED URL=Feed URL +ITEM DESCRIPTION=Item Description +ITEMS=Items +MOD_FEED=mod feed +PARAMITEMDESC=Show the Description or Intro text of individual RSS Items +PARAMWORDCOUNT=Allows you to limit the amount of visible Item description text. 0 will show all the text +RTL FEED=RTL feed +SHOW THE DESCRIPTION TEXT FOR THE WHOLE FEED=Show the description text for the whole Feed +SHOW THE IMAGE ASSOCIATED WITH THE WHOLE FEED=Show the image associated with the whole Feed +WORD COUNT=Word Count diff --git a/administrator/language/en-GB/en-GB.mod_footer.ini b/administrator/language/en-GB/en-GB.mod_footer.ini index 3ce9d125b637a..6ac98ec30a308 100644 --- a/administrator/language/en-GB/en-GB.mod_footer.ini +++ b/administrator/language/en-GB/en-GB.mod_footer.ini @@ -1,11 +1,12 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -CHECK FOR LATEST VERSION=Check for latest Version -MOD_FOOTER=mod_footer -THERE ARE NO PARAMETERS FOR THIS ITEM=There are no Parameters for this Module -THIS MODULE SHOWS THE JOOMLA! COPYRIGHT INFORMATION=This Module shows the Joomla! Copyright information - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CHECK FOR LATEST VERSION=Check for latest Version +MOD_FOOTER=mod_footer +THERE ARE NO PARAMETERS FOR THIS ITEM=There are no Parameters for this Module +THIS MODULE SHOWS THE JOOMLA! COPYRIGHT INFORMATION=This Module shows the Joomla! copyright information. + + diff --git a/administrator/language/en-GB/en-GB.mod_latest.ini b/administrator/language/en-GB/en-GB.mod_latest.ini index 288e6ed750398..f4044d5cf22d9 100644 --- a/administrator/language/en-GB/en-GB.mod_latest.ini +++ b/administrator/language/en-GB/en-GB.mod_latest.ini @@ -1,17 +1,17 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -A FILTER FOR THE AUTHORS=A Filter for the Authors -ADDED OR MODIFIED BY ME=Added or modified by me -ANYONE=Anyone -AUTHORS=Authors -DESCLATESTNEWS=This Module shows a list of the most recently published Articles that are still current. Some that are shown may have expired even though they are the most recent. -MOD_LATEST=mod_latest -NO MATCHING RESULTS=No matching results -NOT ADDED OR MODIFIED BY ME=Not added or modified by me -ORDERING OPTIONS=Ordering Options -RECENTLY ADDED FIRST=Recently Added First +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +A FILTER FOR THE AUTHORS=A Filter for the Authors +ADDED OR MODIFIED BY ME=Added or modified by me +ANYONE=Anyone +AUTHORS=Authors +DESCLATESTNEWS=This Module shows a list of the most recently published Articles that are still current. Some that are shown may have expired even though they are the most recent. +MOD_LATEST=mod_latest +NO MATCHING RESULTS=No matching results +NOT ADDED OR MODIFIED BY ME=Not added or modified by me +ORDERING OPTIONS=Ordering Options +RECENTLY ADDED FIRST=Recently Added First RECENTLY MODIFIED FIRST=Recently Modified First \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.mod_logged.ini b/administrator/language/en-GB/en-GB.mod_logged.ini index 7ce39b4d0947c..e8c6453e34d23 100644 --- a/administrator/language/en-GB/en-GB.mod_logged.ini +++ b/administrator/language/en-GB/en-GB.mod_logged.ini @@ -1,12 +1,12 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -CLIENT=Client -FORCE LOGOUT USER=Force Logout User -MOD_LOGGED=mod_logged -THIS MODULE SHOWS A LIST OF THE CURRENTLY LOGGED IN USERS=This Module shows a list of the currently Logged In Users -LAST ACTIVITY=Last Activity -ACTIVITY HOURS=%.1f hours ago +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CLIENT=Client +FORCE LOGOUT USER=Force Logout User +MOD_LOGGED=mod_logged +THIS MODULE SHOWS A LIST OF THE CURRENTLY LOGGED IN USERS=This Module shows a list of the currently Logged In Users +LAST ACTIVITY=Last Activity +ACTIVITY HOURS=%.1f hours ago diff --git a/administrator/language/en-GB/en-GB.mod_login.ini b/administrator/language/en-GB/en-GB.mod_login.ini index fc500f78679d4..b169b36a1f3cb 100644 --- a/administrator/language/en-GB/en-GB.mod_login.ini +++ b/administrator/language/en-GB/en-GB.mod_login.ini @@ -1,11 +1,11 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCLOGINFORM=This Module displays a Username and Password Login form. It cannot be disabled. -MOD_LOGIN=mod_login -LANGUAGE=Language -ENCRYPT LOGIN FORM=Encrypt Login Form +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCLOGINFORM=This Module displays a Username and Password Login form. It cannot be disabled. +MOD_LOGIN=mod_login +LANGUAGE=Language +ENCRYPT LOGIN FORM=Encrypt Login Form SUBMIT ENCRYPTED LOGIN DATA (REQUIRES SSL)=Submit encrypted login data (requires SSL). Do not enable this option if Joomla is not accessible using the https:// protocol prefix. \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.mod_menu.ini b/administrator/language/en-GB/en-GB.mod_menu.ini index 3b7bdbcb60e34..9e773ff1905f5 100644 --- a/administrator/language/en-GB/en-GB.mod_menu.ini +++ b/administrator/language/en-GB/en-GB.mod_menu.ini @@ -1,85 +1,85 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ADD/EDIT=Add/Edit -ARCHIVE=Archive -ARTICLE MANAGER=Article Manager -ARTICLE TRASH=Article Trash -ARTICLE STATISTICS=Article Statistics -BACK=Back -BROWSER, OS, DOMAIN=Browser, OS, Domain -CATEGORIES=Categories -CATEGORY MANAGER=Category Manager -CHECK-IN ALL CHECKED-OUT ITEMS=Check-in all checked out Articles -CLEAN ALL CACHES=Clean all Caches -CLEAN CONTENT CACHE=Clean the Content Cache -CLEAN THE ARTICLES CACHE=Clean the Articles Cache -COMPONENT MANAGEMENT=Component Management -COMPONENTS=Components -CONFIGURATION=Global Configuration -CONTENT BY SECTION=Content by Section -CONTENT MANAGEMENT=Content Management -CONTENT MANAGERS=Content Managers -CONTROL PANEL=Control Panel -ELEMENT LIST=Element List -EXTENSIONS=Extensions -EXTENSION MANAGER=Extension Manager -FRONTPAGE MANAGER=Front Page Manager -GLOBAL CHECKIN=Global Check-in -INSTALL EXTENSIONS=Install Extensions -INSTALL/UNINSTALL=Install/Uninstall -INSTALLER=Installer -ITEMS=Items -JOOMLA! HELP=Joomla! Help -LANGUAGE MANAGER=Language Manager -LANGUAGES=Languages -LOGOUT=Logout -MANAGE ARTICLES=Manage Articles -MANAGE CONTENT CATEGORIES=Manage Content Categories -MANAGE CONTENT SECTIONS=Manage Content Sections -MANAGE FRONTPAGE ITEMS=Manage Front Page Articles -MANAGE LANGUAGES=Manage Languages -MANAGE MEDIA FILES=Manage Media Files -MANAGE MENU=Manage Menus -MANAGE TRASH=Manage Trash -MANAGE USERS=Manage Users -MEDIA MANAGER=Media Manager -MENUS=Menus -MENU INACTIVE FOR THIS PAGE=This Menu is inactive for this page. -MENU MANAGEMENT=Menu Management -READ MESSAGES=Read Messages -MOD_CSSMENU=mod_cssmenu -MODULE MANAGER=Module Manager -MODULES=Modules -MOD_MENU=mod_menu -MORE COMPONENTS...=More Components... -PAGE HITS=Page Hits -PREVIEW...=Preview... -PLUGIN MANAGEMENT=Plugin Management -PLUGIN MANAGER=Plugin Manager -PLUGINS=Plugins -SEARCH TEXT=Search Text -SECTION MANAGER=Section Manager -SITE MANAGEMENT=Site Management -SITE STATISTICS=Site Statistics -STATISTICS=Statistics -SYNDICATE=Syndicate -SYSTEM=System -SYSTEM INFO=System Info -SYSTEM INFORMATION=System Information -SYSTEM MANAGEMENT=System Management -TEMPLATES - ADMIN=Templates - Admin -TEMPLATES - SITE=Templates - Site -TEMPLATE MANAGER=Template Manager -THEMEOFFICE=ThemeOffice -THIS MODULE SHOWS THE MAIN ADMIN NAVIGATION MODULE=This Module shows the main admin navigation Module -MENU TRASH=Menu Trash -UNINSTALL COMPONENTS=Uninstall Components -USER MANAGER=User Manager -UNINSTALL PLUGINS=Uninstall Plugins -UNINSTALL MODULES=Uninstall Modules -WRITE MESSAGE=Write Message +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ADD/EDIT=Add/Edit +ARCHIVE=Archive +ARTICLE MANAGER=Article Manager +ARTICLE TRASH=Article Trash +ARTICLE STATISTICS=Article Statistics +BACK=Back +BROWSER, OS, DOMAIN=Browser, OS, Domain +CATEGORIES=Categories +CATEGORY MANAGER=Category Manager +CHECK-IN ALL CHECKED-OUT ITEMS=Check-in all checked out Articles +CLEAN ALL CACHES=Clean all Caches +CLEAN CONTENT CACHE=Clean the Content Cache +CLEAN THE ARTICLES CACHE=Clean the Articles Cache +COMPONENT MANAGEMENT=Component Management +COMPONENTS=Components +CONFIGURATION=Global Configuration +CONTENT BY SECTION=Content by Section +CONTENT MANAGEMENT=Content Management +CONTENT MANAGERS=Content Managers +CONTROL PANEL=Control Panel +ELEMENT LIST=Element List +EXTENSIONS=Extensions +EXTENSION MANAGER=Extension Manager +FRONTPAGE MANAGER=Front Page Manager +GLOBAL CHECKIN=Global Check-in +INSTALL EXTENSIONS=Install Extensions +INSTALL/UNINSTALL=Install/Uninstall +INSTALLER=Installer +ITEMS=Items +JOOMLA! HELP=Joomla! Help +LANGUAGE MANAGER=Language Manager +LANGUAGES=Languages +LOGOUT=Logout +MANAGE ARTICLES=Manage Articles +MANAGE CONTENT CATEGORIES=Manage Content Categories +MANAGE CONTENT SECTIONS=Manage Content Sections +MANAGE FRONTPAGE ITEMS=Manage Front Page Articles +MANAGE LANGUAGES=Manage Languages +MANAGE MEDIA FILES=Manage Media Files +MANAGE MENU=Manage Menus +MANAGE TRASH=Manage Trash +MANAGE USERS=Manage Users +MEDIA MANAGER=Media Manager +MENUS=Menus +MENU INACTIVE FOR THIS PAGE=This Menu is inactive for this page. +MENU MANAGEMENT=Menu Management +READ MESSAGES=Read Messages +MOD_CSSMENU=mod_cssmenu +MODULE MANAGER=Module Manager +MODULES=Modules +MOD_MENU=mod_menu +MORE COMPONENTS...=More Components... +PAGE HITS=Page Hits +PREVIEW...=Preview... +PLUGIN MANAGEMENT=Plugin Management +PLUGIN MANAGER=Plugin Manager +PLUGINS=Plugins +SEARCH TEXT=Search Text +SECTION MANAGER=Section Manager +SITE MANAGEMENT=Site Management +SITE STATISTICS=Site Statistics +STATISTICS=Statistics +SYNDICATE=Syndicate +SYSTEM=System +SYSTEM INFO=System Info +SYSTEM INFORMATION=System Information +SYSTEM MANAGEMENT=System Management +TEMPLATES - ADMIN=Templates - Admin +TEMPLATES - SITE=Templates - Site +TEMPLATE MANAGER=Template Manager +THEMEOFFICE=ThemeOffice +THIS MODULE SHOWS THE MAIN ADMIN NAVIGATION MODULE=This Module shows the main admin navigation Module +MENU TRASH=Menu Trash +UNINSTALL COMPONENTS=Uninstall Components +USER MANAGER=User Manager +UNINSTALL PLUGINS=Uninstall Plugins +UNINSTALL MODULES=Uninstall Modules +WRITE MESSAGE=Write Message CLEAN CACHE=Clean Cache \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.mod_online.ini b/administrator/language/en-GB/en-GB.mod_online.ini index 575a62aaa02d3..c46184da7cd6c 100644 --- a/administrator/language/en-GB/en-GB.mod_online.ini +++ b/administrator/language/en-GB/en-GB.mod_online.ini @@ -1,10 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -MOD_ONLINE=mod_online -THIS MODULE SHOWS A LIST OF THE BACKEND USERS LOGGED IN=This Module shows a list of the Back-end Users that are logged in. -USERS ONLINE=Users Online - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +MOD_ONLINE=mod_online +THIS MODULE SHOWS A LIST OF THE BACKEND USERS LOGGED IN=This Module shows a list of the Back-end Users that are logged in. +USERS ONLINE=Users Online + diff --git a/administrator/language/en-GB/en-GB.mod_popular.ini b/administrator/language/en-GB/en-GB.mod_popular.ini index bfe9928cb72b0..caa2c3204ae8a 100644 --- a/administrator/language/en-GB/en-GB.mod_popular.ini +++ b/administrator/language/en-GB/en-GB.mod_popular.ini @@ -1,11 +1,11 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -CREATED=Created -MOD_POPULAR=mod_popular -MOST POPULAR ITEMS=Most Popular Articles -DESCPOPULARITEMS=This Module shows a list of the popular published Articles that are still current. Some that are shown may have expired even though they are the most popular. - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CREATED=Created +MOD_POPULAR=mod_popular +MOST POPULAR ITEMS=Most Popular Articles +DESCPOPULARITEMS=This Module shows a list of the popular published Articles that are still current. Some that are shown may have expired even though they are the most popular. + diff --git a/administrator/language/en-GB/en-GB.mod_quickicon.ini b/administrator/language/en-GB/en-GB.mod_quickicon.ini index 2595d739bdadf..fc4a8d5de97d6 100644 --- a/administrator/language/en-GB/en-GB.mod_quickicon.ini +++ b/administrator/language/en-GB/en-GB.mod_quickicon.ini @@ -1,21 +1,21 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ADD NEW ARTICLE=Add New Article -CATEGORY MANAGER=Category Manager -ARTICLE MANAGER=Article Manager -FRONTPAGE MANAGER=Front Page Manager -GLOBAL CONFIGURATION=Global Configuration -LANGUAGE MANAGER=Language Manager -MEDIA MANAGER=Media Manager -MENU MANAGER=Menu Manager -MOD_QUICKICON=mod_quickicon -QUICK ICONS=Quick Icons -SECTION MANAGER=Section Manager -THIS MODULE SHOWS QUICK ICONS THAT ARE VISIBLE ON THE ADMIN AREA HOME PAGE=This Module shows Quick Icons that are visible on the Control Panel. -TRASH MANAGER=Trash Manager -USER MANAGER=User Manager - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ADD NEW ARTICLE=Add New Article +CATEGORY MANAGER=Category Manager +ARTICLE MANAGER=Article Manager +FRONTPAGE MANAGER=Front Page Manager +GLOBAL CONFIGURATION=Global Configuration +LANGUAGE MANAGER=Language Manager +MEDIA MANAGER=Media Manager +MENU MANAGER=Menu Manager +MOD_QUICKICON=mod_quickicon +QUICK ICONS=Quick Icons +SECTION MANAGER=Section Manager +THIS MODULE SHOWS QUICK ICONS THAT ARE VISIBLE ON THE ADMIN AREA HOME PAGE=This Module shows Quick Icons that are visible on the Control Panel. +TRASH MANAGER=Trash Manager +USER MANAGER=User Manager + diff --git a/administrator/language/en-GB/en-GB.mod_stats.ini b/administrator/language/en-GB/en-GB.mod_stats.ini index 7ff3cd4b25964..c9c986aca05a4 100644 --- a/administrator/language/en-GB/en-GB.mod_stats.ini +++ b/administrator/language/en-GB/en-GB.mod_stats.ini @@ -1,10 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -MENU=Menu -MENU ITEMS=Menu Items -MOD_STATS=mod_stats -DESCITEMSSTATS=This Module shows details of the number of Menu Items that are still current on each of the Menus. Some that are shown may have expired even though they are the most recent. +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +MENU=Menu +MENU ITEMS=Menu Items +MOD_STATS=mod_stats +DESCITEMSSTATS=This Module shows details of the number of Menu Items that are still current on each of the Menus. Some that are shown may have expired even though they are the most recent. diff --git a/administrator/language/en-GB/en-GB.mod_status.ini b/administrator/language/en-GB/en-GB.mod_status.ini index b15926c46e270..4f2e9f6086e6c 100644 --- a/administrator/language/en-GB/en-GB.mod_status.ini +++ b/administrator/language/en-GB/en-GB.mod_status.ini @@ -1,9 +1,9 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -LEGACY=Legacy -MOD_STATUS=mod_status -THIS MODULE SHOWS THE STATUS OF THE LOGGED IN USER.=This Module shows the status of the logged in Users. +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +LEGACY=Legacy +MOD_STATUS=mod_status +THIS MODULE SHOWS THE STATUS OF THE LOGGED IN USER.=This Module shows the status of the logged in Users. diff --git a/administrator/language/en-GB/en-GB.mod_submenu.ini b/administrator/language/en-GB/en-GB.mod_submenu.ini index 0cdcc94a62eae..683bc34dc94ea 100644 --- a/administrator/language/en-GB/en-GB.mod_submenu.ini +++ b/administrator/language/en-GB/en-GB.mod_submenu.ini @@ -1,9 +1,9 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -MOD_SUBMENU=mod_submenu -THIS MODULE SHOWS THE SUBMENU NAVIGATION MODULE=This Module shows the sub-Menu Navigation Module - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +MOD_SUBMENU=mod_submenu +THIS MODULE SHOWS THE SUBMENU NAVIGATION MODULE=This Module shows the sub-Menu Navigation Module + diff --git a/administrator/language/en-GB/en-GB.mod_title.ini b/administrator/language/en-GB/en-GB.mod_title.ini index 99c9d34f64b2c..c1fffc47d489a 100644 --- a/administrator/language/en-GB/en-GB.mod_title.ini +++ b/administrator/language/en-GB/en-GB.mod_title.ini @@ -1,8 +1,8 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -MOD_TITLE=mod_title -THIS MODULE SHOWS THE TOOLBAR COMPONENT TITLE=This Module shows the Toolbar Component Title +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +MOD_TITLE=mod_title +THIS MODULE SHOWS THE TOOLBAR COMPONENT TITLE=This Module shows the Toolbar Component Title diff --git a/administrator/language/en-GB/en-GB.mod_toolbar.ini b/administrator/language/en-GB/en-GB.mod_toolbar.ini index 32e84a2af8efa..01eae2d3bbb62 100644 --- a/administrator/language/en-GB/en-GB.mod_toolbar.ini +++ b/administrator/language/en-GB/en-GB.mod_toolbar.ini @@ -1,9 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -MOD_TOOLBAR=mod_toolbar -THIS MODULE SHOWS THE TOOLBAR ICONS USED TO CONTROL ACTIONS THROUGHOUT THE ADMINISTRATOR AREA=This Module shows the Toolbar icons used to control actions throughout the administrator area - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +MOD_TOOLBAR=mod_toolbar +THIS MODULE SHOWS THE TOOLBAR ICONS USED TO CONTROL ACTIONS THROUGHOUT THE ADMINISTRATOR AREA=This Module shows the toolbar icons used to control actions throughout the administrator area. + + diff --git a/administrator/language/en-GB/en-GB.mod_unread.ini b/administrator/language/en-GB/en-GB.mod_unread.ini index 66d5a6f766c21..b332cb6d932cb 100644 --- a/administrator/language/en-GB/en-GB.mod_unread.ini +++ b/administrator/language/en-GB/en-GB.mod_unread.ini @@ -1,9 +1,9 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -MOD_UNREAD=mod_unread -THIS MODULE SHOWS A LIST OF UNREAD ITEMS=This Module shows a list of unread mail messages - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +MOD_UNREAD=mod_unread +THIS MODULE SHOWS A LIST OF UNREAD ITEMS=This Module shows a list of unread mail messages + diff --git a/administrator/language/en-GB/en-GB.plg_authentication_example.ini b/administrator/language/en-GB/en-GB.plg_authentication_example.ini index 79da4c0bb337a..7af8aa786d6d5 100644 --- a/administrator/language/en-GB/en-GB.plg_authentication_example.ini +++ b/administrator/language/en-GB/en-GB.plg_authentication_example.ini @@ -1,9 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCUSERBOT=Provides hooks for syncing Joomla! and a Third Party Application - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCUSERBOT=Provides hooks for syncing Joomla! and a third-party application + + + diff --git a/administrator/language/en-GB/en-GB.plg_authentication_gmail.ini b/administrator/language/en-GB/en-GB.plg_authentication_gmail.ini index e19473451eaaf..1fc8f5d636c48 100644 --- a/administrator/language/en-GB/en-GB.plg_authentication_gmail.ini +++ b/administrator/language/en-GB/en-GB.plg_authentication_gmail.ini @@ -1,7 +1,7 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -HANDLES USER AUTHENTICATION WITH A GMAIL ACCOUNT=Handles User Authentication with a GMail account (Requires cURL) +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +HANDLES USER AUTHENTICATION WITH A GMAIL ACCOUNT=Handles User Authentication with a GMail account (Requires cURL) diff --git a/administrator/language/en-GB/en-GB.plg_authentication_joomla.ini b/administrator/language/en-GB/en-GB.plg_authentication_joomla.ini index 827b11ef66d2f..addce5d4d8bce 100644 --- a/administrator/language/en-GB/en-GB.plg_authentication_joomla.ini +++ b/administrator/language/en-GB/en-GB.plg_authentication_joomla.ini @@ -1,10 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -HANDLES JOOMLAS DEFAULT USER AUTHENTICATION=Handles Joomla!'s default User Authentication -JOOMLA CAN NOT HAVE A BLANK PASSWORD=Joomla can not have blank password -INVALID PASSWORD=Invalid password -INVALID RESPONSE FROM DATABASE=There is an invalid response from the database \ No newline at end of file +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +HANDLES JOOMLAS DEFAULT USER AUTHENTICATION=Handles Joomla's default User authentication +JOOMLA CAN NOT HAVE A BLANK PASSWORD=Joomla can not have blank password +INVALID PASSWORD=Invalid password +INVALID RESPONSE FROM DATABASE=There is an invalid response from the database. diff --git a/administrator/language/en-GB/en-GB.plg_authentication_ldap.ini b/administrator/language/en-GB/en-GB.plg_authentication_ldap.ini index a5dfac5c5980b..4c83df378e117 100644 --- a/administrator/language/en-GB/en-GB.plg_authentication_ldap.ini +++ b/administrator/language/en-GB/en-GB.plg_authentication_ldap.ini @@ -1,49 +1,50 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -AUTHORIZATION METHOD=Authorization Method -ANONYMOUS COMPARE=Anonymous Compare -AUTHENTICATE THEN BIND=Authenticate then Bind -BASE DN=Base DN -BIND AS USER=Bind as User -BIND AND SEARCH=Bind and Search -BIND DIRECTLY AS USER=Bind Directly as User -CONNECT PASSWORD=Connect password -CONNECT USERNAME=Connect username -DEFAULT PORT IS 389=Default port is 389 -FOLLOW REFERRALS=Follow referrals -FOR EXAMPLE, OPENLDAP.MYCOMPANY.ORG=For example, openldap.mycompany.org -HANDLES USER AUTHENTICATION AGAINST AN LDAP SERVER=Handles User Authentication against an LDAP server -HOST=Host -LDAP AUTHENTICATION=LDAP Authentication -LDAP V3=LDAP V3 -MAP FULLNAME=Map: Full Name -MAP EMAIL=Map: E-mail -MAP USER ID=Map: User ID -MAP PASSWORD=Map: Password -NEGOTIATE TLS=Negotiate TLS -NO=No -PARAMLDAPHOST=For example, openldap.mycompany.org -PARAMLDAPPORT=Default port is 389 -PARAMBASEDN=The base DN of your LDAP server -PARAMAUTHMETHOD=The authorization method to validate the credentials -PARAMCONNECTSTRING=The Connect Username and Connect Password define connection parameters for the DN lookup phase. 2 options are available:- Anonymous DN lookup. Leave both fields blank.- Administrative connection: Connect Username is the username of an administrative account, for example Administrator. Connect password is the actual password of your administrative account. -PARAMCONNECTPASSWORD=The Connect Password is the password of an administrative account. This is used in Authenticate then Bind and Authenticated Compare authorization methods -PARAMLDAPV3=Default is LDAP2, but latest versions of OpenLdap require clients to use LDAPV3 -PARAMNEGOCIATETLS=Negotiate TLS encryption with the LDAP server. This requires all traffic to and from my LDAP server to be encrypted. -PARAMFOLLOW=This option sets the value of the LDAP_OPT_REFERRALS flag. You will need to check it to no for Windows 2003 servers. -PARAMSEARCHSTRING=A query string used for search for a given User. The [search] keyword is dynamically replaced by the User-provided login, so an example string is: uid=[search]. Several strings can be used, separated by semicolons. Only used when searching. -PARAMUSERSDN=The [username] keyword is dynamically replaced by the User-provided login, so an example string is: uid=[username], dc=my-domain, dc=com. Several strings can be used, separated by semicolons. Only used for direct binds. -PARAMMAPFN=LDAP Attribute which contains the Users full name -PARAMMAPEMAIL=LDAP Attribute which contains the Users e-mail address -PARAMMAPUID=LDAP Attribute which contains the Users Login ID. For Active Directory this is sAMAccountName -PARAMMAPPASSWORD=LDAP Attribute which contains the Users password to compare against. -PORT=Port -SEARCH STRING=Search String -THE BASE DN OF YOUR LDAP SERVER=The base DN of your LDAP server, e.g o=mydomain.com -USERS DN=Users DN -YES=Yes - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +AUTHORIZATION METHOD=Authorisation Method +ANONYMOUS COMPARE=Anonymous Compare +AUTHENTICATE THEN BIND=Authenticate then Bind +BASE DN=Base DN +BIND AS USER=Bind as User +BIND AND SEARCH=Bind and Search +BIND DIRECTLY AS USER=Bind Directly as User +CONNECT PASSWORD=Connect password +CONNECT USERNAME=Connect username +DEFAULT PORT IS 389=Default port is 389 +FOLLOW REFERRALS=Follow referrals +FOR EXAMPLE, OPENLDAP.MYCOMPANY.ORG=For example: openldap.mycompany.org +HANDLES USER AUTHENTICATION AGAINST AN LDAP SERVER=Handles User Authentication against an LDAP server +HOST=Host +LDAP AUTHENTICATION=LDAP Authentication +LDAP V3=LDAP V3 +MAP FULLNAME=Map: Full Name +MAP EMAIL=Map: E-mail +MAP USER ID=Map: User ID +MAP PASSWORD=Map: Password +NEGOTIATE TLS=Negotiate TLS +NO=No +PARAMLDAPHOST=For example: openldap.mycompany.org +PARAMLDAPPORT=Default port is 389 +PARAMBASEDN=The base DN of your LDAP server +PARAMAUTHMETHOD=The authorisation method to validate the credentials +PARAMCONNECTSTRING=The Connect Username and Connect Password define connection parameters for the DN lookup phase. Two options are available:- Anonymous DN lookup. Leave both fields blank.- Administrative connection: Connect Username is the username of an administrative account, for example Administrator. Connect password is the actual password of your administrative account. +PARAMCONNECTPASSWORD=The Connect Password is the password of an administrative account. This is used in Authenticate then Bind and Authenticated Compare authorisation methods +PARAMLDAPV3=Default is LDAP2, but latest versions of OpenLdap require clients to use LDAPV3 +PARAMNEGOCIATETLS=Negotiate TLS encryption with the LDAP server. This requires all traffic to and from my LDAP server to be encrypted. +PARAMFOLLOW=This option sets the value of the LDAP_OPT_REFERRALS flag. You will need to set it to No for Windows 2003 servers. +PARAMSEARCHSTRING=A query string used for search for a given User. The [search] keyword is dynamically replaced by the User-provided login. An example string is: uid=[search]. Several strings can be used separated by semi-colons. Only used when searching. +PARAMUSERSDN=The [username] keyword is dynamically replaced by the User-provided login. An example string is: uid=[username], dc=my-domain, dc=com. Several strings can be used, separated by semi-colons. Only used for direct binds. +PARAMMAPFN=LDAP Attribute which contains the User's full name +PARAMMAPEMAIL=LDAP Attribute which contains the User's e-mail address +PARAMMAPUID=LDAP Attribute which contains the User's Login ID. For Active Directory this is sAMAccountName +PARAMMAPPASSWORD=LDAP Attribute which contains the User's password to compare against. +PORT=Port +SEARCH STRING=Search String +THE BASE DN OF YOUR LDAP SERVER=The base DN of your LDAP server, e.g o=mydomain.com +USERS DN=User's DN +YES=Yes + + diff --git a/administrator/language/en-GB/en-GB.plg_content_code.ini b/administrator/language/en-GB/en-GB.plg_content_code.ini index e9a5b9cd54ecd..2831adc0e30ac 100644 --- a/administrator/language/en-GB/en-GB.plg_content_code.ini +++ b/administrator/language/en-GB/en-GB.plg_content_code.ini @@ -1,10 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -MOSCODE=code -DISPLAYS FORMATTED CODE IN CONTENT ITEMS=Displays formatted code in Articles - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +MOSCODE=code +DISPLAYS FORMATTED CODE IN CONTENT ITEMS=Displays formatted code in Articles + + diff --git a/administrator/language/en-GB/en-GB.plg_content_emailcloak.ini b/administrator/language/en-GB/en-GB.plg_content_emailcloak.ini index 60f25b7cc5967..b4f27d0df4285 100644 --- a/administrator/language/en-GB/en-GB.plg_content_emailcloak.ini +++ b/administrator/language/en-GB/en-GB.plg_content_emailcloak.ini @@ -1,14 +1,15 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -AS LINKABLE MAILTO ADDRESS=As linkable mailto address -DESCMOSEMAILCLOAK=Cloaks all e-mails in content from spambots using JavaScript -MODE=Mode -MOSEMAILCLOAK=mosemailcloak -NONLINKABLE TEXT=Non-linkable Text -SELECT HOW THE EMAILS WILL BE DISPLAYED=Select how the e-mails will be displayed - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +AS LINKABLE MAILTO ADDRESS=As linkable mailto address +DESCMOSEMAILCLOAK=Cloaks all e-mails in content from spambots using JavaScript +MODE=Mode +MOSEMAILCLOAK=mosemailcloak +NONLINKABLE TEXT=Non-linkable Text +SELECT HOW THE EMAILS WILL BE DISPLAYED=Select how emails will be displayed + + + diff --git a/administrator/language/en-GB/en-GB.plg_content_geshi.ini b/administrator/language/en-GB/en-GB.plg_content_geshi.ini index 8438edd012f2d..4773d664d8ed2 100644 --- a/administrator/language/en-GB/en-GB.plg_content_geshi.ini +++ b/administrator/language/en-GB/en-GB.plg_content_geshi.ini @@ -1,10 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -GESHI=GeSHi -DESCGESHI=Displays formatted code in Articles based on the GeSHi highlighting engine - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +GESHI=GeSHi +DESCGESHI=Displays formatted code in Articles based on the GeSHi highlighting engine + + diff --git a/administrator/language/en-GB/en-GB.plg_content_image.ini b/administrator/language/en-GB/en-GB.plg_content_image.ini index 2439443e33bee..79cd21aa7e08f 100644 --- a/administrator/language/en-GB/en-GB.plg_content_image.ini +++ b/administrator/language/en-GB/en-GB.plg_content_image.ini @@ -1,15 +1,16 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCIMAGE=Makes it possible to insert images in Articles, configure the image's properties, and upload new image files. -MARGIN=Margin -UP=Up -PADDING=Padding -PARAMMARGIN=Margin in px, of Div surrounding Image & Caption - only applies if using a Caption -PARAMPADDING=Padding in px, of Div surrounding Image & Caption - only applies if using a Caption -IMAGE=Image - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCIMAGE=Makes it possible to insert images in Articles, configure the image's properties and upload new image files. +MARGIN=Margin +UP=Up +PADDING=Padding +PARAMMARGIN=Margin (in pixels) of DIV surrounding image and caption (only applies if using a caption) +PARAMPADDING=Padding (in pixels) of DIV surrounding tmage and caption (only applies if using a caption) +IMAGE=Image + + + diff --git a/administrator/language/en-GB/en-GB.plg_content_loadmodule.ini b/administrator/language/en-GB/en-GB.plg_content_loadmodule.ini index 89d75061e03c2..73714e0867dcb 100644 --- a/administrator/language/en-GB/en-GB.plg_content_loadmodule.ini +++ b/administrator/language/en-GB/en-GB.plg_content_loadmodule.ini @@ -1,17 +1,18 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -CODE THAT WILL WRAP MODULES=Code that will wrap Modules -DESCLOADPOSITION=Loads Module positions within Content, Syntax: {loadposition user1} -LOADPOSITION=loadposition -NO WRAPPING - RAW OUTPUT=No wrapping - raw output -STYLE=Style -WRAPPED BY DIVS=Wrapped by Divs -WRAPPED BY MULTIPLE DIVS=Wrapped by Multiple Divs -WRAPPED BY TABLE - COLUMN=Wrapped by Table - Column -WRAPPED BY TABLE - HORIZONTAL=Wrapped by Table - Horizontal - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CODE THAT WILL WRAP MODULES=Code that will wrap Modules +DESCLOADPOSITION=Loads Module positions within Content, Syntax: {loadposition user1} +LOADPOSITION=loadposition +NO WRAPPING - RAW OUTPUT=No wrapping (raw output) +STYLE=Style +WRAPPED BY DIVS=Wrapped by Divs +WRAPPED BY MULTIPLE DIVS=Wrapped by Multiple Divs +WRAPPED BY TABLE - COLUMN=Wrapped by table (column) +WRAPPED BY TABLE - HORIZONTAL=Wrapped by table (horizontal) + + + diff --git a/administrator/language/en-GB/en-GB.plg_content_pagebreak.ini b/administrator/language/en-GB/en-GB.plg_content_pagebreak.ini index 0a1c8529624ec..ae3cb0acdb7a9 100644 --- a/administrator/language/en-GB/en-GB.plg_content_pagebreak.ini +++ b/administrator/language/en-GB/en-GB.plg_content_pagebreak.ini @@ -1,25 +1,25 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - ->=> -<=< -ALL PAGES= All Pages -ARTICLE INDEX=Article Index -DESCCONTENTPAGEBREAK=Add a Table of Contents functionality to a paginated Article. This is done automatically through the use of the Pagebreak button added to the lower part of the text panel in an Article. The HTML code is included here as a reference of what is available. The Pagebreak will itself display in the text window as a simple horizontal line.
    Syntax: Usage: <hr class="system-pagebreak" />
    <hr class="system-pagebreak" title="The page title" /> or
    <hr class="system-pagebreak" alt="The first page" /> or
    <hr class="system-pagebreak" title="The page title" alt="The first page" /> or
    <hr class="system-pagebreak" alt="The first page" title="The page title" /> -HIDE=Hide -NEXT=Next -NO=No -PAGE #=Page %s -PARAMENABLED=Select whether the Plugin is enabled. -PARAMSITETITLE=title and heading attibutes from Plugin added to Site Title tag -PARAMSITETOC=Display a table of contents on multi-page Articles. -PARAMSITESHOWALL=Allow Users to select the Show All feature -PREV=Prev -SHOW=Show -SHOW ALL=Show all -SITE TITLE=Site Title -TABLE OF CONTENTS=Table of Contents -YES=Yes \ No newline at end of file +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +>=> +<=< +ALL PAGES= All Pages +ARTICLE INDEX=Article Index +DESCCONTENTPAGEBREAK=Add Table of Contents functionality to a paginated Article. This is done automatically through the use of the page break button added to the lower part of the text panel in an Article. The HTML code is included here as a reference of what is available. The page break will be displayed in the text window as a simple horizontal line.
    Syntax: Usage: <hr class="system-pagebreak" />
    <hr class="system-pagebreak" title="The page title" /> or
    <hr class="system-pagebreak" alt="The first page" /> or
    <hr class="system-pagebreak" title="The page title" alt="The first page" /> or
    <hr class="system-pagebreak" alt="The first page" title="The page title" /> +HIDE=Hide +NEXT=Next +NO=No +PAGE #=Page %s +PARAMENABLED=Select whether the Plugin is enabled. +PARAMSITETITLE=title and heading attibutes from Plugin added to Site Title tag +PARAMSITETOC=Display a table of contents on multi-page Articles. +PARAMSITESHOWALL=Allow Users to select the Show All feature +PREV=Prev +SHOW=Show +SHOW ALL=Show all +SITE TITLE=Site Title +TABLE OF CONTENTS=Table of Contents +YES=Yes diff --git a/administrator/language/en-GB/en-GB.plg_content_pagenavigation.ini b/administrator/language/en-GB/en-GB.plg_content_pagenavigation.ini index 309c1c8b4ca19..9bc979fb905bf 100644 --- a/administrator/language/en-GB/en-GB.plg_content_pagenavigation.ini +++ b/administrator/language/en-GB/en-GB.plg_content_pagenavigation.ini @@ -1,13 +1,13 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ABOVE=Above -DESCPAGENAVIGATION=Enables you to add the Next & Previous functionality to an Article. -BELOW=Below -POSITION=Position -POSITION OF PAGE NAVIGATION IN RELATION TO TEXT=The position of the Page Navigation function on the viewed page in relation to the text. - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ABOVE=Above +DESCPAGENAVIGATION=Enables you to add the Next & Previous functionality to an Article. +BELOW=Below +POSITION=Position +POSITION OF PAGE NAVIGATION IN RELATION TO TEXT=The position of the Page Navigation function on the viewed page in relation to the text. + + diff --git a/administrator/language/en-GB/en-GB.plg_content_vote.ini b/administrator/language/en-GB/en-GB.plg_content_vote.ini index d3f4702b31b9a..641b2dc10fa4d 100644 --- a/administrator/language/en-GB/en-GB.plg_content_vote.ini +++ b/administrator/language/en-GB/en-GB.plg_content_vote.ini @@ -1,11 +1,11 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ADD THE VOTING FUNCTIONALITY TO ITEMS=Add the Voting functionality to Articles -BEST=Best -POOR=Poor -RATE=Rate +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ADD THE VOTING FUNCTIONALITY TO ITEMS=Add the Voting functionality to Articles +BEST=Best +POOR=Poor +RATE=Rate USER RATING=User Rating \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.plg_editors-xtd_image.ini b/administrator/language/en-GB/en-GB.plg_editors-xtd_image.ini index 45c0d96c42562..019ed24e1625a 100644 --- a/administrator/language/en-GB/en-GB.plg_editors-xtd_image.ini +++ b/administrator/language/en-GB/en-GB.plg_editors-xtd_image.ini @@ -1,9 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCIMAGE=Displays a button to make it possible to insert images into an Article. Causes a popup to be displayed allowing you to configure the image's properties, and to upload new image files. - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCIMAGE=Displays a button to make it possible to insert images into an Article. Displays a popup allowing you to configure an image's properties and upload new image files. + + + diff --git a/administrator/language/en-GB/en-GB.plg_editors-xtd_pagebreak.ini b/administrator/language/en-GB/en-GB.plg_editors-xtd_pagebreak.ini index f35e802645c6e..89e601ff49bb9 100644 --- a/administrator/language/en-GB/en-GB.plg_editors-xtd_pagebreak.ini +++ b/administrator/language/en-GB/en-GB.plg_editors-xtd_pagebreak.ini @@ -1,9 +1,9 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCPAGEBREAK=Provides a button to enable a pagebreak to be inserted into an Article. A popup allows you to configure the settings to be used. - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCPAGEBREAK=Provides a button to enable a pagebreak to be inserted into an Article. A popup allows you to configure the settings to be used. + + diff --git a/administrator/language/en-GB/en-GB.plg_editors-xtd_readmore.ini b/administrator/language/en-GB/en-GB.plg_editors-xtd_readmore.ini index dfd910b980909..abd21d62bf0a5 100644 --- a/administrator/language/en-GB/en-GB.plg_editors-xtd_readmore.ini +++ b/administrator/language/en-GB/en-GB.plg_editors-xtd_readmore.ini @@ -1,9 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCREADMORE=Enables a button to be availble that allows you to easily insert the Read more... Link into an Article. - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCREADMORE=Enables a button which allows you to easily insert the Read more... link into an Article. + + + diff --git a/administrator/language/en-GB/en-GB.plg_editors_none.ini b/administrator/language/en-GB/en-GB.plg_editors_none.ini index 6c7bade9997f4..9399f07b7d0bc 100644 --- a/administrator/language/en-GB/en-GB.plg_editors_none.ini +++ b/administrator/language/en-GB/en-GB.plg_editors_none.ini @@ -1,7 +1,7 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -THIS LOADS A BASIC TEXT ENTRY FIELD=This loads a basic text entry field +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +THIS LOADS A BASIC TEXT ENTRY FIELD=This loads a basic text entry field. diff --git a/administrator/language/en-GB/en-GB.plg_editors_tinymce.ini b/administrator/language/en-GB/en-GB.plg_editors_tinymce.ini index 5bb95fd361eb5..cfb359124d743 100644 --- a/administrator/language/en-GB/en-GB.plg_editors_tinymce.ini +++ b/administrator/language/en-GB/en-GB.plg_editors_tinymce.ini @@ -18,9 +18,9 @@ CODE CLEANUP UPON SAVING ARTICLE=Code cleaning upon saving article COMPRESSED VERSION=Compressed Version CUSTOM CSS CLASSES=Custom CSS Classes DATE FORMAT=Date Format -DESCLANGCODE=Editor UI Language. A value here is mandatory if manual language selection is set +DESCLANGCODE=Editor UI Language. A value here is mandatory if manual language selection is set. DESCLANGMODE=If Yes, editor language will automatically match selected UI language. Do not activate if appropriate editor languages are not installed. -DESCTINYMCE=TinyMCE is a platform independent web based JavaScript HTML WYSIWYG Editor control. +DESCTINYMCE=TinyMCE is a platform-independent Web-based JavaScript HTML WYSIWYG Editor control. DIRECTIONALITY=Directionality DO NOT CLEAN ENTITIES=Do not clean HTML entities. ELEMENT PATH=Element Path @@ -43,32 +43,32 @@ LEFT TO RIGHT=Left to Right LOAD CSS CLASSES FROM TEMPLATE_CSS.CSS=Load CSS classes from template_css.css NEVER=Never NEWLINES=New Lines -NEWLINES WILL BE MADE INTO THE SELECTED OPTION=New lines will be created using the selected option +NEWLINES WILL BE MADE INTO THE SELECTED OPTION=New lines will be created using the selected option. P ELEMENTS=P Elements -PARAMCODECLEANUP=By default TinyMCE will clean your code of certain HTML elements, like script and center tags, for security and XHTML compliance. We recommend you do not deactivate this funcitonality -PARAMCOMPRESSEDVERSION=Tiny can be run in compressed mode, leading to slightly faster load speeds. However, this mode does not always work, especially in IE, so default for this is Off. Be careful when enabling this to ensure it works on your system -PARAMCUSTOMCSS=You can specify the loading of a custom CSS file - simply enter the Full URL path to the CSS file you want loaded. If you enter a value in this field, this will overrule the Template CSS classes parameter. +PARAMCODECLEANUP=By default, TinyMCE will clean your code of certain HTML elements like script and center tags and check for security and XHTML compliance. We recommend you do not deactivate this functionality +PARAMCOMPRESSEDVERSION=Tiny can be run in compressed mode resulting in slightly faster load speeds. However, this mode does not always work (especially in IE) so default for this is Off. Be careful when enabling this to ensure it works on your system. +PARAMCUSTOMCSS=You can specify the loading of a custom CSS file. Simply enter the full URL path to the CSS file you want loaded. If you enter a value in this field, this will overrule the template CSS classes parameter. PARAMDIRECTIONALITY=Select whether to display the RTL button. Only Works in Advanced mode PARAMELEMENTPATH=If set to ON, it shows the set classes for the marked text. PARAMENTITIECLEANUP=If set to No, entities are stripped from the code. PARAMEXTVALIDELEMENTS=Allows the addition of specific valid_elements to the existing rule set. -PARAMFLASH=Show/Hide the Flash button. Only works in Advanced mode -PARAMFULLSCREEN=Show/Hide the Fullscreen button. Only works in Advanced mode -PARAMINSERTDATE=Show/Hide the Insert Date button. Only works in Advanced mode -PARAMINSERTTIME=Show/Hide the Insert Time button. Only works in Advanced mode -PARAMHTMLHEIGHT=Height of HTML mode pop-up window. Only works in Advanced mode -PARAMHTMLWIDTH=Width of HTML mode pop-up window. Only works in Advanced mode -PARAMLAYER=Show/Hide the Layer control button. Only works in Advanced mode -PARAMPREVIEW=Show/Hide the Preview buttons. Only works in Advanced mode -PARAMPREVIEWHEIGHT=Height of Preview mode pop-up window. Only works in Advanced mode -PARAMPREVIEWWIDTH=Width of Preview mode pop-up window. Only works in Advanced mode -PARAMSEARCHREPLACE=Show/Hide the Search & Replace button. Only works in Advanced mode -PARAMSMILIES=Show/Hide the Smilies buttons. Only works in Advanced mode -PARAMSTYLE=Show/Hide the CSS Style control button. Only works in Advanced mode -PARAMTABLE=Show/Hide the Table control buttons. Only works in Advanced mode +PARAMFLASH=Show/Hide the Flash button. Only works in advanced mode. +PARAMFULLSCREEN=Show/Hide the Fullscreen button. Only works in advanced mode. +PARAMINSERTDATE=Show/Hide the Insert Date button. Only works in advanced mode. +PARAMINSERTTIME=Show/Hide the Insert Time button. Only works in advanced mode. +PARAMHTMLHEIGHT=Height of HTML mode pop-up window. Only works in advanced mode. +PARAMHTMLWIDTH=Width of HTML mode pop-up window. Only works in advanced mode. +PARAMLAYER=Show/Hide the Layer control button. Only works in advanced mode. +PARAMPREVIEW=Show/Hide the Preview buttons. Only works in advanced mode. +PARAMPREVIEWHEIGHT=Height of Preview mode pop-up window. Only works in advanced mode. +PARAMPREVIEWWIDTH=Width of Preview mode pop-up window. Only works in advanced mode. +PARAMSEARCHREPLACE=Show/Hide the Search & Replace button. Only works in advanced mode. +PARAMSMILIES=Show/Hide the smilies buttons. Only works in advanced mode. +PARAMSTYLE=Show/Hide the CSS Style control button. Only works in advanced mode. +PARAMTABLE=Show/Hide the table control buttons. Only works in advanced mode. PARAMTEMPLATE=Show/Hide the Add new Layer button. Only works in Advanced mode. -PARAMTEMPLATECSS=By default the Plugin looks for an editor.css file. If it cannot find one in the default template it loads the editor.css file in the system template. -PARAMXHTMLXTRAS=Show/Hide the additional XHTML features.Only works in Advanced mode. +PARAMTEMPLATECSS=By default the Plugin looks for an editor.css file. If it cannot find one in the default template, it loads the editor.css file in the system template. +PARAMXHTMLXTRAS=Show/Hide the additional XHTML features. Only works in advanced mode. POSITION OF THE TOOLBAR=Position of the toolbar PREVIEW=Preview PREVIEW HEIGHT=Preview Height @@ -77,7 +77,7 @@ PROHIBITED ELEMENTS=Prohibited Elements RELATIVE=Relative RIGHT TO LEFT=Right to Left SAVE WARNING=Save Warning -SAVE WARNING - GIVES WARNING IF YOU CANCEL WITHOUT SAVING CHANGES=Save Warning - gives warning if you cancel without saving changes +SAVE WARNING - GIVES WARNING IF YOU CANCEL WITHOUT SAVING CHANGES=Save Warning: gives warning if you cancel without saving changes. SEARCH AND REPLACE=Search & Replace SELECT FUNCTIONALITY=Select Functionality SHOW/HIDE THE HORIZONTAL RULE BUTTON=Show/Hide the Horizontal Rule button @@ -93,3 +93,4 @@ URL BEHAVIOUR=URL behaviour URLS=URLs XHTMLXTRAS=XHTMLxtras + diff --git a/administrator/language/en-GB/en-GB.plg_editors_xstandard.ini b/administrator/language/en-GB/en-GB.plg_editors_xstandard.ini index 72e1d5281e62d..ebc91e65d3a53 100644 --- a/administrator/language/en-GB/en-GB.plg_editors_xstandard.ini +++ b/administrator/language/en-GB/en-GB.plg_editors_xstandard.ini @@ -1,11 +1,11 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCXSTANDARD=XStandard is the leading standards-compliant plug-in WYSIWYG editor for desktop applications and browser-based content management systems (IE/Mozilla/Firefox/Netscape). -PARAMEDITORMODE=This paramater can be used to set the default view of the editor. -EDITOR MODE=Editor Mode -SCREEN-READER=Screen Reader -WYSIWYG=WYSIWYG \ No newline at end of file +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCXSTANDARD=XStandard is the leading standards-compliant WYSIWYG editor Plugin for desktop applications and browser-based content management systems (IE/Mozilla/Firefox/Netscape). +PARAMEDITORMODE=This paramater can be used to set the default view of the editor. +EDITOR MODE=Editor Mode +SCREEN-READER=Screen Reader +WYSIWYG=WYSIWYG diff --git a/administrator/language/en-GB/en-GB.plg_search_categories.ini b/administrator/language/en-GB/en-GB.plg_search_categories.ini index 0d793ff96065f..885077b15e6e5 100644 --- a/administrator/language/en-GB/en-GB.plg_search_categories.ini +++ b/administrator/language/en-GB/en-GB.plg_search_categories.ini @@ -1,13 +1,13 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ALLOWS SEARCHING OF CATEGORIES INFORMATION=Enables searching of Category information -CATEGORY BLOG=Category Blog -CATEGORY LIST=Category List -NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return -SEARCH LIMIT=Search Limit - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ALLOWS SEARCHING OF CATEGORIES INFORMATION=Enables searching of Category information +CATEGORY BLOG=Category Blog +CATEGORY LIST=Category List +NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return +SEARCH LIMIT=Search Limit + + diff --git a/administrator/language/en-GB/en-GB.plg_search_contacts.ini b/administrator/language/en-GB/en-GB.plg_search_contacts.ini index 7de89295a2dc5..5d9b17a466207 100644 --- a/administrator/language/en-GB/en-GB.plg_search_contacts.ini +++ b/administrator/language/en-GB/en-GB.plg_search_contacts.ini @@ -1,11 +1,12 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ALLOWS SEARCHING OF CONTACTS COMPONENT=Enables searching of Contact Component -NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return -SEARCH LIMIT=Search Limit - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ALLOWS SEARCHING OF CONTACTS COMPONENT=Enables searching of the Contact Component +NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return +SEARCH LIMIT=Search Limit + + + diff --git a/administrator/language/en-GB/en-GB.plg_search_content.ini b/administrator/language/en-GB/en-GB.plg_search_content.ini index e407497302177..f7ce277f54673 100644 --- a/administrator/language/en-GB/en-GB.plg_search_content.ini +++ b/administrator/language/en-GB/en-GB.plg_search_content.ini @@ -1,19 +1,19 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ALLOWS SEARCHING OF ALL ARTICLES=Enables searching of all Articles -ARCHIVED CONTENT=Archived Articles -CONTENT ITEMS=Articles -NO=No -NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return -SEARCH ARCHIVED CONTENT?=Search Archived Articles? -SEARCH CONTENT ITEMS?=Search Articles? -SEARCH LIMIT=Search Limit -SEARCH UNCATEGORISED CONTENT?=Search Uncategorized Articles? -UNCATEGORISED CONTENT=Uncategorized Articles -YES=Yes - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ALLOWS SEARCHING OF ALL ARTICLES=Enables searching of all Articles +ARCHIVED CONTENT=Archived Articles +CONTENT ITEMS=Articles +NO=No +NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return +SEARCH ARCHIVED CONTENT?=Search Archived Articles? +SEARCH CONTENT ITEMS?=Search Articles? +SEARCH LIMIT=Search Limit +SEARCH UNCATEGORISED CONTENT?=Search Uncategorized Articles? +UNCATEGORISED CONTENT=Uncategorized Articles +YES=Yes + + diff --git a/administrator/language/en-GB/en-GB.plg_search_newsfeeds.ini b/administrator/language/en-GB/en-GB.plg_search_newsfeeds.ini index 7813d8c74ab04..e1e3f777d842c 100644 --- a/administrator/language/en-GB/en-GB.plg_search_newsfeeds.ini +++ b/administrator/language/en-GB/en-GB.plg_search_newsfeeds.ini @@ -1,12 +1,12 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ALLOWS SEARCHING OF NEWSFEEDS=Enables searching of News Feeds -NEWSFEEDS=News Feeds -NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return -SEARCH LIMIT=Search Limit - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ALLOWS SEARCHING OF NEWSFEEDS=Enables searching of News Feeds +NEWSFEEDS=News Feeds +NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return +SEARCH LIMIT=Search Limit + + diff --git a/administrator/language/en-GB/en-GB.plg_search_sections.ini b/administrator/language/en-GB/en-GB.plg_search_sections.ini index 1f886f3b0d8a5..d35347ad1e5fa 100644 --- a/administrator/language/en-GB/en-GB.plg_search_sections.ini +++ b/administrator/language/en-GB/en-GB.plg_search_sections.ini @@ -1,13 +1,13 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ALLOWS SEARCHING OF CONTENT SECTION INFORMATION=Enables searching of Article Section information -NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return -SECTION BLOG=Section Blog -SECTION LIST=Section List -SEARCH LIMIT=Search Limit - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ALLOWS SEARCHING OF CONTENT SECTION INFORMATION=Enables searching of Article Section information +NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return +SECTION BLOG=Section Blog +SECTION LIST=Section List +SEARCH LIMIT=Search Limit + + diff --git a/administrator/language/en-GB/en-GB.plg_search_weblinks.ini b/administrator/language/en-GB/en-GB.plg_search_weblinks.ini index 1d0b1d1539a79..4fadaade2a795 100644 --- a/administrator/language/en-GB/en-GB.plg_search_weblinks.ini +++ b/administrator/language/en-GB/en-GB.plg_search_weblinks.ini @@ -1,11 +1,11 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ALLOWS SEARCHING OF WEBLINKS COMPONENT=Enables searching of Web Links Component -NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return -SEARCH LIMIT=Search Limit - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ALLOWS SEARCHING OF WEBLINKS COMPONENT=Enables searching of Web Links Component +NUMBER OF SEARCH ITEMS TO RETURN=Number of search items to return +SEARCH LIMIT=Search Limit + + diff --git a/administrator/language/en-GB/en-GB.plg_system_backlink.ini b/administrator/language/en-GB/en-GB.plg_system_backlink.ini index 53989e7bc80c9..e3b6f84aa0ca0 100644 --- a/administrator/language/en-GB/en-GB.plg_system_backlink.ini +++ b/administrator/language/en-GB/en-GB.plg_system_backlink.ini @@ -1,14 +1,14 @@ -# $Id: en-GB.plg_system_backlink.ini 2007-09-29 11:00:25Z humvee $ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ATTEMPT LEGACY SEF=Attempt Legacy SEF -IF YES, IT SEARCHES FOR OLD QUERY STRINGS THAT MIGHT MATCH AND REDIRECTS=If Yes is selected, the system will search for old Query Strings that might match and then redirects to it. -IF YES, IT USES OLD STYLE SEF AND ATTEMPTS TO GENERATE A VALID LINK=If Yes is selected, the system will use the old style SEF format and will attempt to generate a valid link. -IF YES, IT USES OLD STYLE SEF AND DIRECTS IT TO THE NEW LINK=If Yes is selected, the system will use the old style SEF format and will redirect to the new link. -PROVIDES BACKLINK SUPPORT=The Backlink Plugin provides support for legacy Joomla!1.0.x links. It redirects old style URL and document links to the correct Joomla! 1.5 targets. -SEARCH QUERY STRINGS=Search Query Strings -SEARCH SEF=Search SEF -"%s" HAS MOVED TO %s. CLICK THE LINK IF YOUR BROWSER DOES NOT REDIRECT YOU AUTOMATICALLY.="%s" has moved to %s. Click the link if your browser does not redirect you automatically. +# $Id: en-GB.plg_system_backlink.ini 2007-09-29 11:00:25Z humvee $ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ATTEMPT LEGACY SEF=Attempt Legacy SEF +IF YES, IT SEARCHES FOR OLD QUERY STRINGS THAT MIGHT MATCH AND REDIRECTS=If Yes is selected, the system will search for old Query Strings that might match and then redirects to it. +IF YES, IT USES OLD STYLE SEF AND ATTEMPTS TO GENERATE A VALID LINK=If Yes is selected, the system will use the old style SEF format and will attempt to generate a valid link. +IF YES, IT USES OLD STYLE SEF AND DIRECTS IT TO THE NEW LINK=If Yes is selected, the system will use the old style SEF format and will redirect to the new link. +PROVIDES BACKLINK SUPPORT=The Backlink Plugin provides support for legacy Joomla 1.0.x links. It redirects old style URLs and document links to the correct Joomla 1.5 targets. +SEARCH QUERY STRINGS=Search Query Strings +SEARCH SEF=Search SEF +"%s" HAS MOVED TO %s. CLICK THE LINK IF YOUR BROWSER DOES NOT REDIRECT YOU AUTOMATICALLY.="%s" has moved to %s. Click the link if your browser does not automatically redirect you. diff --git a/administrator/language/en-GB/en-GB.plg_system_debug.ini b/administrator/language/en-GB/en-GB.plg_system_debug.ini index 54be4c054a57e..4a19c5d8812bb 100644 --- a/administrator/language/en-GB/en-GB.plg_system_debug.ini +++ b/administrator/language/en-GB/en-GB.plg_system_debug.ini @@ -1,19 +1,33 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DISPLAY SQL QUERY LOG=Display SQL query log -DISPLAY MEMORY USAGE=Display memory usage -DISPLAY UNDEFINED LANGUAGE STRINGS=Display undefined language strings -IF YES, DISPLAY SQL QUERY LOG=If Yes, display SQL query log -IF YES, DISPLAY MEMORY USAGE=If Yes, display memory usage -IF YES, DISPLAY UNDEFINED LANGUAGE STRINGS=If Yes, display undefined language strings -LANGUAGE FILES LOADED=Language Files Loaded -LEGACY QUERIES LOGGED=Legacy Queries Logged -MEMORY USAGE=Memory Usage -PROFILE INFORMATION=Profile Information -PROVIDES DEBUG INFORMATION=Provides debug information -QUERIES LOGGED=%s queries logged -UNTRANSLATED STRINGS=Untranslated strings +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ALL MODES=All modes +DESIGNER MODE=Designer mode +DIAGNOSTIC MODE=Diagnostic mode +DISPLAY LOADED LANGUAGE FILES=Display loaded language files +DISPLAYS ORPHANED STRINGS IN DIFFERENT WAYS=Displays orphaned strings in different ways +IF YES, DISPLAY A LIST OF THE LANGUAGE FILES LOADED=If Yes, display a list of the language files loaded. +STRING FORMAT=String Format +STRIP STRING PREFIX=Strip Key Prefix +STRIP STRING PREFIX DESC=Strips this prefix from the actual string prior to displaying designer results +DISPLAY PROFILING INFORMATION=Display Profiling Information +IF YES, DISPLAY PROFILING INFORMATION=If Yes, display profiling information + +DISPLAY SQL QUERY LOG=Display SQL query log +DISPLAY MEMORY USAGE=Display memory usage +DISPLAY UNDEFINED LANGUAGE STRINGS=Display undefined language strings. +IF YES, DISPLAY SQL QUERY LOG=If Yes, display SQL query log. +IF YES, DISPLAY MEMORY USAGE=If Yes, display memory usage. +IF YES, DISPLAY UNDEFINED LANGUAGE STRINGS=If Yes, display undefined language strings. +LANGUAGE FILES LOADED=Language Files Loaded +MEMORY USAGE=Memory Usage +PROFILE INFORMATION=Profile Information +PROVIDES DEBUG INFORMATION=Provides debug information +QUERIES LOGGED=%s queries logged. +LEGACY QUERIES LOGGED=%s legacy queries logged. +UNTRANSLATED STRINGS=Untranslated strings +UNTRANSLATED STRINGS DESIGNER=Untranslated Strings Designer +UNTRANSLATED STRINGS DIAGNOSTIC=Untranslated Strings Diagnostic diff --git a/administrator/language/en-GB/en-GB.plg_system_legacy.ini b/administrator/language/en-GB/en-GB.plg_system_legacy.ini index 0d1209646eb6e..94e64dc0db59b 100644 --- a/administrator/language/en-GB/en-GB.plg_system_legacy.ini +++ b/administrator/language/en-GB/en-GB.plg_system_legacy.ini @@ -1,9 +1,9 @@ -# $Id: en-GB.plg_system_legacy.ini -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -USE LEGACY URL ROUTING=Use Legacy URL Routing -IF YES, USE LEGACY URL ROUTING MECHANISM=If yes, use legacy URL routing mechanism. +# $Id: en-GB.plg_system_legacy.ini +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +USE LEGACY URL ROUTING=Use Legacy URL Routing +IF YES, USE LEGACY URL ROUTING MECHANISM=If yes, use legacy URL routing mechanism. PROVIDES LEGACY SUPPORT FOR OLDER VERSION OF JOOMLA!=Provides Legacy Support for older versions of Joomla! \ No newline at end of file diff --git a/administrator/language/en-GB/en-GB.plg_system_sef.ini b/administrator/language/en-GB/en-GB.plg_system_sef.ini index a841e4175d22d..661d40e16f693 100644 --- a/administrator/language/en-GB/en-GB.plg_system_sef.ini +++ b/administrator/language/en-GB/en-GB.plg_system_sef.ini @@ -1,7 +1,7 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCPLGSYSTEMSEF=Adds SEF support to links in the document. It operates directly on the HTML and does not require a special tag. +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCPLGSYSTEMSEF=Adds SEF support to links in the document. It operates directly on the HTML and does not require a special tag. diff --git a/administrator/language/en-GB/en-GB.plg_user_joomla.ini b/administrator/language/en-GB/en-GB.plg_user_joomla.ini index f933b995d1dfc..7a52198b07429 100644 --- a/administrator/language/en-GB/en-GB.plg_user_joomla.ini +++ b/administrator/language/en-GB/en-GB.plg_user_joomla.ini @@ -1,9 +1,9 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -AUTO CREATE USERS=Auto-create Users -PARAMAUTOCREATEUSERS=Automatically create Registered Users where possible -PLG_USER_JOOMLA=Handles Joomla!'s default User synchronisation +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +AUTO CREATE USERS=Auto-create Users +PARAMAUTOCREATEUSERS=Automatically create Registered Users where possible +PLG_USER_JOOMLA=Handles Joomla!'s default User synchronisation diff --git a/administrator/language/en-GB/en-GB.plg_xmlrpc_blogger.ini b/administrator/language/en-GB/en-GB.plg_xmlrpc_blogger.ini index aada646ffc574..f4b48af1c94b9 100644 --- a/administrator/language/en-GB/en-GB.plg_xmlrpc_blogger.ini +++ b/administrator/language/en-GB/en-GB.plg_xmlrpc_blogger.ini @@ -1,26 +1,26 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -BLOGGER XML-RPC API=Blogger XML-RPC API -EDIT POSTS=Edit posts -NEW POSTS=New posts -PARAMCATEGORY=Set the Category to place new posts into -PARAMSECTION=Set the Section to retrieve posts from -LOGIN FAILED=The Login Failed -POST CHECK FAILED=Post Check Failed -POST STORE FAILED=Post Store Failed -POST DELETE FAILED=Post delete failed -SORRY, NO SUCH POST=Sorry, no such post -SORRY, POST IS ALREADY BEING EDITED=Sorry, post is already being edited -NO POSTS AVAILABLE, OR AN ERROR HAS OCCURRED=No posts available, or an error has occurred. -METHOD NOT IMPLEMENTED=Method not implemented -RETURNS A LIST OF WEBLOGS TO WHICH AN AUTHOR HAS POSTING PRIVILEGES.=Returns a list of weblogs to which an author has posting privileges. -RETURNS INFORMATION ABOUT AN AUTHOR IN THE SYSTEM.=Returns information about an author in the system. -RETURNS INFORMATION ABOUT A SPECIFIC POST.=Returns information about a specific post. -RETURNS A LIST OF THE MOST RECENT POSTS IN THE SYSTEM.=Returns a list of the most recent posts in the system. -CREATES A NEW POST, AND OPTIONALLY PUBLISHES IT.=Creates a new post, and optionally publishes it. -DELETES A POST.=Deletes a post. -UPDATES THE INFORMATION ABOUT AN EXISTING POST.=Updates the information about an existing post. +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +BLOGGER XML-RPC API=Blogger XML-RPC API +EDIT POSTS=Edit posts +NEW POSTS=New posts +PARAMCATEGORY=Set the Category to place new posts into +PARAMSECTION=Set the Section to retrieve posts from +LOGIN FAILED=Login Failed +POST CHECK FAILED=Post Check Failed +POST STORE FAILED=Post Store Failed +POST DELETE FAILED=Post delete failed +SORRY, NO SUCH POST=Sorry, no such post. +SORRY, POST IS ALREADY BEING EDITED=Sorry, the post is already being edited. +NO POSTS AVAILABLE, OR AN ERROR HAS OCCURRED=No posts available or an error has occurred. +METHOD NOT IMPLEMENTED=Method not implemented +RETURNS A LIST OF WEBLOGS TO WHICH AN AUTHOR HAS POSTING PRIVILEGES.=Returns a list of weblogs to which an author has posting privileges. +RETURNS INFORMATION ABOUT AN AUTHOR IN THE SYSTEM.=Returns information about an author in the system. +RETURNS INFORMATION ABOUT A SPECIFIC POST.=Returns information about a specific post. +RETURNS A LIST OF THE MOST RECENT POSTS IN THE SYSTEM.=Returns a list of the most recent posts in the system. +CREATES A NEW POST, AND OPTIONALLY PUBLISHES IT.=Creates a new post and optionally publishes it. +DELETES A POST.=Deletes a post. +UPDATES THE INFORMATION ABOUT AN EXISTING POST.=Updates the information about an existing post. diff --git a/administrator/language/en-GB/en-GB.plg_xmlrpc_joomla.ini b/administrator/language/en-GB/en-GB.plg_xmlrpc_joomla.ini index cb5e45f92f20e..fd565fb469e76 100644 --- a/administrator/language/en-GB/en-GB.plg_xmlrpc_joomla.ini +++ b/administrator/language/en-GB/en-GB.plg_xmlrpc_joomla.ini @@ -1,8 +1,8 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -JOOMLA! XML-RPC API=Joomla! XML-RPC API - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +JOOMLA! XML-RPC API=Joomla! XML-RPC API + diff --git a/administrator/language/en-GB/en-GB.tpl_rhuk_milkyway.ini b/administrator/language/en-GB/en-GB.tpl_rhuk_milkyway.ini index f6a3bdd92c27b..73cdf7ad622da 100644 --- a/administrator/language/en-GB/en-GB.tpl_rhuk_milkyway.ini +++ b/administrator/language/en-GB/en-GB.tpl_rhuk_milkyway.ini @@ -1,26 +1,26 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -COLOR VARIATION=Color Variation -COLOR VARIATION TO USE=Color variation to use -BACKGROUND VARIATION=Background Variation -BACKGROUND COLOR VARIATION TO USE=Background color variation to use. -TEMPLATE WIDTH=Template Width -WIDTH STYLE OF THE TEMPLATE=Select the method for the width style of the template from the dropdown. -FLUID=Fluid -FLUID WITH MAXIMUM=Fluid with maximum -MEDIUM=Medium -SMALL=Small -BLUE=Blue -RED=Red -GREEN=Green -WHITE=White -BLACK=Black -ORANGE=Orange -RHUK_MILKYWAY=RHUK Milkyway template -SHOW COMPONENT=Show Component -SHOW/HIDE THE COMPONENT OUTPUT=Select whether to display the Component output. -TPL_RHUK_MILKYWAY=MilkyWay is a fresh new template for Joomla! The clean design of this template makes it very lightweight and fast. +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +COLOR VARIATION=Color Variation +COLOR VARIATION TO USE=Color variation to use +BACKGROUND VARIATION=Background Variation +BACKGROUND COLOR VARIATION TO USE=Background color variation to use. +TEMPLATE WIDTH=Template Width +WIDTH STYLE OF THE TEMPLATE=Select the method for the width style of the template from the dropdown. +FLUID=Fluid +FLUID WITH MAXIMUM=Fluid with maximum +MEDIUM=Medium +SMALL=Small +BLUE=Blue +RED=Red +GREEN=Green +WHITE=White +BLACK=Black +ORANGE=Orange +RHUK_MILKYWAY=RHUK Milkyway template +SHOW COMPONENT=Show Component +SHOW/HIDE THE COMPONENT OUTPUT=Select whether to display the Component output. +TPL_RHUK_MILKYWAY=MilkyWay is a fresh new template for Joomla!. The clean design of this template makes it very lightweight and fast. diff --git a/administrator/language/en-GB/index.html b/administrator/language/en-GB/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/language/en-GB/index.html +++ b/administrator/language/en-GB/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/language/index.html b/administrator/language/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/language/index.html +++ b/administrator/language/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/index.html b/administrator/modules/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/index.html +++ b/administrator/modules/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_custom/index.html b/administrator/modules/mod_custom/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_custom/index.html +++ b/administrator/modules/mod_custom/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_feed/index.html b/administrator/modules/mod_feed/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_feed/index.html +++ b/administrator/modules/mod_feed/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_feed/mod_feed.php b/administrator/modules/mod_feed/mod_feed.php index b04f2439c94f8..b343b0744866a 100644 --- a/administrator/modules/mod_feed/mod_feed.php +++ b/administrator/modules/mod_feed/mod_feed.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die( 'Restricted access' ); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $rssurl = $params->get('rssurl', ''); $rssrtl = $params->get('rssrtl', 0); diff --git a/administrator/modules/mod_feed/tmpl/index.html b/administrator/modules/mod_feed/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_feed/tmpl/index.html +++ b/administrator/modules/mod_feed/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_footer/index.html b/administrator/modules/mod_footer/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_footer/index.html +++ b/administrator/modules/mod_footer/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_latest/index.html b/administrator/modules/mod_latest/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_latest/index.html +++ b/administrator/modules/mod_latest/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_latest/mod_latest.php b/administrator/modules/mod_latest/mod_latest.php index 76b441f058950..195ca2eb82605 100644 --- a/administrator/modules/mod_latest/mod_latest.php +++ b/administrator/modules/mod_latest/mod_latest.php @@ -104,7 +104,7 @@ title, ENT_QUOTES, 'UTF-8');?>

    - $dateProperty;?> + $dateProperty, '%Y-%m-%d %H:%M:%S'); ?> diff --git a/administrator/modules/mod_latest/mod_latest.xml b/administrator/modules/mod_latest/mod_latest.xml index 1c2c1cc5a7139..ff19ec968ea44 100644 --- a/administrator/modules/mod_latest/mod_latest.xml +++ b/administrator/modules/mod_latest/mod_latest.xml @@ -16,14 +16,14 @@ - + - + - + diff --git a/administrator/modules/mod_logged/index.html b/administrator/modules/mod_logged/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_logged/index.html +++ b/administrator/modules/mod_logged/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_logged/mod_logged.xml b/administrator/modules/mod_logged/mod_logged.xml index 38b25049c94af..15a005a8ade31 100644 --- a/administrator/modules/mod_logged/mod_logged.xml +++ b/administrator/modules/mod_logged/mod_logged.xml @@ -15,7 +15,7 @@ - + diff --git a/administrator/modules/mod_logged/tmpl/index.html b/administrator/modules/mod_logged/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_logged/tmpl/index.html +++ b/administrator/modules/mod_logged/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_login/index.html b/administrator/modules/mod_login/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_login/index.html +++ b/administrator/modules/mod_login/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_login/mod_login.xml b/administrator/modules/mod_login/mod_login.xml index c92b86d3d9db7..77f91f33db165 100644 --- a/administrator/modules/mod_login/mod_login.xml +++ b/administrator/modules/mod_login/mod_login.xml @@ -15,7 +15,7 @@ - + diff --git a/administrator/modules/mod_menu/helper.php b/administrator/modules/mod_menu/helper.php index c49b54db58e31..207791e992f17 100644 --- a/administrator/modules/mod_menu/helper.php +++ b/administrator/modules/mod_menu/helper.php @@ -14,7 +14,7 @@ // no direct access defined('_JEXEC') or die('Restricted access'); -require_once(dirname(__FILE__).DS.'menu.php'); +require_once dirname(__FILE__).DS.'menu.php'; class modMenuHelper { @@ -24,8 +24,6 @@ class modMenuHelper */ function buildMenu() { - global $mainframe; - $lang = & JFactory::getLanguage(); $user = & JFactory::getUser(); $db = & JFactory::getDBO(); @@ -48,7 +46,7 @@ function buildMenu() $canManageUsers = $user->authorize('com_users', 'manage'); // Menu Types - require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_menus'.DS.'helpers'.DS.'helper.php' ); + require_once JPATH_ADMINISTRATOR.DS.'components'.DS.'com_menus'.DS.'helpers'.DS.'helper.php'; $menuTypes = MenusHelper::getMenuTypelist(); /* @@ -62,6 +60,9 @@ function buildMenu() $menu->addChild(new JMenuNode(JText::_('Site')), true); $menu->addChild(new JMenuNode(JText::_('Control Panel'), 'index.php', 'class:cpanel')); $menu->addSeparator(); + //if ($canManageACL) { + $menu->addChild(new JMenuNode(JText::_('Access Control'), 'index.php?option=com_acl', 'class:config')); + //} if ($canManageUsers) { $menu->addChild(new JMenuNode(JText::_('User Manager'), 'index.php?option=com_users&task=view', 'class:user')); } @@ -125,8 +126,11 @@ function buildMenu() $query = 'SELECT *' . ' FROM #__components' . - ' WHERE '.$db->NameQuote( 'option' ).' <> "com_frontpage"' . - ' AND '.$db->NameQuote( 'option' ).' <> "com_media"' . + ' WHERE '.$db->NameQuote( 'option' ).' NOT IN (' . + $db->Quote('com_acl').','. + $db->Quote('com_frontpage').','. + $db->Quote('com_media'). + ') AND '.$db->NameQuote( 'option' ).' <> "com_media"' . ' AND enabled = 1' . ' ORDER BY ordering, name'; $db->setQuery($query); @@ -299,5 +303,4 @@ function buildDisabledMenu() $menu->renderMenu('menu', 'disabled'); } -} -?> +} \ No newline at end of file diff --git a/administrator/modules/mod_menu/index.html b/administrator/modules/mod_menu/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_menu/index.html +++ b/administrator/modules/mod_menu/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_menu/mod_menu.php b/administrator/modules/mod_menu/mod_menu.php index d1dd8195dd39c..9246c692952fe 100644 --- a/administrator/modules/mod_menu/mod_menu.php +++ b/administrator/modules/mod_menu/mod_menu.php @@ -14,7 +14,7 @@ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); -require_once( dirname(__FILE__).DS.'helper.php' ); +require_once dirname(__FILE__).DS.'helper.php'; $hide = JRequest::getInt('hidemainmenu'); diff --git a/administrator/modules/mod_online/index.html b/administrator/modules/mod_online/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_online/index.html +++ b/administrator/modules/mod_online/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_online/mod_online.xml b/administrator/modules/mod_online/mod_online.xml index e90ae3a411a66..7f7aeff567ded 100644 --- a/administrator/modules/mod_online/mod_online.xml +++ b/administrator/modules/mod_online/mod_online.xml @@ -15,6 +15,6 @@ - + \ No newline at end of file diff --git a/administrator/modules/mod_popular/index.html b/administrator/modules/mod_popular/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_popular/index.html +++ b/administrator/modules/mod_popular/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_popular/mod_popular.php b/administrator/modules/mod_popular/mod_popular.php index de179f108dc5f..4de0372ba26d1 100644 --- a/administrator/modules/mod_popular/mod_popular.php +++ b/administrator/modules/mod_popular/mod_popular.php @@ -48,7 +48,7 @@ title, ENT_QUOTES, 'UTF-8');?> - created;?> + created, '%Y-%m-%d %H:%M:%S'); ?> hits;?> diff --git a/administrator/modules/mod_popular/mod_popular.xml b/administrator/modules/mod_popular/mod_popular.xml index e0aa54f83d0f9..85c58ab47fe95 100644 --- a/administrator/modules/mod_popular/mod_popular.xml +++ b/administrator/modules/mod_popular/mod_popular.xml @@ -15,6 +15,6 @@ - + diff --git a/administrator/modules/mod_quickicon/index.html b/administrator/modules/mod_quickicon/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_quickicon/index.html +++ b/administrator/modules/mod_quickicon/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_stats/index.html b/administrator/modules/mod_stats/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_stats/index.html +++ b/administrator/modules/mod_stats/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_status/index.html b/administrator/modules/mod_status/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_status/index.html +++ b/administrator/modules/mod_status/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_status/mod_status.xml b/administrator/modules/mod_status/mod_status.xml index db0427c94f055..d84c3b3d11851 100644 --- a/administrator/modules/mod_status/mod_status.xml +++ b/administrator/modules/mod_status/mod_status.xml @@ -15,6 +15,6 @@ - + \ No newline at end of file diff --git a/administrator/modules/mod_submenu/index.html b/administrator/modules/mod_submenu/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_submenu/index.html +++ b/administrator/modules/mod_submenu/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_submenu/mod_submenu.php b/administrator/modules/mod_submenu/mod_submenu.php index 19f54d2497dd9..58ff8d75d0d8a 100644 --- a/administrator/modules/mod_submenu/mod_submenu.php +++ b/administrator/modules/mod_submenu/mod_submenu.php @@ -32,11 +32,10 @@ class JAdminSubMenu { function get() { - global $mainframe; // Lets get some variables we are going to need $menu = JToolBar::getInstance('submenu'); - $list = $menu->_bar; + $list = $menu->getItems(); if(!is_array($list) || !count($list)) { $option = JRequest::getCmd('option'); diff --git a/administrator/modules/mod_submenu/mod_submenu.xml b/administrator/modules/mod_submenu/mod_submenu.xml index aa26c710ee043..5769b6a52da5d 100644 --- a/administrator/modules/mod_submenu/mod_submenu.xml +++ b/administrator/modules/mod_submenu/mod_submenu.xml @@ -15,6 +15,6 @@ - + \ No newline at end of file diff --git a/administrator/modules/mod_title/index.html b/administrator/modules/mod_title/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_title/index.html +++ b/administrator/modules/mod_title/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_title/mod_title.xml b/administrator/modules/mod_title/mod_title.xml index 8830e9c320df0..d2d87c6b78969 100644 --- a/administrator/modules/mod_title/mod_title.xml +++ b/administrator/modules/mod_title/mod_title.xml @@ -15,6 +15,6 @@ - + \ No newline at end of file diff --git a/administrator/modules/mod_toolbar/index.html b/administrator/modules/mod_toolbar/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_toolbar/index.html +++ b/administrator/modules/mod_toolbar/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_toolbar/mod_toolbar.xml b/administrator/modules/mod_toolbar/mod_toolbar.xml index 50008b067aa39..7207910084421 100644 --- a/administrator/modules/mod_toolbar/mod_toolbar.xml +++ b/administrator/modules/mod_toolbar/mod_toolbar.xml @@ -15,6 +15,6 @@ - + \ No newline at end of file diff --git a/administrator/modules/mod_unread/index.html b/administrator/modules/mod_unread/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/modules/mod_unread/index.html +++ b/administrator/modules/mod_unread/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/modules/mod_unread/mod_unread.xml b/administrator/modules/mod_unread/mod_unread.xml index 66b1bd214668b..f09403572c13c 100644 --- a/administrator/modules/mod_unread/mod_unread.xml +++ b/administrator/modules/mod_unread/mod_unread.xml @@ -15,6 +15,6 @@ - + \ No newline at end of file diff --git a/administrator/templates/index.html b/administrator/templates/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/index.html +++ b/administrator/templates/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/khepri/css/component.css b/administrator/templates/khepri/css/component.css index ce69a4e9a9c33..27424e44bc0c5 100644 --- a/administrator/templates/khepri/css/component.css +++ b/administrator/templates/khepri/css/component.css @@ -12,7 +12,6 @@ /** * Joomla! 1.5 Admin template main css file * - * @author Andy Miller * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/templates/khepri/css/general.css b/administrator/templates/khepri/css/general.css index fcca2adbe68bf..b709d78ccebc1 100644 --- a/administrator/templates/khepri/css/general.css +++ b/administrator/templates/khepri/css/general.css @@ -12,7 +12,6 @@ /** * Joomla! 1.5 Admin template main css file * - * @author Andy Miller * @package Joomla * @since 1.5 * @version 1.0 @@ -73,6 +72,9 @@ legend { input, select { font-size: 10px; border: 1px solid silver; } textarea { font-size: 11px; border: 1px solid silver; } button { font-size: 10px; } + +.invalid { color: red; font-weight: bold; } +input.invalid { border: 1px solid red; } input.disabled { background-color: #F0F0F0; } diff --git a/administrator/templates/khepri/css/general_rtl.css b/administrator/templates/khepri/css/general_rtl.css index 998409fd08c77..442ad2a5aedfd 100644 --- a/administrator/templates/khepri/css/general_rtl.css +++ b/administrator/templates/khepri/css/general_rtl.css @@ -12,7 +12,6 @@ /** * Joomla! 1.5 Admin template main RTL css file * - * @author Mati Kochen * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/templates/khepri/css/index.html b/administrator/templates/khepri/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/khepri/css/index.html +++ b/administrator/templates/khepri/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/khepri/css/login.css b/administrator/templates/khepri/css/login.css index 2fc37f13876b4..ebd8e4172a8b1 100755 --- a/administrator/templates/khepri/css/login.css +++ b/administrator/templates/khepri/css/login.css @@ -12,7 +12,6 @@ /** * Joomla! 1.5 Admin template main css file * - * @author Andy Miller * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/templates/khepri/css/login_rtl.css b/administrator/templates/khepri/css/login_rtl.css index 6b2439301f7ed..2e05cd8ff0c56 100644 --- a/administrator/templates/khepri/css/login_rtl.css +++ b/administrator/templates/khepri/css/login_rtl.css @@ -12,7 +12,6 @@ /** * Joomla! 1.5 Admin template main css file * - * @author Mati Kochen * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/templates/khepri/css/menu.css b/administrator/templates/khepri/css/menu.css index 00183c3f925b1..54c7aa6efa4fb 100644 --- a/administrator/templates/khepri/css/menu.css +++ b/administrator/templates/khepri/css/menu.css @@ -12,7 +12,6 @@ /** * JMenu javascript behavior styling * - * @author Johan Janssens * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/templates/khepri/css/menu_rtl.css b/administrator/templates/khepri/css/menu_rtl.css index de0cb287a9845..42f496aafae94 100644 --- a/administrator/templates/khepri/css/menu_rtl.css +++ b/administrator/templates/khepri/css/menu_rtl.css @@ -12,7 +12,6 @@ /** * JMenu javascript behavior styling * - * @author Mati Kochen * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/templates/khepri/css/norounded.css b/administrator/templates/khepri/css/norounded.css index b966f604cc8d9..65549eaae454a 100644 --- a/administrator/templates/khepri/css/norounded.css +++ b/administrator/templates/khepri/css/norounded.css @@ -12,7 +12,6 @@ /** * Joomla! 1.5 Admin template non-rounded css file * - * @author Andy Miller * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/templates/khepri/css/template.css b/administrator/templates/khepri/css/template.css index 2a0b1fb56a75c..5a7873deffa9f 100755 --- a/administrator/templates/khepri/css/template.css +++ b/administrator/templates/khepri/css/template.css @@ -12,7 +12,6 @@ /** * Joomla! 1.5 Admin template main css file * - * @author Andy Miller * @package Joomla * @since 1.5 * @version 1.0 @@ -25,3 +24,5 @@ @import url("menu.css"); @import url("component.css"); +.invalid { color: red; font-weight: bold; } +input.invalid { border: 1px solid red; } diff --git a/administrator/templates/khepri/css/template_rtl.css b/administrator/templates/khepri/css/template_rtl.css index 96599e909cc46..3965e733d2fd6 100644 --- a/administrator/templates/khepri/css/template_rtl.css +++ b/administrator/templates/khepri/css/template_rtl.css @@ -12,7 +12,6 @@ /** * Joomla! 1.5 Admin template main css file * - * @author Mati Kochen * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/templates/khepri/html/index.html b/administrator/templates/khepri/html/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/khepri/html/index.html +++ b/administrator/templates/khepri/html/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/khepri/images/header/index.html b/administrator/templates/khepri/images/header/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/khepri/images/header/index.html +++ b/administrator/templates/khepri/images/header/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/khepri/images/index.html b/administrator/templates/khepri/images/index.html index fa6d84e8055f5..42682b4746225 100755 --- a/administrator/templates/khepri/images/index.html +++ b/administrator/templates/khepri/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/khepri/images/menu/index.html b/administrator/templates/khepri/images/menu/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/khepri/images/menu/index.html +++ b/administrator/templates/khepri/images/menu/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/khepri/images/toolbar/index.html b/administrator/templates/khepri/images/toolbar/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/khepri/images/toolbar/index.html +++ b/administrator/templates/khepri/images/toolbar/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/khepri/index.html b/administrator/templates/khepri/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/khepri/index.html +++ b/administrator/templates/khepri/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/khepri/js/index.html b/administrator/templates/khepri/js/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/khepri/js/index.html +++ b/administrator/templates/khepri/js/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/khepri/js/index.js b/administrator/templates/khepri/js/index.js index 8a1325010971e..e7186e34b1217 100644 --- a/administrator/templates/khepri/js/index.js +++ b/administrator/templates/khepri/js/index.js @@ -12,7 +12,6 @@ /** * Joomla! 1.5 Admininstrator index template behvaior * - * @author Johan Janssens * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/templates/khepri/js/menu.js b/administrator/templates/khepri/js/menu.js index 77ba0e027a72e..a993b5a446107 100644 --- a/administrator/templates/khepri/js/menu.js +++ b/administrator/templates/khepri/js/menu.js @@ -12,7 +12,6 @@ /** * JMenu javascript behavior * - * @author Johan Janssens * @package Joomla * @since 1.5 * @version 1.0 diff --git a/administrator/templates/khepri/login.php b/administrator/templates/khepri/login.php index e5341746d355b..70f52ec089ad5 100755 --- a/administrator/templates/khepri/login.php +++ b/administrator/templates/khepri/login.php @@ -11,6 +11,8 @@ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); + +$app = &JFactory::getApplication(); ?> @@ -49,7 +51,7 @@ function setFocus() {
    - params->get('showSiteName') ? $mainframe->getCfg( 'sitename' ) : JText::_('Administration'); ?> + params->get('showSiteName') ? $app->getCfg( 'sitename' ) : JText::_('Administration'); ?>
    diff --git a/administrator/templates/system/css/index.html b/administrator/templates/system/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/system/css/index.html +++ b/administrator/templates/system/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/system/error.php b/administrator/templates/system/error.php index 6f0a3f06b4e10..a091f27695751 100644 --- a/administrator/templates/system/error.php +++ b/administrator/templates/system/error.php @@ -22,14 +22,16 @@

    - error->code ?> - + error->get('code') ?> -

    -

    error->message ?>

    +

    error->get('message'); ?>

    debug) : + print_r($this->error->get('info')); + echo '


    '; echo $this->renderBacktrace(); endif; ?>

    @@ -37,4 +39,4 @@
    - \ No newline at end of file + diff --git a/administrator/templates/system/html/index.html b/administrator/templates/system/html/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/system/html/index.html +++ b/administrator/templates/system/html/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/system/images/index.html b/administrator/templates/system/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/system/images/index.html +++ b/administrator/templates/system/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/administrator/templates/system/index.html b/administrator/templates/system/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/administrator/templates/system/index.html +++ b/administrator/templates/system/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/cache/index.html b/cache/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/cache/index.html +++ b/cache/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_banners/banners.php b/components/com_banners/banners.php index 225518576d580..9824aa216861a 100644 --- a/components/com_banners/banners.php +++ b/components/com_banners/banners.php @@ -16,7 +16,7 @@ defined('_JEXEC') or die('Restricted access'); // Require the com_content helper library -require_once (JPATH_COMPONENT.DS.'controller.php'); +require_once JPATH_COMPONENT.DS.'controller.php'; // Create the controller $controller = new BannersController( array('default_task' => 'click') ); diff --git a/components/com_banners/index.html b/components/com_banners/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_banners/index.html +++ b/components/com_banners/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_banners/models/index.html b/components/com_banners/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_banners/models/index.html +++ b/components/com_banners/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_contact/contact.php b/components/com_contact/contact.php index 29f284e64b7da..d1d00d12f297f 100644 --- a/components/com_contact/contact.php +++ b/components/com_contact/contact.php @@ -17,7 +17,7 @@ jimport('joomla.application.component.helper'); -require_once(JPATH_COMPONENT.DS.'controller.php'); +require_once JPATH_COMPONENT.DS.'controller.php'; // Create the controller $controller = new ContactController(); diff --git a/components/com_contact/controller.php b/components/com_contact/controller.php index 5243cb652cc27..ef28bb1e364eb 100644 --- a/components/com_contact/controller.php +++ b/components/com_contact/controller.php @@ -37,20 +37,6 @@ function display() $viewName = JRequest::getVar('view', 'category', 'default', 'cmd'); $viewType = $document->getType(); - // interceptors to support legacy urls - switch ($this->getTask()) - { - //index.php?option=com_contact&task=category&id=0&Itemid=4 - case 'category': - $viewName = 'category'; - $layout = 'default'; - break; - case 'view': - $viewName = 'contact'; - $layout = 'default'; - break; - } - // Set the default view name from the Request $view = &$this->getView($viewName, $viewType); @@ -195,100 +181,6 @@ function submit() $this->setRedirect($link, $msg); } - /** - * Method to output a vCard - * - * @static - * @since 1.0 - */ - function vcard() - { - global $mainframe; - - // Initialize some variables - $db = & JFactory::getDBO(); - - $SiteName = $mainframe->getCfg('sitename'); - $contactId = JRequest::getVar('contact_id', 0, '', 'int'); - // Get a Contact table object and load the selected contact details - JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_contact'.DS.'tables'); - $contact =& JTable::getInstance('contact', 'Table'); - $contact->load($contactId); - - // Get the contact detail parameters - $pparams = &$mainframe->getParams('com_contact'); - - // Should we show the vcard? - if ($pparams->get('allow_vcard', 0)) - { - // Parse the contact name field and build the nam information for the vcard. - $firstname = null; - $middlename = null; - $surname = null; - - // How many parts do we have? - $parts = explode(' ', $contact->name); - $count = count($parts); - - switch ($count) { - case 1 : - // only a first name - $firstname = $parts[0]; - break; - - case 2 : - // first and last name - $firstname = $parts[0]; - $surname = $parts[1]; - break; - - default : - // we have full name info - $firstname = $parts[0]; - $surname = $parts[$count -1]; - for ($i = 1; $i < $count -1; $i ++) { - $middlename .= $parts[$i].' '; - } - break; - } - // quick cleanup for the middlename value - $middlename = trim($middlename); - - // Create a new vcard object and populate the fields - require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_contact'.DS.'helpers'.DS.'vcard.php'); - $v = new JvCard(); - - $v->setPhoneNumber($contact->telephone, 'PREF;WORK;VOICE'); - $v->setPhoneNumber($contact->fax, 'WORK;FAX'); - $v->setName($surname, $firstname, $middlename, ''); - $v->setAddress('', '', $contact->address, $contact->suburb, $contact->state, $contact->postcode, $contact->country, 'WORK;POSTAL'); - $v->setEmail($contact->email_to); - $v->setNote($contact->misc); - $v->setURL( JURI::base(), 'WORK'); - $v->setTitle($contact->con_position); - $v->setOrg($SiteName); - - $filename = str_replace(' ', '_', $contact->name); - $v->setFilename($filename); - - $output = $v->getVCard($SiteName); - $filename = $v->getFileName(); - - // Send vCard file headers - header('Content-Disposition: attachment; filename='.$filename); - header('Content-Length: '.strlen($output)); - header('Connection: close'); - header('Content-Type: text/x-vCard; name='.$filename); - header('Cache-Control: store, cache'); - header('Pragma: cache'); - - print $output; - } else { - JError::raiseWarning('SOME_ERROR_CODE', 'ContactController::vCard: '.JText::_('NOTAUTH')); - return false; - } - } - /** * Validates some inputs based on component configuration * @@ -306,13 +198,6 @@ function _validateInputs( $contact, $email, $subject, $body ) $session =& JFactory::getSession(); - /** - $model = $this->getModel('contact'); - $options['category_id'] = $contact->catid; - $options['order by'] = 'a.default_con DESC, a.ordering ASC'; - $contact = $model->getContact( $options ); - **/ - // Get params and component configurations $params = new JParameter($contact->params); $pparams = &$mainframe->getParams('com_contact'); @@ -333,15 +218,9 @@ function _validateInputs( $contact, $email, $subject, $body ) $bannedEmail = $configEmail . ($paramsEmail ? ';'.$paramsEmail : ''); // Prevent form submission if one of the banned text is discovered in the email field - if ( $bannedEmail ) { - $bannedEmail = explode( ';', $bannedEmail ); - foreach ($bannedEmail as $value) { - - if ( JString::stristr($email, $value) ) { - $this->setError( JText::sprintf('MESGHASBANNEDTEXT', 'Email') ); - return false; - } - } + if(false === $this->_checkText($email, $bannedEmail )) { + $this->setError( JText::sprintf('MESGHASBANNEDTEXT', 'Email') ); + return false; } // Determine banned subjects @@ -350,14 +229,9 @@ function _validateInputs( $contact, $email, $subject, $body ) $bannedSubject = $configSubject . ( $paramsSubject ? ';'.$paramsSubject : ''); // Prevent form submission if one of the banned text is discovered in the subject field - if ( $bannedSubject ) { - $bannedSubject = explode( ';', $bannedSubject ); - foreach ($bannedSubject as $value) { - if ( JString::stristr($subject, $value) ) { - $this->setError( JText::sprintf('MESGHASBANNEDTEXT', 'Subject') ); - return false; - } - } + if(false === $this->_checkText($subject, $bannedSubject)) { + $this->setError( JText::sprintf('MESGHASBANNEDTEXT', 'Subject') ); + return false; } // Determine banned Text @@ -366,14 +240,9 @@ function _validateInputs( $contact, $email, $subject, $body ) $bannedText = $configText . ( $paramsText ? ';'.$paramsText : '' ); // Prevent form submission if one of the banned text is discovered in the text field - if ( $bannedText ) { - $bannedText = explode( ';', $bannedText ); - foreach ($bannedText as $value) { - if ( JString::stristr($body, $value) ) { - $this->setError( JText::sprintf('MESGHASBANNEDTEXT', 'Message') ); - return false; - } - } + if(false === $this->_checkText( $body, $bannedText )) { + $this->setError( JText::sprintf('MESGHASBANNEDTEXT', 'Message') ); + return false; } // test to ensure that only one email address is entered @@ -385,4 +254,29 @@ function _validateInputs( $contact, $email, $subject, $body ) return true; } + + /** + * Checks $text for values contained in the array $array, and sets error message if true... + * + * @param String $text Text to search against + * @param String $list semicolon (;) seperated list of banned values + * @return Boolean + * @access protected + * @since 1.5.4 + */ + function _checkText($text, $list) { + if(empty($list) || empty($text)) return true; + $array = explode(';', $list); + foreach ($array as $value) { + $value = trim($value); + if(empty($value)) continue; + if ( JString::stristr($text, $value) !== false ) { + return false; + } + } + return true; + } + + + } \ No newline at end of file diff --git a/components/com_contact/index.html b/components/com_contact/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_contact/index.html +++ b/components/com_contact/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_contact/models/index.html b/components/com_contact/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_contact/models/index.html +++ b/components/com_contact/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_contact/router.php b/components/com_contact/router.php index 5f1c17253ea3c..43e7a06960bec 100644 --- a/components/com_contact/router.php +++ b/components/com_contact/router.php @@ -102,43 +102,33 @@ function ContactBuildRoute(&$query) // Check if the router found an appropriate itemid. if (!$itemid) { - // Check if a id was specified. - if (isset($query['id'])) + // Check if a catid was specified. + if (isset($query['catid'])) { - if (isset($query['alias'])) { - $query['id'] .= ':'.$query['alias']; + if (isset($query['catalias'])) { + $query['catid'] .= ':'.$query['catalias']; } - // Push the id onto the stack. - $segments[] = $query['id']; + $segments[] = $query['catid']; unset($query['view']); - unset($query['id']); - unset($query['alias']); + unset($query['catid']); + unset($query['catalias']); } - elseif (isset($query['catid'])) + + // Check if a id was specified. + if (isset($query['id'])) { - if (isset($query['catalias'])) { - $query['catid'] .= ':'.$query['catalias']; - } - if (isset($query['alias'])) { $query['id'] .= ':'.$query['alias']; } - // Push the catid onto the stack. - $segments[] = 'category'; - $segments[] = $query['catid']; - // Push the id onto the stack. $segments[] = $query['id']; - // Remove the unnecessary URL segments. unset($query['view']); unset($query['id']); unset($query['alias']); - unset($query['catid']); - unset($query['catalias']); } } else diff --git a/components/com_contact/views/category/index.html b/components/com_contact/views/category/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_contact/views/category/index.html +++ b/components/com_contact/views/category/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_contact/views/category/tmpl/default.php b/components/com_contact/views/category/tmpl/default.php index be846488977bc..a067fd273449a 100644 --- a/components/com_contact/views/category/tmpl/default.php +++ b/components/com_contact/views/category/tmpl/default.php @@ -7,13 +7,9 @@ $cparams =& JComponentHelper::getParams('com_media'); ?> -params->get( 'show_page_title' ) ) : ?> +params->get( 'show_page_title', 1 ) ) : ?>
    -category->title) : - echo $this->escape($this->params->get('page_title')).' - '.$this->escape($this->category->title); -else : - echo $this->escape($this->params->get('page_title')); -endif; ?> +escape($this->params->get('page_title')); ?>
    diff --git a/components/com_contact/views/category/tmpl/default_items.php b/components/com_contact/views/category/tmpl/default_items.php index bbe6467227cbb..49b3166a784f0 100644 --- a/components/com_contact/views/category/tmpl/default_items.php +++ b/components/com_contact/views/category/tmpl/default_items.php @@ -8,7 +8,7 @@ count +1; ?>
    - + name; ?>
    @@ -67,7 +67,7 @@ diff --git a/components/com_contact/views/contact/tmpl/index.html b/components/com_contact/views/contact/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_contact/views/contact/tmpl/index.html +++ b/components/com_contact/views/contact/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_contact/views/contact/view.html.php b/components/com_contact/views/contact/view.html.php index d964b7d8128af..e75547bff2c5c 100644 --- a/components/com_contact/views/contact/view.html.php +++ b/components/com_contact/views/contact/view.html.php @@ -34,7 +34,7 @@ function display($tpl = null) // Get the parameters of the active menu item $menus = &JSite::getMenu(); - $menu = $menus->getActive(); + $menu = $menus->getActive(); $pparams = &$mainframe->getParams('com_contact'); @@ -66,7 +66,17 @@ function display($tpl = null) $contacts = $modelCat->getContacts( $options ); // Set the document page title - $document->setTitle(JText::_('Contact').' - '.$contact->name); + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu ) && isset($menu->query['view']) && $menu->query['view'] == 'contact' && isset($menu->query['id']) && $menu->query['id'] == $contact->id) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $pparams->set('page_title', $contact->name); + } + } else { + $pparams->set('page_title', $contact->name); + } + $document->setTitle( $pparams->get( 'page_title' ) ); //set breadcrumbs if (isset( $menu ) && isset($menu->query['view']) && $menu->query['view'] != 'contact'){ diff --git a/components/com_contact/views/contact/view.vcard.php b/components/com_contact/views/contact/view.vcard.php new file mode 100644 index 0000000000000..5a9138fde04f0 --- /dev/null +++ b/components/com_contact/views/contact/view.vcard.php @@ -0,0 +1,101 @@ +getCfg('sitename'); + $contactId = JRequest::getVar('contact_id', 0, '', 'int'); + + // Get a Contact table object and load the selected contact details + JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_contact'.DS.'tables'); + $contact =& JTable::getInstance('contact', 'Table'); + $contact->load($contactId); + + // Get the contact detail parameters + $pparams = &$mainframe->getParams('com_contact'); + + // Should we show the vcard? + if (!$pparams->get('allow_vcard', 0)) { + JError::raiseWarning('SOME_ERROR_CODE', 'ContactController::vCard: '.JText::_('NOTAUTH')); + return false; + } + + // Parse the contact name field and build the nam information for the vcard. + $firstname = null; + $middlename = null; + $surname = null; + + // How many parts do we have? + $parts = explode(' ', $contact->name); + $count = count($parts); + + switch ($count) + { + case 1 : + // only a first name + $firstname = $parts[0]; + break; + + case 2 : + // first and last name + $firstname = $parts[0]; + $surname = $parts[1]; + break; + + default : + // we have full name info + $firstname = $parts[0]; + $surname = $parts[$count -1]; + for ($i = 1; $i < $count -1; $i ++) { + $middlename .= $parts[$i].' '; + } + break; + } + + // quick cleanup for the middlename value + $middlename = trim($middlename); + + $document = &JFactory::getDocument(); + + $document->setPhoneNumber($contact->telephone, 'PREF;WORK;VOICE'); + $document->setPhoneNumber($contact->fax, 'WORK;FAX'); + $document->setName($surname, $firstname, $middlename, ''); + $document->setAddress('', '', $contact->address, $contact->suburb, $contact->state, $contact->postcode, $contact->country, 'WORK;POSTAL'); + $document->setEmail($contact->email_to); + $document->setNote($contact->misc); + $document->setURL( JURI::base(), 'WORK'); + $document->setTitle($contact->con_position); + $document->setOrg($SiteName); + + $filename = str_replace(' ', '_', $contact->name); + + $document->setFilename($filename); + } +} \ No newline at end of file diff --git a/components/com_contact/views/index.html b/components/com_contact/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_contact/views/index.html +++ b/components/com_contact/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_contactdirectory/contactdirectory.php b/components/com_contactdirectory/contactdirectory.php new file mode 100755 index 0000000000000..af91504c97f4a --- /dev/null +++ b/components/com_contactdirectory/contactdirectory.php @@ -0,0 +1,16 @@ +execute(JRequest::getVar('task', null, 'default', 'cmd')); + +// Redirect if set by the controller +$controller->redirect(); diff --git a/components/com_contactdirectory/controller.php b/components/com_contactdirectory/controller.php new file mode 100755 index 0000000000000..32b3145b42b5e --- /dev/null +++ b/components/com_contactdirectory/controller.php @@ -0,0 +1,85 @@ +getType(); + + $view = &$this->getView($viewName, $viewType); + + $model = &$this->getModel( $viewName ); + if (!JError::isError( $model )) { + $view->setModel( $model, true ); + } + + $view->assign('error', $this->getError()); + $view->display(); + } + + /** + * Method to send an email to a contact + * + * @static + * @since 1.0 + */ + function submit(){ + global $mainframe; + + JRequest::checkToken() or die( 'Invalid Token' ); + $user = &JFactory::getUser(); + $model =& $this->getModel('contact'); + + if($model->mailTo($user)) { + $msg = JText::_( 'THANK_MESSAGE'); + $contact = $model->getData($user->get('aid', 0)); + $mainframe->enqueueMessage($msg, "message"); + $this->display(); + //$link = JRoute::_('index.php?option=com_contactdirectory&view=contact&id='.$contact->slug, false); + //$this->setRedirect($link, $msg); + } else { + $this->setError($model->getError()); + $this->display(); + } + } + + /** + * Get the captcha image from securimage library + */ + function captcha() + { + require_once JPATH_COMPONENT . DS . 'includes' . DS . 'securimage' . DS . 'securimage.php'; + @ob_end_clean(); + $img = new securimage(); + $img->draw_lines = false; + $img->arc_linethrough = false; + $img->use_transparent_text = true; + $img->text_transparency_percentage = 40; + $img->text_color = '#0000ff'; + $img->use_multi_text = false; + $img->font_size = 40; + $img->bgimg = JPATH_COMPONENT . DS . 'includes' . DS . 'securimage' . DS . 'images' . DS . 'pattern.gif'; + $img->ttf_file = JPATH_COMPONENT . DS . 'includes' . DS . 'securimage' . DS . 'artistamp.ttf'; + $img->image_width = 150; + $img->show(); + } +} diff --git a/components/com_contactdirectory/css/contactdirectory.css b/components/com_contactdirectory/css/contactdirectory.css new file mode 100755 index 0000000000000..b5d2316e99002 --- /dev/null +++ b/components/com_contactdirectory/css/contactdirectory.css @@ -0,0 +1,29 @@ +.directorybox{ + border: 1px solid #dddddd; + margin-top: 15px; + margin-bottom: 15px; +} + +.directorytitle{ + background: #eeeeee; + border-bottom: 1px solid #dddddd; + padding: 10px; +} + +.directoryinfo{ + padding: 10px; +} + +.directorycategory{ + font-size: 22px; + border-bottom: 2px dotted #999999; + padding: 5px; +} + +.error{ + color: #ff0000; + background: #ffeeee; + padding: 5px; + margin: 10px 0 10px 0; +} +s \ No newline at end of file diff --git a/components/com_contactdirectory/css/index.html b/components/com_contactdirectory/css/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/css/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_contactdirectory/includes/index.html b/components/com_contactdirectory/includes/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/includes/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/includes/phpmailer/LICENSE b/components/com_contactdirectory/includes/securimage/LICENSE.txt similarity index 92% rename from includes/phpmailer/LICENSE rename to components/com_contactdirectory/includes/securimage/LICENSE.txt index f3f1b3b65e1b3..9a749e68550b0 100644 --- a/includes/phpmailer/LICENSE +++ b/components/com_contactdirectory/includes/securimage/LICENSE.txt @@ -55,7 +55,7 @@ modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - + Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a @@ -111,7 +111,7 @@ modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - + 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an @@ -158,7 +158,7 @@ Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 @@ -216,7 +216,7 @@ instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -267,7 +267,7 @@ Library will still fall under Section 6.) distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -329,7 +329,7 @@ restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -370,7 +370,7 @@ subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -422,7 +422,7 @@ conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -456,49 +456,3 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/components/com_contactdirectory/includes/securimage/README.txt b/components/com_contactdirectory/includes/securimage/README.txt new file mode 100644 index 0000000000000..9711d57d93e68 --- /dev/null +++ b/components/com_contactdirectory/includes/securimage/README.txt @@ -0,0 +1,57 @@ +NAME: + + Securimage - A PHP class for creating and managing form CAPTCHA images + +VERSION: 1.0.2 + +AUTHOR: + + Drew Phillips + +DOWNLOAD: + + The latest version can always be + found at http://www.phpcaptcha.org + +DOCUMENTATION: + + Online documentation of the class, methods, and variables can + be found at http://www.phpcaptcha.org/Securimage_Docs/ + +REQUIREMENTS: + PHP 4.3.0 + GD 2.0 + FreeType (optional, required for TTF support) + +SYNOPSIS: + + require_once 'securimage.php'; + + $image = new Securimage(); + + $image->show(); + + // Code Validation + + $image = new Securimage(); + if ($image->check($_POST['code']) == true) { + echo "Correct!"; + } else { + echo "Sorry, wrong code."; + } + +DESCRIPTION: + + What is Securimage? + + Securimage is a PHP class that is used to generate and validate CAPTCHA images. + The classes uses an existing PHP session or creates its own if none is found to store the + CAPTCHA code. Variables within the class are used to control the style and display of the image. + The class supports TTF fonts and effects for strengthening the security of the image. + If TTF support is not available, GD fonts can be used as well, but certain options such as + transparent text and angled letters cannot be used. + + +COPYRIGHT: + Copyright (c) 2007 Drew Phillips. All rights reserved. + This software is released under the GNU Lesser General Public License. diff --git a/components/com_contactdirectory/includes/securimage/artistamp.ttf b/components/com_contactdirectory/includes/securimage/artistamp.ttf new file mode 100644 index 0000000000000000000000000000000000000000..857c1c96f471519c498ded3131426e71dac768b5 GIT binary patch literal 163812 zcmb@v2b^7Hwf?`~-OJf~pR&){bEeOnnK_d(y_|$3WI{jR0 z6%ml4B3+Osy{TYBLF6iSxz_8It5+{d^82nm33AK-7C-+vIc=YJzx&;9S?gKPTI-Fb zG);@NVa?F)UcUd(=-Kvr->2zkHgR;>s&y+je)P+K`hljeKU~v{`&ON_rE}E>)E$~; z-Olr+V>ceR?(DIrmh<^zluwRZd+M>g^OrL<{m|hx$E-W$uS*JTn!YKoX`#Dj^~z&@ zTs|PA{xuYuT*CoBZ-15VH}Jh@&AKh8TytnLPt%WI%k{?BZdkQab=~=hrXM@b_c`lU zp0d%HUven_4COo5uUxnK*dw-ieEyB5nV;LZVe^*RH_ZBjrmv+w^~lCet2Y`)R}Rp$ z-~*I7hi6&oyk>vuaP7_=AGJ=sdHZKwi}Xd?KO5TNI(M7>nUpzd`)5mAY7A}vY-{bt z1)B7t{7H?|pOu!^{q3K1&Cz$-{@Kt5^)t7BHYu}w`)5n*GraAeZ7nuVXGE0Ay=Cp3 z{;aZgPJf2^+k&f2+X#Q}Tnf54)B_U&A?Vco_Px2)dOdF+Pu zTQ+x|G&(rkd28p$+_`gSca9DZk9Y2|a?^&j$8;{;ux34_Zt2`(`qR|P4QmHEnIk8k zeDdI$tkmYLlI(EjE-N>$KBjZS`p%V|n^$k?+;D8?Nyo3>vhujqotsWP`e>@!yk+IO zjhhEMI~Q-*v~KmLwWoHjTDf*D=PW*P?H0~kv}w!nS(!m?k+woRK-*K>pVvj&KH9!o zr?yJlpsmw3YA0%2wAI=sjvUL8^?cjR=aaNiZIIdAsolzRM4OvEX7hQJqr=)bpZ3sJ za^41Qt#%CGmhx#0=Vx_wc4xo8^Vk%nrR?DLD|cpPPS)fx$eDkuYx6r=@^)$J+l4Zl zsb8)pE$!rcXLe*ucH~%IPtuOh?qQ{N93?wx--+7MJf`n(Gk3Q#yX(zdvy;bSYTCpR z`F*W+Do0jPVl9v9>n!H{wVXA5y+xGT!WI5j&*0m=+_}%{V~#&@9sTI!YKitlL-;$A$p^>qn;c+_P z?{C2fZ5iS@#w!!=?Y{c|?C*Ei*qt4aZ)lbyjYPR~4x<|W9tEmsEgU>XVO`K!Ad_>O&S6vz&{n^FE ztz#E`uXV{^U%31c>yX>dT7R*A(svJ;|Hx@C{^pS9&szIH>#p}c^`1Rj+y@^%YTsXf zbL_oKlIK4&?(g@{|9sJgWqUpGms?L5^)C7S_nr)rRR^7Y(C3f)z&)>C*#GVIM-+1R z{UM#2?0)6WrO^{zcYnL*kn}V&-2b)1_Bi{++aKJu@yfSO znE%uvkG*o}s;~WG?bioZzE)lE%*NyY+`8(EN3Lq@deXy-F1q&Rf3o(Q=z8@t>Xi8qcwtlXjrkXzTXnSl=12db<%lnS`Pz9u*Lx2+<0D6&_xeHa zyMOT2NB7%SVfdHI3Ay8flBw;Wjg<5|7-UR&S1 zX5()Az3}UMM_N|DzxKOl&#CR!^5Z{Udvszwa9`7wMsm|L-d;QR-FnON(p}GgWWg`Z zxrb?&t+?{1t2g{;`K{ZgF8!T(!c_-!y!rI(+Q*Gwyl-^r(LV{UxVdfDJHE62kQt}8 z93rx9r@ndaoArHEH;3Q*q*b_U=SBDZe*ZJyjIX$| za^g?kHSe5tANj@c8@9F`e`Q?%-8t8vGF-gt`SNZ%&A#KVz03E`{Qmb3UH`{luKVD! zC+@0Ub=nUOKjY`0TKrPW$zOO^+n;`Q>~W=EKK}K0pHwW}|L}23fBlvFHXhb~@uQE< zUUcWi>lgp>s@gB#GrM>BOMh&Axqr()G@W$Tr|qw7JN=s9@Al2-*W7!5%j@sI;h%On z=Z4+RdU5|-pIdO+XQSoU-d+3Qi_1^{r<-2>?P=%!#=h{4EsI(vuKCjV)SYj}w{5uQ zpr2nq@#xZ(Z>5{=Z*IDOa?z)MuwvPtztDN<{wMsY{Fz&NI{)y(HOK9hy!C*-Wb7no z*+Cz>^_k!8b;-hsbFaMTfw6b}@act1_FeeIE$gk@{3qY&`2Lx5=MLWXtY>xhy!!H{ zEx-K9$1XU{FaPzE>vz&`xqP3=Z6AB#Px_35%irGV{@eSOy!>w`zk1`rPq%J*{KwW; z7OcH1IO6l)*>BTBO;5bF<+4iC`RCPVJn+QhYExU&eKWRg{PKzxyfB{!(L3@uUU6 z{_a8G)xX~L@y?N3?zNpY2OWCbS?Aw=^ikE{K6%)QJ5^sk%U!G|{Gi%)?(S=L`@8?$YZ{BSS@+r&ulE=R_1t4wylT3(koxa8&H-~e+JRFY%5|qa z-7!t2*_LVOmT7B_Z7W>?Cbh*U4Ko+6=Dw1^r>o)_koG zRP}!C6WZsr&#U=Um#KU2ow~1n&mEt;^)t8J{Hg1&yXwj-F2C%fA35XH_ndIlk^8UM zZ~3yF=g+I=5ciwj6wV$};oU`BmzSBv=f!OWct<@E?hVycg-zx`*Q1Y_wzqA7(EmHHF{>pd-RMN{Cobi z|LsZJyZaLD-gkEQz0%#KWR{v}RMPH=(OA{{CPv2V!xQ6;`s73J#Z$gAbF_FX=+P-sl@rF6=8 zozqp4#FlSaR_yyq8HVGlz(3xXBUa+ufl|y#%QE$1qLirujI9@Sp7-JEadYu)|L zir#dnzA0~Y&_LhkMme>{Cq8SMr#b3I)v7O zlVhWmGJT(p(dEuKvtfKlIZ0X>E6X6%85CzYU8opa3dd?lHJBK@*1MfXLMxacHK$x_ z)FvBFeVjs6NDYiGSE$L@r>eD0_k6uR*Qk_v zlUXhcN~S$O*?qN!bWVfS((UjA$NK8yjXsC%%jHI8vTnXS-?`^2T!9a%B{M=js8b>DP6%MVOz zv6u4_!w$m0J0mDrc3uUZeVkEf?+$IxwRPLFS=YW@vX$}!bcN~a1-;hgcDlA_<;;d+ z?A^c)%Z0BYcYI5!$aD=mFVjgyUe4}A^IdA%*lOnPB&@r^N7mk zZrhC8S!=QK%YH3Jgyzkr5vSGF^|-xbVe~~i;8!R1Do(d=RV_Ukvn9c?FX-Y?;pPNtrx%k z{Fk5j;)D0yedq0;`^={=yx{$(9Jv3!%a`pv*6!G^egD;0zV(e4zVf9fAN}I}_kRAK zyY9H{mYZ+9;rgpC{qWgmec;UZopIc;N4)Fc6?-mOyz4Gg^XD<`M~7$4=&5xl#aR2! zD~_q_=1b<_(JReOo6L`Y{PK?)`BmAAKt|mRanwoF`bxcIs3{61&`?#?Z|itYmVD;ovip zo>n1N8qx&O?3{s+N&7@}j8BZ$MCu?n5EmkeGTm=;2yuiUavJIcyVM_sf#1>WnX1s{ zBrW~B+GcldmKk~lJ93q8m~pYCR57C7em!=YoBjOErjp6>597dY9uJ)yxYM+~_L-fI z<8(xR=yoTa6G_k&d&rSev(3Wxyu<9Ur|p{n2&9gm7eSIZNxjq+hT(}}Xxm{p)3lMQ zzV9NlTEA9u!ryyIu9%>i^jw(Nt*~h5uXpX#HYe1}PH3lQ&W$>wP*=Om=m2?yeoqiN zUZunWtfWzUukYuJNUYLWIO3O$Mxz4-)$4^;chsWCA<7E*Ju7s=ox;#DJB@I776+XU z+ticUvzv;c;~92bvce<@lg_YcSL}M&GhF?C;2JFo!PtTTv|>6hX9aXcX@7SI90hnby&KG)}K)>>Z-iw~Ls>V<>^5|*ORgeBj599_^RleExM=I%B5mC;i%{P<#Jb5_th@>Sc-8#ig`w}?o+H- zpFZeSc9c?ES!q^GM>RJq(@}LJr|6nODKV@zgVq~^j$!p%Mth%1W*UZN2C7!T2f?n25R(#IMgZA42$azQinsuzAxFh7gbGcF+6+!@2 zTn`2UM!@LLap#4y)v<(O9b_1`{=y0AO*^PMeps2I3_!Hw#6jNAxzYf~Ym>%XKCN$R z<+rfKP>eD|m$OXItQa{b#E`bSV$1098FkDTds)sYnf~Xc;XOr$!0QTh(@qLj>iT9I zQ_S-`X{X`l{fbUQJwNKq8d^FkcEWGac=fr0Z&!;YYahqxbV}U1+0@k3lAk_U?{8ow zRF~_ilqwaieUzhjIsg;TtTv5GDGv768#&)>UT%oLvZ#&gC+Kfz{n+IfYnQ7JtE<%Y z>K1jcdPV(I{X+d-{VP%}({(7sy4bRfx?M)N)iGH`mW&|<($TRL8BnQ%+_!5_G$_j! zyA=$KjNp^g%?sxu;6y-nV?1H5B8*Va!&Jzcrx54!o|#P(lOiD-h`~m?!r-kq2-U{u z^ed{D;z(6aVaZc4r6!(I1o?__g=i^*)}_73AoNWHrla|_J|qt1GBGDwA1Nz}da^N* z$z%~}v=AN5JGvMZh%GN|o(2-qnlew3rE<}}IyM_9pplM>kdy|M!6Fzc6O$9eS)WZv zjamC9L=w`vzB=Et+mmWDsmYlgsxrAyr8PRC0gz~jJZLmUz|dCy-K>?V4WRGLtyA zM6mdQb#x}FpK+|faYIE<+5QUb5izFxe2FI}7NXVi>3APg-#NgEyvQ{fB?Boz9UF_f zXS-eMC@auC^*n;ui4n^&vF0C?JIbRD znsj7Y8is}=!|yv$mA1Rc7~8^}GNYnU0*O`X_xt^zz1U0bk!#yg6jy`GfrFS;K`ys- z+|vyoZ3<0*<H>HIM-rWqs%^^`^&X(p-@#Q;bK(N zk+x_1kx?nAb~%k%%5-9+5{x*x_o?XoZuy3wy&C`=T- zIlQs>xUKSrnX?Ph_Nwn-P}003b57CnuRu}*nHgl$x{x_wF@%199F=vM&UA*fz;=8r zY_I4V$HcJ{MKpAa=!&BqmP#C#;%?MA;Tu|?dQrPXe?SZITaIY!re>+p(Wxt&@7s;A?S_`8jlR>+8l9#? zk#4mej1_WknyYd|a*Si>AeKZ>iZr*u_aLxK;zAg@eTyTQg~-X6Cpyf4c=H`sp@x-= zC5AV`K)XJ*QF4Zo+@PZGY`+@hJ42OOEnpH;~dBov|?!DL4LI^JXqVvx? z=d3eMKlQ}T8%}svMuG3Mc=uhVc3v>2F{9d~?PMl}Gv9yo%C=Ujj>Jkd9K%Qn6e>z9olF;G)+zRkld42-wYzeDQ1*ist5j*x?GoY}fm|vS zfP#5a&YII~>Wzcgt!r9g*bFjgU*G>tgf)pP2Su z3^em#tY@Gym?yp!(5|?uLVeJ27Wy+Dcu2s2vG! z>Cc1X5y25MUHmNV%sJOsnnk;OK)X!)xON@9=I6B6r`D+3ZkxJY``j%zUU%&$K7Q3@ zAHC?qA3E>cv(Gr?r1!2n;kaY>U$O79J(eV;TR(l%4cCA2>MJh4@PZG1;QgnavSq`2 zjz4zw%6A`is9@CB` zoX-DG)9Zgc@ZZh9?Bwl}a4+q)cTU3FWD+V{93IRrU=A;_V(MTE@|b`pVM2;=%U9;) zq?nI=0_FfB4eT-DMP%m611vd?6GhWA>|XV%v6O#f#8&Rihj)**a7dH#cj&>P?U_HumA0% zy1e+IJuN?Nu>&{k?5vwfzC{)EQk;+65kJ2m@7Pt}f=KC1!uc`ZQ1@n8wdMVM5ES)V zE*F|s9D!%X7lz+R8KaO5th45Px1PUz;2u0WN`nZE*JrIiW@{uZGbV6LC6#NSb;D{V95~y$O25qxC$t?JlTM?o1PU; zUmYkvq+>-mTosT!A=3?bU84^9iMcfa1y3!bf~+UReO8;0lC&`$13p9HGr4$?YgI5k zn0XDEe=rZJ4Y00Zo`{72K;|O+_O^b@rc`~q!>2>R_)$IgqJ|Qy%qX{m5^QFKQU_R3 z06YL>qN^AMW!nZI7khtN;Xybf@PZNwFCPH<_y?2#e+U4vyt1SFRj=$8BcLqfWFtN0 zx7Z1c*vW?;AZ?!s$M*2e3@t0j$w2N{;0Tl*o-Spz?!5P?09r+(#7)NO{Lz-!HcSDi zc##|kgW@01gDX zi%xxjn*B1@Q3aJ?BKURzcr&fN6T~@CShRPH@=mY>=r39=_s&1sY3GHGtK>r#AMLf= z90jvqFsTjhv8&w~Zb{0^(fzU2wW}Bpm08knQD&*upw69<;*SyewQsP}YR*x%Nn3`1<4 zLX%hutdDP~kLWA3_h`3F?V;ALom!_M;#VJY^t+E-G_`Q&xo~^Kg9Ec>^!u)D9(vFL z%l6rOuRV9`ulIJgx57o^HP>?Q8qF=t>DS}Yw+FG$-=Vr~! zwP;mM#cu<`3}F8!c%6;r+oQLAtYU4~caGJrGFA-{NC-(tl5BX!1=Cd;a3u_12KO@W zf{e--2EDKc4MGNxghH!`22O8w6!t5|XR&}281pbLLZSJ1+p#nP-$S3IN(_&H4#bl5 zY>TD8K5QUMnu53*Tlv8C%6hp4oz~&z;?M?8Q?`3kddV!hEp{u9okjg;}FiB)q z#s;0FBBhzyEUis@oY>C_;jjI~haNrEgKukUNE?_{uXVImQ(euTfr-`CoL0&n=&WF) zBDatI(0_1)z2nxl54fidzVp5YvjG=&Be248jGUhwk0?vVdMmj?6V4w!1kEIjIwo+hsUS%6P_DUVp3XyDdp#AE4WImy-rI^QL7^GJSB?ta*9gsUDIfzSo>2&i<&$ zE~g2A=x2rGpgn8Wd?8>DA)i5;$zr)xe;k|jFzwwe&oQ;TI#?Z{E>jTybma1|RZ69|}V{EL~TnHAVqhjtuPA`cqf2xP%sbO1uUPtdnaBp#_q=XN!Qs2Ah| zz{2l2jb||Ez(`sALO0+X7B!<0@gNBXN*h$4(TXBhz|)z0snxUNnNQ2X8( z2_p-VXX@}2oCu7k7FvQdODTgjiBi}ekdeWBu}j++SaE-fmxi+N#$wlU2cl_&L6EjM z@?m_kp1DUG6L8VO9*e^lyB5qRcS;l$N(lGT@V~cQ|FgZo?TaltQE%9N@WR-=EIm1i znxyG+v$39CwgDQY6DPCINGD~THin(QS-~B+j%i3*a)uQ8l*T%h8g4G`#8I~jEiRnjBHF|4a3h^6=QceIWIM_v|WjdA<$105TjU=*R{!|=dLczhp zzX5SUUGSAKVpc@#7QPF)XRQ4^&MV(GDma;ZH?-WXKMURHZR>u501*mW5nWNT+yOE6 zcZIEjJ_BL`qD^t10NZke!9W6tVG~P`5!M$f-3T1)D}bq=_k+^gBtdfkmlpq&+seV6 z8AZXo;A32KN0thDV$gp>q0v-u^d1-dXLvpy8?Y)d9Z8>U5DG{4^$uYj5us+aFWs|X zcT~;6Ar(Y^9(Hg{kKO$|ynj5BXf1@{i-gcv>!mvbKeTBR{H%wN;3!Wl0)zgGy|R?3 z+7f9M0Dnt47ej$M;2HBSOnBaJ!rp6gX5y1AB_`yGrSfKhuo9|Nd1~~mqUq*xX)zqm zg#p1SF1N=SRm(3I(-x&C9YEh8%14FBZBAl34ZDOUSfOE6#ZOPn+UY zI>xl|82X-BiioUv2LrMjb|ZRXhut`k8J2q!Nub11uxysIAGtbwZo$Difl{&Z;^u;C zHf=wzGZ`&=Z!-yk%HLR&*$JjJcXo-bn#|)n+lpsL#0Le5@`YdN(b^#YUm!^pJ{(qGxYQ8;wIBc3)mL72>4hKs!0D%*eBze1?>T1Gkq3^C4H7*8?YM30oB#IbfBC0h{^*CV zefPyLJ^Rel58r?HXRrI@RUf_Rg7ZIo=KJ4w#;K=dRL#+c?7!b$qa*bmkX}pd+;+Qj z&rwGndDN3nIR_o=9(ce32R`($yZ2su?Y+<5yBG_iJAeQ3!Nx(xytj_J)3{w}#vQ-D z_ogfHb9BG{$frJW;bF!(2Q1xV@f5_4x7&y{YpNiVTjRev_@L4UA5<1kkEhQw$1~=c=h@A(m*)(gGY8)RfBvhg{^w&4 zDuaqlo*~bOXN70Vv&yrXX9v$No^s(D&*=*TwjNTmwYr2+$7cGqW0ns>^gQ`is+r;o(|XAlP*ce5Vwxq!Tx@sD0HOq;Awa5d<>=VrZXkc#uVJHE50g_2-l+&QIka5Hwh)TsZH(yV5r#$B5 zY!BBy{ury~5n`acJnk`t3qO}DpiRUCLPc5yU362<6_*pf8^c7cXf;`N7QOWK0icvu5t!EYd zvV}LY5`-;&*^ZI`u7Z{mYFV~&DNKg2NW_qI;w=qOu_zD0?~t*$MWYkG4ub^Yg?2Xc@ve4g zIy!pLZbDB)hFK`(Byt7Wg{?#Ym>I;F$IvfE3HVHy25wuhb^*vaF;U&KJg09+M-$bLj6>SV?Jt%{>Tyu9t;P zrPL@9P=*kud>SX2pw91;(5qC=txOIPmz~{{I@!m$76srwhDv6R>i2Brw#BmwqtMzf$U z%9af3kt(bNXNpv&Pgs7b)v(gu2$$nbsiKKsW|wq=CT|9uPHQP7SeLkg-j;!<8!tthkuGul(u76@`2oENLn&;zlSU`UlkNHE~j&=0YIIM{962xx};h}-dy zi(j21U@YUnX)e_as_q` zbO~n{RE|_r9iUP~W10AT8efw0;u z?;*%J91DST6=EI8=1^hLjmVsmi1V#Kl57n;wV~6K4O6>I_CVJD)PbR;>xw?;twr4=)(%eL55u}kWcpOw!M=@*_N>=cq}rbU+~6c zDvmkflxzp_g_socS)wHoNQgl(qM;Gf?K}Z8h<`8+kS%4QdO-nWnaBgu3`+8Q!5~)B;s&Hf^WGo)It)ZL75Q_zCuowttMjfPK`vU+Q;MwA~bSmV>1(vqaO`yAnaik!KhXwfjUNB zKd;K1)^%1QM*d^;`M&KKfzEj$27F|Co zyOwE&X6x+cQbjz~aWPk{gVDT#<@9nd`8X^leoGPoub{{RD_IfefG5g7f$WmDoE4uO z6YvN)-1;lv7z6h(b{YcSb0Q>2stu}}^grWi-@vXT-_pLT{S|Mdqb{2IjN1CozkN+? zz?WZo@te;+^W+ncJ^awUpa0ygH(Y<+C$72ToU_k7<8(H`Sa-rPL$jMxOW*d^U*7!l zzrOzSSHJV^Z@u`9uVFSm_w*N$JGbBVX-TK}cyA{qEPRSD9~EGk0$-H>vR*tSBNx?6qkdE{hS_Avkut|NkLC5GD^Q#Z$~BvCr)P ztNrz$(l|{lE@vMaaJtJZcUl&pDbs(Z3M44C^MYC$6E}yg;*fa5A#X#G-1IC zMAjwCGe0qmj|o!Il^aMVCb7b%mm_2*Cze7pQOZak&Iao_ph0*qVps6Hnvo$9lvN!u zD5N86jx0|Bi@rk~Uy5Myy#s+E1=k@;rpPgXi{a#A3CFhbVU(D=%974-g_=n~x9z7h zVZ1@;E;(a>MGqT?B(4@aaq~ga&-nz*gNnq{>!-WSt5&i6=Iyki8@xo;N!sQmaT2uo z$REEnm~$cFJTshCBDyqEg9-jUzhQ?(tVaXMsd6O&E55pcd<85N2%QA?Ga;e*$Wq`q zJ;)qgG330{L$(W0uH;HCssbVzL~@F07h9Dwjxqlz?)SS?k>dtiI;zbnkw(hEFVHm- z=JS5y{SiR52$@UAuql$(vhAu+#BdF{2I z933(BJs0g^Upvpf>4E$0&(0#}>;%$IR;pv)t=qqJM{t;9HE&1Rkua=`31 zMfiH=;RYfhD=^8X*Eyn0s2NIE#^m&l%o~@g8(eJX{fey}QEtMIyCa+`R`U?bGEdH| z1F>Kw&HGgfdDjmEjIE#vBLrI=($=?{4BvCh1q>sb6kdWb;)*&3yU9+)E1l+Ikb>c< z_I$OBmC$4uBr!)K0(iO+d@4*wK_kqrMysHZ{kyZ6jw_2wsJ(F9jU~<6}Feh#G-0*aTuZ=uV(J zQIHlO&?DU@SJLfp3pq@Nq~#{)9YuZyYs-~<>@;U~Ok0mo)EIn$o+cgnl5fu@x`Wl$ z;d}k4{V2yx5iwFwal6x!tIb8m`7I+pmZy)IV&pV-FKE{cR@w_>3O}xWUwac&)vE5D z`lQW36DPX;5}?+aL0AmKnh>=(M!%d=j>BYKJmR9*B!g^$RiFr^j!xZc)-$$ z@!9q64iZJQ_il22{xh@Z@{7(j|FUWI;pXt*Orz&~ZT3yK6fTs|)!lw#hTi}`gPe9>8a+;>8 z*XlGdXrBfKb=CGZFlftwL7M=Bw(0fGI%mO`(c3I*7HywnvxsYb4$0G?dtkr_#>6y< z%Ek(P928rmLA=SNFh#6nQY=`V!+xI0Gta8UkU=gtj14io^qJ z9`Q1Szxp1LT5dRCkTpdTDd@sx;gWA9d@W{>P$ST^012-My{qKY*1wQ#PUsc#&M)E# z#K{GnNE)ajWXD!op_PE65;~p;g#Oe#r$8)xd|>E~fHmwq z5oM}HC7p4Fdkn>6RqQ5uC~h`MrznzWMd*Ks*aC3jFN7#cN{4$Of_NZq(xFQ#2;`(N z9NSfPurSatvC|r{bA{uVTpd#*=lAHrY`tK#_*Ls9y%4}q`+5<4vew5lYZt*#v;%G> zkDP)qWw0cy)1wEFUKnf$QL9MH%vfEUV7ZZV0`J5v9>ZP~*_ITvgFFmN2S=n@s6L^8 zMf;R?ul9)cf?7r{_*cI=^)>A)U;fgQk3aVC{de8@+0T6X=9|ts<>bv9H>^31kg}DB zA9nCTdn|e3`RAT}8tUUwp*|kC?~dDUy^-MJ_nmS2Nt@og?mYyy@43q&n3HOnl=87- z@3y<&-PP4SXRb3oHa333d)$W~dg$SHbLZY#zd1S2)J{0wT==OQ)W@#8SY7>*i`2E3 zfAm80eD#S7KCH$@h^Fy5cm54AnBO&)2VC%6~h{DIv zhEnisGf{<7++L|Wxk;Suhz7#;g&Ad+j&b2MEw8oeVZ)Rl6Ue5~J;RGlT%4r{PXeL| zg0qRM&;tD_)~1O!n(UX#-YZyOIAUU_#jor6z>ZtIZUBQF+AVf3Vg_i#ZVW-FSIt^t zd8MGW9Hb-GWGDNRgt*4t)NS)T?l$of*9Z&jRRfy=vL}+ikPiVww#im5#CVew?&{4A zRnkwib1ld{FcT3K1{qttViJ+^x)aV9ZUuyuh)As>4&%HTY~7d8sGI|pjxUM3APTx$ zo3F0Xf6soI@6*oKuF`JT?$;jGzM^fzm*GH#^*PKgJQ(Pay3G_o#`lT$k7WLZV(~K6 z=$gzDnL8sLWnU9X4`SR}-_*BotEYHnQC(GRv+w2Si&Bdo+OMzNbTIm0AF+XhKxUMvcs z6#8+8j(vML8O)(Qj~IQIF*fuZOtrNFJ2Ph5icp4(V$=%yS|$mMI&~if+ZP0RHub^T zM=-^EFiFi7pyFza*Fo5|ZIDPUZb&~bvIJ50M+^=2#kc!#Ze)KKW=iRLo^+NME({?b5?h_MK8 zQY40_mvU-N!3!%io}g^pZzb$!Oz)f?nZdIL>!IaHmUb@f=qbc)2E>42MHOPvNo8k+ zI(k@CR)Hiw7D!P8zP4$;x>0|L4MNwm9qGAbvfR$j1~rVGxoTIng1EHRY8|s)geG%D zwzvU<$=(-y?n91cu#BxUn9B_&S~gjkC=w!-iON0)_yxfW%`1LtW~ey9fMyxM!}Mc@ z%fqQK^#!}Z*$nAGr4-r8jKqZ-WK&}Z&^ww*`g2#mJ zrm{&mr;!O(AyQjxMcyX*ShTdCr2}^jHx7NBeME-S9tnY-ERVAwWTzlWMWK{%Mfmc| zG?L5itO#@FUDk0!Kq|{xXd^Z%;CyaCeiU9vS~dc^G|m;X8>mma*6k6FW8YFFWjWVG zQGszA@Yi+LCAZa3H#%?@ZpqVU6=xz1RC8+?(C2%Fsu4tiS?nA3Y+-f$Vm;rEu!Y}Y z;}&z4S0G%9v{Euw$S$z`u3g)jtoCxyqdJw|g)^57|0r;0!V>vY)H<`PU>9WITL0LGJWLtoC8xG#i&AKYi<&27Zq zT5Iv+4F`D~^tzA(q>Hx8-b=)v5m#H8n=iJHKoJ!2yG!5K@ay?j7a6G#a7t1teB7IP zRbrPj#9fXTh&4CI-Uh$~r|kMhnh&~6{WM0Jyr7Z`40x8vwxE=oT_u4TFRa8?IqdO3 z#&d^NHmxdVxl;^EuKJE_ErH=6QeoD%ZQ3L1Ev?KxXf>js2eqBFor#KHtR2a2%Cc+p zsc1&6g#QOMnBga0;9cY~OQkG!ruMYIURI+7ucTv4?QC5%nEBI3owPx+In~(65ecyo zP1%4D68{ofk;U9sXMKnc<7ie-2a+X~<@Jc&GAkLuG#YURa)v~?;~;^A#M5g6$(e-k zje0I~3}@775a;J(wcsGN4rDWh8O%SQT_EyhL(eBwuglX5VK0YjXdR}x&o&fn)ghi$ ze>6LQPI&-tc-KG)oJD7oT^6`F(-YT0)!0PNv7`d4Urt^m;VVo#7)H-O5b`` z6OkctzM@xDOKTSf1*(7<3F|7(Zar|x9_Gk^EJe4=k>o8bCg`AM5OF{q>hrDm z+2us`5hTA!Pg+SCcVbE9mfuN2fC#4Rm;qvtN$+iagF|@u^WAPQnm;Po)wW%rpPU&; zIi@VY!GZ2Y9kN2@3~8-6(0%gX+O-+hBE6fvp{KOP5a#WAO|R>-^bviIK40HW-$&nH zKU{yW{vrKFL4))=dJbzrOn=dE@Dk}nDrBYvYui!)9mHE7s-oUVpb@eVXA<2|s)%>A zB`ZSg6EG$2OHo(Um+=O4IrAU80&~S?L zp*A_jg;{^RZ+{tQf=FOm<^YkO#~LVH27PS1zO3_I?trnDmQ2>gFN5|hCrpO2tU#F# zLe5Y>oGIl<&y+Pv11Hhiv`W5_C{!l#lW8d}U{^%)^D2%#AsbsX(7N=FBPTmaW0K7) z=%uW&0$4%BqCBy)>fIn!=?X`r0SFeoFXDykp_>sK(hHQ3EI`T9lcE{imfm#eKYD~8 zu+0RL$ae}g(rzxrqmuO+eMmRg`!LY5PGw!u#qdwruiOm1DaA$a%kttSdzXF$1n^}V z5=`=&Bgq?>aqToU;w>yROttoO+hY^2hI6ZLLn+n6*yJJw6nB%nwd$TG!P%f>y6 zE)=LS+CVC1{5cS20?3gKCbTsX@Aj;$lQA)?1QmZsIX=eOl4u20{K+!d3@KOa4Q?1nTaZgOk<3-X&-1Mvep63>1Tz!0;kUKR zJ9qcCph#hfNc2P8ktnu>T+^ zhdUuBiCbo?2fRyEMlch9)ENit(#Q2}=p5`6fjnF%mINo+kANU(c6pF6JR`9>+Ps3O zfYh7G9#Hg~BCNaCJT?zw8Me(o$|{cyw$x}&vu9OEw{03UUB9!3D)TA3clyyT+=To< z6p*FHYG{EZ2%8C)Ok=B#k|N&|Mk|bh`HftwWi4Ve3d=nt%d3-uoPSXVwn`S)v1`93JI*3 zaw|q)7uXJ^nJq1n zp;Va|Y~KQ#L>xa{N+O$lMSjhyIPHu)J9Zo3SI=zsb2C=>7@8}5Q8V9$|B}s z1yow+?Pt$(jQmn`0WSK`Fx%Wjv0-CZ4R ztt8ZvmKKOTP|@a^{j=@fYHveTwntz{LMB}0;Q!?35a)&jJXHRxoV0QF^Fu>8fG8ez zmRFQPUx_Ucj3hGJ#xfOZ2+7@z_Nk+;-jPU))}tIrinDYqcrZ#_3cR4`=`$*@aUt7~ zL0**n0Y6?q^o>OpW9*bw5{8vnG8u7tlgZfcBBLc6wx}LagRs>Si42ieHc3bHb8!)$ z914Kk8B_n@bRI1|>*Y#2G97((jOG9E0qHEYcGE}Mzi_qMs7_Vqs4LZV`sw-y^>g)~ z>3`6-8f`|eF={L`_BReORvGKTJLqnw-d86ce!|)QO5Q#9jue(Kxgo5DDW3o;Up*XkON^Vb(?H6IAmPbwgWt(Xi~S!l`;T8Fd~hE!~nyy zeer}~KSJpo!Dr$KgPoCEg^SEE1|2F7!7`KF9d`hrqrLJfj3e|;#y)c?-T{D=BY$B# z6)C+S?lMUTm(ioKIMhZOWFiQPnPzMnAUxU+S>g!8ZcFt%=o?^7pEQmNX*V^43gJyg z0ile7z(QW=3-(%P$eF(x9wx9`peFRrC>hQ?1ly$z!Ef>aKu%90F>thUJU!4iXpvt6T5@ldF%i-VM@Y+nBKWTvwK^++{5b zN|(z6(4-_c1b&`i)+A0J`@_Sdj|hc|9aX0kAqU&Bzm$V?;-Ex4$b*J*LyQrxS%=Dw z7cy!L?F50fyQ-#2#h-OBVzXadP^|>8`a}{WE`c*~b=1%I5@0YeAls!|Imx8hrNrJ{ znT`jr*bZSv?D^eNVGmTcz#{FhuM>HphVlp;w$p0WWgn28YR&9_<93Ty^lP#o85wf2 z(HaaqpbJpJK9;bI?a%`_2ju@$z-7-CnPfJin?<+y&7~Nv&E}dMA=MALj;^(vlm6K2 zp!ITfs`0~_3A@Vgv}@EXN}aZm^ypiyLB8sjtHgXet(=++$nN8ok@M0+Qlii0Ozytf zcV>HTE?ksLgBdinS_zAL7ksssRdsvV1}zxzEh44ZzS)^+N8{}AFdDtJP{OkH@axLR z85Lrktbeha9bG@F$Of3;3+vNF4WTHBT0}{+-~0tMi*}NZmIZRtlX62~55O9I%p0y3 z!>xenh_mjN7|<{_>UqVMGH5Sfhiek3fqKSW0}xE|cycS4gO=M0SA!=4_aGU0bhThK zcJ1bUq5^sn)yjruoJ8N{26OD=;S>9flCOauixK8?Zx+zb~gnXuqB9qT6O_BkgF9w&0J%TG`O}w zwt!=U2Zj~1TY3rKlALG>FQ8`8Ry8RAmgPsUNFRPJ6{zNt!YNjOYqWb%g!CT{X44|# zj8N{Fz!L1=EYX{@TwFAJGUoDqp#wBcx(-s0c^UbYb4H-orN}@oRn=NBC{l{n~ zB;^RS0g;2s#Z-|+5SNPv5Q>5_oLPnio+`6lcbsB&GPE2~umtp5t*z$t#i@$!i@OR{ zztA;LW;&xSw-gyzQ~7FuQ4|wboM1!HpNcjc?5<1+@SgNJD5#5JB{;w)yT^sPATJ`z zOyH8VM9;;3ptin2bRWRXWZO{}@B{g41f5R7paS+RG9m}p!3l&7sg4F24@JBI&B|D6 zyR&=Qz0dCltuq*GK+3%4lT^*lH2F9Y>jWU0cDJ>$W=K1d>{w7GE{t%T5teQ7awEC2 z8>F*mU`!1v2O$=PkW zN~>$-OT-wzLx$8Eh_G zdOw?31|`R}@L%TraEw3+<|RD`X=WqyJZhCJFs>cz4cE;XER&cWHDrgsW+I^f!2jfO zxArW#u&)yTTqYc%0}sux8dr0LfkGE%E)BF4;VbBM0%No6`?8%m5hea!+|!Z@AXqCy zQ+@a*Kmx!e)On^Hr-O0OR46_OA0Vx~OWZCv2>c}~IeQ4o|?-*k}OM0h5(ol5ePOibL!;;^;slqyG6aA=nu(?Qj|ptKM4|I0N`drGTyE`RrjH^P>QUDQF#oUv5=oE_auOnm988&HRiK`C2BUgeYhRPy#>+;{SSw& zQV)aP#`YnqTD~KU@|qch-CX{CjM^~$mG_e+kTB5Qs1?QADXEj?G5`THh!vHUIIbjt zOZ}Ow8`WedhAPC$)mwxJAj+f)xqU5GK!%U&VZOtv05tIm6zW-uyt7oRV?NzR;&nW) z+;VWidFV=V99eJ9rT5C;AdCekGFFM_^YMDBP!bTGkIYQfqnhirt3HKZ{H}?{$9rjZ zELa$Wci0K23ULgCUKD)5Pw4b4RI^>`Q`v14imXl2)n`|*CJVWDat9WcNU3u*+9ELf z-tRj!_S4rM7k@>KMB`?PUq;sqPodr{P6dcT9|`F(kg>1~mRZwl`#M3k&;JmjXVe}~ zX!CE{BRlIMUd_8l_7MZZ>#~_zrt-iaoF6;yg{62R2>i1%*JNIjxdF|f+u$mGJ@eDd zujx?0^HcYoF-zuPR_D}o06y1$C?`~u$|@j)Cik%7V-`}iYmIefWAQ-C*WT=O&M2GY zS%tS+n}Yq6+1PasdT-fktN=2M049Le4DYdRKZarzmfHTx#3T_?<@fPnzTseW{md;N;gXtNyFb`Ab#|k#xozokhaA;-I zs=)+PhlZPnmBX{~Ts(Vxy}!5)>V5y{g=ZF-0EC8Lcj zpGyNx5h$q`HqL>LKz#e$(KquFi4~OZgT~KcR4HwmD6jg`wM=oq$6_}Oh$qF4hi11R zE9`vYStmYo`~Iuuho{!}UEFu3*s1jMU)VAJ*hj8jS?W6{b;_00oxAmbYhQQN%3i(E zJ^F}ErLCoCDtPAY+YegEA$JC0E*nz)#awKova3odhQOu$7h~Zul)=A7k*QN##lgns z6SqQSE{18Y4?4=zS8aRT3Hx-zbmRDroiC?evuCWzYq-4h0T2oksNm^{!L?-w5tmc$ zp*X}~2Kqwt-fKo%H@9-K5hCWrn~AWZ=!N#*apCMZUE7zys86ev$cP<}NfPeq>r^l3u@U=0J0(c?9Y^XH!i}$&2}te^CZT zz9uKBCrMWa(6v~!i%JHqi(7ArsG=fBsE{0(+nioGrEtLSU>U&jtR59<$cb6oFumq{ zEu}uLx(_e(XbP^cMWWRM6~X?-GU1oeMsVhG#7jCh4i?M6 zPKGqYX`$ihbDUThaJTOP640ub*iH_(N^#&x{Atzzc ziPWycMruumYy@et*d5R(`W%T!5xh6mKIC@O1?^bwm-kJxg7t!wE15XFgn;1%_y#;y zk{jnFK@NTHEUy&g8eLk0sjC-)Do-i7q=}ZbRp{bAdqjDNXp?8vOI{0H(CH;(v*kmp zZD$^i5Kt)TZWk#(y4<)$sJPehXq99VsszgqHD{Xd6<-(Fp_6D(LcW7CK$jl39C7v> z0sLfx!h4*nuW)nI5Y7b6lOOZfJ4t?!Ehx-Mkj5Xw8*+!jLWs>tG{nU`TciMw|A2rL zlq;y>px{ksOw2Ft2G#i_L?5d>{-fDqNm`}LVF^ChU_ zpl%k`3DvtLFB*d~3)?T6uO(ds9n+}V9aquRREt}aQg20&ts%=oysxqh)I$EJ_kiD| zjo2#$v>d}|4d-*YR<2ttmBAqkmEw332bJoK-_3>N62D|D0;@bu#!zu5O_}#6eEzG< z2T`MdIvZSFmpZNKA~#g35amN7BzEBN{MrpD!|)Mv&0r030a*R6+hE2Eb1uqRbTO&! zLn*<8_@!=fJ$;(e!aS(T-Y}JvB~ai7<)?}R*B7B1e?zfGt^m;^swRFfTgX{kgBnj~ z4I1jw9Av+7ErWjFWM$GjxCoE;U90YB=aA;g+m^u3#YTK2|8cTZ8WWg`9XtMEb
    VFZPh%_(+qGIv9O&r*fUB`o34!l7LIp;n1$p*#-82DcBdQ}XQgAr?tvc%I%i!f z-mKJv-SJ{|ByJoyN5M~mXw{%|mMpxJk0b!cFr zz>fkJPzjhvE6c)zqCW70^Tc6ys=4n{Xd~aa3nb0W3)Gq*RYxz&4-i5@YXnyQX;a2%R-g#B!;^ zVmP0noIU}6FDMZ<+m>z2ew?%&A zfiNoNbM*PKBP)X~Iy(E)9S?d4y@>ev;OWwwKJ%bi%by2!q`!lyzE1@^c)lZyGR% zvjI9~t&HzfoG)iSMvwZ}GWTYFmiawdU;(5C-!Q8NVyxY?KaD}cI$a-&#UkUfZ}a1eksJow*sJcyo4 zViwpPuytwDXwW83YGej6z@s9M*r@2MC|$&W@r4yHP4k|qxE8yge_bCg(42!56^J8l*TXK_ZdiiFQ;-~Ju@xXuv7QjD_%!FprSsl?qH z1dy54hzWFZ9%TqV6mGR1HOe%JtCZgn`=w$HG?(*BH3mNt>yMYf*->Ud0uaQ6PGqtG z;<>UZ&&}mat4eOUur=BcN1a^M;2vqwp^4?g9I=wP;gY1d0tlVX0YDMLEAb3y%|^+c zk_LInpbZIObqPxWo>{5_v|hj}fP)fat!gE%qNf`!>o5Ot6rm&-8FVsE0+&R|scf=a z)CNUp!+e8i3(d+p+NcKrsxOWpihkE#J&h5XLp2)|-eTe`yn4Gr({?TCf&2tp{Xz|} zKB$6Oj0NG!;(U3c#Kl65PYN##nnG*b4}(d{EM%S7o7#M|#%lx!+cN%+b3(=f^iwtc zGISc$#fk7Z0_Ygr%n~Ck5j#fA!wU23WA@BKsTLu$*2{h)H`B>$9q@jV&?+0BMq&~v zN}zEf&*c}C%g{aiT|&x>z}a3IOL!P-C`6L04kv)?#LCZ?P6A-d2F%~vqRK~9q(~!E zl&NN>ANZwni1UwjGVD!sR)2)t?2D-V{Uq~C;;d(w%gytcNA(7Ci+QiPohYlOpg~2- zku%p#OvR16k{gZX!(E17wiI(Agf=Czh>2ZfiWI;awbthLGkATL*4%Iasl*#t5HRl z5XS}`5Wy6w5$-4{)6&=op`AZbDiq#1qEyNvLg2bjI6d^1t%!YN~NO>y^ zINMD)3Tp-|-u|8)1vYk5!J89Q@Tv8VfQ!O6_N@R$|0Al(MZ`nXL_w;Dvm;_AoeWzK$Sk=)HpU^QN7+qrh69XG6`xREhYLJgB@imA4L@C zNXv>WVhzz=t2QXQCRZ`msmVd>h}n3VlSK5M0D_8P0mF!*9)x@-vMOi7CW^@e>2Ab) zd7L2R+LjAxrM9CQos2oAd`j=ml)z_-GB$ogx|Lqfs%)o_a^pC!}NQ({S7JHFg4_U26j>;@w2AL~KF5-2)qy*es+Ypuu?x{t})U?jZ z)XjxKH{fvMT)LXlRnYQ1I_wL6l}m(V3{ir#Z)vn2kNQy#20iGnc!fH7_FX9y$*)2A z^D7xT19E(r0xRTAX{#ya=6N9}g@zV!!Ws@VZZQFyNM%$P&hBIv49cdjh(Zr7`|;4P z+5)#(?J{Stl$m(otIld?H}>tbnSa5;{ZWA+IB|`_=fIq19&64dw}f9qv>=qG&T{iv z=Y4FOG8xQ^zI>rc0Ty6s2+x?sNgQBxuVvb5rO*GNt88 zETCn(mep(lU~A}zCzNcC-l3+NhU^Eap-fue{$q`=h&p>LR3b{MK9!l?ykH4V-*R%N5@MfLO2 zG@!0#ig;8bw-oE)3gD1xfjT!y1;t-59YlOJ#mtlPuunf4)z=uwx!ia_b7H;PKK0m% z+7pTSUduuTGm+{gPg1=PF>VxSU_-DZAXSoJ0**ob zpsvhV1}|bfsvv2XE@)}3l+drtGW#@}J+H`2P0fpMcq`nf!fNMg*=9?YMJQq5Qq%={ z!4;IVxoHM71-*bAt|;AGynaog5ln!!1NVg4X1!QHvNTpMh1pJ}g!v(Z;&h-nP&rx) zvA{KV0rrJikT490sTb%p7n`D<_m~tlFGL$XE?4MsOCYyfG_5!b3v*VGne3XEzbJH?CM;tv1apU~%j1gJZqR_wS*E^>vuaX& z2+47hZ(y0sk~Hirmqr2uZ@B5kh2Iieo1wIJgOBj+F$(h&Ku zLm~5Z!XE7{WupLdvPL#$+!H4CQ!b?f9BXPhSWF($5FGHLA{u-BWE3~1oT^{nXf0~31Jsr?m%$%(5B_iDMrgbA+^@*2uLYP z8Q`xMt=g+9+ofrzlIu9Lgi|bQ`D%zNbvnm%80;7BJgN`^4EQC-YGWNq%QML`bWOtV zwAWIafn`zUnlOAAjRIN`XbWuVBq=gO@2595TcHp|TK_^N%A}aY6D&_7N2c@?#uNS+*#h5i^wA?WW ziPPZ}P9D+l;dvz{|3}cc9D`6>-%&Y0-St1?To?yHNkJ`lFk1{W@bZSHU$A;vZoW)h z0caqM(V0`jhRYW@#feHxn-i!tW||<0*`(3qh$2I=R*0`5{?yZyrY!a-O-=ynsm*uTjPo)LH#3 zB^p!tuB9N56Q|1Z;3sYzYZCNrZ8`!3D_D}3wl`Qfy z*;toD(+_jq4)wu5N_F&Qv*oY(L!ad9MJ$5m6UQ2Qft!2pi3!c;*DPl-t? z8!jAN1RY*UQIPkLI+C8DTJ9V-gp>s)2DZn5B@y$KH;Foiq?ymBp6^b^1$Q;K513yE zZ92(B)sijcT!mt68PZ%*sA(}ZR&~;7VpEcYGv#eefuOG=prOu378fZPn;eLON39&P zh|3+_{+cYIHIP1x9w^B%%5h$8q{mSjQ%CGjq@A_Qpss zr&e9Oxp00pk`z(Co{!Grd7^KEY+e%ur32U$#sFd|kv9-5J6v5NIIrFpqmLER*6t)$ z{}uuuMXMy{^tlZ5nV20UNL(Buj>M8J*|N6jifrk7%M_Xv{OkNlttc}V{H;mc5v3#btp_8oe1fhtMxq*^h&0$4tA3n~d6$&~c3&)eZ;pq}gjFYB;K8 zWN8AAiNFY;8evp`@P^BP=HQ#QV>ZjuL2Eoj7)o&NY{r*O<4MTQwnvTHIacd*(ODA$I84 z%*+CW_*jo%4%-1NAqKp-`VE2x*8H9*0b@emq~CcV;EXjZ>ZPQoLCaZaD>(x(5LI-( zO$AsXerr%XnZu}2T_WR1+ z6?VR-_BXR&L3R{&U+3*L#mAoRMNxbVmTEu0aaVdpkOXcsbVNXzlDbTe`Xf- zxy}y}cj!D;dNmhtOzfSg^Uvr)sWh>8R@ZD`voI9``Bmk>y-0CNctv1kUxrm5E)02z z;4^#T`p{;v*MGqb8rMdaFr)U9dyr7n=frD^>wUJbD~7QTMocW{)MBnsEn_Vv6q?l- zf0h=Vu!1BBsRvEtAU`Imkcz~r;72iCi3g!P07^`aLL4LnWqfLK^aV2UlN65;1SZAI zfz=fK8uhg7YU!8+-WF;LxsnS%MugIdY&?X;yHJGhjU)j|HW)*aK02)eWd4N4G8qjZ z8!7Ez9SPIYiln-Nsp2GfEHbT1V_Bp6f>#0uP%GS~HN)iSSkpgl;z*Vr|Az(C)>!CHl zMxX?6T#=YjTR~K)mT)zqL!fmFVa^s{p}PnpPMT%skDw!_2NAcvM z>@g>V4T7}GNw*MAM0wuNcA1&kVyaQ6=xd}PlgIf#a;IsD9c#49ox&=$mdk#Haf`M& zJ_A&zixrrf^v`W8H)x_gWr}U{p+M}a(bkG!f-k~jOCdanSiXV`oa&qixG}w3RZOH5 zsUSk`bkTVUQ61opAVh{u9QQ;!;Y3I<7{VT};i*D9B;RMYEtx2yrl6UiaDJ=Rtuw%B z1HO5mxKtUe=_D(nY3d0T=kPKeWLV)iwrnpZ+*AL{!d+(6Cc@E(X5$32cXQBrG^>3w z2A6Cfnds4ZH%v=YI?@LKS%nKx&7VIg22xC87j z3fmxO1@GRytgWcfnoz~Lw8%C=IUb^V`3ylvQx;Ixq5dnv8hw+R13s5wK8W+d%-JYK zKNCjgn?c#`F$Zsdy}9?^?cdLQ>#JY+@)tkNt1$J^U7De@D6Y4m?IAHqE#zqC#ZZz-a+?#_jT^eyb}&T=!MUBk30Hi zcWyj!r*3h(=lf@zp#b}_r<*OC_Q~wKm@!-TNUQDDQ`=^{6eSI5)grfOn)qn8kClkr ztE~37Dysd}u16_G?&*Bonz{FoCp`My+mAkRACw$3_gYak%V)s_;uUcTs)B4(hz+OP z=P4wkkcY?1Gzfq3HjILkMOS}We?33oWk#{K^}iz34Xjg?Ln4JA4lJ$CnrV5haYt?x z=RwfhwOV(TIe*Ei+#w; zJr=r@S%itvNgfs$nSnOWRJPGA%uG}cL1~c~l?r+pFaX*V1|C5cGQO$;FK>pKz{tIh zc@U!sk9di{iVdolC1l*Mh>n;hW|m=b$hM`}#xridT)oVj%~ zlhZe@TeWh<{2Zgx714m9;*TBk!1BNT>X$$J=}&(6{d>Rn-EV*M8(;h4U0?V-D)68D z=s&#ct*?94%b#=A6=$At`e~0m`Gn(+Irf0R>1FxHB~@@+R0(EO1~JaX|Y|1G0Q6T8jE zOz@}TF0=TF|FI4Db5+>?`13<5v3o~*<&b-oLafGmRe4DMRa3V*JSKQ(;+Cdu&G68; zuQ?v`JXZ18z+-{O#{ZVx`H#o)7r&3BYMX3K4E9*A z-DY65Xa~}w9qh4Sgo1q@!uhZk7FNIp@H33pAyFxI2XiA-k|&k4D-Xv~kpzgGp})aA z!?ei;@um3OhR35{sFOhd^GP|deQHR-9Ff`23AW%HNq}GgD{GVz0S_C3O|gH&IVB=P zY$BBmTe(mrL!mjbz64bS4{)3diwg>M*(V&re!A561D`^&MPsOI@HgcT{Jp_(5)We_ zR}m^(bV0`}kVJfYNXMK(Lxpov8V(n{MCMp%#WoQ=u-5kM;pN?pU8C&QnJoJG9N{M! zy~o5{s*q|lmjsfcQB)-fmL-o0y-X&8AR028COV=*4cpeiq=E}jHj!L?) z_zZGz#7R6vOI9f%_g%v44t9phBjBP5cs5#(daVvFUKfV0=uebsE1uU7RW4ttvUvy{ zRk%@-3;}K6?SdW!;d))SLW&t>H@IlBeFuPz&Khdc`LqESA}KN;MJgm3Z8obGuPPTm7ySY6YT9x6R4DoWl&MOHY=)55B*@K)*W!|T3CV+WeMEzT zVFx5ZluFAX7>qC{j*<_jKz*ZkUb$w560To)v3(4X~=+Nf$>=+!8=Tnq{EY3;D#9^u|q|02LTYLxXH`tarHO_)iDSjU(^6(ja z6+^CoO`S!PLUJRzwW+ITcQ{_jFPB(cRQ3S&lM*oi)OGmK0FeyB>(yEyTP0MPTV`y! zx$h!P+^F0!L$195#*N^am{#1QSQz8;ivIeNyGBb-)CYlAs%0RN?PX`;=Gr7_?a!{u zq@NL-cX)fI?Di--RA~~U1y!RSB8SE@REo-&8p-|?!!}vTe2@OLNie?Irb{%VWgab5 zYVOI5JuQ{|&uWP)Uxf=59VUoWi?@590v@egpmi?IZ+Vwm0Bw^SYaG_NDH6Ygj@PT^ z)Su!8bXoJ>)j|z90JtSjqtrSKXHw$}&1l)M=Vudttsl zuM#%JqNFvQo%hRyYScX(_AXsd6t4*}yFqJWcmT;D%ePo+Z-~YRThpkOTcKm;<1ch- zg{5M$a#hsp74n*+1|q^|k0OzWP){79RhaiG^hkntik1T%tqobv>$lr{diq3??1DR8 zxj1l`mlnT%bd3QV>3Bu500Tl@j8p!;RmcH>rp%Q!S4feGYm4FK6OjS|l_Ne6H(xyn z1ci@lBjeOuZMch0%=Qw9`?$aaO?j_Pjt5R+UPI!Of94I5Y zMC}JUod_HB7nG(GnFt+iIEN&_#l%63GRP7f!1Nq@;J5J2Z)4K^KFqp5!W?U!Xr5-C zWu9YRY+hwvXWjyi|26Yd^GmTh!11lO<^%4lmS!CAR07Z58lh%J^YL`jT&IsoNiRelVIp0bb^0*8VAp9zJXB0{z43H z-8}an_5X1vz@2Kg4C`V}I6q&b=s<7A+4C+%<0@kk$u~wp34w*>b?abMo&+8tKu}H4 z)<)R?rwSUPU2@(dq@R?6H9~Nr*u(}rIvESq^G<#s1kqQ+C5|F;P%2}e5dmAZ31tmD zr+~p1yv`D1aShou0T9PcS1`dtgZ04%QtFf(2g{sbfu*IFvk|da`J?)I*pNaG?PW-O z;`3n;fDx!sZD7Ikkr9yTOo>ubotubi9D+S$J}X^Ns<#e%;zS8V*r1Xi2}{;_t7u`{ zn8UPzhKxh~*)jNxCC?wDO_p0@wnk!%CC46+gjLMN&d42YzUMi_If(jojr+CMTOG!oOthPayJZEW^(@R=yZ#xM~$hSrLPBL}4%heN}( z0e$E5fF_!N{$}arj43~t9+o%><4P*Z3u%&hhJiE@(dwJR-KS}=4|wjSU|~!OD$&@} zO_^aEd>d)MzV9^sv3RWDi@)I^vQB+DPkq;^#>gZf zbyuXVa)vsvigXRaME_H>C7Hr&;2JzMS&S&oI{JLBYv3)VOf%XPUButXE5nl0vr z8$5rmXn@{4 zrY~xBP%MH4!qwwbVd!F%L-r%AIOVXoIXA~qHW3V|G=ijCX=FTShTO=Ic+F)*mq=<; z4WdvFLpWT%L@ZdHgLzzw=xq75l#+Nc@ZKWo(cHXB+Bv(ROq5N51~Mcce-r~_qcV+f zMcF&IOgk0gHp42RH2nrJ@VO~r_3p#x`DB_ZLmFeE3WXzv%9w{4cxw|6{M0$Y`2e#{ zVkSb@!SD_@CsDWkJNP6lf5b^Q&@xCDHAZ#;Z$6xrjmC6{n$?i?vO;cDC1v=m^=nLH zwKgg^;ID-KQ*)$lc4mS_d{u^o1ctq3lNcjR5;j$Nq<-XIeYYExyTCSK{;|-4iIFH6 z4GiH~Xs+yFRQb~r*X#W3@efDnwd7){OxmX~e1nnWQH~gl0w;{&u#wf7VN|jB2nVx8adGusz2r(* z7X_{_$;OLoqyw(eh_ld7w>kZQe9wFvOg4OLDO)Zx`wl*qIUcnk^C`jtRyf!O1W*)$ zC=p?sn6gKW4TzYk78A&^jFM6)VL3aI0R~vFc|fC!z^X5HYnnz4ro*^AHtM_ z_52+)!b4UTK2|)HPOr_=s%vWbaTo~PjMP#?j=w>21*OXeP@*UVgTb8)s1PB@L}=rt z1%|OQrro%?9u>!AW&vhN5_Oi}573iKxirL33W$(>b=}7i=fI{x7~&M5AFr*`gR<9P z6Jc^k7evN%aRmcKm^AEn+tsU zjENnTicI?iKSEmVKUe|c5f-0~3$^x%by%q+3;e*!N(VqHT47qQixN>;1R~V}ZmEM;^?TDRiV|~9}o~h4I#1=Sd?Y`FU@i6>ak9TEPCvj-DRp5r=Y$A z#5l)YSrBVQ0_>q)#I+JzL>Et%f*;w6Nch5iL4%lpG~IW0aGSEm4n^*@(KpN{i0TO2 z!eNK$04_l+ppsOH<4cID*`JNQ57aClT2`gE*a2E9w6$265*J-`dkjy4 z=x>rayd4&fwwpYF1|rWC`WS2E1_WOmB}*IupLmG zs7js;_2by4l*~F0{M!7%c{_8@-cP6BKcm5N57Qm1R?TdqxrRLOP39eR`rTpv#eB=$ zV}9<$qm}QI#A&#ZXs4`sb#bulrj^7ENkPy7z=z8ku>Sa?y6afZqHFOEq*Sc;4t&{( zzR$9dS)hGZje=S(dlD{m7A%xJ%^J3K7>i@{!Ke9E=0wu|)?`?-!Me2>8m<_4SqB6s z7PsHC$SlQgt#i0scCQ?RvLd@A_1b}5pTq?!$8hAloT!EkT6BZIGktJ`VGuOvT&&3% zY~a29f$fhWE8|IZ%?!~u-D?kcb{HrlWW`%kC_#jKv?)lYTq6d2TCvHA7YPMI}i&H z2D0TqqGfLL9x8?yDczO5s8FMHka9%9iAr`c-(;y5%ki9QSg5&E&jKZHivhK< zSST#8=xMx(Pl4HPD@YVmB)d;6kFks9X@P-{(^!Ea@(G!!?hq%?Tg(!ZxF@7@!V&%f zT!GaMft4I0$}ay{AU$m(u=K?f)d3P|L3Cm>Y?#s$dS_VbDcmaqo-kmdvIcpliPE;R zlTwr7lQbozCC8vNUOuEdj$J%PnE!1uqGLS8d14bM;VrjHjid-_EYlF~ofT{DVmwsBM+58c`20+j}SR@8&gYp&|j;0%F}K_n6v_rdc` zy~Hq}nMG&ek>#wz*j+9dNVlfv>V?r7 z1R@Z?0+!HChv0*{!MS`@6$d!6F25`g1go$~gQq@P7|;1+i&$hR_||JRsaQ~e0J7KJ z2=q@mwmcUl^YtqC2*fo4YsvdF31}8M3r>I#G0IKQ0gqwEd8-~MTVAGj+;nsF)p8}H z?EZX^0eLFYeAxL76#GaKsP<8q$a7DdeGn6s`h3vgJVQpJtrunq^2FUimkA>Cyj9Bc zviG2e1&|IRJji2BP0gO7%iuugp3HgZB78gZL$h)F_2x%E+WzCr4;kcp7bK34GxPGL zF9MH0_sIwB-$ujK{r>m9`<-un{R^M}>}NjxPt3Xe``d4O@2&5A$J^d|^XoLk_qkVJ z_N*s8@tnt=e#(hQ9YNl%s_asH+^zTSPUH&{B)JD(xH?)lzRAAOR0+Laey z;hpt_W8GuE;&;b(?%0-f4nNFn-efw^O={&#qe|5#V^-_|&< zGF;ptQxgtc8-+8N9f8YvSgqMLg<7`Bd?kqI6A0w8R23_#1Cw4Nu=a`G#wh3&YD^IZevYcb39Xj%6t zdy$#&PuMUaGl5F9?{zBph@`o;mLm@1grpq7+6T75nuFFswZMi{sQ*RYIBf_BenWL& ze!z4&aVFGYR_ZdTqRrVcvxyirSg{F{q=Uj`mUB|gn|RJkwlmt}@RX^(=EMiuBS~B*FbbA&AeKz=_YDh=Mf55BSrP;tOSN+$0U8_@$Rc zjKTe9Zx(_mUw1k$m=nH^OatRl6@Td#x3?fSH>uEi8>89ag|5GWU~ca3VPi9z|NP7i z&mA_d79mAXT+D!2#t-25*ZaQmC?O~|P~3x;+uKpYsQU_pR5;SDt1Y+#j+Q`+8o@MW z0BY*vj@FyX{Dd+5px6$PE0&6aF+w>m!!&D?U2@Os zcC1^}r%2`4fL0@$Bo-si?Wc;w2%X5}25FyPl*{o>mJjdaN(~x|E)4i8L6>uE-a{xn zTDK~7pjMMe;AC3J3h4HyvLCg(4$>faF?8J227|Fjl*(-qeh{B9p9MAZUKzBK+pV0e zNfU};@C?B~9Xunva(V(48L>eym0C6GAj#G%MeQcQV4Vpp{v1M6Y`q1o(a;RSoUS-* zc-0BsWBR#0-GYQ6b=>g^TwX{!5IuMhR_JT190X@8H zy2EL)#>(m85Hs;OC8c*!FloDFh}HshHffy%)*)T;(Dnldrt6v^oA3=;!mRer@{h~q zom?j3Fa)JI7rP88_yLZ3sY~8jpgRh(4BQvEGiV7FU~wXZ{z`JOwb>@MJGNzVWyXt5 z0h6Fi*VHIbh~Y_)mY^v6UK?*pGy>$E7n8h|qU_YzOdEiDhBZNl=5Pdt(7@<9`OfT^ zRE!F}P69xT21dU$uYN?@rlR9lOPJgVkrEV{9^pW)9_goTdzvnlmy$lL0Tj{cm4S67 zW%C;7k7R~Z*GKRVfngAO;-gYfEVrHL^t%Wp-hQJ3iI=_Tg)g|~c~?LC;%7Yl zX-_@13Yd-FME}-hD?uf~4R?&-=djzW2WQCU4@8 z-hJG>KmVD3hedaG{kN>S-Mx;#_9%Pn>&m;Js6E1fdF+V*X(TG&Z7)TAm0qfio zkL)%@OR6l2R9Up7O0XOBkoKqTp-vVsUue*iEPIKvC~mdcr~$X4 zJK+|mL0Tj?${$Jlcnt%LS;{Wbe>1(rMZ9VKT%{V%&aPy-6OB?#GVak|q!mkf%T!yn-nvOZ+=gq)KGWl5 znoz}va&@|ofT4307+$$rbu0>|7~-MMlEfmfFpGsyh1xbF(X??QOK`!@It^#%#5S+Nga~yb@0SsSmF0*pv1)QV4xe~ zpbQ|Vm_f%Y{W=AdHcFK_v(`hCE=by8VchSQm_AmQ^d~`;4t} zo%_H0oo|2R>tFlozkI=VsrLshS$F4)vtQR%btJD)t5i> zf~Wo6`RAQ;_L*lq{&9~z{j^gbdGhhc9sBTY@ZQ(2=ub~}J8kZ;=f5Dh^4ZV6@}@Tj zx8HW#?N7TPH&|L4@NJ*raGzJbIyXHvHGRh?bGvu#+Wq~HUUj8+ua~*V``2InufMti3ye&oYH^7lLZ(1#tcGh^=GW8ik1 zT*hpJpA9#BizTp|ZMzK?kmnk^OjplU>~GCoroGFIZNV18A74j)wcD)CWbfay%hc9c zLug4*qf|?_a+f)DmpOsg+y5|}52apvc~O7u``@0T{gl99tQ#j2!g&G|<7+gYrS!{U*VqZnRYT9q;8_~3FWFLZ2+BDKWDMLH7)e@Uv zs>hc0q2Zir9KtF0ympA))iyBSLOZFC$h6}sNRlbc@+-St;z=N5eo=bB21XmPuahs( zHWuqrR9qlW=?9}t5Nr=YOK}@=G1|U$CVh^d3XSAN_UsC-5FzecMX>8^_kKIvn3slkZ0`1xM*y8&K?bn ztOW^cmi^w0>!(Q%Qa$1gp@YZ{(KclQY+M571WW{N70n_-Gnf!GIkrmqLU}H%$15i4 z)qNcJ8W=@N489Tpa${T!_`V=N0_9Ll?-u+S;Hd=FSa=GwP-1^6oG^feESwh>8fXKB z%-$qdgli+j5I01S2ThHH6Hi1;srRTJNjMGnL30Udu(bzAoq~c8ucM};)TB7IdU66S zM7jfElftxxli~NGIsjLpT7{kyGAyN8NeVre{CN2u;!wV#HY2o2JCul%=V&}V zydsTD)Tbn|MS4t^r?Y9SRb)bUt}}_d0;FUJOjzfuQkagWR&WTC9akO>NF3%FLrC}y z6fh=X7r3)jmLcBYZA$~HQiV#A1~fA0PdZr|WZN787ZWdtf|)X%Y?6|-v~k?hl0)8! zT!IVB^B$eA)LKciY>O%N7`XX~cq7hOQHpE=v~_V*yCPw*findu$oHYfiI5=y(sBJr zVGsllp!x8T6&js@dKnIL{oLF{7CnVEJ3XLBATE+6Dsn_6iVtG1T{GkPG`s!&uPI=l zK7J6akj8+WqE<`zVbQ_y5=<3IE0vyND`v$G&KCWCdBW*T*4gBI%5qv(9+@agW${!@39l^vB=-7Ekl@ zpMBxeAKU%jx4-3P*tpld?AmLtyyCJ;FMbBT?c9@2IP&nr9(M55McWucg9d zZrMbuzr*u z>@qoi4tc~p$~@FlHO@m#U2<%hdhy-r96>5&m(y}YUFVqJ@Pm=o6{fkIHy~WbGkgv>DJ>2-?6X= z{|Lz({ez3J03~Rq$UJ&Y;$dJhrhz7NVr*@)LY%+Ov1)pl_mR<7T7lJ0r-3ppjfV_D z#-9WP;-dVA{YB(ry>gvn)o5rnm}^Amc`M)?Z>%HYG_x!$?1W)0Y{|yKT8iA>r-y$OGDzZA8LTbj0x;LnLl_$g99gV)IPBrJ~>ieZW_wWM7J>cZz2OV-nCQEn@wY z1(-xyd|?4;7PjFOr^BEbBaM_q6PqhB9q?2}#4-wF$s16{z)w1U9Y{I$Xv{(bv)uCw z(en8e%pA4WQ%w>766One3}hwhhBXd1Tdb41L3!Y5wLF=6i2krJVK{ltow(5ga8NMo zxae%ri*%vjwJiV==@Hj2_88oEiR&h0J4X);9qoi}y>)48BSku;<0VKWHY9!xlUAhoQ?5a;bB^c_ss1pm7#Z@=?K)C?nVQ zaJc}}x$?t_Nl@T$U7#=|oejx6;YsW*-+_LHq2%wQPBrgrq@Tlw8T5e3o0Vpr^XTn& zn4kRk?mIvE{@Y*wnpeH-B^JJU_7xXi@PsqTrA|2h$RqF?JDJ4sn_vC%7eD*y4}Wlv z>PX-G%9oW;ed^ASee`|ryyfOM-|&j-UjD*spL_K)pY~L|5-HT9PCe!1lTHLNI(X-{ zts56NtXsWmZgyrG^=0mY%%?vSo_WR@G4Wj;~VthKGDjpNIU+x{)8*kjV?qy2Y%2(2uOQeq_D; z$a?vaDv|auMRXM4iUtJxWpN?vUx?LZ8~M^-0H7?x9~vfAE&h>LSPLwG+}9E>A`@Ap ze?>;#67(^!*ws<0lEU?rlTePrcOC;x6sBr|-4>4&Ods<*8k`K1V?7?gaw6D^{>qyN zWKbMU1Ftezs*gKt9;Y%=jpx{KS2FzUQf`7nv!xhu-}qI}DWzh6_zKM+!ea~;)%xq> z6f7i{s+7pDxDApP&KIo9zK$c@M&`mHyp9+YfJCIzH%7=_CJsX?n0b%Ti1hplW6;mh zuJQosn^pB|m6%?guVM%bF!sxQXBG{danb|2ylC|GauxCz+zGo*B8P9Tm-oYc8w<$oBMBo4k5?<8LhT}O#y+gupgv-AO5!6A~kl{f{Trolh0<^@t;Dr)P z;L0kPad=$RCE~n8agoAb$fXXJG=(eQ)5N%Bn{Yq8ZWc3(r0Oi zW+*{1Db*N2k#NW!lVMR-fXWALzXca}l5X7&^4NS<&3rmRF@y1*XwJe)#{;*sb7YNl zK561kEmy~t1Wm9+i97QF?=05RN%{hcwIaicnn{kLs+V8B5*~aORvN?)-#Mttwp3@4 zl#9vSmwZz3i_pxi1btYn>y3V#e~O_NP~}%&oXQKMu59frwdH zY-UdSgtn-saeXx{#X4M49tu8LLdxXTR%Go2s5e;nG_Oy!yx8uBA(;7)Lj-2va79^T z+37L}2pKR>a8`9voc4(H$#NfHX27cXqc44{r(7+rDd(*Nk@g^J36v+t9gFFJde2Ss(*{x8*d5Rd zJv_YDIZB9kbJu5(Z%0bC#-HjZYUknqBM@u7Fc38YQ~ZG*o>`BEM&U;+hk zmPn;*HP}Hi5B!2;h6CZZ%#jo&mg-NHkqZF_tAD^NW>+ zv;o657=W}u;|AL$Ehlf6-T;InqxqV_DvgzDoYW}M(L9)wC1}8N8d)W+jmUV&f?U zxyob73|l~brT_(k+rUf>ku6Lb>0}4O)^u)v$_8A9jgy7p$rPC38i}U>Ju5fvm^LFP zN}Ys~00N3!cMLYehG{piMeQ&tK&pogl1#N_^MfGh*5|Vb-b5>kZXwFf6x|?jxowKc zxM^`q0M59uVakOf7Z@r1G%T^DY;M3cFHeP~E{>uLiHdt0ewM1~Gw}7f*k15F4f3h) zTdu-^qAaTa?qt4fc1=ueBq|>TWsQ!iJhPj+m}_A;2{CSks=^V@`Ej>!@CSFl|9v;T(FVTHzwA;psh)n(g%>>S{PUiA z>@i1g-EYh0O$+PS&CZOqTmB#Z{rA5??&cRi|1oIHw-C1a+E>4H*XKX;$&bG4^*6rw zh1Xv5yk}o=@l(zr_o)U|_ZV~W-e?xI#0cToZ7}BG|E?etp&SWOt#Azk z!p|46n+;`mn|(4KzYV}je1hQJOv>@@e=wN*fB0b}StI;gG3OW$Vc>s`I0)eo>aZ8# z*uu}k!?*Jg${`H=;XEF}LrBL7e-+{QzaQ>HcuSrwDJoveLumXGkIg)Ut?WhM_ZA3* zu^i4rMS^2_oH&YMPaa_*7n_qFjA2i*G3-f-VNX&FI|&mP^%<$*6Xc09v(A+uB=#Ru zu0pMN$o!;{BXl1Oi5x*p1T)B8${Fb&=+S%PT0D$xh{C+X2Nw4PLo6sfJK zLKDCcEbDBK^JRkx`^Qy`wk!IL4v3vhgS0@|5w615M#kXc#-{z0-GF;&bMh<1oYrv- z@uLI)G{O43V8C;@ZZHv*a;YoZxd)3lG2jxS1P%^VV-&e_z!I_~o)DXdt?;FIKn~6s z`8TczzB^SQV1>kl3W1SS6%PvpIf4P<2UHHJ*RtshCeeeUU@NVVNeN^b_5X}%lWj0?@Lw3Qb@l{gkPF`wV(d*9G+B-zLlAEwryEr3UZIm4U*$w}AUMpW&zGWLrpc^<+7yJcx-({0 zBB>j3ev8Xb6rl{K7hRBy>txaCrZ=@wB>WZ{k+4&G({tBTYjrhhNpMbOEIqJ5Csjgr zrAyLfP+gIIOLyA^2NF=;u>92tT3~_k;YfSfaNKd&>V=74u5;x0$3n^PKwbl{2ZyIV zTyxh?y+Dtt$?`mnU}_+nU%C@)y7+x z_mD=1l#bZAU7U-0;~T;fwRH7Y73+oav9z?%+EE;H#&CQLe6M@^Gm1>iC5{tiq5_5f zQaQT-pholX@?B2LEjBa(URX%pIoSC$Qz_rb4EUdA9smtGb^CSZf#3e?uYdW!e)iKJ z|L_O*Qat_^`W65DnU8$2cyYYFKwdU^o>?=UazH<9-yym5sxRZtAD<28$fAR@tWoDLwfH`K5 zGZ2AR=!UTZW_tk)OLvi?86?{KxBTBN=3n{C2xf5pyC(Uef~_~Qp|FaC0~}-g2W_Zt zZKy9B>W}bbOr8y%m4Jw;2mu>|Cs(p2@rO2kKLXoTfmrM?-cvn1`4t$z;H+P0`$Kd)vSOaL&iP<^+N8_FjfJXja;R_HDE@^ z^5;;ub}H2n^MS>zQf!O8{mbI2_yoFbl3V6s@~#~1$S^+YZd|2SfCfRDR}V31Oq}Q0zgiGEG)=IURis+TCbPGv1YMQ zucjVzIJ*ogMqd{!w*}IG_*g1iNm{e~C%gz#-|DF85*-2)06w1u!v&r5s@pNuu!DEQ zvKL_caCN*~GidMw_K}#H#2gFDSDoPaEp#!U+f!--WfrIzGB^ZES3n33RX+QvPkj7?A9($ZufF`!r(bmTStp-(!g0qQb>v}(JnWzY zcPOM>zmhuM_*kdis>P1U-29g4gyWAt;k@&sH|B5u``f*H-0$D}lylv`t2ZvZpy{Sx z%KnD7+DB%e_na3Wy#IDuTm02O`JHod#=Ls3WdSc8=_1OAh%K_)G^m`742@9JoI=c4 zVyU}LYMMZ$si4y4CyIY6K8S<<4@+tzTyk$5mk^gJ$`mHq;-N@$uPEZ)I+tR-bv)Md z7?DE$iw1!IZ1_eXsK8HAI;uPbdMd2_bFfn^l)ZrGJU=gv4Bh5TO@{8(X48X)Zj&{1 zn`G!VSwk13a~mKl!(t$s5(qF@tYTR7g{G^}5bieWWj^it5UUBad|us9e3mfZm+!U& zhAF}}5?XH5Kg5+AiQcefFrD|1AYf)-{xCrb(Ad0C9qG0xR%2s|kI%xd7FX4qhJCXyF#^RKB!L)Z&iK^qF2!Rg zS6~ZRx-~>s+YHzBgHi*H1dOGfF^cUFc^R>LuSr)qh$*35P2HurYAGMB1z9Z9?qwQ< zWSVXQi7?b07{rvm0zMV;ea>NV) zm=-{TfFDH$LI5%_Lk{JXR^4a#EK(z_LapCTNQk8^+nbAvn>7Eec}DXYMbs0;F$6zl zt|=z?Sb{8$8}YH*L^DY~3LP0!uM8Kmo~h7-R+6j{o64F?=#@ppR?)5CR ZSaM@ z7*diY(1}$G2nPkVY=q z*NUmD(c|@OeWH`p3*l5)rRs%*8*{A?+7-q`$&XRE%;*egjwduu!b#*d(r%6sn0dxK z#gmXbrisM84*IpZf+?W+L?IIL3Q=r}Xq~agOy#Z4BC6fXE=1#->B^J5ukS(L%-ujc zElp@>8RSa`0(O>?+(sRNIxyVk@*Q-o72knGJo>*1j}@h&mW>_^uEovMu9X23?Pk)< zhunZFS0&R!!}{dR<1-g#o}alfb2I9QRAWasAGfXUNu@--S^>D1xA7is`xq zO#;c$cFAp1$WBxbsRjpVfKPL;8a#4ZnokCt1SAMR&#m~E;_s#ZqxidX=YJ9*FYFZ` z&vyfS=Omz6A&)acGt>Cz&8ueR-bLT44FFE(1bYWeqd)}Dari59moscb*HgaD1 zJOVb+bN`bz`F>=5q%?o7O}?5;<IT!O(8`b`)qE33Sk+?y00TZ+ljg_n}{xKrI|KXalxO8>yIq_vo*b(+d0NSTk3 zK-5olf6(-5BUl@=2Bi6WMK9;vQAmi9CM+c8B2AhzWg z>$Tyu-{%L_gBs})#uu+KSaN>UI{tCbdHZ8dx#Vf*K5KEs=6LWrzu^bcM2++QO2nrz zNM7PJf8Gz`LXLiX6W_l(S2M*bvP+2bKzJgB1kocY)bx@aP8`5BptL}=b@JAtvu1jV zA(Ac?WDsMMo%7Z>4k|ghvBg!-S-#wK*G^1UOq08bG7WVZm-ytYod?{H$e}5OPPI5c zIFa@ehzRD|7oGF03!Z%IIj5e`AHT4E^w-cA(sTfmTWmu^&K8lXSpIq4-ynX z@DYrxCcgBLmv;*Uk@0b1IU4hVNr%Dg+sbpb9Qu}(G1DuKZ_W8*YbPfvBxuLQjm6?p zw7LMn*l9PKllDLg{i9EM>MNG_^EjhvCR2Cle?a=u9V?qwnN>WwHV98R=A5UlUv2F9 zb(ZEMlTIatw7(W*)m*0g!0$63cYc)FCv#}#sLZ1?mt?NYT%UQTS=jzUbL*|!-<5gW zEpNS1Tw!slUI3};^2;uM)-#?Ct?KNvo^ZzFAN#1Ijy&S!-o`84OmNK6{+d%x_SdW-oHeCUxTXfmQQ4YI(8g%Q zZng#DFU0KswyN~s6hQ6isVrq~-4g>@N&8!Eu~(HPOkglKT77l2UinfI$5KdT??!8q z<-xMlO9^pUo1j-zRHgzJolNeKYOlf|na$CA5h7t^6rlxcMcrlCP0BIaKsr=0W|8&A zvgUc-qXnio$`(=<*b2Y$#oO%C#Uc+`nuCvHWbw^o(YjK!LtGY+Y?rzMZCk}+b-K@x zS1Eup5Err^z&@Qmj3x_l|!D{MJY_uuiSEUy9 z)DzlZ;DexD+LClmKYVSx%ACa9+yY(CMdTq+kd1+S*Xq23kVYrVI6*Lxoh zo*BF)cwg|1;MU+L!5v{08rctbguBB1;pySM!$*c!gwG0J5WYNoZTQykz2Pn4_oIiD zC(29Z_3~-uhn62%etP+Hy{m*a26w9q^&rM&Hz9xNB`nTzO z(+{Q}N&hLmA^lYP>GX@~SJJPi-%5Xy{-SbRxIa*|+-7Ru-ecDnXEg z5`c(}2BDKpjtqlAWo`8s9F6-4gx(loxW;6Hz)m(XG7rCCu;y2pMRXEqXI+7CL`NW? za4TIFo5HtBpZIHo(=q~7hsX1m6dKzDa&=@l<~=kVE|MYxE0rjv@3=jy_CQ;v%X{;> zIOJO{ED)N|DWo@r218JuoeX{-t1RkPFtEiVxvLn+_&h8yg~J`88MX(-JXg_(dWE%x zhgx0@R*Cc#9d*U%6?^D`#hupRHi~sS#ua&j$!vuWkBX!0xb32b`AXt~$EplG@qfh6QTT9@hC2=gk+G?qlm-_Q1I>R(;j_nt7$uEc(Qm(W_ z_7lKNv?DOt4@J#ne`=5Tn2>pXg>>M@-EsRJ@ZE1`6`FRmgKBI$jSG2+n$S1NASIH`dw?P*W zy|$__fP%~LTI0sBv>VhD?Q`NJSyj5FPTNc_JLys+(SX@MY#P>!U!l_Ky{@8ldXVd5 zC8OnS%7aN(XWjXtAf6yOVu!^DU^C)0#MSH_t+Hj?eN880<*3mCeZ+0d)T-?u z9YFEcH&)-yN{dEy8n~t1BE3SF1tF(u#2OE@u;Mb(Zh5}CsiUAK3Oyfj5_P!PyP-Xz zHr6=1+|T?J>>p0`D(%PupbTnmT`N!-@X8<>615tl+OH@mi2ZMKm+j#it*+?LRpHX` zA8Z0isy4icZOmxcmP{ZI+u$mm!dVa51nQL?3|osSShWEfx?{9wooUdgW5cMLrAMMh zLuyG62SB_s1uPzq(QX)18SO|tUZ7cguu41yCIp(1{et!4aB=^cwfg8 z3oqAU(&fzP9Bq}P-8w;e7_eoSS?yOk&KJMh^CyQF`-(B~T}#auPuU=|QIl$04FI~`J z_%@m!uCk(bXhUY4Cy(f-9iU2DaCi}O_Rs{qqA`YylPuR-%|n1yC0NHZ5NV42LFh5TBG4ACooEQ-xBHPNunPm74{dZX@YmTQmeh%AYPPT+sRL{R^@poQ z15!b?-}D$LQf}9cNecBDw23lxw8V=|tr5}B)sez`v=72HI)MtK1`64F<_8%^Uso0z zpf1V!glT-lmRpi4)gru2OUo|OUo^8)kj~FufVu28s!_zq_zcsF_CDu(e3^9>Y76nT z%HGxW@)9ysZ5R!|-N&PdW=5~|r&b=oT;TViJsKP!Yql{HD@ zu*rB+6i^39W7ZNC+8XPu6#ivJlMD42a>BCVttH}WV~vN&jv-nELE$-C`3>zJx@V7{ zeX2fz4y^DNy8;qsKV>c1>vnUn--)Y7l;%#^^0a*=iZE_ygM{_18DJ{x9w zhhZD!tY|P00Ufj!974}fU!cTbP-u3vH!Q&$7M#Jtt}rvoc4bn;dEuL2`e8Rka~FM5 zTg)Gy*e$?2Oq|9{KW&65+lo1dfZI(6wHp?gYXRZfDEQr;TIL070c~&C{e=T+#_ZW( zpKfq^8N=Fem2q*2qU6>k7b!ttRS9U^pwVyb?{JN+X~~(WIg@7h7EiQ%jJp&ZXLko5 zk57GI>5T@)oNL2Dw&<1s&^B6%qNP`qYl4}=`n8VsQmvTA#1mMh4K7Db<`2;_&8e7p z%R09TP8?ID5eib8y`^Oq`Xhs7O8aZpPy(gkWND!_4RnA@*;w{G=@a_Fhod#gADVJz zOG9N*bbcYdSkPGOfnB|Ik$$!dXNdorht>w63Tt42^u>_a+&q;98z1TdB8eG?#&o{4 zg^(sSjw0vy4q-(4!_GuuHyo)Q(D`s+$D*lFpa%V7urhM?XWd$vmWckMrM>8ueDj@iToN4k0cfv?!xoJ z^%dLaA(tVw_~CkHHr9A69JWJt#<0B`FH*3i2tyW04=RRhJYu-Qi)V#{AzKVNqdn@6 zXan0>fnd79=@@C#^N5upV&`y=f*#l8U?BNZHJgvter!YEwOBb%Kq$xT$olPg;X&gOY*(v*vxupgKoMdXEBxkE0b2p{!ol=zP`|-B2gb;wv@nG|U37Sq zZin^sBoM0aG7^);N%D|!T1MbJ7PLMeEGIiI*S{^z*F2!3*y(foq zqh+wii4;@-h_HgmMXBJZ1)&8LVUmkzzG6Uv!m`Uk5LRJh|3@ipy=~2UzN`h2-&^y>P z=qI5%EWNr&{Riy^WgxM{Do@Yl*lhS1Z#yls5%58fQVV!0(KfQ4Xq8zJa|NRe?oS{r zo5lmISe?MsLpXTY(aKn`IcnIlysR?M!&^hU_2Y<2WR~1(nSqGbf(WxX&9X}8*d5}U zqp;}&Lep~G;{cXY*sT{-4iFCl?kebV0!ilvY(8|Ck`LtdXd;;e!NqEgxSS{(nxU59 ztjA6#zBCO9Xkwq)vbtI_>^wBgMvi*S2F@=`!Hk*>O8=F6%MN8N`5}1fh?FAS<^cDk zI2r=n3OpDpSmZWp*~pnjMVdd9iXynqDc zFfa}r`x}fcifU-ia0jppS(}iZ%GzsyI=xhz7lgmI+S-L$CivJhU}lf^>VfCWNtWaTZ?kzJ3WB9 zHCjLzE0_{l7Y2lDg9b3mGmDh}ZZJn2IF26^$`UY3jD$wpjXGNi5J&)ZbxA-lFB@Es zXJ2wh2z{fVriQ=~cGxFuZ?-D7K3&F^WMn)__DsgAE47iSr(zOt{0q?-1;BZez;%GZRK$cTS`EyJ!#T>XnW1^Y2c+L#L3vzl1DVZEdqC(i% zd8SXHGqH0Y#VH_!lgM=-r=rwhf(YpnVxQ$s8n~Ft59vl->hO&ipu=&tbZZ zIhUCu0nIKrG=Po%0iGugBjOF#_RS2!`(Lb=rjlu5ESyAk2^%&1bLbK~*Z3E5IH8m; zAP|R5ryg^LHopWgGUqceeeGH(mZuUMJe7a$=4WXOzcPoKb}4Z!V$6g9C+2$nGW&rI zsK+rIFJ}Cry38L}LIuS-bO6|uLJQ}}`ynW%ZjJH58$_`=@Dz0*E=c+&WR23WaNbWdd*a*d zHFdYkjM2r-H+xj}fNW`bw2$TcJdb%{-b9F)eICPn!B?Iya%FnFH>tF|;`^B8EhI;}3! z4S1{mgxzpOhM2&W;yvmMeHOm}>>98m1{45T%TL z%ER)VU=5-YavOc{suDZk)OsX1=Kfx2=N8Q-d)F;@v~bE=z;{!^m#`IM z&S2(ripBCB_iS(w81v_i`3j`)aZE`?^p_gHk}HqnQMg(B;~l5LZJZoI2%9IfqY2ND z{H8h5hFIr^2dX(s9aN`u?GzswujAc|?+gSGT;bU~B7WBZq1bjo{ffzAj@4q2tu?4xJyu`Bc zN9bJ3ad7-|IG!ZMd_sWz0;(E5$31RdAOk+>YdA2ffA2o|aG6>KVKe&~@6k6qLkt2qFxDKRDG$(zg7B!a>yFLJK907_TUinA!9eqsuINK}EHj0z`_mE>rszwBi0hrH1f0@V4#ih_I- z!G$ygh`Y2SVOUqvxT0%7=7*8;7ladn#k#VsnG)84zPmNV?oVxg#ccc3`=6(IX8Uq8 z!$zi%B+ig%N)54Ps9NJ>^nqQ^(uj}1^LQjJgYzPSB0{PApyuF#v!L`2317rStb`G! zR$S#8Vh`xF*q<)r8Qd@7hj-OER)c4#H{8mwx$s5EpEt4Zs=7lQ01hH)$vGOXqB^tM zH^?Nqfm!q*3W{g?2Q46M04!+ymgg`g?`~Wmvgqu$=n1Zurox4Gq8+5K(dF1&%)wGD zEA*aG=_N93t1w0)9*jkz2nBi6S=xkiBHTkoEf=7U6?vWTV#sb-w!#9+sCJM@yN1QQ zX`Z3BY$ZrP?`scfxS9*P$D~kBMS__Ko;ET+P`nr!1eTB|E`*1$8eAzUm*ux}#X~q@ zB7UN(ES2_c%qBo+(@tfE#YR|vEq+wEDS>;Q zCXem}&R*t~xjXQ>0U2}TLd1XPQG zG2JzwKv`5t4Vry~4H{q%Xhx*w*dFtto~UCh(VZD)cx+KgD;ffw<0q#`lOoZMwbb-# z=?Kfy4y5K7w-Ir|M~syB2xOzH93Rp;7_OZGO}AD;gHV6yc7jTUP|h3n1gaHc51 zXauyyyl_2TLH$r8&>JTAGLF`TXhgSp%AR!JOebiHS>{5QAfU+E{Iuo=319PKo({Wr z%vqj$W>lev>H?Dc=00&QDtz!fZX>4AZ1cibX@0Hh$w;MwAQQ2b9Pjno*c?1{>n!%a zo*5#nNiTMGVIz^eP_?Yh-~2aSXNW9}Dd)!A>#rrvo%j}_2D8SY*3PCsuz{wgj^1#L zSvSwS956&!HB_ODc%><3J^06(B`rIFp4kR92_j;K55lz&L*j9A-~jv}4Y73d&j zM5mrrmOiL$MS_jijE-eixzefU5F-FWN#VV$qjnAK5GuwKSP4;gh&7T1v{rkZMGV}{ z@3Olk_t7SoVI&za!}e&Jhw>mcy!ej@4Xd~LOr03!h#*>KUZ+QTr$kddfItj$xsC-? z4n2szGL+5t09nGqvdQgYTEmS|rV6H}fY$>w^H|rm zX>xd2LbVAtyz9PRXM+u7-UTJm8_^A9E}+|_j_HXQ(Hg5oBb*GTg+AHIw{OvBc(sJo zM~TL;U)U_9NU>{3eMS!O;tBc<>OcJxv7#r;1C-tJJGPhJKr_&%$Od|`mcb|kK{_?T+YLK*Viv=1PC2AESFA+%>ZaUvy1 zNX~APux51CX&k{~k)FkZx!?-Wj-4zX&qTrg76I*{Gc|N901W7(XbZgtYE@X%&WbVj zLiTNNAG2bd9L-a_iV3uwfYDl6%JdLR1IJ8mXB%Go*xGdkb&Njrcp z^Ow`o#-I(o2vIcTX?Q0)22;`=rcQ!8Z*npYI)(daNxAft-eT=g8&9Hrrbsl_QhWA| zWdUpn%^h2h1I`o0k)dG>4)8gSr^u_jTYZ%=#@YMss(A=G<+hPmF{ zXue>+X8wb*Rh*u)?wm-Kz=t`HcCK<><`c@%6R6VNl3RvEQtbD!SFsA8z7s=ZY4Pl0AcSYa}oX^`a@44UPStp&hCw^nr0J0PeeL(x`*z6mT9FCkOAg;ai}-64t$~|`fwl(nGJz7XH8u9?K5koP zsMROn#L(C}Seu$LW}Mr3DN0L@mNj^%!1f8@VixhW;G3dxrO=JTD|J=dPSbC#%;5pv z`SW*{m)7xQj(dR9c|R?z?JelQxR>h4U6)?(|GrTfpf}YmdA{)W-DNrsuc*2PTK!!% z&7I4_d*NL+&(`3XH9Pe7;l3PRqfonS4f*G{_9@rOwPj~@@8LDL>jE9#eZR9sacSv4 z(F*+U|F?e-A3!wfhR>eoC*JXJ-TpLpzF~i(I2}O?zx|%Q+>9@8+8=9XJtU68t|GHb zSzr#E7ML~tt=q>B)v#*H34!5I6UxAwsAec<6I^#^0;COc@nQ`T04YvN`PYUqRw zs=CF&DNBZ=kFb2yVBx&!D4Y(OQJAEi`}K&0ou=Aj=RVtp3xj))`ng%Q@4-x`MM#52 zN~!Ehl%~bz!}WXI+hrR*tDs`_V|ACAp4QcR@k9d}gd0~YVVZU}Ul@fumV%H@gzo0M zbn&;iZS(VSLyfC*R67cs=PV2dgUv7G&1U{U`|I`fatQeJe&hy-|IIa3C|D4pC13TpG=PlMRJ zHf~Of<7jqC`3_7M?3L;c@?sYKL-*ggvTL_FZam}hk%I*@OYbn<(z`UEcZc?#GEeUT zEt!~duGyMY+ur64ho2Z%I{(^Xsy=z=3T^&vvpu9&&0;ugH=T2BM_#=!*jly=@0`;* zT`C7B+;x67U%NGH&NSME7QB0|rf6rU!!GDd2k~S%yzn=F#KDC{hXw3Rhvi9%mj7iC zRX6_=qe=J?(55E!%jSicU=fu@5i7I#IQ!OnYRP|561mqlk0e)<%#_IAJjg7K#j3LN z60qFE&AY2HfHf290WZ{&LraxfZ@N~g)TVp2igQof(yMjlhiU7i3Aa+Kr*1cx?^NRD zZA2xv;-|Yut@O4B?VzZc^yu|u#hY^uhf8C^4t)IH%zDI?pA3NM22E6_KFV}y`U59@B zTX#%v*B!Mi+xEKPKK*++Gw$l@PTxF-D>vQoUFLJY+rL98AHRUfKFH6PPPoHS^3(F=fGW%RX}f7? zHt4^g91rKZ&qho6!0D$q-|%Ofw@gp=^Zba(?o2H%ipgf=Of>7K%=d=dCTHe4!yWxS zD+|kWy-oA_vj65cBzBJGoCiJa>CgPtr|FlOcUsABP3z_t0aEO~dVS7JzOs9OMZD_i z&)7VEJ=x>UYpypZf2U*4>3@7$FPg6$SbfZ)hiV9?ZMX9|7@5V_hIXmUs}@tLmTwyo4i=GZ+`5q9cz=D@=i5=cJI9Me&)w)f5ao~tiAhn zinWER@%v_toBTZOLrj-dOkb z4%_NU#~hlz+8?a#bZ(uSnxCJVo15(SCl5X8H+Niq zXP-9TW*_DJqO*Na968aNIF*WFCFe(_Pq>dJKbhJerJbd74^Erq<%7FQOW@PY_PXuu zi-Wmokb!eh#ZV}=a!q#MHL3T`B$2HIkg&9T*94Gdn*f4HFc`wEtpoxC<4bYEd132p z<%;n`f+WU+NRLkhm6tTL7Q%bAn@uI1<`T#nd+#5JyS#*F<2IckW6Ap2gK&l7NQ?N#`uI>(spfUtaQmW1l}NODZU9% zLfhStIL6(I6xtxnQUyN1TwI+IMlCURbeLak6h3i1$QmRw&xbitJpu7Ng4QKetA~=w zlk6jztvp;MB1n@u7|~Zdh7Af|5=%ue*t%kR6c$DdkHYMKxPXfF7e zBI>02agi)yogkk@DWjl%C20u89vA>5^kOd}Z57jIt)=WpA$0+j5>8P;QZ6GB^s}0Z zse_S<`BPc6dFD`G1I-n*Ytjv|bEL8ZszMOgqTG?WOCB9sA678h1r#+1@~B!XS0~UN zi6Y^@{?)(&L*qo*BV{KS;30J#Yl9%TUOAeKp+pI#09(; zEj8%?Y2%d})vV0Z&@t!Ds+c?9SR#HQ#UvJSv4^YXrXd-P|f>we-9m~WwSl9p{N~+ zQ#1z@f&$x|<2awkFG2pwJ~I1Eu6qaGF3@B7@)%{U2ah*2E2AwrIWa2LVJ<` zco?wlsm0U{8-PfHB*dB$C&tWSKVV;BQsxaZjM3Gd)2MRz?$W2I;`Z<6G;>e$NBC;5 zFwe&C{|fU1^Aqz6vx&8UI#14oGwUolBju%Xfc63yt%J{*qJTGHo#6mF!FOo^1j33) z>DUwY1_dCE2a2LEf~xsW2&Da7>B!+g1WI3`J&F)j80A3ph;OKmHmpvXJK=nsJc7#$ z&f|>HNmOPW@1iPNSi_7{tv*33L{xOuntrxJcP~+qs2{DIP+5To?A{8# zBmQ}V;*hkYP72%+?Q9Da3vJ&WDvH(yzAEI@&J%oLkAjz5{I$B*Mi)z&AMFKVlegNI zVK}GBqv{u--=Q``tIt`U@aG2$I??QGG#bCMR+%8bmWUD=fGIWx3KF0uP!Sxwz!(rf z!nx+35d#IP6jDV+>O#ema28_Iq8u4z!l}|w#XrpjDTX>t5)5ZW9XRhfi1`sV}qSEgzM)QV^mLL4iCt_>!FuG5`J@v1>>RXS~s z6AZ9|Hg_h+EJMvkGv`Bo~v4vNFqS zs=+5OH_coO*h9IzO}JTxvVk={8p@7Al2pc44(ejL*7D0!b>e0~vn7Hj>{3Sr{s-x$ zothXRNQ~40k>(qidL@lp(?kQ+(xe8;Y~qkdE^nMev@FDs@V(pxWIY4$X1dvrtDRmH zG=rdna|lKv?>%dtwihbh%sfi4^CZL4yBgMBW}ck#QQRdWDX5wT>6Ye1%)LC_`zu0V z$}u1r0PPaU2Yy2hP8~N{_&68Otx;{*uWs|3ZNI5PqD(3=b7cy6U^|w@;H-TYcYsptC>6w(;SV=CGdt9TOD0OE+uB;~@Qbn_KL_hI4Bf?E+-r}S38GR2nL zd@d>z(-NgSSo;jDOUie~5mB+Ae!vwe&H^SSGXrEW3A>eUS2c*)$9#)gEf_|9at5<> zNMuZ0wz4SMwzb}218tEj=xhTnDXc*|eE_BBtw;!iGr;-en&po=ehzy-jupL^yRYr7T)lM|Kn z*N1-f%R7GY^Pl|ad*8kFJKy@+mu~*-XFmOjfBM)*u759ufrV!F(rX2YY0GO}ebrMh zJ@JI&k3F#e=p#r?Ti&^Zy=kTw_@(E+AiDmeAHDvkKZ`!`@sEGvXSYQ+-FV|opT`k# z%NgFuH-73vAM{Q=`IayKuOJ%++5MXJQr@6|)zMq1Ljp4+k)2d_L7IUt)D+SsfAYug zCa)j<`>xu^{|W5#KYnM7c4k2JQOzkqq6=VMkm!fuhXk;$@*Rf}fexbqjUkBcRD}M= zPt=8DydiovMoQd94WN5 ziD69}803YA3$qPmvlJ-U7 z0~`?EN&452w+b+R13CZdEeJ(YiAwJnRVJQ%haz`W8pBtpozI~c<0 zWhJ#*5CX`cwU-b#tY@&eDL2}8S{pgF(n^v(VkW$eAQcBPN$>>}7hsEWOYp&R$a3(Z zDUe7=Dfo?(q{a7rFnQx{+?|@57sF{lPW?P}+EMvPV8tk%oPi996gde}5r##$6U30R zO9=MoaLOkuE1)CmfCFw<3lDp(Vyb5Q<1wXB1r0X7}_7;LjjEqI{W zRrblH(tKE*XXLb+7Qiz&SC)?S|>A?#7kS$AvvO%A7V!tHw=@?is(rWN* zUvzn$Jgau2%4n8IsCF1f{yHL8FdcieA+Ti3!u4Z)DA@u%UnLh>= z2VOGrJYPIvTsmh4r?2e-nTqtD{zy6Dym5(6s*rH;l`svekbvyY4-^MbUdeBiY|dGy z0reF7fQ%meI@CNdGETE77GwpgMA?PCL&%BEI98G#haPcU@VD)jglX=DeK|JXp z;IW+rT}vGs{PhhYaw#Sb%%KEVMK*D;=$RkY+Ma1mM}u;^L2a2D@}IZUPwF`4yOh|; zJc_qbSq)iEWJ&rueC6e6eys4M|nk>0v)wT0C|Fx!k!B@Q$| z6@t(^Nbq9-Gk_-L7TKm;?fzDDb1ciE4@z z6ZN`H~Q(IE8)C16Tzu z$_7L`ITME|gq5xkX42RTp8E)4P9>{Pg7=hz8j&H4bCERzjt+TJ@-TDIAd^D@1z5O3 zEEyPeK-?s>9p@RX$J?9OX{cOVpM%zUmty^5n9htkoKmTSdC^?g!UxzPpnF7B0(&nJ zh_N;T%Lq_#Xih^y1xb&XA*%;zHt@l;x_xa##*9w1^dib2XqvG0sQ_ z$rzeDNfA9%l?h65LysA@-lrmlo)a8JSET#7DpSorFy1H?+n5b{T-A=^PMxB-UU$x* zq3u8NQBY!8t4MVVvl+Czpx2#*pce#J3>$*JSG{ha;$k>#*Fy!R-<{2OgsSz8T~CmG zS{^t`_6lb@krzA75$0_340DZn3H*T+NYOT^ zIVJ*$Jwtc{2U%2GhLRa&{zKCct*n5=H>CsPwTCugV$e;{OnZHs8@6l;B99`fkY|2C zrdA+O`dSlOBJ>Pe7SM(j0|QH!tl5a)$P?9f@g|$%EV9NIbW6oF?eA6$+$#zXW(0JW z?u+h845XjrTk=fHnbc|CwQw;a=c1X=V92;E5^XFSN}9z`rQt#TZNGH0%;|PMlr0bO z1S_EkHAxsbUT%IVFN;a;Ql-(Fh&qZT8KNQ$7Oqyo zrTh+fWf$x!a%+ePW>knWyp`n=2QTPjZ-o&8ARGa}gnD{d!D#%BbEGTgV0+}f+ zHcg59yhcwUhIm@?SvNIP;GJj0JQ6C$$qEv;D9;XFsG@WXk2p{a1ZD8xi*h^@v`;}o zuJkxx;baZrl6s+jb-J9?D6ri=meo-0wJJsl3FP4fg&dk-X_T{W&1poyr(>fggblYq zip8FYDmZ5v^%@vpfH$m&%A_+89|%TsW=93GIpKR#Vb%?(6T(umAdC~ikq|fKR%I|1 zFT%DgDv`%wL5zLqH!sb-EXk4TgBqcQ0xd5;LR5(ah^||k!m=)_gYTc=f-5RscM8Rn zOiqX%XrNGYs28&#vgywgN})PUd}otTqKzEfa!$pe2oPdtA&Gk00<2V2F3(*So9##YZ7I9A13lN9Vn<;z^D)0E+1>Sw1*>1n@DmnaqmA!7Bsu#yl|C++klzZ4m zC5)*tTpn%mi!Fw&cir6-cd*qm?xTttCHpY$`jdS$@Ce|KDHLH*)eF9F)#0$$aPbO& z>;J#lB>vBWY$~uOyy3$D$0};Em)GIK7Aokek{ZYIQdx~Nc&Vhuy?Cj}rwUuByv7B* zF68xKUJvE&*k+zUeEuZ;==!7 zd&sz2hs-MiT|S=I;VK=c@VhE>s7}b;c&S#%dA!c&bw6GYdFCK4z=07TtiQGhEequ85$v!StaM zThXdjl;qP1krL2lcrpmjcZvYgNOKq{K4xit@+!eT9XWf~g}YF|_~Gh|)P8T{94;h_ zs3Yx><-Z^Yg@M${p=21TR3lZgvR_u95d%lhLT->oC(aIw=3(?jvsGZOLWKgqLbAc? zs3~~-b!JggO514`VGV4ea8)&A*^J-2(X?!i>SB6HXu_Q}PZbW(YJ=xeOj4 z%-vc&!^B{MF5v~-3BWYQBaFjd(x{M}KnAR^~h@G^(T#4 zw#CB{P{|pf_gL*M8w0?ifO|zbj#E_YsNq+eP~@nQ?3_jK5|_cvZ8`w&DnmA{J1ati z^f4nvZd$=g)E{Yd zlt_WaDB%mN87e-ZSWq0M3u-q}^hw-=qn8`eOw94N9L5gl zN65%^CryFAfxwNbGA2HjY@v$))`Urgv5C}eK==d+26=;U$WN>;38RSidD=z+`LrDb zs+)&XDUgRM_JnD{Qqx{x3cM40;w3%Q2BT2vb4XQ<*$&|XZ?^lHS|sXwSELiqSL48d`}2Q+4a z+yFeH2(2Ocf8>Ig7O5clw5sDI{^IWWVMMGT+fo{Dup=lYhQ2Z=$h47ABF%z!KaF_>`MOI9V^~HAzz3%!s9+!`F&Hly!uC{LE4Qd;OsWj6B+be?Z`S}! z!6G83SSULOC6`6KkpE}5VX&}Om$0;NeuL_tLeAfYnPeV=1F;sIC}=VV5%Ct~L6KoBB9YyKKRpt-JD6sjH>y;^(O1zMGIl0<# zy&;GIEXdfF=+Hl?ZBl1~W~M2^l+{R2K`|?zkLs8K9zt*3#aXHckp8t# zdj&?rJTcgE(3cS_GpE54o58#%#{nj^bigLSF2qDR6lRDwAA=uUaX-3S;{<{M(_Txo znC7So)$+|b)U}zWE-G6XbYgZdOJ2jXODXd=_!F5ESDBxHB2o>-4EP@D6e!(|u4)w^ z`k-xLk7QY^s9$gjJmADk(Vv60ESaG%Z)C@nh-2)RBIjb~GekFr(A)QyptYr6!4MP9 zSKCaPfmt>qbEeZJE9N-oROg<~1Ds39jd=o;cQ_bwJRu{<9P8jo9j2|s-*E1cza;34 z2GkD~Z3PPqLW7}%SR16JG1V1po(-Lm0}NWo=RoP%7&+|9WK4vV3c#AI8$=oud?Jw$ zl6E*MN5mGJy=V}o6_u5j>4?8%1+s7Rk;tU(Ki)h337a>lmUhPtl@uOp(hi;Whv zmKNXyvUzXGu48!LuUkQIfc67K|kZ8vc!Z`LOau>oJ zl+R$?VLns>1a`n3dORlgl?|ZEB$*yiTeibk*5NX+3f?E;2VyxtL?*^q1E&~li1EOB zptbTmY|V~bm6-Yu^ADs!SeELt;u@6cObw4^@H_blgdK(vtgwEPbXid>_|zxiyKMJ7 zPW}T;6lQw_c>ZKG$gH%)1do_Ni;lOkE;7G1!l!@PM^lC z+PHErv>jF@Es8Jhb&sFQksr@^_Ukp7$zm1ns84@7Y}f-r&K3QkTy?m zrn8f^Feh9H8Yt3+=_@ppgXNLrN0JqthC!gHQGI)Ph1(Pc${?5^s^W%}#H-{Oq4_hb zM_o*3ttL|?gE`mXW#k8As}h`n^AI-;L7DKRm^dhE#=rw8=m!;KaWG@c#Kqhb3?rX~ zWoT6c)u;9=VDEU=6kr8yCA1}*PAHp#kJg$SnU-!+XE~{5MLbKHmMOaJo7>_rqNq*Q zlAf@+JSBmj-jFni{0eug4WaNv-b_-wxc42hp_}%I)$nf)@qG- zf+}7vniaVOK zOh5=B_Nz6&2KZh|u^(#xND~UlLSnHOiA)Q9yWR|gOkz%`48r_lVMB>n$S?>j#4EFc z^a+SRI!5_(O&j4myw8>!$=%=+XUej&Ui1MExDJt16kw{*MkcRAwE3)l)JF8`DsU{G zWmcIxnxe@^)GHx-jQzvWTkaCKW&VbbR)t>36(yfifei`=_Pb|@xzDqI{pU~P#o=)AQtv6Hi!MCQJ=L3^ZeDV+7yj&vAA9f1{P%d1ANkX( z-4A<<3$s(*qK+ci`r&8(+5Lfg)|vObn|JcJ{=z*U1LX<++3$bb-~6@rbayhT-u#7N z<#CTiS-Sj@=1-n@nK`Po@8~1kwbJ@Z$sBVye&|54Z(I_Q@7AzK8AM896xinUZTzc@ zcX|<3WZ(MlV~hS@?0J7U5NIn^;+WE}?wTs`D{FEhs7I_#?sC|*W%A;ya*2zFj``>w zI4BAs>@)~r>oVww(QK7S9B$x|hl!#QiqpaF_#5UrmQVzl3(q1*2s;%8&k2D=^nfc$ z{-6<<7|dVloc$tMu|R~tRRiPBVR~|rqq^Cq646ZkWIHM$$Tlbc=4c_(L8f zWlz9uxkA<`H7x6tqJX3>677q?vSAt%#N3b%&k00M=9J?7#qS~&o0Ke>Jo30UA1x=8 zJdyx9-Ike!(nZ8yBhhk~FhjT;$3;0!Awu=u5fR7V<`Qrk8{wIpq7+IFp%zE*t2M9L zA|4XS-47;keBh0Sc+v({HDDpQe{*VG$n(rS_>%F~653Kh&Cxqy1=Qc#wOE*A*0c$KuA<+McY^nhzcaj z+PrcZ-~37PhB~Ef=F?QkIhlC(FO|Mt`USGK^257kk2%GhY0d$3>Vf8w6hwT!d4(iw z3=mfML}F$mX+sZ&3Ql3Wvn%+Rv=n}_Rd7IJ#$=}=A`Um&qX0yFiL#Qb@#z77D3>6c zj8HTjg5=JOWn+u)EJ>F$!YLUar=gsNoReXIaZ;AgapEx6j6F7ph1A|Qc3aGj($+aI zR{G?*gwJU&50DqzD^l?#_-(Lfu?}$FLKP*D1*O>SNL+3Qg#ysNiJ*DI)NW$P?N}@U#OYcm}DJm$igg(~wLe_AmPc z&UwMKja$HE%wK%Ejulq}$Gjm+#p;N%7817$4)t(sAYL;UWgImG7(^#jcuaM84gol* zvHT!evMp8f6Uhr{tOhWonW%+0^LKCv0eNEIJTdDL?1r{421bZMm2!OAO~4?qZ4v=g zAWlvpB~;v|b8Nej9W`0s-XX?qy3w8KBSjD*jxJv75c!2Qf^0bm0N80n;6>m$)}1Et z1{@k9nY$q9xaqdL17oPd$W}sLMkuJ!=Ni`6Y6|h-;grpD=CRbqOMKg@m~+I&s46WK z0mvhQ;+}1s`(ZW0cMI<)yaul8?qS5hSLiSh^<8czy2ZpmS%Pg?5CU^bT;<_>sOiKi15Ozt4;eog2kA4=iPYF4YpJ05`Tp6p=;D zlflR;1pJ(!tTGbT6!NrU$}333!7$mLO_@1N!E@zC)~zCZn+dY$kmI`5N>QFaviXi| zKCXB0#o}ycWn>~@J*jpmY7s1BQlVFD6a2+fNX0PD>M1NuUa^R*aruyHvp1pP2-B3@w#S%zXGMfvUo z@g7-E!}Dhp0l&_(0~`E-U|IN7dBszG3Yf!rmPly6WNxWcFHMxX&OYbn z(*Dx%RQ`KQ=|iQDgQan!rCqn0XPW1kmzcjWZ!&L%RzX~pyApCrI47LUD$357A%`jt zK*X$dykO$9yiZ}bkcLsQ7kZExfUife7O9SCq4R=q*b28pqqPhY+BQxL!LSRZ0=eI& zqKqRj)0=y<`q76hx48bMG za8V2)Bw=4MAM5&ieN|8$`U8jsEWD5tJp*Ua;g}Pskw}p(bI9+~cnhLi!ZzABv<2CN z&*AIiki>jb4O ztwlYE2OBE!C#yJv?&cM*fVMT`SG5N_8uJq>jgHOEEO0(y->y?%Y$^v$rxk9+~W}qLT4B1 z2LW;K!SY80thbZUtr}&9&n8fov;czr(XH{!I6OBmCr|}q9Kf0Z#fVCL()O{sC4^Z7 zS;d+H(0nNL6?8~sr08QJXofQ0A7FnJALRu-NCM_ybWpm57IIW2bLVhXag0cStW*Uz zuJh-)c`s`t3`{h={ZZqndIOVO-73OzB{7R>1wLTax!A+^ftA+zXQIR?LkARQGe`j) zOD5tz_B{%uO-*FI2!Bc?&1R-BX;Q^6P7%<2L$c1h(DTj2W&zeSvWw!)qIebyWSr;N z5%YMsgLFsC&pr{vnMb4tu^Z*MjSU(DVH|WBQd(>W{DrWUM!OO5W`@k1eI7?0D3LLN zC-Gmx#;_@%?bow165hR~H@Wp~ghA)Q&p_ECQ3yU41(n5mh=K6zT$w2K*==NcRNS-) zYHkLZht^1?E0co*D{PQTS(%iy6qj-Qg>x7@8_lTRP)uZ;pq@%m=T95h3GYx$XN!F~ zElV@EY1&1(B*;A4u&b3Ou--SOsBbB|JKq0O1p zsU=cA;2Z|jG7)LQWdZHbfwi$4;s0J6VfZT`TvB2ry2vB5fzt&eX@SH75ugw9 zW9ivEq$TO76^!Gcu>dLnnuI`I7D77091=yGGQMbt15`sbAfOkFO!O0RPR$Hd8IYPf z424@Hj#;v|QLL*0d7nl1A&2NiP%4*dAoK(gkbI&^R>YH=bzQ6v=u9=3wO?>X&sj+oHOPOM-;ge~YEJ=_a6jO%Hr-6lz zLdkJ1m=v2a%-gzwO;bQoIMN`Sv$?To;n(dDIdAQA$FMO)5=b>DyTnm~9gL?y!CUxg zoGgOQb}^=LV}){vd9V}13xv*_6}n`fjfuYn_Ddr-=e;3D!;DjD3Y|a1Dg-i`|9d*g3Mus?DrjU4`M#qc6psnAO8-D8&Q76KqwvJIkNgq%imq$l2}2 z+se~SF#%eXUnkJG+YNd%_-$hBCQ#csX8nuUIxA2{j7g-1f3%iHcrxf7>2me7R$xoC zeI?E+_Lq4fdK3x`1h=0@UAl}{nF$A$*&)YZ8q=NWNE_7g?Iu-hP|%y#M5HMYC#Og~ zcuj?Rkdurwf)H3!4_Mi)qE5fujRdqgJv*}lToaW2Ca?uNZJo#3?chq`A`{dM4At zOpP@8hOtQSgxQR{$B!F@i9A(JwbF%0no{VK3mkDMTR0y6%einHSkg%Ni9zyE{ zZiz`3B}PTI-Bz7MC*~ya4|X!NCPHf&j0&bwiU2{AMrb1>A0)2qO*_pTLMk(sXf^Ik zFTS6Avx-MT&UDfR>8LjLoOzI^#>>+V;iipnhz}k)uW0X{%O`iDDlw5<6BF;Wau?95cNXriFpcs8dr2{_C2G-f(xDy^hN<>*Q!Zu^tegN+ySxIN{gHZ&)3MQk*; zXU;t^3@E#sOb@^`j$~g5%pp}&o`bAv z`cWg@&(#&u+__Z=EcpPd9-%#XGGKF-{ccenR(IhOX)o?!GcqGxFhuyM;!#Qg#a$6V zICHvQzD$NS4lJZ8qvVIf6RPIDwgdke&wrltNNPCB4}jYWPK_7N26JmcD{7F9D>HfDl#ti*hmCI z+0J1q%ogE@ztL#7m<$)=F(#jNiwdh0AEKzp?O52Qua;dh6B@Ycnyqb_1L+uDUegaM zO^vOVdKh1$8HX-VhfA}szQR((m^I>&bW zm2f0u3w99#95`SmOL4oVxB*GN-{l2WT&Gs{U<<{>EaoVhB)cGf<*12JC%lcx4A=@N zBslV1O62emoXk83i?=D`pL2@nBuxASW=&9IYZ6@_q0`-O%g)9HSNR#sb>$MLyA z6jCBkl8J%AFeJ+p`ZLn6+Z8G=rx$xX#7{}DzW>k=&+VCLnSkPw)B%iuKrhhZ9lvFM zQm@^VRhxMyt1+vUPQ@2(CCmm36nT0%d2pcHlE|do-|7Smm3So6Bd-+8c~C=l&h~(F zfD&!dhvIKhh9s8*BB z*2SfXF5wXqpb*nprqCv5;jQiA6@ZhP40QULd=7zB#dyj!cbf^j4)Kf-_n?|#+AE{d z=hg0Hxl#izsE!{LN~ovBd5_s9$d&N{tUZB|bvijKnQV6_2B!Vg5tgAuhdaI;jiJ}$6<i^#d+JsK$%Z6@}nQOMSUzi8^^5B?Et%>+9SkT^pd_3jR+OyPY7qR zF~mK$cP)1g;9A3-Moeqm+JA7VE*un;#UcZ0DQea*C;?;+(zfZ!lASJumD5}vxawhybw+|F;Ou`{v^f|N(gf6oKTM0oOvYJTxL8#=pNJ}J{B6;TS zu@s=1P<%-mcB5pyniA}Rk(Zq+a}jDQp=`3tmsNxZ(t?QwexB#fbb&RFKoQ{lNX-Pm zJ85iwzDidBA*q!c0k-Ra&_^T;!XfbSH5IRsgDVH0Zl@T`u#>~@V+1X+aU0?nEtHeo zJR+SO5Di%r6V<%CxMK%7Whi_&397xIXp)YO-~>&mmUo_kw=S++FfzeJcbXD>xo`vs zTI@ilDUZ?xyv$$PMvhnT#4<)2D3urOE`zqhl)e!W$5%Nq;%v}FiKwZ|)RXK3Mhm#^ z1;0A#gw$xl>gF`&i4zC(KAWB7C{_seWAc!A@HN)Th)xJ~gk5A%?LxAAP7xxqU@<5H z@zT#$Nbn^29|ZfXxCR5A>)nGiIN(u8l)PJ&tSYTd?7stfjm>XA5iA`E3LF7g|B#3-9bd&5+w-Ex zU~U0lSJ={Qc-q$y*9i(aK8O%1X9+Wg2#hv3|2q6!BK>N#!PywQwmBReT%A0g&v!I8 z8qkSUj<=oyX(2gdHy25YL712ydj>h?JjfnXn^`fi&c-3)&OBxe4mQdtwyUvy%t{Zk zj!U$oed*+qsD>1#)#*pPYs(r1O~Q-774(*nxsX1~POf*buZubnO~zzMA?IpYxQalb zjG=u~T}Rx55Q29FDdEu5p>YxDu|un!_^E5kbmWrGq|f)(HTrC0-1Zn;#bDsJ6jl067#gk-~s#jj&e7@I~wv z5pJfAwL71VL0d#yRZx{c;t8)th6;~Fyn$XJYtZ8quPAPRawOdpEFs%fyb%aRXz(Fc zE+`#g-ilB{3Ic)2=^!DPh}uomYDlQN_7qU5{A#NL#}*$Rk`7ZL_hXgD=?p|PVOp3M zTpWb2)p|&h3O(H1l-;>TAwe7vP7}B(V!=_e(9ohY7!;NT^9a=wfdYvXW6;9$fDmZH z&07=9)YL(xPL>2o`A!Kn$Tk{WeMvk$3M&M0q50!K2BRMf0wHONBLvteCxpglM!984PC}bGe__tJ|lv^DpdTzn8BmtUccM*>s5TO2!u6xSsHDU zUogsvjuLc2|E*j~h%@Gcb~|g#?TV6SIWJI5`=(xm9x8EA!Ah(!_MB2FI47yBK#U*A zRSn|v{A0Zt&z}w|y*Tk&0Lx~(hFxV7m+K+@3o!!oBs{6;%wjmWO+YtA1PeomGSkPj zMr}q0dR9cPEE_#&)&xgJX^Co95x4-E{L;Ts$Bp@vhslIxM?`d!4mJw5UPwyKIlP68 z=oDBu*?6Acj^SarEvTw8q95>~;A&PWMR=oTU`o<2xw)JoY8(goGnb8BKsK;7=x^UTUa5XLCA_K zg;_@z-H2KzM7vS@lghM5gi%a<_x!K#piJE-O7|~aT>7KZzks*cKxDh=;2X{6pcU`;OOr`Ac5r{rHD} z_ip$4>)v~@`$s`~-hBfnCDmmK`DrU;4Zy42hipKa;U{^dwd+isoKhgLb|2CgKgJMP zhxYy9RLcMB71x=7{Ktq_!Yk!f;Z^0;2w!s_X-}$A&n&csXoC z`IfM6*axggu{mqjS_+#$fM1iP0LBJ4MP7%A>xJ1MkWi0NVcIgvTq%pR22UlZA5*Tt zefLU0;8_Y&x12N}NMEdb%xXuH|7nfyIYwgzxgm+H3)=@aDhC-wG1_qbVg%2Eiy?Es z8@Y$y2cwMzhGfNuu{0pN0S4|t9|Jf-%f^1V-xz&Y)^3#r$Js@5dfqw}32v4T(#t1}+k(7cV2tldc1w zB>n@y7Lud*@4)Q1E}A0uPj)nHztQgLI)S=$(_5pwSaYYpKO9a>JnGn!6R>cqvsplR z@iBzk;CEAiQ$?_SG&*x+TpOlGHwgKub<=1PnYo|fV@5F<{S(AM!R^!|B?x;P#^vW-RzPL82cynC4VpnB=-R00(8BLwL~0!sc5#FWM$zt zM>Qzt!UBL-Mnoxt*Av8*bLVD>ag^;ArZiE`u}43PB213o0M|3}gn=bRBvV|z{y`gA zl{xG#GF>95q{1XAdCu|9P3A13?JfXq_9^BW<~io2$lb5TOSCt0`hm1y$x}K#h`)T3 zWF--H5NhMI&ym#ho(;<5DDnHc3VUD?WKZuc6knn@bt3u@PD!4PBBE z17SWX;RYF(FRY5zKP?qN#6WLKli(qPHC}v;+8dlWy+(+wD|DuvpEMJy z(;Q0P*3sf|a?fZgLUeRp*aGMZ9e^)x0^E*V8-#uuR4+NxXd*a^8N&vR9Bqau{G8~u zV5I;S3c68jEXY^@T9ih??Nm-_Q6xtq@~Ci*_qxEmZA1Plldjyx6wP@G0lUPgFBQAf zZ4$+Vov4lfl0(}l^JY+YhC1<`D*3V!);Kk0lKc#V5s&Clk^qS$ZM!bAw!gNZvC zEntt}#Bg>nF?k)+Ez3{Jk;IuD)QEmSmmmQksetVjWr!6>OCbDEH4l;j5?XEApZ9mc zu6e%(*~pssh{)Q?ASOu4s$Z4JQH?2+NHxM|kpcan>kSaX(>)-JRwt%2`isL_br>r- z32ZU-eDOOU9}y{t&5|Ne?QO%QD)4rVA>_t@$y1vVc&UkJ{3{HIuNV+~e~ zjwGB_(FDrPx^o0J<;37h^5!tdC^J4+`ZF^A=6Buwcy+3^r-1g?%$~^I)hCmnz!pGJ zxB*>ZggL|a$;_J|YIxK64u0-iOFt^zZcaS-=jM((4*s%q`)xn_(GP#{y<5L|%NPIU z^B?`k4}b6j?|M*KKrbbPdefF1IO$;daXa#o9uR4 z`G5W5=Rf_AAAkS5-~RHKZn*Bf?|AzaPrCexfBb~UJqC=Dhd=m1f;&0mo~PgA?x&u3 z!s^P-rNtqsF;tu@ebT%78(%-g`)fkZ|LVfvv!6LKXuR>Y=1p&S-K)I6pt#uUUv!OW z5VCxyoJM8=*#(GdfRSz?hU`A{e-*g?`w#zclECl3cPn*ZSi0k`sRMUdIZ44bBE}dg zAj}}>iR2F;all9zd4YmL|OLC9qgU`Q+U5W53SBb4bGd_iaRwILH{NJ}|326`n^ z13$!1LQB*~F7%@1pWag}%2f~R0j75!~ml8?C)U3)VOGq;|bNuuPBYjk>( zn8KoFD^0O6VvNK#I1L1KU#LF0zqq^I7KF;;iACcX~4`LO;&*OjM6e?kwNw+ zjD<5Nyo0bE7xY>_k zFU)KG1Uv@6LOfujg8AL;IcS6Nwy7y{u`7)%9)R=TY}7XJ>>B>A!rqVZ0LA3kw{B}y zkY6j=bQ7{->cr7O&L(P34HHKPVptB#(b<9@XS!$6X!dFCk|j$P)`l$G z@@{Mi?_j)OW3Y`A7H?o|69NhQPH+foh($ucU>+f40TRgal0X6>0Zf3f1V|XY|G7OQ z$prGk?=2qpsHeKR>ehDdIp6utcaR>=+MzT_o271NHDbc2otDha?26 zn!Ry=cr2VhFaq@Hpv;x6)VQ%eY(nUz4<(^AP_b)QhrL=Wj)_>Y;~i**vywt_Kk98bI~@vDj7M>+qnI%0fk+o#kry2RiA?!P|q^{;*P zAHVYDKmC*6|L}*7eeeUn`N*q({o#l1dH!uzU3t-kyLN6J>kSVzYt^##!+-haH@=31 zF*f9nKSJd7!FRvym9KdDLk~XVx&!<7?%1$yX>oRDdTn~7=R}6_%C~e(3jSa%WI662rkd?TE}Y>FOfbvgO|u2iPX_~yhI&nAb0eOn%Y79YV!Tn zSapK;BBOMem#7cPb}!|1IjW~W;&@9``N=K+=3rhJP*Fn7fLf`Hu2 z1mYQ^3M6DIY(M`KCkP}je)znQGD~8cW!K^?&*6_VgV@-2a^_nNnHyN5QFr!5fFbM3 zN_xt0BzL1)E?+arAf@!2V(muOsQ>hs1pCB|+5i84jHHX`_& z!4bkkLKjaWGTMby?E*nB9w7M?sTGa^h{@XH;b9)7S_P*WPIq~-mY$D&5{q;VAXAhF zZzGFRKIAA30#0iQMcIR` zlS#$ON&$BZfdJySV7R#Y%nX$(HQ-s4Kfz%m(Fatt%W?3=@zhnmZ9Z2paXO!{Rs2E( zgp9qamJ?n!$!1b@c=c$}$?QSp4Rje(cvD0bsP9)qbOEhe7z9PscHm7$tQgRz$q3vI zTlD>jyj6CBD0OBoo8Fi$4%N^|9n&;MVs}>&T?edC7*Duh8*MvVz3nOj=& zXL_}OYH%;4vLN@AVmldLiA-P;8YjdfDL4_rn&|PjkAI&&tH-E>JB|}G3-fv(%An^P zf3@v>%wRuy;v4_)r7wQ|&p-Q_Prv%tf9;jO`ift9=*lZD+P8Pj*bo2h```V}x4-qx zfBx#1|K@*yH+~4&y$`(iJ@0{F0?}hODm|+951>krJ}t*r9!Tct^4furKQj?)9$YQ8J*IkU zjM=3pv&-1yX%XCW|AY7EJ$_6rs6{?nkdGGSqshTX6N9Im>H-SD)8*UaMMr2Y4?toDAf=!Hjm{U`9JfU2tMXyFkxq7s!lufu7N9 z0c`}s84x7ojYB2|qpjf`fD|SSCNx&-$sd4B(*{$Zw)&vB1Kkge;{rr6F9699l=LND zh-Lwbm_#J!slgyN2{$96kAw^dpcKn5#@gaeuJmm|Zsp3cj->K!K%1g@m96$b&^kogO)BN^PmJkk<|N;dl_w}QJq5;mhw&b z!K?!Hh>4M`kZrOSJg;;qpZ7N{-ejoJ&hGGCY7lB!@t3ktRsz!I+_P z1PH}Z3rbZ2EK>>yU683XyYbLO@*O5b4l`{G*`TuC7B@@J7B>S64pfUN9@tfl5kLjl zaFVodSqtPdN0qf%C`B=HAM_z9qYyhr838R7lFfO_<}%DFBqb#qOVhT!DBIQJw9h!9`d-Lcd#@v&CeS z$!w8wts4<|Q2|~GT322TB1j29t>+c9kXnL_*MXzEj^rv~9o3B1T&9j>3$#2qdfxK) zAWqp4J2g_!mzjY<&oe08IWi>n0JMXCu?44)9eP83rRZ2*Qr3YW2No|&{9=D^Zm%NsFF-4Vq*>6 z5SnnV&PeP@+^AxdlcbXS3U#e|7MzZksb8Z`@=b{ZRh%WHY&7kiN0+;r+ZcC}+g^V3 z-R#Ih{8T|6$ZNzc`DtQd`k?C=DPs=tm|V{ygRr(uB}l@!I*_ z=csY{V|1`NjWGu%oQk5L>%8RLf5)33z2Z4m4uyThO+2oAp|lIf@+_ExmV-Dn;wB!o z%9IGCkx~?9SBT@fla$Q@g?(urR6$7sRN+aO2c8MNf+aN}0yN0XWZhpQa}5Upjs;IR zscr7u2&y=D8I%GJ8lCEb0S6lfr=Nq?;CnmTBv{bt=RZ`=fTr14lD)bB879wB1~eRb zL^>UEUn8cOLOI4GKNC2eFvJkYXy*GaUC#2fW5N4_{DEFRsc(>zbsY2@D9J32y>XG}q>IQj z2l2a;sz#zJ_Egi7ss|ypo6pCu#vo=V(?)il1NMxM2kBvhm?0D`&UEOvuySC{j^%ha zlf}P}JU1CO84(1spuzzCC_suRjp!z&8(ft0DTsfO;#A{Xl8=YvD(xqUPg<0F`@=DX zfS^;5d6!>9T7b%VD~GHOEzxLIS+MhI*XBWXhA^TOsG>-o%?}r$XU0JXVqZr1B7nG9 zGE6o7D6?Kf^}5xBl>)V_i3ShUi7w3{T`$+JWyqFN*O=}#8$h{!$MX&trQQMbe*&1u zhVON%3v7ZaM3e@ZKnk{1jgnqDg@=p}-%$NR)?YrDMhTq8l;k2fxA@FvLFJgOXvSit zJQ%rd%}ft-^+e&#s-&PfTilFxa*|@Uq<1m8e+ql1)F#^-5z}mZ!t&{B$%wdcP=Dby zGm8br4e$!ZSQhPz>~eS!X#<OKdyvT=`m}yI%KnG(fY;k}1htyerDaJ6zOR-p0#)38mAL@3rEM_?JXS_slC>RIp%L$Vtnh?=s z34cfi4*5;;qE6xX^X)`{mwXV@6oIMOZ%>XTt%_Ak;<7LrsPQS5k+U5Vn}v}TE?(M zBFuponJy)(Heka>h>>uqM+{i+WR?vy3HVywi&Un0dd8#?#u%S_XvwfQp}t16EMmLZ zw|c7NFqexhvaD&FLK=)UBLRYy>LbbCrEPRJRZ!vC6b_K-C>0fr%{j!1jeL-@TJ;<2 zRRD^77Pb&!IsvlS5_mHp_uAH zfpTYit`Gu%Ojxu$@HSw{c-F_T?RE}#4VMU>m?Aj{x9dk#-r)1Tng=lLBHUk#-~~mm zYUP)Vt=VL?)ff$4p2<@#z%iwf`6;A^tvR^4)(qZ_5dVZv7Wy#W@+Bs|(J%;YD?c2Q z8AY8k2m$GtF^swCWOKwGrGny^V=b08dc`YJ!Kfd>;)?e8i1DW@4HTp^qK;?aE`{w5 z4mYRUE42&b1rMrMCQ7C+OnZgt-F;c4dcWAgFhL#yAGl8|FXT(S{KU_`~ z)A`YfEY7kOM{WFb5}KyE&NrD0y>vRgfr*mqnf@RirX|t?CLo9#do*zjRWnHE!Yz(# zFfKaMSSkS(E3*Wy@AW;$w!<5xz@m%GxG8UE+%+^ON?U8`CuX4}#7$)9(y5vS(bJnu zr6#OoRd~PY#HewIyxv%1F|h@Ojj!n%R+M2-+}xl}g9H2tsbvzM0DEVPQR`{glHX#7 zmip7CmwX9;@3w1J6%|0=E}&Sl9N z7KBsVJ^A9mL<)_DWhMC=t0u-8UVu)B^~5U!l;qW&<;4%P0Dn0>F}GA}O8qO}X5%es z1im0q=pghYP844hQ>jx|dmGCZLP*+0RmcQTJpiFk!GwF`NvFh?80b33=x+kc=P_3&_E17j(bW_^$X%F6M;wZ@%gB}U_j$u&0FwR&7u z=EgZXD!~XvJdn2RplxKkgo6OpKFAmA`No%lDHYM6Q}maxafLnzp%g;WPPRse>@vKX zJci7Q(38Sr11trhL@)yFi<-zvLYu`nvvEX!`CMdp==3ZUPE4PKwg$8xN!-O0XtGmq z#t^EKN5a0$pP_I_g@MagdA9fx_E&fjaPGZ4UR)h2uj$_rSw+HA2edf*QXEkqArJ~~ zJkKcr#}Zz8HV(0cxDD+^xO-_#G)7$mj&Y||sW@q)zEDszm}MTkJw6o#3`y*{6zAaN z0drD!MeQse8>LRfS)jFK)lDQhk~w=n$Z}+tY+CP?2~63Q7hwwcB9lu*sVUw$gXFpN zT+#P*C`KB|1~lO~eQ(vqTvfD*%eXQQIDrFBi4}$wAO#{A^pK24w%`q@8CPbvuDw+@c-S$bl3AsxI%ZFhXQR;SQtL$l5QMX8!SD+mndeZ%SVpoMIeEr2MnqCIeWpRX zAo3@4&I&wIn3OSqUaM9EiD)m?-o;%>-ybk_X~vpP(ybVeHR+6{9F&o?j&dUd)dqxx z86;h7x2z(43CmEjnJ>jXMMWtN9Gi}{a*2$#fp_Wz{D;p99F1<3N8d*L1+nRS;5vX(g8@`NUs@(K^6f1#cD5R{&q(#!4o#J-|pu2N>yP zYUBh)I-)Vs5y41DG)9W81w|0%rdWKSQU1mT^P*U`Bkv+dH0#8@?q)FIL;;v}j4~Ld z%#Q+{FmYgki3Nm&hoR@)K$wodvDVC&h*4=#WTO5-U_f9ZgtkF+AQPDsq2lv9Gt~5o zmpmWivu{<9O~tlr;DEq`{eb86BdKViwoD6A^I^Qeyo2}8)Wg5BN2Y@qw3gX{IRONx z&s-t9*7K*HoMes>CtkWZYUYW69n!#n`Dn4%6_BWFY_x`k8ln`2Ujwlb5i!wJsQ^sS ze+oN<6HF|wGUatiXR$aIWLj`Eq>70Oe6)KAp?QoEkHe3lo)a02NIVY+w)>HG-2%)s~1Bh!z>8R#3i(34B83j7npOywDq##T0uJCE%&2rs_iY zEH2+lD{D(=6Sg&r>0^B{C!*Yns!2b>EQ-`E9k}8KYC)L^G>-AWr0*5#L^zOi$uPos zi+PS}a|G@~#Lnrul~%@so-wy}L=cf6Y&vFlM3P;Q<4S#|y9Ab z$A{9HT$_Lz?IYCF1BkIs&2~_7PYu!e3W%h-m@{$_9xIUoWG#NB8ejy+E z9rkE=MhW&ErEsv@$`r%V89)Mezq#4Z?5f(deT=G9rzkfnB5uNTWBL1$t@Oq@1I~6h zgJMcSO7M$=;;5x=4N!Zq>D$UqvAK4Mm??R>RJ>CSYgM@zMzbh7&4ABU^!qvJ$ad&P zUt(ww;s73C_qUG!M19HlTmpO&@1mmS)P8lAF~9A%6^*KYgaQ24KYZ!)7{5>d;r%as z0i=Em-ZP(Z%~e-k@$@5I>S@#u|LvPkeB+<~@ymbzrN8^zFZ|h`{P7>r1N&ni{Rkqr z?|sFuJp9m0?z{JvXWx9&_17Iea>>OPUU1&wvkvaxxBHBpr*GT3p;<3S%%8+5rt!lc zIo;9G?$`d=+OqlFbF5GPk5ArUJ$memuWbK@dXsw3BX57R^+o`McfIo+Z?#^pUZ>X0 zB^G*#rN!yV@#JV?W@=*08cC=PC%GR&A>&62)e044dYYb7Ptl3BJ-X?&P&Eu%O=*4F z|4S{UPBE1O(!Ut9Qz`jk*d%c@&ufX7B#1WhlB|``E2OiOB#eY+A<3eH|8=(Nd*-rd`R2iLt=vuX&WrQf21=v0y<;wrh$t4Jviw=$YP3nShvBC2CD6zkfm*;6J#~X zQfXY70D$lI5YClS;;X+c1_f-lFnlX9Q!GsY4KC@Dlubhv`OOaLjohJ1xJLSgMr>1@@5u%;^!pFf_7U zy*{&(I+L)K${z}WN%i1MR&c)D;6d@=O9sld3(_7G9ojr#YbLF;D!H;sm0aPK;N2q6 zUNCD`K|zVgnt77_kpb8&?LE-P#(@VjA)2o-1CR)zzetRDRT$LC21TQ}5RFLs@?lj) z!#(BNO{t)7l8F+XHabd&bSn+1hlL_RMVHk5OJw1L{y^5nwXSFA^@pf#9#0%w2G8E~ zV>^W7QuJogc0%N;8~b?x?fZcm@#h>^8*VmG%{hwevz>Gp;r)RGkX)mUw^2fRFa+$} zX~Qx!vy`l1+L&~Jg5Yi&XHc1CoF-cBem2Gr&tYK6Isv!VA&p#5PzT1;T9+M`=>}(- z1e=HzuxF>?t#t*P6+P98?GL9)rEIDY`1!Cz>MEw>?o=l(c^y^objw zES3yAhAPycyb9Qb2`|QV2kObu#Zme%2GU{@WyE%^h0ME3xLF{F00jaZdB78+&77G& zoqmT9(K#3#dQ>OynW@Z3I%rNX=TM*F!CmH}BGH~V<_JA3AXzI7$OOe()-|_a>y!useD;|2_p1YoZ$L-f$ zedRfa&N@h=!@YaX+;Q60&FlMUc}&9#2k|h~```Dr*FXG{`+xbeOAqYdH8s&2ZVxpm z@&)&H5=X3?ZyGfp%E#B+FMIjRk}tf#p53@^);_OwgW9#?`HJH!WMHA`;r>GB+w@mHvh{EwT{( zF<@iN2JPEo{^`%p$)==ogNL0&7$`B$;s7k>UpxAY#N+(HBc<9_33^Xwp`f%xfadUk z+WxKiQb?TI(PgfAoG2s~3zXy->2kxBLQdh=@}dNXoI=+#dual&l$)aOg+CrdR1bvU z4lyAc@;!KkP>xc@N)E>`^54#T zDbzjC_ov#Ggh?ewS7HRhd5%+cyD$=@@_d0_^=NcUvR~vc{p6e*g@~R@g=`+@55_XG ze1TU!`E<<*`tQY)|H``+AgZ${g>SkdN4_9MH1gTXx+k~7tV0Z= z7Y`<6I_)eGI1rFf0;f?y_A>aIvp86lZ10I>lDc37OR@?2f7#IAJIu%2ul$l*lgI;3 zqaHf#B#m<;A1v<;>#{So z5WdRT_4Q=|SB3xesacZG`QdNA+FNPtSYOBT78W(W5W5(n&}PsLgk^M>u7 zJY$T^9*l=IW(McKL;SpQGGxSZkLw?~<#6=mBjGmK-1YszNO~(n*Sipl%IHee7;^LT zeKLgr*?b94RCdQT5(l))n*#TY{w}vX?*~6DkbMYL-s^XIC9bt2cdAyRKw@EKHN7(T z7qD@Eb-a3TG8xEe)@M}15As~<4MhEwojAiQU(tIPU-QKMA;7%+Fe{um4-6RhSdV;g zmd!5LW@#hnI*MGp<7^DBEBiz0lH?y(8ytlLjeDJ0^+mfqI=RExKGof2UHdBIRS#I( z4_>tEfsZElUUuD~!`EK)bTd6yC~uybe%cvlpZnq&BR_fho7CT4B0XdflZw22NAg1b zEACPETs?7>eg3V#bd7Rf{_2BU?ADl4FT7Kk<&yM#COuQE{nCq-sNNTPSL85RfW66nH${V^cEZC)#rQVKo zW2R|NyG$dlKOIMvc;pPA;xj1=E)+@=xxA6dY+wc~oqyWX8>Q)KRF~{RxwK|(d90SZ+}_i~cTnb~_WE)`8Iz41 ztOS6np3ws|9)|1T(NPpgiukEDSt8X5Ior16!2-7?OmWR24r483&vh3(Yif5YyIhUa z4z-(+RV~{?YA=}zk&xJFcPgk}Eh!aG8Y8MaUdxW<8=aw`tPnT@a-#Vmnbfl1>eRC% zrKnF`a(rM2x8xE+3zyL@O#ja{)|&d+*IjweZhy#3SKniAXxA9KGz_~S^I*2G%2UHr zuD7Q3AI_2q)b_-}LOTpOBEpKywN{<3HyT-|(}I9!K%H}~QL{C^-mcpt zN^OV1MpDzLOt+$Z1fnz?MeSZox#jlUn6Yk4s;SK0^c>w0VF%js1g03(>zcgy98xW|BVqcbeAM;IvCA!8Q|J%u{VuomVd)f{zT;0 zjX!kiRuk!@W^%i;yXiJ>bf!CFmg~OKSvNMt(=gS$-gPF7a;222x|QCVVtKLR4IfOR zybgsYFtVFz23c$_#V(1pY5UBX1;_QhMb z8}7CJU#CQNee!|PjrS){U%wOR3%TDKu*px1$WS+t%CFMLzv77sHMUvn^^^mFgP17W>m1qOuWJ z_q?Vxe)n!pOgP;JnXy6qS}!RtUU8WM2FbcX-erVq*C9L_`itF-nKlPp;$#?U`keCL zQx0uX#=>NyWEN@@3z_ofO~X7&FlVp0bqw6rpOrqo0LS1Am0jTmX1y%<0=i_GvG%n+ zHnILRr4}c4q=rl>cJSUlQKyY2DkOeo%_9g}HPqD610c-d?(vB&X!F$TBd@716^zg= z%^GK84N#+j2-5!LW@-0n7v)Wh3>~ap#9Le#w#q1V_MWz>R=H!WeNCzNzO$XvZl5?O zTY2P=J%9T8!*^_GoxX7)Y^ZwXx;>i@seK!ZPf-g@9Vt3vWzCt2T>@Xtk%vNlL0Y2( zHIj}MNFOFGE!CdZb^YjxCKs|+U!HXR3Pl$e-!A$p&%Ctxl!e9puIuiao4>5M#;EjB zq0OzIA3J;Z_#{305Vujqb-T~%&aFdBk*p=Bb?ZBtvS%+nctIm-wcm1WZV@dqm8wu4aihKMr7-atFa8}S0<^GUVJU0ODdxd=9?J3; zv;pFNIwI%io&3T?8DuA!Ep2_JyJ7e3Bb*?f_x=npMlyZ<*utJts=LO`v@R@zA28)` zCF?vo>s_FeW}}d9Rig_^?c_K*OxKUchT6ZlFeVZY+b1VCs8(29zwe0W1ixC}jgak_ z+B~@@-Jzj^mmE5`x-BA*bjCAT@6h(fR+Um+t1Si~=r+{0K%IXO(gjlD?(*%1I#fTa zPERP3bW=yY%ayt;ZFu9DV2Qob$B!Eqniog}VE$bRo#8Bba-zk%%!mhYf%fF8eI{`3>e zA6-2zyO6CyG~hO#yMDiY-Rj|?aO%>EdTV%_+!pP*7zdJcj@u0o`=@)?~?hI z^RRnmoP+Z)ST5rnEMFbxV7ZKQu>8@);5-bL%Q$7Zow)C)9F^{cr?4 zuyn^JSz4lRUfGl_50*Zvk27ZJls>uh_DPMpaOg#s(tlIdxI*9KKYh$CsFE&J0L+s}d3R)8}I3HUr$o8jFDLUVPMw;i06>U2mY zKv9Q9xYEBZ2=7FYE3zEp%-YE4c&$11Gz$^27~dMl#j<~uc?e~64=@WePZ0-f8!urV z|4O2x9y30kxF_+_#7EVpZ4ar(9^3Y@#IZ+z>m6@@%bS1Y;g{a`{5x-W#&y?T{q&>f zpT~9Gwq^51m<03FYbPhhs}+Pc5FPpb4?p@lzx{zne&Zc)d)))~-gW04&wKXG*IsiW zB3Wl2(g^HQPdEpqViu*k1OWL>H{N*D&Cm9p_uS_`?{_Ozw^S^aUTf_+^WxXPH29+n#%y+MQ5`SMCSh(s5cBLranK$+nFrYnN9^2frA(;OE>!C$m^jez$UO z9Zo!U>b>>Y%Dn}vix8aqMrV5#2zCkFx!>d$PLcd0+SIH8^Z?!g%@~}u!wtzggxCDm zVKzA=fB+x{Nhb9P+ojN!B@sy-`F1bXpbVRU60pSmYC9#;G;!3IC_gEL+5Q4?ykNb8 z#Zt%wBFx*KP1Z@unk1N(4tJmmJ+{xAg(dZvH!@Kv7Q#^2Pa~=J5Hf;ftvxTuImKDB z$u#`Pc}_Qk9#zj#9$F33_;OW&CtB%dhPJrgw3Ufx&?ZGsfmHHjJkm;sR)fwM$O)FB zTs{mfL}to)dI*h#a6;{zL!s{SV?6(VF}^&E;xQ#`O$7RB{p`kG8EnQIq}0$-u2Ta}i~iPZ5gCnEJy2vy~lbsUjz~x3~8=ND>SWzERY@$klde=-Q;dQX)hf{$9D!+cBwD4 zY-h2{{j1Zk=%}fe?mca?__W9zPiLFs<`QCzX?smAm!Hg0{}Fb!t=sB6(|4;;ZjL*v zzA-4)v18O@U6OHv*{7)s#&`O?H;gxTlGH09xQOl##~rHBpnxL%Ww#g>=naAoD;bA$ zn$U7v8d33d>52dv1~NfIM!gtfq|>Am$%!GNGRYU+Y8VmW*e<1MLq(~=gTR+AKtU^n zX|j|ra7*YllE;)TGb%FjZ1k3qq54FZb`>rAvcvgEwF%44&N@}sp=&ZLOqHWElTO{? z|4ho8F!xOk(@)u*G+PH>!?@xQCP^4@FhK34Z{kZ^Pq``XQqlN zm!~93;W&$QB?k`uod5WvaDcG5L1&6>L7r0aAyuM5PH5+yno~^OK*Cc>)!h`NY`Z{$ zE|S_2o*`TAeaAn&P-HfGVU~`HDx5%$GD%-?P8m&z?Nms2;o$g3j0f=rE=xR=_;aY+ z`;3`wzXdnr-+v4_+p>J0q8P#!l@TY^+tIQsLiz z@V)PR8&!`l{mows?d{M1>@$A~>+RSF-~ZmVqrO3N_AK5yj|HrMy=s^%U<6C~5<34V~CqX%)OW zy&O|})LzPr_eh!XUa3^}1{KII708HI^HCrlrR1a22OsU=BTCfxXtR8@MLw$V(J`tJ z$}SAG|LcsnL9Otr+J;a*M2S)O7oxHuMapx$gz_Op%0l}P%EzYvF16$2qd519IF4)&3L2jQyIJv0sQ8`(?Hq6??;s#DfN%0Yd@f0h@po>vd3@ATJ(o$2rgc}>4HTQ$#M-~Ftw=>i}r=pTwMvNxWP&+8nF_=u&U5gdEzEI=Hklfa>*W>x5WPQ#7d$jYm$*gUiqDlppE=Qea8&Ps}dkMUP zHr0$J&(Wa=j4m*&) zK}WKlc%?CBydm*yBI&ym4=3JF7n(07zMS|vzDa_LItWC}Z+hBaiuy!7{1Q>pL0(6) zlfxO4b>xAbR?wt`FeUn|Jhj~(+<{0O*CqX+$TQ4`eMzhF;PD)h)I;!#=Xyy3DLj>! z6qZA3E2bTo+W&!ziwX>_R&wJoLI2gVJFJHj76k z{evCR?HA4)fQ;hAq;MjSqAV!&@P>GTGbY`dkEw{ zg_hZ3m8=dC7{yTz4A$bIrID%3gy&Tun8G+pQm>E$gH3_e(o`!OI&?Y$26Iy=&qQ<) zF&~o71r2s$1%;5Bg3MEGcsVH_`7wJ@c>Zh$TLN1rOdC{kkLF8M*rKIKC8@iSLW81I zmNEo5rBo<{8MjEyR7N$BI_Z_X>@}#Lsl2fsmXrE4RYyV;nnr7T80M7%`r~hLHz0I{ zA=ObHUzZXN%0yw|J9$1pLnYtFYp^a>!zm#`B;9Nyfbj_ht2C7?rj5e+C3vG=F+>iH z=bIj-DDD*20OiqX#$a1%cT7s5jv@qIl9n$1x;$!R6mFtZO_47x4koDgz!XvIY1`$) zaJmqyNnZ}V%k!%g6w@;}XNM`uR_X9%R3hUkIAB+y!9(T2^C@ahfZ24ZTK^~1pg)`V ztHf6mPoOKf4k4?jsteV1XrkVto=bP%*Qj@>-&P-{%JU2AAMm#2PVM2A((+PnViKc^ zIMHNs>4+re+`;=6S$^(QA@p&Zz>2ZSi{hY5FvZO;)i-c$csTStgNsXAM)&gN`$DJI z&Ng@C$_%!ZnjmI~C2rJ6ZdGI<2HXbjaUlgz)=q;WGRZPFn1pRx75$NhjHm1MZkLU2|WjG8@4!y%pI1lpR z$^#|Gh=3~xNY}i+G)EwVp<;F=3;@3jMVy_@I1aCn z`6tMdrhp8XvMFdGHh>_9NMTT9?yF=?o9UFq05PMg8dBDS=CAJrsR@KND%+4y2b|&I zBT8ZNvNI!0T&BN)rY9x`;UEj2nL%!qZNOC%&LFNj<(#sJ%rIU8|G|J{CSwx?wnB(a ziH@ss@AiW=p^3t$%x0 zbE%iX+N2%|os07Fb&ls!+-RiUkAxFrp=bt{c!`=YA2t>uiw=i^bTSgKB@P7TMX{gA znbHE2)D5*^ZhDk92aMGx>x8r*HK%r7xw)7I2t+#_j*&B#s(2NlUZG=cFV(clKfVr^ zkh4I37;na-jT2Nf(pN#-t58qC97_=zdDIlwLkf7irpsE|gjRMlhFTuZQkEYOFcBx!CEPw6Mm1 z14`iLf*{F(^EamdSwV0ucd;b>0P?sqO^fqjo6nGI?WZan1J{p_-LwlNGt6oHXWw}% zuEllf)LTAx!!zH1+pc{59CE%wJxZY*cl#wrzeIOqrAXJ zm@#~1sfOGtBt@Km$U+!UaTNMI?RXbrh9!i6$+9@us5tX%h@wx~t(4(l*t!x0;A03c z5o}}-M=bT{BN>Mnbbb)`At=FBpO>bmWwmJVX>EDS~E(9C4@{Y9F1z&5jJgc;s2L4EK<}+m7I|rU7M!;7s!DV zF~uX>K_5<i=`&r z0OdfQ-E=;wMzA87QT%@R%~V*^)=UJF#9&DgH!OCS11p&5rINlC>?v6{dH$Rk2dO3= zdk&WA1Z#y8mo6C-s9=~O&77gIuz|>tMorYZOLeyG7uwsr{Dv~tl7=23pCoh6Z*c86 z4<5Tk!CGbq`!yMpkWwZyIh$iibg3B+&LNJRWxrhXUL2HKv_cA(ECs(u$ndl@P1#aB zZaPjH6KfeBryjBj!KH1ZLd)6ZN*w-wZ(LA|t{C4-{1Z8?YND6eN-puXZPRM!&TYFA z!swPf1Q^iNnsJg#L(N7uvwho!{?gpc*l;bINhiv190oAY^z={V1bzb&&u=TNoS<9J<-1zWyPE5NE542ctjHD@qp^lRurY!x%*U_1K%6zB2? zB<{g!$M`oUP<_dzoOCyq{s)xhrqRMOcHri!To_O|%56@RX{-(CvS*&|BEv%~M>=1d zW>w;`Y%rpva0|sOq<0Y7k%qTP;#rA6NqAF4K#2wE9uT{>@m5chD4%j3~ z+>cvF?Bt~KRa(lR?PEOLC@+nb)Xg$}+fL^%x zRZ=xrr5z=e#A(|tcjimAg529w^%eC`>Kn|C>s4|+k_Y1d>X4L}fcr* zWCWNzBo`n~wD{!mIesx;K_3ceO#JedpCwwZa*kwTk{^lV9d>lW<)<=;iV;EXnW@;X zhT+(|zQLvZNp5sDC%>S)Mohx8f5F4}XR9QVxWQ#bHX$1k?2CWbnmtFdQ1T}sO{us@ zS61Q^K3igAav}ML@QQsCqU%U1j32!nwm8g`ZKI{c)G3-Tx>kwENpfEd zK&ZDeIa7ej=0)OMf0eIuBBcIcbz?f7Vc-rt<|Qqs5YMwRC!8@7{1J@v$5PCn93dy4 z8>y-KMWP^%l=eVvxNFzG)cV`q)JMq zDe=!qH>McjaVUFeBUrRf1Uo>o&rOrS0=qJ^!{oSz;11SObpJ#0&#O0>lMN7wTGN`f z%5hjn*u)64v`WE!cHMF1o(syKVMu{j2M0tRX8X~?c+s7q5D6DInS&QbK~N@0r}vp1 zbwMl6(&oX3BLg$hG3?oFw$UEWC6mKwJ$aCzQpoGlj3$|zpR8DQl4poE!6ssQB8Z}U zIAlUIm~)&qm8;M)d+0gjtGSq1ZTWWQw}6Z{4aVy9@uDAvmRUehhCGD)hg>1Z40?#T zCJvpVb7h2j0>8@d37dIs%q5`ngSDc=f^Wn8#zF@nA821pYg&vp&xwUSDDsJfQyd01 zpekZ!d?Tb5nS$OTf`v3D1F35rzbBO{V2OEJtZ~zHE8v|VjG{Uw;^?3$O!r0Ul$pd7 zn_fDcr*wpgQ^XLQ!0~e->b!h`w7x(kPA;sJP-dgs!We8wcg~9uI`mUq<`jAfPM&;P zwgdhv4eNl0qe-8DnX?ZIzrMYGvrPm0F{okK~Y7Etb-DS0oo9Ed$H~o*<5p zq)8>Iuw;87=~OCPh=C(-sF95F*?f-J!JP1hsMe*=T{2EOWlG5Gg4L#icSEWgx-EPF z6t;pqD)S|1eWG|{+Y>aAM8YUd&pA1NhC=ATHM1ko2T8nrp9(%N*`PNBX9WR!(S_t* zN0PB(j8TZkl}yDH22;vRGRsl-6SVll)X|Jm#FnJvCz2h2P3}QTUT8v2&9gKxsUZ0n zxTD@IRzU8fg09jqw! z08|Le3zR}lzCp;wf)nhg902wkV>C#!1g-@cLCbsf zV`Kur$=L8}8kaLQ7?MOc0JW#&j|a0ACR2`$)g*Lc3c&hf)gyT;1H@np92ILOPN!#V zLi>-$b&qOt&vfZ~KyQUQT3Fe%V=ZL!dFeW5(`0}?0!$Dw6eun{fuJX3QcOq!u{T^vH!+8@x9D7K zW0puLlBMaaEGEAk)#8SY3P}K7;-?W46IF0nzK*nZgvn|+%YQ*?7KLjv0<<-xvJBT8 zk0ot1_!}I$3%1MyhwVon1yX$kg$PP_nsHE1CQTe%s#dw7saJ(*q^>v`dET&VukB|L zQQ%x~zmv;_jp3!wFP5lL%NGzPOQvd0okoNCR5Pg2O`5YZh6;Ls23n9j3q=9921pGx z9&Hs4-gPSH7mI;gBZth)W}?Mf^Su11zXsiaARS^F8CQ|6U^q;i18g2L+%SF-6+l`B z{s*x1do-5`MEOWs8NuS%qy01x?ka=lLp#@>^pE#)|PfRF{^RH=tW79p9}6+nAh~I zr{?H!as2OK5&p<{1dQa9iO;Jc6t6d^f7$kO)C#`;y?_1AH^27JU;UfE{`{YP=2MTq z_2GwZy5YK`mz_5?Io<#c%^m;A55D%5zx<0YeD1So8T`Q~KK9t}eh8uP-+I?O-mX*Z zucpVv%kH}6**9Ht^xWNNY+g6LwvJR=VmP&M$L$xV4j!=P4(>nu@4sYL)-TO{^RE`J zzS92iOYeV?b#Kbo889R-N-=Z&CZQH*_M71j`=x)d{` zEHFJuZiA)02onolM(H00-o_9|ecfUKP)hv&SbuAfxf8Atsp~%Y8+&B+NOWOzLP4e- znTiHXANeO9%o6y`5{-f4J2=oiDe_~2;!pI)G^)m7KvN>8Ay}ErL?j`Y^Vk+6b66XB z8o~ydi3kgbA$nv<)Q>9Fx`EjQ(VnLnK|Yo8kqkAE5lEin4yC%vsnWzdM~N+puox10 zHz2jVtDGE7#)V9e6dYa=pzXd12Sna2NFn9 zSG`=`Yeyj|d-~g=?2K~=US;Pkdp!li*h`ljJ6>hc&5dqwMC$bK9Gc+dbFM`K86+B? zE3h_;5DZW@NG(ZuRX4Lm0oX)H#w&*i*^=2qkg>$3kVe2Y&AW)B;!eYplM-UIzX6;{ zWlI;Luz(5`U5)4@L@omfhF>cd>y6CZctP5)t8pS+A_kQVTFB$%%E;lsy9d=XD#q~e za0`F|t`8k~F^dpOvEh>iJmNG3&Pd@lf}$&O0f5`39xiHuF_C;Q>8s;5y+UEgE7<99 z7&#a`Zyyan&RMyXDsU2u`C^C$EP69_ssw0pRwgMCKzKa*9oQzdwpSdt}YY{2zyji8YL&XsQkzTgUndky>H$ZMBui?2pKtaTQ!9AoE z+UtbN8mB7+_VAhL0(YYd!KIz!-!-o>KCNcdB9GNm)cNXq^*pp*|B+_3GBXE8&1f0A znwfaF&z%bKWHtKi4W3ZSOv!?YJ`)e2jUUG2#SN=(bbKO-X^C6$6LmUF?sjo%l1Q{~_lCuX>PNC+*^Nk$$m$HA{ckn+rQK8U z>)38Q_*oJleP9@th0mFYZXTkJvUEWiu`0L+p;Mic4(ES(5LI^GWhj5_lLK z8L+@#42RRi$AstFVI}P-$xI2>ah!3K^|6W0E8}C(AOqqHvWg6W!SQFzHgFO}n!m(R z>P%%xY=veH=|3I(R1Q+B7~r5Tk!lp{M4_x`RdEL7?Dg?S0pVq6jEHT{Qh;C! z%KF_!^jWaECYO~L+r-fyrXE#HE%tKQ5h-)N#kCURE7zJIxy&?|jRmD*q1e@)Gt8A? zKl)UQx80Wm>SO6xS+0P-oBC1TyawHoAqYMVo+Urk%BC6^uv}C6_wn!$xbOmP&Sz=0 zG6oYhnQ5buP3pdYR)C5oLTBwno)V!^dZtQv%V$C{hs@{^tBO|>wsFP7D0r*0< zR4%{+J}0>Xd{jGyCPITOrD+j4(uh^y@MJrgMyLVle&9m~JBHR&nKZsj9~PwXi05)O z=(=_#q=6->FAyA57GW)96tH)&dzW7?3Sm6(gnwjmn`u%3P98n-T0mu1O4_NCMu3~+ z1;n!WT*y4)pW%W@ya%{W&rL0Di0FtS5X2KUAxIE5Al-*4vB|w*k?9E}uDfNV5X{ZN z@+8ZP>qiy>o)AK;B7kj6>d)ru*kzjTVA<%ki@3h%0n=8IL@wzEfdQ=<;FF}Wln3yK zSVV1=i9w$Mm=+5JIK-u@Q!qeAm1Dv^PM0&rFw>4xHjN>) zDv<({gOCUbI+;g28YAUmN4uHIC_-b#QBEx@n!T2v&3pD(=n{R`ylQI1CwC*c&!kgr zr0JaJ411YM*1&g8fol-=aAv@wMd$*0n*1kvIOtW5?1bpz5=60krZ%n{9f1f-=&DzW zhlxy*V+Fi$R4px$!SEK0RD&&flMa%ZPI`{2!v=YdP9e{4J8jk|l^xI604PlBG)8a~ zv=?&k?g&*A8M&`g`2w=W$w)Vg)!c(78lXl77oT~zkUUS&B!a1mnXNNw zrcuW8RMPiAOs2nwMoGkSkkXT?2*yBe7BnnH9T~GMx08c_uScObG$Ar&DdE16Nw!4f zk{bry8%n^vVhRw+r2nZ%&mrNCzOWo7r_%G<&tTr3v{@YH{5LSK0fix9M%#ADOLL1R zpXKHH=-VN`>~KdrYHc}6FaLnJ1J(~h=#qP~%$f@{M`(zCIt7&YD4dP}Wl#R|QY3~w zM4PY$zA8&Fhy&qNoV-`<`Dj?1AO zZ%O=S;>Re5Y*z=EW$#ildt&k>rOFTTejUy0pxy8yvlygg40jTb7eDArfc zSu*zsmVu4ziD_hl)IKKmaS0=N3P_?SQNck5re7p*WyTcx2b&e*`XWfiVvo@<8;OBM zh@3A81RRT@W+pRnMrB$ODBWgFor%`dm26bcFXC_uO^p3$m>Nqin1sL*8aL60!Y?u9 z-QJ>1WAr-K@?M+)4He-{$ISmRYjNa@Ox7Iqs+T@MK$h^K@%LFtPfd)6@y8Ln9Gnkk za7lZ}#LcN?dk#uEOfVeOd@N{_2gakAsHe(%WR^bGI9hPpNj3sJ~BMLg#g73i( zr0Bko0lx6b-H8g5kR4RQ<`E8W7lg4oe{ z+RdnErfOYO#pAe|E+Xmx=t-OOw0BsbjcT!g*GCIqw6~xFHsP9P^6TmM;y1wvys0I) zBPuroQMAa^jUlkgsbu8>fm8&Y@Ur8{N~(sD@fT8*qT0{F&E^yX-%NY_iQ#=4{VCAo zC5i5Vo}&Z=O%50$*n}1(nc^Em=3SHIvysO!fr;y9hH4^{fYdHB%mf{P!n7PuVo|Uv z==26^rSTK@_jvuTSF>(74 zZj$*jsrGOyU^YdV>Fu%aUH^E}4TAkokk05|4om9e39O3aImkzNU`E55k?fPfl$2-XL9SYiTJ zjim^&+mlklRf{E#ttq)I**+b`XL#;ytbpF&Qh!v|m$m7Ta1E8}RSY&_&tXn9r{Rg^ zGiGCLFk|jSL^NmnnHSKZBo9H0sVy!yJSR`T>WptlK@(mb6CpD2I3ipb1UfVBu-Bl~ zG$37;nUD!xpsX4}Eb%GNSvs4})$kp7OT?8U=VSrqG5ewojg<+?!Zjldb5ZH&K=9)B z&!Y}1kR$u2ydH)`2JgtlB5_}{FoifY;NFXQO6hgz<|?T;ox5LJJT0e^!8+tN6b-Tb zF9Z~&;j)Qy=PiFbUEo0`N#GkB>q|Bdr*u97`=$3RI{O%?^`-522flTHscrdQujjin zSSS=!O)KA2A^O@`%DI>lYkD*^M0&%~k5P-voKNb=4)f&6;6Y<*Vkx(!ya7+4^(JdGuhF`wza-C()+H9aidG#&Z`5>1BqjKf zP8M%fIwsRBuK`a&CP_W%GTlZbA4JYWHqSl2^eAnEC~0u5f@7kS=$Wl@77=tD_H>%& z>v&hN?o*LZAtGnKRFJX62fjy$TmPhgl7IKqR0G%_rEhYE??#Q47 zh&nrpg~UmCJdzG1+~MXm3>bonD~Uc~coq*9QvycZ*kE+5HYr+id{7bDty+U_iMD#= z2=byZTqgeD4oUhWp!ay-0#3szbRj8qXi3>(A3ymXl&c&Vx}se=`7F>EBPUYAL@{kQ zpu!A-LMfje+OVY#FS`!NRZ7jEmG5-enps9Mzdu_^(RVYK+l-VEX}1yP4llS{q&R(Q z{1b@>)D7x$iJ`=JVjnf)=O!*r+?04=+eUTs&D)-xxc<6pt~`3=vP&;G@7%Kw9vB3hoE-&3wd~*Td z2|YkWak6xrDt4-KK}_t?mZHE?sXE1kpKggi1Zqam23wzin>W};tQ+?%9)4QA+g_T^ zj*hI$7jl>-Nm34>htVt+Q&G8i6g{S_l=(e?+Gt2-Kc5?-O{wiSa@|x^?WE?`X3|v4 zw|@^8CDV|MOR^>DWi)A&h*WZG`i4VIekpOkxywZDnP9M}4A;zBC&pObjywyo;6 z+qOM7ar2GWUw8FYR~)_c;tS6|_w2Q6#yht>`x!?rzwDBWE;#R;L%Vlwou8YTnjGtm z49BHhqH1S0+k5t8)b3T@l)mCW=X&eK|LLNy6)ap-d3PsnJN2^PcH**2upmDYEa)pP zQ@S|*@`G7fx$eBdZ=QxXy7GmUwY7%XlfQ7{+KV*W;M&_=v0u8BL|^+m8q#4fi+UpN zm~ZDs=FJ_gyz5N$jcl#ZqOGnjo_eMq5aTCD+8Yee6;&)#r+0^ljVEH#C_H#EpjauVpCvHpJnfR5&D-&-@ygl(QbW?vX@lnxJm1<*0puw(# zS0#8@PhSKs0N{L2h&t51Vc8coC>H}TY5~FF9-qp0aj-D(vxGT=$5kG_6=;sFtzHsY z#$ya?N1)HuXSB~2O5)ea3?$RU;NnlJcoEO0$AkjZ%ADdb=ioa@*t4=B*@R3)aeuZq zYy2r0%VH9davm)lTqeY7w~TiSsRM@|aEC=%!e$T#9-^?o0pUTwjYwu*pRBIQR5E_1 zS**>FPs|KCXl_b0Z~D2zO#M&g8;&%5W}da_ADP_4JBrnP|21}PvN*$Kn{lQ>>dKiS zz!&hlQ?$h3S@n}_m!)%DB9SF#BHF}TagWbYHwQV;Zp;sULJ@8T43zm?0r_GlL_e$` zbCRO72|H!Xh(e5#`}LE1x+UD2f*+5%xn`^2lt-oJI`9cj@=z5S?TYTg^-< z6h{VXH=-aiqLoEIZ#IvA$9#$L34HvoCBCf^ zu*4gxjfByR+66oAHuX96W%bYM3H4*3vl(L@-7>ZsI|h|HCs=Xvc!MqIr<@xSIF{Rp z&_4s5+;waz9_9Y&b#P#~t>u@*-`b`B-!U_|_qdbAdsz~nCzh#b9xy?`2W~>9niG^Z zZs>?xy0204lSDR+BFK}$v(aNTa?grAlVE@Fm42kZ!lv1LmtQ<8_DSwqS8i{4V8r-6 znY*?mwKy`jo#d`@crxWNHX?|h&0U)>>YN3qOP;}Bgt}&uE@ZatBQ449LUU|`ESnVKXf_Ft(|}D<4_slBH1fhGDXE%AznCyrDpW5%d&sHA z!j{7tox+yeZ@`vYXh_K5+cm20Th1y^&ZP||F%{;ZFgIBqkmTTsX?7KGT`zFjRQ6Z{ za@<-o9~;Xr6cjcm)Hs!`3%BX#a^tAn*W9>lMRVimVEHq-ad5C!xpBA|#CC)q{}nZk zplu7iJn4B;7Ntn&FK33D{z6d==NgY)=h#R*+C~js4rnd(=V2^>#&mZyNlw@&X)S-5 z7FtV|!XZgZydd!4-1+wML)c3+^00$xvnfnGF{Gm_92X!`&2fndQ|aEjLU93drG2oI zf#GYYBUC^omtPChq8v|Ay*DM(XWdUKJ)sZZA z4Na?4!}tuNbPur>(Fp>>f*pF06bUI+cy**|k!q(E=Ll{K*G^b~w-K+xP=cGsuB4DH zBiv86>q4t@au8jJzSKRej9@pcpVmo=4#M3zC_XapF{P&Z6ID&op+2NCTqo-N#h5qC z4}c%}MM3edVgLW9B%F5%CCgIh!^O$sF(=Gh$q&;B8(*rXX3=N3K;5gpu71E-PaCtw z7UMMI4DctXBmNP#u=CUT;Q?&i|8M4nDf|&@S&BLWB#AlJrc)d*EFM2H-^Ba^H>Rr& zt{Hh@0AO*5Y?_B6d>C!{TzgTwAV*ErPrM|Z>8>$>v8`jD2 zW}uzHrl5)n>;KcaU5`=(o!j--EG5yXX~FFf8X(C?+($Z0z?Xw~*YO9bU9UJg9yEa~ zj3!u{JygX=+ce=Mtvk{P3c&<*Dk+Rr)z~AsMEC>y7xNh z7|{L>E;Kn>rd<+I%rLBi4LXseElU&3L4KCwlWHa`jbvuYT2MijBqK{!?UalxKn$q^ z&`D?~Ocj=Q06Kfsrx9@ARGk1CF&PJ)?}KcDv84KwM$rQKQ+p2J=HmO>sdBNXS`?x~ z|B<478}g_}BH`i_dEMn(LgY-DZL^#|Jaan(qF086?gXy!zp6VEFiEN^-=7aik=brOF|AYQc ztO)6@nR&{@abh#a=$cHTKPTNHNn$Yzd1h-qx%)~cyx?^mw3>3ZM(XR4*n89ep=%bW zyyL-$gr7Y@-fG9mbb)BX?+`DSI!Jj(OCgg^B4t=j!Oj+T++V@(E z9rjw!>zQ<&8BZ(5Ub+D7Hs@;H8!uAmW6dys&v;j3tV4RCdwyM~Du~vY)Bj3;D)rAy zlg*mYw?EuN0^4szErPG|dW-?teWll9_Z9QpwPxr)?E~3}qpalv$()+VbyzQmkx@LV zcbU&&w>`EwU`9uqi)5gyqn2a!>Xu|^u)jCj2dHCYxVzpKtCB&iG#h(W0dq;*6(MeO z#+a53rX-{DZ7`!VHW+3N)#!Dp;_BMKuEUuObn!E-Vv@!GM49MVa~J$pfj6=Vnwe3Y z0l7?RmF7=N<%X&Q49RM_w1R9sWcezX4`;EvGU{D*NMS+;p3#9)k|Q3(lJw&E$&d+A z>w1RyH|pAyGn%7j?b_x#*=yzW_>z%E4Fn&{i(FQg6W2Gqz#VWqtHnsBuU9k0cg<9p z3NHqUYU@0|)@qSz)x1mA&ae5}u;#4Fn8mRt>dFxmCE2~T6|^ztwSh(IhcqNK2F(Fd zQ@67DHxlAP|B>zJN%fHz8nwKLJ2Dfrb&-OcRsn-O1XoKc3a&agfWr>!U$N|E%bvNc z-Dva}0ken*BId#05ULk85$R4bcavX@xR{Ka!sSlv;}9$1lOjHuJ(kKcIZ1A5?rly! zxp|7bam})+rQ;p#H5Ls3a7b)3F*Y(h*x%Px&k^_N9)I+4neF>*-jdn6_kPi0cTZG` zhaM8yzCE&S>ypLIz08)GW?XD@jyl6Fac13*9>Z`NrJkqpF#nhAG$ zDKQW@_lwi&h%1|uhO@v;&`R;v(DcX>jpZ?eu!@jukIbEso_L}_LVLBq06a-ubMoNz#lP`VYC2)c*qC)tncoQw|v-b`dm!;`q^7X=>AbHXKK7XCs)NCQ6bJzGdg?1z9NF!dRpEmLw9OxBi8Lltb94UTkGAz-SIKGf zAM9!N!NRnok@PrOS$;PFAo743iisP*wvM?(hl*N7LX}I|C~<(=Uz3D>T9sQgFP=7l zK%049SM*aA{a3~VRdUN7;5^$E%ntitpp-%QM*9{JvE{dC?4tui6h69#@F5c6R^$Pv zay(f)irNzf3tukg43GhcjyKKXQ8NcQXU#m7LRoczTxr3ieJXh24TGmiU|0F5}}dbV5Ob+p~0BLS9Yu3K~{q89Hz@kJ3CHeZ#yotLnFtsocn*~qvx zYnn}2y=nzbmQEq-CKe6$chzgva-PUkBTJ%%p#^Td(F;pQYj7^sr$!*{YsTW7kZ(P# zoUEDuu-53qDwKE%ibz3q)l5&5P!jN@RP|M4w~juL<~mHr@xt-bV%e@IEJ34Jxtjry z%A+8(d-1peBtSo4@9>MJKUzyJB}rov_V5G|f~&N#onk}{speNq>F6kcsvHG?Fd~a^ z3M7L@yq^VWms{(^nUwJssNzuG5Dr;#n9?Vc!G}6~d6Uc|_mnJ?7}cEWPZ0n>VeRh6!+xBwp1@xtPyop*T6{ z;AB_5-gUx>-uT$q_{ya#qOx~%^}4!QJ=4M=t?;TDUcZ_5SA~kd_5sX2fma=CJ&@J1 zWBvo#VIK(VD3xxZeG3D-J|Fs~;#c`(;k*@|4448eniXY`P#MYa+DlOeI(|SqOe-3I zAvDIo(viY=Q4A?S)j=?}rOHhOh0z3X4WK9&H77Pi4nR0!@IEAR1?b-Viq`|jnUeuh z6C{c}S4i&8hn3mp zN46Z>M_H@!_$M%I4?J^~BOVOI|C@sQm9#pbD4#LZYcR zkTG?SUcjN9T#+ZERBGAF~5S)05ihFVTK3ltt}dcVT{?);|?-`A={Lo ztgOhdNh`{jgC>^hg;mB4GP$8ua4Y*%Fi7h%l?TU+M{qE!WCAzlGz^{k_%RZ(toe4i zo+hE^s~ws;LMytH|LiPE%pePBu8e-BQ5)7RgJ+a`V3JnzX|LN$G1Zd5P8(y**@NDo zI@akLgKEWASRA*g=vnAATn>|QhbeKEUWu8N&z*n6zMO~GHJ=4{^ zUPM>))8^;M%sgJMN@sVU?{`ER5!SUpt_bpt4INmB#IiZUze+U*BVZP_63!YIlUPr@T&{Fv zhB5#+;{XA2d2cvgS&V5DxNVvS!MfPxlSZNheh-SmC^>$*3Fl^g4`L_6(k)9450=-F z{8XhIBO=Zeu*Q^~$Uw5#R7|FdQsO(MD2VPs|{B8V1H5f4LL@dz=Pv) zfI!hshs7vfHgI_ud%>ME$x*?7@*sc#BKvd({58DHK=zVdQ8ICujI$qx-8h_E`55^- zF`))dZJP(F2{`oFa&8RFj%p=>D04*##`_n{lX#=XWiL5Y&T5XBty`Phh(P7|7u0|m1=HFnrCF|d}+Q_r8&?p zggGNm2e{Q^7+GZc!hNLqTN!MXCFO9DVf`X3q!hART8eUnK?!NkC`E`@JS)M~f;9C4 zPZGDVn{A7xH?&p#A|T(ccs@Uohw{3+dL~SrSbLo~riMDpX3*W)=mBLWT2JY)00*d} zlhmt`8@)_hBo`;rJ-^IPcD9j_rcuf#3R?@Aj_TsBkESqkKn71Tdnbn4gYAL;nozD~ zG{px^P9{#pY5{+NH>4!*l^>wbw1X$(({bvu0a1IX<>{l$7$lU7c%I zPc76{NTa9TQO;+i=9}_tTfb_eeDw_4YU;AAo8Q#yS`()g)USXG=+xN4h^QP>xrH+h zd1qG;E!YRYK(wtkKPUkeb(6(0l2~OMm1;a&8O|ospJw)o1t2+at5lrpsJxA~`>s?|1U~{B(bR&|X`XC|sP5g3Z7yk8em(pPhK+OQb3X`;6Po>IWTd%Jw3)iwi+OE1$W}_4Z`u^izZ>H5$0eoe{&34dM zgLyJCzrn}=iR!0)Q&|gjKG7~oAESZTse+%rNqDtYv%Aa_OFMEyxO~;3l};VLFKvNK z8C#jvp<|GmP$7H?fjO#utP>*GSel>>yu~r?f_b$9AvcJ!$B?F~uOq{IZUSreC04BK zyHfk?NSpHgjLtX z*uPi(o$EWTMhIm6{6<*c8lX(g%w%9D)jhmaiN4CThbDGbPoiC1f;|9IjSo}Rv1y%#@@Gt0x_A=Zb-92;FZZ+*C8`QDqvtZX&! z>#Ps$y8rcKb!R(Wt1q^iedX({5&QqRH6jB%Tp~`AWm<>v?^z?VN|{?Do@CdEelW9o zC+wsnLx4w)IkJ0KUNg1m@7-2@ zm~gM6HNvZ`Z{^+@5L}%$Kg>e=>&uE^z8k-l?lH$@hn6lxdt9bykJoaKBzB+&^=j zaKBzB+;6YL>bvB8&(^38{&89kZFZVv%bLq&YI5+P+6?#r_I;$@kN7ZYLIc-$=&JU;l6-yDa=AOY&>`wL zlf|hTWJ_ML(1C83_Vc7p)HywfEy6p3fW)NZ(%5*A9CyG$^HZw^S>YQ>onY zSdG*$cIvJH!q*8s<*MzWX*8+nuZxh!ZK!Z;hcCUTK<05w?VdY}^9n z9uW_*>U5+~cb3ey1Df07{5F-8Uf z1wfYa(TI4_T32B5ujv*o*%vlPs~Pe#IlmbuTN6(wq52Av!T3T;pdGT-n^6*5N{a=y z(ppSMOvn@Wt;Q3FbvZ^tzS3%Z{+Y7Z*9jT&zzi(0AL67%(0c)%Z(r&(XWC_k}G%J0NW{vmUtxz*fbKCkf^p)=c6lapN! z+rTQV`ygT+S8Ii77pdL?fLkPw?qP?{zZzZ4(ca0TzSC6pzX9}wB`lk1Id%}G5dyQO z)l_H+hiNuO6&}?w*fh0yEe#iqPOqC*z#!v}?llRz2%M=dk}*ev0oFK>Nrog|Vj_^4 zc`DPIgjh9k;;}$taftOkL|&|x(E~WKi?tBDF}Pqxv&B;TbXYQdvbyY7rZ5G+FH!TS zx0EIs#8o}5H{kzPEhz;pq}Q)l#s%)p0AS-!@m>>CdSh1BeABR&qLvx*hY8qDL#k3N z=Xk|w5$acgdW`?6DsTKIqRp+KS1yObrw$JFe^2X_$xUrAi8l5`!JBrr5+sS81||jQ zQR1efQ0Td$v3>#E;UEVC@_MrBg_Rp8AyA|E7?C2ta8QRBedvGu#*L;i18Qh8=D45) z2W@Kb>}*dWjk~ANmq|6aa-hLqn2hpAVp@VI1`bI8lH&|aoWse~?q`zFHGy&gexf$^ z4(0mh20g@FAOUxO$=dYMt;o$+ROCnoi`MS%q=;TIP4JV!S_K7>ogk$Etujt!$LmF* zuQXU!askN33Ey>+k^Ch=EE(<^+B&&r32ZPSEe&|rOR<7Rfbx&% z5c7UB)DB}?E!9cuw)-sGon%KYpTlO5T8O=@TBgM5^ZMfrjY;XoRmQ=d@uU(EP*T05GL#-~mi$ZOLqJHJYQC>k7#usV0GS_@FfaI(eY# zKI)WUrII8r4*nvJMvA+iKoJ6~1<|s$J9*ex5ys43xYt;)4_Gre`rNtq7yD!TZqgGOR7P6QBHFZb2X6+_4c+4vAY zr)B{`y5Mg|DPXDweI}$}Fo1ET*e1pCc|>~Pjw@j5$fTypYtyC=W+5bCXpZb9&X12&BY1G#KLHJ3__|G?o=Qs|AKAE)@s% zPlvYZ1u89&7m#N0?hUMQbbPL{!JhU2OEo<{IDpl+GF4`sf{~!S#*mxZ3J#3)6`Uz5 zDq68>h&)}&v24+m%VLA1<3<(az#tNkpj7>i^%xH)mPMNw41tHC*xDiy8VZdmR|>7L zIDRt7B@kcS(bbs?A&uM}fDnH``6P5^S9z+O6{Ri*zmDF!foQX9N&;l9JyAs&pY@In zngHR2FtqGu2qIiO?4$uIfaA)xfGYL)fH|Zxg@kJfKXoFhTt;i6QV2z)FsnD)e$;8O z%uecs2~~py?DWx~2{ETeY%x_NYGc^~tLS9;M-w3~RUn2gZ)!_fZB=zi%vJPOQ|tug zQ{fW@B>;JlwX)99C7mIrD^mq-NF}|-m<=jkI=FNtb)00f7yu?el!%jCvF8qFTWx1g;bHp`sR~C-`j*za}{}@+Iala&@o)NFnC} z7?XNpAf9ROOl0B1a)x7m){D7Sob1@-mHZ43C!Vny3wRbfAaFc0rLrV~i&*7t)~;Y# z-*a=NGQ(`^Mv4$Spiimv!Y+!;VnphU0KY81^07)XWGtkUR3~jovZ%DjkXp)biW>)V zV!R9_fG$%v#|et$jUb{{s|ku;<%S{zffZs#L1O3&+7`7ZxP^Qi;AH@w79uyYQzv}# zvSD_H(HKl3QV79NF4g>Gw}U`+a?k~!5F`CS;ArE3I@QUG4-UNbR6rvSld)+kLk2ij z*WU&b51a^dCN@{_QTU{^kf{v*5Hfmj5rB?F4scn3NifVQ3?Ao4AMyh9Pa3FVv9yv) za^VBu&4n?aBp@!pN`!jWoLH*j)k+jd0Fvtgp8<#?t=@cnT)MK?fWW|OCm@pf29y`( z;kc8V%=^h{LUDs+Es@UG6$cO*;n!IWpiGtqd3?;uv<&oPI7yPeZ*Pl0(?lR8AUzJs zUj!cxCnXmY0P)k&ay>EVDo#tQ4JI1t)-wBfonNu)5%cCAYimJIfF2n8?TK_B&erCN zkZ{KAi}e=*3<4skvh73Q|4StFNv0|UfMq+A5h&vOAu7cD==Ee1{m>I*B}7Z0Y7uPv z+$htA!>FXSR=G@kf!@GdK{4U~FGff$rcb|C3xZm{8}_|qP>v_7ZBW6jgu5D8TYEMG zDr{tYN3u?a9m-b3@EZVDbKK5a2Y}cLPj9f$tCxXvK_lEfKULMv8>{ZV%i|>M+~i54 z-*R;fF~LV1@)71?J}H8D%O#5*+><Kfb;OQJ)EzA4qML*LY8t+jUO%hLU!FU#)7mRiG? zRdD`NJ|fqX{qG)mm`IB6;kPnyPaa{;Bu~l3<~=A2pCVJqBjhT3TJ>vWRrU~6 zE;2~vwAWC6AcbEdZ#Bqxz|$$Dl?M{3rgG4(#T4?wVaq0j=!7hYzse-hJ80H?w&IQt zR_0eM2xv;hyT%(U<`J=ImFgunMvFU>{R)|>9^(oNKIA8dtw7WgTIJKqUX_@3t%vrh zN;zfV=Q=?#kExc+@j=RHE5!c0LWbcSP22p0i55lwp}er3+2Y!raH zsin|P72Jd?YK%C=wk|ZC7u255<-oMiTs9DeJF7=eU32_in~pu>4ZQ_doSbqBptTtt zsT2b|+f8&n3RALhRr*Ukt|=TktF(wUSGrj+F~k@?xBnRI$w zxg61G{Wrpopb&7RA^jbkc@`?2SYi3K+$P_Nprr-yS zs6w76;aE|5z$72ZrB!N1YMS6A1@4N5(Ak=20&8#=*)(us<$}6*SiZg7>2-CbB2(SP zOc!Dc*9u6lw4XwYpHeY{R3cQFm`*nl^!5eQJ1T|jCIouX98=OIk=iX&%<8WWx! z^SQWs&5i=((up&b2roSB#I@=#lcR)w`H>(%!{=L2M|Lw^((V>06-(^?Hn|*Jf5tX>tn;I?x<3A!1z6vuMixqZM67deW($(b;FuFacLIIo{W%UmcS0&;$)c*pF3fi~!yqH&s zXgvadZh_da_Dll{To%TaC^XvEXJ$^<;`z$8tJDlQxcw={ zKrB-Nbm;23c92X{X<~ZDse!r)fgGcFMbU(zn{~6DVBMjt3*`J-rW z%)}-RkpQdxO&O)DBAs2kgHEH-&*(J4HEtQ8K{|`bte^wBnXI3$x<&Ygvmu6#fC28P z>N2?xqY+c)?#X<#2Pa}Zrl7CRMy-Y!HxnVXR!==w1Sz5UmkK>(eFhZ-e++dZfo?4V zQ;4G>x)@vFdSR7d%H<&6vnZY_B#Kq;-Y~fe&k#+XIY6m15RptKVAxT`bIC=?A!UD4 zQXx$nqpcdxrU9p8WHUf4{S?|7a8M*)P=nH()rR&T=qL%3!giAJ@jsev+NHQg8IE=Y zGtZMejp*z^8q(7&A5dfomIClmRc2AIsw^O}wb3r9+1zv|D~wWtOh{zxFpCCRiD|4q zH$r5R)P;^nhl$2NhS3D;4|8;ee3781cu-Cn=?~Rf8!aX%<~zNY?o@W zZJ_`NUsbclK$g?l|#;Rg!S}!Knyat6;u1}td(nk&f7^L~vh&zuwr$;SuLVPWjrP1R*L@VDvKQ~H zdsCB>Q`f)Mof=;pS)PcW>F&I2dU7nX((G*6!9keA>}xUCtIP~eZsvWSx1ePuf6dz~ zy$G*5+_I+cl$+;U({B!)3P7-W2LhWJR@dkuSW(5JimxgDFcIUywbmF07oL(`D1l#XC|u)5d*hpcBP5_{wwZ86k97x6q#VssQIO%o9l30p%(SY}Wd@ zd{ADLN$30yBJ5c6u?|ipdrHYnTZJWWFA9yHWj=<)i_8I4SOltzd_ppT^I+|Z)zi_! z0wO(7U?S2hU{|_8C;9l|d| zhtEF!&9nX-y0G@+*)IGCblq2V*6{0p*q>+4nDr9vn%}Q?X}>P~-{^QHpbWEv1G|r;D z$Jsc>@&;U`#ZgU`I|kkfGm-W#;CQH>QFAb$x&kvBL2;~wh_k}N!@Qs!_P@||J6j{E zw9{!rTgRzJZa(-NA&$#4E1?%azW}$M$$BLQH}sHR!~;Fmv4r(Zq%x*xKbCHBHx18E zB#G20dZ|1d5^xpSedHK8EdC~c2o^kqVr))pw=pzm~@PIA*O)kYFjNh{Z z0{=Y@^BgR#A9dH?`k4*unrou#OU1$+pSsO#I`@7vw0OEI(7NltiY0q@e@8m;`%PZ= zJzy4#tGqxn^T7i^Fmq%&&uXUgoMt)~iNBoruV*;F-y{~zakLN30fA;l-0yuSr8{Rv z**rF7eOE&H8OC=dlW%96VSHC&`Cc|-T;D4)O%FHfG3-wZ`)UX3Vm?k14zR zm>t*5J%a=2>?q=z4++aXIxVnbg>5tQu)wgU^D)fbYUHqbd5I%vEap|S=L0XFnYP21y-_7q>R-TyDAuV26~D78o<(klNz`TOPE`suPtbl zD~6J2jEvtfHo;d;ge2o0m}wRaGAjX8)I>H)#!XDWnP>%R16dlNSMm=*^Yh;=fR@cp z%=5(F>k7_ke5u5(Y6c=C0?7iQ>ZDpI$cboYI+LefNIybs8Sk*8VKE^U2g8ahp!|NQ6fzT>mEefmaJglpe+-YF-ac)}Z}aK8WKr62$3A7A)~zkmL@r=NV{ zD_?%(p$G1}>$9J^^+O-L?9vO~dd}HropJo32ko=IxopYe(UIZ)1ZygJ_>tt9XPj~7 z!;d6(o^{sF_wT$aI{txcu6);nf|(tl}S0SQ><-2{SYZOY`Eb`XgdZUMti7Amw8QszH%Kma~&3obYcKs87SWrIYl!?5*lE-i;Uz5?@K1SMl}~0yL3#cVKwU31D`}L zXzl@afHoGLfI6*Li3K;91>>y>a(+IME)nX94x%ZXF{okCT9odL45@o3Sx61BLiTpw zTf_r{{Q>i68JjHDE&P2f=ZTPt!wiXvZJq2W=9M%jCIFeTKz+2dU=jF2b8ltgTp5M$ja_ObMqL*n(aM}W9G9gFGJxK=WGf859G6DwE9q)icub>h7o^EL1r z)P!pV&IWb7Op>n%J8%-H62{7G1IR3kWr~mQGFH3*8+W$O-N8Cz$xG~c+1cnkgD2!p z7@>X*vve9Rs5NFInYa!#hr;_*22TTuYS0^WCvdDY&9TB`mgGAsEy>F(W$mG=meN0a zZT}2cZPsc>uhe78A-8n8%tTzFhpOMCG~h9nj#)DrDldP;SIu=!>o~AoN{=bQk%mI+ zAF8sx(+QQdh{8}deuEESYO+hQLlvfDZlndmmc}5W)R_F3h%ulk%7{4}w*Y-Pba8l$ zBGf`W=@{Z{5gC1&8A1K~>U1tw7;<_UbOP=|ZKw1UHTbcWOV;VH932c-J&IjC%*%z_{nFS)b9jJj=pe=Io|Da0a+qTT6go$PveAKRe?0E9vh$HnNb zOchFTXyL~g7jzNKwOF>@Sf^7?_2R4W7v&f}mw5VC+N5M3BsCwb5g3Db`r)68wwTGsRTMVt}z82>=2G zHD$110OCuI7bE?|tU%O&tF;?|9j-Low{ga_j?CNJPiZ4NCOw`4GC5<2!dk~LG-h#Z z6uz}+Uw*S`C-^5hp3PR>YBW;_%Kl`4R~YK$wnUs9SUN-~aDeC6kQ${+`I%v`$JY~> zkuI;TM4V8ry$@m^L}|Z>#4~Rbdz=KKmbgYYSHjn@-zf~Tyae| z!j;78KAwg`o-(HWatFd9t~ekDH@+uuL!CU62-?{wUKbO&jBas42?CDY?{MPyL(5V$ zKZ~4>-*c}Prtr_C$o{T9zcb&99M1luXZI^&x$b;jo{XFY>aYR|rw`ow3VBO&ky*L2 zxk@G)J?*thNn=bjUZAa7E)GZI{ZScpV=I=su^|^{j)~7;HCriYZB*y{S#xH-Y^}%R zGLxNY8G5_etW3mAsB}@;!N{?0PW5hrqGO~o`5|&D%!G_E#@xiX9oT9FLNYwr)quEV zF+3@L=SI9@(SGbcWmqKX(LB3Mq2xEJe)qmHkB5aVh2aue&}gLHMSX?#k{2By@4LFq zAT%#4hi!+3l{9>uGw@iUZHHtYd?y+St1j^=>bw5hpSHm+H|j5ZqS zU%$4wX7$RYqXa+o7Nx`WyDQ}WoM|5vkXP9|W?E(z*jtoM^RAy%~+(+Td$A$ z$*UFp%&?CxW{@hHS@St0-URCk*62hbvXStd1i64nkz8*tlRyEQ^mKy+nz?-2wx|X$ zDHJ+M#^)9kdSAeCc%4`Rr0H<>^>+TBw?)1r63eqRg=``9yh!#gk@5-96rLqgdr_q0 zQIW2ni1a)n(z{!vu}h@yL6Lz0k&z7|OMW9V>4+@fBC^-FMb@%!6DYBLo)Fpp9+3li zKNw`~A)NQd14WLyLu3c_obM1dAiu{r|*k4~IrtJkW{p-XG42c>3fUtfQGqt~%Rp*Ln{!+}|_lnt47PGZi z%n=uhIcBMtfV&0h)bIF5ZE_+tY)mMx8@R4FZwouHC z?-TP$u5^Pe3Y#y=FyATu4TK6?Flx1^XPBIJeFmnOpi6$4re=y?cHoQ zu-(u0b+(tp(3ECZm2DB*1~%@wi{I|Llvm+9uATCE_ez$hLv)C~=l<5og7_*=}IFUz|1nQ=ARI5@+*g#MzfJ9q>JI=%3DE zl)-Ly@&1H3hx3~wmzZCX43L)@2{-wcEHG2zndc;FF4^;2=Uq~Cwv*}l78x)`I!q7p ze3TrA*ONQsX&E-#WR#WLh`E~9dz|l`AkP0vs^(MDZXT2h3^46{uAAHVe5>@DJIMj? z4Pp%cP8P(rvHxIM6nhizw@cZ%U-Hf|l5tLu9*0;l=SXQdYw-o=rAirU&dJha8kFNl z{BAw_qT)x|rGsPL&Ji5@AJXoeD7~E5?Ns^wG6`UJYdElKfPwd&H*ns8k} zBWdQUpGaqPNE+^Ql<9d9=U7QQM{$iD<=M!4H@Hze((G?IXG;S^Siku$-`7f;`K^%Q zllyGr*fxHPP;s{KzBlKzNgIBgw9}+6W88m&vTUVpYb9lVAzfxa=`>quPu`uYWW?56 z>#p_II&Tl_WXpdn`(JO%F<)r;=54loTE@jvVyn!SP0Kfb({jz*Ot;j`Q+r-CckcNC z&z!kmI<$Rk8@%()2+$ie!%P(I@oz&u;q6Tbmi?Hzlrj8_z@gggzJTBgfHh^aXowFk4O+ zeO8}IYjai+Au%NhJ1*!i`pm#1)Xj40%Y)X}p7V+Ne7zTlE;0Nn!i*k615y@mW$sV0 zB1(fN3nVK!##DjxOH$^Fl#Eyn`ZA-V&YilYhZv0p+EPD#bdV^o1+>)&TEQs#(_;97 z#)zz%AkJlyh>vMmCd<(mR)SF53pSE9(j&Ib$ zctZYKo+NJaDf-1T^pmg4-_V1;DSs=^F>=2pFA%-*Ls*A@B0rU%$(Cb`7v_p`#hOQ_{dBj&q!Y#?BNsN$#kR-E_@mNUF%7=cG-iN6LF`J;KEM>P0!^E zMO2|`t*yPIv)gZ#R-To$S^(p!E2LuxDzr6V)dgH&i;rfqX z`q7U)AP?PgoyaFXc+H<*eA9d6lFQ#M?-LsL&-lq@BA-NUdH=4*9>4lSx8M5Vy@*XTSBFbN}R# z^WOHS=U?!4dG9+eyy%@@dh|vv7j>@Y{}s|r|83)W-omrGou_mcPv?GG`vqEck6C99 zF>f;GnG2n-INx^uzB}7p>~8C>clUM=bg$^Gu_6$za0AtuIrl!E>GNPAe{0s7gUxo% zy}@4d}A=FiN<=2G)+{w_CHw*Ia% z?<3Ah|E{IH|9_9y4>G!R%-zITyM!^P{X@IQWuQj)&j*C72Py;$QP(ufk4RFMD$jf_W~e2p!Ut=uupf*eKN1j@?Z& zg6nJUOnW4}w!NAyyWs1$^Z6y{ z3vv^_Q}&3Es!_Cm(e7Fwy&9LFtxtsPj$~%BrQzfV*M=mzRXR+gTAy@@yW3qLxhUA| zas4H?3eOIUZ;wG96IQdekCH$oLw&$XsLL5Mt2P4IVnxttV^K0fO!PI^5;%KoeYmx~ znpP<)=?c_zVSO~e8&{(~*sxn&DiX<))D5IDd|>>8uExV`re9cL14?D|kY1F$pnQGR zaS9a2aRqAGo!X}7q*4m&!|7TJ#uKl(GkJ7+OOCec z<7s^|wXiEzM_aJ|uJ#Br`gmUZH;2f2AK69KM z{8H-^o(*%Cec4j!=$zT1SEa>#z#35TrOAW|Z>=89WIz%zO!O}F8b%l|t&jb{Cu*u6 zq4&{7qhCj2lI@6#ju&vAJaBSys<6Rr(0WCHtZV9MD2@R~VS40_m_zx_3&tp|Pp$*! zg4Q=Y4v5a)CXrA;mDWdptyi!wdra#Se%0%6H#qF6PmqkmJjMOhw*mAIkLtYoXc-WB ztqa0jMoq(lu#Y1=qL}3B3FM@Hi*%OB$H4NIhZZr4^VdRcoK#JdsZ0-qx5eI)??mC$qLbQ5s91 z3LYDMwd!L(+4^vlTJtpY5yd3mZR^8;^kFN(qk}_B>(hEg$u(6Y7?Z4X8q5G7H$m=5 zBB%7)Sw1m46}n-AJ{uuPqd|)`^wz_lz|w}k)$!D10fC4ER}4IRUg7yrO=ZU9sdcBs49NS;EcirJu`fx(KfdYyEiP? zDdMhNf|WHv82|X5V}lQ<*h6Aly;tivd+ooJ)>rGJXHzNO^`pMnt0iu|xSOBCzvAZg zn$#x_la^1CbXy;7EHFjDhV>$IXDS;Hx8$f^jw4D7CdEdpJ`@_kqF19n$Q#B39U~fT z_c{_8PP6|Y@+V%|x0m6Dd?LiG)QIXqYDpRdpZd-m*I&|SX^mE0v_7^DS}Oe#z8LB0 zR2GkA0cauu8{di^C51H-l8mz4#nwlEJ$EKUD{Lc;XVA%txB*v6{VARgM)G(@0lb>< zok5@y&Ay_sPOmc&q|?L+q(~OclObI^pR|MpN=JRl{RB{J+l9wL0*96Nb3}%5E23Rk zm%&76U$gZIzuGd=iT$uXsRHI^m@hq!7RenE)+c4_!xh5%aLm?>C#RomeK-Oz5-z8~ zl;HV7z+@PZ)CY}_bUSv)QzIPGUR~>B3k2nFx>X;aix(&;+CycK`slsV8SfRx^BhO6 zP@h&^veX7GV^~nZWAEp>(s7AoJc&YpYaO;S-7-x z>5|r`;F6b1zo+$hisS6%AUm|a+zKBDRsc|S_N5h=DOFe{S}B=L7Yc5?+^P>zIYE#q zmu-Etv2=w3^qz~%wFIJ1Z>hK9CLHmJ3S$Wb>giWll#KI`b2(q%8@^+A9kk3q-G}zc74Z7U@H(+~|9OYopY{F}p%1`I`tCD#opa#6KRrw>4xYY!-I3b)2tBwG=J4A7?S~K17g9qAJsgBT5D#qMzw76}{qg~LJ&cg)?}rYa zd){MHkLnS6dH}}%>Cid54t@OYPb~s{1sH!X!uVhD9Y~Li^tJfw@D9>`!+R%T7(r32 zj@9cankJXX_5RmHYC=R368}NbU+?}EE`A@^MEHpQbwu@^JK^u(UF?Sk@TEThle7%JdsSLGud3eP%M=z)mpvLY_$hE zgG0k3qhr$eiiydo=^0s>om)A-YW13hwd>Yz*tlu)mXl6CW$UTiPTP)loW66{?mc_Y z*mvex`wtvEboM#to_GEQ7aqRo;!7^Q?D8wFyz1&}u6^Hi*WYmCO*h|i>uu=vJJ9

    Y8CgV+bD#gh&!2hri(mTk zb6@#q^!!)9_VsVP@ZvXL`qs;@eEZcSuf6`pcfR}PTi<°9vO4*wDEwgPyk2l_8Z zpFvNdFQ8}9m(e0-Fpq6Gf~$BP-i{CB4^S^rFH=7jouXe1i!m`J4vLRQV=-6Emwe?v zsee$5u#!kbA45-~&%r&ugr3I+^&Vkd!E5oU>OH;*_xKmlA$rB2D8fBD%kF{yffpAS zf1$A-g~{*5TNZCxeBa{5@C=@hc*s={;>Bzh@hK1evW>HegnV%=hq|XesnE*ANqgjPV`H39l8zO zj6RAU1lp|VCUgy~!>#B;=mvBTdI;Tz9z|b6&!bPmXPu62M?29s&@S{<^mX(SdI7zN zzKMQ>cB5~jZ=sjbV`vZh8M*_#hF(QS&|dTt^bWca?L%jvGtqu@7CM0b2^~adqeJK% zbS^p{orf+!7s6Z*ql?i+=n`}px)gmDB;^WNt1Hn}=%?si;Por$b@U1J0Qv#Y_y+nH z^d@=>eGh#feFs+aY4jEJ1gywEqpM+6ucv;1ICz-I1OE_lz|%j&<1gg*qHpm%+PC<% zMVY*(ec?I?#xJ!|_@Vy0|37}8^nd)#OTf|Nzj7!Eh`a!yX9V7C;#eb7n2L)}iMr%X zYc_AcIdIx7Th1sJL~+WycT#*3pC(Q{Ieo$2o2E{igm<5$le0UYV)Uta{wC|-iEr%c zy)zS^iEkI5Vhk`$ylMNhi&yS=QkN1%>rI2=wD_zQoxbTbIU3de90vEt!XG_(<&Nz) zoj6h(sOPTS<8}y70>9G!BE2u<@ z=prQPDM3Pvkk8xf9b3oVL1SaqBi19mSJg`07PY0}QKO!#9etD*-+LFH9i4>x7Z(4H z?bI)j8F|r|RLJltN83T0bOBvnH>8`>ovb@kcZu$19m|?@*r?;&RuhNaw4|ejy!8e6 zoFlf*sasFoTCL!-vD4s+H&V?;t6p={PD4D_dyegAS4VNI zoXMr+T05S^nZv9mdLZT6XKelS|L24+b6@ z8+zO;)~m6lXE2xg;vcEksJBo6MbJm3jRuzE^#UCUTP->&7_wn|!0T~3&^n!--KN7j zybfU&t+NR1HVd}c*E#I0Lx&j3Zw&fOA-CD)vN#Z>`26e@KJ0TVE;s9P7|~ccZ@u(| zt={~Yb=W$*{JVnT(hFPj+D}+Y`1+qetJuTT+wfrG>LcBbGw^8F$%BDQ_#@tlk573g z9x8q!{Yde_Y47C6;qh?sfz%^~haH(mGSpj!=U+5Df8m)Iz)$$T;LHmzJo8LqORI}_ zQ8&?1WIz*W7JXLQZ!mOf!eqhgn^-Y^r62oe3(EK;*C{B;HrtSD1;ID2#1Ol}I!-6q zn2Dhcu}K^4_r=Pcnc0C!pFBFlqfu#e%_v=H$k_(JCW~Xq%tGX?{^;lXEBR}`lW*0ZkeWV6G? z{9GzLF)_L7ljpm#n;#m*<+Pa?QfbGpD#*xoS0MGS*7@RtW!T&B{!tT1eOR zoY{+i6Yz`M$1geCeA=ma-KyMJtCTM2%zPaG!4l2wlMY-ovYu^Z^8+rVL&3!#)6Y2!&+A;g%x~;PK`K}W`J*cl@SN0C??(%9--qj z%_gVjGgfbQYQ9{v%7b2Bu30%ttz4sOvT>f5r-%MURzPJfa2-T^ zYm#uWM5!VU$_O|a6DY#5+9;K56S-$_8XJh{r&azg8(pup9LN0u{me%XC&sIRk6e@* zu7;03$lD#!dW*Mv#Bv*-ZP6PHtgee4_(!p!LU<|?aFOAq@LiYqQnOo<&B^!ic57&0 zK>LIL*m-BDI+@;nSFkdHKjgI6&%H11un+EjWX5MOG4H*{Q?EH~7G9hR?Yc8mnn~>V z2pjUcx=%SB@hcvTsUr#IGmC$wzYVs{ggj^!`mnTtmWnP*%qtb+u|%aR6&r0Zq8*I#g%=TzZi6=tR#7eV0=ani|!5fPyawx&e6LxmOAej|G9x(vR zfvxaRnY#?KeN6XZPk2u--$S&9Yk+ksl~!@tXQ_(OR?9I8s7Y9uR=cj^ z9)@e$xZT%_1nX`${_n;G1&8na*>G@kD((tLeS!3;Oj0xkJms#*H#SysjcW#@{Mi0WYM|4vK4tS2u0%OMx^G1zC)tPh6NlT6??g|ldfzT_p!1iMIyzCE zKRp5(d}PpW8=^kwe|T*8F<+!ngFDPEcJPbfzwpQ}Srx{}DHyQ~!VXzy;)z+v=c^UH zOQpW;QkjQe{M75Oe`@EZjn7!E@4fJ?zu2wjcfR-5yJS9AxZ6!jcQbLELhD!)q8+NK z>D>*?9n;hlOcOYH(`%3K+PHDor(VbGi~q2adwu^WW~&{XD2!70H2fv%-_SVPE{!=; z&U7M`NHy*{-*%?(t8qs^vI8Lx5Ud^H$U0z4ZyXvLDxDj4YTbQ%SD-Yg+A zF}vD7G?w2AnvcBDU}6UmMOz)qSJ=}cGO6jlc#MG+hv%wv#?@cMNVd}{5aS*`V6^8q zbhX3_g__P38+W>kqMMOz7CYtLYZe?s4#8qGt#I(>y*`??8=a$^FH&+_XChQ8wN`NC zvJT@ZaZZ>Qd3(c3n}ZqAp5U(c1h3)ZHn9*iQIw_bGKs4N!k0@?n0k>q2c#_|Ss0GP zk`4oM8OekMpzH`z2?NDrtGnVh_}8r4@XPPLxA5M3)H&V7g>Dy93mC(lVh|1d4LyTg zC?eS`2AWk|h-Zxkqd}tWa4)iEM3$-*USPdI;OG1UkYY!9-~!P%^@NzJv0>cSqC}Ww5FHUs$?_P?lKyZ}jiz zi$Iz11)4R<2!tMu!N<2%??_vb#9%f%G?>c{ZpjR^v)KU>0586~cniLqrr>kH0#_L9 z!6H7p*u8xhy~p|<1UMAj`_I&ORUH)pYMlxlU=`NJv3i=94Q^gG6P7z>RtCg`_1=%_-lVN*y4$3S}-zJ@|$PzS?~Y#f8Ox^U;q29>n=E0ET4AA z^!#N9isfy05!%2v$A1Rt@S=?5Q9N$Wqhl4uz%phdYqhwMY=H@=Y6~oMzB2}rm-K{b zk1N`QPi?nt=@Ol8M)CC&?MVf!-Hgf8_Rti(Dwa5W;bo<$M~^Y64#p>z@Y|(G$UuX) zt9>%{G*Dher%U4|?88~y!8+g+7Lka>Y6G{clXyL5C8r>i%4{}SQGzU2F$eWFkIj&X zRLZ4NME010Q4v)OTaO&EUiPZj)&Z~)h#Vo>7AB0hqOI*#3%)h5xSUIJ)NG6b`#_Kc zigAH_5mvVAbkw@y*2K2asTGxVjZ}HGI54~ZjD^xgkFDPEZIf?2d0#c-;Pt$8^gd?z z>eNZs&aK~34^@hZ;_!HLbXSQ#YqzwszS^#%C~qMrbRPq19k9-y25P6!!_wuRv?oJx zNiM~uxlAA($mG-cOefvR%%*13r=(6vpP4!{eM#z)^v$W8)1ORzGX2HW7t^n#UP=Ej z^~3bPrT#7b_tf9hBAa5+U@duj&lXh05GOT2@w1dR-2?-jokct!xg*$E@Ypc%wSHTcG|I_YG=U=dUWoPABJ(oXbETZ4#8=DeT#B-teXP)(bAsdonR| zH^m1C_`9E(fAqP@*_Xa{z<>HBEu2r=o5zG;&NcP9pKJs~xB(HDQ9p-l-i^}fKGtXQ znIrZrn>A(4WA<^p&CXHSuD3X1&8ia2vr^S9jOnpt(F+j^j#$c;G0SSpLCY1E+bvI6 zp0~Vi;etG?$9j{mY z?N+V(H-KgOB~>{ReKIEVfrl zdG}mvV&&ANLl5G7v&jv~Hb;1VgUNDhF?!{mt8P1EO>T6kR+GSIy!hnpcTOgpea-kW zkQf&lLN`f!XXCSp+2l#_lM*K-_r>=m_9ZWlU!1r&d1L&>#Er?1#6ObwNb<477ZWch zevoh{imkfAs)UQ2;!$|z9pj$ zfI&6NJs+A#2QaDkikRdiIAuN07r3CYp~dw5=$?5dmbf=)$!g=LXgZb%Cm2cy$Ko;F z?7~IslP^8C`-7u}hGH@}{o$g=tP_;#S+_j%GhZcCUs2Ak%J9|mngavYHNTL~yk_>J zKV37KttoA5$ZE9~_wKJz(dgx;pZ6g^lYj9r^$j|NGJyYFK9CRQL;0}I?8d&Rh?3Zs zN?{~IvcbUmW1>GQiBUneu&UZrH386ReF31~4;#R`fe!EpG!WUB>ruL$22%^>mSG?c zV*mtz0_tm2ao@G4=+_U8%InTOYg?Q$pJaWv7PpzrXPD_o?#XQrQ9odc2S4`hUA9sE zfA)$QkRigJxZL_t?2N`A^x_7}sCy8cWYC3=|84zT}P8$=clRfqH3Zyl4CG z1B&gagSJW|o*0fb@>Q!r3FJX@Svjd;5G;*Iqudy4tZr;;7y`UQZ>l5%4LK9xG6;TG zynF-6ZDOOB;r4jcl6($XM8N7OM0><vl z!g-sMuYPjh?!-u;zS8XUg|mLM&N5%wckAczUu|=y`ifF!N5V0(p?T<<(Y;sC-S^H= zHI}ceD7#Xe#hTuE&JY#NUb^Sp4-@Gg0H10R@{=Ssi%NEv1r)OZd@H+|vl~2g{y86HS&KI6t^1>+8TD%yt)IS7G5=A-56Y=$ZN}qvvl|g&Yuhi6{ z>RSHa&LzF<86X}U)UElgM75Jp0)xM%hX?hQqc2gNqc7p_FD$&Wut5B< ztI#;iXF;70Bh$V4V0{{<)7Dd8J^C{dztruBR0PL=zVb`@FRuJK%xGruZ`3GY*95Zq zL20KkVN4oR-h?;lO=S|9WG2N{S)rNq@r|a#)C#o9t+CeX*0$Ec))lQMTFg3N}HO1YV+K&~d7;6QI5TB*Oytyf`paBrYQF^&YVDnwbVaMoWJIAKKsv zgBgp*kf!F^o?b=)^;}^RWh`j{@}9v}Z`V~@pvD?oEWBXNW&CtrfH1?i!dWnR@Wd_8 zJk|aC^S7+M=a6yDmv=t>7d-OA`@TM~_pDrHTo;uZt*LJu4i~V__msUgXBC9t==uWg zBUOTMmmi*Y~H{`I8P#G?fz;g8nd~W z=MTIY5kmfKH)(d%+(P1SfBB1RZ^GrVGZchPI-M`oa8biYUsx3h=yX;qHu5fab{}X0 z@8TjYQ$&MS&?wp~jdliyhXfWJ-(Y|n0vZK2onnHtWY?z@%nU z3~`tGM4-~z$avfan8QEK1(WTv-H{&edLpij8Y6o1aRI+}>b{xGh7F^Nq6`e4bagoz zDoSxSYED$}EylHD^=$%$yI;ZGi?Ef}lOXbkCDCtym=X(>nW`eWjHd9q@v-$;L&$hw zxV6WKyZ4bAa1H#4e}IOHpw&{9H#>x&#fKaQ$-)X|+CU>#;6p)cPz+XrQgBUBALK0( zRDmmQEYoft_yE$il{iG&l9LjQiUUYJ^+F$yhvejJabi(>9s?02{N=}g@}p1Bw)Tac zI;X9W+&Hmm{jMD+AF$hmkD9;tz$4%B4QEr`7cSno=7no+ef`>f^x^x6j`sqFucUrN zB5^b#r9y&&qO4*OxG+|r9ASmjF*1h2OvQ=il#{oHWhSiRlW0C|j%pqfDn!de^JJ}; zCxToOEJdy71*8Ie3~DkEsH=-`{`s#zaqko7RfQp!nK84ev37mz1a?z}&pmkWhmzED z2Hnwl%w?b2di4=vKghg`kU=P*_epCE`n1>M_W7d`F`4pb(nu+Qe)FdU(M^&I3d6Ee zS}!OJVm$~7?;fi$iY)0=rhqJ&l$1iT}U z8n|jhAZP>0gBsa#9zl2*mn=Qi)SBW8W?cgy(zsfqdrPMOM;uwy)^kIkD3~`VR;v^uUQcx?Ea`jb@$_ERGP9 zQ&5gm0wGoj_*up1;EYs-#}dU00b?G)qB;`-Z*e620gE#jiYH_y&&dfVYvBnV~nRA$4%5MA3eb z$F6TVL#Q8gpF8=|O?3Bp%CKWxqx26YF-YX^1eOpilp*7O9mrf0{gbqx4mbj_Ks_)S zSRXh&a8BUrzy|^k1fC9jBk7F62VE-G%aueuEmd+t zLa{;p!)oJ|D9sjenvSx5V_=L0VXzfZxl)pfC6d&T6X3Lvq=u%Ww~_>*3K7s-$B@&< z2ZroM&ld)jtY)uVU>X_5<$*%u@?2t1ywx}H%;+{w1sazYvX!+$$j4mCu_-c-V*g{yrMm^@--)gDjVPa#AC0mr}CNZ zS1x`0CE!^CQ1ddNW(X>iJ27f`QkifBfk-Hg7OOPstOB2_q>>QIdg0;X6e9;PVps)5 z_=Yis+{kD|L)g+XVq?pTy+dJ3q?5v_P^s8y;Z{g44so(rr8E{+;3ABFP<$=dj@Z8OGK(djP<8 zo7(*jQ14K*E0VxpZS>!-byp-rCr#mfzlFS^4k`{hoj+2- zKPrhnV*F?t^#6~4y!=`>*}tZ9$4Uf)5%}>J;AapOq@dMeQ&14psEs44R6!I=)TmoF zdWhexDH1?NwGv&@7{@50q8kpKNN z*r01+E-9##CZW;6Z&I8INbs6CBkN>YMBxx?ls!@2DH%h8jBT(ur1l9jg1HgN2B9aj zOZF438dPn|yjzzOl5uK21}8wByV3y;zfcalY3j`@PrY!qK0NL5`+}}~0#8Y42}$rj*SgV!{fs% zjHu(uguzwLDeVs1;*?C9%Xv?PXWN)jp@}Vw(c>KnThf`4P&OB@jD*^)+(0KJjkE+g zo;wbgnhw)M6@IGl1huyeoT@WI(5d|cXhL=ugYfn|EfsRh;R%bltdvGG4AwGvL^(D} zH2y?Dh2e4V{6?BAaA@!Tq|09J^1)0#v=iG>v5d>ujpSTTE>WDr>&0i5BXJo@2?qWc zJA6gmD)j1RMz45o_oPmcA$pUdj21S~o;nEpwuAJG!0#|*JnA}q*wbfY*r*tctQ#4O z5l`8(+H=sO^Moye%guzs0#tFr0w*zHH5TZxt7Cg%D?v1Y4ahb@O%3GlL|fQH5dO*V zg(oMi@BPsj8uAlAz*P`={L2*tIGzJ{tm)pf4B9;v2ADbeERit=IuMgE>kj&ebPCZq z{-7_G5BP)4MhC?jekBVTjBJLDA;ll$`j(&66_BTG%o_a=5iv%nJ{Xuv$71!wV~t$C z)2zs`3MV&Wd`CtePO?HU3*rC-Er&%1P(!8d>l~Q z0TmD0e(9F&Fhcr656VM5sqhtGNRF1**njd@i*MQYuF5>Zon z+K_!}^v~4RZm}Xpb$TllNSRoqg5M~4MFY6+-BtK$tI;o(x~b(_3ZEOXe^Xn5 zmy7QK0~YrN1fMIB%opOU%tblL&j~|*9G8*?p^}953(^%p;uw`dOVOcbCsj5=o&|E? z$1xBKAS|{xj@x>^L(kWz;&CYW)O(d5`bs`B0Ia&Wo74gC+G(cyE-x+^D2h+yond@A z-b3DRMFlKUFJp>Lij||!Ql|mWq9RLT98B>e75q}kl@P4m1|9=mlJ|*ETmgULBsI$r zMp-GS&`{oB1&)PYh>8Qt1_xgbjs+<>s5$^D`boWKnRZNqMOP~qeZQAJ>5mUR{_FpE z zR8SBo@lc-6Srn^9H7YP$BT9yhumm|{#f9ahi_e8+<1r7NnA@J~N)W3Woa3S=;-(7} zfD?2XXeb9s)Pd%L;KzGhy!7S+XXb)~8z;xtfa3BLa>h(}q$4=2&RI6xy$Kku_5@WHx6zjZcUiDcBWSlY25u=&S#9;k5JM@^JZEc5Ok40O z0g8=6VN!>00X2xQs@~{QCWa^@5;_uX4VZ&}kcv#g zLO|mJ(5ct5=XEW;d|bZ4X`mZqjJk53Iw?VT+@4ko9}??MCmRiUe7I<t zcuhXj&q_v7Y@x|%kpPG3%>Lm`uuZ*B&)pk(Ojfrbu!iWk=0)OFZwoE?Ljn+u9W7DOg&esPff;Z%i25_qI~srvFumhCvSkn}B}#TC|*#8zEJ4md6)N;7K^pVw=oDC>{ZyJE!M zi?<7+fS=!b9wgox^XuzV1I3`*>9<+Ul`V~h?HKsKliKAz~$1$L4MFR z=pOP6c?W&XYO~g?Hyh2S$z(Pp6NOaTT#hQ?0w<-Tka_ep0<7%1zT|nmr)VkoJ8n8AwD6auK~$Afzy~)HjLZNmK|C zqMH8KQTIQxW8SbihrjhJ)bL!%2*1vuF z75i&Lc(?1c_ib(@^0jiSRJ?4*4S~UGqWf3d+TF!UB2^EUM$QL*KtDPiRBe4-3S&gk zp|Dr6+F4K{tkH=N zic`dT7&Bs}`~BKY`!7Eg-_*0IV06Lt?;bSAW~MeANSAS}5{+pV1TX$ObUb^3x&)e% zvevkdNht9c!~!->KuR2OaY(B$Myo9rcO_6r7F@gx^>a1+AxcXljI4u7C)gH32KWif z;vGn$x;4xC5cV!MN=AiV+^OKn6DYqw_~!q()YW z0UF{OosRR{H{bh_Q(xZV_Bn}<2!6qTExxDwHq3koT_jC=Q<$mPGvP`)Q>_eTluC^& zN0d;I(?^J(2rHC<1bm1GE!x2xlrkBetUiL(ISDEC`Kg>Zkr`piL(OCbM z_Yn>CntmbJUs5%FcB(!pU18jlJZFmr^N04p&1T6|41#hTBe zrH*wt_l;;qjNn&uF1wLmA0EioJsd{KcwuB^V)F3Hq!{hia!JPpo!L}XbFuB~fB$YvDP)9-#y?bg~;ow&kE1ZIXtdq1o1ow8U0L@6L#97WfKrpJz!?KyHti#SAD5#+c2?mI^N?a=c^- z5YM2Oql9O`7J@vLBU}5;M5;Dx9>*X65|JuMGt^xSxB?6X!IUeX;JZFmy?rH?7K8ZB z2Jl2YITu@#E@Xb^kCkd$@>d+E>Ar*;%@|20khsg_YJXtG(2a^Gpr_y+|NK4kpaWr- zgc^mp&`DC=z(C5$TY5$AB4T!@oRPG07E`a;72 z&;`<^#bHEms5k*d0-g`(JvCt*ZDQzCCdMf0!nloqf^Q>}WhJeIbp%^&!iKAlO& z%@?I>n~kd{Dzlu9)BENdGuJ08mrXZUUKVrd7z1zfLq8#XvS6_XY`os+iw(6W9Pjz8*v{&WqI6&c(23_O=GG>YP7+fBzY?}Y0}1b z{%gS>1i^Q%qUOt+ivH|Zo=r}h{T`3Asg zrW3TK3ck+Pvo#q|omF)m`VRl7uBkTEkoD+yn!p0NU1agn&2+Eq*rM!ShcH%4=O-BJ z+_1E!);O!~#!k^0$hSvh^_x#yxWS-*m1e6Bli+iNYD3x01C~NEo1Gr5jR+iXv7eld z*#%QH8mS~Bqq7s!|4+2pL(gNg%h?GRTVbdp{vLR=1y(Tx;mjdvg@H*x8J~t}c@qj< zh6H{>^@%(I287>8o1B6Kjin}w08`E8yn(PcC%c`TJ0}Z}*9sHGK)9jRX;ox)@-{6! z4XObQiKa8)C(#dT*qVlBUM3Ez!UkLc-3PWo6+(t=#?e9|V2lb~=rW?V+12ZJdWJ2Ky1>#|II`kas5dwyYde5h1RkGZ}0t%5Wc zKl%Eprt!|}4<5R~5go}Ui|u%zX0tj0!DLqF!Rj~x!@H!RP%w~8WK%VoR}$c_Le*1A z@GM%lv832!9AQfx$QvlK-+qh*}Jj)2(x6D-SV zhYz1NT{7Vh`TRq3BmSb})ZwP*{Lm@6y;qi^ZZJ|uKcp>A&6&CG+=JJpTs^v3SPd8K zz3fO)mtAz56*kD(X~pd3S%x-=JlU`yyGbuBaq~35sYVFg6|zbIuVvG8MKwp9w2Nz9 zd<;Xe!AsX)aQD3j&b_#M#1!e|M`j!!!#JEIQNxGlHe7SwSvOyOYGQ6WKh?Oz6!wga zjf_cv71&iv(Xi{Rh_*=0ydfA?oNiWeI#@HOBn?~=hYe06XMo-;KH^9^on{&O6oV17 ziIyWAFVh*AFKIo~xSFPxLNP3)RLteqP?_;_2D>;o&uFX5)o|$chat^9{bjVu_s;q*>U6 z2SqF>=YhE0$|~CF^SEf5)PVMyO3`>u^n0TYBQJ7x z=Xt9tC0EKK*uS@S$3q8CzA+og6jzjz*>e|8UeNixuz$J~wBwtVWTBW)lz6d_c+MA2 zM7(0aFZc{Pm&?(Ktla9L>`s9(o;tH>ZK3Ut7(AV9ZJO~;73X22FJAl;;OqvF{w6vg zjU!*Orc^6jomS#W7D77KM=QLARd_R7MR6l$TrDK$LOd! z+6Mr1cfZXCKsyJ6u@H+*LB9Kn2LRdA)%cD~VQ%PWrGy8H&sOYBm0r!}5(Up9Dy2P3 zxcr@_6@D8ng1muufmc%RsQqkvB-sLj718z@ADP@`Z5Gj0*O!>C>mQ6Y*x!Vu|=vN|V@1UDfLbJ9>+|s++sM)=5+g@jw=8eDcs4c!NfC55bQEf(M~$ zaxyA#u&uJtQ3l$ak}I%EF3T#u0Gm@-BS$KP>;TFcA!ucNM%I8jRU;ebOmhQFp~)_f9`1t-+hAG-Rg#H?-TZzPT^Un`6&$j;K2y;j6pL9;dhaX{SFh z;CBGz9o-j>LH_O5ff@i3Qx*$m_>?HDd1%J2g5S!OHfNmj{{sB(81V0?iu)e`?u$|Y zP`@1MumuTl4lpM`CQ?lZRE_yD?Dki*huvj(jX{4X;I(H2ey6S2(FawS!iTEy;b*`O z%%WSQ%@8pSj7AhR%POrVN0JK=2*dLT*SCD8aUy)<%n$>ej7F!COpP&E0suBB;Q0fw zb~+Pi$K`UIzeB)sKmfBn1 zdcs>LJ6*t6S+3XU&vf66Lw?2;uxBBa9q;}!CXiP#pZe;1?w(|Ox@>b{V4YK+-#NJx zo5FUhJ6n1sn@>e6e}a55MA^O91y6TTdqcIXJ<*>FcFJY@%9X?Klu}L|gg~&f55)f# z;B6Ul4DA4vs_B09Q1L^5D73Mu?RtKi%Niq$ANGM50w!}VUq%5&b}+n*V!%3;am!UW zVN@>`#A(&&sj8Z^<`J*qcviTUlsn-az6H1ApsFp&?#q3R=INR`YiIUq>Kw9>SjnzZ zm2}qK^Bs;+xTe)t=blWd=fCBFLKBK>d%VI>#jf`@*->tXq+jr|N`-Jtz*0fT0v_)YP)0$SD zdeE`|wdkWxfqA%~ZhM9_eo^7(0(GJ3!u*8=IuVa0t30i^2Z%9+HWMhc#d(e{nKF=F zc0*fX$>AKRc1k59ErPK zPOL4$lDS;wqoh5(f(K@GNlzqVq-jQsI-$5ob$=fZ0q1QY5kt@Lk}plN#+50be^?%f zj)%sE;y&+u>OiUcc`HRbLRtL(vO!2ETZcR)&7&ULR*I445_M&K)Is1#7`zHVpDk1k zqom@5)?`2Q+w}Tu{EX9NgbgGVW;t6#bmnDGo|kc$ld%;VYoMkBUnHq=Jp6zGzy{!f z>LY;Lq&AoU@|OAGo;K6$IpE9I7bGLx;Pt>_fDw|iAxSK()+0*R zn-H!B`|5JnkCUyare^x)wcTn%Fa@ixg-wP)PowxT&6L(wCdNvsHp_94>P=%I7(UKp zSZ|jnN~Muz%m;ZnW;F2Yn!2PwPhs)*_*?jQ(1pH78mXZghHwPe{62dCXM*59a8l4M zC?!2B)v(ZHOC}#SpNBLJDGW!71=YZ?TpR#(kA_ zD+=eY%V#rb-bo3sFRV-jypeD`pKZiu7X+I%=6TsWI3xy~9)GA<7|+eGvO8TlXf(u& z-NnD)k5M0o{W1em#OX5Gye7nYO{@X7$(X&8(;EVhJFNY?CDU87L{m zo1|IN)r+aLN}?LLub7O@P87|-YlQQuR4APgR_q5~_HzNYIzH-qDb@YYdcH888Q36? z!%Y4ParrH;S??{PMHZ${6OSslbUE%9V-SLt9Z#k zx+n$==7>(ea>guJ#7B}=e{dmZp0U+d26?|*4;u_$!Frd;YJTO}xKrRjiCJ}YWahgE zqWNpSLAKNN>O}M$%y5F|!4sFpqSMMK;u8vO4s_>@6sfG`2l0K&-O_~+6#i;=|cI=$4r1k2rL^C$iLv>n)@j;J2$5IOk+ zXuKBiX9(R5wIPqS<@FSOEw!;S2@RG>Xyt&;WS=qJAcZti8)`r)4Pt5oO6v_3sHNrH z9!JFM3#aOhwA`xj1#<+tuN^+#YP96iX0uisQls|%9)4mBfNz9#{a<}>tLV@muJI1G zH}yHEWu-N&#EB0Mtb$&pW4&#p9Kw*G-2-Qxz#fB_FLZfbLA(%vo_4k-*?gXdO-#ri z+H}3!<8pOBAMlyR*V%l5ry~$DNH4w|gYGVHyRpHf=dGL8`gjMnSaf`J-_H}oMuO6{ zaqdHB`ph=fA=f!GYX}d22A+dg#n@hH*xQr+ zl!5U;ONQT3Xv(QFo6^Y+Ki@Q|p~(_(GOxP)+s(>;N#x$xvdM6nTb{|UrDi?J1g4VOX@6d3eIy-_Fd2539wEe4&$LrUCw1blkUg!H2l6&GsCm(+v6 zF~F*=fLt%exypG_zN^QjR`vWCkAKyD(|Ob6&sqE&b@k*A*zP3QJaKUtp9}pdX|y2K zl`yDSh!&w@gpf-J+e{9OTrqC|$^IBCC;gl^nbgS!fip-pogleL-2}4oV79g5l(qsO z?=O9EZ z#xtu|Q-6HV3u8H;bgN3~7OAa-L!2}1Kne@}&nV4@ZLA~VbVU6=4^)g~UzGKE5(yd# z-JEO%gKwpKRU*wvQ4^t>Fxmlf@aBs^GN`RSNyo@+H`QIC8tH^u!VbI@2>rw^Lg*k6 zKRvzYV*{1-m@4MQORKwwfI{bP=V}?YSpg6B3hRdKoxO!CBgG=naWQ(E`X>G|*y^<8 z2_Tz5OPoz$yb|pdU{jYs_NT)!51LxFzCgT2tr!4`fe1jHfIX}u2AcZj#x>z;U^S4Q zFDaW=2U?L8fuubT&AlgIZg)U8<*K3e*E(GlyM2BH!D)Ny-YEKEss%O;VGo>icPaWi z5JL=9y(PQaf1GaRa?^zfi|f(D633Y@AvFqrL<8n}l%&bSn_ReU_qD z#`>Rl;)sdfi18Cfd}HYzZ}dh?oG{|?r4hHm2#woto>rgRS~ZS(ZfVqadiQ}YvmW)@ zTz;}N;(JT?*|6+B7FZ3a)WE1|m8Q3S$FBvcnXoF&vPLshD+$fTrO!EW#KfF70z97H zOtcY%X6+tt^zM;3VFaOB8*v+q&}hyrn=8p%u2bjox;B?5$tPia?2`aUkl7?Fq>Y&9 zjqogel9u}X|may3qgxE z>N_XiNAtne*>2Wm3;Tu%ZyWtj`X3`EdLyzYj3Bes?(s%%ME-;kWVYIf+hByo+bS7D zW((RbzF5a!rv8lP;moat)^KZtY6k~0d)#nwJjkG=x=@0Z|yG$~P|DFX`1ljQm zcmOJIWDk8nvRaU2a0v*?Np{#TP0C4dVh`EK?l?B_mWR}kReM%zJv6*&#LqqG=4G*usJ=K7OZ?grT;$J+S3R9;;?y8D5N+knptwwnzoa0=)BN}EL zkkv|aY}H0vJ>EdI9JfN7CU2#AR!-AUQy_5!S%xJ~7*+wyFD#E1BdIBp{#guZs7#T_ zj#Q7+aQ2~UhDoXt_TKbLfTS_XgP$&sl!~Dyzt=XJXsvfz#-C^xH`>=vZMg5eM8iMt z_&Aj8!wIKJz%K`ea>-)M|5B8Lq z9S{q-X1+X|LaQu>W~bxId%dy<{e+ejYms>*O&J7PMg^_(1Y98@7J;XR+a7$0Gfbl4 z9@o^XS{y;Zt2IvdAWQf9TGVud`n=c5Lp(GH=^=8^xCv*vXk+><7vM~Iz`c&Qf7g~v zq5Np3ydtDCKXb*VOWLXYa6M$Hius||1Khn_D>2Xro+;y`x@8Ha(k#HvG}2G&e)XpMCZ zwWcZOn{1wzlS5pRm6ZrMYO%!ZQ*JelLRVTtwXYev|~QxS0=~amI(p10T?SlXGKAi*0H>c-Rf-D9hM95h%Nr zAef1;9+R(td`3NJqF^E}_+$?pK41(AQk=M|&~L4xlE9TnvRXkREiBNJ-rF7B!yIAo zF_i-i6y!2=E0OvVoJoLR^{yC<4Xv9T$TgDTNWx*ziP@>z!V3P&udKOf|JwV^;vn<~ zpSE}3n0I=lK3#$%&Ef&GNb9R&d3@()W&d^8&R#lZfsOH@7#w8`{RrUk>;w4v z=&og=;^=_2ZG+uvVvJR)&?W-?eT+D2s^XkMG}^3@_JB@~q&XQ%R{@>uZm@1Ra>q)` zrXgPKY9a~@EC_*>nnlxWjJE#>E)rZ3>J)hZB-Rz&xZGS-BXzTP)Upe)Z6;fw+MZ1UO04 z8NjiS0}Q{wMhan1E@cupcX_}Oi^N1{@oq6@qHMb1WO%@Yza@P5t+zgW_gkbD7wuep zjXvD7_$}yzm`x;esd~DS3|pg^?47W}VF9@?Z_Qzpv*yH{l)Ex_N6sL5D}n`Vl?&D@ zm2A}O>E4ElBCG}R7Sy#+4U&4`0Vy?Zg=Q4ej-sxJ>Nzbdn?q@8$&FZk90EyM^*S$m zhTK3O{?&sI{F?Am{O;X%fA_n0-}PqqfkU_4a>`HO|?P1l=m;%^c@i9bnw z5r2_-1;0YQO~0)Zhdmg>4tS`udAvfQR20gk@u`ZSbOt%4RN*GWN**@xhr*C+F>{X6 zu%TlpK@mkXgbaegWB|oOC5#S}Il;jHArK0WO~C;OxqO0YHpYjBr^Xu6cte=-NeQ3e zlpJunw`QYA8om!_^;!RwnjIs`Rr?}}r>}jMGOi>mON0d^;OwnrUn4L+4rd{&slgf) znuwDc*Q){n$--qtPY)!WAd5)K`P%4KyV+*InayHoZ_YVPw9WM?FBI+_S>6QyIe^=> z*9oa9+Q{)&wwu>L{SG_qAGg^l%DlqAmiocD{`v1aDQq@lm+hsw;3+o9GMY>jY)ZMu z#+oo?{=f&!n08w4w>roLOgV3^CB96;GxQ|%wLSoSt!C2KN@L=;nzg=GhguW_D*|TX z$<+BlXUG&dZH-7dlXsg0ujtRj;0$gwO{MT>sK-?wI4QX;v;zBupaI5gS9cH@6a;%t z;n;0(hRefw>+ta=arptB({R{ODiIE5ex3;g)2UD(L+$ftQo(R46NHm20`MDb3mjgh zs{`%~5O4ody19ZYRE4hSDti4GwESfC2GnGxhhkANo-36T)zx;%U9XX7>j4VszA-ZBAFp)mC$QY}7k7 zt(TjloIKrRr%|;mmCB^V<23Vn8Ray$5(M{{k;A-&jX z`JZU961G9{oS|WZf||3}>gR1o&$_86YaDmb1Z-J6w&l2qA2jIopED&DKj#Ri*zTVy znbFMOJhn8{b^UPG#?H2@f6_*BVLLgG;~(1b6Zk?rV`RHua!uS&kDB3_A+m8vryH4r zjiL^V(Fipgas&s)-Op+#Q;hF6P~A@-cUs3UKx0-Ge*rs4{|q(nC@MjXx2CtcO94el z!7;!A2$UFFfX$?gF>kUvkm!lIOL@0g$z$0BHC_=;(iF+z<)8-D0xz&fHB7)mje~@z zL;#6uTo$lEyaJA7k|vcxbq@oW7_B$fL-wCuafW0al^6cwk&E_?+D2wKcmM4@IQ?rb zIRLv*^#<(;tt0zU$Jg>}8XrCN(Kp6cn^)EEo$Nj&#?MfsZYui86rnlp>=SI z*S)ZtDFadf4!ZzH@Jd)Ga3(l|*CZj67C6I>A5im0@(>m#n^2kog-uSkRFlw$|N7U3 zzy9^FN5A&q%M0(kv+y!Bo3gX4zgZWB;+>E0~rM(bI)+}{PL&rb~c64xLB(2mMtWvA8QZ6n0f8D(acvMB! zKV0|r-ko%J_C2}jB;DyOo$hR%&f3{X8nTg%T?r&W1QJLBh$}EIC?cqgE6yyi0eed&sK0=?au3NY2)TvWdr%s(Z zCC^;WEG68@SIOH~;Z?!C8E+Lc=HvXh8fQ%6;`2ij5~D5op=pWHR$G2(W@2jeoH|hx_-;tX~`sNcJ@qPpe2xNebag>$^6OW_dxDHlW zaD1VGV+sTsM4Sq`BW+VX;bZZyXnz7OBl@v8T7DEyZQ5EVLCByLd|jr51CBa_5hnp*bLV9W zqoj#9L}_(Q$c0}H$z)86fkT=kcZotP z@&-6tR-9#dUXobE?Od)*94(ejUeq9`+pQWVwRn%a7AL!HswAT>A}6y92|k=2@O#gs%kl2WRuz>HvE zUM-jw<|E8vwn!GQrOh(evdpr^ve~lDvcqz~a?}!PsVFTdjLoiXNXe|PuFk8-mQS!` z$C_e=iN{#vbslaW;o~}iu~wxP4LH`I@qrH)Bpaix`G`W^bI`101QN*`G0-szE0ykm zF*e^a8($cob+Sd1s!5H(M|dmBXv%k_THPvBX@R>ot9Xh%3QmCG;lbi4NX!{-t68B` zKCDn@hv*DZ=BVEaHTu#0dJctqvXg5v4Jo*`s=$$vV^r#OVHG&>U{J@$MW-jkINXH= z55QM;>{SAeuw}%iSflnP&Q3&YxY%6bYrdvP!W@~w&hwV1BulCA9bqw=Go%b>hQgbg zY-FkCR8hxL1ugj}_bKAwSUfZ;g@vR>snb{pOoO26;+AZI9ssJz>o@LJIY6$!R2k4* zX#zH3w82dir6Nd(udkZZvt~`t++RJQP$$I3$0`(1f<`CCsKqxX)LC@2&!6AkK7U?& zZnW3p%xrEgw&1Rv(Ko4LnESDVqDaG-sK*U7?d)oAhs)p$afUjLMJ5%~8{+FC3Jn$6 z`lh-FUz@KqTOW~R(EIB2p+2u#-)8V?N;Qb6vt<^#1Xr}Vxz@)T9d5nD+!$R4*}x3T z!&+#ZNQMe<%N!EN&+Pf~bQ7F;xT8R52>24oBnFQ*6=5wJ^udVZP(g*%xCUk1S~GZX zLryLZ3xX;Z4t-VPetkitAt50>4Ts|$rm2&fr{RE9VRUp#WRiS7YIbh76y>w593DLy zDwSlH*2I_+R(1K739&fLQB_e{UZdkDp)yLGIM3`@mQz$;MF*#h#_*ZejEGQunj{~b ziinGdTQfJcxgpzIqM6cJ2uhp$FN@hChzdC?o1fq_M5mgRX}%P=$H-FZvUDjL0oM}6 zMJ1-eb3|ieR48lI+el^wfw)M85fYS>6-%;AC2KD+rMNZjz;aV<633LnvW&$Qn?mn( zs+82!bcL{aLz*QuO(9IKFqh@K?_Azi=Lsuuxwj3p2~`K&Fo#R1ifDT}U$%>Tr6sf} zt+(=mjrPeQK1*-KVu&qti_({38uXF|=)^AaHtX^*3*;AsN`=lsZ(&>E+`=`5+X@d9 zY72FFK0C}L!}3DCp#{dg(5g^Tr?A5}2`h|LTjL>uNrjQt`1p{=G%lFn}J(wO6o9;rVt5x7Xo}q{@pUITO!F3b2A9r?%arNy5X`fSDeRLQ4{(@B(pO`$UiSp`a)A{@>@JrjGb^42y#*&*anAGaD*$Pu}??G~i@THb|uCxp0)a2+ayO5n@ zt*>jE)Q~g7F0@wrDx37)hH7J>)yE)zTXT%ju|9olC_Gdc>lBq>=rq_B3K6boOJ!)9 zD|%9WgSW2USlQlK){3+B?a7UW-MT`JDr;ER6Bn{YBM zgVH6%2R>&J89!-gz){$9JE12HlT1jyRm9aD|ABuGVn*Rt*{VoGT?u@46of}anGHr= zL{fT2c%)X@RDW&wf9Ct+{&@zEAXX)pITK?|F)=1>ghFFUw%KrSc%gpof8-UUZT{uN z^YMkEXt7+AFyFA8xD{cbNdvRpK$Ba5Mg| z5<{9MksNCoSnHIqs`faYCL`VIXr58;X`SM&pJMd3R~fC|v~;6R?bTpgfSQ2_K4EDj z(;Ylb|AK0PF_CqwRdCV_DdfN z*|AnB%kC(fU?;1K%XQcTcCr^u&rn6{yv3c))cgo@1hrXsLRy+RN~P2)(!(?3-?x{R zS`%ZFrMT$0oWiuA0c~7)X>tONU2p^1mS&eAmL+eszPoFx&S=epX-x7C=KB+mc&_{DkF-m;y93`r70gR#1jH5hf zmWb6ADXn8P8aUULgTiwt&zX>r7iD;FFAB_wOR_~6Ui|oeeQJlhxZR?^F98Kk$@kPI z>2c$W0-n3SRosO;CTZ6=joH1i38|(ig)Y?)Wq|+nSUOAvt5&+>hF?5`$%+2X^ueAn zVRD)nZt&RXsFckkH2*x*ZFLvnZa^42p7}jydqfsPvW-$Lw>=^|6?<@95wK$-iy=y* z!QGc+pG0Z0gJ}X5LzE^zkcKRVC{3E21~hm2zgE5ic{dzBuU2>)BBK)G;ch+3Vl(9C zq-w0*)EuJ^-f_KA=w36RhS`38u(cZg^89W24y`3dc{4#ca%tS+or$^G%L#H*n^3Q8EbC}s?FfKHt5iG z^nrldOsToxg1aAHut2TkGTmuKH>Bqn+^JH7o&Ta(S9Y?+SaBAaxrmA6mDCtPz)kWrKqEWckO!y2Gmf~>HX0Xs zutONwPmCcNj2&E-9A{*v@Keo|mEO_gbdJXDUVFaPHz~WOMBUsKn-rfwBQ;|$3ttHm=yNWg z4diB@d^QM@>{}nH6(|2~YQ@PPW98H$?rVJzTM~4>Et^gDW=Gi5tk`nXr-kD74l}GC z^`U0+hLM6JQ_+&zn&wSRGn%o114S2~V*?^I4-=KSY&~(s6%(}l03|hJyEzkMg(vbe zT~z}uqLZ%BO46qme0X+*sD!0-!Q=~Yc_c8(O*`Wk`d5VTd*NxEz+;*i2Mj=WHi}%J_jS%X>Xg`GJBND3!^FS34L)I&pr%9bA z9FX0Ggc(UM%*>M6X;yfn%|@_M zv@=@K7>C393X?9bQAZX#ocxS59K=AfZev_>CATE136iX^Eji1clAM(-l;T>6Wcf#y z*qW7+Y|l(d&OSbM>b9(89?rr@&n?Nhb>3_cL(Q(oc^%n;tR`qdhE&||5Vz*8%xO}qg!O%>*uMujpWHOuKMDb?Y`FV2@`=_8_WwWp43x0TKkty3K@ zM5zs0l~Zp>_mnEDSbSr$O`q(FXN}QLtVtr2fdN%kH^^;6+Ydn}URYbw`Z8#uKubt$ z2=Y^pV<$k#^g!P98gJ3@0XTI`8A<)iEo=%&nkA@G&7;o;%?}>Gw4*JhBrCf#H#y$r z5=9KRbk6(P2sj-UZj22bea->bf#xymgT_f0I~;M@C64Sw7aaO^)u!i|0>{6RD8|M; zHWQtGEq;JAcyqjEIJKhl<>u((65#zCt824Pr}5#kf?RC|vj_?5Fs(+dEi%AIlOwNC z-&kaYMS&iyn}|6WaxErWPLd!|`ZI%!n1VBj5GLG^5Sf#y><^nJ z=o2T9;_eLzuExGM>wDa&h>gh`w+#o{WoK zot@K{f8L~m8Pn^}KQCwbP%JWF;eCr2rwpBUUcvO$t7HEsV@eu(`GxZVE0g@-ZH%XVM#)s$!1eU05rDNG4oLqzuxUWB{pAHpn+ zJ2s6fg_fpeEsn1Qrei)6qfxQu`^Bj?-h}&FxwvrQ#Hp2J0Nl9rG|!!609zU~xUv9% zl9H&TByGHwO8W&NfW!dKQT*!{aQH5b95|?bXGoulbq&yo<_#WIsvD% z%c~vBD|sw0?zx%cB(KCa^0OP~TCEW+JGM0~A*8O8RK{5!`jblV-Ndl`r zqPLt+?O0jkb(7DCP@0kejh+qUQ#n?aoQCj`(;Q`Vj)eBHi_S_jo=+|NCXl8;PJ>>_ z&nO6V-&npkutl}(3D-)bm1e~j!aX>mSr;^Mv zS5ym|#b>ZX9_=-lR8W_yjDmtG^A3^)40jkumI?*JX2ZsfhNa!2QM+J)_Hq7Zf^d)c zBwEwwbt=pu8eG$&*Z9nOojC;eIENaQUNhaYr-9466!>eXV&^jz-BCh!JVRLkfzjp6 zg9}&~+&l}-h50z-WKtLLVH^Il3i$TeZYfzCW^(75=BZ0VDG+_W*b<%OtBNnc2YB>~ z6{x{A@)}F@;&2$Q>4an&xSba}^1VWiSkcskw2N^ralQB|{Nh=?QG!ydfd@Y3Gblq1 zjT$WkCOVxDbPmFIr7X)v@Eb0JcWEy+sU{T^O;VetR(e~+SF9z)_Kt;p$alAxAykQv z{QHr0cP6ZatVxM>@q&cR%!H&&JI20EqDkn*U8JO6ad@R^VS-6#GUe&=OiCZ_bn!(g zLZceh;h}!D!1v4M5PrN}=0tGA(ZIrYf{JBNdSYTmMq*;Ry)q}KswyYDN?Zw}+@!>e z^rYNUk0Yn7j9UIiXc7DIZGnH8i?u8sS8>~6DCfaO>||jkn<*@2i-px}wXlJ05bj`i z2;13q97_8Wgpe4eIntbNE;QGfJI%f35%U%1E#`a72D6mp)5qwT9=8$d+w^mxf=?2R zdJ~JcM5PL$mKY%>!b`gUcrZnLUVK&jrg$Z(LdfnP6elSFtEM@`<$O!P{XeP%-9P63 zlA5nsC_lIIZUJh&!k;KqU~~v)iC$w&xL{I4-~`{Az?)|H+=F~Vl1M7qazF)1x;uGE z=@w#hQ)46Hu|2W^H@4I@r#YpV#B@zgp50=v;S%axF$x^{D*9A{7w0-nxOq=h8bvR5 z6BK#Wesf4A2)8NF&AElmOS_kbZrCUudi-%s-vZiM=bo_nzIibpeU8DKm^`wSjEyYZ zlL6m1r=^FQ9W%)`G$nz3a}jej<2OWwqwmf1mV}2z`)qI;gkzBr(b3G8f^AuwMyIq9 zS~hJ8yjlo2T^=5tqG$|B3vG;0=pq`U;UbBve}iqqr&?+-l9AC`s0PW$!F!@$xRj>g zMlH}#6^&gc6}T)#xO$WR%HVxbZMZw?^riaYGq02yofRm69bjIb`8r$da_?0*m?U_>7q8Ayd-}tKzl| z4BvjspfOS>ni4-tD46b@0=ija88q)&iWyHXCEY@*^CUiVK!kuf6Nq z!6jF#l!~-`l1b#1FwHmeN_ZpN8Q`3XAm;?u)O2c2UQ=&uk~yb-jB`k8Ndryw%+2O{ ztKB{WZfzmnp&R00(CSN3hZ<56QnFJNK2=z#Sp}mb8w@N|PD2PwaawI4YN}2h*60ia zX>oN9NXuwZ>`~vn-R}I`?H>uauH(ap)Aj@FJZrC0U=E;R}z@=`s}Ah73&#j-we( zVa~YZREs0F$XT47jYuISPI8iF6P6BeStu{U19pM5=ma;(6FIg&(Um|Su72Y^io3v( zx2m{JPvqJDZzc|kEG2nOx3Zhz-Nv9%X+)(~ zugxnrA1{Zn0LTp%!2Q_bKzFdYg?m5ny#K!EgZBvv>nK$E!3U-9f8fE+>rXg6bqv}V z7u)FVROje4cEN5nr-fRrc~UH#{fUWEgu<1l2(_l!bCgLoojTO4OfYD&VzNX{dQ7^Q zm7bNJ$)IUcT8+}r!edCQcQOfSoBZ69?hU}zav0j5Hs8t%K_QJPtHqY$vJ6O`eEisPSM-&L^ z7NNCOXn}*2&wlue@DbjBjdh9FiblwH*|__n>1y#7xG;qSdnJ^j2DMUY3`veiON=Uy zOM}Y{h0(4GDc9OVRf=SI9ae@IBcdRAC8(t&WjT}do4{yc(FWXBSRQ6YpD8!vKMXB- zV65GO@n=Q@OWe~2PZAm%4ZFmCw4w(O#!&Nd>yL@25X5VvqO7?#PphRWDbrz#ipsJ% zG85~pKDRB`nsuJ9ptz~2px7tmrj;jW=2&xMqOCcZQbl@WWx6XfIx;KMm0s0Q*xKaI zpWFbnsgJOD>A;lpP32!Rz2YQd*nR8oO``8V+`MR~fBNVVG`T@)e$w{7i-)DI{8@;NSQ1N2p~v!YY=a5Lkiu9CIPZM8)e^6&{B8_Bxw_ zk6C!1Srygn68L+u2yskFE50m?$PPqj-(~OQ93@ z98dONAdVnB)&G-X7t@OynNBQ4+QleiKE4?)K>iSPyvaW*Ug!Tt_|E^OA{)<={QnZZ z@qZvf5)v+9lCY2M#qK1$&rZlLLEH$x zi67uaxCK9G(==S{87@|^ctw`~Be5G=`zEy46pYLl!AaLi)`w3o&gR)cryclAQeNP{ znbVuv5qJ~L6zQPdR{sy2cJv$V#%U)pCnN%wA_sLLJT3rzYVjNGFJ9q)irS0Q?4K-4 z_$PSdBrGw(lVfy2yQ;Kk+qq~Dv=#LL;YI9|yvQQhNz5B3Sp?<9>5DdI_xq;{^~kH9 z*~DAXe(*WY>j++@wDcaQH)tLFCc1O}A|4BTc>Pc|{pMk`2k{hrIE}x8y`uc-#rI-- zcH^@Nb-5AWEAW{ctQ+__QmjPZ0Dgq0!h!M@`M&_(*NI>Ie-fTzF~k#!A#SCL-fMgm z2YHr-pihh2uzRBNcSB+zm=3rDCkRyjBapsT{=LvvtNf>!599gG?DtHE_?;Z)!E4D8 zq}L;T5#TB0p!bg;r5-6A{Hck@#N*UUIpRau0JDc)66rWQ0$%7Npd(E`tKs_u*DO`Z~6R?=0n0SPbpk9#V zF*Z`nWQ4y0H7I2Z!lzJ*8J?NC_|s`Tr5o@Bu%f4#JmpLtp2g$MfO~-_JsspvJqRCT zTX_!KIm`o$0!=914tNrjq4cFJ3{+~Nc0jpd$lcCkx&Z%(G-1Fh9^v~yy)ceL7-&+C z@LteA47HdEcnGaSPu+l9L76a6W;Ty6;qm!^r`cu>^?=mk6ypKhiuR@O4!~|ugTe)X z>p@#e8PCFjGq4B5-FUzx9PkKYVt`v1;?TMrCILnwo?tmkLV6E}@f?;0U^0&tMIWtbI^ z&%GQz%;VjF$3a!f;rDro?s~> z=wOBXX(6X%5n?>Jlb)UuEM~=kd4LCjvm0Z2I&-56+3LY*7 z{2V6)+@Rqmz(e3DHz;5RJOSQt`=19j+)N1`pqP6Bj{y_P;bFi-XjzKMV(&drgP|HUbYS6f*1YP&FYXtIp9HzQFTb^0sJGz+dA~Y z5*}j*JOs|9G%g-fz+-0c@Fc)*F;dm}zegL@`5(g=NcrRf9s}le7|**{J@B6mcp7<5 z0_+0(0eMo`4fq6Fgu=5p+y&b+YTpLL%;vC!!!E!dkfsswEr35D4TbH1PoNf!z;G9b zGkAO{;11+KXq%#eAtLOrZXQ>`T#${Taytk2ZW3a_#<$h?Efe5 zpNy93VpDj1ry$L2gsB!&z{z&jg!+~Oeu8(KKtm7UNjz-=l?nifdz+ENWSppP!@Dhr z=>q&7DO-7N1ZVPa0h@}H9@Y+QX8=+y2o?Yy0tMPR1t?}0!UvHL#gqb4?I^yS$Is?r zJKz(*gy1Y5Q^H|6>j1ZOu}-{O4oLNde2P-KPH`6;*;qpeHtKfAjPW;TQ4IRo#eBYX_` zP|P$Q-UWD?wF7<&oM-qygU1mHI{@DU9cF+^ck-AnK;n}b{tr=i%E8QL@_c6ck0O31 z;_CtF-I@LmfDb+G0;FX$PctXX9xXk9Pomz#xgBEheL_5`h(^naQ7e0FQur zvoRlK@R%aNlc3CO)F=<|6fmb!e1LxkZWPl3_%UihrL=Nb!sY;nF2En~?i_excLRQk zx8_2V6c1PqUR?&Rh-bf|Ie=~A+_ecgs}Q~qId1}|?c(8`9F_pSfwrbJzvnS_z^9NC z#proV0pJnLwvfHd!K#b{OnNORd%j82mQzsI{Q3YX+iSpGfCrHe!4e+h0o;L72+ra$1%NcFP7)|dANf^9fys8#Nh<9 zIIQRKTY1=r8r%%-rKd%JUn1vSz{CVN0vrgo01}r{d>h~iHkHF^JbpSL&AbFl;alPxVkLkHk#R$e*r0xAgRcItJprFQWzEYD25eV6n|3uO*yFCqI_2Q zj`BN|UNu>DwQ5xTh(@EiMeERR(rI;9>7LXp^hx?D`UU#$43C7^LUxCmLKlbr)41GZ zF#W;wow+?sAJ!Lc2)`}--H67B*CQ{CVo_6~_D07}9dn$9@*4jZ2QJ zihCu#D}Gx-V#4Btzb5`RDLv`>WR|=w`Q4NaDL+bH>4nsq)Q2oK%M#10Y1wIiN}rSd zenxu6uQG1S_{mykZMDv~j##g<-fG=$Jz#ysdcyjpO>K*@W!Xw?Q*5(sOKodxH`wm7 z{lWH}?Je6$+jp7zOz8MBt1{a%dooAtnf6)sSF*0o&dr{j{fC^o+|=Cr9M?J?a-7K9 z>vTA0IhQ&wb2(gl^V{-!@`v-UD40^Pr*LWEYemzGZZG;nafv(BeY8YZQd_bSf4?o+ zS@Mi$n&*V)yHa!MaOsgUMOk6ly0TxFJy^E4?5}0tmS0z)t+ZE8s$5ZdwDLsdS5@k& z_^O<$%Br@i-l~;V>#J_B+FrH4>S)!8s;|5S-Zt+R??c`tVSuf2f|v6kq-sJI%b4*i-HMC zDm#Q7=V3Z0VP^l}VKtBco`*FQFOc3DoA5jw&BHoibX>3o!npBWB-?U9Njg)b7#RpF z5N`>Dl?dkt!Yb%%Y64+3lf;>Uu$DE67X`vPmI!^1oTpxG7Ekc79{Go8$;+&uG!Q=8 zQ63JVc%6}ljXWIB!*m;fQ77X`enrA{bgofQ(!FCLaJNBWx{J%KYvr#{a_y zC6~vOFV*%8jr0vkR;hMypik;ty{u324a|2)fyX?eV{plek^aGf;T-u{+u#uY8BEmN zKYwU&cyPf8G8tOtkgAs~k%sygE*cq@hWdv4hF13VI_j77EnCzxFw)+)aK)0Iq2SNp zcX!{=FiMbIjv`kuE;o?&oH%rh^bag-?^&JtkksvRIGv8>o{^D7eX9Z$!k9nEhS*Zp z!{RSiJcZ8_ioJ^M>_H|$w)WsJ zAE8>FY6LkA;g^-i4C3uRggV)3wv2~-h?$SMO*-rC@f01vUud{^xX{*69aT79xip z&^I;Jf_ilGl4#b#iV5)}_*(>AR&gp2=5h=DyJr&eC7J|VkEkdG@{zzdMA;EYfXk3u z4^K-JqZGkb?nQ}I_l3ZZXe#GMxeS7W#2C~D_ z5u)5yA#NF-6F zo5UAXzhRCQVHA8TSSDdM$Z5P{EH%+-2ye=HQhg-;{%U+vxzs9zBjG_c?gK^7q?=6B zzA-)ww#PiYKgbrNq>0pPK<>oZ{rE<2MV|AJ=Y0GkI{#0tDS@7Y_yqYoNNd8rk6j2z z?J!Q^GkJpg1n~szzBvI`;~m06#*oGv;=ffK59&|U$E2V21(`mCc|YZ+MFm(c~S}TC?}6s z#B=o4lE5>{KiJnN_6E6E$ebl}??igZElym!0yL9*2K7mq_Ec}`O>ztQc!~AAZxR>u z@tT~wz2&iCF@ImC5aA||sWhh$e-r0P$Sv4&s4R(>Jj9<5gC}L05q|ybB8~~wP42fu zli=tZ50rgl!|&!CrYIGO>R56 zSIYRy{4CcY$WK3STbUX`yydp&LvGZYsiYCWMZEllC{5;4nq7$hs3qi1~BT;TS zu%jk-d+<#o(8T8x!vmntgx|_!B`)?;HYh6qJ!4O( z1me&MDbEViI6}1_0PfW&aR^kSalYrQbmywsnb?zD&;R)^#=7!c|2{$_ojHQ3FLW;O zj|F)jhMUmp!z&A9dDsbHB^-|3+eqw^MPp|vmc>C|lK`Dj5_T$5K=oAEj;3LCoB`>` z20e})YxZpPv|O}79>z`h?ZUdX5OM-`0kA6eU`1PoRcZyRgf*}ib*zCTQwPqOgx%yu z$V8K&8EC>R*8)va8&>Y^XoXJbUAjrLhn4V5Xe?&4IqW>x63+!)=7AfDTNYsCBd)vv zv&a(kDx%;ra2@rm5m0d@IOjsN(naiISl3^QRnFyX4O`3BLH~3GyAms%tJ!*X4ZD_Y zzY9FZ&aFlI>?tu>=gTyea8MN zi0ldMmhV&6uNWF+UR%1>f-8HHwTU<{5vzsykv3dw)*7`TFw@d%)mo)i#O;D?%8mo` z*_3(Gj?*1!dj$Q|nLAWzHNuYYDQrq-%@a7MaNx>~(L2@Z`W@Q2b+FPq`(NzN#>V>o z9o`LfJAFPm0MCr|i*`)K$Gc(f4k@i}hZ^Dbz;8=hoy>y*cuwG)$0ASQJ5r90eA~G$ z@=dia>#D}9z6ljH;&m-y?5l-QZ&JeX$ej=(=%sE%B&sGacVVzqPl-t^!ZO)tt zF^P92uSo=t(O)b0gJfoTOzi{L;m;|ZnV-^p<>LJd^I{K9`SDp{+7*}Oy}E6k`3C1Y z(d%3Xx1VOk^PAlNbz|mx<$sEQWZm}*&CbvcpnMPJQc#TjHLqd~4O(=W5^m;@$TS-TkW#FIGQYVQFl9D=xU^uB-O-Uii%Y`74IP9y)I=XL|h_DiTwDvcy6lapmHPK_t(K)nYctmRH8(B3tv^dCChM%!j zjx$SUtF-Yq`NU6*}|f)Y&bqQj@Q`#@FQQoFP@$ z*4DRm*4O1one*))w-n4uW?jyOZfB7z-{~ec1Q+7Gb$$W(kpKL@zXJb`hhK9@|6FuQ zPOf8Z;!gFh`whFpLZ`jmacsrkUMR@g_4;Yutimrp**vNXIr?7-GoLv8@#*zD?>umI z#(!Tr-8_83g)c6T`sumpr|l0_j zjL#zH{{N4Ox4YmUTkajn!44pGo~thfyQ?AMm%8i!qkb0b7Q*WNj?1^BSM z0Yk~vG%P>d^XX%cY~0+i`JKnY&g*|ifBC%4YS-Z-{`EIZddpY3<&)RdRd+se*M&1r zefQ)1`qn*$0q5s;6+fJ-d+%R^wueKf&Q%q)UVfyr_2}-Lnq!8e8~2>&|KpmYf4ljy z%Pqbd^ODzY-63?}{mjdb-`5xD?E zFP;0tZRg+9|A*HuUY0#CExAsb`unt~=SRfvd|%k&XK%l1d672z^rqwQKYsJc4fjv^ z+wfl+b$9M~d&ApNHy%>_U6;|V{<2OtvPb}v9imyefR4uS9a9*e~J9`-5sBFRWF;An{%0So%S(&lC~+}9Y8d9 zg|7d)syF(rkYRSL{>JFSi5UMc&h8#(fosC-?sOKqaOsUayRQ@G{C_TDxF$L4WTvlJ zwQ7}PC4`n?2rZ8JgG=*<`j!n2_m2z?tc(cj@3juPfP^NHL1YsPXJcIXyVUvkg8s z{KE5p+llT;nXhQL@VW<{?7r;Z%Dc9=>464 zKHhM6??|@#^(!r|q;J(TZa27R{pP#6-Bq)XKXRvcu5D)Qw8?S9B`b?R+v$;1+p=Hi zEO+hE@3Q>xm%gocpK7Q%`O@_-Ev#D7Y#DlC@|(ww-?-?R5~y)|fB8`NLOge_C|wmnAO^lzm}X_q+N3 z3j*T0pUcUqgcYtt^ebbWkxr80$K`f-eAldD=xj)$SE`+;h#K;?vUoxoxQOs8*D2Ew zowCio#p;ZS-Vd0Sm&btVQGFJb}tt6&+i%OllnR15>xaI zOW@w2z6E_leFO9Ra-^PtUa22D7%PU6Y*-o|8S0-uvShV>c*VR6`sR;FBZD~-HXOzz zBB^#PU*g-gp`Q68Bwaz=8tGfwH!vb)0u#F){V1^0;Y1-Td-|93%v(a3oSEBr50iRE zO7*`~(K5oiK6fdyK{^Q~>?G95kbyQ;yXa? z@(xgYa0f`Lt#9wF_OirLK;8sdW;9z7C$9Z<4RJy0c!w&yLP^Uu|d845_25W^#RPr_|X>ujsq$ z+kG9rhL#EGeXT80TYGhFr?0ji?;(Tc`j$?I#EbBCbabISsk*DPv9%pCus(>STqJ5B z`I_6Bd;y&6r?<7&cXUYOwE_`ZYMZ+1D3|eAJ@9U>Z?A1c)q~P?Yr8bb*V#g^PeQm_ zYO8JsQe92e?NVD;ds}NqeGVtgG+$Gb)Y96iuc_xmYO3ci)V8*C)KBdK^1kY(9K6!v z>-2R8-U*OfY6TVArMl|o>W2CbhtyGDuP0K1Rd^nC^=Oo)4p169fFt13VQFx|*}S;0 ze;BLSzFuiyaDdoqL4RLwhujgWN6<6otw0CT_g#qhIdiY%jL528WjNL0ONtXxK+F;8f~czG{d5?&39tzr_6$=b<3C zFBx1o=vdglz*$TKi9(s@%ynjOvv0Fql|k8Huoy;~{^sN5|C+q)+u0?Ks1GNZPPf-Q zdjD~@bf~9r!NIO)yPiJ!>m%5hh+WBG5FBu z|5$qY)pwq{{f_vOKRmkR!zqca?@v!W@^0AU$8H&&y6(p}PknOagPYGw-FNzfceY?fS^?($`o53_!ER(%_yomuE(XR`iWv?>lc|D?@Zvu3cl9v+dNamp$<9HLiJE zryl&*g;(60)A8lWTOQv3!gEVEH@~puwFg$`mfp7d9oIK&{^dS;aOS(t_(PH52fldj zD(hnfFDHgYyPvjHp33Y>Tw5`3mQeA|-=Ew6+U2_=-Wq=Ur#nJ^ciHpaqgUIW(rZ6@ zA?3#@)4rSYR__nGnx9-z%THH-8)ba4F64LXgrm?py);f9wQHTQ4^dB0yRY5zfBho+ zm)41A^3Dur?06LwF2mRljR4LGssVK>mx+`N&f@$+S4pAESvd1&ob#uxLis~?etBPw z|LEM?{C`vZyiJ#Mc5APhYP05kbL|_q=dAXPSSqJ~x-;S1AC!@6pW44h`OqIPo_pz? z%T7C7FMK-vsja6xwxQ8?Gt3c}Uw7>duXwIov^@1UJMwRSZ|LLwH+_EKK+B5vE>C|z zzdyVDu@|4XvO+ac#mqwv%?qP`mX=u->ttsw5{jJO^p2? D_wy^5 literal 0 HcmV?d00001 diff --git a/components/com_contactdirectory/includes/securimage/gdfonts/automatic.gdf b/components/com_contactdirectory/includes/securimage/gdfonts/automatic.gdf new file mode 100644 index 0000000000000000000000000000000000000000..3eee7068f3d178d9fcae61543edd388f2090b8a6 GIT binary patch literal 61196 zcmeI0S#}*cu0=CP@qX%~W>)i`#Us(412(s@t{jxYYdHvD10Vo0LbCt&&p-eCxBdN3 z`}=?G@BQbVz)zUKzx~gmk(TJ_3wLl{k~#F*0(K4{_&Z7 zDf1m#QWx*_7fhgEqSmG@)Nr?b80J7-g) zhqgKM0MbN?e1yn36%9+BB+p4kQJj<_It#Rl8toA_M}A4BRJNNED`mmr;!b%qVFEdA zAq=4TQCwFfcCeaZ7O?XDxV=}p*ksqlCs?1_qLkbGlP4gTX?pZZX7?h+mR;VOwCIHHTbcWz0 znM)_Fx0QW;lP255BPJP^6oT;PtRC9?g38y6DY)^K= zLb{B!GK9j+S^Y8+ne86%6AXXc*IH`#*h4Ey-R&7gx)9V2XRT3w3eiBCLVAjYQx_zZ zEU9eRBUH}FbN+}hZ>Fr9-ekQDLwy3Hp}0Pcf}(S{pfeTs$CM1Wi_ zhL;;)eTs$CEgU-mIrByJejldT;j7=XO`N0Iex1$ix9$5T;OFBj?(DW)lcp`Cgd_|-m>kLYq0L_qM-k{tolUZD%ULzWx(EjzRdt9bQt7VL2CWu*sAkIY}SJT~J#Npv- zXbms2ni6m*a(Hjk^~#brIo9YzR>p*A+BOz(SFemDofJPM${T@XeKn4={3xx@IvUau zf_jEXXIn}phMhJ)W((&Gg_Uds?VIU=jXL)Eo!W&&KkNa z=a8+PCt>f@;ii3x=}NY3C=DP910BVm&UBjCF~~NwT!59U)_e$-Q(|_2mOXcg3ueZ& zG7J@Fsnjp?BK!Q;=DIsf=c2}n$`#w4L(cgm3EMU~%72YT*yGndT}dkYeI27rsmOk* zlJr*?4Is-Qvnm01ES#<`j7>zvBg(JcLl#+BkT^DlR&s{D3x#DNBOBw$lFGwc(v_sE z#ZhsmDs;fq1d*mBtOS^$^aV*6=qNga)Paow%37X?vpnvp>UV4QB28-I58ge@lUjC+v-~(M8q%wp>LC&zUDvYkktG~i#+f88 zgH;VTD}&k1b7Z@7NLIEuMeXe_YL!X+8pea5-bva1%Ue8io~WWMLsdgQY0_!#5}~d* z9>5uf(i3$ktwkGaO$dwzJQYO_II$Yke9SZd^1K|2 zqDy6IzqZt;yQ+{U&t5m={!5_bF=J13Bg# z&Fl9SDtA+^3DXu*K(V~5MY>5AVzEISLEuEnKu3{xKw`(rrqHey7loZH%nncc3DN~> zkw}5c#2v)cBazUfHSI4)105Mk<}XWYxQ2zrgW4K%N&le8Ahzdabb=OLb)ghYtUzWA zg-NcIJat-9A|~dCj5f>=lRRNtF_Y4S$m~`GBt}^{=M}Uly40EW%S(DR^?-WWNXiXm zL|0-v35i>bgmP9Nf~A;krI|=mq|VaA%Gf=$_u^_Ts>3t#*XFo)h+qKmR~M-VRifnA zScJJC;jWbRW@R9zzB`xx-p?~0VC_vqnWS}=@YZ}z4=3S66GvBCH0U5&TD8Q}H`6uD zU0~ET$0IqxQhFj)I*TT5%}4PSlaL&6n^cFVZ`M|@iU_DMB&W!|C9O3jY0Da~%tl~K zrx|xMy%5jOOeWUnufpWHX1PlZQ*zR?cL4R0Cfx;`XdWrZl@S0EKaW(n66)&<+uMe^4rE%(|AY4>flc zM_1ZTs>2g@uMiPOG7+tAL@ol!lFCnDeRA2+VUnI4KC=O|njCP)!l?=3hlZ5bNRy{0 zNIx5CceO{fnj90^v2Z#-fIfz5fekMjuzB2IRfELcY?#2qd748F+{IPjE9$-eRbA5C z0&3rp2t*{ZP$6sZyc~;oI7R>&yy;=S-BOvc|OTX#yC~YOM<%qHzVZNXKzVW=qi6hQ_Z9$sM z{?!B!*%5NDeO0LRwSXUElDI#3<1m|mv@(npX3jMfS^Wp_ghfR!vM3efM2135hb6*> zE10B75CQ4PhS|pJzO6*pC6#IiT!8k*5*O6+ODS#$oKaW9&K8qBO2WT{X2mqq6Y|MiTW|g+Yc} zd|?7G&k_Zsi$DuOsK|Xqb7gYunRJtKh>L_x;2n^}O=6>KyrEltMe4R(lcw!JY28MW zCUIvE5xcu4VXnZ6>A)=Fj^(AOQ5iZVPh6P;;-vjWowxa&3E*YpJI@4JCBO_>C89-D ze?^Pen0L?j$SQ^&TESs7A$kyjDKpo^#}!>SVT3pei>c&2y>GUPltLEpV@wkF2X7o^ z6OdMhp~B2r{W21nopL~83NOo|uu^B*50To?SC#U46t7KO@qAkC`>mXJwfuIrn%PTb^{*@d8PxYu_l5Tg`@QJa0Gi1CeI4UW zKTunoL-`bRuWX)TLc`|8QHueyuD@Ymz1`vgTj^foA)^^K(Isv*%oQx1$zvjhg!Z=fC zC2kUk9ud|B1YIVWinygp(#XV;5A;s!7)Hfl&@IboR%4h) zEc_J4UESJS6X=%#0!ibGa&gVOkTP9qoq-ObwXBwS!XP5jAS0v$xec#QpwBpCNR#mg zJ71FyO0#P7XEaMcYdcNSBzKpU$gR9QfgElhr-iH7pJrjH84qSsdhbhx$#czgK9dli zoDJ|^UYkIlC`6E^(>6*<9HGF1noTYL#tJ(G6dwYRticg^x*4+_`%(gpcrZ{W-K26t z(n(R@^psFgZ}HU$^zlLrX)^kN7uTW-u9GiUVSX>gT-g9)5+Ylc<0?5{$G%ODre0$a213o4Xifa=(>J6q4tlM>ycWB-sP!B{+nLlGeU26(KucZAi`fhoit+uW5NzuN9o?D2-F>r-Q^^&njuSk!y7`C#t3 z%;)mDb@%!xYtKpAU^CeLcZr{Y(_Jla%O=Hs`?ql2yv=PWayQRlL)3#YPyBz2X*K88 oe~fdyx{2h9H8tlYEN+r%hPy_YF%Wzt3UZe0Q<6Tnw41>H11C;2(EtDd literal 0 HcmV?d00001 diff --git a/components/com_contactdirectory/includes/securimage/gdfonts/bubblebath.gdf b/components/com_contactdirectory/includes/securimage/gdfonts/bubblebath.gdf new file mode 100644 index 0000000000000000000000000000000000000000..5dc6feab2f10aeb70130606b05a762f6a6dfb7d3 GIT binary patch literal 67516 zcmeHM3z8%^uCp()XL$E`_rK5b2Le(m+0|9k>#>~~ks}HqK#Izm-5CG>AAkJufA;>T zUR&(>^Ur?&wAf!hw!1v9vV*gE21~1`>##SIkC1}RY$d7`hK}7klhorw5F?tp`aSE; zv-*U+Kd+4Wtx3*ZS>60vy$qhfxPe1{%eDh$YjYBi7O+FIT^l_t&XV_L2-~9^{T#_Y z)|oB(L|V;qKCr0i>y@5a*dC-Rycn%#S0}t}O=wk2C!VJIvXNed0W8f3v!1 zma8{d<0iO9Nv{}pEyn$>Ytf%A{CJ{WD=vO)g%N3DjL4c@w`;r%qY6oCd?u9vFQthw zA}<(fl8hcKLy?LdJu{vlu4io|9H`Xp&S@9uwI*s|U0s1|O@8s8uzn1C zy3!gXxzPz);)x~3h@OIFNXjE(NG!w_RO_@g1v{8vzpf!(XRI^#9zJ`-%_@7(;cLj*3WMlyROg!W0`RD zbr*icdcA(H;zHc`Xdb-R_2(>4?vAbIU7CrDNokv0UFgh+a=~1-O1Cp3*VZ_vuY82< z@KrYIqCQrN-;H*sWsfFdzV6o@#_k63Bn@d@3dq_vyY6S_nO&W%z}iQNQFz_X&NI8! zxv6U&o>Q*wn15sf}!>qu%R@h8r+_NBVgiH5WD%=XOH z@V(dywcC1==7%m$>sM^gW_R^H#5X;o-kF}+t~-kT%;wW?Cc}AOUt!&Gf4#!}gZk$T z^zaVr$Fk=vE%FQYhEC%zti5g~E*+G%$<>9Fg~?)?0~gJd@c)UY7K@ zzy(x=-0^!@oU5y)EfWNc57xHwpxRe#Ig8Rl^n$W)IkN+r3)VHrW;x$WUem-FH7Saj zwM4h4(4)WrL2s+O#tV*}NtT!?ikRB0Q}v^!NG0u?VK!N(*xk{^X+56?nbt*y?QGkE zqHnO$ZfRTUhvZXiw0ISh?Kx2zJy?b!6+3!nJV9K~+DJH1sl9P7*R$-SnkAl{XZAFt zJk4;{e_`GHu5V`f2JByFy*6kcsF>6jvn-?+xHe?r>Z_6JoLfnaFTOJ1sx&c1G4bIBbiyFbBe3As|rCKNANPa*kyT@?b_&}YkDDn==4vWbIc%)nJ3O; z`_b3q3)>;5(~tyYhdE2qTcO;XmHwfgH|N|g?J~onc$6l_h`eAKlJbaHB`Qs*qWy~v z7$%qRxmc+|^E6}!C+BYO&Ux;tzYA7HtA&(4?$zRI6xHCquPNS9?AzLF>1zqvh{l^% zDT_a0vxhc>Ri4$In_?X%DXl2tMXYDdSm-BwCh$z)nZPrFX9CXzo(Vh?cqZ^n;F-WP zfoB5G1fB^z6L==@OyHToGl6FU&jg+c{7oj{|AC}l|8FV&^1**4(e+gpuD)*0xuuas z%s?%ri7_HCScarLB36k?6RJp$U(y^8ZJ-y$l|0n7q&{b9yFGZVD@;}tyB2#|zr}i! z68hF3LgJDX*)U7Ksf8^YC1LFti*yE|ziC}RRi7pT%zQ<^yMs%uHXR>dxnNfNn)Hrh zzlgK%aTG5t$z-RAF``_s3`tSUsM}Z}acMmU&?S}WW8?a8CYEfiJ$|GWxs5GI9aQsLj#)xXcG9={@ z&y2*%vZcp=|nj(ksgX0>mZi8Qw~vWOWL#iKMa zM&t#{kd#N>a<*NGD~+AF0FrfPy?uKme+iSlp^JQr{TtQIW7=3w=OxC76BLYhsWk3a z+)d+^;?-1maeb9FD}GCeDSkJCQ>|;y>~f8=*otvitt8Mr+g7ImR{CZ}lHL*@VvJ6# z7qN$wN5nE(XhId8Si@#kYOr=n*ulxU+gqDvHAcH}C|F~s=el2>=-s-}Mv2*y&Tn>} z*_%0=z1Br}TU}6Xz_@o1MSrktu2wgC_LWmZH@bes_N=PH>fG$Hb<{bM zC5;A82`N4?j+OP9{vXs`=8G;+S66V|vXc0yJSlNs`Ch~XG=imKjAyp%QlL?Z6=FO) z&+Kb;;bE%_;>D}g4VmvS7LYn@DVq!f_~FkTD*j}Jx6Br>{0jbF^!qC)?KGiZNOPqcBm*~vRzkZePQ34~~=)`R@ISZ>eG?}rp`Ohi}GiXtX!R+rykv6dX{l8o91ry6}4CNEN9D^#+3FtDsw z8oN_na4ps0kOZxW##%Ryu74wGUBp;n>?dbTb~$g32WgUjZbe)=ff%DEF+T4lX;L0F zHfuj&t%ldx>k0;UTfL!pnJ#RHud-bmJ?wqZ=sOYIRMQxmT**W+@U;z5AWg)@Ix@22 z(rRLink>8MWpqX&m1u>Z)!m7{Usp~Ev6)+l*U=sZQ#9)S6zsUgp4M;Cen<&@>klE= zB%Xf~V?wSHNEvuf;>fFtxb#K=IbypO-nf3biAbDR$Hpx5j%+7UZ?I-M0H?9~XfTh8aQubt@bho086^UU5j z&(o-;XXlyywC>^Lob#!BVvN|LV5hHh!H{dK4HlVr(R6-7*~SzUjHLcbZpRppHx zx~S{Tl;l@wV;zt$KLV6}@U9aeOcPE#|e)X() z3;pHDsmP+PuQ(8}zTNlv{1wYQLJZAm8G`j%oynFIIE>zfz5Q(e-GPFiDG z!&CDi#t7V^@OIahbH8I0e{y(q5aZ%|kIL(4Ucyq0UzR4{6(Xl14w?b})V32WAF&zf1zFhFp( z)%%DS96OV&R({2HZS=7B!7|^8)UEpUzVp#OHGYNlquZ17x;Qs0y?S;iitIKb$IblV zoJ6V$q+Mx8lEncdhfqZ)_U~3V=icYFlf`VY=5TP{eSL+kNoJkAmZ*^0)0~U31@(w% zG_ze-C5%f{dr@4;ySmj~X}i6I9d-9&x4KtW&gNk@mg2=F93!KguWS(zW9ycP zu{PwS)0z?hT!L5q%!*Me)i{oqwLmIe7<$~+nOz3ADQ(+goONB<%{viJRI8WMlGkn= z$wFriY>mBpby-U>xus)fz*%WxjK~X?At{fDRie^_D#FAgi5MfQ1M?5nU3$d+C zgX9{e*@|&jr4r~lOU>*c_{xpNfEWnIVq1CO{}me+s}vG)EMjfcQkobe@`7bZ$|IaGig?0GV<#?v zWSv>5AsP*%u1sQW1Ma#~tteu$T^r}TJ77pmAF~#{ga`MRS+}*v^BJ`|A!jREZh;u1 zmZ}10B&qi+?&jmVc$o}$U0-F*inS0^{C)(lTGy_%Q;oBnA{tjS236Ni9_A5wDZJ@F zNpJ1+%&Zr*=OlD&WRtuT&+P0xv$ONe&dxJCJJ0OwJhQX&%+Ag;J3G&;Ip;6&?#ucv ze)4PV)C)02EGk%rq%11du>(s?Tv|_zQIl}?AKbyY6rMh^v-8ZJoCT8>&^4jid1j>s zjOCPrwuiC)O+y8v-8d9UlkzCA4s541{TPua#^}Ua4X;DWqrd<`Z>u*HFF1@way+G< z70+FhRj2AlO_564H^Y-tW9Uddi7_HCScar5D%P=)6_?f%W7H&^eI%pv%+Ag;dvX@6 z#OxT2vSs}invDy;9!Yw+k`VVWj?OdtN?os`2g-e8dSr`z7?NFVKpJO?A{v*0JHaht zF^;e_TTNua(N|zxXEy3;eG1==PHv5%8#O1!h`eAKlCr2+$3|9MT2G8olW_Klj?PF7 zWnDn|wKQQzJ*(Kb^o)UGtxS?GauQ-jk!pXqE1Wwm4fa1_vg5g5#95b#Yu)8Emb6H- zVM=|!?k@YJvu0L8iq!QGPx;vv&R~2c#)!ON*&3-7qYq15soW*(E(g}(I`4sv&I~_F zqwkaGJ6IN96^%u6(H|3tF*>m|R8kg|!m$i**x7kzV^;gTY;P)5^RRXqHq(tIeXXR3 z#%1lYTW8NHjdoK~VIxW43Q^D3D;ssCJ~N~)_wLY+F^5L z1MV5^+G4$Zd(;?`?BYTP5Q>TxF)>Co7t9^5b*~u3FGsuevX>UZaNVyvOrrZtx*Mr% z>^F8D?d&|WtCN*mE0uU{1Gh3e&um;!A3o}C7X-bn-V|D>RoDnudS)yIt6-JQH{( z@J!&Dz%zko0?!1V2|N>cCh$z)nZPrFX9CXzo(Vh?cqZ^n;F&;Ap#Ejq{^i;K-8$ap z@Gsf?XK7FAXMtYzLGyzH)=)i@13ZmJ-T%oH|MpJYF(7~DfpWYocHw=)@*#5*SEZ%v0V3Ddn6IyVgzfNE*6gy5t`z^u2o;W=X#7Ziac`wPOQD@v9j9c@ zU6nQR>wKnhVyg?MeNFL>Vqeyn94mN&ky~D*7dEqT>6uwIR7-0mQEqmg+26UY{NC!= z%YZOzTYva|&HmcUdK1s?JOTbfa7U6SH`pQRh9n@{cOn&vt$fLq+A!PLfboNJOFp8= zkd#N3Y;Z=M>ImLU2eq%Sux@2feuK5fei7$p|1*@5yz(>aXNz|g$qxEj0U$-GAhH^PX>J`M|GCAb%+S?et3- zeg?X}%9tip^}-yow8fxve;_Ln~WJT$1K~jas~%w+>R|zLdib zw^j0I8r9G2HUlK{ydopXh%_-qWV?>uv(Rsba68J;$C0do_hs%$Dc(`+NA}0-;(rSL z4Dn`LsJpMPur-e5n{@Yj$`V^&oz09QJGt0^_18$XC^95PF{6{SvEtHtVvL$p#lNp^ z-Ytibd)~1!PyE6J>=Uvt>L&5@`7w27!}ZpgF8|wT?)ek8ewR1L`NVnF&UK5ux!~D( zW`EE7y&3=C1Ga(tecd!WU&oj1;Cxf?$KfA6uMY$#$l+kO{U(y!ld+%K%a6cikVZY| zYwaE~*w}9P6}D?%YHmfoxgG7$@Y!=_Ywl+${-4kdJ3G(pH|k!_uFe`~n~G>$he$|M z^>ih0NW#icH;t24MB_z_)a`>rG1Em@nnemvABR4~Gg8iCfR`yoUWq-HFsMeNUa?YJ z5sepdZjvq{mJ)a@VP&YB#z`xpaf{s&sf>&Mcsb9pi)TmYDu-@0agt(8nlJI}JhT0U zh@XUGSF`iXK6PcvxL^5wDLYScW?!1~&(!_(zdjwxKR&j5jlat3ue03Zrf})L`XsQ= zsbF_z`;$02!wRmoI=t1nx})x<4YTr>@S|Po4X^?*yJd zUz&h@TK4_K{4&HZ(AD_vbfv4Jh{^U>S?*DVbO`|1)&;fQ-PZlOW0#8<#yA7^B|dLw z=b7#EE^XjMa~res%>IRS^H<07E_+P)SznmI_6xKd7ZL7XSJH|iCTm|u-ilO6_K@qJ zQhZLA-&9DbV8lv-Wk|}S#w4#Zh%suiq3tXtTlWS=gJWCFiOW*2i=((D2kP^EJBjq|caI1|xmW{>BkeC?5V zM6>hETHQSB=J{;jnt%qxt0?SHiH^Siv6`Uu;V z;JeLGuN`--E8P@DOt!y-{2KS$DFO0r>w?AD2Cvp5dE@-s*4^*)e7FbwdIJ8*+3VjaUW#!4y1vS~tG@1DPuXF+uBf%5*v)L$ zL;7V!X%Ue#O!d< z$JOo}E+c)v%f^|t{?*_?<_Xx~`^)i3`qP-+w#P*V%$oy>wK5~C9i4Pze;5Xe`bj!l zQ72O1;+ZXaaTbh40u<*TtvmPp32Vpjk?iL+ETNuPY^{=?8D)YAuTOe3^8@RQ|-L3D{8M zYf-K-nRxTW7&VD2_ghVxR6}v)C03fy>^!q^n)`23x-cJa5Y? zgd+E4({A)9Z1&KGu;O`}!Zk6)Bho9LJF?qZ^V~u|;Y$QeVSG*+$$#-Uh{&WbkK9 a!ZR})@M-1LH#Ulyxt>$vbUwB6BKBV;AyU== literal 0 HcmV?d00001 diff --git a/components/com_contactdirectory/includes/securimage/gdfonts/caveman.gdf b/components/com_contactdirectory/includes/securimage/gdfonts/caveman.gdf new file mode 100644 index 0000000000000000000000000000000000000000..4f72cdbb2e65547549315d4152a5f6f79ed889f9 GIT binary patch literal 160540 zcmeI3Te4(1j$ONFqHj$}^Ph+C+IW-4BPvU6rlMP>69g7EKsb-z$ZL`R=fD2zzy25f z`@ij9THfnT;7#C7;7#C7;7#D)Jc0kV*H;lAgr9G-Tc4fyE4Nu2tVLBUKZ} zlPl~>ZmOISFygth@+tZ8okc_m+fWSLS?FTmTp3H&?(+@_BNxo!F= z zQbmiT;H6igx2ti?GuromzfKnmqgqwXh zxK+f_R5GLN$$Lwne6~`AO+SGfzzfOevCJ&4t|X~R=GGi+QY|SVl9o!^5Ro$2XfIkB zI>dgMH)0u7oaxr--V*x%(M!0&fCu0&fCu0&fCu0&fC+ z0{Ami_m92)VJ!c7Y#{2OKe6#2=JcNfVhZqpP^RQGi!*$XYKJ1HMKLN}CS-lvNr zv#jy~xt1G+(arCo+^3vLiqEb(-_qhA8@b1%$$=~Cir-}E@gl0-MTcjU8)Q|q?*<&P zYRCaMf^bXvj8k7w3Ms6)7t#jK1hpLEUNj67HOF03^}bOZlWVyVRbkbS`~uq1L12YW zUMcq5hoqQGxsk=pmbp9N#v~==aW^JdK1%+Wj<26D-OrNsG}qb%y)>yJnEMUXPf|}D z&(eN+s}9*6Qm>--!ngbvdlPsQcoTRNcoTRNcoTRNcoTRNcoTRNcoTRNcoTRNcoTRN z_(vyTzq0%KB_MubNVUIyy+?5%SPva@Z3|(&lT3Y(^7~g&`2zJwzes9PB7c;;|FSRn-eFE|yQ@_9p(tpc*{nw0uQuKr5 zupwWhYkvNh50fJNA;}F2`vWJ3d2eq5Zvt-uZvt-uZvt-uZvt-uZvt-uZvt-uZvy|{ zOhA7p@cC;7{>_C#pT9oumS67NNhxW_7wN6u`_yCn&uPl(ZNm2>aTEkrOY94ON`~A?iT*_5 z{LzXv(qhR-$k7Ch&(7 zz&+yimdeop!s15d ztRN7liJ z0|oU&SCA0XK+-CyH!~fdKaTB1ppD6a9prOce*myHT@z&5BC=X?hNU<-gGrs<0C z&ttIwV=5Qi^pxruoVlv`Lv@~#%(Lk6X7*zT7w!BuQlH~Z;HL?sTXf->O5w6ee!a@| z-sZf7io5CTsB~C0*GEI1q1GrBTt)SJsfF5Bo3)3N#iRRVCZ{xNZ*bp8VH|J+sk$an z1P&yBH`vR_6By)|BuH>&3hpFB3un(^@}Zapx;Ki`WbK`#4>@2ov7`2R3jRTcCcyPF zS$k1Vtk`<8Wg}uMwtCgdgNNJ?o7nM5-Xc1Hv2q)oT9K736M|MNSc@QS$gizN~tnb>9s*iWpqn9+z!DIP2k|7^t(%MNWE0y(R=jzg76KPvcM)NgPcgis;FWV}! zljN07JriY;LrucSC@N)>5=QkCSo`Ewl1epI)8A|G?cN0beG~9Y$HuJ;g7ZmfS*|F4 zq&0}Q2=#TMkVFI-*!yaMh==8j8LAoHBdLK1hZV_cRmsaZMZ$I5=z6p-l2?$E0bpGO zha^>4F_z<(1=Wgu$q@*oM}`BEGcY|;-4EoNamH|QviBM8C7I8&m6|9~{SA4*q}1s!n1+k>GWB(us~NJ+t{z(XgmrojvT z&EaI*Cj`&AxRrCj4W#DPE@!=?8F==az#mND*ZV}zM!A>%tn^y`v_+sKx?7$P-5WIeuH(l*cN~_f&RreUbQq6c|Y?w$#?}_>eYI zYp1#_xoL7TV@;%OHCZT+z`)9kyi~0#a;T%cPqkCZAWLn|al#ELE;T$zu?tycZkk-f z>s&yBH0rQ6mDAxVnsD+uaz&E7J<#`@E3d4!Dhfboms}K0OAh9`K4AAWL;K(g@AW3| z_Y?4Y^l_Eqq9Nl@vs_5cDlSiRuNo%n;V>M8>x2&Q^tj@w6d_ZU5&{krS72pT0Bao3|5Z{9@tzg>OdINw^!c^aqi4#ZMzhxh;MWbjh8eA z87YpPl{m+T;j1vNquP-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR z-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UR-Q6NtaVbSWZG#E*a3 zi39B~LbWYK*xf^YuWYL=&I8GRBMSv=?R(c8)u)5m`WK#WqH=aGXNK=BQy2c*VieKQ zo2vl6QAC@#O0t*;itJUBf{JnrLYlHy4TJksRWc)=8ui~VeXAk)aUp?qBiw)Cw27F z{s+j#?X{ftx!wf+XacxPUssCaaqGDPJC>KYM`U4{S={46Q3i_IChEegdye5T6H{Qs zkb|n4E9$~U>Pjl(@4`fRvN)t(K_IZD`TW!DoFv`31xZUA%KFs7HQOz1d5=H6^d}Oz>o`KY#qD*OWQ5f+td@Q-Wo) zwLm`m>|3;LQwKLq&2sn~#Y9`Vw|x`%iwVe6^_^$f=k1ioT&O#$UkA$ENPKM=b4DeS z4|7EEjp%?IZ4CG(LJt%^pycM#2|SXBDgpComn?9b!|>ennH z_^!bo&B!WFM65Wr1>_-ncQ)}I)L@B4;?OLgo+On_@N|epWJ9-4om3X|P;DcnxCNq* zjg*EpK<`etfdg^KkL1SMs1`JZs2<{3lT~$(&pmbFpw$Lx>q?SbZqFnB3Qz;G~F52JN@Gf-^)HPx70>o848FR`3toyem89L;tj&7GsLu^LTVuAg#o zxa!0Qvyk=6kCc?Dqzu?&C^wHDNXg$cA%cc&ziJ}pIczL_di?)Y_13)AZ`ChHswC8! zS5%wNG@ExL_0eG7r=!MjkXvLiTJSy5{n|v@!rWGct-uC6-Z9u5AeRCz7!CG;Jj6LCw~I9=P_n zQ?_Lefz}I?_9~^>R~)>Vnj5u}Q_R$@xW`drHh_pFqVZG?k**0ptzJib*kMiJM$Vo% zp(RW4>E1~35zlLVHCNWOkho?p5`Ep&r4|H0_H#r-Ah6y@Q$@0;z=0J3tQSo*+EcOj z)wJToF7AjK=+Xf<21yPQ{85uHgG;$FH1mnr?m+AFFs_40Rt$gZ<`?GEGa#HJ@C=|k>S^_Gmn{ifwcUvv!x*H=tSCIqE-aN51 zy^g?8S4660mUN8_klYZC7<-`9SEtqJ;l2mn{cry!@Fx?%ZNq)q@25mrmJEMbCkink znP!7tSaruL@^IMJ#V5(3O!+rWj@iSlU1a^Co2Hs_g)qbswMGM1k;OP`+Q21>AK zIMXJag0^|)K@75J=1nJ6*;`4YzmfW(gTSgP@;T!~6ykqCUpt`K1`^gTaZSu(H&8fFy^^Kmog~#? zHGd`j*rg4x5(ZTc&1fS4x426O-0*NRIOu>I32>8w|C81KWJ+xHHu!KQ_Eljbjyc;IfNKA9k}ZkqBi`9pjsDgUQF|4{SC>N3zDrlfK> z3D))O(kKY5D=9$`SSyJS{N5)=?Z6+JswXv)8J~YtPeSsu29eok65=)hU_~OWNt369 zh#PS5mEf1{-S7`Jz@pjRX-{U+j1a1X=b*WODmvQQNrA135i4k;;h4u`1gT9n`=O3t zM=xOLih8T~wr>J|Faf=wdXf5NO)`$LkME}Zn*f*qb$Lb9 z|Deg&lXSjF+~O}%)J*KEDL*T5ln;{6`IDw}`4gEWA#V*qKQhw`mZxouT*JS21ky~Ibz~)+-!Zvw9PK+uaC34|szX|;51oZA5 z?`VYie#&lrJa9jWQb@mU=B0*5R;aV|XdE6TtvXW(Aj9_f0wqx}D@kEwaD7!-$yAHt zK(HcF4-sKVMh3{bQrxB75Cl7{St)#sYHdG-7QlN(-F5>Mui2^gL9&uky=I4M)nxQU zW>HiRog7UzF- ztVz=-NJtII#R(%~H^c&*Xs?Enmpw@2{u+r;b2A2YQSfaS@I7nO#!8nRs`_R+r)S~C?=%%2Tak4&qkw_DtH%?(*dzUn5E>rRrQ=uttWSy5la zkNlga9iymPD=wDz(BziA=}t;0TDXv$2^qDmK-5uj*6_273u%K?9ZkEFB3klK)m0~H z`oOY}?Aa%PQin+n;1GahT}c%DAhrIK8Jc$X*~K8USm}3=d7flPtI1TgLfR~H9Zyvd z`Mg8O4RhcotBmYCf*g04EX%2>k*+!N$f3*!DXM~gfn376Y1Q8LP2k4~#C7HyeSGzM zc49lnf~%}LduYnyF`J#WTpVPAtpm$z>6TW!+hIaJp=u^aP+~>oE}1%ABtwNoV<(zX zk+$`RgOg%lM-Yj~yXPWiUn}s7Uj1lJWa}mODJjTfN!U@wED`BZP`rBVe}eSlZA!U8 z?J>wZ8t36W9!$!tvN<3#98)wtgEp}00@u7c(dJ}!y42Ge;O^&3Rc#8#5}IdW*4d<{ z`18C8d`!Ua)b&PzQZd@?sun2GvavMCwOHE{3~-bis5+L$CTXHWb39a*Iuz#P_XlLD zP8)9{EOk}Qe~3I)@5M0-G!cDHGHa$b2dJN>D|_4xAB8ee(*g@vHNkBl?vgXyc2vxk zx)H>h3E27Q^HzZ3_1~hY<*m%MPdYt%@MbKpF2coNE~4#+?1hZc3v?rKmO9wl;@iCm z{K*9DE|rI6=Jzn~CuLW81STtbgJVaP?R9fXA*Dp|98gs}l2M-&i8_N3<5|ojZuM`+ zQQqpwl4>uBASL9*?0cuQ1Ck-vbkIE!t<_YEeO|?NS&%F~TT85ia)b*SpqzF&u&EXe$)XP+4w-6Kryh#?%?Rx5 zG%~w@@ml=4DLo~&qRuunm4 z;YUp2_kNs!T_pa9E-(2AJ$_^>Cj2HVHC@e(iAtgAo|lf8r8X<~Y~6S7kxWO8oUpWa z+7kzFJ{^3@p&NL4%{C}r)$h@CI`}~Ivqdl4CL1n*izbpBfkR{<5bEBpCnysn0`OqZ zBa#;?ATYt!=LKwEt4+L-zwr!;|aT`L@{04R@3&T}etIID}x1PFWHY z(9a=~P*>N(UGgeHi=y_b@?3S{I3u~WK=y=WvsAn}-}X)5&nFP~l&oXAP$_yMS)<14 z&L!C0LT#%k_tYBe6%3T6YxF%sa+Yz{mHbuHl0!plNP2xEL}Ktp3Orct)DE}-AXYmO z2&@6PWg(34LfWU}bGoA3KzyDTlqq>xM>kYsE__B+5oaRh6KWtW7>FBi@M>|TJ+PtV zb4>@=^1y;(>!8W172HV{9g&_Xb+mld+(1%WG6=+rDm+JBm&u<1uWK9wMNmJ%CzHK&5(O(WU zT-s-Kuk*EON(&BLLzP2GXO3I=QVVPOS<)%>ZsGl>pBV1*Xe@Wa9i0xSD}IlFuq zCW7UrX{uVr=ZdOWwKDI1(^OE{56wKzd!JFf|H$FK^u-F%t86UN7q5$=KlgbAV>a3X zlzVAuOOPeh68SB^`aTBRH+dn%C%E3;?p;gm)?A@I}K#gC^Yn;$-P-NC(;YM zu9@bd4CaIkPJr#}O>>!x=jH0wqsPvgmgQt_$$Jy0YWQjOOB@LDb9(r2ZiD%4#P^&}X3 z`4}g1oo}Btiz_q9gWvl}nrco7M_}lYeD>~!5vz&yCPod)P|@5MQws?fR;^Zd)&V(1 z*0wiNPg7LNCM1^ApU7G8M4D)-5@xYjpq}XCyh-CNW28_b6ItUaWFv%O_9WT{Dk7{-bxX@*}K!8eh)%_=F(mC|J}U^URg=73YJgInDN2=h5LjK(NyR*60a;4q2$HZZ zNh_K0`6TBv-vpKk@P$gRMx+Rt6vW-cDm+sWB1Y0oDwFb%S5z*xs#t<9A|blI-;2ZR zb-27qVa3)&ZOa@8tRUMelEO3)hxL*%hfbna_+ep1UsSDi+S_q*ifU*`#5_hJIP8Wpm}?B zdpt^2jEt_b$%=d z+)&LpZdi_}At1lO?*<%gRb_I1ftr`4o6_693H<2<O@S-LsN3H2CJA}l;^XX97*#hf+AJfPbjFn4e`Yh^RckE?0zc%jq-UQwR-UQwR z-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR z-UQwR-UQwR-UQwR-UQwR-UQwR-UQwR{&WKTw{(BV!C&V6LPbpBD{4hQNi_FaUk(9E z)>D1?9~USX@PWkNw+;~9^aT8k=cIWUDrre_)?86@7H%(ZNInp%v_4VjTU7t&4(D*L zrpH_Kq--=X&~~63X<8_c>S#Zt;Q<+IFlsRwQT}AH8zcn+c8u|g>J~C}ZKMQ?l;e$* ztp}-Owlk~#96pko7U4XJEO`(^Vn%OguX957ShJkiObq99yb1hk6G#{DCX}%2MQj{x zcUAFsctbm*`-Rj>1K&vT{V_>dmh+|Qd#GI$5Yo8-2$w9Ie4mhiT30{aBg#oGb(CQQr&OR;|O zcakspPnz~*Hg<~YQ`0bRXS^n(o(YO)!8@r%D%cs_S4MURP}~LI!SSPra*V`^MA{cY zC*7!t1(pzdpr#Jp6_OC$SF$l>Tgg?^_(~QL+E8IXVkLjq{GII8^ZqZZV{%!_?V@R) zyC2snHY#}&Z6yCF++Q8EyL7rz9iO6|D0|0?_if$;{$v7vi`Y0O7D_iOyKw9p?17u4 zfcx{-M5V~#(X6Pov-a>iSr2v7?BrTlou&MrXiDNPylL(eEsYMb@->!4k!BgpCH+Dc zQRecOX(4T+2`cBJ8N_!yg3={6=u8uGSK4B#e%DOkwx1J`doD%jZ*hlneO zM7JDKgEIq3=8)tV=P;eQ36^MxFJLL|Bv(1T9O}b4B|QI|z%LU>7i+($B$64khxEdz ztC5jEGCJw|PjUe6a1Ay5hz_{%O*R5sR|o^4wl39$ki^2`DG$kHWs)RQq??V@ZHHu^ z$*GtD} zb)1yD!9`Msv|+t?(QLw15`zz@#bY}QN32?yL}b)>?8Z$;Y9MAI@PlR`W(~2bnfN1_ z7&ZR^5?#3V&zdJtFA+sCtuy!{Zvvka@S6!^&!8v=0NFZO!5XF8#@h8=(em{Jq(|qeHXboKZ07)yVtZU-Lw0k|-4xWS; zPF+p%$XNjR7x&_C0=Eh1JxWi(3gfo%8V}4sGp0WP%+tui)lDTS#tuiConYmH^c0f_ zR2utTGm$sV6r(0S`rO-;Bji3=Gtk^fP;BXtf=s;(O`$X3cGqN84;G`5vMqpb7SdzY zXe0;!@#?i=-u3FdPw}+rWTKkcNZA@f+EqTY`jI8EpQ^K70+-J{M|1sLn;6=r+BeNs zv1Vn}8nIml!scM?p7kd1k4-@D-KU&g&yRZ;)Ez9`^=h{V@6u=a?)cKo@J*AC;muw^ z{(^AsTD*NDeP|}t5AxqqJw&h735(NTNe;T`7wO>jyN@Z?yh+yorurbG_O&<_PAB@% z{PE~=n1B34b|4kMH7e)D@o!){4u1sK7xZ|&f+6~Wz3`jBA5B27;4LLz()%@~JDlK) zCVw*}_CmHlVqQskh|s{5q#(GD6aA59h+eC6X-BW51kve@bUA@ z2T_)T4zHv~voXme6oOo+zp{+C!OjlWA8$Erk~x~}0Uk9MGU;SGCUCVAHEU^+n7BYTqSY1jfDHHYMhoZ#U^3wY36Np;o} zZQ!o?uaaB!Id-CIgT7npQ@V$fv5_g9&57n{u?K3+7f3dftc*83K>6GQzJL-+$2W5- zf}w~sZ0Z}Be5r@z-Ap03!1KKcqzSB#dWyTbeZ_h(j34hEE^;KU7BE`ZIGhp(4Cl7y zpOtq_E%=irAX&Gn@cn@%rGzZ_Wgr#Yxds;a*n8LQnroc-vmw*ko(7PE8tNDY&%h;JCBRqQ7_{pj1%cK0lEY- z)RCSze?CFjIzX31|42X$2Pgm=jIQu*Yat=&IyvKa(q%X$OH4b9B5hLa8RU*tQU`wS zB1A!+R5QtT;mWR)jZKM}OzzDDiZN`A`YL(mVxrs8%ZX65{l^w741Fyxl4SO9_87T| zw6xG_f7M+>a6q|`TNs%t{IRlWLOYL?HSY0}nJ zlgYkGW{-q5HM=)k#01@<&8Lzd#aqtXz6tmQ>;mcH-eDAsH-k{e;7+UxOuXx!z7j_Z zQ!06~s{Hf!J!P8~gWUQ7hk6SIshqD@iAg8l8*?Sy{7z`n?!H zSaY6PGjRjdwm@K&KGy14SM83`UIIz$2&SPxc##uV``k|$szYvGwUqg9(d5eMT&Y|$ znM&aNXq=Z@kx&l|Lj?mJKsZY6>zFJDBMpgXy$Sr~1aO&TJ!%xnHVeFAoA8mNK#^_F zM$1d6B(`wgI+~rU4U!t+e{L^B3AuBAsGFF@R8yvqXl|r8V`QSp6pka=y=f|NAagR# zcF-(m*Fv?p9A)dj6p@YfSpxF2ws?4BBrhXY914C>A^At-7mVWEGKoKC8vs_AYeH*nG9 zLK`|XCHDt1i)NX6ZjVct`i8M16EM_HVC_ITIr|b|+J+dp2W&+fh?*g2E_Ql~;JCjzzRjOzv)lOhB zGpT_%hh>^0lV%sC*kqFXiinNH9hqc~_8zN7C1vLT?|hR6pPUgU3;vsCP@I~{BGoqu z^q<9@(f!|%Xnobpl3pDdSS7QNCDMc|NTN21hLs6vj!(IvO_8@oxFP$66IYfyG0*=d z@TU`qdo?n1C~USes{4rJT8pQEwn=EZ`ZtneCClOPh83t|oNpU&?21<=8I6coXL^lgK8g-0}NW)qV%k87DR z!1AF0;&mg{XB3tNTrSB$l8+(+P}6nOoTo`o;4D}4Zks_>2EQ@HL4 z^wMYGMcxE{oq*jp!o#Y$ek0wmxa>1)4(Hr}xWn>TdU!Q*5j+>@k@sQa8P|*uqdjj1 zm>dB&3)QjaaLqTOIy3IJlbfhhYy?@{a{~}RInG@S@`yTFW;|<0n>1%j+9>jcdlg_xpv&hE{gk3{zAHFPvHH}WCc}|^G%e)$xO7Duy9%uB__~7 zOtgc2_!QrZb0SB4acPchFNIBxfIgxvM=&&h0G|6lcLILt)M$gKQ3|>vgX~NpfAADe zBt_)bx=Kw;WE4uQn;FDchzE1|0xp{2YNTyLlq`cgS(v=3ART-Ym4rcNnQV8^MKiQY z=Fg|XQ!}PgNgN?kl2b+@sm3WR9?%JI>@T>61%nS8NBo zkz6FwgWQV;iFnSosEDkj%BN5>y*#P65O0$&$j;^JP7NbZeFUH5P2jI4V0ZB&H{IBs zbb!KVNvEpOB`NAE#-k+fBEL1{y#mMQ$aP&wrkvcd{2y=14<1A4rNOI?U)0Q~ zy@^kXJqtM>x-&@WLwAv!&_ObOcu;HHo~mz>tL6^=*d%}7@T;C^mF&>zI3o9}WIC+1 zaHuV+rOO+rG2mws#Aj{0G|vB#q-2c@lH@=eJ$w2~^0&92!J#QtHpx!fenVUJ4KZIO pMRGYe!;KV|zp;T=1?3ha)YeW?c)QBIwx*dkNjAB+{ZE|0{{^LsVv7I( literal 0 HcmV?d00001 diff --git a/components/com_contactdirectory/includes/securimage/gdfonts/crass.gdf b/components/com_contactdirectory/includes/securimage/gdfonts/crass.gdf new file mode 100644 index 0000000000000000000000000000000000000000..73420a98d08009cb0ebb079be8e55f7304c9c208 GIT binary patch literal 39691 zcmeI4VRqfR4TO_bbQ^CU-T!_{3^2d|qOPw~J5uuGb1DKKhu{E`)8qc=e}DY=@z46t zf8sxD!Ozd1Yr!KxP{(cKr~N?fs~-SOYyp0N58=A0N>*HvoyaVMtk{E|y-=sCsx6V+ z=wZmMV4g%`S)-Mz)_g_27Pzd3kFfHaMQCs5+Bb&V&#CROoft*_H5k)+zxj>w5)@y3 zzuRBqc$;jHYaC&URo*_o1n&16&c2nsdQ0bpxWJ*|KMe@QM2Gev{d>ikZtN}{PtjX24EISqf{Y4!0;x{*od=86mhUST} ztY3nq-bJCckw57n34;Fv=g|tRWMvs8&cL^*Hr&odcHmKQ%0Gd54@%datk`cP?f->= zuMk(}ei&Ffi+Bg={np`-eYEb8L_ZYhFQ5-4Mp%M2fQ2{BcX0|5Td;m&gCQ6m*m!}( zG*vLmo4it1;YHq%i$0Wyz)r+HgXWhK+g|%lPdDbaa}KBNL>n%zHcoH~Vn6c;9y}*< zi+sHn^O3)QFlFz`a4cYwa@)CxB-FES;`ky}jVfVqaT+OSM{%lCY#KjWkyl_r;S$#6 zp*~iD+OdamX(d{3ZCYv?uA#rr62>?gH)fEw%PJ^1x3LF2qBd?nCzW|wm2t^>nhJ@^ zg}=mcw5qteJ*{{HS&>xsMQq{vF;NDL4>UF?wl#meh+L98Pw-6OnZPrFX9CXzo(Vh? zcqZ^n;F-WPfoB5G1pW;Z;NRDySN(Haw_eCq#`q}DKiets6@Qu^FRj1*RUTDmapqiE zIsWY5W25rF3q%Z9n3BN!-!k@?6xUZ$k!|$Mo!;bW*4QB|c@C^xvGAAp(7CHmuwQvn zTc#yf3XK`(4cuy=I>lwKQAJ=Z>%k&k{6HH{Enj!kDsG^%n?`PN_@wjRfKdp!q9xE1 z>^;jAAU;l_6|C*=#-rzBc7S0lTwUHLa<>O>#KW~Nco{SojB+T&KkE0%zlQTVn}>HWOlbJ$szg zszd>=C>c2mGmrH{j7wOr)F+r9l2!*{^$;o!u;&-N;jd=C5gQHgJ&l8U~0CcOGCYiqnrJ-BAU=sRb^JMOWrPIpH3 zcu)C{fX?kg+~lQ!zu3S(p2OX zQ6g)@k4PdkER?YgdW#KuDJvfdAaLxt#*5st?w1q4p@rgp@BGxKjg5{e0X3XR( zS3awDeU|Ao?N;YC0lS6S%~tPX_7Y7RZvA))s=VRq)Uh?6k#%25MT&Q7u+uB8s{eRJ zSCg%^ut4I5EOGU3#fQr-1Q>I@MRyW2S&KR|Y9N-_0wpdzFeDZEQEH@&gj)W~Ft1eW zQd~kPylta-uy~`@QCDXdtAbXMaY}8W7l+;)da2ggjAP-dmUcQ$y<=+-h1h9f@V77u ztOvz$@-OmeDvo`0B@zk$Hg)x*P1Y~FQT-4j9TfUCxURKH#y=4p z>Ydi!LuM9a#}Z3eL-RpJSEk@eiG`|sj~gxdIo64q$_)6kb^`m$*x*8lD1RTbYd!I~ zDthvoxcv5LWo{@jg2Xv(kQC)N;=+_uFfgkm9+x8JS@|wt&A7Xar3@#oR|N5>X9pVh z3J3gN6+e9NlDJpdU`N+KF_MkH^*m^T#e1tE9F*rLChs*?cDS#(>GGXD zRM?cEJzJ|v-j;#wA%W_M{j73}Sy4iw>sK*lUTJn8diOA`;stn8&Y3Lmpo?b>1npsB z+Ng~^#oH(mqfd!XYFvTo|I!u1<145)q1fW^7}zp|4Nn@IL;J^4?>(DrBPps_DDfH_ z1`vZx4EQ{r2|N>cCh$z)nZPrFX9CXzo(Vh?cqZ_-PQd;M+VqCMjZXOcc=H!ME<0Wd z6UR&4+muIsg2$z)$^ibE*(wu=7_cxUfjO`}CT-XF-|98FCMtY~2u-RH_X^C;ZCkPM zmpG5HzN=5LUwKlS74j_9LdBrc{(1Cw99N~Os1599vJy1TszwYYaBADEgwmm+`^Da# zyals}_I(w{Xk53k=i}I8KP(f>628MH?_(b8cjM7DZWV_sEJNg2ixXpHg)zc)*tV;N zMaU1dYp%-N?Q|SX*kcJzmMfI6=p16;yu<@LSVCBDz$3b4Szf#5Jw$Z@G#5F&I zNlTp#-YxJxU|c);LVW1hYoB4aQoEu45?ob1dhKMdb|dogn?ZhH?Tc87tmWz`lJr)A znLQY6zCUbdsn3fXn)TXecvX`5^})&+HTW(TorkZTO!;@J=UtcPKL7R>mY>zWxr!wW z+DwSCI^W}@{S~uBl$6SyAlr-a0lONP&`POKFu$)l8+X=8mv}`~35D<%IK?YiGD~Br zoxla|6j^WXr=pctQqgtTJsg}Ec>ez(zU6Cbv#uK+T(e;GoipJb_gFvO>CW~laz|XY zDq23P<%WwNv9;GJ%TzH=0Jyl~SCHa^?BL4M*&jf=|%`|H(L=`*qC`l(rY z2KWZ9bJs@Fz%s&)xVks=WZ@A*&~S>ox-=EFf`Q>jB!Y#qwhelV4SFf@4G0{2u5s+T zgL(m05_QN#O%+!wYTGN1#qA^prP`BwJl(IFX3QP-F!%wt&ZD^{%HapfGBF{=HlQ=? zJk=o!ec|MZEXcC)eqxiS*NSt6vyAXmWdMC<7L>e_#tX+~cU;g$wNhhQk@jdC(NJsB zsTBauN+OD5R)HlLhFldQ`A#g?z!ltu!82DrtL7@pbefIIR}weu2hQs+UcHOiOEhV? z_2Vh1@`m$+$VnmC;1bvnyhsF7{rbw9p*krVwetq<9Dr|Jfa&NC>-Kw%nXE-E8Z{70 zY=IJ&9vG5}{3tb2MnWzBWtdm0btx_(6yCPcJXpNZ>Zq%;i&a6Z$T+38(2GNF4!uwDS9r3{S%P2hTro`VxtRf1A4c z(I)Gc-Kc(ukq!#|8eG@fB;%h54)soJ?;$e_vSW!QtfBd!qAOGIq{Kp1zQ>K0{2c2< zO=SlBSv!IKWo&REM3lde*|nbdTopZeOl5F>Tbwp5kqkh|#CSCpE6X^ndA!;qevJn^0_VcnoYA h!iFb}&7u8csrQ~uwviN7ER=YS4FiZlCI-Cx@ju->A5s7S literal 0 HcmV?d00001 diff --git a/components/com_contactdirectory/includes/securimage/images/audio_icon.gif b/components/com_contactdirectory/includes/securimage/images/audio_icon.gif new file mode 100644 index 0000000000000000000000000000000000000000..beafd518270f15bd62e15276ede1c5daab7d8892 GIT binary patch literal 621 zcmZ?wbhEHb6k`x!_^QpIqpNFdY;5n~;OXV*;u07d77`tuk`SMg4g%!``GsX=6`7eG zdAYMHE8DB9Cl}-|Dk@sq*4En8JY(Xd{;AWZcXzLtI%VaIncG&ZSh;fLjtv{u?cBL* z-n?TgR~%Wn^4iXwNA~QwzIDrk0|)jWJ$mfyncG*dUO#s1;k9c|Uc7kq`}ZFcBNGM+ zfZ|UUMg|6;KR{-H{KUZa&ta<9(x80Hu6g9xjs6OJx{*}F1irQnIh u7dv#M;XVU}-70|>#f(4=q5()DsoH-GNgp`0mIfgL4N0Ze0AvFtqn literal 0 HcmV?d00001 diff --git a/components/com_contactdirectory/includes/securimage/images/pattern.gif b/components/com_contactdirectory/includes/securimage/images/pattern.gif new file mode 100644 index 0000000000000000000000000000000000000000..b04a87b91810e20c7ba51ee29b9322472c9399ab GIT binary patch literal 8324 zcmV-~Aba0ONk%w1Vfp~S0HFc^e}8}F<>mkX|NsC0A^8LW3IGEDEC2ui0QvyG00091 zlz|w=u?&%MjYc4XgpKFtJe4OXl6%)qY)+a>07(-)H(AvhA2KxUBO5PKA!wbuASR% zjK03D03YtI3}0>@6;kg#ZyFMH!}KA#htJ#!VUQ&X-fYoc#nq4MO z9)u%lp)pqe(o|Av3Y=9?&TPh+1r-^fsF>b_?SLt(ot`@~C5g4R-mAA~v@X>X$O$*I zZu#Mr6Jc#3Tyl@yc{0b^O+j~r&;>=ySs%cdETlmk15ne_nTp8zBE~xBi`bAd~c;SvDGCB9U3A?*19^hH)Q#$IZgu zd5PWDgE;MF2i<3R1gKhXs-$I;P80H1j81eocny9QIkgmlhF!rRKd((!Vl^Sg^A(71 zQR3PNOYK#}gER(4*dZ$_Rz-LJ#e_|Xg)x)FhARX^Avcv3sf%UHJ$RR8gpe16dpseT z-i@`OxXg0UAy_4HGW__)P(J?HN+w5+!%&67#iXD`GxoDmRcz(~=9qSh!%LY51hZh5 zfz_vBn;Nj$z>W%fgCCEE9y*_DU$jUZKwb1FsW6w`RjDptG2>=sd)>fic$G#Lr!=@J zD#E6zoT9#hH>?euluFx zhqTR_)QFhVyags@32IlCdYpxGSBs>;X6$3Jit8tilljnwk7#+J6pz3daqSqq_CX)M zr^r^+X;dl_uw=sZillU)s_4Q(pXG$pvQ$Mp?HONTWiLvbxfNS8?r7y(Ro(_x8kG5r zndPy3rlc~U5i&<9cGMP@OhlaJYu`_vb$T0ncIA`M&m)Ko9Va#}0vkCM&05u?4vD8+ zgtEmXNfTCI2(1eWyb&}M4NiAhL zSOf3n57!6>TIO0>{eUN;P0DpWTf&ehJns0=8O{b%q8LrhFqiq?=;~y)wMYMNVTWc_1G>!ICWg={%w{+LPsI~}|)$tKYBnA&7M;*U4ZkG8N<}QzjzYu<6MZMJ2Gq4teg;A`x4l_nDKg$qmPJZ6|qFZqvJsN|nO;}a|Xnd)T!dU#JLkC zs`;gZXh@l&D=m})CTVDhF2fK}NR_8V7Q?LrJsJzMq(n!u=s;nM(%}|orY9^du*&+u z`9Ot5HU^Rq4)ms#cyl#sRxWKx(i_Gui^tP)Nsj|_-qA2yw9a-6P2D(8*o?W?tEM)o zbJJ1nl8~cZt_dcmlb$ez{>Vsl+?FVq8fC-ewmA!_BxOq5V^}X)D%EgEW>i9BcS>76 z@UX|KQy{0R9@VD3GBiP6C0avA=!hX{S6$Zpu1o_8#g@Qty}(Nj(-N3Z;R-lHE1g+i z;G(l_Q7(s`jUo7c>R)cPMv|F&j2_~MyCi;aT)*-Up~83It8UCH(*fx+jPS)2W@v{c zhJzRVH{FRAOEQb;?+E>%yAJO25)=ZuA_Sx*?{t z+acdaW;F@fx8(ig(+Ee*mwd8LMM{N}ifOQzy;&M@R*|rVrA;$}3eX@VtT164*D>CT z*BQ*Um+!a|6ZT_RJdSnEs*Fmi(3#mw)iqYNp=C9K_7G>BZ2635PC>KxW6<`nUJZAh zT%zbQBP-dDu_035sJjbj5b}=O?cD2fq)1CsX+h=Ei~z@_XOn7Dt3l)M!u~lcqY1D> z(*ob#08|a{SpvfG{VdI9oKJy-ggpEWRf$0$ZM&xE&!Y`k5GyT{@h zjX@K$8&QFPF0uIT!noP6kIpf++?MDqcdva>wdVX=A0}u=>UH9^ly?@=ZQboD#OdKS z7+vG#v?p+8Tx-GDrRKFRS6^QfX&aBDrO(h6AC>hs796_CcBo@|mF?x;tjeP>n5)AD zwOi{7r}ie-<8DJNt0--?R09pusT-c3+7l??n)Q{bZd#yPn3~;h+`3cr{m|o!w^F@m zy6zLn*iv~Z$HDHM)Mt(M5^u=O0SY=4(IJpN*x@AkXS7c;zOR{!guEr)> zql6P?SX?4X;#hwYG+BYxaVu44)y63s2X-d4H?{YUilS^Cv`GR8h(QNcyoGWu)m$^d zW8C*TZ-gB~7jZSGOZaq8PsIdj)$EH62p&uK#KtvFQ9Ofq?HiIx!kd`nPFA+;KRyC;p^CN*KPD;TX zTeOE%6p=x~gXSa_>QZe!7BU(rO=<{r#6n5WNh^Cg`Y-Ne@K{Ih)i8+ zOpdluGD3Od1($~OKpk;_k~x__7nt+WJer9r&J}&0(BT z1TyJ!WJl>Q-gs}-hJ+Wkl1PM-*W-eo(rhegV6)|tGdV-yM}+=jxGm_leA;+HsFgbo$RhP(TAa3SS=A8e$X>6ALZYRLz?fGrbX=?hB~UtB=M$7S z_iI^nq@6gWu2_0I*rYB9dEzLEu48_uXq1KrY-%!#ywo8$8jQ*qiiI_b3JIh9rfs>E zio<1CKC&a}rK1=0q(i!1#fO)u!E~npAzMWR&ElwSV*Xov=c9<&j(T}~Z?`0CsYOo| zP2(aYF$xSXh?<%ugwDfXYN~@eg>p4#mYLLaxiOlBcB>o%SVQQ471vc(Qa~IUYuv(3 zP04pevVKOubL8ouBe!AXksrzPJ>~dxCK6IRN(vN&Pvs-lTJF~=wTuCLiJtA3R%cgHMOWsusa#|yC zHL0uWhfVoqSjjebYF{6#V@}y+YvgLCXoQ>>TW%L4I`mE?6f~ z@-~7U8M>{uoNy&yXJe2{#d4O3P4IGr?-6xj(5%XvGthH#1g2LsD=-5|JA~FoM5rN2 z@om8BpUX#cxS3Z8C!SoZIl=gF-C zR8ax=FvqiQ?#Y^2mvSssrvTE6ZFrv`3g?rBfxln1twvrIbo#<#vSfdPHoOpj2yu ziF=WDL+NsVibgX=d|wOm4+4s7wy~~|^p?%UeHA3J3vyqUbh4UQz{c@XCX7@U^? z!u_f`_ffDUw5+j-g7PLV>8rqi@6_3W_|0OP6_+mwfBTR>EpPy39Dh=<&!d&p`i{#=9<(a?!H zAda+)dWa!^wsvMRSiCi;tvD=?o1^Ksxo;YlF!i{Nt9FR{c(qizR7pRILxHa5(AhhE zYD%Sut1Xu}D)N@V$NoHu|E1AT8EieR(0Pi}ut=pSte!(9FoipMlxL%Ih^uwe&sck< zGJ{yX!!+*&x)xos<@gR!9n`erq9Iy!Kr4DbYqw5nAmE{?81d2G8<351R>df+>oIjF z8mg!ue2eAQ19VqQS-Ut!B<4}ceU}WB!pAfFpClWd($=6(C$SmyDUW@0S_xDwJFF6A z$0BynPWGOYXIZfjo)<%{XV##FosHysWso*KBu$ZcEqj~0J}k{Jk6JE!Nv7QuZ?Wi0LbC=l|MLzg9XUQ zSC(_h-Q=xp{w%8)KKN>|wvmrBU5d-Ym`bijJG4wZ#gt}BgtWv=%*8}2-(<~HsfQ5} z4TkXTe$~ZYV0c$pgMA{A-{=i{PQ2g+j^MM1bg7rcUYKd-HJ1gttDwqgIID@R+Gy@A z-hN8nq!=^_hMQpFEosE_WB)^i)hro^gs)jZlKUfo&WUgE>7K1gQ01H6+Ndn~sie<{LoGUL5<{@X z0$4eAbmrV6el29el$?zF=6k`c-u#Z{6F(TKPoOQ2?(AhwrMvi=4G4;I(L(63ELzFZ zKsa6ghM$_E^F!AO+Se>f*@}ullMcVWYUz+3eY!dd=Saa&P0-J=%T!Cn?i+O6rlWO) zl1(s-vMpfgEXy+y;5$`?v#NHu+fFHOM0}5 z1=sYEg-0A+$eGo!m#O_ohY7flpyuLRIc}U*;6e)4dq7*E8A0#-vMbj*5g*RQ`-T9B z>9r}F(xo{cmJqp*C)bMgO~UL$8 zWx^C7MM53Bf;G;uBpHw}eW2UfE z@=-YV`IJMC0Q(`kH`Zu1%)ie?Ui&XL_~`2k@=7^$cnSV zY^h2dt}^s9x~#FASvqQ~mb4YL7$Z+-H3-mAw!0kooDOE}+H`y(3<=MEF0zt#%90SF zN+w`ZBm+C>3O88@kKmj@M*+?HrrvOdG>SSiTh(G?rD#|;zuZV^3pp2Wa}p>wG9?0Y zw`z27m@bfNWMxvQ?hpZ8eZk(CU-yPryoF7a_r~LtJI6I|o}bQG{_=)^+vc#Ow1R=N>f7Sep|BaPHECBn zUZZIC5Ur)lYtn@yTAJi;iKx36S94qF3?Q|QSup!idG7T7MBu*$LqivQ+7Wbk&~Rb+ zUBo0(OBy%~G<@a8^jS#8-kldaSMhAHg4B?|oBbIT}_m;&rYk#dZhLXvyNNGYer z3X)?Z%);U;9t9IBPB7o%18S%u#sK6aw=~Nn9z-sa>K4dSwB-flsKY~}4b>RrD5O;B zkdvg;B8u8!(5nMnNOi721gj1VScqlK!{sR8%3N2B(JQJ_``hc^xa#%IS3zu?? ziNI6riK4sMa*Oaw5W}?5y2WJD5>?W6)h$#}3xf=>U!j@RNdq~2R7Mq-%C!n&w&hX9 zfd=siD&FYard4RIrRdL)?r0+1s&FjUE-H(XH=!5O0cRLt7oCe+zVg$4czn-HahGr-}mA`z(9O z3qCx#FglJyX05w5hMmv7E7hxLIZuOr$OiVBnXgX&K0abRna0@#6l@HO4QOj$)-Tlp zpMykL3fCPlkmzz-Ytc8WRgPeWNuCR4Vu!~u8BN}Cm)cUHdr$|3DJ+$ViNCdsD)GJr2 z-WTt_Z^_k1Yn^tz5Qb7qW^e2AcHAEu_r}**v+HotRp*jzx%(9n-OlJ%71O|(*G1OJ zMzaE~tsF&m`qD(hICC7xYy>Ua{=Vp-+Is_f$?~lq(^Ta@QA{q>(ni@2nRQJT-B!}a z9=LfAev%5&f4as9ByqrKHqaNN@P#cw;0r!sk;d|_lfaiXq$iNs72%T81Ajn`IDVRz ztB%z^HgSW6=zAEoX2F^|G3hVb{z?!uv-$=uIA~KZo6QT}v8(mB&cYeX9MkelDR)%(h;JG+ zr)pYNKAm6?g@-?pi-)9zin9h0CHxZk$=aH;pwi4-4I{|GL49+RA5`gT%4fh8 z+K>~cEFvgX@ha^}uT#8Cr1_ZQ2y?0mk_e@*IrHmNCl*w{7CI&{dCFev?x((IYUB_R z`aAe`a$^oD-_=kAF-e)Jwa2X?C5yx{K4CbVuk2_ppc!CwG^$Pxv_E8 zvJgt{6#l6^vTfclOpRS~jK1*2C+>E>@bMP~k48oYcam@*Kx!k&qe$9h7^G1xGo4Ke zE_2!R6I1+*G{})3JW&ls3=$bBZLGuX^rEdzYic^s)zjU z2GiNCb9`=bGJF+JCRb`$+nI~%8EK3WX3@u54ukFV<&myd&Sl-YrJU;)J98IL%Bjw_ z3l)-P$w?I^jfIc-9A32B(a#}f6IHEV-%vUGY;3^x}x8iMF&x{Eg2I6uN$L_ z{#w7;2g=p7Br5DASUy7^fx8C`cbe)NoxXvOV6^Qr;@fUwL1H`YfnTCzZ=l z;|mD!Tu+d=nb0z1B$GAs*59xvghX{919Lz!j(2)UOjIJ6b5nrB5lTd)+(hQ;j-Y zF!~*6N2yd~ampCSEJ0VcPY$uk_M_tyUOk<5XD+VkLE~*#_wYFF*YhuV2~Iunp2Vt&t{N<>hdjALoPvO701B_7kbxp)EVyD7SnIy9A2G?B=_^Mcpzhx7-N<0}%A!0f_?7We&=BB%CaB6Ptji&y#V=p2w7!KzXt05lpspEM3`BTH%UXDah6V>n8Og~tI6xGK`HJXUg#tx`gY`5u<@9|a z${kJRgF-nOg9F(4R6=DG>_MWTp(f&{p)Bf_0oq%;a?r#XtQw|MwS1<*8Ce%$(jz?HI zI5;#YDAa~u-UDKWucr+83P4BI7J_Vwa^hB@P%i@|8bZRnos_J^l|21I!{Ff=78Vo= aM8QB^K+!<3$zTGg0-_A8G%&D{!5RQ?yDO0Z literal 0 HcmV?d00001 diff --git a/components/com_contactdirectory/includes/securimage/index.html b/components/com_contactdirectory/includes/securimage/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/includes/securimage/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_contactdirectory/includes/securimage/securimage.php b/components/com_contactdirectory/includes/securimage/securimage.php new file mode 100644 index 0000000000000..96b0ca29e67ec --- /dev/null +++ b/components/com_contactdirectory/includes/securimage/securimage.php @@ -0,0 +1,932 @@ + + * File: securimage.php
    + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or any later version.

    + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details.

    + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

    + * + * Any modifications to the library should be indicated clearly in the source code + * to inform users that the changes are not a part of the original software.

    + * + * If you found this script useful, please take a quick moment to rate it.
    + * http://www.hotscripts.com/rate/49400.html Thanks. + * + * @link http://www.phpcaptcha.org Securimage PHP CAPTCHA + * @link http://www.phpcaptcha.org/latest.zip Download Latest Version + * @link http://www.phpcaptcha.org/Securimage_Docs/ Online Documentation + * @copyright 2007 Drew Phillips + * @author drew010 + * @version 1.0.3.1 (March 24, 2008) + * @package Securimage + * + */ + +/** + ChangeLog + + 1.0.3.1 + - Error reading from wordlist in some cases caused words to be cut off 1 letter short + + 1.0.3 + - Removed shadow_text from code which could cause an undefined property error due to removal from previous version + + 1.0.2 + - Audible CAPTCHA Code wav files + - Create codes from a word list instead of random strings + + 1.0 + - Added the ability to use a selected character set, rather than a-z0-9 only. + - Added the multi-color text option to use different colors for each letter. + - Switched to automatic session handling instead of using files for code storage + - Added GD Font support if ttf support is not available. Can use internal GD fonts or load new ones. + - Added the ability to set line thickness + - Added option for drawing arced lines over letters + - Added ability to choose image type for output + +*/ + +/** + * Output images in JPEG format + */ +define('SI_IMAGE_JPEG', 1); +/** + * Output images in PNG format + */ +define('SI_IMAGE_PNG', 2); +/** + * Output images in GIF format + * Must have GD >= 2.0.28! + */ +define('SI_IMAGE_GIF', 3); + +/** + * Securimage CAPTCHA Class. + * + * @package Securimage + * @subpackage classes + * + */ +class Securimage { + + /** + * The desired width of the CAPTCHA image. + * + * @var int + */ + var $image_width = 175; + + /** + * The desired width of the CAPTCHA image. + * + * @var int + */ + var $image_height = 45; + + /** + * The image format for output.
    + * Valid options: SI_IMAGE_PNG, SI_IMAGE_JPG, SI_IMAGE_GIF + * + * @var int + */ + var $image_type = SI_IMAGE_PNG; + + /** + * The length of the code to generate. + * + * @var int + */ + var $code_length = 4; + + /** + * The character set for individual characters in the image.
    + * Letters are converted to uppercase.
    + * The font must support the letters or there may be problematic substitutions. + * + * @var string + */ + var $charset = 'ABCDEFGHKLMNPRSTUVWYZ23456789'; + //var $charset = '0123456789'; + + /** + * Create codes using this word list + * + * @var string The path to the word list to use for creating CAPTCHA codes + */ + var $wordlist_file = '../words/words.txt'; + + /** + * True to use a word list file instead of a random code + * + * @var bool + */ + var $use_wordlist = true; + + /** + * Whether to use a GD font instead of a TTF font.
    + * TTF offers more support and options, but use this if your PHP doesn't support TTF.
    + * + * @var boolean + */ + var $use_gd_font = false; + + /** + * The GD font to use.
    + * Internal gd fonts can be loaded by their number.
    + * Alternatively, a file path can be given and the font will be loaded from file. + * + * @var mixed + */ + var $gd_font_file = 'gdfonts/bubblebath.gdf'; + + /** + * The approximate size of the font in pixels.
    + * This does not control the size of the font because that is determined by the GD font itself.
    + * This is used to aid the calculations of positioning used by this class.
    + * + * @var int + */ + var $gd_font_size = 20; + + // Note: These font options below do not apply if you set $use_gd_font to true with the exception of $text_color + + /** + * The path to the TTF font file to load. + * + * @var string + */ + var $ttf_file = "./elephant.ttf"; + + /** + * The font size.
    + * Depending on your version of GD, this should be specified as the pixel size (GD1) or point size (GD2)
    + * + * @var int + */ + var $font_size = 24; + + /** + * The minimum angle in degrees, with 0 degrees being left-to-right reading text.
    + * Higher values represent a counter-clockwise rotation.
    + * For example, a value of 90 would result in bottom-to-top reading text. + * + * @var int + */ + var $text_angle_minimum = -20; + + /** + * The minimum angle in degrees, with 0 degrees being left-to-right reading text.
    + * Higher values represent a counter-clockwise rotation.
    + * For example, a value of 90 would result in bottom-to-top reading text. + * + * @var int + */ + var $text_angle_maximum = 20; + + /** + * The X-Position on the image where letter drawing will begin.
    + * This value is in pixels from the left side of the image. + * + * @var int + */ + var $text_x_start = 8; + + /** + * Letters can be spaced apart at random distances.
    + * This is the minimum distance between two letters.
    + * This should be at least as wide as a font character.
    + * Small values can cause letters to be drawn over eachother.
    + * + * @var int + */ + var $text_minimum_distance = 30; + + /** + * Letters can be spaced apart at random distances.
    + * This is the maximum distance between two letters.
    + * This should be at least as wide as a font character.
    + * Small values can cause letters to be drawn over eachother.
    + * + * @var int + */ + var $text_maximum_distance = 33; + + /** + * The background color for the image.
    + * This should be specified in HTML hex format.
    + * Make sure to include the preceding # sign! + * + * @var string + */ + var $image_bg_color = "#e3daed"; + + /** + * The text color to use for drawing characters.
    + * This value is ignored if $use_multi_text is set to true.
    + * Make sure this contrasts well with the background color.
    + * Specify the color in HTML hex format with preceding # sign + * + * @see Securimage::$use_multi_text + * @var string + */ + var $text_color = "#ff0000"; + + /** + * Set to true to use multiple colors for each character. + * + * @see Securimage::$multi_text_color + * @var boolean + */ + var $use_multi_text = true; + + /** + * String of HTML hex colors to use.
    + * Separate each possible color with commas.
    + * Be sure to precede each value with the # sign. + * + * @var string + */ + var $multi_text_color = "#0a68dd,#f65c47,#8d32fd"; + + /** + * Set to true to make the characters appear transparent. + * + * @see Securimage::$text_transparency_percentage + * @var boolean + */ + var $use_transparent_text = true; + + /** + * The percentage of transparency, 0 to 100.
    + * A value of 0 is completely opaque, 100 is completely transparent (invisble) + * + * @see Securimage::$use_transparent_text + * @var int + */ + var $text_transparency_percentage = 15; + + + // Line options + /** + * Draw vertical and horizontal lines on the image. + * + * @see Securimage::$line_color + * @see Securimage::$line_distance + * @see Securimage::$line_thickness + * @see Securimage::$draw_lines_over_text + * @var boolean + */ + var $draw_lines = true; + + /** + * The color of the lines drawn on the image.
    + * Use HTML hex format with preceding # sign. + * + * @see Securimage::$draw_lines + * @var string + */ + var $line_color = "#80BFFF"; + + /** + * How far apart to space the lines from eachother in pixels. + * + * @see Securimage::$draw_lines + * @var int + */ + var $line_distance = 5; + + /** + * How thick to draw the lines in pixels.
    + * 1-3 is ideal depending on distance + * + * @see Securimage::$draw_lines + * @see Securimage::$line_distance + * @var int + */ + var $line_thickness = 1; + + /** + * Set to true to draw angled lines on the image in addition to the horizontal and vertical lines. + * + * @see Securimage::$draw_lines + * @var boolean + */ + var $draw_angled_lines = false; + + /** + * Draw the lines over the text.
    + * If fales lines will be drawn before putting the text on the image.
    + * This can make the image hard for humans to read depending on the line thickness and distance. + * + * @var boolean + */ + var $draw_lines_over_text = false; + + /** + * For added security, it is a good idea to draw arced lines over the letters to make it harder for bots to segment the letters.
    + * Two arced lines will be drawn over the text on each side of the image.
    + * This is currently expirimental and may be off in certain configurations. + * + * @var boolean + */ + var $arc_linethrough = true; + + /** + * The colors or color of the arced lines.
    + * Use HTML hex notation with preceding # sign, and separate each value with a comma.
    + * This should be similar to your font color for single color images. + * + * @var string + */ + var $arc_line_colors = "#8080ff"; + + /** + * Full path to the WAV files to use to make the audio files, include trailing /.
    + * Name Files [A-Z0-9].wav + * + * @since 1.0.1 + * @var string + */ + var $audio_path = './audio/'; + + + //END USER CONFIGURATION + //There should be no need to edit below unless you really know what you are doing. + + /** + * The gd image resource. + * + * @access private + * @var resource + */ + var $im; + + /** + * The background image resource + * + * @access private + * @var resource + */ + var $bgimg; + + /** + * The code generated by the script + * + * @access private + * @var string + */ + var $code; + + /** + * The code that was entered by the user + * + * @access private + * @var string + */ + var $code_entered; + + /** + * Whether or not the correct code was entered + * + * @access private + * @var boolean + */ + var $correct_code; + + /** + * Class constructor.
    + * Because the class uses sessions, this will attempt to start a session if there is no previous one.
    + * If you do not start a session before calling the class, the constructor must be called before any + * output is sent to the browser. + * + * + * $securimage = new Securimage(); + * + * + */ + function Securimage() + { + if ( session_id() == '' ) { // no session has been started yet, which is needed for validation + session_start(); + } + } + + /** + * Generate a code and output the image to the browser. + * + * + * show('bg.jpg'); + * ?> + * + * + * @param string $background_image The path to an image to use as the background for the CAPTCHA + */ + function show($background_image = "") + { + if($background_image != "" && is_readable($background_image)) { + $this->bgimg = $background_image; + } + + $this->doImage(); + } + + /** + * Validate the code entered by the user. + * + * + * $code = $_POST['code']; + * if ($securimage->check($code) == false) { + * die("Sorry, the code entered did not match."); + * } else { + * $valid = true; + * } + * + * @param string $code The code the user entered + * @return boolean true if the code was correct, false if not + */ + function check($code) + { + $this->code_entered = $code; + $this->validate(); + return $this->correct_code; + } + + /** + * Generate and output the image + * + * @access private + * + */ + function doImage() + { + if($this->use_transparent_text == true || $this->bgimg != "") { + $this->im = imagecreatetruecolor($this->image_width, $this->image_height); + $bgcolor = imagecolorallocate($this->im, hexdec(substr($this->image_bg_color, 1, 2)), hexdec(substr($this->image_bg_color, 3, 2)), hexdec(substr($this->image_bg_color, 5, 2))); + imagefilledrectangle($this->im, 0, 0, imagesx($this->im), imagesy($this->im), $bgcolor); + } else { //no transparency + $this->im = imagecreate($this->image_width, $this->image_height); + $bgcolor = imagecolorallocate($this->im, hexdec(substr($this->image_bg_color, 1, 2)), hexdec(substr($this->image_bg_color, 3, 2)), hexdec(substr($this->image_bg_color, 5, 2))); + } + + if($this->bgimg != "") { $this->setBackground(); } + + $this->createCode(); + + if (!$this->draw_lines_over_text && $this->draw_lines) $this->drawLines(); + + $this->drawWord(); + + if ($this->arc_linethrough == true) $this->arcLines(); + + if ($this->draw_lines_over_text && $this->draw_lines) $this->drawLines(); + + $this->output(); + + } + + /** + * Set the background of the CAPTCHA image + * + * @access private + * + */ + function setBackground() + { + $dat = @getimagesize($this->bgimg); + if($dat == false) { return; } + + switch($dat[2]) { + case 1: $newim = @imagecreatefromgif($this->bgimg); break; + case 2: $newim = @imagecreatefromjpeg($this->bgimg); break; + case 3: $newim = @imagecreatefrompng($this->bgimg); break; + case 15: $newim = @imagecreatefromwbmp($this->bgimg); break; + case 16: $newim = @imagecreatefromxbm($this->bgimg); break; + default: return; + } + + if(!$newim) return; + + imagecopy($this->im, $newim, 0, 0, 0, 0, $this->image_width, $this->image_height); + } + + /** + * Draw arced lines over the text + * + * @access private + * + */ + function arcLines() + { + $colors = explode(',', $this->arc_line_colors); + imagesetthickness($this->im, 3); + + $color = $colors[rand(0, sizeof($colors) - 1)]; + $linecolor = imagecolorallocate($this->im, hexdec(substr($color, 1, 2)), hexdec(substr($color, 3, 2)), hexdec(substr($color, 5, 2))); + + $xpos = $this->text_x_start + ($this->font_size * 2) + rand(-5, 5); + $width = $this->image_width / 2.66 + rand(3, 10); + $height = $this->font_size * 2.14 - rand(3, 10); + + if ( rand(0,100) % 2 == 0 ) { + $start = rand(0,66); + $ypos = $this->image_height / 2 - rand(5, 15); + $xpos += rand(5, 15); + } else { + $start = rand(180, 246); + $ypos = $this->image_height / 2 + rand(5, 15); + } + + $end = $start + rand(75, 110); + + imagearc($this->im, $xpos, $ypos, $width, $height, $start, $end, $linecolor); + + $color = $colors[rand(0, sizeof($colors) - 1)]; + $linecolor = imagecolorallocate($this->im, hexdec(substr($color, 1, 2)), hexdec(substr($color, 3, 2)), hexdec(substr($color, 5, 2))); + + if ( rand(1,75) % 2 == 0 ) { + $start = rand(45, 111); + $ypos = $this->image_height / 2 - rand(5, 15); + $xpos += rand(5, 15); + } else { + $start = rand(200, 250); + $ypos = $this->image_height / 2 + rand(5, 15); + } + + $end = $start + rand(75, 100); + + imagearc($this->im, $this->image_width * .75, $ypos, $width, $height, $start, $end, $linecolor); + } + + /** + * Draw lines on the image + * + * @access private + * + */ + function drawLines() + { + $linecolor = imagecolorallocate($this->im, hexdec(substr($this->line_color, 1, 2)), hexdec(substr($this->line_color, 3, 2)), hexdec(substr($this->line_color, 5, 2))); + imagesetthickness($this->im, $this->line_thickness); + + //vertical lines + for($x = 1; $x < $this->image_width; $x += $this->line_distance) { + imageline($this->im, $x, 0, $x, $this->image_height, $linecolor); + } + + //horizontal lines + for($y = 11; $y < $this->image_height; $y += $this->line_distance) { + imageline($this->im, 0, $y, $this->image_width, $y, $linecolor); + } + + if ($this->draw_angled_lines == true) { + for ($x = -($this->image_height); $x < $this->image_width; $x += $this->line_distance) { + imageline($this->im, $x, 0, $x + $this->image_height, $this->image_height, $linecolor); + } + + for ($x = $this->image_width + $this->image_height; $x > 0; $x -= $this->line_distance) { + imageline($this->im, $x, 0, $x - $this->image_height, $this->image_height, $linecolor); + } + } + } + + /** + * Draw the CAPTCHA code over the image + * + * @access private + * + */ + function drawWord() + { + if ($this->use_gd_font == true) { + if (!is_int($this->gd_font_file)) { //is a file name + $font = @imageloadfont($this->gd_font_file); + if ($font == false) { + trigger_error("Failed to load GD Font file {$this->gd_font_file} ", E_USER_WARNING); + return; + } + } else { //gd font identifier + $font = $this->gd_font_file; + } + + $color = imagecolorallocate($this->im, hexdec(substr($this->text_color, 1, 2)), hexdec(substr($this->text_color, 3, 2)), hexdec(substr($this->text_color, 5, 2))); + imagestring($this->im, $font, $this->text_x_start, ($this->image_height / 2) - ($this->gd_font_size / 2), $this->code, $color); + + } else { //ttf font + if($this->use_transparent_text == true) { + $alpha = intval($this->text_transparency_percentage / 100 * 127); + $font_color = imagecolorallocatealpha($this->im, hexdec(substr($this->text_color, 1, 2)), hexdec(substr($this->text_color, 3, 2)), hexdec(substr($this->text_color, 5, 2)), $alpha); + } else { //no transparency + $font_color = imagecolorallocate($this->im, hexdec(substr($this->text_color, 1, 2)), hexdec(substr($this->text_color, 3, 2)), hexdec(substr($this->text_color, 5, 2))); + } + + $x = $this->text_x_start; + $strlen = strlen($this->code); + $y_min = ($this->image_height / 2) + ($this->font_size / 2) - 2; + $y_max = ($this->image_height / 2) + ($this->font_size / 2) + 2; + $colors = explode(',', $this->multi_text_color); + + for($i = 0; $i < $strlen; ++$i) { + $angle = rand($this->text_angle_minimum, $this->text_angle_maximum); + $y = rand($y_min, $y_max); + if ($this->use_multi_text == true) { + $idx = rand(0, sizeof($colors) - 1); + $r = substr($colors[$idx], 1, 2); + $g = substr($colors[$idx], 3, 2); + $b = substr($colors[$idx], 5, 2); + if($this->use_transparent_text == true) { + $font_color = imagecolorallocatealpha($this->im, "0x$r", "0x$g", "0x$b", $alpha); + } else { + $font_color = imagecolorallocate($this->im, "0x$r", "0x$g", "0x$b"); + } + } + imagettftext($this->im, $this->font_size, $angle, $x, $y, $font_color, $this->ttf_file, $this->code{$i}); + + $x += rand($this->text_minimum_distance, $this->text_maximum_distance); + } //for loop + } //else ttf font + } //function + + /** + * Create a code and save to the session + * + * @since 1.0.1 + * + */ + function createCode() + { + $this->code = false; + + if ($this->use_wordlist && is_readable($this->wordlist_file)) { + $this->code = $this->readCodeFromFile(); + } + + if ($this->code == false) { + $this->code = $this->generateCode($this->code_length); + } + + $this->saveData(); + } + + /** + * Generate a code + * + * @access private + * @param int $len The code length + * @return string + */ + function generateCode($len) + { + $code = ''; + + for($i = 1, $cslen = strlen($this->charset); $i <= $len; ++$i) { + $code .= strtoupper( $this->charset{rand(0, $cslen - 1)} ); + } + return $code; + } + + /** + * Reads a word list file to get a code + * + * @access private + * @since 1.0.2 + * @return mixed false on failure, a word on success + */ + function readCodeFromFile() + { + $fp = @fopen($this->wordlist_file, 'rb'); + if (!$fp) return false; + + $fsize = filesize($this->wordlist_file); + if ($fsize < 32) return false; // too small of a list to be effective + + if ($fsize < 128) { + $max = $fsize; // still pretty small but changes the range of seeking + } else { + $max = 128; + } + + fseek($fp, rand(0, $fsize - $max), SEEK_SET); + $data = fread($fp, 128); // read a random 128 bytes from file + fclose($fp); + $data = preg_replace("/\r?\n/", "\n", $data); + + $start = strpos($data, "\n", rand(0, 100)) + 1; // random start position + $end = strpos($data, "\n", $start); // find end of word + + return strtolower(substr($data, $start, $end - $start)); // return substring in 128 bytes + } + + /** + * Output image to the browser + * + * @access private + * + */ + function output() + { + header("Expires: Sun, 1 Jan 2000 12: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"); + + switch($this->image_type) + { + case SI_IMAGE_JPEG: + header("Content-Type: image/jpeg"); + imagejpeg($this->im, null, 90); + break; + + case SI_IMAGE_GIF: + header("Content-Type: image/gif"); + imagegif($this->im); + break; + + default: + header("Content-Type: image/png"); + imagepng($this->im); + break; + } + + imagedestroy($this->im); + } + + /** + * Get WAV file data of the spoken code.
    + * This is appropriate for output to the browser as audio/x-wav + * + * @since 1.0.1 + * @return string WAV data + * + */ + function getAudibleCode() + { + $letters = array(); + $code = $this->getCode(); + + if ($code == '') { + $this->createCode(); + $code = $this->getCode(); + } + + for($i = 0; $i < strlen($code); ++$i) { + $letters[] = $code{$i}; + } + + return $this->generateWAV($letters); + } + + /** + * Save the code in the session + * + * @access private + * + */ + function saveData() + { + $_SESSION['securimage_code_value'] = strtolower($this->code); + } + + /** + * Validate the code to the user code + * + * @access private + * + */ + function validate() + { + if ( isset($_SESSION['securimage_code_value']) && !empty($_SESSION['securimage_code_value']) ) { + if ( $_SESSION['securimage_code_value'] == strtolower(trim($this->code_entered)) ) { + $this->correct_code = true; + $_SESSION['securimage_code_value'] = ''; + } else { + $this->correct_code = false; + } + } else { + $this->correct_code = false; + } + } + + /** + * Get the captcha code + * + * @since 1.0.1 + * @return string + */ + function getCode() + { + if (isset($_SESSION['securimage_code_value']) && !empty($_SESSION['securimage_code_value'])) { + return $_SESSION['securimage_code_value']; + } else { + return ''; + } + } + + /** + * Check if the user entered code was correct + * + * @access private + * @return boolean + */ + function checkCode() + { + return $this->correct_code; + } + + /** + * Generate a wav file by concatenating individual files + * @since 1.0.1 + * @access private + * @param array $letters Array of letters to build a file from + * @return string WAV file data + */ + function generateWAV($letters) + { + $first = true; // use first file to write the header... + $data_len = 0; + $files = array(); + $out_data = ''; + + foreach ($letters as $letter) { + $filename = $this->audio_path . strtoupper($letter) . '.wav'; + + $fp = fopen($filename, 'rb'); + + $file = array(); + + $data = fread($fp, filesize($filename)); // read file in + + $header = substr($data, 0, 36); + $body = substr($data, 44); + + + $data = unpack('NChunkID/VChunkSize/NFormat/NSubChunk1ID/VSubChunk1Size/vAudioFormat/vNumChannels/VSampleRate/VByteRate/vBlockAlign/vBitsPerSample', $header); + + $file['sub_chunk1_id'] = $data['SubChunk1ID']; + $file['bits_per_sample'] = $data['BitsPerSample']; + $file['channels'] = $data['NumChannels']; + $file['format'] = $data['AudioFormat']; + $file['sample_rate'] = $data['SampleRate']; + $file['size'] = $data['ChunkSize'] + 8; + $file['data'] = $body; + + if ( ($p = strpos($file['data'], 'LIST')) !== false) { + // If the LIST data is not at the end of the file, this will probably break your sound file + $info = substr($file['data'], $p + 4, 8); + $data = unpack('Vlength/Vjunk', $info); + $file['data'] = substr($file['data'], 0, $p); + $file['size'] = $file['size'] - (strlen($file['data']) - $p); + } + + $files[] = $file; + $data = null; + $header = null; + $body = null; + + $data_len += strlen($file['data']); + + fclose($fp); + } + + $out_data = ''; + for($i = 0; $i < sizeof($files); ++$i) { + if ($i == 0) { // output header + $out_data .= pack('C4VC8', ord('R'), ord('I'), ord('F'), ord('F'), $data_len + 36, ord('W'), ord('A'), ord('V'), ord('E'), ord('f'), ord('m'), ord('t'), ord(' ')); + + $out_data .= pack('VvvVVvv', + 16, + $files[$i]['format'], + $files[$i]['channels'], + $files[$i]['sample_rate'], + $files[$i]['sample_rate'] * (($files[$i]['bits_per_sample'] * $files[$i]['channels']) / 8), + ($files[$i]['bits_per_sample'] * $files[$i]['channels']) / 8, + $files[$i]['bits_per_sample'] ); + + $out_data .= pack('C4', ord('d'), ord('a'), ord('t'), ord('a')); + + $out_data .= pack('V', $data_len); + } + + $out_data .= $files[$i]['data']; + } + + return $out_data; + } +} /* class Securimage */ + +?> diff --git a/components/com_contactdirectory/includes/securimage/securimage_example.php b/components/com_contactdirectory/includes/securimage/securimage_example.php new file mode 100644 index 0000000000000..4bc656ae70c19 --- /dev/null +++ b/components/com_contactdirectory/includes/securimage/securimage_example.php @@ -0,0 +1,6 @@ +Out of the box example of Securimage CAPTCHA Class.

    + + +
    (Audio)

    + +Reload Image diff --git a/components/com_contactdirectory/includes/securimage/securimage_play.php b/components/com_contactdirectory/includes/securimage/securimage_play.php new file mode 100644 index 0000000000000..c507da6590cfa --- /dev/null +++ b/components/com_contactdirectory/includes/securimage/securimage_play.php @@ -0,0 +1,16 @@ +getAudibleCode(); +exit; + +?> \ No newline at end of file diff --git a/components/com_contactdirectory/includes/securimage/securimage_show.php b/components/com_contactdirectory/includes/securimage/securimage_show.php new file mode 100644 index 0000000000000..40b62d9dc1900 --- /dev/null +++ b/components/com_contactdirectory/includes/securimage/securimage_show.php @@ -0,0 +1,9 @@ +show(); // alternate use: $img->show('/path/to/background.jpg'); + +?> diff --git a/components/com_contactdirectory/index.html b/components/com_contactdirectory/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_contactdirectory/metadata.xml b/components/com_contactdirectory/metadata.xml new file mode 100755 index 0000000000000..79517a1e99d2b --- /dev/null +++ b/components/com_contactdirectory/metadata.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/components/com_contactdirectory/models/categories.php b/components/com_contactdirectory/models/categories.php new file mode 100755 index 0000000000000..c0cc9d46a6a04 --- /dev/null +++ b/components/com_contactdirectory/models/categories.php @@ -0,0 +1,269 @@ +setState('limit', $mainframe->getUserStateFromRequest('com_contactdirectory.limit', 'limit', $config->getValue('config.list_limit'), 'int')); + $this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int')); + + // In case limit has been changed, adjust limitstart accordingly + $this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0)); + } + + /** + * Method to get contact item data for the categories + * + * @access public + * @return array + */ + function getData($groupby_cat) + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery($groupby_cat); + $rows = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + + if($rows != null){ + foreach($rows as $row) { + $row->slug = $row->id.':'.$row->alias; + } + } + $this->_data = $rows; + } + return $this->_data; + } + + function getFields($groupby_cat) + { + if(!$this->_fields){ + $this->getData($groupby_cat); + for($i=0; $i_data); $i++) { + $id = $this->_data[$i]->id; + $query = " SELECT f.id, f.title, d.data, f.pos, f.type, d.show_directory AS show_field, f.params, f.access " + ." FROM #__contactdirectory_fields f " + ." LEFT JOIN #__contactdirectory_details d ON d.field_id = f.id " + ." WHERE f.published = 1 AND d.contact_id = $id" + ." ORDER BY f.pos, f.ordering "; + $this->_db->setQuery($query); + $this->_fields[] = $this->_db->loadObjectList(); + } + } + return $this->_fields; + } + + /** + * Method to load category data if it doesn't exist. + * + * @access private + * @return boolean True on success + */ + function getCategories() + { + global $mainframe; + + if (empty($this->_categories)) + { + // Get the page/component configuration + $params = &$mainframe->getParams(); + + $orderby_params = $params->def('orderby_cat', 'order'); + switch ($orderby_params) { + case 'alpha' : + $orderby = ' ORDER BY title '; + break; + case 'ralpha' : + $orderby = ' ORDER BY title DESC '; + break; + case 'order' : + $orderby = ' ORDER BY ordering'; + break; + default : + $orderby = ''; + break; + } + + // Lets get the information for the current category + $query = "SELECT *, " + ." CASE WHEN CHAR_LENGTH(alias) " + ." THEN CONCAT_WS(':', id, alias) ELSE id END AS catslug " + ." FROM #__categories" + ." WHERE section = 'com_contactdirectory'" + ." AND published = 1" + .$orderby; + $this->_db->setQuery($query); + $this->_categories = $this->_db->loadObjectList(); + } + return $this->_categories; + } + + /** + * Method to get the total number of contact items for the categories + * + * @access public + * @return integer + */ + function getTotal($groupby_cat) + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery($groupby_cat); + $this->_total = $this->_getListCount($query); + } + return $this->_total; + } + + function getPagination($groupby_cat) + { + // Load the content if it doesn't already exist + if (empty($this->_pagination)) { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination($this->getTotal($groupby_cat), $this->getState('limitstart'), $this->getState('limit') ); + } + return $this->_pagination; + } + + function _buildQuery($groupby_cat) + { + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy($groupby_cat); + + // if the Group By Category parameter is selected, all contacts are returned (even multiples) + // if not only the distinct contacts are returned + if($groupby_cat){ + $query = ' SELECT c.*, cat.title AS category, ' + . ' CASE WHEN CHAR_LENGTH(cat.alias) ' + . ' THEN CONCAT_WS(\':\', cat.id, cat.alias) ELSE cat.id END AS catslug ' + . ' FROM #__contactdirectory_contacts AS c ' + . ' LEFT JOIN #__contactdirectory_con_cat_map AS map ON map.contact_id = c.id ' + . ' LEFT JOIN #__categories AS cat ON cat.id = map.category_id '. + $where. + $orderby; + }else{ + $query =' SELECT DISTINCT c.* ' + . ' FROM #__contactdirectory_contacts AS c ' + . ' LEFT JOIN #__contactdirectory_con_cat_map AS map ON map.contact_id = c.id ' + . ' LEFT JOIN #__categories AS cat ON cat.id = map.category_id '. + $where. + $orderby; + + } + return $query; + } + + + function _buildContentOrderBy($groupby_cat) + { + global $mainframe; + // Get the page/component configuration + $params = &$mainframe->getParams(); + + $orderby = ' ORDER BY '; + + if($groupby_cat){ + $orderby .= ' cat.title, '; + } + + $orderby_params = $params->def('orderby', 'order'); + switch ($orderby_params) { + case 'alpha' : + $orderby .= ' c.name '; + break; + case 'ralpha' : + $orderby .= ' c.name DESC '; + break; + case 'order' : + $orderby .= ' map.ordering'; + break; + } + return $orderby; + } + + function _buildContentWhere() + { + global $mainframe, $option; + + $user =& JFactory::getUser(); + $gid = $user->get('aid', 0); + $db =& JFactory::getDBO(); + + $alphabet = $mainframe->getUserStateFromRequest( $option.'alphabet', 'alphabet', '', 'string' ); + $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + // Get the page/component configuration + $params = &$mainframe->getParams(); + + $where = ' WHERE 1'; + + // Does the user have access to view the items? + $where .= ' AND c.access <= '.(int) $gid; + + // The category and the contact are published + $where .= ' AND c.published = 1 AND cat.published = 1'; + + /* + * If we have a filter, and this is enabled... lets tack the AND clause + * for the filter onto the WHERE clause of the contact item query. + */ + if ($params->get('search')) { + if ($search) { + // clean filter variable + $search = JString::strtolower($search); + $search = $this->_db->Quote( '%'.$this->_db->getEscaped( $search, true ).'%', false ); + + $where .= ' AND LOWER( c.name ) LIKE '.$search; + } + } + if ($params->get('alphabet')) { + if ($alphabet) { + // clean filter variable + $alphabet = JString::strtolower($alphabet); + $alphabet = $this->_db->Quote( $this->_db->getEscaped( $alphabet, true ).'%', false ); + + $where .= ' AND LOWER( c.name ) LIKE '.$alphabet; + } + } + return $where; + } +} diff --git a/components/com_contactdirectory/models/category.php b/components/com_contactdirectory/models/category.php new file mode 100755 index 0000000000000..82a43784f1cff --- /dev/null +++ b/components/com_contactdirectory/models/category.php @@ -0,0 +1,309 @@ +setState('limit', $mainframe->getUserStateFromRequest('com_contactdirectory.limit', 'limit', $config->getValue('config.list_limit'), 'int')); + $this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int')); + + // In case limit has been changed, adjust limitstart accordingly + $this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0)); + + $this->_id = JRequest::getVar('catid', 0, '', 'int'); + } + + /** + * Method to get contact item data for the current category + * + * @param int $state The content state to pull from for the current + * category + * @since 1.5 + */ + function getData() + { + // Load the Category data + if ($this->_loadCategory() && $this->_loadData()) + { + // Initialize some variables + $user =& JFactory::getUser(); + + // Make sure the category is published + if (!$this->_category->published) + { + JError::raiseError(404, JText::_('RESOURCE NOT FOUND')); + return false; + } + + // check whether category access level allows access + if ($this->_category->access > $user->get('aid', 0)) + { + JError::raiseError(403, JText::_('ALERTNOTAUTH')); + return false; + } + } + return $this->_data; + } + + function getFields() + { + if(!$this->_fields){ + $this->getData(); + for($i=0; $i_data); $i++) { + $id = $this->_data[$i]->id; + $query = " SELECT f.id, f.title, d.data, f.pos, f.type, d.show_directory AS show_field, f.params, f.access " + ." FROM #__contactdirectory_fields f " + ." LEFT JOIN #__contactdirectory_details d ON d.field_id = f.id " + ." WHERE f.published = 1 AND d.contact_id = $id" + ." ORDER BY f.pos, f.ordering "; + $this->_db->setQuery($query); + $this->_fields[] = $this->_db->loadObjectList(); + } + } + return $this->_fields; + } + + /** + * Method to get the total number of contact items + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + function getPagination() + { + // Load the content if it doesn't already exist + if (empty($this->_pagination)) { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + return $this->_pagination; + } + + /** + * Method to get category data for the current category + * + * @since 1.5 + */ + function getCategory() + { + // Load the Category data + if ($this->_loadCategory()) + { + // Initialize some variables + $user = &JFactory::getUser(); + + // Make sure the category is published + if (!$this->_category->published) { + JError::raiseError(404, JText::_('RESOURCE NOT FOUND')); + return false; + } + // check whether category access level allows access + if ($this->_category->access > $user->get('aid', 0)) { + JError::raiseError(403, JText::_('ALERTNOTAUTH')); + return false; + } + } + return $this->_category; + } + + /** + * Method to load category data if it doesn't exist. + * + * @access private + * @return boolean True on success + */ + function _loadCategory() + { + if (empty($this->_category)) + { + // Lets get the information for the current category + $query = 'SELECT *, ' + .' CASE WHEN CHAR_LENGTH(alias) ' + .' THEN CONCAT_WS(\':\', id, alias) ELSE id END AS slug ' + .' FROM #__categories WHERE id = '. (int) $this->_id; + $this->_db->setQuery($query); + $this->_category = $this->_db->loadObject(); + } + return true; + } + + /** + * Method to load contact item data for items in the category if they don't + * exist. + * + * @access private + * @return boolean True on success + */ + function _loadData() + { + if (empty($this->_category)) { + return false; + } + + // Lets load the contact data if they don't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $rows = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + + if($rows != null){ + foreach($rows as $row){ + $row->slug = $row->id.':'.$row->alias; + } + } + + $this->_data = $rows; + } + return true; + } + + function _buildQuery() + { + global $mainframe; + // Get the page/component configuration + $params = &$mainframe->getParams(); + + // Get the WHERE and ORDER BY clauses for the query + $where = $this->_buildContentWhere(); + $orderby = $this->_buildContentOrderBy(); + + $query = ' SELECT c.*, cat.title AS category, v.name AS user' + . ' FROM #__contactdirectory_contacts AS c ' + . ' LEFT JOIN #__users AS v ON v.id = c.user_id ' + . ' LEFT JOIN #__contactdirectory_con_cat_map AS map ON map.contact_id = c.id ' + . ' LEFT JOIN #__categories AS cat ON cat.id = map.category_id '. + $where. + $orderby; + + return $query; + } + + + function _buildContentOrderBy() + { + global $mainframe; + // Get the page/component configuration + $params = &$mainframe->getParams(); + + $orderby = ' ORDER BY '; + + $orderby_params = $params->def('orderby', 'order'); + switch ($orderby_params) { + case 'alpha' : + $orderby_params = 'c.name '; + break; + case 'ralpha' : + $orderby_params = 'c.name DESC '; + break; + case 'order' : + $orderby_params = 'map.ordering '; + break; + default : + $orderby_params = ''; + break; + } + $orderby .= $orderby_params; + + return $orderby; + } + + function _buildContentWhere() + { + global $mainframe, $option; + + $user =& JFactory::getUser(); + $gid = $user->get('aid', 0); + $db =& JFactory::getDBO(); + + $alphabet = $mainframe->getUserStateFromRequest( $option.'alphabet', 'alphabet', '', 'string' ); + $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + // Get the page/component configuration + $params = &$mainframe->getParams(); + + $where = ' WHERE 1'; + + // Does the user have access to view the items? + $where .= ' AND c.access <= '.(int) $gid; + + // First thing we need to do is assert that the contacts are in the current category + if ($this->_id) { + $where .= ' AND map.category_id = '.(int) $this->_id; + } + + /* + * If we have a filter, and this is enabled... lets tack the AND clause + * for the filter onto the WHERE clause of the contact item query. + */ + if ($params->get('search')) { + if ($search) { + // clean filter variable + $search = JString::strtolower($search); + $search = $this->_db->Quote( '%'.$this->_db->getEscaped( $search, true ).'%', false ); + + $where .= ' AND LOWER( c.name ) LIKE '.$search; + } + } + if ($params->get('alphabet')) { + if ($alphabet) { + // clean filter variable + $alphabet = JString::strtolower($alphabet); + $alphabet = $this->_db->Quote( $this->_db->getEscaped( $alphabet, true ).'%', false ); + + $where .= ' AND LOWER( c.name ) LIKE '.$alphabet; + } + } + return $where; + } +} diff --git a/components/com_contactdirectory/models/contact.php b/components/com_contactdirectory/models/contact.php new file mode 100755 index 0000000000000..b433794bee57f --- /dev/null +++ b/components/com_contactdirectory/models/contact.php @@ -0,0 +1,350 @@ +_id = JRequest::getVar('id', 0, '', 'int'); + + $this->_formData = new stdClass(); + $this->_formData->name = JRequest::getString('name', '', 'post'); + $this->_formData->email = JRequest::getString('email', '', 'post'); + $this->_formData->subject = JRequest::getString('subject', '', 'post'); + $this->_formData->body = JRequest::getString('body', '', 'post'); + $this->_formData->email_copy = JRequest::getString('email_copy', '', 'post'); + $this->_formData->captcha = JRequest::getString('captcha', '', 'post'); + } + + function &getFormData() + { + return $this->_formData; + } + + /** + * Method to get a contact + * + * @since 1.5 + */ + function &getData($access) + { + // Load the contact data + if ($this->_loadData()) + { + // Initialize some variables + $user = &JFactory::getUser(); + + // Make sure the contact is published + if (!$this->_data->published) { + JError::raiseError(404, JText::_('RESOURCE NOT FOUND')); + return false; + } + + // Check to see if at least one of the categories is published + $this->getCategories(); + $found = false; + foreach ($this->_categories as $category) { + if($category->published == 1){ + $found = true; + } + } + if (!$found) { + JError::raiseError( 404, JText::_('RESOURCE NOT FOUND') ); + return false; + } + + // Check whether category access level allows access + if ($this->_data->access > $access) { + JError::raiseError( 403, JText::_('ALERTNOTAUTH') ); + return false; + } + } + else $this->_initData(); + + return $this->_data; + } + + function &getFields() + { + if(!$this->_fields){ + $query = " SELECT f.id, f.title, d.data, f.pos, f.type, d.show_contact AS show_field, f.params, f.access " + ." FROM #__contactdirectory_fields f " + ." LEFT JOIN #__contactdirectory_details d ON d.field_id = f.id " + ." WHERE f.published = 1 AND d.contact_id = $this->_id" + ." ORDER BY f.pos, f.ordering "; + $this->_db->setQuery($query); + $this->_fields = $this->_db->loadObjectList(); + } + return $this->_fields; + } + + function &getEmail() + { + if(!$this->_email){ + $query = " SELECT d.data FROM #__contactdirectory_details d " + ." JOIN #__contactdirectory_fields f ON d.field_id = f.id " + ." WHERE f.published = 1 AND d.field_id = 1 AND d.contact_id = $this->_id "; + $this->_db->setQuery($query); + $this->_email = $this->_db->loadResult(); + } + return $this->_email; + } + + function &getCategories() + { + if(!$this->_categories){ + $query = " SELECT c.title, c.published, map.category_id AS id, map.ordering " + ." FROM jos_categories c " + ." LEFT JOIN jos_contactdirectory_con_cat_map map ON map.category_id = c.id " + ." WHERE map.contact_id = '$this->_id' "; + $this->_db->setQuery($query); + $this->_categories = $this->_db->loadObjectList(); + } + return $this->_categories; + } + + /** + * Method to load content contact data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _loadData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = 'SELECT * FROM #__contactdirectory_contacts WHERE id = '.(int) $this->_id; + $this->_db->setQuery($query); + $this->_data = $this->_db->loadObject(); + return (boolean) $this->_data; + } + return true; + } + + /** + * Method to initialise the contact data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _initData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $contact = new stdClass(); + $contact->id = 0; + $contact->name = null; + $contact->alias = null; + $contact->published = 0; + $contact->checked_out = 0; + $contact->checked_out_time = 0; + $contact->params = null; + $contact->user_id = 0; + $contact->access = 0; + $this->_data = $contact; + return (boolean) $this->_data; + } + return true; + } + + function mailTo($access) { + global $mainframe; + + $pparams =& $mainframe->getParams('com_contactsdirectory'); + $SiteName = $mainframe->getCfg('sitename'); + $default = JText::sprintf( 'MAILENQUIRY', $SiteName ); + + $subject = $this->_formData->subject; + if(!$subject) { $subject = $default; } + + $contact =& $this->getData($access); + $email_to =& $this->getEmail(); + + $cparams = new JParameter($contact->params); + + if($email_to == '' && $contact->user_id != 0){ + $contact_user = JUser::getInstance($contact->user_id); + $email_to = $contact_user->get('email'); + } + + jimport('joomla.mail.helper'); + if (!$this->_formData->email || !$this->_formData->body || (JMailHelper::isEmailAddress($this->_formData->email) == false)) + { + $this->setError(JText::_('CONTACT_FORM_NC')); + return false; + } + + JPluginHelper::importPlugin( 'contact' ); + $dispatcher =& JDispatcher::getInstance(); + + if (!$this->_validateInputs( $contact, $this->_formData->email, $this->_formData->subject, $this->_formData->body, $this->_formData->captcha ) ) { + return false; + } + + $post = JRequest::get( 'post' ); + $results = $dispatcher->trigger( 'onValidateContact', array( &$contact, &$post ) ); + + foreach ($results as $result) + { + if (JError::isError( $result )) { + return false; + } + } + + $results = $dispatcher->trigger( 'onSubmitContact', array( &$contact, &$post ) ); + + if (!$pparams->get('custom_reply')) { + $MailFrom = $mainframe->getCfg('mailfrom'); + $FromName = $mainframe->getCfg('fromname'); + + $prefix = JText::sprintf('ENQUIRY_TEXT', JURI::base()); + $body = $prefix."\n".$this->_formData->name.' <'.$this->_formData->email.'>'."\r\n\r\n".stripslashes($this->_formData->body); + + $mail = JFactory::getMailer(); + + $mail->addRecipient($email_to); + $mail->setSender(array( $this->_formData->email, $this->_formData->name)); + $mail->setSubject($FromName.': '. $subject); + $mail->setBody($body); + + $sent = $mail->Send(); + + $params = new JParameter($contact->params); + $emailcopyCheck = $params->get( 'show_email_copy', 0 ); + + if ( $this->_formData->email_copy && $emailcopyCheck ) + { + $copyText = JText::sprintf('COPYOF', $contact->name, $SiteName); + $copyText .= "\r\n\r\n".$body; + $copySubject = JText::_('COPYOF')." ".$subject; + + $mail = JFactory::getMailer(); + + $mail->addRecipient( $this->_formData->email ); + $mail->setSender( array( $MailFrom, $FromName ) ); + $mail->setSubject( $copySubject ); + $mail->setBody( $copyText ); + + $sent = $mail->Send(); + } + } + return true; + } + + function _validateInputs( $contact, $email, $subject, $body, $captcha ) { + global $mainframe; + + $session =& JFactory::getSession(); + + $params = new JParameter($contact->params); + $pparams = &$mainframe->getParams('com_contactdirectory'); + + $sessionCheck = $pparams->get( 'validate_session', 1 ); + $sessionName = $session->getName(); + if ( $sessionCheck ) { + if ( !isset($_COOKIE[$sessionName]) ) { + $this->setError( JText::_('ALERTNOTAUTH') ); + return false; + } + } + + $configEmail = $pparams->get( 'banned_email', '' ); + $paramsEmail = $params->get( 'banned_mail', '' ); + $bannedEmail = $configEmail . ($paramsEmail ? ';'.$paramsEmail : ''); + + if ( $bannedEmail ) { + $bannedEmail = explode( ';', $bannedEmail ); + foreach ($bannedEmail as $value) { + if ( JString::stristr($email, $value) ) { + $this->setError( JText::sprintf('MESGHASBANNEDTEXT.', 'email') ); + return false; + } + } + } + + $configSubject = $pparams->get( 'banned_subject', '' ); + $paramsSubject = $params->get( 'banned_subject', '' ); + $bannedSubject = $configSubject . ( $paramsSubject ? ';'.$paramsSubject : ''); + + if ( $bannedSubject ) { + $bannedSubject = explode( ';', $bannedSubject ); + foreach ($bannedSubject as $value) { + if ( $value && JString::stristr($subject, $value) ) { + $this->setError( JText::sprintf('MESGHASBANNEDTEXT', 'subject') ); + return false; + } + } + } + + $configText = $pparams->get( 'banned_text', '' ); + $paramsText = $params->get( 'banned_text', '' ); + $bannedText = $configText . ( $paramsText ? ';'.$paramsText : '' ); + + if ( $bannedText ) { + $bannedText = explode( ';', $bannedText ); + foreach ($bannedText as $value) { + if ( $value && JString::stristr($body, $value) ) { + $this->setError( JText::sprintf('MESGHASBANNEDTEXT', 'message') ); + return false; + } + } + } + + $check = explode( '@', $email ); + if ( strpos( $email, ';' ) || strpos( $email, ',' ) || strpos( $email, ' ' ) || count( $check ) > 2 ) { + $this->setError( JText::_( 'YOU CANNOT ENTER MORE THAN ONE EMAIL ADDRESS', true ) ); + return false; + } + $sc = $params->get('show_captcha'); + if($sc == '') { + $sc = $pparams->get('show_captcha'); + } + if($sc) { + require_once JPATH_COMPONENT . DS . 'includes' . DS . 'securimage' . DS . 'securimage.php'; + $img = new securimage(); + if($captcha == '' || $img->check($captcha) == false) { + $this->setError( JText::_( 'WRONGCODE', true ) ); + return false; + } + } + return true; + } +} diff --git a/components/com_contactdirectory/models/index.html b/components/com_contactdirectory/models/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/models/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_contactdirectory/router.php b/components/com_contactdirectory/router.php new file mode 100755 index 0000000000000..9286e0d9baeaf --- /dev/null +++ b/components/com_contactdirectory/router.php @@ -0,0 +1,306 @@ +getItems('componentid', $component->id); + } + + // Search for an appropriate menu item. + if (is_array($items)) + { + // If only the option and itemid are specified in the query, return that item. + if (!isset($query['view']) && !isset($query['id']) && !isset($query['catid']) && isset($query['Itemid'])) { + $itemid = (int) $query['Itemid']; + } + + // Search for a specific link based on the critera given. + if (!$itemid) + { + foreach ($items as $item) + { + // Check if this menu item links to this view. + if (isset($item->query['view']) && $item->query['view'] == 'contact' + && isset($query['view']) && $query['view'] == 'contact' + && isset($item->query['id']) && $item->query['id'] == $query['id']) + { + $itemid = $item->id; + } + elseif (isset($item->query['view']) && $item->query['view'] == 'category' + && isset($query['view']) && $query['view'] == 'category' + && isset($item->query['id']) && $item->query['id'] == $query['catid']) + { + $itemid = $item->id; + } + } + } + + // If no specific link has been found, search for a general one. + if (!$itemid) + { + foreach ($items as $item) + { + //echo $item->query['view'].'
    '; + if (isset($query['view']) && $query['view'] == 'contact' + && isset($item->query['view']) && $item->query['view'] == 'category' + && isset($item->query['id']) && isset($query['catid']) + && $query['catid'] == $item->query['id']) + { + // This menu item links to the contact view but we need to append the contact id to it. + $itemid = $item->id; + $segments[] = isset($query['catalias']) ? $query['catid'].':'.$query['catalias'] : $query['catid']; + $segments[] = isset($query['alias']) ? $query['id'].':'.$query['alias'] : $query['id']; + break; + } + elseif (isset($query['view']) && $query['view'] == 'category' + && isset($item->query['view']) && $item->query['view'] == 'category' + && isset($item->query['id']) && isset($query['id']) && $item->query['id'] != $query['id']) + { + // This menu item links to the category view but we need to append the category id to it. + $itemid = $item->id; + $segments[] = isset($query['alias']) ? $query['id'].':'.$query['alias'] : $query['id']; + break; + } + } + } + + // Search for an even more general link. + if (!$itemid) + { + foreach ($items as $item) + { + if (isset($query['view']) && $query['view'] == 'contact' + && isset($item->query['view']) && $item->query['view'] == 'categories' + && isset($query['catid']) && isset($query['id'])) + { + // This menu item links to the categories view but we need to append the category and contact id to it. + $itemid = $item->id; + $segments[] = isset($query['catalias']) ? $query['catid'].':'.$query['catalias'] : $query['catid']; + $segments[] = isset($query['alias']) ? $query['id'].':'.$query['alias'] : $query['id']; + break; + } + elseif (isset($query['view']) && $query['view'] == 'category' + && isset($item->query['view']) && $item->query['view'] == 'categories' + && isset($query['catid'])) + { + // This menu item links to the categories view but we need to append the category id to it. + $itemid = $item->id; + $segments[] = isset($query['catalias']) ? $query['catid'].':'.$query['catalias'] : $query['catid']; + break; + } + } + } + } + + // Check if the router found an appropriate itemid. + if (!$itemid) + { + // Check if a category was specified + if (isset($query['view']) && $query['view'] == 'category' && isset($query['catid'])) + { + if (isset($query['catalias'])) { + $query['catid'] .= ':'.$query['catalias']; + } + + // Push the catid onto the stack. + $segments[] = $query['catid']; + + unset($query['view']); + unset($query['catid']); + unset($query['catalias']); + } + // Check if a id was specified. + elseif (isset($query['id'])) + { + if (isset($query['catalias'])) { + $query['catid'] .= ':'.$query['catalias']; + } + + // Push the catid onto the stack. + $segments[] = $query['catid']; + + if (isset($query['alias'])) { + $query['id'] .= ':'.$query['alias']; + } + + // Push the id onto the stack. + $segments[] = $query['id']; + unset($query['view']); + unset($query['id']); + unset($query['alias']); + unset($query['catid']); + unset($query['catalias']); + } + elseif (isset($query['catid'])) + { + if (isset($query['alias'])) { + $query['catid'] .= ':'.$query['catalias']; + } + + // Push the catid onto the stack. + $segments[] = 'category'; + $segments[] = $query['catid']; + unset($query['view']); + unset($query['catid']); + unset($query['catalias']); + unset($query['alias']); + }else{ + // Categories view. + unset($query['view']); + } + }else { + $query['Itemid'] = $itemid; + + // Remove the unnecessary URL segments. + unset($query['view']); + unset($query['id']); + unset($query['alias']); + unset($query['catid']); + unset($query['catalias']); + } + return $segments; +} + +function ContactdirectoryParseRoute($segments) +{ + $vars = array(); + + // Get the active menu item. + $menu = &JSite::getMenu(); + $item = &$menu->getActive(); + + // Check if we have a valid menu item. + if (is_object($item)) + { + // Proceed through the possible variations trying to match the most specific one. + if (isset($item->query['view']) && $item->query['view'] == 'contact' && isset($segments[0])) + { + // Break up the contact id into numeric and alias values. + if (isset($segments[0]) && strpos($segments[0], ':')) { + list($id, $alias) = explode(':', $segments[0], 2); + } + + // Contact view. + $vars['view'] = 'contact'; + $vars['id'] = $id; + } + elseif (isset($item->query['view']) && $item->query['view'] == 'category' && count($segments) == 2) + { + // Break up the category id into numeric and alias values. + if (isset($segments[0]) && strpos($segments[0], ':')) { + list($catid, $catalias) = explode(':', $segments[0], 2); + } + + // Break up the contact id into numeric and alias values. + if (isset($segments[1]) && strpos($segments[1], ':')) { + list($id, $alias) = explode(':', $segments[1], 2); + } + + // Contact view. + $vars['view'] = 'contact'; + $vars['id'] = $id; + $vars['catid'] = $catid; + } + elseif (isset($item->query['view']) && $item->query['view'] == 'category' && isset($segments[0])) + { + // Break up the category id into numeric and alias values. + if (isset($segments[0]) && strpos($segments[0], ':')) { + list($catid, $catalias) = explode(':', $segments[0], 2); + } + + // Category view. + $vars['view'] = 'category'; + $vars['catid'] = $catid; + } + elseif (isset($item->query['view']) && $item->query['view'] == 'categories' && count($segments) == 2) + { + // Break up the category id into numeric and alias values. + if (isset($segments[0]) && strpos($segments[0], ':')) { + list($catid, $catalias) = explode(':', $segments[0], 2); + } + + // Break up the contact id into numeric and alias values. + if (isset($segments[1]) && strpos($segments[1], ':')) { + list($id, $alias) = explode(':', $segments[1], 2); + } + + // Contact view. + $vars['view'] = 'contact'; + $vars['id'] = $id; + $vars['catid'] = $catid; + } + elseif (isset($item->query['view']) && $item->query['view'] == 'categories' && isset($segments[0])) + { + // Break up the category id into numeric and alias values. + if (isset($segments[0]) && strpos($segments[0], ':')) { + list($catid, $catalias) = explode(':', $segments[0], 2); + } + + // Category view. + $vars['view'] = 'category'; + $vars['catid'] = $catid; + } + elseif (isset($item->query['view']) && $item->query['view'] == 'categories') + { + // Categories view. + $vars['view'] = 'categories'; + } + } + else + { + // Count route segments + $count = count($segments); + + // Check if there are any route segments to handle. + if ($count) + { + if ($count == 2) + { + // We are viewing a contact. + $vars['view'] = 'contact'; + $vars['catid'] = $segments[$count-2]; + $vars['id'] = $segments[$count-1]; + } + elseif($count == 1) + { + // We are viewing a category. + $vars['view'] = 'category'; + $vars['catid'] = $segments[$count-1]; + } + else + { + // We are viewing categories. + $vars['view'] = 'categories'; + } + } + } + return $vars; +} diff --git a/components/com_contactdirectory/views/categories/index.html b/components/com_contactdirectory/views/categories/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/views/categories/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_contactdirectory/views/categories/metadata.xml b/components/com_contactdirectory/views/categories/metadata.xml new file mode 100755 index 0000000000000..46ab2b092cc49 --- /dev/null +++ b/components/com_contactdirectory/views/categories/metadata.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/components/com_contactdirectory/views/categories/tmpl/default.php b/components/com_contactdirectory/views/categories/tmpl/default.php new file mode 100755 index 0000000000000..2de6e89b8789c --- /dev/null +++ b/components/com_contactdirectory/views/categories/tmpl/default.php @@ -0,0 +1,99 @@ + + + + +params->get( 'show_page_title' ) ) : ?> +

    + escape($this->params->get('page_title'));?> +
    + + +
    + params->get('image') || $this->params->get('description')) : ?> +
    + params->get('show_image')) : ?> + <?php echo JText::_( 'DECRIPTION_IMG' ); ?> + params->get('show_description')) : + echo $this->params->get('description'); + endif; ?> +
    + + +
    +
    - +
    + params->get('alphabet') || $this->params->get('search')): ?> + + + + + + + + + + + + + + + + params->get('groupby_cat')) echo $this->loadTemplate('list'); ?> + params->get('groupby_cat')) echo $this->loadTemplate('groupby'); ?> + +
    + params->get('alphabet')): ?> + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z | + Reset + + + + params->get('search')): ?> + : + + + + +
    + params->get('show_limit')) : + echo JText::_('DISPLAY #') .' '; + echo $this->pagination->getLimitBox(); + endif; ?> + + pagination->getPagesLinks(); ?> + + pagination->getPagesCounter(); ?> +
    + + +
    \ No newline at end of file diff --git a/components/com_contactdirectory/views/categories/tmpl/default.xml b/components/com_contactdirectory/views/categories/tmpl/default.xml new file mode 100755 index 0000000000000..326c37d2f4e01 --- /dev/null +++ b/components/com_contactdirectory/views/categories/tmpl/default.xml @@ -0,0 +1,73 @@ + + + + + + + + + CONTACT_CATEGORIES_LAYOUT + CONTACT_CATEGORIES_LAYOUT_DESCRIPTION + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/com_contactdirectory/views/categories/tmpl/default_groupby.php b/components/com_contactdirectory/views/categories/tmpl/default_groupby.php new file mode 100755 index 0000000000000..77125c4dba871 --- /dev/null +++ b/components/com_contactdirectory/views/categories/tmpl/default_groupby.php @@ -0,0 +1,132 @@ + + +categories as $this->category): ?> + data[$this->category->title]) && count($this->data[$this->category->title]) > 0): ?> + + + params->get('linkcat')): ?> + category->title; ?> + category->title; ?> + + + + + + data[$this->category->title]) > 0): ?> + data[$this->category->title] as $this->contact): ?> +
    + contact->params->get('show_name') && $this->contact->name) || (isset($this->contact->pos_title) && count($this->contact->pos_title) >= 1)): ?> +
    +
    + params->get('link')): ?> + + contact->name; ?> + + contact->name;?> + +
    + contact->pos_title as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    +
    + + contact->pos_top) && count($this->contact->pos_top) >= 1): ?> + contact->pos_top as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + + + + contact->pos_left) && count($this->contact->pos_left) >= 1) || (isset($this->contact->pos_main) && count($this->contact->pos_main) >= 1) || (isset($this->contact->pos_right) && count($this->contact->pos_right) >= 1)): ?> + + + + contact->pos_left) && count($this->contact->pos_left) >= 1): ?> + + + + + contact->pos_main) && count($this->contact->pos_main) >= 1): ?> + + + + + contact->pos_right) && count($this->contact->pos_right) >= 1): ?> + + + +
    + contact->pos_left as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    + contact->pos_main as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    + contact->pos_right as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    + + + + contact->pos_bottom) && count($this->contact->pos_bottom) >= 1): ?> + contact->pos_bottom as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + + +
    + +
    + + + + + + \ No newline at end of file diff --git a/components/com_contactdirectory/views/categories/tmpl/default_list.php b/components/com_contactdirectory/views/categories/tmpl/default_list.php new file mode 100755 index 0000000000000..b82a071361acf --- /dev/null +++ b/components/com_contactdirectory/views/categories/tmpl/default_list.php @@ -0,0 +1,120 @@ + + + + + data) > 0): ?> + data as $this->contact): ?> +
    + contact->params->get('show_name') && $this->contact->name) || (isset($this->contact->pos_title) && count($this->contact->pos_title) >= 1)): ?> +
    +
    + params->get('link')): ?> + + contact->name; ?> + + contact->name;?> + +
    + contact->pos_title as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    +
    + + contact->pos_top) && count($this->contact->pos_top) >= 1): ?> + contact->pos_top as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + + + + contact->pos_left) && count($this->contact->pos_left) >= 1) || (isset($this->contact->pos_main) && count($this->contact->pos_main) >= 1) || (isset($this->contact->pos_right) && count($this->contact->pos_right) >= 1)): ?> + + + + contact->pos_left) && count($this->contact->pos_left) >= 1): ?> + + + + + contact->pos_main) && count($this->contact->pos_main) >= 1): ?> + + + + + contact->pos_right) && count($this->contact->pos_right) >= 1): ?> + + + +
    + contact->pos_left as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    + contact->pos_main as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    + contact->pos_right as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    + + + + contact->pos_bottom) && count($this->contact->pos_bottom) >= 1): ?> + contact->pos_bottom as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + + +
    + +
    + + + + \ No newline at end of file diff --git a/components/com_contactdirectory/views/categories/tmpl/index.html b/components/com_contactdirectory/views/categories/tmpl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/views/categories/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_contactdirectory/views/categories/view.html.php b/components/com_contactdirectory/views/categories/view.html.php new file mode 100755 index 0000000000000..ecaacca3a8843 --- /dev/null +++ b/components/com_contactdirectory/views/categories/view.html.php @@ -0,0 +1,176 @@ +getModel(); + $document =& JFactory::getDocument(); + + $pparams = &$mainframe->getParams('com_contactdirectory'); + $cparams =& JComponentHelper::getParams('com_media'); + + $categories = $model->getCategories(); + $contacts = $model->getData($pparams->get('groupby_cat')); + $fields = $model->getFields($pparams->get('groupby_cat')); + + $pagination = $model->getPagination($pparams->get('groupby_cat')); + + $alphabet = $mainframe->getUserStateFromRequest( $option.'alphabet', 'alphabet', '', 'string' ); + $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + // search filter + $lists['search']= $search; + + //add alternate feed link + /*if($pparams->get('show_feed_link', 1) == 1) + { + $link = '&format=feed&limitstart='; + $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); + $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); + $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); + $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); + }*/ + + foreach($categories as $category){ + $category->link = JRoute::_('index.php?option=com_contactdirectory&view=category&catid='.$category->catslug); + } + + for($i=0; $iget('groupby_cat')){ + $contacts[$i]->link = JRoute::_('index.php?option=com_contactdirectory&view=contact&catid='.$contacts[$i]->catslug.'&id='.$contacts[$i]->slug); + }else{ + $contacts[$i]->link = JRoute::_('index.php?option=com_contactdirectory&view=contact&catid=0:all&id='.$contacts[$i]->slug); + } + $contacts[$i]->fields = $fields[$i]; + $contacts[$i]->params = new JParameter($contacts[$i]->params); + + foreach($contacts[$i]->fields as $contacts[$i]->field){ + $contacts[$i]->field->params = new JParameter($contacts[$i]->field->params); + + if($contacts[$i]->field->type == 'image'){ + if($contacts[$i]->field->data){ + if($contacts[$i]->field->pos == 'right'){ + $contacts[$i]->field->data = JHTML::_('image', $cparams->get('image_path') . '/'.$contacts[$i]->field->data, JText::_( 'CONTACT' ), array('align' => 'right')); + }else{ + $contacts[$i]->field->data = JHTML::_('image', $cparams->get('image_path') . '/'.$contacts[$i]->field->data, JText::_( 'CONTACT' ), array('align' => 'left')); + } + } + } + + if($contacts[$i]->field->type == 'textarea'){ + $contacts[$i]->field->data = nl2br($contacts[$i]->field->data); + } + + if($contacts[$i]->field->type == 'url'){ + if(!empty($contacts[$i]->field->data)){ + $contacts[$i]->field->data = ''.$contacts[$i]->field->data.''; + } + } + + // Handle email cloaking + if($contacts[$i]->field->type == 'email' && $contacts[$i]->field->show_field) { + jimport('joomla.mail.helper'); + $contacts[$i]->field->data = trim($contacts[$i]->field->data); + if(!empty($contacts[$i]->field->data) && JMailHelper::isEmailAddress($contacts[$i]->field->data)) { + $contacts[$i]->field->data = JHTML::_('email.cloak', $contacts[$i]->field->data); + }else{ + $contacts[$i]->field->data = ''; + } + } + + // Manage the display mode for the field title + switch ($contacts[$i]->field->params->get('field_title')) + { + case 0 : + // text + $contacts[$i]->field->params->set('marker_title', JText::_($contacts[$i]->field->title).": "); + break; + case 1: + //icon and text + $image = JHTML::_('image.site', 'arrow.png', '/images/M_images/', $contacts[$i]->field->params->get('choose_icon'), '/images/M_images/', JText::_($contacts[$i]->field->title).": "); + $contacts[$i]->field->params->set('marker_title', $image); + break; + case 2 : + // icons + $image = JHTML::_('image.site', 'arrow.png', '/images/M_images/', $contacts[$i]->field->params->get('choose_icon'), '/images/M_images/', JText::_($contacts[$i]->field->title).": "); + $contacts[$i]->field->params->set('marker_title', $image." ".JText::_($contacts[$i]->field->title).": "); + break; + case 3 : + // none + $contacts[$i]->field->params->set('marker_title', ''); + break; + } + + switch ($contacts[$i]->field->pos){ + case 'title': + $contacts[$i]->pos_title[] = $contacts[$i]->field; + break; + case 'top': + $contacts[$i]->pos_top[] = $contacts[$i]->field; + break; + case 'left': + $contacts[$i]->pos_left[] = $contacts[$i]->field; + break; + case 'main': + $contacts[$i]->pos_main[] = $contacts[$i]->field; + break; + case 'right': + $contacts[$i]->pos_right[] = $contacts[$i]->field; + break; + case 'bottom': + $contacts[$i]->pos_bottom[] = $contacts[$i]->field; + break; + } + + if($pparams->get('groupby_cat')){ + $data[$contacts[$i]->category][$i] = $contacts[$i]; + }else{ + $data[$i] = $contacts[$i]; + } + } + } + + $document->setTitle(JText::_('CONTACT')); + + JHTML::stylesheet('contactdirectory.css', 'components/com_contactdirectory/css/'); + + $this->assignRef('lists', $lists); + $this->assignRef('data', $data); + $this->assignRef('pagination', $pagination); + $this->assignRef('categories', $categories); + $this->assignRef('params', $pparams); + $this->assignRef('user', $user); + $this->assignRef('cparams', $cparams); + + $this->assign('action', $uri->toString()); + + parent::display($tpl); + } +} diff --git a/components/com_contactdirectory/views/category/index.html b/components/com_contactdirectory/views/category/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/views/category/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_contactdirectory/views/category/metadata.xml b/components/com_contactdirectory/views/category/metadata.xml new file mode 100755 index 0000000000000..657cd43e42a03 --- /dev/null +++ b/components/com_contactdirectory/views/category/metadata.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/components/com_contactdirectory/views/category/tmpl/default.php b/components/com_contactdirectory/views/category/tmpl/default.php new file mode 100755 index 0000000000000..a3eb0bb38d032 --- /dev/null +++ b/components/com_contactdirectory/views/category/tmpl/default.php @@ -0,0 +1,215 @@ + + + + +params->get( 'show_page_title' ) ) : ?> +
    + category->title && $this->params->get('show_title') ) : echo $this->escape($this->params->get('page_title')).' - '.$this->escape($this->category->title); + else : echo $this->escape($this->params->get('page_title')); + endif; ?> +
    + + +
    + category->image || $this->category->description) : ?> +
    + params->get('show_description_image')) : ?> + <?php echo JText::_( 'CONTACT' ); ?> + params->get('show_description')) : + echo $this->category->description; + endif; ?> +
    + + +
    + + params->get('alphabet') || $this->params->get('search')): ?> + + + + + + + + + + + + + + + + + + + +
    + params->get('alphabet')): ?> + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z | + + + + + params->get('search')): ?> + : + + + + +
    + params->get('show_limit')) : + echo JText::_('DISPLAY #') .' '; + echo $this->pagination->getLimitBox(); + endif; ?> + + pagination->getPagesLinks(); ?> + + pagination->getPagesCounter(); ?> +
    + contacts) > 0): ?> + contacts as $this->contact): ?> +
    + contact->params->get('show_name') && $this->contact->name) || (isset($this->contact->pos_title) && count($this->contact->pos_title) >= 1)): ?> +
    +
    + params->get('link')): ?> + + contact->name; ?> + + contact->name;?> + +
    + contact->pos_title as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    +
    + + contact->pos_top) && count($this->contact->pos_top) >= 1): ?> + contact->pos_top as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + + + + contact->pos_left) && count($this->contact->pos_left) >= 1) || (isset($this->contact->pos_main) && count($this->contact->pos_main) >= 1) || (isset($this->contact->pos_right) && count($this->contact->pos_right) >= 1)): ?> + + + + contact->pos_left) && count($this->contact->pos_left) >= 1): ?> + + + + + contact->pos_main) && count($this->contact->pos_main) >= 1): ?> + + + + + contact->pos_right) && count($this->contact->pos_right) >= 1): ?> + + + +
    + contact->pos_left as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    + contact->pos_main as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    + contact->pos_right as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + +
    + + + + contact->pos_bottom) && count($this->contact->pos_bottom) >= 1): ?> + contact->pos_bottom as $this->contact->info):?> + contact->info->data && $this->contact->info->show_field && $this->contact->info->access <= $this->user->get('aid', 0)): ?> +
    + + contact->info->params->get( 'marker_title' ); ?> + + contact->info->data; ?> +
    + + + +
    + +
    + + +
    + + +
    +
    \ No newline at end of file diff --git a/components/com_contactdirectory/views/category/tmpl/default.xml b/components/com_contactdirectory/views/category/tmpl/default.xml new file mode 100755 index 0000000000000..8430e5d592706 --- /dev/null +++ b/components/com_contactdirectory/views/category/tmpl/default.xml @@ -0,0 +1,62 @@ + + + + + + + + + + CONTACT_CATEGORY_LAYOUT + CONTACT_CATEGORY_LAYOUT_DESCRIPTION + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/com_contactdirectory/views/category/tmpl/index.html b/components/com_contactdirectory/views/category/tmpl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/views/category/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_contactdirectory/views/category/view.html.php b/components/com_contactdirectory/views/category/view.html.php new file mode 100755 index 0000000000000..c933041431538 --- /dev/null +++ b/components/com_contactdirectory/views/category/view.html.php @@ -0,0 +1,172 @@ +getModel(); + $document = &JFactory::getDocument(); + + $pparams = &$mainframe->getParams('com_contactdirectory'); + $cparams =& JComponentHelper::getParams('com_media'); + + $category = $model->getCategory(); + $contacts = $model->getData(); + $fields = $model->getFields(); + $pagination = $model->getPagination(); + + $alphabet = $mainframe->getUserStateFromRequest( $option.'alphabet', 'alphabet', '', 'string' ); + $search = $mainframe->getUserStateFromRequest( $option.'search', 'search', '', 'string' ); + $search = JString::strtolower( $search ); + + // search filter + $lists['search']= $search; + + //add alternate feed link + /*if($pparams->get('show_feed_link', 1) == 1) + { + $link = '&format=feed&limitstart='; + $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); + $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); + $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); + $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); + }*/ + + for($i=0; $ilink = JRoute::_('index.php?option=com_contactdirectory&view=contact&catid='.$category->slug.'&id='.$contacts[$i]->slug); + $contacts[$i]->fields = $fields[$i]; + $contacts[$i]->params = new JParameter($contacts[$i]->params); + + foreach($contacts[$i]->fields as $contacts[$i]->field){ + $contacts[$i]->field->params = new JParameter($contacts[$i]->field->params); + + if($contacts[$i]->field->type == 'image'){ + if($contacts[$i]->field->data){ + if($contacts[$i]->field->pos == 'right'){ + $contacts[$i]->field->data = JHTML::_('image', $cparams->get('image_path') . '/'.$contacts[$i]->field->data, JText::_( 'CONTACT' ), array('align' => 'right')); + }else{ + $contacts[$i]->field->data = JHTML::_('image', $cparams->get('image_path') . '/'.$contacts[$i]->field->data, JText::_( 'CONTACT' ), array('align' => 'left')); + } + } + } + + if($contacts[$i]->field->type == 'textarea'){ + $contacts[$i]->field->data = nl2br($contacts[$i]->field->data); + } + + if($contacts[$i]->field->type == 'url'){ + if(!empty($contacts[$i]->field->data)){ + $contacts[$i]->field->data = ''.$contacts[$i]->field->data.''; + } + } + + // Handle email cloaking + if($contacts[$i]->field->type == 'email' && $contacts[$i]->field->show_field) { + jimport('joomla.mail.helper'); + $contacts[$i]->field->data = trim($contacts[$i]->field->data); + if(!empty($contacts[$i]->field->data) && JMailHelper::isEmailAddress($contacts[$i]->field->data)) { + $contacts[$i]->field->data = JHTML::_('email.cloak', $contacts[$i]->field->data); + }else{ + $contacts[$i]->field->data = ''; + } + } + + // Manage the display mode for the field title + switch ($contacts[$i]->field->params->get('field_title')) + { + case 0 : + // text + $contacts[$i]->field->params->set('marker_title', JText::_($contacts[$i]->field->title).": "); + break; + case 1: + //icon and text + $image = JHTML::_('image.site', 'arrow.png', '/images/M_images/', $contacts[$i]->field->params->get('choose_icon'), '/images/M_images/', JText::_($contacts[$i]->field->title).": "); + $contacts[$i]->field->params->set('marker_title', $image); + break; + case 2 : + // icons + $image = JHTML::_('image.site', 'arrow.png', '/images/M_images/', $contacts[$i]->field->params->get('choose_icon'), '/images/M_images/', JText::_($contacts[$i]->field->title).": "); + $contacts[$i]->field->params->set('marker_title', $image." ".JText::_($contacts[$i]->field->title).": "); + break; + case 3 : + // none + $contacts[$i]->field->params->set('marker_title', ''); + break; + } + + switch ($contacts[$i]->field->pos){ + case 'title': + $contacts[$i]->pos_title[] = $contacts[$i]->field; + break; + case 'top': + $contacts[$i]->pos_top[] = $contacts[$i]->field; + break; + case 'left': + $contacts[$i]->pos_left[] = $contacts[$i]->field; + break; + case 'main': + $contacts[$i]->pos_main[] = $contacts[$i]->field; + break; + case 'right': + $contacts[$i]->pos_right[] = $contacts[$i]->field; + break; + case 'bottom': + $contacts[$i]->pos_bottom[] = $contacts[$i]->field; + break; + } + } + } + + // Set the page title and pathway + if ($category->title) + { + + // Add the category breadcrumbs item + $document->setTitle(JText::_('CONTACT').' - '.$category->title); + } else { + $document->setTitle(JText::_('CONTACT')); + } + + // Prepare category description + $category->description = JHTML::_('content.prepare', $category->description); + + JHTML::stylesheet('contactdirectory.css', 'components/com_contactdirectory/css/'); + + $this->assignRef('contacts', $contacts); + $this->assignRef('lists', $lists); + $this->assignRef('pagination', $pagination); + $this->assignRef('category', $category); + $this->assignRef('params', $pparams); + $this->assignRef('user', $user); + $this->assignRef('cparams', $cparams); + + $this->assign('action', $uri->toString()); + + parent::display($tpl); + } +} diff --git a/components/com_contactdirectory/views/contact/index.html b/components/com_contactdirectory/views/contact/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/views/contact/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_contactdirectory/views/contact/metadata.xml b/components/com_contactdirectory/views/contact/metadata.xml new file mode 100755 index 0000000000000..038334b36258d --- /dev/null +++ b/components/com_contactdirectory/views/contact/metadata.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/components/com_contactdirectory/views/contact/tmpl/default.php b/components/com_contactdirectory/views/contact/tmpl/default.php new file mode 100755 index 0000000000000..f42fa03233396 --- /dev/null +++ b/components/com_contactdirectory/views/contact/tmpl/default.php @@ -0,0 +1,157 @@ + + +params->get( 'show_page_title' )): ?> +
    + params->get( 'page_title' ); ?> +
    + + + + + + + + + pos_top) >= 1 || $this->showFormTop): ?> + + + + + pos_left) >= 1 || count($this->pos_main) >= 1 || count($this->pos_right) >= 1): ?> + + + + + + + pos_bottom) >= 1 || $this->showFormBottom): ?> + + + + +
    + + + contact->name && $this->contact->params->get( 'show_name' ) ) : ?> +
    + contact->name; ?> +
    + + pos_title) >= 1 || $this->showFormTitle): ?> + pos_title as $this->info): ?> + info->data && $this->info->show_field && $this->info->access <= $this->user->get('aid', 0)): ?> +
    + + info->params->get( 'marker_title' ); ?> + + info->data; ?> +
    + + showFormTitle):?> +
    + loadTemplate('form'); ?> +
    + + +
    +
    + pos_top) >= 1): foreach($this->pos_top as $this->info): ?> + info->data && $this->info->show_field && $this->info->access <= $this->user->get('aid', 0)): ?> +
    + + info->params->get( 'marker_title' ); ?> + + info->data; ?> +
    + + showFormTop):?> +
    + loadTemplate('form'); ?> +
    + +
    +
    + + + + + pos_left) >= 1 || $this->showFormLeft):?> + + + + + pos_main) >= 1 || $this->showFormMain):?> + + + + + pos_right) >= 1 || $this->showFormRight):?> + + + +
    + pos_left) >= 1): foreach($this->pos_left as $this->info): ?> + info->data && $this->info->show_field && $this->info->access <= $this->user->get('aid', 0)): ?> +
    + + info->params->get( 'marker_title' ); ?> + + info->data; ?> +
    + + showFormLeft):?> +
    + loadTemplate('form'); ?> +
    + +
    + pos_main) >= 1): foreach($this->pos_main as $this->info): ?> + info->data && $this->info->show_field && $this->info->access <= $this->user->get('aid', 0)): ?> +
    + + info->params->get( 'marker_title' ); ?> + + info->data; ?> +
    + + showFormMain):?> +
    + loadTemplate('form'); ?> +
    + +
    +
    +
    + pos_bottom) >= 1): foreach($this->pos_bottom as $this->info): ?> + info->data && $this->info->show_field && $this->info->access <= $this->user->get('aid', 0)): ?> +
    + + info->params->get( 'marker_title' ); ?> + + info->data; ?> +
    + + showFormBottom):?> +
    + loadTemplate('form'); ?> +
    + +
    \ No newline at end of file diff --git a/components/com_contactdirectory/views/contact/tmpl/default.xml b/components/com_contactdirectory/views/contact/tmpl/default.xml new file mode 100755 index 0000000000000..baced173ca2ce --- /dev/null +++ b/components/com_contactdirectory/views/contact/tmpl/default.xml @@ -0,0 +1,16 @@ + + + + + + + + + + STANDARD_CONTACT_LAYOUT + STANDARD_CONTACT_LAYOUT_DESCRIPTION + + + + + \ No newline at end of file diff --git a/components/com_contactdirectory/views/contact/tmpl/default_form.php b/components/com_contactdirectory/views/contact/tmpl/default_form.php new file mode 100755 index 0000000000000..d73d5cde82d76 --- /dev/null +++ b/components/com_contactdirectory/views/contact/tmpl/default_form.php @@ -0,0 +1,96 @@ + + +params->get('validate_email_form')=='1') { + // validate all fields on submit + $formValidationType=''; + //$formValidationType=' onsubmit="return validateForm(this);" '; +} else { + // immediate validation on every field + $formValidationType=' class="form-validate" '; +} +?> + + + +error) && $this->error != null) : ?> +
    error; ?>
    + + +
    +
    > +
    + +
    + +
    + +
    + +
    + +
    + +

    + +
    + + contact->params->get( 'show_email_copy' )) : ?> +
    + + + + contact->params->get('show_captcha')) : ?> +
    +
    + captcha; ?> +
    + +
    + + +
    +
    + +
    + + + + + + +
    +
    +
    \ No newline at end of file diff --git a/components/com_contactdirectory/views/contact/tmpl/index.html b/components/com_contactdirectory/views/contact/tmpl/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/views/contact/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_contactdirectory/views/contact/view.html.php b/components/com_contactdirectory/views/contact/view.html.php new file mode 100755 index 0000000000000..a61efde35a4ba --- /dev/null +++ b/components/com_contactdirectory/views/contact/view.html.php @@ -0,0 +1,241 @@ +getPathway(); + $document = & JFactory::getDocument(); + + // Get the parameters of the active menu item + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + $pparams = &$mainframe->getParams('com_contactdirectory'); + + $cparams = JComponentHelper::getParams ('com_media'); + + // Push a model into the view + $model = &$this->getModel(); + + //get the contact + $contact =& $model->getData($user->get('aid', 0)); + + //get the fields + $fields =& $model->getFields(); + + // check if we have a contact + if (!is_object( $contact )) { + JError::raiseError( 404, 'CONTACT NOT FOUND' ); + return; + } + + // check if we have the fields + if (!is_array($fields)) { + JError::raiseError( 404, 'CONTACT NOT FOUND' ); + return; + } + + // Adds parameter handling + $contact->params = new JParameter($contact->params); + $pparams->merge($contact->params); + + $email = null; + foreach($fields as $field){ + $field->params = new JParameter($field->params); + + if($field->type == 'image'){ + if($field->data){ + if($field->pos == 'right'){ + $field->data = JHTML::_('image', $cparams->get('image_path') . '/'.$field->data, JText::_( 'CONTACT' ), array('align' => 'right')); + }else{ + $field->data = JHTML::_('image', $cparams->get('image_path') . '/'.$field->data, JText::_( 'CONTACT' ), array('align' => 'left')); + } + + } + } + + if($field->type == 'textarea'){ + $field->data = nl2br($field->data); + } + + if($field->type == 'url'){ + if(!empty($field->data)){ + $field->data = ''.$field->data.''; + } + } + + // Handle email cloaking + if($field->type == 'email') { + jimport('joomla.mail.helper'); + $field->data = trim($field->data); + if(!empty($field->data) && JMailHelper::isEmailAddress($field->data)) { + $field->data = JHTML::_('email.cloak', $field->data); + }else{ + $field->data = ''; + } + if($field->id == 1){ + $email = $field; + } + } + + // Manage the display mode for the field title + switch ($field->params->get('field_title')) + { + case 0 : + // text + $field->params->set('marker_title', JText::_($field->title).": "); + break; + case 1: + //icon and text + $image = JHTML::_('image.site', 'arrow.png', '/images/M_images/', $field->params->get('choose_icon'), '/images/M_images/', JText::_($field->title).": "); + $field->params->set('marker_title', $image); + break; + case 2 : + // icons + $image = JHTML::_('image.site', 'arrow.png', '/images/M_images/', $field->params->get('choose_icon'), '/images/M_images/', JText::_($field->title).": "); + $field->params->set('marker_title', $image." ".JText::_($field->title).": "); + break; + case 3 : + // none + $field->params->set('marker_title', ''); + break; + } + + switch ($field->pos){ + case 'title': + $pos_title[] = $field; + break; + case 'top': + $pos_top[] = $field; + break; + case 'left': + $pos_left[] = $field; + break; + case 'main': + $pos_main[] = $field; + break; + case 'right': + $pos_right[] = $field; + break; + case 'bottom': + $pos_bottom[] = $field; + break; + } + } + + // Set the document page title + $document->setTitle(JText::_('CONTACT').' - '.$contact->name); + + //set breadcrumbs + if (isset( $menu ) && isset($menu->query['view']) && $menu->query['view'] != 'contact'){ + $pathway->addItem($contact->name, ''); + } + + JHTML::_('behavior.formvalidation'); + + $captcha = null; + if($contact->params->get('show_captcha')) { + $captcha = JHTML::image('index.php?option=com_contactdirectory&task=captcha&format=raw&sid=' . md5(uniqid(time())), 'captcha', array('id'=>'captcha-img')); + } + + $showFormTitle = false; + $showFormTop = false; + $showFormLeft = false; + $showFormMain = false; + $showFormRight = false; + $showFormBottom = false; + + if($contact->params->get('email_form_pos') == 'title' && + $contact->params->get('show_email_form') && + ($email->data || $contact->user_id) && + $contact->params->get('email_form_access') <= $user->get('aid', 0)){ + $showFormTitle = true; + } + + if($contact->params->get('email_form_pos') == 'top' && + $contact->params->get('show_email_form') && + ($email->data || $contact->user_id) && + $contact->params->get('email_form_access') <= $user->get('aid', 0)){ + $showFormTop = true; + } + + if($contact->params->get('email_form_pos') == 'left' && + $contact->params->get('show_email_form') && + ($email->data || $contact->user_id) && + $contact->params->get('email_form_access') <= $user->get('aid', 0)){ + $showFormLeft = true; + } + + if($contact->params->get('email_form_pos') == 'main' && + $contact->params->get('show_email_form') && + ($email->data || $contact->user_id) && + $contact->params->get('email_form_access') <= $user->get('aid', 0)){ + $showFormMain = true; + } + + if($contact->params->get('email_form_pos') == 'right' && + $contact->params->get('show_email_form') && + ($email->data || $contact->user_id) && + $contact->params->get('email_form_access') <= $user->get('aid', 0)){ + $showFormRight = true; + } + + if($contact->params->get('email_form_pos') == 'bottom' && + $contact->params->get('show_email_form') && + ($email->data || $contact->user_id) && + $contact->params->get('email_form_access') <= $user->get('aid', 0)){ + $showFormBottom = true; + } + + // Fill up the form with the original data after summit error + $data =& $this->get('FormData'); + + JHTML::stylesheet('contactdirectory.css', 'components/com_contactdirectory/css/'); + + $this->assignRef('contact', $contact); + $this->assignRef('pos_title', $pos_title); + $this->assignRef('pos_top', $pos_top); + $this->assignRef('pos_left', $pos_left); + $this->assignRef('pos_main', $pos_main); + $this->assignRef('pos_right', $pos_right); + $this->assignRef('pos_bottom', $pos_bottom); + $this->assignRef('showFormTitle', $showFormTitle); + $this->assignRef('showFormTop', $showFormTop); + $this->assignRef('showFormLeft', $showFormLeft); + $this->assignRef('showFormMain', $showFormMain); + $this->assignRef('showFormRight', $showFormRight); + $this->assignRef('showFormBottom', $showFormBottom); + $this->assignRef('params', $pparams); + $this->assignRef('email', $email); + $this->assignRef('captcha', $captcha); + $this->assignRef('user', $user); + $this->assignRef('data', $data); + + parent::display($tpl); + } +} diff --git a/components/com_contactdirectory/views/index.html b/components/com_contactdirectory/views/index.html new file mode 100755 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_contactdirectory/views/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_content/content.php b/components/com_content/content.php index 2f6dc7c1cbb35..08d322f63b948 100644 --- a/components/com_content/content.php +++ b/components/com_content/content.php @@ -16,9 +16,9 @@ defined('_JEXEC') or die('Restricted access'); // Require the com_content helper library -require_once(JPATH_COMPONENT.DS.'controller.php'); -require_once(JPATH_COMPONENT.DS.'helpers'.DS.'query.php'); -require_once(JPATH_COMPONENT.DS.'helpers'.DS.'route.php'); +require_once JPATH_COMPONENT.DS.'controller.php'; +require_once JPATH_COMPONENT.DS.'helpers'.DS.'query.php'; +require_once JPATH_COMPONENT.DS.'helpers'.DS.'route.php'; // Component Helper jimport('joomla.application.component.helper'); diff --git a/components/com_content/controller.php b/components/com_content/controller.php index 82455763a0fd5..e52d8065b0b5b 100644 --- a/components/com_content/controller.php +++ b/components/com_content/controller.php @@ -156,7 +156,7 @@ function save() // manage frontpage items //TODO : Move this into a frontpage model - require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_frontpage'.DS.'tables'.DS.'frontpage.php'); + require_once JPATH_ADMINISTRATOR.DS.'components'.DS.'com_frontpage'.DS.'tables'.DS.'frontpage.php'; $fp = new TableFrontPage($db); if (JRequest::getVar('frontpage', false, '', 'boolean')) @@ -204,7 +204,7 @@ function save() if ($isNew) { // messaging for new items - require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_messages'.DS.'tables'.DS.'message.php'); + require_once JPATH_ADMINISTRATOR.DS.'components'.DS.'com_messages'.DS.'tables'.DS.'message.php'; // load language for messaging $lang =& JFactory::getLanguage(); diff --git a/components/com_content/helpers/icon.php b/components/com_content/helpers/icon.php index 16df0da8f766a..3a2c62b3bcb5c 100644 --- a/components/com_content/helpers/icon.php +++ b/components/com_content/helpers/icon.php @@ -56,7 +56,7 @@ function pdf($article, $params, $access, $attribs = array()) $attribs['title'] = JText::_( 'PDF' ); $attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;"; - $attribs['rel'] = 'nofollow'; + $attribs['rel'] = 'nofollow'; return JHTML::_('link', JRoute::_($url), $text, $attribs); } @@ -64,9 +64,9 @@ function pdf($article, $params, $access, $attribs = array()) function email($article, $params, $access, $attribs = array()) { //$link = JURI::base()."index.php?view=article&id=".$article->slug; - $uri =& JURI::getInstance(); - $base = $uri->toString( array('scheme', 'host', 'port')); - $link = $base.JRoute::_( "index.php?view=article&id=".$article->slug, false ); + $uri =& JURI::getInstance(); + $base = $uri->toString( array('scheme', 'host', 'port')); + $link = $base.JRoute::_( "index.php?view=article&id=".$article->slug, false ); $url = 'index.php?option=com_mailto&tmpl=component&link='.base64_encode( $link ); $status = 'width=400,height=300,menubar=yes,resizable=yes'; diff --git a/components/com_content/helpers/index.html b/components/com_content/helpers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/helpers/index.html +++ b/components/com_content/helpers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/index.html b/components/com_content/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/index.html +++ b/components/com_content/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/models/archive.php b/components/com_content/models/archive.php index 976aa3527f1c6..c3359bc919a02 100644 --- a/components/com_content/models/archive.php +++ b/components/com_content/models/archive.php @@ -20,7 +20,6 @@ /** * Content Component Archive Model * - * @author Louis Landry * @package Joomla * @subpackage Content * @since 1.5 @@ -122,7 +121,7 @@ function _buildQuery() ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . ' LEFT JOIN #__sections AS s ON s.id = a.sectionid' . ' LEFT JOIN #__users AS u ON u.id = a.created_by' . - ' LEFT JOIN #__groups AS g ON a.access = g.id'. + ' LEFT JOIN #__core_acl_axo_groups AS g ON a.access = g.value'. $voting['join']. $where. $orderby; diff --git a/components/com_content/models/article.php b/components/com_content/models/article.php index fabec42a297da..566a37f6f648a 100644 --- a/components/com_content/models/article.php +++ b/components/com_content/models/article.php @@ -1,605 +1,621 @@ - - * @package Joomla - * @subpackage Content - * @since 1.5 - */ -class ContentModelArticle extends JModel -{ - /** - * Article data - * - * @var object - */ - var $_article = null; - - /** - * Constructor - * - * @since 1.5 - */ - function __construct() - { - parent::__construct(); - - $id = JRequest::getVar('id', 0, '', 'int'); - $this->setId((int)$id); - } - - /** - * Method to set the article id - * - * @access public - * @param int Article ID number - */ - function setId($id) - { - // Set new article ID and wipe data - $this->_id = $id; - $this->_article = null; - } - - /** - * Overridden set method to pass properties on to the article - * - * @access public - * @param string $property The name of the property - * @param mixed $value The value of the property to set - * @return boolean True on success - * @since 1.5 - */ - function set( $property, $value=null ) - { - if ($this->_loadArticle()) { - $this->_article->$property = $value; - return true; - } else { - return false; - } - } - - /** - * Overridden get method to get properties from the article - * - * @access public - * @param string $property The name of the property - * @param mixed $value The value of the property to set - * @return mixed The value of the property - * @since 1.5 - */ - function get($property, $default=null) - { - if ($this->_loadArticle()) { - if(isset($this->_article->$property)) { - return $this->_article->$property; - } - } - return $default; - } - - /** - * Method to get content article data for the frontpage - * - * @since 1.5 - */ - function &getArticle() - { - // Load the Category data - if ($this->_loadArticle()) - { - $user = & JFactory::getUser(); - - // Is the category published? - if (!$this->_article->cat_pub && $this->_article->catid) { - JError::raiseError( 404, JText::_("Article category not published") ); - } - - // Is the section published? - if ($this->_article->sectionid) - { - if ($this->_article->sec_pub === null) - { - // probably a new item - // check the sectionid probably passed in the request - $db =& $this->getDBO(); - $query = 'SELECT published' . - ' FROM #__sections' . - ' WHERE id = ' . (int) $this->_article->sectionid; - $db->setQuery( $query ); - $this->_article->sec_pub = $db->loadResult(); - } - if (!$this->_article->sec_pub) - { - JError::raiseError( 404, JText::_("Article section not published") ); - } - } - - // Do we have access to the category? - if (($this->_article->cat_access > $user->get('aid', 0)) && $this->_article->catid) { - JError::raiseError( 403, JText::_("ALERTNOTAUTH") ); - } - - // Do we have access to the section? - if (($this->_article->sec_access > $user->get('aid', 0)) && $this->_article->sectionid) { - JError::raiseError( 403, JText::_("ALERTNOTAUTH") ); - } - - $this->_loadArticleParams(); - - /* - * Record the hit on the article if necessary - */ - $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); - if (!$this->_article->parameters->get('intro_only') && ($limitstart == 0)) - { - $this->hit(); - } - - } - else - { - $user =& JFactory::getUser(); - $article =& JTable::getInstance('content'); - $article->state = 1; - $article->cat_pub = null; - $article->sec_pub = null; - $article->cat_access = null; - $article->sec_access = null; - $article->author = null; - $article->created_by = $user->get('id'); - $article->parameters = new JParameter( '' ); - $article->text = ''; - $this->_article = $article; - } - - return $this->_article; - } - - /** - * Method to increment the hit counter for the article - * - * @access public - * @return boolean True on success - * @since 1.5 - */ - function hit() - { - global $mainframe; - - if ($this->_id) - { - $article = & JTable::getInstance('content'); - $article->hit($this->_id); - return true; - } - return false; - } - - /** - * Tests if article is checked out - * - * @access public - * @param int A user id - * @return boolean True if checked out - * @since 1.5 - */ - function isCheckedOut( $uid=0 ) - { - if ($this->_loadArticle()) - { - if ($uid) { - return ($this->_article->checked_out && $this->_article->checked_out != $uid); - } else { - return $this->_article->checked_out; - } - } elseif ($this->_id < 1) { - return false; - } else { - JError::raiseWarning( 0, 'Unable to Load Data'); - return false; - } - } - - /** - * Method to checkin/unlock the article - * - * @access public - * @return boolean True on success - * @since 1.5 - */ - function checkin() - { - if ($this->_id) - { - $article = & JTable::getInstance('content'); - return $article->checkin($this->_id); - } - return false; - } - - /** - * Method to checkout/lock the article - * - * @access public - * @param int $uid User ID of the user checking the article out - * @return boolean True on success - * @since 1.5 - */ - function checkout($uid = null) - { - if ($this->_id) - { - // Make sure we have a user id to checkout the article with - if (is_null($uid)) { - $user =& JFactory::getUser(); - $uid = $user->get('id'); - } - // Lets get to it and checkout the thing... - $article = & JTable::getInstance('content'); - return $article->checkout($uid, $this->_id); - } - return false; - } - - /** - * Method to store the article - * - * @access public - * @return boolean True on success - * @since 1.5 - */ - function store($data) - { - global $mainframe; - - $article =& JTable::getInstance('content'); - $user =& JFactory::getUser(); - - // Bind the form fields to the web link table - if (!$article->bind($data, "published")) { - $this->setError($this->_db->getErrorMsg()); - return false; - } - - // sanitise id field - $article->id = (int) $article->id; - - $isNew = ($article->id < 1); - if ($isNew) - { - $article->created = gmdate('Y-m-d H:i:s'); - $article->created_by = $user->get('id'); - } - else - { - $article->modified = gmdate('Y-m-d H:i:s'); - $article->modified_by = $user->get('id'); - } - - // Append time if not added to publish date - if (strlen(trim($article->publish_up)) <= 10) { - $article->publish_up .= ' 00:00:00'; - } - - $date =& JFactory::getDate($article->publish_up, $mainframe->getCfg('offset')); - $article->publish_up = $date->toMySQL(); - - // Handle never unpublish date - if (trim($article->publish_down) == JText::_('Never') || trim( $article->publish_down ) == '') - { - $article->publish_down = $this->_db->getNullDate();; - } - else - { - if (strlen(trim( $article->publish_down )) <= 10) { - $article->publish_down .= ' 00:00:00'; - } - - $date =& JFactory::getDate($article->publish_down, $mainframe->getCfg('offset')); - $article->publish_down = $date->toMySQL(); - } - - $article->title = trim( JFilterOutput::ampReplace($article->title) ); - - // Publishing state hardening for Authors - if (!$user->authorize('com_content', 'publish', 'content', 'all')) - { - if ($isNew) - { - // For new items - author is not allowed to publish - prevent them from doing so - $article->state = 0; - } - else - { - // For existing items keep existing state - author is not allowed to change status - $query = 'SELECT state' . - ' FROM #__content' . - ' WHERE id = '.(int) $article->id; - - $this->_db->setQuery($query); - $state = $this->_db->loadResult(); - - if ($state) { - $article->state = 1; - } - else { - $article->state = 0; - } - } - } - - // Search for the {readmore} tag and split the text up accordingly. - $text = str_replace('
    ', '
    ', $data['text']); - - $tagPos = JString::strpos($text, '
    '); - - if ($tagPos === false) { - $article->introtext = $text; - } else { - $article->introtext = JString::substr($text, 0, $tagPos); - $article->fulltext = JString::substr($text, $tagPos +27); - } - - // Filter settings - jimport( 'joomla.application.component.helper' ); - $config = JComponentHelper::getParams( 'com_content' ); - $user = &JFactory::getUser(); - $gid = $user->get( 'gid' ); - - $filterGroups = (array) $config->get( 'filter_groups' ); - if (in_array( $gid, $filterGroups )) - { - $filterType = $config->get( 'filter_type' ); - $filterTags = preg_split( '#[,\s]+#', trim( $config->get( 'filter_tags' ) ) ); - $filterAttrs = preg_split( '#[,\s]+#', trim( $config->get( 'filter_attritbutes' ) ) ); - switch ($filterType) - { - case 'NH': - $filter = new JFilterInput(); - break; - case 'WL': - $filter = new JFilterInput( $filterTags, $filterAttrs, 0, 0 ); - break; - case 'BL': - default: - $filter = new JFilterInput( $filterTags, $filterAttrs, 1, 1 ); - break; - } - $article->introtext = $filter->clean( $article->introtext ); - $article->fulltext = $filter->clean( $article->fulltext ); - } - - // Make sure the article table is valid - if (!$article->check()) { - $this->setError($article->getError()); - return false; - } - - $article->version++; - - // Store the article table to the database - if (!$article->store()) { - $this->setError($this->_db->getErrorMsg()); - return false; - } - - if ($isNew) - { - $this->_id = $article->_db->insertId(); - } - - $article->reorder("catid = " . (int) $data['catid']); - - $this->_article =& $article; - - return true; - } - - /** - * Method to store a user rating for a content article - * - * @access public - * @param int $rating Article rating [ 1 - 5 ] - * @return boolean True on success - * @since 1.5 - */ - function storeVote($rate) - { - if ( $rate >= 1 && $rate <= 5) - { - $userIP = $_SERVER['REMOTE_ADDR']; - - $query = 'SELECT *' . - ' FROM #__content_rating' . - ' WHERE content_id = '.(int) $this->_id; - $this->_db->setQuery($query); - $rating = $this->_db->loadObject(); - - if (!$rating) - { - // There are no ratings yet, so lets insert our rating - $query = 'INSERT INTO #__content_rating ( content_id, lastip, rating_sum, rating_count )' . - ' VALUES ( '.(int) $this->_id.', '.$this->_db->Quote($userIP).', '.(int) $rate.', 1 )'; - $this->_db->setQuery($query); - if (!$this->_db->query()) { - JError::raiseError( 500, $this->_db->stderr()); - } - } - else - { - if ($userIP != ($rating->lastip)) - { - // We weren't the last voter so lets add our vote to the ratings totals for the article - $query = 'UPDATE #__content_rating' . - ' SET rating_count = rating_count + 1, rating_sum = rating_sum + '.(int) $rate.', lastip = '.$this->_db->Quote($userIP) . - ' WHERE content_id = '.(int) $this->_id; - $this->_db->setQuery($query); - if (!$this->_db->query()) { - JError::raiseError( 500, $this->_db->stderr()); - } - } - else - { - return false; - } - } - return true; - } - JError::raiseWarning( 'SOME_ERROR_CODE', 'Article Rating:: Invalid Rating:' .$rate, "JModelArticle::storeVote($rate)"); - return false; - } - - /** - * Method to load content article data - * - * @access private - * @return boolean True on success - * @since 1.5 - */ - function _loadArticle() - { - global $mainframe; - - if($this->_id == '0') - { - return false; - } - - // Load the content if it doesn't already exist - if (empty($this->_article)) - { - // Get the page/component configuration - $params = &$mainframe->getParams(); - - // If voting is turned on, get voting data as well for the article - $voting = ContentHelperQuery::buildVotingQuery($params); - - // Get the WHERE clause - $where = $this->_buildContentWhere(); - - $query = 'SELECT a.*, u.name AS author, u.usertype, cc.title AS category, s.title AS section,' . - ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'. - ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug,'. - ' g.name AS groups, s.published AS sec_pub, cc.published AS cat_pub, s.access AS sec_access, cc.access AS cat_access '.$voting['select']. - ' FROM #__content AS a' . - ' LEFT JOIN #__categories AS cc ON cc.id = a.catid' . - ' LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = "content"' . - ' LEFT JOIN #__users AS u ON u.id = a.created_by' . - ' LEFT JOIN #__groups AS g ON a.access = g.id'. - $voting['join']. - $where; - $this->_db->setQuery($query); - $this->_article = $this->_db->loadObject(); - - if ( ! $this->_article ) { - return false; - } - - if($this->_article->publish_down == $this->_db->getNullDate()) { - $this->_article->publish_down = JText::_('Never'); - } - - // These attributes need to be defined in order for the voting plugin to work - if ( count($voting) && ! isset($this->_article->rating_count) ) { - $this->_article->rating_count = 0; - $this->_article->rating = 0; - } - - return true; - } - return true; - } - - /** - * Method to load content article parameters - * - * @access private - * @return void - * @since 1.5 - */ - function _loadArticleParams() - { - global $mainframe; - - // Get the page/component configuration - $params = clone($mainframe->getParams('com_content')); - - // Merge article parameters into the page configuration - $aparams = new JParameter($this->_article->attribs); - $params->merge($aparams); - - // Set the popup configuration option based on the request - $pop = JRequest::getVar('pop', 0, '', 'int'); - $params->set('popup', $pop); - - // Are we showing introtext with the article - if (!$params->get('show_intro') && !empty($this->_article->fulltext)) { - $this->_article->text = $this->_article->fulltext; - } else { - $this->_article->text = $this->_article->introtext . chr(13).chr(13) . $this->_article->fulltext; - } - - // Set the article object's parameters - $this->_article->parameters = & $params; - } - - /** - * Method to build the WHERE clause of the query to select a content article - * - * @access private - * @return string WHERE clause - * @since 1.5 - */ - function _buildContentWhere() - { - global $mainframe; - - $user =& JFactory::getUser(); - $aid = (int) $user->get('aid', 0); - - $jnow =& JFactory::getDate(); - $now = $jnow->toMySQL(); - $nullDate = $this->_db->getNullDate(); - - /* - * First thing we need to do is assert that the content article is the one - * we are looking for and we have access to it. - */ - $where = ' WHERE a.id = '. (int) $this->_id; - $where .= ' AND a.access <= '. (int) $aid; - - if (!$user->authorize('com_content', 'edit', 'content', 'all')) - { - $where .= ' AND ( '; - $where .= ' ( a.created_by = ' . (int) $user->id . ' ) '; - $where .= ' OR '; - $where .= ' ( a.state = 1 OR a.state = -1)' . - ' AND ( a.publish_up = '.$this->_db->Quote($nullDate).' OR a.publish_up <= '.$this->_db->Quote($now).' )' . - ' AND ( a.publish_down = '.$this->_db->Quote($nullDate).' OR a.publish_down >= '.$this->_db->Quote($now).' )'; - $where .= ' ) '; - } - - return $where; - } -} +setId((int)$id); + } + + /** + * Method to set the article id + * + * @access public + * @param int Article ID number + */ + function setId($id) + { + // Set new article ID and wipe data + $this->_id = $id; + $this->_article = null; + } + + /** + * Overridden set method to pass properties on to the article + * + * @access public + * @param string $property The name of the property + * @param mixed $value The value of the property to set + * @return boolean True on success + * @since 1.5 + */ + function set( $property, $value=null ) + { + if ($this->_loadArticle()) { + $this->_article->$property = $value; + return true; + } else { + return false; + } + } + + /** + * Overridden get method to get properties from the article + * + * @access public + * @param string $property The name of the property + * @param mixed $value The value of the property to set + * @return mixed The value of the property + * @since 1.5 + */ + function get($property, $default=null) + { + if ($this->_loadArticle()) { + if(isset($this->_article->$property)) { + return $this->_article->$property; + } + } + return $default; + } + + /** + * Method to get content article data for the frontpage + * + * @since 1.5 + */ + function &getArticle() + { + // Load the Category data + if ($this->_loadArticle()) + { + $user = & JFactory::getUser(); + + // Is the category published? + if (!$this->_article->cat_pub && $this->_article->catid) { + JError::raiseError( 404, JText::_("Article category not published") ); + } + + // Is the section published? + if ($this->_article->sectionid) + { + if ($this->_article->sec_pub === null) + { + // probably a new item + // check the sectionid probably passed in the request + $db =& $this->getDBO(); + $query = 'SELECT published' . + ' FROM #__sections' . + ' WHERE id = ' . (int) $this->_article->sectionid; + $db->setQuery( $query ); + $this->_article->sec_pub = $db->loadResult(); + } + if (!$this->_article->sec_pub) + { + JError::raiseError( 404, JText::_("Article section not published") ); + } + } + + // Do we have access to the category? + if (($this->_article->cat_access > $user->get('aid', 0)) && $this->_article->catid) { + JError::raiseError( 403, JText::_("ALERTNOTAUTH") ); + } + + // Do we have access to the section? + if (($this->_article->sec_access > $user->get('aid', 0)) && $this->_article->sectionid) { + JError::raiseError( 403, JText::_("ALERTNOTAUTH") ); + } + + $this->_loadArticleParams(); + + /* + * Record the hit on the article if necessary + */ + $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); + if (!$this->_article->parameters->get('intro_only') && ($limitstart == 0)) + { + $this->hit(); + } + + } + else + { + $user =& JFactory::getUser(); + $article =& JTable::getInstance('content'); + $article->state = 1; + $article->cat_pub = null; + $article->sec_pub = null; + $article->cat_access = null; + $article->sec_access = null; + $article->author = null; + $article->created_by = $user->get('id'); + $article->parameters = new JParameter( '' ); + $article->text = ''; + $this->_article = $article; + } + + return $this->_article; + } + + /** + * Method to increment the hit counter for the article + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function hit() + { + global $mainframe; + + if ($this->_id) + { + $article = & JTable::getInstance('content'); + $article->hit($this->_id); + return true; + } + return false; + } + + /** + * Tests if article is checked out + * + * @access public + * @param int A user id + * @return boolean True if checked out + * @since 1.5 + */ + function isCheckedOut( $uid=0 ) + { + if ($this->_loadArticle()) + { + if ($uid) { + return ($this->_article->checked_out && $this->_article->checked_out != $uid); + } else { + return $this->_article->checked_out; + } + } elseif ($this->_id < 1) { + return false; + } else { + JError::raiseWarning( 0, 'Unable to Load Data'); + return false; + } + } + + /** + * Method to checkin/unlock the article + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function checkin() + { + if ($this->_id) + { + $article = & JTable::getInstance('content'); + return $article->checkin($this->_id); + } + return false; + } + + /** + * Method to checkout/lock the article + * + * @access public + * @param int $uid User ID of the user checking the article out + * @return boolean True on success + * @since 1.5 + */ + function checkout($uid = null) + { + if ($this->_id) + { + // Make sure we have a user id to checkout the article with + if (is_null($uid)) { + $user =& JFactory::getUser(); + $uid = $user->get('id'); + } + // Lets get to it and checkout the thing... + $article = & JTable::getInstance('content'); + return $article->checkout($uid, $this->_id); + } + return false; + } + + /** + * Method to store the article + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + function store($data) + { + global $mainframe; + + $article =& JTable::getInstance('content'); + $user =& JFactory::getUser(); + $dispatcher =& JDispatcher::getInstance(); + JPluginHelper::importPlugin('content'); + + // Bind the form fields to the web link table + if (!$article->bind($data, "published")) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + // sanitise id field + $article->id = (int) $article->id; + + $isNew = ($article->id < 1); + if ($isNew) + { + $article->created = gmdate('Y-m-d H:i:s'); + $article->created_by = $user->get('id'); + } + else + { + $article->modified = gmdate('Y-m-d H:i:s'); + $article->modified_by = $user->get('id'); + } + + // Append time if not added to publish date + if (strlen(trim($article->publish_up)) <= 10) { + $article->publish_up .= ' 00:00:00'; + } + + $date =& JFactory::getDate($article->publish_up, $mainframe->getCfg('offset')); + $article->publish_up = $date->toMySQL(); + + // Handle never unpublish date + if (trim($article->publish_down) == JText::_('Never') || trim( $article->publish_down ) == '') + { + $article->publish_down = $this->_db->getNullDate();; + } + else + { + if (strlen(trim( $article->publish_down )) <= 10) { + $article->publish_down .= ' 00:00:00'; + } + + $date =& JFactory::getDate($article->publish_down, $mainframe->getCfg('offset')); + $article->publish_down = $date->toMySQL(); + } + + $article->title = trim( JFilterOutput::ampReplace($article->title) ); + + // Publishing state hardening for Authors + if (!$user->authorize('com_content', 'publish', 'content', 'all')) + { + if ($isNew) + { + // For new items - author is not allowed to publish - prevent them from doing so + $article->state = 0; + } + else + { + // For existing items keep existing state - author is not allowed to change status + $query = 'SELECT state' . + ' FROM #__content' . + ' WHERE id = '.(int) $article->id; + + $this->_db->setQuery($query); + $state = $this->_db->loadResult(); + + if ($state) { + $article->state = 1; + } + else { + $article->state = 0; + } + } + } + + // Search for the {readmore} tag and split the text up accordingly. + $text = str_replace('
    ', '
    ', $data['text']); + + $pattern = '##i'; + $tagPos = preg_match($pattern, $text); + + if ($tagPos == 0) { + $article->introtext = $text; + } else { + list($article->introtext, $article->fulltext) = preg_split($pattern, $text, 2); + } + + // Filter settings + jimport( 'joomla.application.component.helper' ); + $config = JComponentHelper::getParams( 'com_content' ); + $user = &JFactory::getUser(); + $gid = $user->get( 'gid' ); + + $filterGroups = (array) $config->get( 'filter_groups' ); + if (in_array( $gid, $filterGroups )) + { + $filterType = $config->get( 'filter_type' ); + $filterTags = preg_split( '#[,\s]+#', trim( $config->get( 'filter_tags' ) ) ); + $filterAttrs = preg_split( '#[,\s]+#', trim( $config->get( 'filter_attritbutes' ) ) ); + switch ($filterType) + { + case 'NH': + $filter = new JFilterInput(); + break; + case 'WL': + $filter = new JFilterInput( $filterTags, $filterAttrs, 0, 0 ); + break; + case 'BL': + default: + $filter = new JFilterInput( $filterTags, $filterAttrs, 1, 1 ); + break; + } + $article->introtext = $filter->clean( $article->introtext ); + $article->fulltext = $filter->clean( $article->fulltext ); + } + + // Make sure the article table is valid + if (!$article->check()) { + $this->setError($article->getError()); + return false; + } + + $article->version++; + + //Trigger OnBeforeContentSave + $result = $dispatcher->trigger('onBeforeContentSave', array(&$article, $isNew)); + if(in_array(false, $result, true)) { + $this->setError($article->getError()); + return false; + } + + // Store the article table to the database + if (!$article->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + if ($isNew) + { + $this->_id = $article->_db->insertId(); + } + + $article->reorder("catid = " . (int) $data['catid']); + + //Trigger OnAfterContentSave + $dispatcher->trigger('onAfterContentSave', array(&$article, $isNew)); + + $this->_article =& $article; + + return true; + } + + /** + * Method to store a user rating for a content article + * + * @access public + * @param int $rating Article rating [ 1 - 5 ] + * @return boolean True on success + * @since 1.5 + */ + function storeVote($rate) + { + if ( $rate >= 1 && $rate <= 5) + { + $userIP = $_SERVER['REMOTE_ADDR']; + + $query = 'SELECT *' . + ' FROM #__content_rating' . + ' WHERE content_id = '.(int) $this->_id; + $this->_db->setQuery($query); + $rating = $this->_db->loadObject(); + + if (!$rating) + { + // There are no ratings yet, so lets insert our rating + $query = 'INSERT INTO #__content_rating ( content_id, lastip, rating_sum, rating_count )' . + ' VALUES ( '.(int) $this->_id.', '.$this->_db->Quote($userIP).', '.(int) $rate.', 1 )'; + $this->_db->setQuery($query); + if (!$this->_db->query()) { + JError::raiseError( 500, $this->_db->stderr()); + } + } + else + { + if ($userIP != ($rating->lastip)) + { + // We weren't the last voter so lets add our vote to the ratings totals for the article + $query = 'UPDATE #__content_rating' . + ' SET rating_count = rating_count + 1, rating_sum = rating_sum + '.(int) $rate.', lastip = '.$this->_db->Quote($userIP) . + ' WHERE content_id = '.(int) $this->_id; + $this->_db->setQuery($query); + if (!$this->_db->query()) { + JError::raiseError( 500, $this->_db->stderr()); + } + } + else + { + return false; + } + } + return true; + } + JError::raiseWarning( 'SOME_ERROR_CODE', 'Article Rating:: Invalid Rating:' .$rate, "JModelArticle::storeVote($rate)"); + return false; + } + + /** + * Method to load content article data + * + * @access private + * @return boolean True on success + * @since 1.5 + */ + function _loadArticle() + { + global $mainframe; + + if($this->_id == '0') + { + return false; + } + + // Load the content if it doesn't already exist + if (empty($this->_article)) + { + // Get the page/component configuration + $params = &$mainframe->getParams(); + + // If voting is turned on, get voting data as well for the article + $voting = ContentHelperQuery::buildVotingQuery($params); + + // Get the WHERE clause + $where = $this->_buildContentWhere(); + + $query = 'SELECT a.*, u.name AS author, u.usertype, cc.title AS category, s.title AS section,' . + ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,'. + ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug,'. + ' g.name AS groups, s.published AS sec_pub, cc.published AS cat_pub, s.access AS sec_access, cc.access AS cat_access '.$voting['select']. + ' FROM #__content AS a' . + ' LEFT JOIN #__categories AS cc ON cc.id = a.catid' . + ' LEFT JOIN #__sections AS s ON s.id = cc.section AND s.scope = "content"' . + ' LEFT JOIN #__users AS u ON u.id = a.created_by' . + ' LEFT JOIN #__core_acl_axo_groups AS g ON a.access = g.value'. + $voting['join']. + $where; + $this->_db->setQuery($query); + $this->_article = $this->_db->loadObject(); + + if ( ! $this->_article ) { + return false; + } + + if($this->_article->publish_down == $this->_db->getNullDate()) { + $this->_article->publish_down = JText::_('Never'); + } + + // These attributes need to be defined in order for the voting plugin to work + if ( count($voting) && ! isset($this->_article->rating_count) ) { + $this->_article->rating_count = 0; + $this->_article->rating = 0; + } + + return true; + } + return true; + } + + /** + * Method to load content article parameters + * + * @access private + * @return void + * @since 1.5 + */ + function _loadArticleParams() + { + global $mainframe; + + // Get the page/component configuration + $params = clone($mainframe->getParams('com_content')); + + // Merge article parameters into the page configuration + $aparams = new JParameter($this->_article->attribs); + $params->merge($aparams); + + // Set the popup configuration option based on the request + $pop = JRequest::getVar('pop', 0, '', 'int'); + $params->set('popup', $pop); + + // Are we showing introtext with the article + if (!$params->get('show_intro') && !empty($this->_article->fulltext)) { + $this->_article->text = $this->_article->fulltext; + } else { + $this->_article->text = $this->_article->introtext . chr(13).chr(13) . $this->_article->fulltext; + } + + // Set the article object's parameters + $this->_article->parameters = & $params; + } + + /** + * Method to build the WHERE clause of the query to select a content article + * + * @access private + * @return string WHERE clause + * @since 1.5 + */ + function _buildContentWhere() + { + global $mainframe; + + $user =& JFactory::getUser(); + $aid = (int) $user->get('aid', 0); + + $jnow =& JFactory::getDate(); + $now = $jnow->toMySQL(); + $nullDate = $this->_db->getNullDate(); + + /* + * First thing we need to do is assert that the content article is the one + * we are looking for and we have access to it. + */ + $where = ' WHERE a.id = '. (int) $this->_id; + $where .= ' AND a.access <= '. (int) $aid; + + if (!$user->authorize('com_content', 'edit', 'content', 'all')) + { + $where .= ' AND ( '; + $where .= ' ( a.created_by = ' . (int) $user->id . ' ) '; + $where .= ' OR '; + $where .= ' ( a.state = 1' . + ' AND ( a.publish_up = '.$this->_db->Quote($nullDate).' OR a.publish_up <= '.$this->_db->Quote($now).' )' . + ' AND ( a.publish_down = '.$this->_db->Quote($nullDate).' OR a.publish_down >= '.$this->_db->Quote($now).' )'; + $where .= ' ) '; + $where .= ' OR '; + $where .= ' ( a.state = -1 ) '; + $where .= ' ) '; + } + + return $where; + } +} diff --git a/components/com_content/models/category.php b/components/com_content/models/category.php index df61e3ebda05e..a726c6d68e093 100644 --- a/components/com_content/models/category.php +++ b/components/com_content/models/category.php @@ -20,7 +20,6 @@ /** * Content Component Category Model * - * @author Louis Landry * @package Joomla * @subpackage Content * @since 1.5 @@ -62,6 +61,8 @@ class ContentModelCategory extends JModel */ var $_siblings = null; + protected $_content = null; + /** * Constructor * @@ -269,7 +270,7 @@ function _loadSiblings() // Get the parameters of the active menu item $menu =& JSite::getMenu(); - $item = $menu->getActive(); + $item = $menu->getActive(); $params =& $menu->getParams($item->id); if ($user->authorize('com_content', 'edit', 'content', 'all')) @@ -367,7 +368,7 @@ function _buildQuery($state = 1) ' FROM #__content AS a' . ' LEFT JOIN #__categories AS cc ON a.catid = cc.id' . ' LEFT JOIN #__users AS u ON u.id = a.created_by' . - ' LEFT JOIN #__groups AS g ON a.access = g.id'. + ' LEFT JOIN #__core_acl_axo_groups AS g ON a.access = g.value'. $voting['join']. $where. $orderby; @@ -425,14 +426,14 @@ function _buildContentWhere($state = 1) $gid = $user->get('aid', 0); $jnow =& JFactory::getDate(); - $now = $jnow->toMySQL(); + $now = $jnow->toMySQL(); // Get the page/component configuration - $params = &$mainframe->getParams(); + $params = &$mainframe->getParams(); $noauth = !$params->get('show_noauth'); $nullDate = $this->_db->getNullDate(); - $where = ' WHERE 1'; + $where = ' WHERE 1'; // Does the user have access to view the items? if ($noauth) { diff --git a/components/com_content/models/frontpage.php b/components/com_content/models/frontpage.php index 749015c04130e..689c81e7a5e78 100644 --- a/components/com_content/models/frontpage.php +++ b/components/com_content/models/frontpage.php @@ -20,7 +20,6 @@ /** * Frontpage Component Model * - * @author Louis Landry * @package Joomla * @subpackage Content * @since 1.5 @@ -138,7 +137,7 @@ function _buildQuery() ' LEFT JOIN #__categories AS cc ON cc.id = a.catid'. ' LEFT JOIN #__sections AS s ON s.id = a.sectionid'. ' LEFT JOIN #__users AS u ON u.id = a.created_by' . - ' LEFT JOIN #__groups AS g ON a.access = g.id'. + ' LEFT JOIN #__core_acl_axo_groups AS g ON a.access = g.value'. $voting['join']. $where .$orderby @@ -201,7 +200,7 @@ function _buildContentWhere() ' OR ( a.catid = 0 AND a.sectionid = 0 ) )'; $where .= ' AND ( a.publish_up = '.$this->_db->Quote($nullDate).' OR a.publish_up <= '.$this->_db->Quote($now).' )' . - ' AND ( a.publish_down = '.$this->_db->Quote($nullDate).' OR a.publish_down >= '.$this->_db->Quote($now).' )'; + ' AND ( a.publish_down = '.$this->_db->Quote($nullDate).' OR a.publish_down >= '.$this->_db->Quote($now).' )'; } return $where; diff --git a/components/com_content/models/index.html b/components/com_content/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/models/index.html +++ b/components/com_content/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/models/section.php b/components/com_content/models/section.php index 6522e79d6f174..5bc84402208a9 100644 --- a/components/com_content/models/section.php +++ b/components/com_content/models/section.php @@ -20,7 +20,6 @@ /** * Content Component Section Model * - * @author Louis Landry * @package Joomla * @subpackage Content * @since 1.5 @@ -259,6 +258,7 @@ function _loadCategories() { $user =& JFactory::getUser(); + // Get the page/component configuration $params = &$mainframe->getParams(); $noauth = !$params->get('show_noauth'); @@ -266,11 +266,6 @@ function _loadCategories() $now = $mainframe->get('requestTime'); $nullDate = $this->_db->getNullDate(); - // Get the parameters of the active menu item - $menu =& JSite::getMenu(); - $item = $menu->getActive(); - $params =& $menu->getParams($item->id); - // Ordering control $orderby = $params->get('orderby', ''); $orderby = ContentHelperQuery::orderbySecondary($orderby); @@ -425,7 +420,7 @@ function _buildQuery($state = 1) ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . ' LEFT JOIN #__sections AS s ON s.id = a.sectionid' . ' LEFT JOIN #__users AS u ON u.id = a.created_by' . - ' LEFT JOIN #__groups AS g ON a.access = g.id'. + ' LEFT JOIN #__core_acl_axo_groups AS g ON a.access = g.value'. $voting['join']. $where. $orderby; @@ -443,10 +438,9 @@ function _buildContentOrderBy($state = 1) $orderby .= $filter_order .' '. $filter_order_Dir.', '; } - // Get the parameters of the active menu item - $menu =& JSite::getMenu(); - $item = $menu->getActive(); - $params =& $menu->getParams($item->id); + // Get the page/component configuration + $app =& JFactory::getApplication(); + $params =& $app->getParams(); switch ($state) { @@ -487,7 +481,11 @@ function _buildContentWhere($state = 1) $nullDate = $this->_db->getNullDate(); // First thing we need to do is assert that the articles are in the current category - $where = ' WHERE a.access <= '.(int) $aid; + if ($noauth) { + $where = ' WHERE a.access <= '.(int) $aid; + } else { + $where = ' WHERE 1'; + } if ($this->_id) { $where .= ' AND s.id = '.(int)$this->_id; } diff --git a/components/com_content/router.php b/components/com_content/router.php index 5b45fb4627607..47b164368f591 100644 --- a/components/com_content/router.php +++ b/components/com_content/router.php @@ -15,17 +15,52 @@ function ContentBuildRoute(&$query) { $segments = array(); + // get a menu item based on Itemid or currently active + $menu = &JSite::getMenu(); + if (empty($query['Itemid'])) { + $menuItem = &$menu->getActive(); + } else { + $menuItem = &$menu->getItem($query['Itemid']); + } + $mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view']; + $mCatid = (empty($menuItem->query['catid'])) ? null : $menuItem->query['catid']; + $mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id']; + if(isset($query['view'])) { + $view = $query['view']; if(empty($query['Itemid'])) { $segments[] = $query['view']; } + unset($query['view']); + }; + // are we dealing with an article that is attached to a menu item? + if (($mView == 'article') and (isset($query['id'])) and ($mId == intval($query['id']))) { unset($query['view']); - }; + unset($query['catid']); + unset($query['id']); + } + + if (isset($view) and ($view == 'section' && !empty($query['Itemid']))) { + if (($mView != 'section') or ($mView == 'section' and $mId != intval($query['id']))) { + $segments[] = 'section'; + unset($query['Itemid']); + } + } + + if (isset($view) and $view == 'category') { + if ($mId != intval($query['id']) || $mView != $view) { + $segments[] = $query['id']; + } + unset($query['id']); + } - if(isset($query['catid'])) { - $segments[] = $query['catid']; + if (isset($query['catid'])) { + // if we are routing an article or category where the category id matches the menu catid, don't include the category segment + if ((($view == 'article') and ($mView != 'category') and ($mView != 'article') and ($mCatid != intval($query['catid'])))) { + $segments[] = $query['catid']; + } unset($query['catid']); }; @@ -33,10 +68,8 @@ function ContentBuildRoute(&$query) if (empty($query['Itemid'])) { $segments[] = $query['id']; } else { - $menu = &JSite::getMenu(); - $menuItem = &$menu->getItem( $query['Itemid'] ); if (isset($menuItem->query['id'])) { - if($query['id'] != $menuItem->query['id']) { + if($query['id'] != $mId) { $segments[] = $query['id']; } } else { @@ -64,10 +97,13 @@ function ContentBuildRoute(&$query) if(isset($query['layout'])) { - if(!empty($query['Itemid'])) { - $menu = &JSite::getMenu(); - $menuItem = &$menu->getItem( $query['Itemid'] ); + if(!empty($query['Itemid']) && isset($menuItem->query['layout'])) { if ($query['layout'] == $menuItem->query['layout']) { + + unset($query['layout']); + } + } else { + if($query['layout'] == 'default') { unset($query['layout']); } } @@ -91,7 +127,7 @@ function ContentParseRoute($segments) if(!isset($item)) { $vars['view'] = $segments[0]; - $vars['id'] = $segments[$count - 1]; + $vars['id'] = $segments[$count - 1]; return $vars; } @@ -101,11 +137,10 @@ function ContentParseRoute($segments) case 'section' : { if($count == 1) { + $vars['view'] = 'category'; if(isset($item->query['layout']) && $item->query['layout'] == 'blog') { - $vars['view'] = 'article'; - } else { - $vars['view'] = 'category'; + $vars['layout'] = 'blog'; } } @@ -114,7 +149,7 @@ function ContentParseRoute($segments) $vars['catid'] = $segments[$count-2]; } - $vars['id'] = $segments[$count-1]; + $vars['id'] = $segments[$count-1]; } break; @@ -134,15 +169,21 @@ function ContentParseRoute($segments) case 'article' : { - $vars['id'] = $segments[$count-1]; - $vars['view'] = 'article'; + $vars['id'] = $segments[$count-1]; + $vars['view'] = 'article'; } break; case 'archive' : { - $vars['year'] = $segments[$count-2]; - $vars['month'] = $segments[$count-1]; - $vars['view'] = 'archive'; + if($count != 1) + { + $vars['year'] = $count >= 2 ? $segments[$count-2] : null; + $vars['month'] = $segments[$count-1]; + $vars['view'] = 'archive'; + } else { + $vars['id'] = $segments[$count-1]; + $vars['view'] = 'article'; + } } } diff --git a/components/com_content/views/archive/index.html b/components/com_content/views/archive/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/archive/index.html +++ b/components/com_content/views/archive/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/archive/tmpl/default.php b/components/com_content/views/archive/tmpl/default.php index a111627ee9abe..5cf92382bb2de 100644 --- a/components/com_content/views/archive/tmpl/default.php +++ b/components/com_content/views/archive/tmpl/default.php @@ -1,7 +1,7 @@
    -params->get('show_page_title')) : ?> +params->get('show_page_title', 1)) : ?>
    escape($this->params->get('page_title')); ?>

    diff --git a/components/com_content/views/archive/tmpl/index.html b/components/com_content/views/archive/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/archive/tmpl/index.html +++ b/components/com_content/views/archive/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/archive/view.html.php b/components/com_content/views/archive/view.html.php index 0f878542b768b..20eb4ae3fc89b 100644 --- a/components/com_content/views/archive/view.html.php +++ b/components/com_content/views/archive/view.html.php @@ -15,7 +15,7 @@ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die( 'Restricted access' ); -require_once (JPATH_COMPONENT.DS.'view.php'); +require_once JPATH_COMPONENT.DS.'view.php'; /** * HTML View class for the Content component @@ -39,6 +39,7 @@ function display($tpl = null) // Initialize some variables $user =& JFactory::getUser(); $pathway =& $mainframe->getPathway(); + $document =& JFactory::getDocument(); // Get the page/component configuration $params = &$mainframe->getParams('com_content'); @@ -65,6 +66,21 @@ function display($tpl = null) jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', JText::_( 'Archives' )); + } + } else { + $params->set('page_title', JText::_( 'Archives' )); + } + $document->setTitle( $params->get( 'page_title' ) ); + $form = new stdClass(); // Month Field $months = array( diff --git a/components/com_content/views/article/index.html b/components/com_content/views/article/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/article/index.html +++ b/components/com_content/views/article/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/article/tmpl/default.php b/components/com_content/views/article/tmpl/default.php index b66d0a4547555..55cab22abf2ea 100644 --- a/components/com_content/views/article/tmpl/default.php +++ b/components/com_content/views/article/tmpl/default.php @@ -3,13 +3,18 @@ $canEdit = ($this->user->authorize('com_content', 'edit', 'content', 'all') || $this->user->authorize('com_content', 'edit', 'content', 'own')); ?> +params->get('show_page_title', 1) && $this->params->get('page_title') != $this->article->title) : ?> +

    + escape($this->params->get('page_title')); ?> +
    + params->get('show_title') || $this->params->get('show_pdf_icon') || $this->params->get('show_print_icon') || $this->params->get('show_email_icon')) : ?> params->get('show_title')) : ?> - - @@ -105,7 +110,7 @@ params->get('show_url') && $this->article->urls) : ?> - @@ -113,7 +118,7 @@ - - diff --git a/components/com_content/views/article/tmpl/form.php b/components/com_content/views/article/tmpl/form.php index bf04c17fc65e8..10d5236f62bf5 100644 --- a/components/com_content/views/article/tmpl/form.php +++ b/components/com_content/views/article/tmpl/form.php @@ -47,6 +47,9 @@ function submitbutton(pressbutton) { } //--> +params->get('show_page_title', 1)) : ?> +
    escape($this->params->get('page_title')); ?>
    +
    @@ -58,6 +61,7 @@ function submitbutton(pressbutton) { : +
    @@ -147,7 +151,7 @@ function submitbutton(pressbutton) { diff --git a/components/com_content/views/article/tmpl/index.html b/components/com_content/views/article/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/article/tmpl/index.html +++ b/components/com_content/views/article/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/article/view.html.php b/components/com_content/views/article/view.html.php index eb2bd9408cd9f..2ea381765712e 100644 --- a/components/com_content/views/article/view.html.php +++ b/components/com_content/views/article/view.html.php @@ -1,342 +1,378 @@ -getPathway(); - $params =& $mainframe->getParams('com_content'); - - // Initialize variables - $article =& $this->get('Article'); - $aparams =& $article->parameters; - $params->merge($aparams); - - // Get the menu item object - $menus = &JSite::getMenu(); - $menu = $menus->getActive(); - - if($this->getLayout() == 'pagebreak') { - $this->_displayPagebreak($tpl); - return; - } - - if($this->getLayout() == 'form') { - $this->_displayForm($tpl); - return; - } - - if (($article->id == 0)) - { - $id = JRequest::getVar( 'id', '', 'default', 'int' ); - return JError::raiseError( 404, JText::sprintf( 'Article # not found', $id ) ); - } - - $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); - - // Create a user access object for the current user - $access = new stdClass(); - $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all'); - $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own'); - $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); - - // Check to see if the user has access to view the full article - if ($article->access <= $user->get('aid', 0)) { - $article->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid));; - } else { - $article->readmore_link = JRoute::_("index.php?option=com_user&task=register"); - } - - /* - * Process the prepare content plugins - */ - JPluginHelper::importPlugin('content'); - $results = $dispatcher->trigger('onPrepareContent', array (& $article, & $params, $limitstart)); - - /* - * Handle the metadata - */ - $document->setTitle($article->title); - - if ($article->metadesc) { - $document->setDescription( $article->metadesc ); - } - if ($article->metakey) { - $document->setMetadata('keywords', $article->metakey); - } - - if ($mainframe->getCfg('MetaTitle') == '1') { - $mainframe->addMetaTag('title', $article->title); - } - if ($mainframe->getCfg('MetaAuthor') == '1') { - $mainframe->addMetaTag('author', $article->author); - } - - $mdata = new JParameter($article->metadata); - $mdata = $mdata->toArray(); - foreach ($mdata as $k => $v) - { - if ($v) { - $document->setMetadata($k, $v); - } - } - - // If there is a pagebreak heading or title, add it to the page title - if (!empty($article->page_title)) - { - $article->title = $article->title .' - '. $article->page_title; - $document->setTitle($article->page_title.' - '.JText::sprintf('Page %s', $limitstart + 1)); - } - - /* - * Handle the breadcrumbs - */ - if($menu && $menu->query['view'] != 'article') - { - switch ($menu->query['view']) - { - case 'section': - $pathway->addItem($article->category, 'index.php?view=category&id='.$article->catslug); - $pathway->addItem($article->title, ''); - break; - case 'category': - $pathway->addItem($article->title, ''); - break; - } - } - - /* - * Handle display events - */ - $article->event = new stdClass(); - $results = $dispatcher->trigger('onAfterDisplayTitle', array ($article, &$params, $limitstart)); - $article->event->afterDisplayTitle = trim(implode("\n", $results)); - - $results = $dispatcher->trigger('onBeforeDisplayContent', array (& $article, & $params, $limitstart)); - $article->event->beforeDisplayContent = trim(implode("\n", $results)); - - $results = $dispatcher->trigger('onAfterDisplayContent', array (& $article, & $params, $limitstart)); - $article->event->afterDisplayContent = trim(implode("\n", $results)); - - $print = JRequest::getBool('print'); - - $this->assignRef('article', $article); - $this->assignRef('params' , $params); - $this->assignRef('user' , $user); - $this->assignRef('access' , $access); - $this->assignRef('print', $print); - - parent::display($tpl); - } - - function _displayForm($tpl) - { - global $mainframe; - - // Initialize variables - $document =& JFactory::getDocument(); - $user =& JFactory::getUser(); - $uri =& JFactory::getURI(); - - // Make sure you are logged in and have the necessary access rights - if ($user->get('gid') < 19) { - JError::raiseError( 403, JText::_('ALERTNOTAUTH') ); - return; - } - - // Initialize variables - $article =& $this->get('Article'); - $params =& $article->parameters; - $isNew = ($article->id < 1); - - // At some point in the future this will come from a request object - $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); - - // Add the Calendar includes to the document section - JHTML::_('behavior.calendar'); - - if ($isNew) - { - // TODO: Do we allow non-sectioned articles from the frontend?? - $article->sectionid = JRequest::getVar('sectionid', 0, '', 'int'); - $db = JFactory::getDBO(); - $db->setQuery('SELECT title FROM #__sections WHERE id = '.(int) $article->sectionid); - $article->section = $db->loadResult(); - } - - // Get the lists - $lists = $this->_buildEditLists(); - - // Load the JEditor object - $editor =& JFactory::getEditor(); - - // Build the page title string - $title = $article->id ? JText::_('Edit') : JText::_('New'); - - // Set page title - $document->setTitle($title); - - // get pathway - $pathway =& $mainframe->getPathWay(); - $pathway->addItem($title, ''); - - // Unify the introtext and fulltext fields and separated the fields by the {readmore} tag - if (JString::strlen($article->fulltext) > 1) { - $article->text = $article->introtext."
    ".$article->fulltext; - } else { - $article->text = $article->introtext; - } - - // Ensure the row data is safe html - JFilterOutput::objectHTMLSafe( $article); - - $this->assign('action', $uri->toString()); - - $this->assignRef('article', $article); - $this->assignRef('params', $params); - $this->assignRef('lists', $lists); - $this->assignRef('editor', $editor); - $this->assignRef('user', $user); - - - parent::display($tpl); - } - - function _buildEditLists() - { - // Get the article and database connector from the model - $article = & $this->get('Article'); - $db = & JFactory::getDBO(); - - $javascript = "onchange=\"changeDynaList( 'catid', sectioncategories, document.adminForm.sectionid.options[document.adminForm.sectionid.selectedIndex].value, 0, 0);\""; - - $query = 'SELECT s.id, s.title' . - ' FROM #__sections AS s' . - ' ORDER BY s.ordering'; - $db->setQuery($query); - - $sections[] = JHTML::_('select.option', '-1', '- '.JText::_('Select Section').' -', 'id', 'title'); - $sections[] = JHTML::_('select.option', '0', JText::_('Uncategorized'), 'id', 'title'); - $sections = array_merge($sections, $db->loadObjectList()); - $lists['sectionid'] = JHTML::_('select.genericlist', $sections, 'sectionid', 'class="inputbox" size="1" '.$javascript, 'id', 'title', intval($article->sectionid)); - - foreach ($sections as $section) - { - $section_list[] = (int) $section->id; - // get the type name - which is a special category - if ($article->sectionid) { - if ($section->id == $article->sectionid) { - $contentSection = $section->title; - } - } else { - if ($section->id == $article->sectionid) { - $contentSection = $section->title; - } - } - } - - $sectioncategories = array (); - $sectioncategories[-1] = array (); - $sectioncategories[-1][] = JHTML::_('select.option', '-1', JText::_( 'Select Category' ), 'id', 'title'); - $section_list = implode('\', \'', $section_list); - - $query = 'SELECT id, title, section' . - ' FROM #__categories' . - ' WHERE section IN ( \''.$section_list.'\' )' . - ' ORDER BY ordering'; - $db->setQuery($query); - $cat_list = $db->loadObjectList(); - - // Uncategorized category mapped to uncategorized section - $uncat = new stdClass(); - $uncat->id = 0; - $uncat->title = JText::_('Uncategorized'); - $uncat->section = 0; - $cat_list[] = $uncat; - foreach ($sections as $section) - { - $sectioncategories[$section->id] = array (); - $rows2 = array (); - foreach ($cat_list as $cat) - { - if ($cat->section == $section->id) { - $rows2[] = $cat; - } - } - foreach ($rows2 as $row2) { - $sectioncategories[$section->id][] = JHTML::_('select.option', $row2->id, $row2->title, 'id', 'title'); - } - } - - $categories = array(); - foreach ($cat_list as $cat) { - if($cat->section == $article->sectionid) - $categories[] = $cat; - } - - $categories[] = JHTML::_('select.option', '-1', JText::_( 'Select Category' ), 'id', 'title'); - $lists['sectioncategories'] = $sectioncategories; - $lists['catid'] = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1"', 'id', 'title', intval($article->catid)); - - // Select List: Category Ordering - $query = 'SELECT ordering AS value, title AS text FROM #__content WHERE catid = '.(int) $article->catid.' ORDER BY ordering'; - $lists['ordering'] = JHTML::_('list.specificordering', $article, $article->id, $query, 1); - - // Radio Buttons: Should the article be published - $lists['state'] = JHTML::_('select.booleanlist', 'state', '', $article->state); - - // Radio Buttons: Should the article be added to the frontpage - if($article->id) { - $query = 'SELECT content_id FROM #__content_frontpage WHERE content_id = '. (int) $article->id; - $db->setQuery($query); - $article->frontpage = $db->loadResult(); - } else { - $article->frontpage = 0; - } - - $lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', (boolean) $article->frontpage); - - // Select List: Group Access - $lists['access'] = JHTML::_('list.accesslevel', $article); - - return $lists; - } - - function _displayPagebreak($tpl) - { - $document =& JFactory::getDocument(); - $document->setTitle(JText::_('PGB ARTICLE PAGEBRK')); - - parent::display($tpl); - } -} -?> +getPathway(); + $params = JComponentHelper::getParams('com_content'); + + // Initialize variables + $article =& $this->get('Article'); + $aparams = $article->parameters; + $params->merge($aparams); + + if($this->getLayout() == 'pagebreak') { + $this->_displayPagebreak($tpl); + return; + } + + if($this->getLayout() == 'form') { + $this->_displayForm($tpl); + return; + } + + if (($article->id == 0)) + { + $id = JRequest::getVar( 'id', '', 'default', 'int' ); + return JError::raiseError( 404, JText::sprintf( 'Article # not found', $id ) ); + } + + $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); + + // Create a user access object for the current user + $access = new stdClass(); + $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all'); + $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own'); + $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); + + // Check to see if the user has access to view the full article + if ($article->access <= $user->get('aid', 0)) { + $article->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid));; + } else { + $article->readmore_link = JRoute::_("index.php?option=com_user&task=register"); + } + + /* + * Process the prepare content plugins + */ + JPluginHelper::importPlugin('content'); + $results = $dispatcher->trigger('onPrepareContent', array (& $article, & $params, $limitstart)); + + /* + * Handle the metadata + */ + // because the application sets a default page title, we need to get it + // right from the menu item itself + // Get the menu item object + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + if (is_object( $menu ) && isset($menu->query['view']) && $menu->query['view'] == 'article' && isset($menu->query['id']) && $menu->query['id'] == $article->id) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', $article->title); + } + } else { + $params->set('page_title', $article->title); + } + $document->setTitle( $params->get( 'page_title' ) ); + + if ($article->metadesc) { + $document->setDescription( $article->metadesc ); + } + if ($article->metakey) { + $document->setMetadata('keywords', $article->metakey); + } + + if ($app->getCfg('MetaTitle') == '1') { + $document->setMetadata('title', $article->title); + } + if ($app->getCfg('MetaAuthor') == '1') { + $document->setMetadata('author', $article->author); + } + + $mdata = new JParameter($article->metadata); + $mdata = $mdata->toArray(); + foreach ($mdata as $k => $v) + { + if ($v) { + $document->setMetadata($k, $v); + } + } + + // If there is a pagebreak heading or title, add it to the page title + if (!empty($article->page_title)) + { + $article->title = $article->title .' - '. $article->page_title; + $document->setTitle($article->page_title.' - '.JText::sprintf('Page %s', $limitstart + 1)); + } + + /* + * Handle the breadcrumbs + */ + if($menu && $menu->query['view'] != 'article') + { + switch ($menu->query['view']) + { + case 'section': + $pathway->addItem($article->category, 'index.php?view=category&id='.$article->catslug); + $pathway->addItem($article->title, ''); + break; + case 'category': + $pathway->addItem($article->title, ''); + break; + } + } + + /* + * Handle display events + */ + $article->event = new stdClass(); + $results = $dispatcher->trigger('onAfterDisplayTitle', array ($article, &$params, $limitstart)); + $article->event->afterDisplayTitle = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onBeforeDisplayContent', array (& $article, & $params, $limitstart)); + $article->event->beforeDisplayContent = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onAfterDisplayContent', array (& $article, & $params, $limitstart)); + $article->event->afterDisplayContent = trim(implode("\n", $results)); + + $print = JRequest::getBool('print'); + + $this->assignRef('article', $article); + $this->assignRef('params' , $params); + $this->assignRef('user' , $user); + $this->assignRef('access' , $access); + $this->assignRef('print', $print); + + parent::display($tpl); + } + + function _displayForm($tpl) + { + // Initialize variables + $app =& JFactory::getApplication(); + $document =& JFactory::getDocument(); + $user =& JFactory::getUser(); + $uri =& JFactory::getURI(); + $params = JComponentHelper::getParams('com_content'); + + // Make sure you are logged in and have the necessary access rights + if ($user->get('gid') < 19) { + JResponse::setHeader('HTTP/1.0 403',true); + JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') ); + return; + } + + // Initialize variables + $article =& $this->get('Article'); + $aparams = $article->parameters; + $isNew = ($article->id < 1); + + $params->merge($aparams); + + // At some point in the future this will come from a request object + $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); + + // Add the Calendar includes to the document section + JHTML::_('behavior.calendar'); + + if ($isNew) + { + // TODO: Do we allow non-sectioned articles from the frontend?? + $article->sectionid = JRequest::getVar('sectionid', 0, '', 'int'); + $db = JFactory::getDBO(); + $db->setQuery('SELECT title FROM #__sections WHERE id = '.(int) $article->sectionid); + $article->section = $db->loadResult(); + } + + // Get the lists + $lists = $this->_buildEditLists(); + + // Load the JEditor object + $editor =& JFactory::getEditor(); + + // Build the page title string + $title = $article->id ? JText::_('Edit') : JText::_('New'); + + // Set page title + // because the application sets a default page title, we need to get it + // right from the menu item itself + // Get the menu item object + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + $params->set( 'page_title', $params->get( 'page_title' ) ); + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', JText::_( 'Submit an Article' )); + } + } else { + $params->set('page_title', JText::_( 'Submit an Article' )); + } + $document->setTitle( $params->get( 'page_title' ) ); + + // get pathway + $pathway =& $app->getPathway(); + $pathway->addItem($title, ''); + + // Unify the introtext and fulltext fields and separated the fields by the {readmore} tag + if (JString::strlen($article->fulltext) > 1) { + $article->text = $article->introtext."
    ".$article->fulltext; + } else { + $article->text = $article->introtext; + } + + // Ensure the row data is safe html + JFilterOutput::objectHTMLSafe( $article); + + $this->assign('action', $uri->toString()); + + $this->assignRef('article', $article); + $this->assignRef('params', $params); + $this->assignRef('lists', $lists); + $this->assignRef('editor', $editor); + $this->assignRef('user', $user); + + + parent::display($tpl); + } + + function _buildEditLists() + { + // Get the article and database connector from the model + $article = & $this->get('Article'); + $db = & JFactory::getDBO(); + + $javascript = "onchange=\"changeDynaList( 'catid', sectioncategories, document.adminForm.sectionid.options[document.adminForm.sectionid.selectedIndex].value, 0, 0);\""; + + $query = 'SELECT s.id, s.title' . + ' FROM #__sections AS s' . + ' ORDER BY s.ordering'; + $db->setQuery($query); + + $sections[] = JHTML::_('select.option', '-1', '- '.JText::_('Select Section').' -', 'id', 'title'); + $sections[] = JHTML::_('select.option', '0', JText::_('Uncategorized'), 'id', 'title'); + $sections = array_merge($sections, $db->loadObjectList()); + $lists['sectionid'] = JHTML::_('select.genericlist', $sections, 'sectionid', 'class="inputbox" size="1" '.$javascript, 'id', 'title', intval($article->sectionid)); + + foreach ($sections as $section) + { + $section_list[] = (int) $section->id; + // get the type name - which is a special category + if ($article->sectionid) { + if ($section->id == $article->sectionid) { + $contentSection = $section->title; + } + } else { + if ($section->id == $article->sectionid) { + $contentSection = $section->title; + } + } + } + + $sectioncategories = array (); + $sectioncategories[-1] = array (); + $sectioncategories[-1][] = JHTML::_('select.option', '-1', JText::_( 'Select Category' ), 'id', 'title'); + $section_list = implode('\', \'', $section_list); + + $query = 'SELECT id, title, section' . + ' FROM #__categories' . + ' WHERE section IN ( \''.$section_list.'\' )' . + ' ORDER BY ordering'; + $db->setQuery($query); + $cat_list = $db->loadObjectList(); + + // Uncategorized category mapped to uncategorized section + $uncat = new stdClass(); + $uncat->id = 0; + $uncat->title = JText::_('Uncategorized'); + $uncat->section = 0; + $cat_list[] = $uncat; + foreach ($sections as $section) + { + $sectioncategories[$section->id] = array (); + $rows2 = array (); + foreach ($cat_list as $cat) + { + if ($cat->section == $section->id) { + $rows2[] = $cat; + } + } + foreach ($rows2 as $row2) { + $sectioncategories[$section->id][] = JHTML::_('select.option', $row2->id, $row2->title, 'id', 'title'); + } + } + + $categories = array(); + foreach ($cat_list as $cat) { + if($cat->section == $article->sectionid) + $categories[] = $cat; + } + + $categories[] = JHTML::_('select.option', '-1', JText::_( 'Select Category' ), 'id', 'title'); + $lists['sectioncategories'] = $sectioncategories; + $lists['catid'] = JHTML::_('select.genericlist', $categories, 'catid', 'class="inputbox" size="1"', 'id', 'title', intval($article->catid)); + + // Select List: Category Ordering + $query = 'SELECT ordering AS value, title AS text FROM #__content WHERE catid = '.(int) $article->catid.' ORDER BY ordering'; + $lists['ordering'] = JHTML::_('list.specificordering', $article, $article->id, $query, 1); + + // Radio Buttons: Should the article be published + $lists['state'] = JHTML::_('select.booleanlist', 'state', '', $article->state); + + // Radio Buttons: Should the article be added to the frontpage + if($article->id) { + $query = 'SELECT content_id FROM #__content_frontpage WHERE content_id = '. (int) $article->id; + $db->setQuery($query); + $article->frontpage = $db->loadResult(); + } else { + $article->frontpage = 0; + } + + $lists['frontpage'] = JHTML::_('select.booleanlist', 'frontpage', '', (boolean) $article->frontpage); + + // Select List: Group Access + $lists['access'] = JHTML::_('list.accesslevel', $article); + + return $lists; + } + + function _displayPagebreak($tpl) + { + $document =& JFactory::getDocument(); + $document->setTitle(JText::_('PGB ARTICLE PAGEBRK')); + + parent::display($tpl); + } +} +?> diff --git a/components/com_content/views/category/index.html b/components/com_content/views/category/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/category/index.html +++ b/components/com_content/views/category/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/category/tmpl/blog.php b/components/com_content/views/category/tmpl/blog.php index 035df083e0347..1f015240b6c64 100644 --- a/components/com_content/views/category/tmpl/blog.php +++ b/components/com_content/views/category/tmpl/blog.php @@ -1,8 +1,8 @@ -params->get('show_page_title')) : ?> +?> +params->get('show_page_title', 1)) : ?>
    escape($this->params->get('page_title')); ?>
    diff --git a/components/com_content/views/category/tmpl/blog_item.php b/components/com_content/views/category/tmpl/blog_item.php index bbe2d5e889e7d..f2cec43ba5613 100644 --- a/components/com_content/views/category/tmpl/blog_item.php +++ b/components/com_content/views/category/tmpl/blog_item.php @@ -11,7 +11,7 @@ item->params->get('show_title')) : ?> - - - + + +
    params->get('link_titles') && $this->article->readmore_link != '') : ?> - + escape($this->article->title); ?> escape($this->article->title); ?> @@ -86,7 +91,7 @@ params->get('show_author')) && ($this->article->author != "")) : ?>
    + article->created_by_alias ? $this->article->created_by_alias : $this->article->author) ); ?> @@ -97,7 +102,7 @@ params->get('show_create_date')) : ?>
    + article->created, JText::_('DATE_FORMAT_LC2')) ?>
    + article->urls; ?>
    + article->toc)) : ?> article->toc; ?> @@ -123,7 +128,7 @@ article->modified) !=0 && $this->params->get('show_modify_date')) : ?>
    + ( article->modified, JText::_('DATE_FORMAT_LC2')); ?> )
    - article->publish_up, 'publish_up', 'publish_up', '%Y-%m-%d %H:%M:%S', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?> + article->publish_up, 'publish_up', 'publish_up', '%Y-%m-%d %H:%M:%S', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?>
    - article->publish_down, 'publish_down', 'publish_down', '%Y-%m-%d %H:%M:%S', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?> + article->publish_down, 'publish_down', 'publish_down', '%Y-%m-%d %H:%M:%S', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?>
    item->params->get('link_titles') && $this->item->readmore_link != '') : ?> - + escape($this->item->title); ?> escape($this->item->title); ?> @@ -36,11 +36,11 @@ item, $this->item->params, $this->access); ?> - item, $this->item->params, $this->access); ?> - + item, $this->item->params, $this->access); ?> +
    diff --git a/components/com_content/views/category/tmpl/blog_links.php b/components/com_content/views/category/tmpl/blog_links.php index ac06a9b74999c..d91a5c86e3521 100644 --- a/components/com_content/views/category/tmpl/blog_links.php +++ b/components/com_content/views/category/tmpl/blog_links.php @@ -6,7 +6,7 @@
      links as $link) : ?>
    • - + title; ?>
    • diff --git a/components/com_content/views/category/tmpl/default.php b/components/com_content/views/category/tmpl/default.php index b180c3bc6c08c..1c40ba9736b90 100644 --- a/components/com_content/views/category/tmpl/default.php +++ b/components/com_content/views/category/tmpl/default.php @@ -2,10 +2,10 @@ defined('_JEXEC') or die('Restricted access'); $cparams =& JComponentHelper::getParams('com_media'); ?> -params->get('show_page_title')) : ?> -
      - escape($this->category->title); ?> -
      +params->get('show_page_title', 1)) : ?> +
      + escape($this->params->get('page_title')); ?> +
      diff --git a/components/com_content/views/category/tmpl/default.xml b/components/com_content/views/category/tmpl/default.xml index 2bcf6a300e9aa..30ae025543200 100644 --- a/components/com_content/views/category/tmpl/default.xml +++ b/components/com_content/views/category/tmpl/default.xml @@ -12,6 +12,17 @@ + + + + + + + + + + + diff --git a/components/com_content/views/category/tmpl/default_items.php b/components/com_content/views/category/tmpl/default_items.php index c259b011badab..840bc39c1d3d6 100644 --- a/components/com_content/views/category/tmpl/default_items.php +++ b/components/com_content/views/category/tmpl/default_items.php @@ -72,7 +72,7 @@ function tableOrdering( order, dir, task ) params->get('show_title')) : ?> access <= $this->user->get('aid', 0)) : ?> diff --git a/components/com_content/views/category/tmpl/index.html b/components/com_content/views/category/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/category/tmpl/index.html +++ b/components/com_content/views/category/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/category/view.feed.php b/components/com_content/views/category/view.feed.php index 27f9f6dfed4b9..33fec755bf2c2 100644 --- a/components/com_content/views/category/view.feed.php +++ b/components/com_content/views/category/view.feed.php @@ -30,14 +30,16 @@ function display() { global $mainframe; - $doc =& JFactory::getDocument(); + $doc =& JFactory::getDocument(); $params =& $mainframe->getParams(); - $doc->link = JRoute::_('index.php?option=com_content&view=category&id='.JRequest::getVar('id',null, '', 'int')); // Get some data from the model JRequest::setVar('limit', $mainframe->getCfg('feed_limit')); + $category = & $this->get( 'Category' ); $rows = & $this->get( 'Data' ); + $doc->link = JRoute::_(ContentHelperRoute::getCategoryRoute($category->id, $cagtegory->sectionid)); + foreach ( $rows as $row ) { // strip html from feed item title @@ -46,7 +48,7 @@ function display() // url link to article // & used instead of & as this is converted by feed creator - $link = JRoute::_('index.php?option=com_content&view=article&id='. $row->slug .'&catid='.$row->catslug ); + $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid)); // strip html from feed item description text $description = ($params->get('feed_summary', 0) ? $row->introtext.$row->fulltext : $row->introtext); @@ -66,4 +68,3 @@ function display() } } } -?> diff --git a/components/com_content/views/category/view.html.php b/components/com_content/views/category/view.html.php index 664d4c44f6265..3ebc7e18d9942 100644 --- a/components/com_content/views/category/view.html.php +++ b/components/com_content/views/category/view.html.php @@ -15,7 +15,7 @@ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die( 'Restricted access' ); -require_once (JPATH_COMPONENT.DS.'view.php'); +require_once JPATH_COMPONENT.DS.'view.php'; /** * HTML View class for the Content component @@ -26,6 +26,19 @@ */ class ContentViewCategory extends ContentView { + protected $_params = null; + public $total = null; + public $access = null; + public $action = null; + public $items = null; + public $item = null; + public $params = null; + public $category = null; + public $user = null; + public $pagination = null; + public $lists = null; + public $links = array(); + function display($tpl = null) { global $mainframe, $option; @@ -44,10 +57,8 @@ function display($tpl = null) $params = clone($mainframe->getParams('com_content')); // Request variables - $layout = JRequest::getCmd('layout'); + $layout = JRequest::getCmd('layout'); $task = JRequest::getCmd('task'); - $limit = $mainframe->getUserStateFromRequest('com_content.'.$this->getLayout().'.limit', 'limit', $params->def('display_num', 0), 'int'); - $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // Parameters $params->def('num_leading_articles', 1); @@ -64,10 +75,16 @@ function display($tpl = null) $leading = $params->get('num_leading_articles'); $links = $params->get('num_links'); - //In case we are in a blog view set the limit + $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); + if ($layout == 'blog') { - if ($limit == 0) $limit = $intro + $leading + $links; + $default_limit = $intro + $leading + $links; + } else { + $params->def('display_num', $mainframe->getCfg('list_limit')); + $default_limit = $params->get('display_num'); } + $limit = $mainframe->getUserStateFromRequest('com_content.'.$this->getLayout().'.limit', 'limit', $default_limit, 'int'); + JRequest::setVar('limit', (int) $limit); $contentConfig = &JComponentHelper::getParams('com_content'); @@ -95,7 +112,17 @@ function display($tpl = null) $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); // Set page title per category - $document->setTitle($category->title. ' - '. $params->get( 'page_title')); + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', $category->title); + } + } else { + $params->set('page_title', $category->title); + } + $document->setTitle( $params->get( 'page_title' ) ); //set breadcrumbs if(is_object($menu) && $menu->query['view'] != 'category') { @@ -137,6 +164,7 @@ function &getItems() global $mainframe; //create select lists + $user = &JFactory::getUser(); $lists = $this->_buildSortLists(); if (!count( $this->items ) ) @@ -155,11 +183,21 @@ function &getItems() $i = 0; foreach($this->items as $key => $item) { - $item->link = JRoute::_('index.php?view=article&catid='.$this->category->slug.'&id='.$item->slug); + // checks if the item is a public or registered/special item + if ($item->access <= $user->get('aid', 0)) + { + $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid)); + $item->readmore_register = false; + } + else + { + $item->link = JRoute::_('index.php?option=com_user&task=register'); + $item->readmore_register = true; + } $item->created = JHTML::_('date', $item->created, $this->params->get('date_format')); $item->odd = $k; - $item->count = $i; + $item->count = $i; $this->items[$key] = $item; $k = 1 - $k; @@ -181,12 +219,12 @@ function &getItem($index = 0, &$params) $SiteName = $mainframe->getCfg('sitename'); - $item =& $this->items[$index]; - $item->text = $item->introtext; + $item =& $this->items[$index]; + $item->text = $item->introtext; - $category = & $this->get( 'Category' ); - $item->category = $category->title; - $item->section = $category->sectiontitle; + $category = & $this->get( 'Category' ); + $item->category = $category->title; + $item->section = $category->sectiontitle; // Get the page/component configuration and article parameters $item->params = clone($params); @@ -236,12 +274,12 @@ function _buildSortLists() $filter_order = JRequest::getCmd('filter_order'); $filter_order_Dir = JRequest::getCmd('filter_order_Dir'); - $lists['task'] = 'category'; - $lists['filter'] = $filter; - $lists['order'] = $filter_order; - $lists['order_Dir'] = $filter_order_Dir; + $lists['task'] = 'category'; + $lists['filter'] = $filter; + $lists['order'] = $filter_order; + $lists['order_Dir'] = $filter_order_Dir; return $lists; } } -?> \ No newline at end of file +?> diff --git a/components/com_content/views/frontpage/index.html b/components/com_content/views/frontpage/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/frontpage/index.html +++ b/components/com_content/views/frontpage/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/frontpage/tmpl/default.php b/components/com_content/views/frontpage/tmpl/default.php index a91ec998f4344..6d61ba7653100 100644 --- a/components/com_content/views/frontpage/tmpl/default.php +++ b/components/com_content/views/frontpage/tmpl/default.php @@ -1,6 +1,6 @@ -params->get('show_page_title')) : ?> +params->get('show_page_title', 1)) : ?>
      escape($this->params->get('page_title')); ?>
      @@ -35,8 +35,8 @@ for ($z = 0; $z < $this->params->def('num_columns', 2); $z ++) : if ($z > 0) : $divider = " column_separator"; endif; ?> params->get('num_intro_articles', 4) / $this->params->get('num_columns')); - $cols = ($this->params->get('num_intro_articles', 4) % $this->params->get('num_columns')); + $rows = (int) ($this->params->get('num_intro_articles', 4) / $this->params->get('num_columns')); + $cols = ($this->params->get('num_intro_articles', 4) % $this->params->get('num_columns')); ?> +params->get('show_other_cats', 1)): ?> + + + +
      - + title; ?> item = $item; echo JHTML::_('icon.edit', $item, $this->params, $this->access) ?> item->params->get('show_title')) : ?> item->params->get('link_titles') && $this->item->readmore_link != '') : ?> - + item->title; ?> escape($this->item->title); ?> @@ -74,7 +74,7 @@ item->catslug, $this->item->sectionid)).'">'; ?> item->category; ?> - item->params->get('link_section')) : ?> + item->params->get('link_category')) : ?> '; ?> diff --git a/components/com_content/views/frontpage/tmpl/index.html b/components/com_content/views/frontpage/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/frontpage/tmpl/index.html +++ b/components/com_content/views/frontpage/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/frontpage/view.html.php b/components/com_content/views/frontpage/view.html.php index 53d7621b1e502..e293755c1b8b2 100644 --- a/components/com_content/views/frontpage/view.html.php +++ b/components/com_content/views/frontpage/view.html.php @@ -1,149 +1,171 @@ -getParams(); - - // parameters - $intro = $params->def('num_intro_articles', 4); - $leading = $params->def('num_leading_articles', 1); - $links = $params->def('num_links', 4); - - $descrip = $params->def('show_description', 1); - $descrip_image = $params->def('show_description_image',1); - - $params->set('show_intro', 1); - - $limit = $intro + $leading + $links; - JRequest::setVar('limit', (int) $limit); - - //set data model - $items =& $this->get('data' ); - $total =& $this->get('total'); - - // Create a user access object for the user - $access = new stdClass(); - $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all'); - $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own'); - $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); - - //add alternate feed link - if($params->get('show_feed_link', 1) == 1) - { - $link = '&format=feed&limitstart='; - $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); - $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); - $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); - $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); - } - - jimport('joomla.html.pagination'); - $this->pagination = new JPagination($total, $limitstart, $limit - $links); - - $this->assign('total', $total); - - $this->assignRef('user', $user); - $this->assignRef('access', $access); - $this->assignRef('params', $params); - $this->assignRef('items', $items); - - parent::display($tpl); - } - - function &getItem($index = 0, &$params) - { - global $mainframe; - - // Initialize some variables - $user =& JFactory::getUser(); - $dispatcher =& JDispatcher::getInstance(); - - $SiteName = $mainframe->getCfg('sitename'); - - $task = JRequest::getCmd('task'); - - $linkOn = null; - $linkText = null; - - $item =& $this->items[$index]; - $item->text = $item->introtext; - - // Get the page/component configuration and article parameters - $item->params = clone($params); - $aparams = new JParameter($item->attribs); - - // Merge article parameters into the page configuration - $item->params->merge($aparams); - - // Process the content preparation plugins - JPluginHelper::importPlugin('content'); - $results = $dispatcher->trigger('onPrepareContent', array (& $item, & $item->params, 0)); - - // Build the link and text of the readmore button - if (($item->params->get('show_readmore') && @ $item->readmore) || $item->params->get('link_titles')) - { - // checks if the item is a public or registered/special item - if ($item->access <= $user->get('aid', 0)) - { - $item->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid)); - $item->readmore_register = false; - } - else - { - $item->readmore_link = JRoute::_("index.php?option=com_user&task=register"); - $item->readmore_register = true; - } - } - - $item->event = new stdClass(); - $results = $dispatcher->trigger('onAfterDisplayTitle', array (& $item, & $item->params,0)); - $item->event->afterDisplayTitle = trim(implode("\n", $results)); - - $results = $dispatcher->trigger('onBeforeDisplayContent', array (& $item, & $item->params, 0)); - $item->event->beforeDisplayContent = trim(implode("\n", $results)); - - $results = $dispatcher->trigger('onAfterDisplayContent', array (& $item, & $item->params, 0)); - $item->event->afterDisplayContent = trim(implode("\n", $results)); - - return $item; - } -} \ No newline at end of file +getParams(); + // parameters + $intro = $params->def('num_intro_articles', 4); + $leading = $params->def('num_leading_articles', 1); + $links = $params->def('num_links', 4); + + $descrip = $params->def('show_description', 1); + $descrip_image = $params->def('show_description_image',1); + + $params->set('show_intro', 1); + + $limit = $intro + $leading + $links; + JRequest::setVar('limit', (int) $limit); + + //set data model + $items =& $this->get('data' ); + $total =& $this->get('total'); + + // Create a user access object for the user + $access = new stdClass(); + $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all'); + $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own'); + $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); + + //add alternate feed link + if($params->get('show_feed_link', 1) == 1) + { + $link = '&format=feed&limitstart='; + $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); + $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); + $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); + $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); + } + + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', htmlspecialchars_decode($mainframe->getCfg('sitename' ))); + } + } else { + $params->set('page_title', htmlspecialchars_decode($mainframe->getCfg('sitename' ))); + } + $document->setTitle( $params->get( 'page_title' ) ); + + jimport('joomla.html.pagination'); + $this->pagination = new JPagination($total, $limitstart, $limit - $links); + + $this->assign('total', $total); + + $this->assignRef('user', $user); + $this->assignRef('access', $access); + $this->assignRef('params', $params); + $this->assignRef('items', $items); + parent::display($tpl); + } + + function &getItem($index = 0, &$params) + { + global $mainframe; + + // Initialize some variables + $user =& JFactory::getUser(); + $dispatcher =& JDispatcher::getInstance(); + + $SiteName = $mainframe->getCfg('sitename'); + + $task = JRequest::getCmd('task'); + + $linkOn = null; + $linkText = null; + + $item =& $this->items[$index]; + $item->text = $item->introtext; + + // Get the page/component configuration and article parameters + $item->params = clone($params); + $aparams = new JParameter($item->attribs); + + // Merge article parameters into the page configuration + $item->params->merge($aparams); + + // Process the content preparation plugins + JPluginHelper::importPlugin('content'); + $results = $dispatcher->trigger('onPrepareContent', array (& $item, & $item->params, 0)); + + // Build the link and text of the readmore button + if (($item->params->get('show_readmore') && @ $item->readmore) || $item->params->get('link_titles')) + { + // checks if the item is a public or registered/special item + if ($item->access <= $user->get('aid', 0)) + { + $item->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid)); + $item->readmore_register = false; + } + else + { + $item->readmore_link = JRoute::_("index.php?option=com_user&task=register"); + $item->readmore_register = true; + } + } + + $item->event = new stdClass(); + $results = $dispatcher->trigger('onAfterDisplayTitle', array (& $item, & $item->params,0)); + $item->event->afterDisplayTitle = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onBeforeDisplayContent', array (& $item, & $item->params, 0)); + $item->event->beforeDisplayContent = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onAfterDisplayContent', array (& $item, & $item->params, 0)); + $item->event->afterDisplayContent = trim(implode("\n", $results)); + + return $item; + } +} diff --git a/components/com_content/views/index.html b/components/com_content/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/index.html +++ b/components/com_content/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/section/index.html b/components/com_content/views/section/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/section/index.html +++ b/components/com_content/views/section/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/section/tmpl/blog_item.php b/components/com_content/views/section/tmpl/blog_item.php index 3de06167cbf69..8700ce0687a65 100644 --- a/components/com_content/views/section/tmpl/blog_item.php +++ b/components/com_content/views/section/tmpl/blog_item.php @@ -15,7 +15,7 @@ item->params->get('show_title')) : ?> item->params->get('link_titles') && $this->item->readmore_link != '') : ?> - + escape($this->item->title); ?> escape($this->item->title); ?> diff --git a/components/com_content/views/section/tmpl/blog_links.php b/components/com_content/views/section/tmpl/blog_links.php index 9ef4f00bbca00..81b52cacbc1e9 100644 --- a/components/com_content/views/section/tmpl/blog_links.php +++ b/components/com_content/views/section/tmpl/blog_links.php @@ -6,7 +6,7 @@ links as $link) : ?>
    • - + title; ?>
    • diff --git a/components/com_content/views/section/tmpl/default.php b/components/com_content/views/section/tmpl/default.php index 54118e45a05e1..bbc95a87342fd 100644 --- a/components/com_content/views/section/tmpl/default.php +++ b/components/com_content/views/section/tmpl/default.php @@ -2,9 +2,9 @@ defined('_JEXEC') or die('Restricted access'); $cparams =& JComponentHelper::getParams('com_media'); ?> -params->get('show_page_title')) : ?> -
      - escape($this->section->title); ?> +params->get('show_page_title', 1)) : ?> +
      + escape($this->params->get('page_title')); ?>
      @@ -25,7 +25,7 @@ categories as $category) : ?> params->get('show_empty_categories') && !$category->numitems) continue; ?>
    • - + title;?> params->get('show_cat_num_articles')) : ?>   diff --git a/components/com_content/views/section/tmpl/default.xml b/components/com_content/views/section/tmpl/default.xml index 47045faa65201..82f5bc3846378 100644 --- a/components/com_content/views/section/tmpl/default.xml +++ b/components/com_content/views/section/tmpl/default.xml @@ -46,7 +46,7 @@ - + diff --git a/components/com_content/views/section/tmpl/index.html b/components/com_content/views/section/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_content/views/section/tmpl/index.html +++ b/components/com_content/views/section/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_content/views/section/view.feed.php b/components/com_content/views/section/view.feed.php index 2fa56e6a5c49e..f891c2f958f0e 100644 --- a/components/com_content/views/section/view.feed.php +++ b/components/com_content/views/section/view.feed.php @@ -37,9 +37,10 @@ function display() JRequest::setVar('limit', $mainframe->getCfg('feed_limit')); // Lets get our data from the model - $rows =& $this->get( 'Data' ); + $rows = &$this->get( 'Data' ); + $section = &$this->get( 'Section' ); - $doc->link = JRoute::_('index.php?option=com_content&view=section&id='.JRequest::getVar('id',null, '', 'int')); + $doc->link = JRoute::_(ContentHelperRoute::getSectionRoute($section->id));; foreach ( $rows as $row ) { @@ -49,7 +50,7 @@ function display() // url link to article // & used instead of & as this is converted by feed creator - $link = JRoute::_('index.php?option=com_content&view=article&id='. $row->slug .'&catid='.$row->catslug ); + $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));; // strip html from feed item description text $description = ($params->get('feed_summary', 0) ? $row->introtext.$row->fulltext : $row->introtext); @@ -69,4 +70,3 @@ function display() } } } -?> diff --git a/components/com_content/views/section/view.html.php b/components/com_content/views/section/view.html.php index 43ec0504e951e..7b2f03ad57aa0 100644 --- a/components/com_content/views/section/view.html.php +++ b/components/com_content/views/section/view.html.php @@ -1,165 +1,189 @@ -getParams(); - - // Request variables - $limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int'); - $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); - - //parameters - $intro = $params->def('num_intro_articles', 4); - $leading = $params->def('num_leading_articles', 1); - $links = $params->def('num_links', 4); - - $limit = $intro + $leading + $links; - JRequest::setVar('limit', (int) $limit); - - // Get some data from the model - $items = & $this->get( 'Data'); - $total = & $this->get( 'Total'); - $categories = & $this->get( 'Categories' ); - $section = & $this->get( 'Section' ); - - // Create a user access object for the user - $access = new stdClass(); - $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all'); - $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own'); - $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); - - //add alternate feed link - if($params->get('show_feed_link', 1) == 1) - { - $link = '&format=feed&limitstart='; - $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); - $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); - $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); - $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); - } - - // Prepare section description - $section->description = JHTML::_('content.prepare', $section->description); - - for($i = 0; $i < count($categories); $i++) - { - $category =& $categories[$i]; - $category->link = JRoute::_('index.php?view=category&id='.$category->slug); - - // Prepare category description - $category->description = JHTML::_('content.prepare', $category->description); - } - - if ($total == 0) { - $params->set('show_categories', false); - } - - jimport('joomla.html.pagination'); - $pagination = new JPagination($total, $limitstart, $limit - $links); - - $this->assign('total', $total); - - $this->assignRef('items', $items); - $this->assignRef('section', $section); - $this->assignRef('categories', $categories); - $this->assignRef('params', $params); - $this->assignRef('user', $user); - $this->assignRef('access', $access); - $this->assignRef('pagination', $pagination); - - parent::display($tpl); - } - - function &getItem( $index = 0, &$params) - { - global $mainframe; - - // Initialize some variables - $user =& JFactory::getUser(); - $dispatcher =& JDispatcher::getInstance(); - - $SiteName = $mainframe->getCfg('sitename'); - - $task = JRequest::getCmd('task'); - - $linkOn = null; - $linkText = null; - - $item =& $this->items[$index]; - $item->text = $item->introtext; - - // Get the page/component configuration and article parameters - $item->params = clone($params); - $aparams = new JParameter($item->attribs); - - // Merge article parameters into the page configuration - $item->params->merge($aparams); - - // Process the content preparation plugins - JPluginHelper::importPlugin('content'); - $results = $dispatcher->trigger('onPrepareContent', array (& $item, & $item->params, 0)); - - // Build the link and text of the readmore button - if (($item->params->get('show_readmore') && @ $item->readmore) || $item->params->get('link_titles')) - { - // checks if the item is a public or registered/special item - if ($item->access <= $user->get('aid', 0)) - { - //$item->readmore_link = JRoute::_("index.php?view=article&id=".$item->slug); - $item->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid)); - $item->readmore_register = false; - } - else - { - $item->readmore_link = JRoute::_("index.php?option=com_user&task=register"); - $item->readmore_register = true; - } - } - - $item->event = new stdClass(); - $results = $dispatcher->trigger('onAfterDisplayTitle', array (& $item, & $item->params,0)); - $item->event->afterDisplayTitle = trim(implode("\n", $results)); - - $results = $dispatcher->trigger('onBeforeDisplayContent', array (& $item, & $item->params, 0)); - $item->event->beforeDisplayContent = trim(implode("\n", $results)); - - $results = $dispatcher->trigger('onAfterDisplayContent', array (& $item, & $item->params, 0)); - $item->event->afterDisplayContent = trim(implode("\n", $results)); - - return $item; - } -} +getParams(); + + // Request variables + $limit = JRequest::getVar('limit', $params->get('display_num'), '', 'int'); + $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); + + //parameters + $intro = $params->def('num_intro_articles', 4); + $leading = $params->def('num_leading_articles', 1); + $links = $params->def('num_links', 4); + + $limit = $intro + $leading + $links; + JRequest::setVar('limit', (int) $limit); + + // Get some data from the model + $items = & $this->get( 'Data'); + $total = & $this->get( 'Total'); + $categories = & $this->get( 'Categories' ); + $section = & $this->get( 'Section' ); + + // Create a user access object for the user + $access = new stdClass(); + $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all'); + $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own'); + $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); + + //add alternate feed link + if($params->get('show_feed_link', 1) == 1) + { + $link = '&format=feed&limitstart='; + $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); + $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); + $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); + $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); + } + + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', $section->title); + } + } else { + $params->set('page_title', $section->title); + } + $document->setTitle( $params->get( 'page_title' ) ); + + // Prepare section description + $section->description = JHTML::_('content.prepare', $section->description); + + for($i = 0; $i < count($categories); $i++) + { + $category =& $categories[$i]; + $category->link = JRoute::_(ContentHelperRoute::getCategoryRoute($category->slug, $category->section).'&layout=default'); + + // Prepare category description + $category->description = JHTML::_('content.prepare', $category->description); + } + + if ($total == 0) { + $params->set('show_categories', false); + } + + jimport('joomla.html.pagination'); + $pagination = new JPagination($total, $limitstart, $limit - $links); + + $this->assign('total', $total); + + $this->assignRef('items', $items); + $this->assignRef('section', $section); + $this->assignRef('categories', $categories); + $this->assignRef('params', $params); + $this->assignRef('user', $user); + $this->assignRef('access', $access); + $this->assignRef('pagination', $pagination); + + parent::display($tpl); + } + + function &getItem( $index = 0, &$params) + { + global $mainframe; + + // Initialize some variables + $user =& JFactory::getUser(); + $dispatcher =& JDispatcher::getInstance(); + + $SiteName = $mainframe->getCfg('sitename'); + + $task = JRequest::getCmd('task'); + + $linkOn = null; + $linkText = null; + + $item =& $this->items[$index]; + $item->text = $item->introtext; + + // Get the page/component configuration and article parameters + $item->params = clone($params); + $aparams = new JParameter($item->attribs); + + // Merge article parameters into the page configuration + $item->params->merge($aparams); + + // Process the content preparation plugins + JPluginHelper::importPlugin('content'); + $results = $dispatcher->trigger('onPrepareContent', array (& $item, & $item->params, 0)); + + // Build the link and text of the readmore button + if (($item->params->get('show_readmore') && @ $item->readmore) || $item->params->get('link_titles')) + { + // checks if the item is a public or registered/special item + if ($item->access <= $user->get('aid', 0)) + { + //$item->readmore_link = JRoute::_("index.php?view=article&id=".$item->slug); + $item->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug, $item->sectionid)); + $item->readmore_register = false; + } + else + { + $item->readmore_link = JRoute::_("index.php?option=com_user&task=register"); + $item->readmore_register = true; + } + } + + $item->event = new stdClass(); + $results = $dispatcher->trigger('onAfterDisplayTitle', array (& $item, & $item->params,0)); + $item->event->afterDisplayTitle = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onBeforeDisplayContent', array (& $item, & $item->params, 0)); + $item->event->beforeDisplayContent = trim(implode("\n", $results)); + + $results = $dispatcher->trigger('onAfterDisplayContent', array (& $item, & $item->params, 0)); + $item->event->afterDisplayContent = trim(implode("\n", $results)); + + return $item; + } +} diff --git a/components/com_mailto/assets/index.html b/components/com_mailto/assets/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_mailto/assets/index.html +++ b/components/com_mailto/assets/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_mailto/index.html b/components/com_mailto/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_mailto/index.html +++ b/components/com_mailto/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_mailto/mailto.php b/components/com_mailto/mailto.php index a26ec2a347761..be53abc013de1 100644 --- a/components/com_mailto/mailto.php +++ b/components/com_mailto/mailto.php @@ -17,7 +17,7 @@ jimport('joomla.application.component.helper'); -require_once( JPATH_COMPONENT.DS.'controller.php' ); +require_once JPATH_COMPONENT.DS.'controller.php'; $controller = new MailtoController( ); $controller->registerDefaultTask('mailto'); diff --git a/components/com_mailto/views/index.html b/components/com_mailto/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_mailto/views/index.html +++ b/components/com_mailto/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_mailto/views/mailto/index.html b/components/com_mailto/views/mailto/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_mailto/views/mailto/index.html +++ b/components/com_mailto/views/mailto/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_mailto/views/mailto/tmpl/default.php b/components/com_mailto/views/mailto/tmpl/default.php index 492211d1731ac..64f61cff9b2a0 100644 --- a/components/com_mailto/views/mailto/tmpl/default.php +++ b/components/com_mailto/views/mailto/tmpl/default.php @@ -3,7 +3,7 @@ - -
      - -
      + +params->def( 'show_page_title', 1 ) ) : ?> +
      + escape($this->params->get('page_title')); ?> +
      +
    • diff --git a/components/com_user/views/user/tmpl/index.html b/components/com_user/views/user/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_user/views/user/tmpl/index.html +++ b/components/com_user/views/user/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_user/views/user/view.html.php b/components/com_user/views/user/view.html.php index 4ae6168739a5d..26488e64f91de 100644 --- a/components/com_user/views/user/view.html.php +++ b/components/com_user/views/user/view.html.php @@ -44,8 +44,28 @@ function display( $tpl = null) $user =& JFactory::getUser(); + // Get the page/component configuration + $params = &$mainframe->getParams(); + + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', JText::_( 'User Details' )); + } + } else { + $params->set('page_title', JText::_( 'User Details' )); + } + $document = &JFactory::getDocument(); + $document->setTitle( $params->get( 'page_title' ) ); + // Set pathway information $this->assignRef('user' , $user); + $this->assignRef('params', $params); parent::display($tpl); } @@ -54,7 +74,8 @@ function _displayForm($tpl = null) { global $mainframe; - $user =& JFactory::getUser(); + $user =& JFactory::getUser(); + $params = &$mainframe->getParams(); // check to see if Frontend User Params have been enabled $usersConfig = &JComponentHelper::getParams( 'com_users' ); @@ -66,6 +87,22 @@ function _displayForm($tpl = null) $params = $user->getParameters(true); } } + $params->merge( $params ); + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', JText::_( 'Edit Your Details' )); + } + } else { + $params->set('page_title', JText::_( 'Edit Your Details' )); + } + $document = &JFactory::getDocument(); + $document->setTitle( $params->get( 'page_title' ) ); $this->assignRef('user' , $user); $this->assignRef('params', $params); diff --git a/components/com_weblinks/controller.php b/components/com_weblinks/controller.php index b0dfd2df8dac8..8b815668d9a8f 100644 --- a/components/com_weblinks/controller.php +++ b/components/com_weblinks/controller.php @@ -48,4 +48,24 @@ function display() parent::display(); } + + /** + * Report a weblink + * + * @acces public + * @since 1.6 + */ + + function report() + { + $model =& $this->getModel('weblink'); + if ($model->report()) { + $msg = JText::_("Link Reported"); + } + else { + $msg = JText::_("Error reporting link"); + } + + $this->setRedirect(JRoute::_('index.php?option=com_weblinks'), $msg); + } } \ No newline at end of file diff --git a/components/com_weblinks/controllers/index.html b/components/com_weblinks/controllers/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_weblinks/controllers/index.html +++ b/components/com_weblinks/controllers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_weblinks/controllers/weblink.php b/components/com_weblinks/controllers/weblink.php index af68397dbab18..ca1271a4ab55a 100644 --- a/components/com_weblinks/controllers/weblink.php +++ b/components/com_weblinks/controllers/weblink.php @@ -34,7 +34,8 @@ class WeblinksControllerWeblink extends WeblinksController */ function edit() { - $user = & JFactory::getUser(); + $app =& JFactory::getApplication(); + $user =& JFactory::getUser(); // Make sure you are logged in if ($user->get('aid', 0) < 1) { @@ -46,7 +47,11 @@ function edit() JRequest::setVar('layout', 'form'); $model =& $this->getModel('weblink'); - $model->checkout(); + // fail if checked out not by 'me' + if ($model->isCheckedOut( $user->get('id') )) { + $msg = JText::sprintf( 'DESCBEINGEDITTED', JText::_( 'The weblink' ), $weblink->title ); + $app->redirect( 'index.php?option=com_weblinks', $msg ); + } parent::display(); } diff --git a/components/com_weblinks/helpers/index.html b/components/com_weblinks/helpers/index.html index fa6d84e8055f5..42682b4746225 100755 --- a/components/com_weblinks/helpers/index.html +++ b/components/com_weblinks/helpers/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_weblinks/helpers/query.php b/components/com_weblinks/helpers/query.php new file mode 100644 index 0000000000000..9419bd52f3f63 --- /dev/null +++ b/components/com_weblinks/helpers/query.php @@ -0,0 +1,91 @@ + null ); + //Find the itemid + $itemid = WeblinksHelperRoute::_findItem($needles); + $itemid = $itemid ? '&Itemid='.$itemid : ''; + //Create the link - $link = 'index.php?option=com_weblinks&view=weblink&id='. $id . '&catid='.$catid; - $link .= '&Itemid=' . WeblinksHelperRoute::_findItem($needles); + $link = 'index.php?option=com_weblinks&view=weblink&id='. $id . '&catid='.$catid . $itemid; return $link; } function _findItem($needles) { - $component =& JComponentHelper::getComponent('com_weblinks'); + static $items; + + if (!$items) + { + $component =& JComponentHelper::getComponent('com_weblinks'); + $menu = &JSite::getMenu(); + $items = $menu->getItems('componentid', $component->id); + } + + if (!is_array($items)) { + return null; + } - $menus = &JApplication::getMenu('site', array()); - $items = $menus->getItems('componentid', $component->id); $match = null; foreach($needles as $needle => $id) { diff --git a/components/com_weblinks/index.html b/components/com_weblinks/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_weblinks/index.html +++ b/components/com_weblinks/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_weblinks/models/categories.php b/components/com_weblinks/models/categories.php index 283c407af8e7d..527c58522e6a6 100644 --- a/components/com_weblinks/models/categories.php +++ b/components/com_weblinks/models/categories.php @@ -20,7 +20,6 @@ /** * Weblinks Component Categories Model * - * @author Johan Janssens * @package Joomla * @subpackage Weblinks * @since 1.5 @@ -54,7 +53,7 @@ function __construct() } /** - * Method to get weblink item data for the category + * Method to get weblink item data for the category * * @access public * @return array @@ -99,7 +98,7 @@ function _buildQuery() .' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\':\', cc.id, cc.alias) ELSE cc.id END as slug' .' FROM #__categories AS cc' .' LEFT JOIN #__weblinks AS a ON a.catid = cc.id' - .' WHERE a.published = 1' + .' WHERE a.state = 1' .' AND section = \'com_weblinks\'' .' AND cc.published = 1' .' AND cc.access <= '.(int) $aid diff --git a/components/com_weblinks/models/category.php b/components/com_weblinks/models/category.php index 50d05256fc038..a506e72251061 100644 --- a/components/com_weblinks/models/category.php +++ b/components/com_weblinks/models/category.php @@ -20,7 +20,6 @@ /** * Weblinks Component Weblink Model * - * @author Johan Janssens * @package Joomla * @subpackage Content * @since 1.5 @@ -225,11 +224,10 @@ function _buildQuery() $query = 'SELECT *' . ' FROM #__weblinks' . ' WHERE catid = '. (int) $this->_id. - ' AND published = 1' . + ' AND state = 1' . ' AND archived = 0'. ' ORDER BY '. $filter_order .' '. $filter_order_dir .', ordering'; return $query; } } -?> diff --git a/components/com_weblinks/models/index.html b/components/com_weblinks/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_weblinks/models/index.html +++ b/components/com_weblinks/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_weblinks/models/weblink.php b/components/com_weblinks/models/weblink.php index 5be97a2facc93..41a0e8c52506e 100644 --- a/components/com_weblinks/models/weblink.php +++ b/components/com_weblinks/models/weblink.php @@ -20,7 +20,6 @@ /** * Weblinks Component Weblink Model * - * @author Johan Janssens * @package Joomla * @subpackage Weblinks * @since 1.5 @@ -81,7 +80,7 @@ function &getData() $user = &JFactory::getUser(); // Make sure the weblink is published - if (!$this->_data->published) { + if ($this->_data->state != 1) { JError::raiseError(404, JText::_("Resource Not Found")); return false; } @@ -233,6 +232,34 @@ function store($data) return true; } + /** + * Method to mark a weblink reported + * + * @access public + * @return boolean True on success + * @since 1.6 + */ + function report() + { + if ($this->_id) + { + $weblink = & $this->getTable(); + if(!$weblink->load($this->_id)) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + $weblink->state = -1; + + if (!$weblink->store()) { + $this->setError($this->_db->getErrorMsg()); + return false; + } + + return true; + } + return false; + } + /** * Method to load content weblink data * @@ -278,7 +305,7 @@ function _initData() $weblink->description = null; $weblink->date = null; $weblink->hits = 0; - $weblink->published = 0; + $weblink->state = 0; $weblink->checked_out = 0; $weblink->checked_out_time = 0; $weblink->ordering = 0; @@ -292,4 +319,3 @@ function _initData() return true; } } -?> diff --git a/components/com_weblinks/models/weblinks.php b/components/com_weblinks/models/weblinks.php new file mode 100644 index 0000000000000..3ddcdaf575f8c --- /dev/null +++ b/components/com_weblinks/models/weblinks.php @@ -0,0 +1,196 @@ +setState('limit', $mainframe->getUserStateFromRequest('com_weblinks.limit', 'limit', $config->getValue('config.list_limit'), 'int')); + $this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int')); + + // In case limit has been changed, adjust limitstart accordingly + $this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0)); + + // Get the filter request variables + $filter = new stdClass(); + $filter->order = $mainframe->getUserStateFromRequest( $option.'filter_order', 'filter_order', 'w.ordering', 'cmd' ); + $filter->order_Dir = $mainframe->getUserStateFromRequest( $option.'filter_order_Dir', 'filter_order_Dir', '', 'word' ); + $this->_filter = $filter; + } + + /** + * Method to get weblink item data for the category + * + * @access public + * @return array + */ + function getData() + { + // Lets load the content if it doesn't already exist + if (empty($this->_data)) + { + $query = $this->_buildQuery(); + $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit')); + + $total = count($this->_data); + for($i = 0; $i < $total; $i++) + { + $item =& $this->_data[$i]; + $item->slug = $item->id.':'.$item->alias; + } + } + + return $this->_data; + } + + /** + * Method to get the total number of weblink items for the category + * + * @access public + * @return integer + */ + function getTotal() + { + // Lets load the content if it doesn't already exist + if (empty($this->_total)) + { + $query = $this->_buildQuery(); + $this->_total = $this->_getListCount($query); + } + + return $this->_total; + } + + /** + * Method to get a pagination object of the weblink items for the category + * + * @access public + * @return integer + */ + function getPagination() + { + // Lets load the content if it doesn't already exist + if (empty($this->_pagination)) + { + jimport('joomla.html.pagination'); + $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') ); + } + + return $this->_pagination; + } + + /** + * Method to get filter object for the categories + * + * @access public + * @return object + */ + function getFilter() + { + return $this->_filter; + } + + function _buildQuery() + { + $orderby = $this->_buildContentOrderBy(); + + // We need to get a list of all weblinks + $query = 'SELECT w.*, cc.title AS category' + . ' FROM #__weblinks AS w' + . ' LEFT JOIN #__categories AS cc ON cc.id = w.catid' + . ' WHERE w.state = 1' + . ' AND cc.published = 1' + . $orderby; + + return $query; + } + + function _buildContentOrderBy() + { + global $mainframe; + + if ($this->_filter->order != ''){ + $orderby = ' ORDER BY '. $this->_filter->order .' '. $this->_filter->order_Dir .', w.ordering'; + } + else { + // Get the page/component configuration + $params = &$mainframe->getParams(); + if (!is_object($params)) { + $params = &JComponentHelper::getParams('com_weblinks'); + } + + $orderby_sec = $params->def('orderby_sec', ''); + $orderby_pri = $params->def('orderby_pri', ''); + $secondary = WeblinksHelperQuery::orderbySecondary($orderby_sec); + $primary = WeblinksHelperQuery::orderbyPrimary($orderby_pri); + + $orderby = ' ORDER BY '.$primary.' '.$secondary; + } + + return $orderby; + } +} +?> diff --git a/components/com_weblinks/router.php b/components/com_weblinks/router.php index 5053f17e47718..622cb3b7278f8 100644 --- a/components/com_weblinks/router.php +++ b/components/com_weblinks/router.php @@ -122,9 +122,31 @@ function WeblinksBuildRoute(&$query) // Check if the router found an appropriate itemid. if (!$itemid) { + // Check if a category was specified + if (isset($query['view']) && $query['view'] == 'category' && isset($query['id'])) + { + if (isset($query['alias'])) { + $query['id'] .= ':'.$query['alias']; + } + + // Push the catid onto the stack. + $segments[] = $query['id']; + + unset($query['view']); + unset($query['id']); + unset($query['alias']); + } // Check if a id was specified. - if (isset($query['id'])) + elseif (isset($query['id'])) { + if (isset($query['catalias'])) { + $query['catid'] .= ':'.$query['catalias']; + } + + // Push the catid onto the stack. + $segments[] = $query['catid']; + + if (isset($query['alias'])) { $query['id'] .= ':'.$query['alias']; } @@ -134,6 +156,8 @@ function WeblinksBuildRoute(&$query) unset($query['view']); unset($query['id']); unset($query['alias']); + unset($query['catid']); + unset($query['catalias']); } elseif (isset($query['catid'])) { @@ -223,23 +247,21 @@ function WeblinksParseRoute($segments) // Check if there are any route segments to handle. if ($count) { - if (count($segments[0]) == 2) + if ($count == 2) { // We are viewing a weblink. $vars['view'] = 'weblink'; - $vars['id'] = $segments[$count-2]; - $vars['catid'] = $segments[$count-1]; - + $vars['catid'] = $segments[$count-2]; + $vars['id'] = $segments[$count-1]; } else { // We are viewing a category. $vars['view'] = 'category'; - $vars['catid'] = $segments[$count-1]; + $vars['id'] = $segments[$count-1]; } } } return $vars; } -?> diff --git a/components/com_weblinks/views/categories/index.html b/components/com_weblinks/views/categories/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_weblinks/views/categories/index.html +++ b/components/com_weblinks/views/categories/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_weblinks/views/categories/tmpl/default.php b/components/com_weblinks/views/categories/tmpl/default.php index 716c9bb303dc1..0e6c5cba2627a 100644 --- a/components/com_weblinks/views/categories/tmpl/default.php +++ b/components/com_weblinks/views/categories/tmpl/default.php @@ -6,8 +6,8 @@ +params->def('image', -1) != -1) || $this->params->def('show_comp_description', 1) ) : ?> -params->def('image', -1) != -1) || $this->params->def('show_comp_description', 1) ) : ?> +
      -
        categories as $category ) : ?>
      • - + title;?>   @@ -29,4 +29,4 @@
      • -
      \ No newline at end of file + diff --git a/components/com_weblinks/views/categories/tmpl/index.html b/components/com_weblinks/views/categories/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_weblinks/views/categories/tmpl/index.html +++ b/components/com_weblinks/views/categories/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_weblinks/views/categories/view.html.php b/components/com_weblinks/views/categories/view.html.php index 38a7dfb331ae0..553979257a78f 100644 --- a/components/com_weblinks/views/categories/view.html.php +++ b/components/com_weblinks/views/categories/view.html.php @@ -40,6 +40,22 @@ function display( $tpl = null) // Get the page/component configuration $params = &$mainframe->getParams(); + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', JText::_( 'Web Links' )); + } + } else { + $params->set('page_title', JText::_( 'Web Links' )); + } + + $document->setTitle( $params->get( 'page_title' ) ); + // Set some defaults if not set for params $params->def('comp_description', JText::_('WEBLINKS_DESC')); diff --git a/components/com_weblinks/views/category/index.html b/components/com_weblinks/views/category/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_weblinks/views/category/index.html +++ b/components/com_weblinks/views/category/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_weblinks/views/category/tmpl/default.php b/components/com_weblinks/views/category/tmpl/default.php index b14945d2c7173..1d45a68506979 100644 --- a/components/com_weblinks/views/category/tmpl/default.php +++ b/components/com_weblinks/views/category/tmpl/default.php @@ -1,7 +1,7 @@ params->def( 'show_page_title', 1 ) ) : ?>
      - category->title; ?> + escape($this->params->get('page_title')); ?>
      @@ -21,4 +21,22 @@ loadTemplate('items'); ?>
      + +
      \ No newline at end of file diff --git a/components/com_weblinks/views/category/tmpl/default_items.php b/components/com_weblinks/views/category/tmpl/default_items.php index 58f24521b875f..8384a898ac1c5 100644 --- a/components/com_weblinks/views/category/tmpl/default_items.php +++ b/components/com_weblinks/views/category/tmpl/default_items.php @@ -1,4 +1,12 @@ + +params->get('show_snapshot')) + JHTML::_('weblink.snapshotinit', $this->params->get('snapshot_width'), $this->params->get('snapshot_height')); + else + JHTML::_('behavior.tooltip'); +?> + -
      - -
      +params->def( 'show_page_title', 1 ) ) : ?> +
      + escape($this->params->get('page_title')); ?> +
      + diff --git a/components/com_weblinks/views/weblink/tmpl/index.html b/components/com_weblinks/views/weblink/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_weblinks/views/weblink/tmpl/index.html +++ b/components/com_weblinks/views/weblink/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_weblinks/views/weblink/view.html.php b/components/com_weblinks/views/weblink/view.html.php index ea424eabd6cbf..b97e2ebce7206 100644 --- a/components/com_weblinks/views/weblink/view.html.php +++ b/components/com_weblinks/views/weblink/view.html.php @@ -56,11 +56,13 @@ function _displayForm($tpl) $document =& JFactory::getDocument(); $model =& $this->getModel(); $user =& JFactory::getUser(); - $uri =& JFactory::getURI(); + $uri =& JFactory::getURI(); + $params = &$mainframe->getParams(); // Make sure you are logged in and have the necessary access rights if ($user->get('gid') < 19) { - JError::raiseError( 403, JText::_('ALERTNOTAUTH') ); + JResponse::setHeader('HTTP/1.0 403',true); + JError::raiseWarning( 403, JText::_('ALERTNOTAUTH') ); return; } @@ -68,16 +70,28 @@ function _displayForm($tpl) $weblink =& $this->get('data'); $isNew = ($weblink->id < 1); + // Check it out + $model->checkout(); + // Edit or Create? if (!$isNew) { - // Is this link checked out? If not by me fail - //if ($model->isCheckedOut($user->get('id'))) { - // $mainframe->redirect("index.php?option=$option", "The weblink $weblink->title is currently being edited by another administrator."); - //} - // Set page title - $document->setTitle(JText::_('Links').' - '.JText::_('Edit')); + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', JText::_( 'Web Links'.' - '.JText::_('Edit') )); + } + } else { + $params->set('page_title', JText::_( 'Web Links'.' - '.JText::_('Edit') )); + } + + $document->setTitle( $params->get( 'page_title' ) ); //set breadcrumbs if($item->query['view'] != 'weblink') @@ -101,12 +115,28 @@ function _displayForm($tpl) * we want to manipulate the pathway and pagetitle to indicate this. Also, * we need to initialize some values. */ - $weblink->published = 0; + $weblink->state = 0; $weblink->approved = 1; $weblink->ordering = 0; + $weblink->reported = 0; // Set page title - $document->setTitle(JText::_('Links').' - '.JText::_('New')); + // Set page title + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // because the application sets a default page title, we need to get it + // right from the menu item itself + if (is_object( $menu )) { + $menu_params = new JParameter( $menu->params ); + if (!$menu_params->get( 'page_title')) { + $params->set('page_title', JText::_( JText::_('Submit a Web Link') )); + } + } else { + $params->set('page_title', JText::_( JText::_('Submit a Web Link') )); + } + + $document->setTitle( $params->get( 'page_title' ) ); // Add pathway item $pathway->addItem(JText::_('New'), ''); @@ -123,8 +153,8 @@ function _displayForm($tpl) $lists['ordering'] = JHTML::_('list.specificordering', $weblink, $weblink->id, $query ); - // Radio Buttons: Should the article be published - $lists['published'] = JHTML::_('select.booleanlist', 'jform[published]', 'class="inputbox"', $weblink->published ); + // Radio Buttons: weblink state + $lists['state'] = JHTML::_('weblink.statelist', 'jform[state]', $weblink->state ); JFilterOutput::objectHTMLSafe( $weblink, ENT_QUOTES, 'description' ); @@ -132,7 +162,7 @@ function _displayForm($tpl) $this->assignRef('lists' , $lists); $this->assignRef('weblink' , $weblink); - + $this->assignRef('params' , $params); parent::display($tpl); } } diff --git a/components/com_weblinks/views/weblinks/index.html b/components/com_weblinks/views/weblinks/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_weblinks/views/weblinks/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_weblinks/views/weblinks/metadata.xml b/components/com_weblinks/views/weblinks/metadata.xml new file mode 100644 index 0000000000000..b3a25126de999 --- /dev/null +++ b/components/com_weblinks/views/weblinks/metadata.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/components/com_weblinks/views/weblinks/tmpl/default.php b/components/com_weblinks/views/weblinks/tmpl/default.php new file mode 100644 index 0000000000000..1c7e669fc83a3 --- /dev/null +++ b/components/com_weblinks/views/weblinks/tmpl/default.php @@ -0,0 +1,14 @@ + +params->def( 'show_page_title', 1 ) ) : ?> +
      + category->title; ?> +
      + + +
      @@ -58,12 +60,12 @@ function submitbutton(pressbutton)
      - - lists['published']; ?> + lists['state']; ?>
      + + + +
      + loadTemplate('items'); ?> +
      \ No newline at end of file diff --git a/components/com_weblinks/views/weblinks/tmpl/default.xml b/components/com_weblinks/views/weblinks/tmpl/default.xml new file mode 100644 index 0000000000000..6bebaac84c9a0 --- /dev/null +++ b/components/com_weblinks/views/weblinks/tmpl/default.xml @@ -0,0 +1,35 @@ + + + + + + + + + All Weblinks Layout + This layout shows a list of all Web Links + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/com_weblinks/views/weblinks/tmpl/default_items.php b/components/com_weblinks/views/weblinks/tmpl/default_items.php new file mode 100644 index 0000000000000..48d2a8c80f622 --- /dev/null +++ b/components/com_weblinks/views/weblinks/tmpl/default_items.php @@ -0,0 +1,104 @@ + + +params->get('show_snapshot')) + JHTML::_('behavior.imagetooltip', $this->params->get('snapshot_width'), $this->params->get('snapshot_height')); + else + JHTML::_('behavior.tooltip'); +?> + + + + + +params->get( 'show_display_num' )): ?> + + + + +params->def( 'show_headings', 1 ) ) : ?> + + params->get( 'show_numbers' )): ?> + + + + + params->get( 'show_link_hits' ) ) : ?> + + + + params->get( 'show_report' )): ?> + + + + +items as $item) : ?> + + params->get( 'show_numbers' )): ?> + + + + params->get( 'show_link_hits' ) ) : ?> + + + + params->get( 'show_report' )): ?> + + + + + + + + + + +
      + pagination->getLimitBox(); + ?> +
      + + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + filter->order_Dir, $this->filter->order ); ?> + + +
      + pagination->getRowOffset( $item->count ); ?> + + image ) : ?> +   image;?>   + + + link; ?> + + params->get( 'show_link_description' ) ) : ?> +
      description); ?> + +
      + category; ?> + + hits; ?> + + +
      + pagination->getPagesLinks(); ?> +
      + pagination->getPagesCounter(); ?> +
      + + + \ No newline at end of file diff --git a/components/com_weblinks/views/weblinks/tmpl/index.html b/components/com_weblinks/views/weblinks/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/components/com_weblinks/views/weblinks/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/com_weblinks/views/weblinks/view.html.php b/components/com_weblinks/views/weblinks/view.html.php new file mode 100644 index 0000000000000..b6a89fbde4a97 --- /dev/null +++ b/components/com_weblinks/views/weblinks/view.html.php @@ -0,0 +1,151 @@ +getPathway(); + + // Get the parameters of the active menu item + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // Get some data from the model + $items = &$this->get('data' ); + $total = &$this->get('total'); + $pagination = &$this->get('pagination'); + $filter = &$this->get('filter'); + + // Get the page/component configuration + $params = &$mainframe->getParams(); + + // Add alternate feed link + if($params->get('show_feed_link', 1) == 1) + { + $link = '&format=feed&limitstart='; + $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); + $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); + $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); + $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); + } + + // Set page title per category + $document->setTitle( $params->get( 'page_title')); + + // Set some defaults if not set for params + $params->def('comp_description', JText::_('WEBLINKS_DESC')); + $params->def('show_numbers', '1'); // Default to "show" + $params->def('show_report', '0'); // Default to "hide" + $params->def('show_snapshot', '0'); // Default to "hide" + $params->def('snapshot_width', '120'); + $params->def('snapshot_height', '90'); + + // icon in table display + if ( $params->get( 'link_icons' ) <> -1 ) { + $image = JHTML::_('image.site', $params->get('link_icons'), '/images/M_images/', $params->get( 'weblink_icons' ), '/images/M_images/', 'Link' ); + } + + $source = $params->get('snapshot_source'); + $source_url = ''; + if ($source) { + JModel::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_weblinks'.DS.'models'); + $model =& JModel::getInstance('snapshotsources','WeblinksModel'); + $sites = $model->getData(); + foreach ($sites as $site) { + if ($source == $site->name) $source_url = $site->url; + } + } + + $patterns = array('%u','%w','%h'); + $replacements = array(null, $params->get('snapshot_width'), $params->get('snapshot_height')); + + $k = 0; + $count = count($items); + for($i = 0; $i < $count; $i++) + { + $item =& $items[$i]; + + $link = JRoute::_( 'index.php?view=weblink&id='. $item->slug); + + $item->report_link = JRoute::_('index.php?task=report&id='. $item->slug); + if ($source_url) { + $replacements[0] = $item->url; + $url_snapshot = str_replace($patterns, $replacements, $source_url); + $item->url_snapshot = JRoute::_($url_snapshot); + } + else { + $item->url_snapshot = ''; + $params->set('show_snapshot', '0'); + } + + $menuclass = 'weblinks'.$params->get( 'pageclass_sfx' ); + + $itemParams = new JParameter($item->params); + switch ($itemParams->get('target', $params->get('target'))) + { + // cases are slightly different + case 1: + // open in a new window + $item->link = ''. $item->title .''; + break; + + case 2: + // open in a popup window + $item->link = "". $item->title ."\n"; + break; + + default: + // formerly case 2 + // open in parent window + $item->link = ''. $item->title .''; + break; + } + + $item->image = $image; + + $item->odd = $k; + $item->count = $i; + $k = 1 - $k; + } + + $this->assignRef('filter', $filter); + $this->assignRef('params', $params); + $this->assignRef('items', $items); + $this->assignRef('pagination', $pagination); + + $this->assign('action', $uri->toString()); + + parent::display($tpl); + } +} +?> diff --git a/components/com_weblinks/weblinks.php b/components/com_weblinks/weblinks.php index a304f818fc742..620892576210d 100644 --- a/components/com_weblinks/weblinks.php +++ b/components/com_weblinks/weblinks.php @@ -16,7 +16,11 @@ defined('_JEXEC') or die('Restricted access'); // Require the base controller -require_once (JPATH_COMPONENT.DS.'controller.php'); +require_once JPATH_COMPONENT.DS.'controller.php'; +require_once JPATH_COMPONENT.DS.'helpers'.DS.'query.php'; + +// Helper classes +JHTML::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'classes'); // Require specific controller if requested if($controller = JRequest::getWord('controller')) { diff --git a/components/com_wrapper/index.html b/components/com_wrapper/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_wrapper/index.html +++ b/components/com_wrapper/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_wrapper/router.php b/components/com_wrapper/router.php index 69ec55a4474f7..b44f07696695a 100644 --- a/components/com_wrapper/router.php +++ b/components/com_wrapper/router.php @@ -1,6 +1,6 @@ \ No newline at end of file + \ No newline at end of file diff --git a/components/com_wrapper/views/wrapper/index.html b/components/com_wrapper/views/wrapper/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_wrapper/views/wrapper/index.html +++ b/components/com_wrapper/views/wrapper/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_wrapper/views/wrapper/tmpl/default.php b/components/com_wrapper/views/wrapper/tmpl/default.php index e620490b37c9a..1e974b159acdf 100644 --- a/components/com_wrapper/views/wrapper/tmpl/default.php +++ b/components/com_wrapper/views/wrapper/tmpl/default.php @@ -13,7 +13,7 @@ function iFrameHeight() { }
      -params->get( 'show_page_title' ) ) : ?> +params->get( 'show_page_title', 1 ) ) : ?>
      params->get( 'page_title' ); ?>
      diff --git a/components/com_wrapper/views/wrapper/tmpl/index.html b/components/com_wrapper/views/wrapper/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/components/com_wrapper/views/wrapper/tmpl/index.html +++ b/components/com_wrapper/views/wrapper/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/components/com_wrapper/views/wrapper/view.php b/components/com_wrapper/views/wrapper/view.php index d0fca14653b63..50cfd2e538738 100644 --- a/components/com_wrapper/views/wrapper/view.php +++ b/components/com_wrapper/views/wrapper/view.php @@ -25,6 +25,9 @@ class WrapperViewWrapper extends JView { function display( $tpl = null ) { + $mainframe = &JFactory::getApplication(); + $document = &JFactory::getDocument(); + // auto height control if ( $this->params->def( 'height_auto' ) ) { $this->wrapper->load = 'onload="iFrameHeight()"'; @@ -32,7 +35,18 @@ function display( $tpl = null ) $this->wrapper->load = ''; } + // Get the page/component configuration + $params = &$mainframe->getParams(); + + $menus = &JSite::getMenu(); + $menu = $menus->getActive(); + + // because the application sets a default page title, we need to get it + // right from the menu item itself + $document->setTitle( $params->get( 'page_title' ) ); + + $this->assignRef('params', $params); + parent::display($tpl); } } -?> \ No newline at end of file diff --git a/components/com_wrapper/wrapper.php b/components/com_wrapper/wrapper.php index 49cf5d5898ebc..e00734b1f59de 100644 --- a/components/com_wrapper/wrapper.php +++ b/components/com_wrapper/wrapper.php @@ -31,7 +31,6 @@ * Static class to hold controller functions for the Wrapper component * * @static - * @author Johan Janssens * @package Joomla * @subpackage Wrapper * @since 1.5 @@ -75,7 +74,7 @@ function display() $row->url = $url; } - require_once (JPATH_COMPONENT.DS.'views'.DS.'wrapper'.DS.'view.php'); + require_once JPATH_COMPONENT.DS.'views'.DS.'wrapper'.DS.'view.php'; $view = new WrapperViewWrapper(); $view->assignRef('params' , $params); diff --git a/components/index.html b/components/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/components/index.html +++ b/components/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/htaccess.txt b/htaccess.txt index d91059c369e3f..7d84efb52deb8 100644 --- a/htaccess.txt +++ b/htaccess.txt @@ -27,6 +27,24 @@ Options +FollowSymLinks RewriteEngine On +########## Begin - Rewrite rules to block out some common exploits +## If you experience problems on your site block out the operations listed below +## This attempts to block the most common type of exploit `attempts` to Joomla! +# +# Block out any script trying to set a mosConfig value through the URL +RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] +# Block out any script trying to base64_encode crap to send via URL +RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR] +# Block out any script that includes a - - - $val) { - $val = preg_replace("/[^_A-Za-z0-9-\.&=]/i", '', $val); - $_REQUEST[$key] = $val; -} - -// Determine filename to execute for loading... -$filename = JPATH_BASE . DS . 'sql' . DS . 'migration' . DS . 'migrate.sql'; -$_REQUEST['fn'] = $filename; -$error = false; -$file = false; -// Single file mode - -if (!$error && !isset ($_REQUEST["fn"]) && $filename != "") { - echo ("

      Start Import from $filename into $db_name at $db_server

      \n"); -} - -// Open the file - -if (!$error && isset ($_REQUEST["fn"])) { - - // Recognize GZip filename - - if (eregi("\.gz$", $_REQUEST["fn"])) - $gzipmode = true; - else - $gzipmode = false; - if ((!$gzipmode && !$file = fopen($_REQUEST["fn"], "rt")) || ($gzipmode && !$file = gzopen($_REQUEST["fn"], "rt"))) { - echo ("

      ". JText::sprintf("Cant open file for import", $_REQUEST["fn"]) ."

      \n"); - echo ("

      ". JText::_('CHECKDUMPFILE') . - " .
      ". JText::_('NEEDTOUPLOADFILE')."

      \n"); - $error = true; - } - - // Get the file size (can't do it fast on gzipped files, no idea how) - - else - if ((!$gzipmode && fseek($file, 0, SEEK_END) == 0) || ($gzipmode && gzseek($file, 0) == 0)) { - if (!$gzipmode) - $filesize = ftell($file); - else - $filesize = gztell($file); // Always zero, ignore - } else { - echo ("

      ". JText::_('FILESIZEUNKNOWN') . $_REQUEST["fn"] . "

      \n"); - $error = true; - } -} - -// ******************************************************************************************* -// START IMPORT SESSION HERE -// ******************************************************************************************* -if (!$error && isset ($_REQUEST["start"]) && isset ($_REQUEST["foffset"]) && eregi("(\.(sql|gz|csv))$", $_REQUEST["fn"])) { - - // Check start and foffset are numeric values - - if (!is_numeric($_REQUEST["start"]) || !is_numeric($_REQUEST["foffset"])) { - echo ("

      ". JText::_('NONNUMERICOFFSET') ."

      \n"); - $error = true; - } - - if (!$error) { - $_REQUEST["start"] = floor($_REQUEST["start"]); - $_REQUEST["foffset"] = floor($_REQUEST["foffset"]); - } - - // Check $_REQUEST["foffset"] upon $filesize (can't do it on gzipped files) - - if (!$error && !$gzipmode && $_REQUEST["foffset"] > $filesize) { - echo ("

      ".JText::_('POINTEREOF')."

      \n"); - $error = true; - } - - // Set file pointer to $_REQUEST["foffset"] - - if (!$error && ((!$gzipmode && fseek($file, $_REQUEST["foffset"]) != 0) || ($gzipmode && gzseek($file, $_REQUEST["foffset"]) != 0))) { - echo ("

      ". JText::_('UNABLETOSETOFFSET') . $_REQUEST["foffset"] . "

      \n"); - $error = true; - } - - // Start processing queries from $file - - if (!$error) { - $query = ""; - $queries = 0; - $totalqueries = $_REQUEST["totalqueries"]; - $linenumber = $_REQUEST["start"]; - $querylines = 0; - $inparents = false; - - // Stay processing as long as the $linespersession is not reached or the query is still incomplete - - while ($linenumber < $_REQUEST["start"] + $linespersession || $query != "") { - - // Read the whole next line - - $dumpline = ""; - while (!feof($file) && substr($dumpline, -1) != "\n") { - if (!$gzipmode) - $dumpline .= fgets($file, DATA_CHUNK_LENGTH); - else - $dumpline .= gzgets($file, DATA_CHUNK_LENGTH); - } - if ($dumpline === "") - break; - - // Handle DOS and Mac encoded linebreaks (I don't know if it will work on Win32 or Mac Servers) - - $dumpline = str_replace("\r\n", "\n", $dumpline); - $dumpline = str_replace("\r", "\n", $dumpline); - - // DIAGNOSTIC - // echo ("

      Line $linenumber: $dumpline

      \n"); - - // Skip comments and blank lines only if NOT in parents - - if (!$inparents) { - $skipline = false; - reset($comment); - foreach ($comment as $comment_value) { - if (!$inparents && (trim($dumpline) == "" || strpos($dumpline, $comment_value) === 0)) { - $skipline = true; - break; - } - } - if ($skipline) { - $linenumber++; - continue; - } - } - - // Remove double back-slashes from the dumpline prior to count the quotes ('\\' can only be within strings) - - $dumpline_deslashed = str_replace("\\\\", "", $dumpline); - - // Count ' and \' in the dumpline to avoid query break within a text field ending by ; - // Please don't use double quotes ('"')to surround strings, it wont work - - $parents = substr_count($dumpline_deslashed, "'") - substr_count($dumpline_deslashed, "\\'"); - if ($parents % 2 != 0) - $inparents = !$inparents; - - // Add the line to query - - $query .= $dumpline; - - // Don't count the line if in parents (text fields may include unlimited linebreaks) - - if (!$inparents) - $querylines++; - - // Stop if query contains more lines as defined by MAX_QUERY_LINES - - if ($querylines > MAX_QUERY_LINES) { - echo ("

      ". JText::_('STOPPEDATLINE') ." $linenumber.

      "); - echo ("

      ". JText::sprintf('TOOMANYLINES',MAX_QUERY_LINES)."

      "); - $error = true; - break; - } - $vars = $this->getVars(); - $DBtype = JArrayHelper::getValue($vars, 'DBtype', 'mysql'); - $DBhostname = JArrayHelper::getValue($vars, 'DBhostname', ''); - $DBuserName = JArrayHelper::getValue($vars, 'DBuserName', ''); - $DBpassword = JArrayHelper::getValue($vars, 'DBpassword', ''); - $DBname = JArrayHelper::getValue($vars, 'DBname', ''); - $DBPrefix = JArrayHelper::getValue($vars, 'DBPrefix', 'jos_'); - $DBOld = JArrayHelper::getValue($vars, 'DBOld', 'bu'); - //$migration = JArrayHelper::getValue($vars, 'migration', '0'); - $migration = JRequest::getVar( 'migration', 0, 'post', 'bool' ); - - $db = & JInstallationHelper::getDBO($DBtype, $DBhostname, $DBuserName, $DBpassword, $DBname, $DBPrefix); - if(JError::isError($db)) jexit(JText::_('CONNECTION FAIL')); - -// echo 'Done.
      '; - // Execute query if end of query detected (; as last character) AND NOT in parents - - if (ereg(";$", trim($dumpline)) && !$inparents) { - if (!TESTMODE) { - $db->setQuery(trim($query)); -// echo $query . '
      '; - if (!$db->Query()) { - echo ("

      ".JText::_('Error at the line') ." $linenumber: ". trim($dumpline) . "

      \n"); - echo ("

      ".JText::_('Query:') . trim(nl2br(htmlentities($query))) ."

      \n"); - echo ("

      MySQL: " . mysql_error() . "

      \n"); - $error = true; - break; - } - $totalqueries++; - $queries++; - $query = ""; - $querylines = 0; - } - } - $linenumber++; - } - } - - // Get the current file position - - if (!$error) { - if (!$gzipmode) - $foffset = ftell($file); - else - $foffset = gztell($file); - if (!$foffset) { - echo ("

      ".JText::_('CANTREADPOINTER')."

      \n"); - $error = true; - } - } - - // Print statistics - - // echo ("

      Statistics

      \n"); - - if (!$error) { - $lines_this = $linenumber - $_REQUEST["start"]; - $lines_done = $linenumber -1; - $lines_togo = ' ? '; - $lines_tota = ' ? '; - - $queries_this = $queries; - $queries_done = $totalqueries; - $queries_togo = ' ? '; - $queries_tota = ' ? '; - - $bytes_this = $foffset - $_REQUEST["foffset"]; - $bytes_done = $foffset; - $kbytes_this = round($bytes_this / 1024, 2); - $kbytes_done = round($bytes_done / 1024, 2); - $mbytes_this = round($kbytes_this / 1024, 2); - $mbytes_done = round($kbytes_done / 1024, 2); - - if (!$gzipmode) { - $bytes_togo = $filesize - $foffset; - $bytes_tota = $filesize; - $kbytes_togo = round($bytes_togo / 1024, 2); - $kbytes_tota = round($bytes_tota / 1024, 2); - $mbytes_togo = round($kbytes_togo / 1024, 2); - $mbytes_tota = round($kbytes_tota / 1024, 2); - - $pct_this = ceil($bytes_this / $filesize * 100); - $pct_done = ceil($foffset / $filesize * 100); - $pct_togo = 100 - $pct_done; - $pct_tota = 100; - - if ($bytes_togo == 0) { - $lines_togo = '0'; - $lines_tota = $linenumber -1; - $queries_togo = '0'; - $queries_tota = $totalqueries; - } - - $pct_bar = "
      "; - } else { - $bytes_togo = ' ? '; - $bytes_tota = ' ? '; - $kbytes_togo = ' ? '; - $kbytes_tota = ' ? '; - $mbytes_togo = ' ? '; - $mbytes_tota = ' ? '; - - $pct_this = ' ? '; - $pct_done = ' ? '; - $pct_togo = ' ? '; - $pct_tota = 100; - $pct_bar = str_replace(' ', ' ', '[ Not available for gzipped files ]'); - } - /* - echo (" -
      - - - - - - - - - -
      SessionDoneTo goTotal
      Lines$lines_this$lines_done$lines_togo$lines_tota
      Queries$queries_this$queries_done$queries_togo$queries_tota
      Bytes$bytes_this$bytes_done$bytes_togo$bytes_tota
      KB$kbytes_this$kbytes_done$kbytes_togo$kbytes_tota
      MB$mbytes_this$mbytes_done$mbytes_togo$mbytes_tota
      %$pct_this$pct_done$pct_togo$pct_tota
      % bar$pct_bar
      -
      - \n");*/ - - // Finish message and restart the script - - if ($linenumber < $_REQUEST["start"] + $linespersession) { - echo ("

      ".JText::_('CONGRATSEOF')."

      \n"); - // Do migration - if($migration) { - ?>
      Migration will continue shortly...
      -
      - - - - - - - - - - -
      - - '. JText::_('FINALIZEINSTALL').'
      '; - //echo ("

      Thank you for using this tool! Please rate Bigdump at Hotscripts.com

      \n"); - //echo ("

      You can send me some bucks or euros as appreciation via PayPal

      \n"); - $error = true; - } else { - if ($delaypersession != 0) - echo ("

      ".JText::sprintf('DELAYMSG',$delaypersession)."

      \n"); - ?> -

      - -
      - - - - - - - - - - - - - -
      - window.setTimeout('location.href=\"" . $_SERVER["PHP_SELF"] . "?start=$linenumber&fn=" . $_REQUEST["fn"] . "&foffset=$foffset&totalqueries=$totalqueries\";',500+$delaypersession);\n"); - //echo ("\n"); - - //echo ("

      Press STOP to abort the import OR WAIT!

      \n"); - } - } else - echo ("

      ".JText::_('STOPPEDONERROR')."

      \n"); - -} - -//if ($dbconnection) mysql_close(); -if ($file && !$gzipmode) - fclose($file); -else - if ($file && $gzipmode) - gzclose($file); - -//ob_flush(); -//die(); -?> + + + + + +<?php JText::_('Migration load script') ?> + + + + $val) { + $val = preg_replace("/[^_A-Za-z0-9-\.&=]/i", '', $val); + $_REQUEST[$key] = $val; +} + +// Determine filename to execute for loading... +$filename = JPATH_BASE . DS . 'sql' . DS . 'migration' . DS . 'migrate.sql'; +$_REQUEST['fn'] = $filename; +$error = false; +$file = false; +// Single file mode + +if (!$error && !isset ($_REQUEST["fn"]) && $filename != "") { + echo ("

      Start Import from $filename into $db_name at $db_server

      \n"); +} + +// Open the file + +if (!$error && isset ($_REQUEST["fn"])) { + + // Recognize GZip filename + + if (eregi("\.gz$", $_REQUEST["fn"])) + $gzipmode = true; + else + $gzipmode = false; + if ((!$gzipmode && !$file = fopen($_REQUEST["fn"], "rt")) || ($gzipmode && !$file = gzopen($_REQUEST["fn"], "rt"))) { + echo ("

      ". JText::sprintf("Cant open file for import", $_REQUEST["fn"]) ."

      \n"); + echo ("

      ". JText::_('CHECKDUMPFILE') . + " .
      ". JText::_('NEEDTOUPLOADFILE')."

      \n"); + $error = true; + } + + // Get the file size (can't do it fast on gzipped files, no idea how) + + else + if ((!$gzipmode && fseek($file, 0, SEEK_END) == 0) || ($gzipmode && gzseek($file, 0) == 0)) { + if (!$gzipmode) + $filesize = ftell($file); + else + $filesize = gztell($file); // Always zero, ignore + } else { + echo ("

      ". JText::_('FILESIZEUNKNOWN') . $_REQUEST["fn"] . "

      \n"); + $error = true; + } +} + +// ******************************************************************************************* +// START IMPORT SESSION HERE +// ******************************************************************************************* +if (!$error && isset ($_REQUEST["start"]) && isset ($_REQUEST["foffset"]) && eregi("(\.(sql|gz|csv))$", $_REQUEST["fn"])) { + + // Check start and foffset are numeric values + + if (!is_numeric($_REQUEST["start"]) || !is_numeric($_REQUEST["foffset"])) { + echo ("

      ". JText::_('NONNUMERICOFFSET') ."

      \n"); + $error = true; + } + + if (!$error) { + $_REQUEST["start"] = floor($_REQUEST["start"]); + $_REQUEST["foffset"] = floor($_REQUEST["foffset"]); + } + + // Check $_REQUEST["foffset"] upon $filesize (can't do it on gzipped files) + + if (!$error && !$gzipmode && $_REQUEST["foffset"] > $filesize) { + echo ("

      ".JText::_('POINTEREOF')."

      \n"); + $error = true; + } + + // Set file pointer to $_REQUEST["foffset"] + + if (!$error && ((!$gzipmode && fseek($file, $_REQUEST["foffset"]) != 0) || ($gzipmode && gzseek($file, $_REQUEST["foffset"]) != 0))) { + echo ("

      ". JText::_('UNABLETOSETOFFSET') . $_REQUEST["foffset"] . "

      \n"); + $error = true; + } + + // Start processing queries from $file + + if (!$error) { + $query = ""; + $queries = 0; + $totalqueries = $_REQUEST["totalqueries"]; + $linenumber = $_REQUEST["start"]; + $querylines = 0; + $inparents = false; + + // Stay processing as long as the $linespersession is not reached or the query is still incomplete + + while ($linenumber < $_REQUEST["start"] + $linespersession || $query != "") { + + // Read the whole next line + + $dumpline = ""; + while (!feof($file) && substr($dumpline, -1) != "\n") { + if (!$gzipmode) + $dumpline .= fgets($file, DATA_CHUNK_LENGTH); + else + $dumpline .= gzgets($file, DATA_CHUNK_LENGTH); + } + if ($dumpline === "") + break; + + // Handle DOS and Mac encoded linebreaks (I don't know if it will work on Win32 or Mac Servers) + + $dumpline = str_replace("\r\n", "\n", $dumpline); + $dumpline = str_replace("\r", "\n", $dumpline); + + // DIAGNOSTIC + // echo ("

      Line $linenumber: $dumpline

      \n"); + + // Skip comments and blank lines only if NOT in parents + + if (!$inparents) { + $skipline = false; + reset($comment); + foreach ($comment as $comment_value) { + if (!$inparents && (trim($dumpline) == "" || strpos($dumpline, $comment_value) === 0)) { + $skipline = true; + break; + } + } + if ($skipline) { + $linenumber++; + continue; + } + } + + // Remove double back-slashes from the dumpline prior to count the quotes ('\\' can only be within strings) + + $dumpline_deslashed = str_replace("\\\\", "", $dumpline); + + // Count ' and \' in the dumpline to avoid query break within a text field ending by ; + // Please don't use double quotes ('"')to surround strings, it wont work + + $parents = substr_count($dumpline_deslashed, "'") - substr_count($dumpline_deslashed, "\\'"); + if ($parents % 2 != 0) + $inparents = !$inparents; + + // Add the line to query + + $query .= $dumpline; + + // Don't count the line if in parents (text fields may include unlimited linebreaks) + + if (!$inparents) + $querylines++; + + // Stop if query contains more lines as defined by MAX_QUERY_LINES + + if ($querylines > MAX_QUERY_LINES) { + echo ("

      ". JText::_('STOPPEDATLINE') ." $linenumber.

      "); + echo ("

      ". JText::sprintf('TOOMANYLINES',MAX_QUERY_LINES)."

      "); + $error = true; + break; + } + $vars = $this->getVars(); + $DBtype = JArrayHelper::getValue($vars, 'DBtype', 'mysql'); + $DBhostname = JArrayHelper::getValue($vars, 'DBhostname', ''); + $DBuserName = JArrayHelper::getValue($vars, 'DBuserName', ''); + $DBpassword = JArrayHelper::getValue($vars, 'DBpassword', ''); + $DBname = JArrayHelper::getValue($vars, 'DBname', ''); + $DBPrefix = JArrayHelper::getValue($vars, 'DBPrefix', 'jos_'); + $DBOld = JArrayHelper::getValue($vars, 'DBOld', 'bu'); + //$migration = JArrayHelper::getValue($vars, 'migration', '0'); + $migration = JRequest::getVar( 'migration', 0, 'post', 'bool' ); + + $db = & JInstallationHelper::getDBO($DBtype, $DBhostname, $DBuserName, $DBpassword, $DBname, $DBPrefix); + if(JError::isError($db)) jexit(JText::_('CONNECTION FAIL')); + +// echo 'Done.
      '; + // Execute query if end of query detected (; as last character) AND NOT in parents + + if (ereg(";$", trim($dumpline)) && !$inparents) { + if (!TESTMODE) { + $db->setQuery(trim($query)); +// echo $query . '
      '; + if (!$db->Query()) { + echo ("

      ".JText::_('Error at the line') ." $linenumber: ". trim($dumpline) . "

      \n"); + echo ("

      ".JText::_('Query:') . trim(nl2br(htmlentities($query))) ."

      \n"); + echo ("

      MySQL: " . mysql_error() . "

      \n"); + $error = true; + break; + } + $totalqueries++; + $queries++; + $query = ""; + $querylines = 0; + } + } + $linenumber++; + } + } + + // Get the current file position + + if (!$error) { + if (!$gzipmode) + $foffset = ftell($file); + else + $foffset = gztell($file); + if (!$foffset) { + echo ("

      ".JText::_('CANTREADPOINTER')."

      \n"); + $error = true; + } + } + + // Print statistics + + // echo ("

      Statistics

      \n"); + + if (!$error) { + $lines_this = $linenumber - $_REQUEST["start"]; + $lines_done = $linenumber -1; + $lines_togo = ' ? '; + $lines_tota = ' ? '; + + $queries_this = $queries; + $queries_done = $totalqueries; + $queries_togo = ' ? '; + $queries_tota = ' ? '; + + $bytes_this = $foffset - $_REQUEST["foffset"]; + $bytes_done = $foffset; + $kbytes_this = round($bytes_this / 1024, 2); + $kbytes_done = round($bytes_done / 1024, 2); + $mbytes_this = round($kbytes_this / 1024, 2); + $mbytes_done = round($kbytes_done / 1024, 2); + + if (!$gzipmode) { + $bytes_togo = $filesize - $foffset; + $bytes_tota = $filesize; + $kbytes_togo = round($bytes_togo / 1024, 2); + $kbytes_tota = round($bytes_tota / 1024, 2); + $mbytes_togo = round($kbytes_togo / 1024, 2); + $mbytes_tota = round($kbytes_tota / 1024, 2); + + $pct_this = ceil($bytes_this / $filesize * 100); + $pct_done = ceil($foffset / $filesize * 100); + $pct_togo = 100 - $pct_done; + $pct_tota = 100; + + if ($bytes_togo == 0) { + $lines_togo = '0'; + $lines_tota = $linenumber -1; + $queries_togo = '0'; + $queries_tota = $totalqueries; + } + + $pct_bar = "
      "; + } else { + $bytes_togo = ' ? '; + $bytes_tota = ' ? '; + $kbytes_togo = ' ? '; + $kbytes_tota = ' ? '; + $mbytes_togo = ' ? '; + $mbytes_tota = ' ? '; + + $pct_this = ' ? '; + $pct_done = ' ? '; + $pct_togo = ' ? '; + $pct_tota = 100; + $pct_bar = str_replace(' ', ' ', '[ Not available for gzipped files ]'); + } + /* + echo (" +
      + + + + + + + + + +
      SessionDoneTo goTotal
      Lines$lines_this$lines_done$lines_togo$lines_tota
      Queries$queries_this$queries_done$queries_togo$queries_tota
      Bytes$bytes_this$bytes_done$bytes_togo$bytes_tota
      KB$kbytes_this$kbytes_done$kbytes_togo$kbytes_tota
      MB$mbytes_this$mbytes_done$mbytes_togo$mbytes_tota
      %$pct_this$pct_done$pct_togo$pct_tota
      % bar$pct_bar
      +
      + \n");*/ + + // Finish message and restart the script + + if ($linenumber < $_REQUEST["start"] + $linespersession) { + echo ("

      ".JText::_('CONGRATSEOF')."

      \n"); + // Do migration + if($migration) { + ?>
      Migration will continue shortly...
      +
      + + + + + + + + + + +
      + + '. JText::_('FINALIZEINSTALL').''; + //echo ("

      Thank you for using this tool! Please rate Bigdump at Hotscripts.com

      \n"); + //echo ("

      You can send me some bucks or euros as appreciation via PayPal

      \n"); + $error = true; + } else { + if ($delaypersession != 0) + echo ("

      ".JText::sprintf('DELAYMSG',$delaypersession)."

      \n"); + ?> +

      + +
      + + + + + + + + + + + + + +
      + window.setTimeout('location.href=\"" . $_SERVER["PHP_SELF"] . "?start=$linenumber&fn=" . $_REQUEST["fn"] . "&foffset=$foffset&totalqueries=$totalqueries\";',500+$delaypersession);\n"); + //echo ("\n"); + + //echo ("

      Press STOP to abort the import OR WAIT!

      \n"); + } + } else + echo ("

      ".JText::_('STOPPEDONERROR')."

      \n"); + +} + +//if ($dbconnection) mysql_close(); +if ($file && !$gzipmode) + fclose($file); +else + if ($file && $gzipmode) + gzclose($file); + +//ob_flush(); +//die(); + diff --git a/installation/includes/defines.php b/installation/includes/defines.php index 4ada4e7ac1686..97feccfc89a44 100644 --- a/installation/includes/defines.php +++ b/installation/includes/defines.php @@ -1,31 +1,31 @@ - 10) && !file_exists( JPATH_INSTALLATION . DS . 'index.php' )) { - header( 'Location: ../index.php' ); - exit(); -} - -/* - * Joomla! system startup - */ - -// System includes -require_once( JPATH_LIBRARIES .DS.'joomla'.DS.'import.php'); - -// Installation file includes -define( 'JPATH_INCLUDES', dirname(__FILE__) ); - -/* - * Joomla! framework loading - */ - -// Include object abstract class -jimport( 'joomla.utilities.compat.compat' ); - -// Joomla! library imports -jimport( 'joomla.database.table' ); -jimport( 'joomla.user.user'); -jimport( 'joomla.environment.uri' ); -jimport( 'joomla.user.user'); + 10) && !file_exists( JPATH_INSTALLATION . DS . 'index.php' )) { + header( 'Location: ../index.php' ); + exit(); +} + +/* + * Joomla! system startup + */ + +// System includes +require_once(JPATH_LIBRARIES . DS . 'joomla' . DS . 'import.php'); + +// Installation file includes +define( 'JPATH_INCLUDES', dirname(__FILE__) ); + +/* + * Joomla! framework loading + */ + +// Include object abstract class +jimport( 'joomla.utilities.compat.compat' ); + +// Joomla! library imports +jimport( 'joomla.database.table' ); +jimport( 'joomla.user.user'); +jimport( 'joomla.environment.uri' ); +jimport( 'joomla.user.user'); jimport( 'joomla.html.parameter' ); -jimport( 'joomla.utilities.utility' ); -jimport( 'joomla.language.language'); -jimport( 'joomla.utilities.string' ); -?> \ No newline at end of file +jimport( 'joomla.utilities.utility' ); +jimport( 'joomla.language.language'); +jimport( 'joomla.utilities.string' ); diff --git a/installation/includes/index.html b/installation/includes/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/installation/includes/index.html +++ b/installation/includes/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/installation/includes/js/index.html b/installation/includes/js/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/installation/includes/js/index.html +++ b/installation/includes/js/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/installation/includes/js/installation.js b/installation/includes/js/installation.js index 80ffc8cb87603..5ef9b19474517 100644 --- a/installation/includes/js/installation.js +++ b/installation/includes/js/installation.js @@ -1,22 +1,32 @@ -/** * @version $Id: install.js 966 2005-11-11 01:37:07Z Jinx $ * @package Joomla * @subpackage Installation * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL */ - /** -* @param object A form element -* @param string The name of the element to find -*/ -function getElementByName( f, name ) { - if (f.elements) { - for (i=0, n=f.elements.length; i < n; i++) { - if (f.elements[i].name == name) { - return f.elements[i]; - } - } - } - return null; -} -/** - * Generic submit form - */ -function submitForm( frm, task ) { - frm.task.value = task; - frm.submit(); -} \ No newline at end of file +/** +* @version $Id: install.js 966 2005-11-11 01:37:07Z Jinx $ +* @package Joomla +* @subpackage Installation +* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +* @license GNU/GPL +*/ + + /** +* @param object A form element +* @param string The name of the element to find +*/ +function getElementByName( f, name ) { + if (f.elements) { + for (i=0, n=f.elements.length; i < n; i++) { + if (f.elements[i].name == name) { + return f.elements[i]; + } + } + } + return null; +} + +/** + * Generic submit form + */ + +function submitForm( frm, task ) { + frm.task.value = task; + frm.submit(); +} + diff --git a/installation/includes/js/xajax.js b/installation/includes/js/xajax.js index 57fcd2435f353..2f1b99040776b 100644 --- a/installation/includes/js/xajax.js +++ b/installation/includes/js/xajax.js @@ -1,10 +1,10 @@ function Xajax() { if (xajaxDebug) this.DebugMessage = function(text) { alert("Xajax Debug:\n " + text) }; - + this.workId = 'xajaxWork'+ new Date().getTime(); this.depth = 0; - + //Get the XMLHttpRequest Object this.getRequestObject = function() { @@ -27,11 +27,11 @@ function Xajax() } if(!req && typeof XMLHttpRequest != "undefined") req = new XMLHttpRequest(); - + if (xajaxDebug) { if (!req) this.DebugMessage("Request Object Instantiation failed."); } - + return req; } @@ -47,7 +47,7 @@ function Xajax() } return returnObj; } - + // xajax.include(sFileName) dynamically includes an external javascript file this.include = function(sFileName) { @@ -57,7 +57,7 @@ function Xajax() objScript.src = sFileName; objHead[0].appendChild(objScript); } - + // xajax.addHandler adds an event handler to an element this.addHandler = function(sElementId, sEvent, sFunctionName) { @@ -70,7 +70,7 @@ function Xajax() eval("this.$('"+sElementId+"').attachEvent('on"+sEvent+"',"+sFunctionName+",false);"); } } - + // xajax.removeHandler removes an event handler from an element this.removeHandler = function(sElementId, sEvent, sFunctionName) { @@ -83,7 +83,7 @@ function Xajax() eval("this.$('"+sElementId+"').detachEvent('on"+sEvent+"',"+sFunctionName+",false);"); } } - + // xajax.create creates a new child node under a parent this.create = function(sParentId, sTag, sId) { @@ -92,7 +92,7 @@ function Xajax() objElement.setAttribute('id',sId); objParent.appendChild(objElement); } - + // xajax.insert inserts a new node before another node this.insert = function(sBeforeId, sTag, sId) { @@ -101,7 +101,7 @@ function Xajax() objElement.setAttribute('id',sId); objSibling.parentNode.insertBefore(objElement, objSibling); } - + this.getInput = function(sType, sName, sId) { var Obj; @@ -118,7 +118,7 @@ function Xajax() } return Obj; } - + // xajax.createInput creates a new input node under a parent this.createInput = function(sParentId, sType, sName, sId) { @@ -126,7 +126,7 @@ function Xajax() var objElement = this.getInput(sType, sName, sId); objParent.appendChild(objElement); } - + // xajax.insertInput creates a new input node before another node this.insertInput = function(sBeforeId, sType, sName, sId) { @@ -134,7 +134,7 @@ function Xajax() var objElement = this.getInput(sType, sName, sId); objSibling.parentNode.insertBefore(objElement, objSibling); } - + // xajax.remove deletes an element this.remove = function(sId) { @@ -144,16 +144,16 @@ function Xajax() objElement.parentNode.removeChild(objElement); } } - + //xajax.replace searches for text in an attribute of an element and replaces it //with a different text this.replace = function(sId,sAttribute,sSearch,sReplace) { var bFunction = false; - + if (sAttribute == "innerHTML") sSearch = this.getBrowserHTML(sSearch); - + eval("var txt=document.getElementById('"+sId+"')."+sAttribute); if (typeof txt == "function") { @@ -172,7 +172,7 @@ function Xajax() newTxt += txt; if (bFunction) { - eval("newTxt =" + newTxt); + eval("newTxt =" + newTxt); eval('this.$("'+sId+'").'+sAttribute+'=newTxt;'); } else if (this.willChange(sId,sAttribute,newTxt)) @@ -181,7 +181,7 @@ function Xajax() } } } - + // xajax.getFormValues() builds a query string XML message from the elements of a form object this.getFormValues = function(frm) { @@ -189,7 +189,7 @@ function Xajax() var submitDisabledElements = false; if (arguments.length > 1 && arguments[1] == true) submitDisabledElements = true; - + if (typeof(frm) == "string") objForm = this.$(frm); else @@ -219,15 +219,15 @@ function Xajax() { sXml += name+"="+encodeURIComponent(formElements[i].value); } - } + } } } - + sXml +=""; - + return sXml; } - + // Generates an XML message that xajax can understand from a javascript object this.objectToXML = function(obj) { @@ -240,10 +240,10 @@ function Xajax() continue; if (obj[i] && typeof(obj[i]) == 'function') continue; - + var key = i; var value = obj[i]; - if (value && typeof(value)=="object" && + if (value && typeof(value)=="object" && (value.constructor == Array ) && this.depth <= 50) { @@ -251,9 +251,9 @@ function Xajax() value = this.objectToXML(value); this.depth--; } - + sXml += ""+key+""+value+""; - + } catch(e) { @@ -261,7 +261,7 @@ function Xajax() } } sXml += ""; - + return sXml; } @@ -335,7 +335,7 @@ function Xajax() { if (r.readyState != 4) return; - + if (r.status==200) { if (xajaxDebug && r.responseText.length < 1000) xajax.DebugMessage("Received:\n" + r.responseText); @@ -345,10 +345,10 @@ function Xajax() else { alert("Error: the XML response that was returned from the server is invalid."); document.body.style.cursor = 'default'; - if (xajaxStatusMessages == true) window.status = 'Invalid XML response error'; + if (xajaxStatusMessages == true) window.status = 'Invalid XML response error'; } } - + delete r; } if (xajaxDebug) this.DebugMessage("Calling "+sFunction +" uri="+uri+" (post:"+ postData +")"); @@ -357,7 +357,7 @@ function Xajax() delete r; return true; } - + //Gets the text as it would be if it were being retrieved from //the innerHTML property in the current browser this.getBrowserHTML = function(html) @@ -373,11 +373,11 @@ function Xajax() } tmpXajax.innerHTML = html; var browserHTML = tmpXajax.innerHTML; - tmpXajax.innerHTML = ''; - + tmpXajax.innerHTML = ''; + return browserHTML; } - + // Tests if the new Data is the same as the extant data this.willChange = function(element, attribute, newData) { @@ -393,10 +393,10 @@ function Xajax() eval("oldData=document.getElementById('"+element+"')."+attribute); if (newData != oldData) return true; - + return false; } - + //Process XML xajaxResponses returned from the request this.processResponse = function(xml) { @@ -420,7 +420,7 @@ function Xajax() var search; var type; var before; - + for (j=0; j 1 && arguments[1] == true) submitDisabledElements = true; - + if (typeof(frm) == "string") objForm = this.$(frm); else @@ -219,15 +219,15 @@ function Xajax() { sXml += name+"="+encodeURIComponent(formElements[i].value); } - } + } } } - + sXml +=""; - + return sXml; } - + // Generates an XML message that xajax can understand from a javascript object this.objectToXML = function(obj) { @@ -240,10 +240,10 @@ function Xajax() continue; if (obj[i] && typeof(obj[i]) == 'function') continue; - + var key = i; var value = obj[i]; - if (value && typeof(value)=="object" && + if (value && typeof(value)=="object" && (value.constructor == Array ) && this.depth <= 50) { @@ -251,9 +251,9 @@ function Xajax() value = this.objectToXML(value); this.depth--; } - + sXml += ""+key+""+value+""; - + } catch(e) { @@ -261,7 +261,7 @@ function Xajax() } } sXml += ""; - + return sXml; } @@ -335,7 +335,7 @@ function Xajax() { if (r.readyState != 4) return; - + if (r.status==200) { if (xajaxDebug && r.responseText.length < 1000) xajax.DebugMessage("Received:\n" + r.responseText); @@ -345,10 +345,10 @@ function Xajax() else { alert("Error: the XML response that was returned from the server is invalid."); document.body.style.cursor = 'default'; - if (xajaxStatusMessages == true) window.status = 'Invalid XML response error'; + if (xajaxStatusMessages == true) window.status = 'Invalid XML response error'; } } - + delete r; } if (xajaxDebug) this.DebugMessage("Calling "+sFunction +" uri="+uri+" (post:"+ postData +")"); @@ -357,7 +357,7 @@ function Xajax() delete r; return true; } - + //Gets the text as it would be if it were being retrieved from //the innerHTML property in the current browser this.getBrowserHTML = function(html) @@ -373,11 +373,11 @@ function Xajax() } tmpXajax.innerHTML = html; var browserHTML = tmpXajax.innerHTML; - tmpXajax.innerHTML = ''; - + tmpXajax.innerHTML = ''; + return browserHTML; } - + // Tests if the new Data is the same as the extant data this.willChange = function(element, attribute, newData) { @@ -393,10 +393,10 @@ function Xajax() eval("oldData=document.getElementById('"+element+"')."+attribute); if (newData != oldData) return true; - + return false; } - + //Process XML xajaxResponses returned from the request this.processResponse = function(xml) { @@ -420,7 +420,7 @@ function Xajax() var search; var type; var before; - + for (j=0; j - * @package Joomla - * @since 1.5 - */ -class JRouterInstallation extends JObject -{ - /** - * Function to convert a route to an internal URI - * - * @access public - */ - function parse($url) - { - return true; - } - - /** - * Function to convert an internal URI to a route - * - * @param string $string The internal URL - * @return string The absolute search engine friendly URL - * @since 1.5 - */ - function build($url) - { - $url = str_replace('&', '&', $url); - - return $url; - } -} \ No newline at end of file + \ No newline at end of file + \ No newline at end of file diff --git a/installation/index.php b/installation/index.php index 6cb5eff9ed13c..5285521ee822a 100644 --- a/installation/index.php +++ b/installation/index.php @@ -1,36 +1,36 @@ -initialise(); - -// render the application -$mainframe->render(); - - - -/** - * RETURN THE RESPONSE - */ -echo JResponse::toString(); +initialise(); + +// render the application +$mainframe->render(); + + + +/** + * RETURN THE RESPONSE + */ +echo JResponse::toString(); diff --git a/installation/installer/controller.php b/installation/installer/controller.php index a1e7422356703..76a52dcec1508 100644 --- a/installation/installer/controller.php +++ b/installation/installer/controller.php @@ -22,14 +22,15 @@ */ jimport('joomla.application.component.controller'); -require_once( dirname(__FILE__).DS.'models'.DS.'model.php'); -require_once( dirname(__FILE__).DS.'views'.DS.'install'.DS.'view.php'); +require_once dirname(__FILE__).DS.'models'.DS.'model.php'; +require_once dirname(__FILE__).DS.'views'.DS.'install'.DS.'view.php'; class JInstallationController extends JController { - var $_model = null; + protected $_model = null; + + protected $_view = null; - var $_view = null; /** * Constructor @@ -74,7 +75,7 @@ function dbconfig() */ function execute($task) { - global $mainframe; + $appl = JFactory::getApplication(); // Sanity check if ( $task && ( $task != 'lang' ) && ( $task != 'removedir' ) ) @@ -85,7 +86,7 @@ function execute($task) * If the state is not set, then cookies are probably disabled. **/ - $goodEnoughForMe = $mainframe->getUserState('application.cookietest'); + $goodEnoughForMe = $appl->getUserState('application.cookietest'); if ( ! $goodEnoughForMe ) { @@ -105,7 +106,7 @@ function execute($task) $registry->makeNameSpace('application'); // Set the cookie test seed - $mainframe->setUserState('application.cookietest', 1); + $appl->setUserState('application.cookietest', 1); } parent::execute($task); @@ -271,7 +272,7 @@ function makedb() */ function mainconfig() { - //$this->dumpLoad(); + $model =& $this->getModel(); $view =& $this->getView(); @@ -363,22 +364,22 @@ function saveconfig() return true; } - function dumpLoad() { - $model =& $this->getModel(); - $model->dumpLoad(); - - } - function migration() { $model =& $this->getModel(); - $model->setData('back', 'mainconfig'); + $view =& $this->getView(); if(!$model->checkUpload()) { $view->error(); return false; } - $view->migrateScreen(); + if (!$model->dumpLoad()) + { + $view->error(); + return false; + } + + $view->migration(); return true; } @@ -390,4 +391,4 @@ function postmigrate() { } } -} \ No newline at end of file +} diff --git a/installation/installer/helper.php b/installation/installer/helper.php index 25450af94904e..16727a1a11682 100644 --- a/installation/installer/helper.php +++ b/installation/installer/helper.php @@ -27,7 +27,7 @@ class JInstallationHelper */ function detectDB() { - $map = array ('mysql_connect' => 'mysql', 'mysqli_connect' => 'mysqli', 'mssql_connect' => 'mssql'); + $map = array ('mysqli_connect' => 'mysqli', 'mysql_connect' => 'mysql', 'mssql_connect' => 'mssql'); foreach ($map as $f => $db) { if (function_exists($f)) @@ -195,11 +195,12 @@ function populateDatabase(& $db, $sqlfile, & $errors, $nexttask='mainconfig') { $db->setQuery($query); //echo $query .'
      '; - $db->query() or die($db->getErrorMsg()); + $db->query(); JInstallationHelper::getDBErrors($errors, $db ); } } + return count($errors); } @@ -290,8 +291,9 @@ function createAdminUser(& $vars) $nullDate = $db->getNullDate(); $query = "INSERT INTO #__users VALUES (62, 'Administrator', 'admin', ".$db->Quote($adminEmail).", ".$db->Quote($cryptpass).", 'Super Administrator', 0, 1, 25, '$installdate', '$nullDate', '', '')"; $db->setQuery($query); - if (!$db->query()) - { + try { + $db->query(); + } catch(JException $e) { // is there already and existing admin in migrated data if ( $db->getErrorNum() == 1062 ) { @@ -309,8 +311,9 @@ function createAdminUser(& $vars) // add the ARO (Access Request Object) $query = "INSERT INTO #__core_acl_aro VALUES (10,'users','62',0,'Administrator',0)"; $db->setQuery($query); - if (!$db->query()) - { + try { + $db->query(); + } catch (JException $e) { echo $db->getErrorMsg(); return; } @@ -318,8 +321,9 @@ function createAdminUser(& $vars) // add the map between the ARO and the Group $query = "INSERT INTO #__core_acl_groups_aro_map VALUES (25,'',10)"; $db->setQuery($query); - if (!$db->query()) - { + try { + $db->query(); + } catch (JException $e) { echo $db->getErrorMsg(); return; } @@ -630,7 +634,8 @@ function findMigration( &$args ) { */ function uploadSql( &$args, $migration = false, $preconverted = false ) { - global $mainframe; + $appl = JFactory::getApplication(); + $archive = ''; $script = ''; @@ -841,19 +846,19 @@ function unpack($p_filename, &$vars) { } function return_bytes($val) { - $val = trim($val); - $last = strtolower($val{strlen($val)-1}); - switch($last) { - // The 'G' modifier is available since PHP 5.1.0 - case 'g': - $val *= 1024; - case 'm': - $val *= 1024; - case 'k': - $val *= 1024; - } - - return $val; + $val = trim($val); + $last = strtolower($val{strlen($val)-1}); + switch($last) { + // The 'G' modifier is available since PHP 5.1.0 + case 'g': + $val *= 1024; + case 'm': + $val *= 1024; + case 'k': + $val *= 1024; + } + + return $val; } function replaceBuffer(&$buffer, $oldPrefix, $newPrefix, $srcEncoding) { @@ -1295,12 +1300,10 @@ function postMigrate( $db, & $errors, & $args ) { JInstallationHelper::getDBErrors($errors, $db ); } - // TODO: SAM: This doesn't work? /* * Add core client modules from old site to modules table as unpublished - * SAM: Of course this doesn't work since we dont use this table any more! */ - $query = 'SELECT id FROM '.$newPrefix.'modules_migration WHERE client_id = 0 '; //AND module != "mod_mainmenu"'; + $query = 'SELECT id FROM '.$newPrefix.'modules_migration WHERE client_id = 0 '; $db->setQuery( $query ); $lookup = $db->loadResultArray(); JInstallationHelper::getDBErrors($errors, $db ); @@ -1395,7 +1398,8 @@ function getDBErrors( & $errors, $db ) */ function setFTPCfg( $vars ) { - global $mainframe; + $appl = JFactory::getApplication(); + $arr = array(); $arr['ftp_enable'] = $vars['ftpEnable']; $arr['ftp_user'] = $vars['ftpUser']; @@ -1404,20 +1408,21 @@ function setFTPCfg( $vars ) $arr['ftp_host'] = $vars['ftpHost']; $arr['ftp_port'] = $vars['ftpPort']; - $mainframe->setCfg( $arr, 'config' ); + $appl->setCfg( $arr, 'config' ); } function _chmod( $path, $mode ) { - global $mainframe; + $appl = JFactory::getApplication(); + $ret = false; // Initialize variables $ftpFlag = true; - $ftpRoot = $mainframe->getCfg('ftp_root'); + $ftpRoot = $appl->getCfg('ftp_root'); // Do NOT use ftp if it is not enabled - if ($mainframe->getCfg('ftp_enable') != 1) { + if ($appl->getCfg('ftp_enable') != 1) { $ftpFlag = false; } @@ -1425,8 +1430,8 @@ function _chmod( $path, $mode ) { // Connect the FTP client jimport('joomla.client.ftp'); - $ftp = & JFTP::getInstance($mainframe->getCfg('ftp_host'), $mainframe->getCfg('ftp_port')); - $ftp->login($mainframe->getCfg('ftp_user'), $mainframe->getCfg('ftp_pass')); + $ftp = & JFTP::getInstance($appl->getCfg('ftp_host'), $appl->getCfg('ftp_port')); + $ftp->login($appl->getCfg('ftp_user'), $appl->getCfg('ftp_pass')); //Translate the destination path for the FTP account $path = JPath::clean(str_replace(JPATH_SITE, $ftpRoot, $path), '/'); @@ -1450,22 +1455,21 @@ function _chmod( $path, $mode ) /** Borrowed from http://au.php.net/manual/en/ini.core.php comments */ function let_to_num($v){ //This function transforms the php.ini notation for numbers (like '2M') to an integer (2*1024*1024 in this case) - $l = substr($v, -1); - $ret = substr($v, 0, -1); - switch(strtoupper($l)){ - case 'P': - $ret *= 1024; - case 'T': - $ret *= 1024; - case 'G': - $ret *= 1024; - case 'M': - $ret *= 1024; - case 'K': - $ret *= 1024; - break; - } - return $ret; + $l = substr($v, -1); + $ret = substr($v, 0, -1); + switch(strtoupper($l)){ + case 'P': + $ret *= 1024; + case 'T': + $ret *= 1024; + case 'G': + $ret *= 1024; + case 'M': + $ret *= 1024; + case 'K': + $ret *= 1024; + break; + } + return $ret; } } -?> diff --git a/installation/installer/index.html b/installation/installer/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/installation/installer/index.html +++ b/installation/installer/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/installation/installer/installer.php b/installation/installer/installer.php index 03b3f41c6abc0..c87467ae5cb19 100644 --- a/installation/installer/installer.php +++ b/installation/installer/installer.php @@ -16,8 +16,8 @@ defined('_JEXEC') or die('Restricted access'); $here = dirname(__FILE__); -require_once( $here.DS.'controller.php'); -require_once( $here.DS.'helper.php'); +require_once $here.DS.'controller.php'; +require_once $here.DS.'helper.php'; // Get the controller $config = array(); diff --git a/installation/installer/jajax.php b/installation/installer/jajax.php index 28181db1e2189..fc4ae5ed56ec3 100644 --- a/installation/installer/jajax.php +++ b/installation/installer/jajax.php @@ -1,368 +1,197 @@ - 10)) { - header( 'Location: ../../index.php' ); - exit(); -} - -// System includes -require_once( JPATH_LIBRARIES .DS.'joomla'.DS.'import.php'); - -require_once( JPATH_BASE . DS. 'installer' . DS . 'helper.php' ); -// Require the xajax library -require_once (JXPATH_BASE.DS.'xajax'.DS.'xajax.inc.php'); -$xajax = new xajax(); -$xajax->errorHandlerOn(); - -$xajax->registerFunction(array('getFtpRoot', 'JAJAXHandler', 'ftproot')); -$xajax->registerFunction(array('FTPVerify', 'JAJAXHandler', 'ftpverify')); -$xajax->registerFunction(array('instDefault', 'JAJAXHandler', 'sampledata')); - -JError::setErrorHandling(E_ERROR, 'callback', array('JAJAXHandler','handleError')); -JError::setErrorHandling(E_WARNING, 'callback', array('JAJAXHandler','handleError')); -JError::setErrorHandling(E_NOTICE, 'callback', array('JAJAXHandler','handleError')); -jimport( 'joomla.utilities.compat.compat' ); - -/** - * AJAX Task handler class - * - * @static - * @package Joomla - * @subpackage Installer - * @since 1.5 - */ -class JAJAXHandler -{ - /** - * Method to get the path from the FTP root to the Joomla root directory - */ - function ftproot($args) - { - jimport( 'joomla.application.application' ); - jimport( 'joomla.registry.registry' ); - - $lang = new JAJAXLang($args['lang']); -// $lang->setDebug(true); - - $objResponse = new xajaxResponse(); - $args = $args['vars']; - - $root = JInstallationHelper::findFtpRoot($args['ftpUser'], $args['ftpPassword'], $args['ftpHost'], $args['ftpPort']); - if (JError::isError($root)) { - $objResponse->addScript('document.getElementById(\'ftpdisable\').checked = true;'); - $objResponse->addAlert($lang->_($root->get('message'))); - } else { - $objResponse->addAssign('ftproot', 'value', $root); - $objResponse->addAssign('rootPath', 'style.display', ''); - $objResponse->addScript('document.getElementById(\'verifybutton\').click();'); - } - - return $objResponse; - } - - /** - * Method to verify the ftp values are valid - */ - function ftpverify($args) - { - jimport( 'joomla.application.application' ); - jimport( 'joomla.registry.registry' ); - - $lang = new JAJAXLang($args['lang']); -// $lang->setDebug(true); - - $objResponse = new xajaxResponse(); - $args = $args['vars']; - - $status = JInstallationHelper::FTPVerify($args['ftpUser'], $args['ftpPassword'], $args['ftpRoot'], $args['ftpHost'], $args['ftpPort']); - if (JError::isError($status)) { - if (($msg = $status->get('message')) != 'INVALIDROOT') { - $msg = $lang->_('INVALIDFTP') ."\n". $lang->_($msg); - } else { - $msg = $lang->_($msg); - } - $objResponse->addScript('document.getElementById(\'ftpdisable\').checked = true;'); - $objResponse->addAlert($msg); - } else { - $objResponse->addScript('document.getElementById(\'ftpenable\').checked = true;'); - $objResponse->addAlert($lang->_('VALIDFTP')); - } - - return $objResponse; - } - - /** - * Method to load and execute a sql script - */ - function sampledata($args) - { - jimport( 'joomla.database.database'); - jimport( 'joomla.language.language'); - jimport( 'joomla.registry.registry'); - - - $errors = null; - $msg = ''; - $objResponse = new xajaxResponse(); - $lang = new JAJAXLang($args['lang']); -// $lang->setDebug(true); - - /* - * execute the default sample data file - */ - $type = $args['DBtype']; - if ($type == 'mysqli') { - $type = 'mysql'; - } - $dbsample = '../sql'.DS.$type.DS.'sample_data.sql'; - - $db = & JInstallationHelper::getDBO($args['DBtype'], $args['DBhostname'], $args['DBuserName'], $args['DBpassword'], $args['DBname'], $args['DBPrefix']); - $result = JInstallationHelper::populateDatabase($db, $dbsample, $errors); - - /* - * prepare sql error messages if returned from populate - */ - if (!is_null($errors)){ - foreach($errors as $error){ - $msg .= stripslashes( $error['msg'] ); - $msg .= chr(13)."-------------".chr(13); - $txt = ''; - } - } else { - // consider other possible errors from populate - $msg = $result == 0 ? $lang->_("Sample data installed successfully") : $lang->_("Error installing SQL script") ; - $txt = ''; - } - - $objResponse->addAssign("theDefault", "innerHTML", $txt); - return $objResponse; - } - - /** - * Handle a raised error : for now just silently return - * - * @access private - * @param object $error JError object - * @return object $error JError object - * @since 1.5 - */ - function &handleError(&$error) - { - return $error; - } -} - - -/** - * Languages/translation handler class - * - * @package Joomla.Framework - * @subpackage I18N - * @since 1.5 - */ -class JAJAXLang extends JObject -{ - /** - * Debug language, If true, highlights if string isn't found - * - * @var boolean - * @access protected - */ - var $_debug = false; - - /** - * Identifying string of the language - * - * @var string - * @access protected - */ - var $_identifyer = null; - - /** - * The language to load - * - * @var string - * @access protected - */ - var $_lang = null; - - /** - * Transaltions - * - * @var array - * @access protected - */ - var $_strings = null; - - /** - * Constructor activating the default information of the language - * - * @access protected - */ - function __construct($lang = null) - { - $this->_strings = array (); - - if ($lang == null) { - $lang = 'en-GB'; - } - - $this->_lang= $lang; - - $this->load(); - } - - /** - * Translator function, mimics the php gettext (alias _) function - * - * @access public - * @param string $string The string to translate - * @param boolean $jsSafe Make the result javascript safe - * @return string The translation of the string - */ - function _($string, $jsSafe = false) - { - //$key = str_replace( ' ', '_', strtoupper( trim( $string ) ) );echo '
      '.$key; - $key = strtoupper($string); - $key = substr($key, 0, 1) == '_' ? substr($key, 1) : $key; - if (isset ($this->_strings[$key])) { - $string = $this->_debug ? "•".$this->_strings[$key]."•" : $this->_strings[$key]; - } else { - if (defined($string)) { - $string = $this->_debug ? "!!".constant($string)."!!" : constant($string); - } else { - $string = $this->_debug ? "??".$string."??" : $string; - } - } - if ($jsSafe) { - $string = addslashes($string); - } - return $string; - } - - /** - * Loads a single language file and appends the results to the existing strings - * - * @access public - * @param string $prefix The prefix - * @param string $basePath The basepath to use - * $return boolean True, if the file has successfully loaded. - */ - function load( $prefix = '', $basePath = JPATH_BASE ) - { - $path = JAJAXLang::getLanguagePath( $basePath, $this->_lang); - - $filename = empty( $prefix ) ? $this->_lang : $this->_lang . '.' . $prefix ; - - $result = false; - - $newStrings = $this->_load( $path.DS.$filename.'.ini' ); - - if (is_array($newStrings)) { - $this->_strings = array_merge( $this->_strings, $newStrings); - $result = true; - } - - return $result; - - } - - /** - * Loads a language file and returns the parsed values - * - * @access private - * @param string The name of the file - * @return mixed Array of parsed values if successful, boolean False if failed - */ - function _load( $filename ) - { - if ($content = @file_get_contents( $filename )) { - if( $this->_identifyer === null ) { - $this->_identifyer = basename( $filename, '.ini' ); - } - - $registry = new JRegistry(); - $registry->loadINI($content); - return $registry->toArray( ); - } - - return false; - } - - /** - * Set the Debug property - * - * @access public - */ - function setDebug($debug) { - $this->_debug = $debug; - } - - /** - * Determines is a key exists - * - * @access public - * @param key $key The key to check - * @return boolean True, if the key exists - */ - function hasKey($key) { - return isset ($this->_strings[strtoupper($key)]); - } - - /** - * Get the path to a language - * - * @access public - * @param string $basePath The basepath to use - * @param string $language The language tag - * @return string language related path or null - */ - function getLanguagePath($basePath = JPATH_BASE, $language = null ) - { - $dir = $basePath.DS.'language'; - if (isset ($language)) { - $dir .= DS.$language; - } - return $dir; - } -} - - - -/* - * Process the AJAX requests - */ -$xajax->cleanBufferOff(); //Needed for suPHP compilance -$xajax->processRequests(); \ No newline at end of file + 10)) { + header( 'Location: ../../index.php' ); + exit(); +} + +// System includes +require_once JPATH_LIBRARIES .DS.'joomla'.DS.'import.php'; + +require_once JPATH_BASE . DS. 'installer' . DS . 'helper.php'; +// Require the xajax library +require_once JXPATH_BASE.DS.'xajax'.DS.'xajax.inc.php'; +$xajax = new xajax(); +$xajax->errorHandlerOn(); + +$xajax->registerFunction(array('getFtpRoot', 'JAJAXHandler', 'ftproot')); +$xajax->registerFunction(array('FTPVerify', 'JAJAXHandler', 'ftpverify')); +$xajax->registerFunction(array('instDefault', 'JAJAXHandler', 'sampledata')); + +JError::setErrorHandling(E_ERROR, 'callback', array('JAJAXHandler','handleError')); +JError::setErrorHandling(E_WARNING, 'callback', array('JAJAXHandler','handleError')); +JError::setErrorHandling(E_NOTICE, 'callback', array('JAJAXHandler','handleError')); +jimport( 'joomla.utilities.compat.compat' ); + + + +// initialuse the application +$mainframe->initialise(); + +/** + * AJAX Task handler class + * + * @static + * @package Joomla + * @subpackage Installer + * @since 1.5 + */ +class JAJAXHandler +{ + function & _getVars() + { + static $vars; + + if ( ! $vars ) + { + $session = JFactory::getSession(); + $registry = $session->get('registry'); + $vars =& $registry->toArray('application'); + } + + return $vars; + } + + /** + * Method to get the path from the FTP root to the Joomla root directory + */ + function ftproot($args) + { + jimport( 'joomla.application.application' ); + jimport( 'joomla.registry.registry' ); + + $objResponse = new xajaxResponse(); + $args = $args['vars']; + + $root = JInstallationHelper::findFtpRoot($args['ftpUser'], $args['ftpPassword'], $args['ftpHost'], $args['ftpPort']); + if (JError::isError($root)) { + $objResponse->addScript('document.getElementById(\'ftpdisable\').checked = true;'); + $objResponse->addAlert(JText::_($root->get('message'))); + } else { + $objResponse->addAssign('ftproot', 'value', $root); + $objResponse->addAssign('rootPath', 'style.display', ''); + $objResponse->addScript('document.getElementById(\'verifybutton\').click();'); + } + + return $objResponse; + } + + /** + * Method to verify the ftp values are valid + */ + function ftpverify($args) + { + jimport( 'joomla.application.application' ); + jimport( 'joomla.registry.registry' ); + + $objResponse = new xajaxResponse(); + $args = $args['vars']; + + $status = JInstallationHelper::FTPVerify($args['ftpUser'], $args['ftpPassword'], $args['ftpRoot'], $args['ftpHost'], $args['ftpPort']); + if (JError::isError($status)) { + if (($msg = $status->get('message')) != 'INVALIDROOT') { + $msg = JText::_('INVALIDFTP') ."\n". JText::_($msg); + } else { + $msg = JText::_($msg); + } + $objResponse->addScript('document.getElementById(\'ftpdisable\').checked = true;'); + $objResponse->addAlert($msg); + } else { + $objResponse->addScript('document.getElementById(\'ftpenable\').checked = true;'); + $objResponse->addAlert(JText::_('VALIDFTP')); + } + + return $objResponse; + } + + /** + * Method to load and execute a sql script + */ + function sampledata($args) + { + jimport( 'joomla.database.database'); + jimport( 'joomla.language.language'); + jimport( 'joomla.registry.registry'); + + + $errors = null; + $msg = ''; + $objResponse = new xajaxResponse(); + + $vars = JAJAXHandler::_getVars(); + + /* + * execute the default sample data file + */ + $type = $vars['DBtype']; + if ($type == 'mysqli') { + $type = 'mysql'; + } + $dbsample = '../sql'.DS.$type.DS.'sample_data.sql'; + + $db = & JInstallationHelper::getDBO($vars['DBtype'], $vars['DBhostname'], $vars['DBuserName'], $vars['DBpassword'], $vars['DBname'], $vars['DBPrefix']); + $result = JInstallationHelper::populateDatabase($db, $dbsample, $errors); + + /* + * prepare sql error messages if returned from populate + */ + if (!is_null($errors)){ + foreach($errors as $error){ + $msg .= stripslashes( $error['msg'] ); + $msg .= chr(13)."-------------".chr(13); + $txt = ''; + } + } else { + // consider other possible errors from populate + $msg = $result == 0 ? JText::_("Sample data installed successfully") : JText::_("Error installing SQL script") ; + $txt = ''; + } + + $objResponse->addAssign("theDefault", "innerHTML", $txt); + return $objResponse; + } + + /** + * Handle a raised error : for now just silently return + * + * @access private + * @param object $error JError object + * @return object $error JError object + * @since 1.5 + */ + function &handleError(&$error) + { + return $error; + } +} + + +/* + * Process the AJAX requests + */ +$xajax->cleanBufferOff(); //Needed for suPHP compilance +$xajax->processRequests(); diff --git a/installation/installer/models/index.html b/installation/installer/models/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/installation/installer/models/index.html +++ b/installation/installer/models/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/installation/installer/models/model.php b/installation/installer/models/model.php index 87f3c83db051b..e58e416e3c257 100644 --- a/installation/installer/models/model.php +++ b/installation/installer/models/model.php @@ -32,7 +32,7 @@ class JInstallationModel extends JModel * @access protected * @since 1.5 */ - var $data = array(); + public $data = array(); /** * Array used to store user input created during the installation process @@ -41,14 +41,16 @@ class JInstallationModel extends JModel * @access protected * @since 1.5 */ - var $vars = array(); + public $vars = array(); + + public $test; /** * Constructor */ function __construct($config = array()) { - $this->_state = new JObject(); + $this->_state = new JStdClass(); //set the view name if (empty( $this->_name )) { @@ -75,13 +77,13 @@ function __construct($config = array()) */ function chooseLanguage() { - global $mainframe; + $appl = JFactory::getApplication(); $vars =& $this->getVars(); jimport('joomla.language.helper'); $native = JLanguageHelper::detectLanguage(); - $forced = $mainframe->getLocalise(); + $forced = $appl->getLocalise(); if ( !empty( $forced['lang'] ) ){ $native = $forced['lang']; @@ -104,7 +106,7 @@ function chooseLanguage() */ function dbConfig() { - global $mainframe; + $appl = JFactory::getApplication(); $vars =& $this->getVars(); @@ -114,19 +116,19 @@ function dbConfig() $lists = array (); $files = array ('mysql', 'mysqli',); - $db = JInstallationHelper::detectDB(); + $db = isset($vars['DBtype']) ? $vars['DBtype'] : JInstallationHelper::detectDB(); foreach ($files as $file) { $option = array (); $option['text'] = $file; if (strcasecmp($option['text'], $db) == 0) { - $option['selected'] = 'selected="true"'; + $option['selected'] = 'selected="selected"'; } $lists['dbTypes'][] = $option; } - $doc =& JFactory::getDocument(); + $doc = JFactory::getDocument(); $this->setData('lists', $lists); @@ -142,12 +144,12 @@ function dbConfig() */ function finish() { - global $mainframe; + $appl = JFactory::getApplication(); $vars =& $this->getVars(); - $vars['siteurl'] = JURI::root(); - $vars['adminurl'] = $vars['siteurl'].'administrator/'; + $vars['siteUrl'] = JURI::root(); + $vars['adminUrl'] = $vars['siteUrl'].'administrator/'; return true; } @@ -161,12 +163,12 @@ function finish() */ function ftpConfig($DBcreated = '0') { - global $mainframe; + $appl = JFactory::getApplication(); $vars =& $this->getVars(); // Require the xajax library - require_once( JPATH_BASE.DS.'includes'.DS.'xajax'.DS.'xajax.inc.php' ); + require_once JPATH_BASE.DS.'includes'.DS.'xajax'.DS.'xajax.inc.php'; // Instantiate the xajax object and register the function $xajax = new xajax(JURI::base().'installer/jajax.php'); @@ -275,7 +277,7 @@ function license() */ function makeDB($vars = false) { - global $mainframe; + $appl = JFactory::getApplication(); // Initialize variables if ($vars === false) { @@ -325,12 +327,6 @@ function makeDB($vars = false) $this->setData('errors', $errors); return false; } - if (!preg_match( '#^[a-zA-Z]+[a-zA-Z0-9_]*$#', $DBname )) { - $this->setError(JText::_('MYSQLDBNAMEINVALIDCHARS')); - $this->setData('back', 'dbconfig'); - $this->setData('errors', $errors); - return false; - } if (strlen($DBPrefix) > 15) { $this->setError(JText::_('MYSQLPREFIXTOOLONG')); $this->setData('back', 'dbconfig'); @@ -359,7 +355,7 @@ function makeDB($vars = false) if ($err = $db->getErrorNum()) { // connection failed - $this->setError(JText::sprintf('WARNNOTCONNECTDB', $db->getErrorNum())); + $this->setError(JText::sprintf('WARNNOTCONNECTDB', $err ) ); $this->setData('back', 'dbconfig'); $this->setData('errors', $db->getErrorMsg()); return false; @@ -419,10 +415,8 @@ function makeDB($vars = false) } } - $type = $DBtype; - if ($type == 'mysqli') { - $type = 'mysql'; - } + // For the install the mysql type will be used + $type = 'mysql'; // set collation and use utf-8 compatibile script if appropriate if ($DButfSupport) { @@ -455,7 +449,7 @@ function makeDB($vars = false) // Handle default backend language setting. This feature is available for // localized versions of Joomla! 1.5. - $langfiles = $mainframe->getLocaliseAdmin(); + $langfiles = $appl->getLocaliseAdmin(); if (in_array($lang, $langfiles['admin']) || in_array($lang, $langfiles['site'])) { // Determine the language settings $param[] = Array(); @@ -496,7 +490,7 @@ function makeDB($vars = false) */ function mainConfig() { - global $mainframe; + $appl = JFactory::getApplication(); $vars =& $this->getVars(); @@ -511,7 +505,7 @@ function mainConfig() } // Require the xajax library - require_once( JPATH_BASE.DS.'includes'.DS.'xajax'.DS.'xajax.inc.php' ); + require_once JPATH_BASE.DS.'includes'.DS.'xajax'.DS.'xajax.inc.php'; // Instantiate the xajax object and register the function $xajax = new xajax(JURI::base().'installer/jajax.php'); @@ -549,6 +543,7 @@ function mainConfig() $vars['siteName'] = stripslashes(stripslashes($vars['siteName'])); } + /* $folders = array ( 'administrator/backups', 'administrator/cache', @@ -572,14 +567,15 @@ function mainConfig() 'templates', ); - // Now lets make sure we have permissions set on the appropriate folders - // foreach ($folders as $folder) - // { - // if (!JInstallationHelper::setDirPerms( $folder, $vars )) - // { - // $lists['folderPerms'][] = $folder; - // } - // } + //Now lets make sure we have permissions set on the appropriate folders + foreach ($folders as $folder) + { + if (!JInstallationHelper::setDirPerms( $folder, $vars )) + { + $lists['folderPerms'][] = $folder; + } + } + */ return true; } @@ -597,8 +593,8 @@ function preInstall() $lists = array (); $phpOptions[] = array ( - 'label' => JText::_('PHP version').' >= 4.3.10', - 'state' => phpversion() < '4.3.10' ? 'No' : 'Yes' + 'label' => JText::_('PHP version').' >= 5.2', + 'state' => phpversion() < '5.2' ? 'No' : 'Yes' ); $phpOptions[] = array ( 'label' => '- '.JText::_('zlib compression support'), @@ -718,147 +714,99 @@ function removedir() */ function saveConfig() { - global $mainframe; - + $appl = JFactory::getApplication(); $vars =& $this->getVars(); - $lang =& JFactory::getLanguage(); + $lang = JFactory::getLanguage(); + $config = new JRegistry('config'); // Import authentication library jimport( 'joomla.user.helper' ); - // Set some needed variables - $vars['siteUrl'] = JURI::root(); - $vars['secret'] = JUserHelper::genRandomPassword(16); - - $vars['offline'] = JText::_( 'STDOFFLINEMSG' ); - $vars['errormsg'] = JText::_( 'STDERRORMSG' ); - $vars['metadesc'] = JText::_( 'STDMETADESC' ); - $vars['metakeys'] = JText::_( 'STDMETAKEYS' ); - $vars['tmp_path'] = JPATH_ROOT.DS.'tmp'; - $vars['log_path'] = JPATH_ROOT.DS.'logs'; - - // set default language - $forced = $mainframe->getLocalise(); - if ( empty($forced['lang']) ) { - $vars['deflang'] = 'en-GB'; - $vars['bclang'] = 'english'; - } else { - $vars['deflang'] = $forced['lang']; - $vars['bclang'] = $lang->getBackwardLang(); - } - - if ( empty( $forced['helpurl'] ) ) { - $vars['helpurl'] = 'http://help.joomla.org'; - } else { - $vars['helpurl'] = $forced['helpurl']; - } - - // If FTP has not been enabled, set the value to 0 - if (!isset($vars['ftpEnable'])) + $data = new JstdClass(); + $data->dbtype = $vars['DBtype']; + $data->host = $vars['DBhostname']; + $data->user = $vars['DBuserName']; + $data->password = $vars['DBpassword']; + $data->db = $vars['DBname']; + $data->dbprefix = $vars['DBPrefix']; + $data->ftp_host = $vars['ftpHost']; + $data->ftp_port = $vars['ftpPort']; + $data->ftp_user = $vars['ftpUser']; + $data->ftp_pass = $vars['ftpPassword']; + $data->ftp_root = rtrim($vars['ftpRoot'], '/'); + $data->ftp_enable = $vars['ftpEnable']; + $data->tmp_path = JPATH_ROOT.DS.'tmp'; + $data->log_path = JPATH_ROOT.DS.'logs'; + $data->mailer = 'mail'; + $data->mailfrom = $vars['adminEmail']; + $data->fromname = $vars['siteName']; + $data->sendmail = '/usr/sbin/sendmail'; + $data->smtpauth = '0'; + $data->smtpuser = ''; + $data->smtppass = ''; + $data->smtphost = 'localhost'; + $data->debug = 0; + $data->caching = '0'; + $data->cachetime = '900'; + $data->language = $vars['lang']; + $data->secret = JUserHelper::genRandomPassword(16); + $data->editor = 'none'; + $data->offset = 0; + $data->lifetime = 15; + + $data->list_limit = 30; + $data->debug_lang = 0; + $data->gzip = 0; + $data->xmlrpc_server = 0; + $data->cache_handler = 'file'; + $data->MetaAuthor = ''; + $data->MetaTitle = ''; + $data->sef = 0; + $data->sef_rewrite = 0; + $data->sef_suffix = 0; + $data->feed_limit = 0; + $data->session_handler = 'database'; + + $data->MetaDesc = JText::_( 'STDMETADESC' ); + $data->MetaKeys = JText::_( 'STDMETAKEYS' ); + $data->offline = 0; + $data->offline_message = JText::_( 'STDOFFLINEMSG' ); + // @todo: change to -1 before release + $data->error_reporting = '2047'; + $data->helpurl = 'http://help.joomla.org'; + + $config->loadObject($data); + + // Update the credentials with the new settings + if ( $data->ftp_enable ) { - $vars['ftpEnable'] = 0; - } - - /* - * Trim the last slash from the FTP root, as the FTP root usually replaces JPATH_ROOT. - * If the path had a trailing slash, this would lead to double slashes, like "/joomla//configuration.php" - */ - if (isset($vars['ftpRoot'])) { - $vars['ftpRoot'] = rtrim($vars['ftpRoot'], '/'); + jimport('joomla.client.helper'); + $oldconfig =& JFactory::getConfig(); + $oldconfig->setValue('config.ftp_enable', $data->ftp_enable); + $oldconfig->setValue('config.ftp_host', $data->ftp_host); + $oldconfig->setValue('config.ftp_port', $data->ftp_port); + $oldconfig->setValue('config.ftp_user', $data->ftp_user); + $oldconfig->setValue('config.ftp_pass', $data->ftp_pass); + $oldconfig->setValue('config.ftp_root', $data->ftp_root); + JClientHelper::getCredentials('ftp', true); } - switch ($vars['DBtype']) { - - case 'mssql' : - $vars['ZERO_DATE'] = '1/01/1990'; - break; - - default : - $vars['ZERO_DATE'] = '0000-00-00 00:00:00'; - break; - } - - JInstallationHelper::createAdminUser($vars); - /** * Write the configuration file */ - jimport('joomla.template.template'); - - $tmpl = new JTemplate(); - $tmpl->applyInputFilter('ShortModifiers'); + $fname = JPATH_CONFIGURATION.DS.'configuration.php'; + $written = NULL; - // load the wrapper and common templates - $tmpl->setRoot( JPATH_BASE . DS . 'template' . DS. 'tmpl' ); + // Get the config registry in PHP class format and write it to configuation.php + jimport('joomla.filesystem.file'); + $written = JFile::write($fname, $config->toString('PHP', 'config', array('class' => 'JConfig'))); - $tmpl->readTemplatesFromFile('configuration.html'); - $tmpl->addVars('configuration', $vars, 'var_'); - - if (empty($vars['ftpSavePass'])) { - $tmpl->addVar('configuration', 'var_ftpuser', ''); - $tmpl->addVar('configuration', 'var_ftppassword', ''); - } - - $buffer = $tmpl->getParsedTemplate('configuration'); - $path = JPATH_CONFIGURATION.DS.'configuration.php'; - - if (file_exists($path)) { - $canWrite = is_writable($path); - } else { - $canWrite = is_writable(JPATH_CONFIGURATION.DS); - } - - /* - * If the file exists but isn't writable OR if the file doesn't exist and the parent directory - * is not writable we need to use FTP - */ - $ftpFlag = false; - if ((file_exists($path) && !is_writable($path)) || (!file_exists($path) && !is_writable(dirname($path).'/'))) { - $ftpFlag = true; - } - - // Check for safe mode - if (ini_get('safe_mode')) + if ( ! $written ) { - $ftpFlag = true; - } - - // Enable/Disable override - if (!isset($vars['ftpEnable']) || ($vars['ftpEnable'] != 1)) - { - $ftpFlag = false; + return false; } - if ($ftpFlag == true) - { - // Connect the FTP client - jimport('joomla.client.ftp'); - jimport('joomla.filesystem.path'); - - $ftp = & JFTP::getInstance($vars['ftpHost'], $vars['ftpPort']); - $ftp->login($vars['ftpUser'], $vars['ftpPassword']); - - // Translate path for the FTP account - $file = JPath::clean(str_replace(JPATH_CONFIGURATION, $vars['ftpRoot'], $path), '/'); - - // Use FTP write buffer to file - if (!$ftp->write($file, $buffer)) { - $this->setData('buffer', $buffer); - return false; - } - - $ftp->quit(); - - } - else - { - if ($canWrite) { - file_put_contents($path, $buffer); - } else { - $this->setData('buffer', $buffer); - return true; - } - } + JInstallationHelper::createAdminUser($vars); return true; } diff --git a/installation/installer/views/index.html b/installation/installer/views/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/installation/installer/views/index.html +++ b/installation/installer/views/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/installation/installer/views/install/index.html b/installation/installer/views/install/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/installation/installer/views/install/index.html +++ b/installation/installer/views/install/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/installation/installer/views/install/tmpl/default.php b/installation/installer/views/install/tmpl/default.php new file mode 100644 index 0000000000000..c1998a59da58f --- /dev/null +++ b/installation/installer/views/install/tmpl/default.php @@ -0,0 +1,69 @@ +getSteps(); + +?> + +
      +
      +
      +
      +
      +
      + +
      +

      +
      + 1 : +
      +
      + 2 : +
      +
      + 3 : +
      +
      + 4 : +
      +
      + 5 : +
      +
      + 6 : +
      +
      + 7 : +
      +
      +
      + +
      +
      +
      +
      +
      + +
      + +get('subtemplate'); +$output = $this->loadTemplate($tpl); + +if ( ! JError::isError($output) ) +{ + echo $output; +} + diff --git a/installation/template/tmpl/dbconfig.html b/installation/installer/views/install/tmpl/default_dbconfig.php similarity index 50% rename from installation/template/tmpl/dbconfig.html rename to installation/installer/views/install/tmpl/default_dbconfig.php index 36c24b82baaa3..2b6a118b2d179 100644 --- a/installation/template/tmpl/dbconfig.html +++ b/installation/installer/views/install/tmpl/default_dbconfig.php @@ -1,10 +1,18 @@ - -@version $Id$ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - + + + + +
      + + + diff --git a/installation/template/tmpl/migration.html b/installation/installer/views/install/tmpl/default_migration.php similarity index 50% rename from installation/template/tmpl/migration.html rename to installation/installer/views/install/tmpl/default_migration.php index 249c73ef5db88..4a2e263147955 100644 --- a/installation/template/tmpl/migration.html +++ b/installation/installer/views/install/tmpl/default_migration.php @@ -1,10 +1,19 @@ - -@version $Id: migration.html 6450 2007-02-01 16:36:11Z hackwar $ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - + + - - - - - - -
      -
      -
      -
      - -
      -
      -
      -
      -
      - -
      -
      -
      -
      -
      -
      -
      - - - + + + + + + + + direction == 'rtl') : ?> + + + + + + + + + + +
      +
      +
      +
      + +
      +
      +
      +
      +
      + +
      +
      +
      +
      +
      +
      +
      + + + diff --git a/installation/template/js/index.html b/installation/template/js/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/installation/template/js/index.html +++ b/installation/template/js/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/installation/template/js/validation.js b/installation/template/js/validation.js index b22f906a7376b..3276447d67fe1 100644 --- a/installation/template/js/validation.js +++ b/installation/template/js/validation.js @@ -1,238 +1,247 @@ -/** -* @version $Id$ -* @package Joomla -* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -* Joomla! is free software. This version may have been modified pursuant -* to the GNU General Public License, and as distributed it includes or -* is derivative of works licensed under the GNU General Public License or -* other free or open source software licenses. -* See COPYRIGHT.php for copyright notices and details. -*/ - -/** - * Unobtrusive Form Validation library - * - * Inspired by: Chris Campbell - * - * @author Louis Landry - * @package Joomla - * @subpackage Installation - * @since 1.5 - */ - -// JFormValidator prototype -JFormValidator = function() { this.constructor.apply(this, arguments);} -JFormValidator.prototype = { - - constructor: function() - { - var self = this; - - this.valid = true; - this.vContinue = true; - this.handlers = Object(); - - // Default regexes - this.handlers['date'] = { enabled : true, - exec : function (value) { - regex=/(((0[13578]|10|12)([-.\/])(0[1-9]|[12][0-9]|3[01])([-.\/])(\d{4}))|((0[469]|11)([-.\/])([0][1-9]|[12][0-9]|30)([-.\/])(\d{4}))|((2)([-.\/])(0[1-9]|1[0-9]|2[0-8])([-.\/])(\d{4}))|((2)(\.|-|\/)(29)([-.\/])([02468][048]00))|((2)([-.\/])(29)([-.\/])([13579][26]00))|((2)([-.\/])(29)([-.\/])([0-9][0-9][0][48]))|((2)([-.\/])(29)([-.\/])([0-9][0-9][2468][048]))|((2)([-.\/])(29)([-.\/])([0-9][0-9][13579][26])))/; - return regex.test(value); - } - } - this.handlers['phone'] = { enabled : true, - exec : function (value) { - regex=/^(\d{3}-\d{3}-\d{4})*$/; - return regex.test(value); - } - } - this.handlers['zipcode'] = { enabled : true, - exec : function (value) { - regex=/(^(?!0{5})(\d{5})(?!-?0{4})(-?\d{4})?$)/; - return regex.test(value); - } - } - this.handlers['password'] = { enabled : true, - exec : function (value) { - regex=/^[a-zA-Z]\w{3,14}$/; - return regex.test(value); - } - } - this.handlers['numeric'] = { enabled : true, - exec : function (value) { - regex=/^(\d|-)?(\d|,)*\.?\d*$/; - return regex.test(value); - } - } - this.handlers['email'] = { enabled : true, - exec : function (value) { - regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/; - return regex.test(value); - } - } - }, - - registerEvent: function(target,type,args) - { - //use a closure to keep scope - var self = this; - - if (target.addEventListener) { - target.addEventListener(type,onEvent,true); - } else if (target.attachEvent) { - target.attachEvent('on'+type,onEvent); - } - - function onEvent(e) { - e = e||window.event; - e.element = target; - return self["on"+type](e, args); - } - }, - - attachToForm: function(form) - { - // Iterate through the form object and attach the validate - // method to all input fields. - for (var i=0;i < form.elements.length; i++) { - form.elements[i].onchange = function(){return document.formvalidator.validate(this);} - } - // Attach the validate method to the onsubmit event for the given form - form.onsubmit = function(){return validate(this);} - }, - - validate: function(target) - { - // Get the value of the target tag. - switch (target.tagName) { - case 'INPUT': - case 'TEXTAREA': - var value = target.value; - break; - case 'SELECT': - var value = target.options[target.selectedIndex].value; - break; - } - // Check to see if the tag is to be validated - var pivot = target.className.indexOf('validate'); - - // Make sure we are set to go... - this.vContinue = true; - - // get all the rules from the input box classname - if (pivot != -1) { - var rules = target.className.substring(pivot); - } else { - return; - } - rules = rules.split(' '); - - /** - * Validation rules are as follows - * [0] 'validate' -- to validate the field this should always be 'validate' - * [1] 'required' -- this means the field is required and should be populated - * [2] 'type' -- this represents an additional validation type (ie. email, phone, date) - * [3] 'feedbackID' -- this is the id of the element where feedback is sent to. - */ - var validate = rules[0]; - var required = rules[1]; - var type = rules[2]; - var feedbackID = rules[3]; - - // Check for derived feedbackID - if (feedbackID) { - if (feedbackID.charAt(0) == '@') { - feedbackID = target.id + '-' + feedbackID.substring(1); - } - } - - // The validation state for the target - var state; - - //validateRequired() checks if it is required and then sends back feedback - state = this.validateRequired (required, value, type); - - /** - * If the field is required and blank the fvContinue field will be false - * and we shouldn't bother validating the specific type... it will just - * cause potential errors. - */ - if (this.vContinue) - { - // Check the additional validation types - if ((type) && (type != 'none') && (this.handlers[type])) { - // Execute the validation handler and return result - if (this.handlers[type].exec(value)) { - state = true; - } else { - state = false; - } - } - } - - this.handleResponse(state, target, feedbackID); - - // Return validation state - return state; - }, - - validateRequired: function(required, value, type) - { - //check if required if not, continue validation script - if (required == "required") { - //if it is rquired and blank then it is an error and continues to be required - if (value == "") { - this.vContinue = false; - return false; - } - //if its not blank and has no other validation requirements the field passes - else if (type == "none") { - return true; - } - } - }, - - isValid: function(form) - { - var valid = true; - for (var i=0;i < form.elements.length; i++) { - if (this.validate(form.elements[i]) == false) { - valid = false; - } - } - return valid; - }, - - handleResponse: function(state, target, feedback) - { - // Set the default values for the target and extra objects - if (target.origBorder != '') { - target.origBorder = target.style.borderColor; - } - // Set color to red if the object doesn't validate - if (state == false) { - target.style.borderColor = '#f00'; - } else { - target.style.borderColor = target.origBorder; - } - - // Get the extra object - var extra = document.getElementById(feedback); - // Set extra color to red if the object doesn't validate - if (extra) { - if (extra.origColor != '') { - extra.origColor = extra.style.color; - } - if (state == false) { - extra.style.color = '#f00'; - } else { - extra.style.color = extra.origColor; - } - } - } -} - -document.formvalidator = null; -Window.onDomReady(function(){ - document.formvalidator = new JFormValidator(); -}); \ No newline at end of file +/** +* @version $Id$ +* @package Joomla +* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +* Joomla! is free software. This version may have been modified pursuant +* to the GNU General Public License, and as distributed it includes or +* is derivative of works licensed under the GNU General Public License or +* other free or open source software licenses. +* See COPYRIGHT.php for copyright notices and details. +*/ + +/** + * Unobtrusive Form Validation library + * + * Inspired by: Chris Campbell + * + * @author Louis Landry + * @package Joomla + * @subpackage Installation + * @since 1.5 + */ + +// JFormValidator prototype +JFormValidator = function() { this.constructor.apply(this, arguments);} +JFormValidator.prototype = { + + constructor: function() + { + var self = this; + + this.valid = true; + this.vContinue = true; + this.handlers = Object(); + + // Default regexes + this.handlers['date'] = { enabled : true, + exec : function (value) { + regex=/(((0[13578]|10|12)([-.\/])(0[1-9]|[12][0-9]|3[01])([-.\/])(\d{4}))|((0[469]|11)([-.\/])([0][1-9]|[12][0-9]|30)([-.\/])(\d{4}))|((2)([-.\/])(0[1-9]|1[0-9]|2[0-8])([-.\/])(\d{4}))|((2)(\.|-|\/)(29)([-.\/])([02468][048]00))|((2)([-.\/])(29)([-.\/])([13579][26]00))|((2)([-.\/])(29)([-.\/])([0-9][0-9][0][48]))|((2)([-.\/])(29)([-.\/])([0-9][0-9][2468][048]))|((2)([-.\/])(29)([-.\/])([0-9][0-9][13579][26])))/; + return regex.test(value); + } + } + this.handlers['phone'] = { enabled : true, + exec : function (value) { + regex=/^(\d{3}-\d{3}-\d{4})*$/; + return regex.test(value); + } + } + this.handlers['zipcode'] = { enabled : true, + exec : function (value) { + regex=/(^(?!0{5})(\d{5})(?!-?0{4})(-?\d{4})?$)/; + return regex.test(value); + } + } + this.handlers['sitename'] = { enabled : true, + exec : function (value) { + regex=/^(.){1,200}$/; + return regex.test(value); + } + } + this.handlers['password'] = { enabled : true, + exec : function (value) { + regex=/^\S[\S ]{2,98}\S$/; + return regex.test(value); + } + } + this.handlers['numeric'] = { enabled : true, + exec : function (value) { + regex=/^(\d|-)?(\d|,)*\.?\d*$/; + return regex.test(value); + } + } + this.handlers['email'] = { enabled : true, + exec : function (value) { + regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/; + return regex.test(value); + } + } + }, + + registerEvent: function(target,type,args) + { + //use a closure to keep scope + var self = this; + + if (target.addEventListener) { + target.addEventListener(type,onEvent,true); + } else if (target.attachEvent) { + target.attachEvent('on'+type,onEvent); + } + + function onEvent(e) { + e = e||window.event; + e.element = target; + return self["on"+type](e, args); + } + }, + + attachToForm: function(form) + { + // Iterate through the form object and attach the validate + // method to all input fields. + for (var i=0;i < form.elements.length; i++) { + form.elements[i].onchange = function(){return document.formvalidator.validate(this);} + } + // Attach the validate method to the onsubmit event for the given form + form.onsubmit = function(){return validate(this);} + }, + + validate: function(target) + { + // Get the value of the target tag. + switch (target.tagName) { + case 'INPUT': + case 'TEXTAREA': + var value = target.value; + break; + case 'SELECT': + var value = target.options[target.selectedIndex].value; + break; + } + // Check to see if the tag is to be validated + var pivot = target.className.indexOf('validate'); + + // Make sure we are set to go... + this.vContinue = true; + + // get all the rules from the input box classname + if (pivot != -1) { + var rules = target.className.substring(pivot); + } else { + return; + } + rules = rules.split(' '); + + /** + * Validation rules are as follows + * [0] 'validate' -- to validate the field this should always be 'validate' + * [1] 'required' -- this means the field is required and should be populated + * [2] 'type' -- this represents an additional validation type (ie. email, phone, date) + * [3] 'feedbackID' -- this is the id of the element where feedback is sent to. + */ + var validate = rules[0]; + var required = rules[1]; + var type = rules[2]; + var feedbackID = rules[3]; + + // Check for derived feedbackID + if (feedbackID) { + if (feedbackID.charAt(0) == '@') { + feedbackID = target.id + '-' + feedbackID.substring(1); + } + } + + // The validation state for the target + var state; + + //validateRequired() checks if it is required and then sends back feedback + state = this.validateRequired (required, value, type); + + /** + * If the field is required and blank the fvContinue field will be false + * and we shouldn't bother validating the specific type... it will just + * cause potential errors. + */ + if (this.vContinue) + { + // Check the additional validation types + if ((type) && (type != 'none') && (this.handlers[type])) { + // Execute the validation handler and return result + if (this.handlers[type].exec(value)) { + state = true; + } else { + state = false; + } + } + } + + this.handleResponse(state, target, feedbackID); + + // Return validation state + return state; + }, + + validateRequired: function(required, value, type) + { + //check if required if not, continue validation script + if (required == "required") { + //if it is rquired and blank then it is an error and continues to be required + if (value == "") { + this.vContinue = false; + return false; + } + //if its not blank and has no other validation requirements the field passes + else if (type == "none") { + return true; + } + } + }, + + isValid: function(form, element) + { + var valid = true; + for (var i=0;i < form.elements.length; i++) { + if ((element == '') || ((element != '') && (form.elements[i].name==element))) { + if (this.validate(form.elements[i]) == false) { + valid = false; + } + } + } + return valid; + }, + + handleResponse: function(state, target, feedback) + { + // Set the default values for the target and extra objects + if (target.origBorder != '') { + target.origBorder = target.style.borderColor; + } + // Set color to red if the object doesn't validate + if (state == false) { + target.style.borderColor = '#f00'; + } else { + target.style.borderColor = target.origBorder; + } + + // Get the extra object + var extra = document.getElementById(feedback); + // Set extra color to red if the object doesn't validate + if (extra) { + if (extra.origColor != '') { + extra.origColor = extra.style.color; + } + if (state == false) { + extra.style.color = '#f00'; + } else { + extra.style.color = extra.origColor; + } + } + } +} + +document.formvalidator = null; +Window.onDomReady(function(){ + document.formvalidator = new JFormValidator(); +}); + diff --git a/installation/template/tmpl/configuration.html b/installation/template/tmpl/configuration.html deleted file mode 100644 index 3755a3fb57811..0000000000000 --- a/installation/template/tmpl/configuration.html +++ /dev/null @@ -1,74 +0,0 @@ - -@version $Id$ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - - - diff --git a/installation/template/tmpl/error.html b/installation/template/tmpl/error.html deleted file mode 100644 index f0a5063afab4c..0000000000000 --- a/installation/template/tmpl/error.html +++ /dev/null @@ -1,88 +0,0 @@ - -@version $Id$ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - - -
      - -
      -
      - -
      diff --git a/installation/template/tmpl/finish.html b/installation/template/tmpl/finish.html deleted file mode 100644 index b722be00d32f2..0000000000000 --- a/installation/template/tmpl/finish.html +++ /dev/null @@ -1,153 +0,0 @@ - -@version $Id$ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - - -
      - - - -
      - - -
      diff --git a/installation/template/tmpl/index.html b/installation/template/tmpl/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/installation/template/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/installation/template/tmpl/language.html b/installation/template/tmpl/language.html deleted file mode 100644 index 7efffd4c1008c..0000000000000 --- a/installation/template/tmpl/language.html +++ /dev/null @@ -1,94 +0,0 @@ - -@version $Id: language.html 137 2005-09-12 10:21:17Z eddieajau $ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - - - - -
      - - -
      - - -
      diff --git a/installation/template/tmpl/license.html b/installation/template/tmpl/license.html deleted file mode 100644 index 6afd1d36b7b9c..0000000000000 --- a/installation/template/tmpl/license.html +++ /dev/null @@ -1,65 +0,0 @@ - -@version $Id: license.html 137 2005-09-12 10:21:17Z eddieajau $ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - - -
      - - -
      - - -
      diff --git a/installation/template/tmpl/mainconfig.html b/installation/template/tmpl/mainconfig.html deleted file mode 100644 index 9c5e8a32f4fa6..0000000000000 --- a/installation/template/tmpl/mainconfig.html +++ /dev/null @@ -1,429 +0,0 @@ - -@version $Id$ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - - - - - - -
      - - - diff --git a/installation/template/tmpl/page.html b/installation/template/tmpl/page.html deleted file mode 100644 index d906f5e99f571..0000000000000 --- a/installation/template/tmpl/page.html +++ /dev/null @@ -1,63 +0,0 @@ - -@version $Id: page.html 137 2005-09-12 10:21:17Z eddieajau $ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - - - - -
      -
      -
      -
      -
      -
      -
      -

      Steps

      -
      - 1 : Language -
      -
      - 2 : Pre-Installation check -
      -
      - 3 : License -
      -
      - 4 : Database -
      -
      - 5 : FTP Configuration -
      -
      - 6 : Configuration -
      -
      - 7 : Finish -
      -
      -
      -
      -
      -
      -
      -
      -
      -
      - - -
      - -
      - -
      - - - - diff --git a/installation/template/tmpl/preinstall.html b/installation/template/tmpl/preinstall.html deleted file mode 100644 index cd8cc7608281a..0000000000000 --- a/installation/template/tmpl/preinstall.html +++ /dev/null @@ -1,164 +0,0 @@ - -@version $Id: preinstall.html 137 2005-09-12 10:21:17Z eddieajau $ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - - -
      - - -
      - - -
      diff --git a/installation/template/tmpl/removedir.html b/installation/template/tmpl/removedir.html deleted file mode 100755 index 9eaeaedcb9cbd..0000000000000 --- a/installation/template/tmpl/removedir.html +++ /dev/null @@ -1,24 +0,0 @@ - -@version $Id: page.html 137 2005-09-12 10:21:17Z eddieajau $ -@package Joomla -@subpackage Installation -@copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -@license GNU/GPL - - - -
      - - - - - - - -
      - PLEASE REMEMBER TO COMPLETELY REMOVE THE INSTALLATION DIRECTORY -
      - Click here when the directory has been removed. -
      -
      -
      \ No newline at end of file diff --git a/language/en-GB/en-GB.com_banners.ini b/language/en-GB/en-GB.com_banners.ini index 2d8dfcd223d9e..1af75e2c246fb 100644 --- a/language/en-GB/en-GB.com_banners.ini +++ b/language/en-GB/en-GB.com_banners.ini @@ -1,15 +1,15 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -BNR_CLIENT_NAME=You must select a name for the Client. -BNR_CONTACT=You must select a Contact for the Client. -BNR_VALID_EMAIL=You must select a valid e-mail for the Client. -BNR_CLIENT=You must select a Client, -BNR_NAME=You must select a name for the Banner. -BNR_IMAGE=You must select an image for the Banner. -BNR_URL=You must select a URL/Custom Banner code for the Banner. - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +BNR_CLIENT_NAME=You must select a name for the Client. +BNR_CONTACT=You must select a Contact for the Client. +BNR_VALID_EMAIL=You must select a valid e-mail for the Client. +BNR_CLIENT=You must select a Client, +BNR_NAME=You must select a name for the Banner. +BNR_IMAGE=You must select an image for the Banner. +BNR_URL=You must select a URL/Custom Banner code for the Banner. + + diff --git a/language/en-GB/en-GB.com_contact.ini b/language/en-GB/en-GB.com_contact.ini index 16f2ef7dce795..e03e6994689f1 100644 --- a/language/en-GB/en-GB.com_contact.ini +++ b/language/en-GB/en-GB.com_contact.ini @@ -8,7 +8,7 @@ ADDRESS=Address ALL=all CONTACT_FORM_NC=Please make sure the form is complete and valid. CONTACTS=Contacts -CLOAKING=This e-mail address is being protected from spam bots, you need JavaScript enabled to view it. +CLOAKING=This e-mail address is being protected from spambots. You need JavaScript enabled to view it. CONTACT=Contact COPY_TEXT=This is a copy of the following message you sent to %s via %s COPY OF:=Copy of: @@ -16,7 +16,7 @@ DISPLAY NUM=Display # DOWNLOAD INFORMATION AS A=Download information as a EMAIL=E-mail EMAIL ADDRESS=E-mail address -EMAIL_A_COPY=E-mail a copy of this message to your own address +EMAIL_A_COPY=E-mail a copy of this message to your own address. ENQUIRY=Enquiry ENQUIRY_TEXT=This is an enquiry e-mail via %s from: ENTER YOUR MESSAGE=Enter your Message @@ -34,9 +34,9 @@ SELECT CONTACT=Select Contact SEND=Send SUBURB=TOWN/SUBURB TELEPHONE=Telephone -THANK_MESSAGE=Thank you for your e-mail -THANK YOU FOR YOUR E-MAIL=Thank you for your e-mail +THANK_MESSAGE=Thank you for your e-mail. +THANK YOU FOR YOUR E-MAIL=Thank you for your e-mail. THE CONTACT LIST FOR THIS WEBSITE.=The Contact list for this Web site. THERE ARE NO CONTACT DETAILS LISTED.=There are no Contact Details listed. VCARD=vCard -YOU CANNOT ENTER MORE THAN ONE EMAIL ADDRESS=You cannot enter more than one e-mail address +YOU CANNOT ENTER MORE THAN ONE EMAIL ADDRESS=You cannot enter more than one e-mail address. diff --git a/language/en-GB/en-GB.com_contactdirectory.ini b/language/en-GB/en-GB.com_contactdirectory.ini new file mode 100644 index 0000000000000..05d7ed81cac50 --- /dev/null +++ b/language/en-GB/en-GB.com_contactdirectory.ini @@ -0,0 +1,38 @@ +# $Id: en-GB.com_contactdirectory.ini 10082 2008-08-30 07:19:00Z chantalb $ +# Copyright (C) 2008 Chantal Bisson. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CONTACT=Contact +CONTACT_FORM_NC=Please make sure the form is complete and valid. +CONTACT NOT FOUND=Contact not found +COPYOF=Copy of: +DESCRIPTION_IMG=Description Image +EMAIL_A_COPY=E-mail a copy of this message to your own address +EMAIL ADDRESS=E-mail address +ENQUIRY_TEXT=This is an enquiry e-mail via %s from: +ENTER YOUR MESSAGE=Enter your Message +ENTER YOUR NAME=Enter your Name +ENTERCODE=Enter code displayed above: +MAILENQUIRY=%s Enquiry +MESGHASBANNEDTEXT=The %s of your e-mail contains banned text. +MESSAGE SUBJECT=Message Subject +SEND=Send +THANK_MESSAGE=Thank you for your e-mail +VALIDEMAIL=Please enter a valid e-mail address. +WRONGCODE=You have entered the wrong security code +YOU CANNOT ENTER MORE THAN ONE EMAIL ADDRESS=You cannot enter more than one e-mail address +HIDE=Hide +SHOW=Show +NO=No +YES=Yes +ORDERING=Ordering +DESCRIPTION=Description +LEFT=Left +RIGHT=Right +FILTER=Filter +GO=Go +RESET=Reset +DISPLAY #=Display # +IMAGE=Image +DESCRIPTION_IMAGE=Description Image \ No newline at end of file diff --git a/language/en-GB/en-GB.com_content.ini b/language/en-GB/en-GB.com_content.ini index 9c5e01aa87869..2766ce9057362 100644 --- a/language/en-GB/en-GB.com_content.ini +++ b/language/en-GB/en-GB.com_content.ini @@ -1,114 +1,114 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ACCESS LEVEL=Access Level -ADD=Add -ALIGN=Align -ALL PAGES=All Pages -ALT TEXT=Alt Text -ALREADY EXISTS=Already exists -ALTERNATIVE READ MORE TEXT=Alternative Read more: -PARAMALTREADMORE=Enter text that will display alongside the dynamic Read more: of the IntroText where used that will display instead of the main Article Title. -ARTICLES BEING MOVED= Articles being moved: -ARTICLES BEING COPIED=Articles being copied: -ARTICLE CATEGORY NOT PUBLISHED=Article Category not published -ARTICLE MUST HAVE A TITLE=Article must have a Title -ARTICLE MUST HAVE SOME TEXT=Article must have some text -ARTICLE SECTION NOT PUBLISHED=Article Section not published -ARTICLE # NOT FOUND=Article #%d not found -ARTICLE RATING=Article Rating -ARTICLE INDEX=Article Index -AUTHOR=Author -AUTHOR ALIAS=Author Alias -BORDER=Border -BOTTOM=Bottom -CAPTION=Caption -CONTENT=Content -CREATED=Created -DATE=Date -DESCNEWITEMSFIRST=New Article default to the first place. Ordering can be changed after this Article is saved. -DESCRIPTION=Description -DISPLAY NUM=Display # -DOWN=Down -EDIT IMAGE=Edit Image -EDIT ITEM=Edit Article -EDITOR=Editor -EMAIL=E-mail -EMAIL_MSG=The following page from the "%s" website has been sent to you by %s ( %s ).\n\nYou can access it at the following URL:\n %s -EMAIL_ERR_NOINFO=You must enter your valid e-mail and the valid e-mail to send to. -FILTER=Filter -FINISH PUBLISHING=Finish Publishing -GREEN=Green -HITS=Hits -IMAGES=Images -INFO=Info -INSERT=Insert -INTRO TEXT=Intro Text -INVALID RATING=Invalid Rating -ITEM SENT BY=Article sent by %s -ITEM SUCCESSFULLY SAVED.=Article successfully saved. -ITEMS=Articles -ITEM TITLE=Article Title -KEY NOT FOUND=Key not found -KEYWORDS=Keywords -LAST MODIFIED=Last Modified -MESSAGE SUBJECT=Message Subject -METADATA=Metadata -MORE=More... -NEVER=Never -NEW ITEM=New Item -NO IMAGE=No Image -NO=No -NUM=# -ON_NEW_CONTENT=A new Article has been submitted by [ %s ] titled [ %s ] from Section [ %s ] and Category [ %s ] -OPTIONAL=Optional -ORDER=Order -ORDERING=Ordering -PAGE=Page -PDF=PDF -PGB TOC ALIAS PROMPT=Table of Contents Alias: -PGB PAGE TITLE=Page Title: -PGB INS PAGEBRK=Insert Pagebreak -PGB ARTICLE PAGEBRK=Article Pagebreak -PLEASE SELECT A CATEGORY=Please select a Category -PUBLISHED=Published -PUBLISHING=Publishing -REGISTER TO READ MORE...=Register to read more... -READ MORE=Read more: %s -REGISTERED USERS ONLY=Registered Users Only -REQUIRED=Required -REMOVE=Remove -SEND EMAIL=Send e-mail -SELECT CATEGORY=Select Category -SELECT SECTION=Select Section -SHOW ON FRONT PAGE=Show on Front Page -SOURCE=Source -START PUBLISHING=Start Publishing -STATE=State -SUB-FOLDER=Sub-folder -THANK_SUB=Thanks for your submission. Your submission will now be reviewed before being posted to the site. -THANKS FOR RATING!=Thanks for rating! -THE MODULE=The Module -THIS CATEGORY IS CURRENTLY EMPTY=This Category is currently empty -THIS ITEM HAS BEEN SENT TO=This Article has been sent to -TITLE=Title -TITLE ASC=Title asc -TITLE DESC=Title desc -TOP=Top -UNABLE TO LOAD DATA=Unable to Load Data -UNCATEGORIZED=Uncategorized -UP=Up -VERSION=Version -VIEW ALL=View All -WARNUSER=Please either Cancel or Save the current change -WRITTEN BY=Written by %s -YES=Yes -YOU ALREADY RATED THIS ARTICLE TODAY!=You already rated this Article today! -YOUR EMAIL=Your E-mail -YOUR FRIENDS EMAIL=Your friend's e-mail -YOUR NAME=Your Name - - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ACCESS LEVEL=Access Level +ADD=Add +ALIGN=Align +ALL PAGES=All Pages +ALT TEXT=Alt Text +ALREADY EXISTS=Already exists +ALTERNATIVE READ MORE TEXT=Alternative Read more: +PARAMALTREADMORE=Enter text that will display alongside the dynamic Read more of the IntroText. It will be displayed instead of the main Article title where used. +ARCHIVES=Archives +ARTICLES BEING MOVED= Articles being moved: +ARTICLES BEING COPIED=Articles being copied: +ARTICLE CATEGORY NOT PUBLISHED=Article Category not published +ARTICLE MUST HAVE A TITLE=Article must have a Title +ARTICLE MUST HAVE SOME TEXT=Article must have some text +ARTICLE SECTION NOT PUBLISHED=Article Section not published +ARTICLE # NOT FOUND=Article #%d not found +ARTICLE RATING=Article Rating +ARTICLE INDEX=Article Index +AUTHOR=Author +AUTHOR ALIAS=Author Alias +BORDER=Border +BOTTOM=Bottom +CAPTION=Caption +CONTENT=Content +CREATED=Created +DATE=Date +DESCNEWITEMSFIRST=New Article defaults to the first position. Ordering can be changed after this Article has been saved. +DESCRIPTION=Description +DISPLAY NUM=Display # +DOWN=Down +EDIT IMAGE=Edit Image +EDIT ITEM=Edit Article +EDITOR=Editor +EMAIL=E-mail +EMAIL_MSG=The following page from the "%s" Web site has been sent to you by %s ( %s ).\n\nYou can access it at the following URL:\n %s +EMAIL_ERR_NOINFO=You must enter your valid e-mail address and a valid e-mail for the recipient. +FILTER=Filter +FINISH PUBLISHING=Finish Publishing +GREEN=Green +HITS=Hits +IMAGES=Images +INFO=Info +INSERT=Insert +INTRO TEXT=Intro Text +INVALID RATING=Invalid Rating +ITEM SENT BY=Article sent by %s +ITEM SUCCESSFULLY SAVED.=Article successfully saved. +ITEMS=Articles +ITEM TITLE=Article Title +KEY NOT FOUND=Key not found +KEYWORDS=Keywords +LAST MODIFIED=Last Modified +MESSAGE SUBJECT=Message Subject +METADATA=Metadata +MORE=More... +NEVER=Never +NEW ITEM=New Item +NO IMAGE=No Image +NO=No +NUM=# +ON_NEW_CONTENT=A new Article has been submitted by [ %s ] titled [ %s ] from Section [ %s ] and Category [ %s ] +OPTIONAL=Optional +ORDER=Order +ORDERING=Ordering +PAGE=Page +PDF=PDF +PGB TOC ALIAS PROMPT=Table of Contents Alias: +PGB PAGE TITLE=Page Title: +PGB INS PAGEBRK=Insert Pagebreak +PGB ARTICLE PAGEBRK=Article Pagebreak +PLEASE SELECT A CATEGORY=Please select a Category +PUBLISHED=Published +PUBLISHING=Publishing +REGISTER TO READ MORE...=Register to read more... +READ MORE=Read more: %s +REGISTERED USERS ONLY=Registered Users Only +REQUIRED=Required +REMOVE=Remove +SEND EMAIL=Send e-mail +SELECT CATEGORY=Select Category +SELECT SECTION=Select Section +SHOW ON FRONT PAGE=Show on Front Page +SOURCE=Source +START PUBLISHING=Start Publishing +STATE=State +SUB-FOLDER=Sub-folder +SUBMIT AN ARTICLE=Submit an Article +THANK_SUB=Thank you for your submission. It will be reviewed before being posted on the site. +THANKS FOR RATING!=Thanks for rating! +THE MODULE=The Module +THIS CATEGORY IS CURRENTLY EMPTY=This Category is currently empty. +THIS ITEM HAS BEEN SENT TO=This Article was sent to +TITLE=Title +TITLE ASC=Title asc +TITLE DESC=Title desc +TOP=Top +UNABLE TO LOAD DATA=Unable to load data. +UNCATEGORIZED=Uncategorised +UP=Up +VERSION=Version +VIEW ALL=View All +WARNUSER=Please either Cancel or Save the current change. +WRITTEN BY=Written by %s +YES=Yes +YOU ALREADY RATED THIS ARTICLE TODAY!=You already rated this Article today! +YOUR EMAIL=Your E-mail +YOUR FRIENDS EMAIL=Your friend's e-mail +YOUR NAME=Your Name diff --git a/language/en-GB/en-GB.com_frontpage.ini b/language/en-GB/en-GB.com_frontpage.ini index 4e8b5446a2ca4..dd2a3db772804 100644 --- a/language/en-GB/en-GB.com_frontpage.ini +++ b/language/en-GB/en-GB.com_frontpage.ini @@ -1,7 +1,7 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -EMPTY_BLOG=There are no Articles to display +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +EMPTY_BLOG=There are no Articles to display. diff --git a/language/en-GB/en-GB.com_mailto.ini b/language/en-GB/en-GB.com_mailto.ini index 19c764b4f9562..cbf43788f0703 100644 --- a/language/en-GB/en-GB.com_mailto.ini +++ b/language/en-GB/en-GB.com_mailto.ini @@ -1,19 +1,19 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -EMAIL_ERR_NOINFO=Please provide a valid e-mail address -EMAIL_INVALID=The address '%s' does not appear to be a valid e-mail address -EMAIL_THIS_LINK_TO_A_FRIEND=E-mail this Link to a Friend -EMAIL_TO=E-mail to -SENDER=Sender -YOUR_EMAIL=Your E-mail -SUBJECT=Subject -SEND=Send -CANCEL=Cancel -EMAIL_SENT=E-mail has been sent successfully -EMAIL_NOT_SENT=E-mail could not be sent -EMAIL_MSG=This is an e-mail from (%s) sent by %s (%s). You may find the following Link interesting: %s -CLOSE_WINDOW=Close Window +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +EMAIL_ERR_NOINFO=Please provide a valid e-mail address. +EMAIL_INVALID=The address '%s' does not appear to be a valid e-mail address. +EMAIL_THIS_LINK_TO_A_FRIEND=E-mail this link to a friend. +EMAIL_TO=E-mail to +SENDER=Sender +YOUR_EMAIL=Your E-mail +SUBJECT=Subject +SEND=Send +CANCEL=Cancel +EMAIL_SENT=E-mail was sent successfully. +EMAIL_NOT_SENT=E-mail could not be sent. +EMAIL_MSG=This is an e-mail from (%s) sent by %s (%s). You may also find the following link interesting: %s +CLOSE_WINDOW=Close Window diff --git a/language/en-GB/en-GB.com_messages.ini b/language/en-GB/en-GB.com_messages.ini index 29f80eecd3321..a983976822f2b 100644 --- a/language/en-GB/en-GB.com_messages.ini +++ b/language/en-GB/en-GB.com_messages.ini @@ -4,6 +4,6 @@ # License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php # Note : All ini files need to be saved as UTF-8 - No BOM -A NEW PRIVATE MESSAGE HAS ARRIVED=A new private message has arrived from %s -MESSAGE_FAILED=The User has locked their Mail Box. Message failed. +A NEW PRIVATE MESSAGE HAS ARRIVED=A new private message has arrived from %s. +MESSAGE_FAILED=The user has locked their mailbox. Message failed. PLEASE LOGIN TO READ YOUR MESSAGE=Please login to %s to read your message. diff --git a/language/en-GB/en-GB.com_newsfeeds.ini b/language/en-GB/en-GB.com_newsfeeds.ini index c3d497ee7479a..8f8a600a456cd 100644 --- a/language/en-GB/en-GB.com_newsfeeds.ini +++ b/language/en-GB/en-GB.com_newsfeeds.ini @@ -1,13 +1,13 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -NEWS_FEEDS=News Feeds -DISPLAY NUM=Display # -ERROR: FEED NOT RETRIEVED=Error: Feed not retrieved -FEED LINK=Feed Link -FEED NAME=Feed Name -NUM ARTICLES=# Articles -NEWS FEEDS=News Feeds +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +NEWS_FEEDS=News Feeds +DISPLAY NUM=Display # +ERROR: FEED NOT RETRIEVED=Error. Feed not retrieved. +FEED LINK=Feed Link +FEED NAME=Feed Name +NUM ARTICLES=# Articles +NEWS FEEDS=News Feeds diff --git a/language/en-GB/en-GB.com_poll.ini b/language/en-GB/en-GB.com_poll.ini index c5dc8d8260c0e..354fbd469ea59 100644 --- a/language/en-GB/en-GB.com_poll.ini +++ b/language/en-GB/en-GB.com_poll.ini @@ -1,19 +1,19 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -CONTINUE=Continue -COOKIES MUST BE ENABLED!=Cookies must be enabled! -FIRST VOTE=First Vote -LAST VOTE=Last Vote -NUMBER OF VOTERS=Number of Voters -SELECT POLL=Select Poll -SELECT POLL FROM THE LIST=Select Poll from the list -THANKS FOR YOUR VOTE!=Thanks for your vote! -THERE ARE NO RESULTS FOR THIS POLL.=There are no results for this Poll. -WARNSELECT=No selection has been made, please try again -YOU ALREADY VOTED FOR THIS POLL TODAY!=You already voted for this Poll today! -YOUR POLL MUST CONTAIN A TITLE.=Your Poll must contain a Title. -YOUR POLL MUST HAVE A NON-ZERO LAG TIME.=Your Poll must have a non-zero lag time. +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CONTINUE=Continue +COOKIES MUST BE ENABLED!=Cookies must be enabled! +FIRST VOTE=First Vote +LAST VOTE=Last Vote +NUMBER OF VOTERS=Number of Voters +SELECT POLL=Select Poll +SELECT POLL FROM THE LIST=Select a poll from the list +THANKS FOR YOUR VOTE!=Thank you for voting! +THERE ARE NO RESULTS FOR THIS POLL.=There are no results yet for this poll. +WARNSELECT=No selection was made. Please try again. +YOU ALREADY VOTED FOR THIS POLL TODAY!=You already voted for this Poll today! +YOUR POLL MUST CONTAIN A TITLE.=Your Poll must contain a Title. +YOUR POLL MUST HAVE A NON-ZERO LAG TIME.=Your Poll must have a non-zero lag time. diff --git a/language/en-GB/en-GB.com_search.ini b/language/en-GB/en-GB.com_search.ini index 1a733e9f0b9fd..c782795c998e4 100644 --- a/language/en-GB/en-GB.com_search.ini +++ b/language/en-GB/en-GB.com_search.ini @@ -10,20 +10,20 @@ ALPHABETICAL=Alphabetical ANY WORDS=Any words DISPLAY NUM=Display # EXACT PHRASE=Exact Phrase -IGNOREKEYWORD=One or more common words were ignored in the search +IGNOREKEYWORD=One or more common words were ignored in the search. MOST POPULAR=Most Popular NEWEST FIRST=Newest First -NO RESULTS WERE FOUND=No results were found +NO RESULTS WERE FOUND=No results were found. OLDEST FIRST=Oldest First ORDERING=Ordering SEARCH=Search SEARCH KEYWORD=Search Keyword -SEARCH_MESSAGE=Search term must be a minimum of 3 characters and a maximum of 20 characters +SEARCH_MESSAGE=Search term must be a minimum of 3 characters and a maximum of 20 characters. SEARCH ONLY=Search Only SECTION/CATEGORY=Section/Category -TOTALRESULTSFOUND=Total %s results found. +TOTALRESULTSFOUND=Total: %s results found. WITH=with SEARCH_AGAIN=Search Again SEARCH_RESULT=Search Result UNCATEGORISED CONTENT=Uncategorised Content -SEARCH PARAMETERS=Search Parameters \ No newline at end of file +SEARCH PARAMETERS=Search Parameters diff --git a/language/en-GB/en-GB.com_user.ini b/language/en-GB/en-GB.com_user.ini index 6adc6f16aa3e7..269677e4deebc 100644 --- a/language/en-GB/en-GB.com_user.ini +++ b/language/en-GB/en-GB.com_user.ini @@ -1,146 +1,146 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ACCOUNT DETAILS FOR=Account Details for %s at %s -BACK-END LANGUAGE=Back-end Language: -BUTTON_LOGIN=Login -BUTTON_LOGOUT=Logout -CHECKED IN=Checked in -CHECKING TABLE=Checking Table -CONF_CHECKED_IN=Checked out Items have now been all checked in -CONFIRM YOUR ACCOUNT=Confirm your Account -COULD_NOT_FIND_EMAIL=a User with the specified e-mail address could not be found -COULD_NOT_FIND_USER=a User with the specified Username and e-mail address could not be found -EDIT YOUR DETAILS=Edit Your Details -DATABASE_ERROR=a database error was encountered. Please try again later -DESCLOGINFORM=This Module displays a username and password Login form. It also displays a link to retrieve a forgotten password. If User registration is enabled, (refer to the Global Configuration settings), then another link will be shown to invite Users to self-register. -EMAIL=E-mail -EMAIL ADDRESS=E-mail Address -ERROR_SENDING_CONFIRMATION_EMAIL=an error was encountered while sending the confirmation e-mail -ERROR_SENDING_REMINDER_EMAIL=an error was encountered while sending the Username reminder e-mail -E_SESSION_TIMEOUT=Your session may have expired, please try again -E_NOLOGIN_BLOCKED=Login denied! Your account has either been blocked or you have not activated it yet. Did you not get an activation e-mail and follow the validation link? -FAILED TO COPY=Failed to Copy -FAX=Fax -FORGOT_YOUR_PASSWORD=Forgot your Password? -FORGOT_YOUR_USERNAME=Forgot your Username? -FRONT-END LANGUAGE=Front-end Language: -GREETING=Greeting -HELP SITE=Help Site: -HELP SITE FOR THIS USER=Help Site for this User -HINAME=Hi %s, -IMAGE=Image -ITEMS=Items -INVALID_EMAIL_ADDRESS=the e-mail address was invalid -INVALID_TOKEN=the token was invalid -JAUTHENTICATION::__CONSTRUCT: COULD NOT LOAD AUTHENTICATION LIBRARIES.=JAuthentication::__construct: Could not load authentication libraries. -LOGIN=Login -LOGOUT=Logout -LOGIN MESSAGE=Login Message -LOGIN REDIRECTION URL=Login Redirection Page -LOGOUT MESSAGE=Logout Message -LOGOUT REDIRECTION URL=Logout Redirection Page -LOGIN_DESCRIPTION=To access the Private Area of this site please Login -LOGOUT_DESCRIPTION=You are currently Logged in to the Private Area of this site -MOD_LOGIN=mod_login -NAME=Name -NAME/USERNAME=Name/Username -NEWPASS_MAIL_MSG=The User Account %s %s %s %s %s %s -NEWPASS_MSG1=has this e-mail associated with it.\n A Web User from -NEWPASS_MSG2=has just requested that a new password be sent.\n\nYour New Password is: -NEWPASS_MSG3=\n\nIf you did not ask for this, don't worry. You are seeing this message, not them. If this was an error just Login with your new password and then change your password to what you would like it to be. -NEW PASSWORD FOR=%s :: New Password for - %s -NEW USER PASSWORD CREATED AND SENT!=New User Password created and sent! -NO ACCOUNT YET?=No Account Yet? -NOTICE=Notice -PARAMPOSTTEXT=This is the text or HTML that is displayed below the Login form -PARAMPRETEXT=This is the text or HTML that is displayed above the Login form -PARAMLOGINREDIRECTURL=Select the page the User will be redirected to after a successful Login. Select from all the pages listed in the drop down list. If no selection is made the Front Page will be loaded by default. -PARAMLOGOUTREDIRECTURL=Select the page the User will be redirected to after successfully ending their current session by Logging Out. Select from all the pages listed in the drop down list. If no selection is made the Front Page will be loaded by default. -PARAMLOGINMESSAGE=Show/Hide the JavaScript Pop-up indicating Login Success -PARAMLOGOUTMESSAGE=Show/Hide the JavaScript Pop-up indicating Logout Success -PASSWORD=Password -PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT=Hello,\n\na request has been made to reset your %s account password. To reset your password, you will need to submit this token in order to verify that the request was legitimate.\n\nThe token is %s .\n\nClick on the URL below to enter the token and proceed to resetting your password.\n\n%s\n\nThank you. -PASSWORD_RESET_CONFIRMATION_EMAIL_TITLE=Your %s password reset request -PASSWORD_RESET_CONFIRMATION_FAILED=Your password reset confirmation failed because %s. -PASSWORD_RESET_FAILED=Your password reset failed because %s. -PASSWORD_RESET_REQUEST_FAILED=Your password reset request failed because %s. -PASSWORD_RESET_SUCCESS=Your password has been reset. -PASSWORDS_DO_NOT_MATCH=Passwords do not match -PASSWORDS_DO_NOT_MATCH_LOW=the passwords do not match -PLEASE ENTER A VALID E-MAIL ADDRESS.=Please enter a valid e-mail address. -PLEASE VERIFY THE PASSWORD.=Please verify the password. -POST-TEXT=Post-text -PRE-TEXT=Pre-text -REGERROR=Registration Error -REGISTER=Register -REGISTRATION=Registration -REGISTER_REQUIRED=Fields marked with an asterisk (*) are required. -REGWARN_PASS=Please enter a valid password. No spaces, more than 6 characters and contain 0-9,a-z,A-Z -REGWARN_VPASS2=Password and verification do not match, please try again. -REG_ACTIVATE_COMPLETE_TITLE=Activation Complete! -REG_ACTIVATE_COMPLETE=Your Account has been successfully activated. You can now Login using the Username and password you chose during the registration. -REG_ACTIVATE_NOT_FOUND_TITLE=Invalid Activation Link! -REG_ACTIVATE_NOT_FOUND=There is no such account in our database or the account has already been activated. -REG_COMPLETE_TITLE=Registration Complete! -REG_COMPLETE=You may now Login. -REG_COMPLETE_ACTIVATE_TITLE=Registration Complete! -REG_COMPLETE_ACTIVATE=Your account has been created and an activation link has been sent to the e-mail address you entered. Note that you must activate the account by clicking on the activation link when you get the e-mail before you can login. -REMEMBER ME=Remember Me -REMIND_USERNAME_DESCRIPTION=Please enter the e-mail address associated with your User account. Your username will be e-mailed to the e-mail address on file. -REMIND_USERNAME_EMAIL_TIP_TITLE=E-mail Address -REMIND_USERNAME_EMAIL_TIP_TEXT=Please enter the e-mail address associated with your account. -RESEND USERNAME FOR=Resend username for %s -RESEND_MAIL_MSG=The User account %s %s %s %s %s -RESEND_MSG1=has this e-mail associated with it.\n A Web User from -RESEND_MSG2=has just requested to get the username resend. -RESEND_MSG3=\n\nIf you did not ask for this, don't worry. You are seeing this message, not them. -RESET_PASSWORD_COMPLETE_DESCRIPTION=To complete the password reset process please enter a new password. -RESET_PASSWORD_CONFIRM_DESCRIPTION=An e-mail has been sent to your e-mail address. The e-mail contains a verification token, please paste the token in the field below to prove that you are the owner of this account. -RESET_PASSWORD_EMAIL_TIP_TEXT=Please enter the e-mail address for your account. -RESET_PASSWORD_EMAIL_TIP_TITLE=E-mail Address -RESET_PASSWORD_PASSWORD1_TIP_TEXT=Please enter a new password for your account. -RESET_PASSWORD_PASSWORD1_TIP_TITLE=Password -RESET_PASSWORD_PASSWORD2_TIP_TEXT=Please enter the password again. -RESET_PASSWORD_PASSWORD2_TIP_TITLE=Verify Password -RESET_PASSWORD_REQUEST_DESCRIPTION=Please enter the e-mail address for your account. A verification token will be sent to you. Once you have received the token, you will be able to choose a new password for your account. -RESET_PASSWORD_TOKEN_TIP_TEXT=Please enter the token that was sent to your e-mail address. -RESET_PASSWORD_TOKEN_TIP_TITLE=Token -RESET_PASSWORD_USERNAME_TIP_TEXT=Please enter the username for your account -RESET_PASSWORD_USERNAME_TIP_TITLE=Username -RESET YOUR PASSWORD=Reset your Password -SELECT A USER TO DELETE=Select a User to Delete -SEND=Send -SEND_MSG=Hello %s,\n\nThank you for registering at %s.\n\nYou may now Login to %s using the username and password you registered with. -SEND_MSG_ACTIVATE=Hello %s,\n\nThank you for registering at %s. Your account is created and must be activated before you can use it.\nTo activate the account click on the following link or copy-paste it in your browser:\n%s\n\nAfter activation you may login to %s using the following username and password:\n\nusername - %s\npassword - %s -SEND_MSG_ADMIN=Hello %s,\n\nA new User has registered at %s.\nThis e-mail contains their details:\n\nName - %s\ne-mail - %s\nUsername - %s\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only. -SEND REGISTRATION=Send Registration -SHOW/HIDE THE SIMPLE GREETING TEXT=Show/Hide the simple greeting text -SORRY, NO CORRESPONDING USER WAS FOUND=Sorry, no corresponding User was found -SUBMISSION SUCCESS!=Submission Success! -SUBMIT=Submit -SUBMIT_SUCCESS_DESC=Your Item has been successfully submitted to our administrators. It will be reviewed before being published on this site. -TIME ZONE FOR THIS USER=Time Zone for this User -TOKEN=Token -UNABLE TO FIND A USER WITH GIVEN ACTIVATION STRING= The system is unable to find a User with the given activation string. The account may already be activated or the activation code has expired. If the latter you need to re-register with this site. -UPDATE=Update -UP_EXISTS=Image $Userfile_name already exists. Please rename the file and try again. -UP_SIZE=You cannot upload files greater than 15kb in size. -USERNAME RESENT=Username resent -USERNAME_REMINDER_EMAIL_TEXT=Hello,\n\nA username reminder has been requested for your %s account.\n\nYour username is %s.\n\nTo login to your account, click on the link below.\n\n%s\n\nThank you. -USERNAME_REMINDER_EMAIL_TITLE=Your %s username -USERNAME_REMINDER_FAILED=Your username reminder failed because %s. -USERNAME_REMINDER_SUCCESS=Your username has been e-mailed to %s. -USER EDITOR=User Editor: -USER NAME=User Name -USER UNKNOWN=User Unknown -VERIFY PASSWORD=Verify Password -WARNJAVASCRIPT=!Warning! JavaScript must be enabled for proper operation. -WELCOME!=Welcome! -WELCOME_DESC=Welcome to the Registered User content of our site -YOU MAY ONLY UPLOAD A GIF, OR JPG IMAGE.=You may only upload a .gif, or .jpg image. -YOUR NAME=Your Name -YOUR SETTINGS HAVE BEEN SAVED.=Your settings have been Saved. \ No newline at end of file +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ACCOUNT DETAILS FOR=Account Details for %s at %s +BACK-END LANGUAGE=Back-end Language: +BUTTON_LOGIN=Login +BUTTON_LOGOUT=Logout +CHECKED IN=Checked in +CHECKING TABLE=Checking Table +CONF_CHECKED_IN=Checked out items have now been all checked in. +CONFIRM YOUR ACCOUNT=Confirm your account. +COULD_NOT_FIND_EMAIL=a User with the specified e-mail address could not be found. +COULD_NOT_FIND_USER=a User with the specified username and e-mail address could not be found. +EDIT YOUR DETAILS=Edit Your Details +DATABASE_ERROR=A database error occurred. Please try again later. +DESCLOGINFORM=This Module displays a username and password login form. It also displays a link to retrieve a forgotten password. If user registration is enabled, (refer to the Global Configuration settings), another link will be shown to invite users to self-register. +EMAIL=E-mail +EMAIL ADDRESS=E-mail Address +ERROR_SENDING_CONFIRMATION_EMAIL=An error was encountered while sending the confirmation e-mail. +ERROR_SENDING_REMINDER_EMAIL=An error was encountered while sending the username reminder e-mail. +E_SESSION_TIMEOUT=Your session may have expired. Please try again. +FAILED TO COPY=Failed to copy. +FAX=Fax +FORGOT_YOUR_PASSWORD=Forgot your Password? +FORGOT_YOUR_USERNAME=Forgot your Username? +FRONT-END LANGUAGE=Front-end Language: +GREETING=Greeting +HELP SITE=Help Site: +HELP SITE FOR THIS USER=Help Site for this User +HINAME=Hi %s, +IMAGE=Image +ITEMS=Items +INVALID_EMAIL_ADDRESS=the e-mail address was invalid. +INVALID_TOKEN=the token was invalid. +JAUTHENTICATION::__CONSTRUCT: COULD NOT LOAD AUTHENTICATION LIBRARIES.=JAuthentication::__construct: Could not load authentication libraries. +LOGIN=Login +LOGOUT=Logout +LOGIN MESSAGE=Login Message +LOGIN REDIRECTION URL=Login Redirection Page +LOGOUT MESSAGE=Logout Message +LOGOUT REDIRECTION URL=Logout Redirection Page +LOGIN_DESCRIPTION=To access the private area of this site, please log in. +LOGOUT_DESCRIPTION=You are currently logged in to the private area of this site. +MOD_LOGIN=mod_login +NAME=Name +NAME/USERNAME=Name/Username +NEWPASS_MAIL_MSG=The User Account %s %s %s %s %s %s +NEWPASS_MSG1=has this e-mail associated with it.\n A Web User from +NEWPASS_MSG2=has just requested that a new password be sent.\n\nYour New Password is: +NEWPASS_MSG3=\n\nIf you did not ask for this, don't worry. Only you are seeing this message, not them. If this was an error, just login with your new password and change your password to what you would like it to be. +NEW PASSWORD FOR=%s :: New Password for - %s +NEW USER PASSWORD CREATED AND SENT!=New User Password created and sent! +NO ACCOUNT YET?=No Account Yet? +NOTICE=Notice +PARAMPOSTTEXT=This is the text or HTML that is displayed below the login form. +PARAMPRETEXT=This is the text or HTML that is displayed above the login form. +PARAMLOGINREDIRECTURL=Select the page the user will be redirected to after a successful login. Select from all the pages listed in the drop down list. If no selection is made, the Front Page will be loaded by default. +PARAMLOGOUTREDIRECTURL=Select the page the user will be redirected to after successfully ending their current session by logging out. Select from all the pages listed in the drop down list. If no selection is made, the Front Page will be loaded by default. +PARAMLOGINMESSAGE=Show/Hide the JavaScript Pop-up indicating Login Success +PARAMLOGOUTMESSAGE=Show/Hide the JavaScript Pop-up indicating Logout Success +PASSWORD=Password +PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT=Hello,\n\na request has been made to reset your %s account password. To reset your password, you will need to submit this token in order to verify that the request was legitimate.\n\nThe token is %s .\n\nClick on the URL below to enter the token and proceed with resetting your password.\n\n%s\n\nThank you. +PASSWORD_RESET_CONFIRMATION_EMAIL_TITLE=Your %s password reset request +PASSWORD_RESET_CONFIRMATION_FAILED=Your password reset confirmation failed because %s. +PASSWORD_RESET_FAILED=Your password reset failed because %s. +PASSWORD_RESET_REQUEST_FAILED=Your password reset request failed because %s. +PASSWORD_RESET_SUCCESS=Your password has been reset. +PASSWORDS_DO_NOT_MATCH=Passwords do not match. +PASSWORDS_DO_NOT_MATCH_LOW=the passwords do not match +PLEASE ENTER A VALID E-MAIL ADDRESS.=Please enter a valid e-mail address. +PLEASE VERIFY THE PASSWORD.=Please verify the password. +POST-TEXT=Post-text +PRE-TEXT=Pre-text +REGERROR=Registration Error +REGISTER=Register +REGISTRATION=Registration +REGISTER_REQUIRED=Fields marked with an asterisk (*) are required. +REGWARN_PASS=Please enter a valid password. No spaces, more than six characters, and containing 0-9, a-z, A-Z. +REGWARN_VPASS2=Password and verification do not match. Please try again. +REG_ACTIVATE_COMPLETE_TITLE=Activation Complete! +REG_ACTIVATE_COMPLETE=Your Account has been successfully activated. You can now log in using the username and password you chose during the registration. +REG_ACTIVATE_NOT_FOUND_TITLE=Invalid Activation Link! +REG_ACTIVATE_NOT_FOUND=There is no such account in our database or the account has already been activated. +REG_COMPLETE_TITLE=Registration Complete! +REG_COMPLETE=You may now log in. +REG_COMPLETE_ACTIVATE_TITLE=Registration Complete! +REG_COMPLETE_ACTIVATE=Your account has been created and an activation link has been sent to the e-mail address you entered. Note that you must activate the account by clicking on the activation link when you get the e-mail before you can login. +REMEMBER ME=Remember Me +REMIND_USERNAME_DESCRIPTION=Please enter the e-mail address associated with your User account. Your username will be e-mailed to the e-mail address on file. +REMIND_USERNAME_EMAIL_TIP_TITLE=E-mail Address +REMIND_USERNAME_EMAIL_TIP_TEXT=Please enter the e-mail address associated with your account. +RESEND USERNAME FOR=Resend username for %s +RESEND_MAIL_MSG=The User account %s %s %s %s %s +RESEND_MSG1=has this e-mail associated with it.\n A Web User from +RESEND_MSG2=has just requested to get the username resend. +RESEND_MSG3=\n\nIf you did not ask for this, don't worry. You are seeing this message, not them. +RESET_PASSWORD_COMPLETE_DESCRIPTION=To complete the password reset process, please enter a new password. +RESET_PASSWORD_CONFIRM_DESCRIPTION=An e-mail has been sent to your e-mail address. The e-mail contains a verification token, please paste the token in the field below to prove that you are the owner of this account. +RESET_PASSWORD_EMAIL_TIP_TEXT=Please enter the e-mail address for your account. +RESET_PASSWORD_EMAIL_TIP_TITLE=E-mail Address +RESET_PASSWORD_PASSWORD1_TIP_TEXT=Please enter a new password for your account. +RESET_PASSWORD_PASSWORD1_TIP_TITLE=Password +RESET_PASSWORD_PASSWORD2_TIP_TEXT=Please enter the password again. +RESET_PASSWORD_PASSWORD2_TIP_TITLE=Verify Password +RESET_PASSWORD_REQUEST_DESCRIPTION=Please enter the e-mail address for your account. A verification token will be sent to you. Once you have received the token, you will be able to choose a new password for your account. +RESET_PASSWORD_TOKEN_TIP_TEXT=Please enter the token that was sent to your e-mail address. +RESET_PASSWORD_TOKEN_TIP_TITLE=Token +RESET_PASSWORD_USERNAME_TIP_TEXT=Please enter the username for your account +RESET_PASSWORD_USERNAME_TIP_TITLE=Username +RESET YOUR PASSWORD=Reset your Password +SELECT A USER TO DELETE=Select a User to Delete +SEND=Send +SEND_MSG=Hello %s,\n\nThank you for registering at %s.\n\nYou may now log in to %s using the username and password you registered with. +SEND_MSG_ACTIVATE=Hello %s,\n\nThank you for registering at %s. Your account is created and must be activated before you can use it.\nTo activate the account click on the following link or copy-paste it in your browser:\n%s\n\nAfter activation you may login to %s using the following username and password:\n\nUsername: %s\nPassword: %s +SEND_MSG_ADMIN=Hello %s,\n\nA new user has registered at %s.\nThis e-mail contains their details:\n\nName: %s\nE-mail: %s\nUsername: %s\n\nPlease do not respond to this message. It is automatically generated and is for information purposes only. +SEND REGISTRATION=Send Registration +SHOW/HIDE THE SIMPLE GREETING TEXT=Show/Hide the simple greeting text +SORRY, NO CORRESPONDING USER WAS FOUND=Sorry, no corresponding user was found. +SUBMISSION SUCCESS!=Submission Success! +SUBMIT=Submit +SUBMIT_SUCCESS_DESC=Your Item has been successfully submitted to our administrators. It will be reviewed before being published on this site. +TIME ZONE FOR THIS USER=Time Zone for this User +TOKEN=Token +UNABLE TO FIND A USER WITH GIVEN ACTIVATION STRING= The system is unable to find a user with the given activation string. The account may already be activated or their activation code has expired. If it has expired, you need to re-register with this site. +UPDATE=Update +UP_EXISTS=Image $Userfile_name already exists. Please rename the file and try again. +UP_SIZE=You cannot upload files greater than 15kb in size. +USERNAME RESENT=Username resent +USERNAME_REMINDER_EMAIL_TEXT=Hello,\n\nA username reminder has been requested for your %s account.\n\nYour username is %s.\n\nTo login to your account, click on the link below.\n\n%s\n\nThank you. +USERNAME_REMINDER_EMAIL_TITLE=Your %s username +USERNAME_REMINDER_FAILED=Your username reminder failed because %s. +USERNAME_REMINDER_SUCCESS=Your username has been e-mailed to %s. +USER EDITOR=User Editor: +USER NAME=Username +USER UNKNOWN=User Unknown +VERIFY PASSWORD=Verify Password +WARNJAVASCRIPT=!Warning! JavaScript must be enabled for proper operation. +WELCOME!=Welcome! +WELCOME_DESC=Welcome to the registered user area of our site. +YOU MAY ONLY UPLOAD A GIF, OR JPG IMAGE.=You may only upload a .gif, or .jpg image. +YOUR NAME=Your Name +YOUR SETTINGS HAVE BEEN SAVED.=Your settings have been Saved. +YOU ARE ALREADY REGISTERED.=You are already registered. diff --git a/language/en-GB/en-GB.com_weblinks.ini b/language/en-GB/en-GB.com_weblinks.ini index 0fe0438fb2f4f..980ed2718b488 100644 --- a/language/en-GB/en-GB.com_weblinks.ini +++ b/language/en-GB/en-GB.com_weblinks.ini @@ -6,10 +6,10 @@ ALL=All CLICK TO SORT THIS COLUMN=Click to sort by this column. -DESCNEWITEMSLAST=New Web Links default to the last place. Ordering can be changed after this Web Link is saved. +DESCNEWITEMSLAST=New Web links default to the last position. Ordering can be changed after this Web link has been saved. DESCRIPTION=Description DISPLAY NUM=Display # -ERROR SAVING WEBLINK=Error saving the Web Link +ERROR SAVING WEBLINK=Error saving the Web link. HITS=Hits LINKS=Links NAME=Name @@ -18,7 +18,7 @@ NUM=# ORDERING=Ordering PLEASE PROVIDE A VALID URL=Please provide a valid URL. SUBMIT A WEB LINK=Submit A Web Link -THANK_SUB=Thanks for your submission. Your submission will now be reviewed before being posted to the site. +THANK_SUB=Thanks for your submission. It will be reviewed before being posted on the site. URL=URL WEB LINK=Web Link WEBLINK ITEM MUST HAVE A TITLE=Web Link Item must have a Title. diff --git a/language/en-GB/en-GB.com_wrapper.ini b/language/en-GB/en-GB.com_wrapper.ini index 8caa50fa953c1..9bc812489b6d0 100644 --- a/language/en-GB/en-GB.com_wrapper.ini +++ b/language/en-GB/en-GB.com_wrapper.ini @@ -1,8 +1,8 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -NO_IFRAMES=This option will not work correctly. Unfortunately, your browser does not support Inline Frames - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +NO_IFRAMES=This option will not work correctly. Unfortunately, your browser does not support inline frames. + diff --git a/language/en-GB/en-GB.ini b/language/en-GB/en-GB.ini index c9f6223375ec4..49294ab3b7250 100644 --- a/language/en-GB/en-GB.ini +++ b/language/en-GB/en-GB.ini @@ -68,11 +68,12 @@ NEXT MONTH (HOLD FOR MENU)=Click to move to the next month. Click and hold for a NEXT YEAR (HOLD FOR MENU)=Click to move to the next year. Click and hold for a list of years. PREV. MONTH (HOLD FOR MENU)=Click to move to the previous month. Click and hold for a list of the months. PREV. YEAR (HOLD FOR MENU)=Click to move to the previous year. Click and hold for a list of years. -SELECT DATE=Select a date. +SELECT DATE=Select a date TIME=Time TIME:=Time: CLOSE=Close TODAY=Today +WK=wk # Time Zones @@ -86,6 +87,7 @@ TODAY=Today (UTC -07:00) MOUNTAIN TIME (US & CANADA)=(UTC -07:00) Mountain Time (US & Canada) (UTC -06:00) CENTRAL TIME (US & CANADA), MEXICO CITY=(UTC -06:00) Central Time (US & Canada), Mexico City (UTC -05:00) EASTERN TIME (US & CANADA), BOGOTA, LIMA=(UTC -05:00) Eastern Time (US & Canada), Bogota, Lima +(UTC -04:30) VENEZUELA=(UTC -04:30) Venezuela (UTC -04:00) ATLANTIC TIME (CANADA), CARACAS, LA PAZ=(UTC -04:00) Atlantic Time (Canada), Caracas, La Paz (UTC -03:30) ST. JOHN'S, NEWFOUNDLAND, LABRADOR=(UTC -03:30) St. John's, Newfoundland, Labrador (UTC -03:00) BRAZIL, BUENOS AIRES, GEORGETOWN=(UTC -03:00) Brazil, Buenos Aires, Georgetown @@ -139,16 +141,16 @@ ACCESS FORBIDDEN=Access Forbidden! ADMINISTRATOR=administrator ALERTNOTAUTH=You are not authorised to view this resource. ALL=All -AN ERROR HAS OCCURED=An error has occurred +AN ERROR HAS OCCURED=An error has occurred. AN ERROR HAS OCCURRED WHILE PROCESSING YOUR REQUEST.=An error has occurred while processing your request. AN OUT-OF-DATE BOOKMARK/FAVOURITE=an out-of-date bookmark/favourite APPLY=Apply ARCHIVE=Archive ARCHIVED=Archived -ARE YOU SURE YOU WANT TO DELETE SELECTED ITEMS.=Are you sure you want to delete the selected Items. +ARE YOU SURE YOU WANT TO DELETE SELECTED ITEMS.=Are you sure you want to delete the selected items? A SEARCH ENGINE THAT HAS AN OUT-OF-DATE LISTING FOR THIS SITE=a search engine that has an out-of-date listing for this site A MIS-TYPED ADDRESS=a mistyped address -ATTENTION OPEN IN A NEW WINDOW=Attention, open in a new window. +ATTENTION OPEN IN A NEW WINDOW=Attention: open in a new window. BACK=[ Back ] BANNER=Banner CACHE DIRECTORY UNWRITABLE=Cache directory unwritable @@ -158,7 +160,7 @@ CATEGORY=Category CENTER=Center CHECKED OUT=Checked Out CLICK TO SORT THIS COLUMN=Click to sort by this column -CLOAKING=This e-mail address is being protected from spambots, you need JavaScript enabled to view it +CLOAKING=This e-mail address is being protected from spambots. You need JavaScript enabled to view it CLOSE WINDOW=Close Window COMPONENT NOT FOUND=Component not found CONTACT=Contact @@ -166,10 +168,11 @@ CONTRIBUTED BY=Contributed by COPY FAILED=Copy failed DELETE=Delete DESCBEINGEDITTED=%s %s is currently being edited by another Editor, Publisher, or Administrator. -DESCNEWITEMSFIRST=New Items default to the first place. Ordering can be changed after this Item is saved. -DESCNEWITEMSLAST=New Items default to the last place. Ordering can be changed after this Item is saved. +DESCNEWITEMSFIRST=New items default to the first position. Ordering can be changed after this item has been saved. +DESCNEWITEMSLAST=New items default to the last position. Ordering can be changed after this item has been saved. DIRECTORY UNWRITABLE=Directory Unwritable E_LOGIN_AUTHENTICATE=Username and password do not match or you do not have an account yet. +E_NOLOGIN_BLOCKED=Login denied! Your account has either been blocked or you have not activated it yet. Did you not get an activation e-mail and follow the validation link? EDIT=edit EDIT CSS=Edit CSS EDIT HTML=Edit HTML @@ -177,7 +180,7 @@ END=End ERROR=Error ERROR LOADING FEED DATA=Error loading feed data. ERROR LOADING MODULES=Error loading Modules: -ERRORXMLSETUP=No xml files were found in the install folder +ERRORXMLSETUP=No XML files were found in the install folder. FAILED TO SET LDAP_OPT_REFERRALS OPTION=failed to set LDAP_OPT_REFERRALS option FAILED TO SET LDAP PROTOCOL V3=failed to set LDAP Protocol V3 FIRST=first @@ -203,9 +206,9 @@ LOGIN=Login LOGIN_BLOCKED=Your Login has been blocked. Please contact the administrator. LOGIN_INCOMPLETE=Please complete the username and password fields. LOGIN_INCORRECT=Incorrect username or password. -LOGIN_SUCCESS=You have successfully Logged In -LOGOUT_SUCCESS=You have successfully Logged Out -MAIL_FUNCTION_DISABLED=The mail() function has been disabled and the mail cannot be sent +LOGIN_SUCCESS=You have successfully logged in. +LOGOUT_SUCCESS=You have successfully logged out. +MAIL_FUNCTION_DISABLED=The mail() function has been disabled and the mail cannot be sent. MAIL_MSG=Please do not respond to this message as it is automatically generated and is for information purposes only. MAIL_MSG_ADMIN=Hello %s,\n\n\nA User submitted %s:\n [ %s ]\nhas been just submitted by User:\n [ %s ]\nfor %s.\n\n\n\nPlease go to %s/%s to view and approve this %s.\n\n MESSAGE=Message @@ -227,7 +230,7 @@ NOT_EXIST=The page you are trying to access does not exist.
      Please select a NOT FOUND=not found NUM=# OF=of -PAGE COULD NOT BE FOUND=Page could not be found +PAGE COULD NOT BE FOUND=Page could not be found. PAGEBREAK=Pagebreak PATH IS NOT A FOLDER=Path is not a folder: PARAMADMINLANGUAGE=Default Language for the Administrator Back-end @@ -235,9 +238,9 @@ PARAMLANGUAGE=Default Language for the Site Front-end PASSWORD=Password PAGE=Page PARENT WINDOW WITH BROWSER NAVIGATION=Parent Window with Browser Navigation -PLEASE ENTER A USER NAME.=Please enter a User Name. -PLEASE ENTER A VALID E-MAIL ADDRESS.=Please enter a valid e-mail address. -PLEASE ENTER YOUR NAME.=Please enter Your Name. +PLEASE ENTER A USER NAME.=Please enter a usermame: +PLEASE ENTER A VALID E-MAIL ADDRESS.=Please enter a valid e-mail address: +PLEASE ENTER YOUR NAME.=Please enter your name: PLEASE GO TO=Please go to PLEASE MAKE A SELECTION FROM THE LIST TO=Please make a selection from the list to PLEASE SELECT A NEWS STORY TO=Please select a news story to @@ -264,7 +267,7 @@ SELECT A CATEGORY=Select a Category SELECT A SECTION=Select a Section SELECT EDITOR=Select Editor SELECT LANGUAGE=Select Language -SESSION_EXPIRED=Your session has expired, please login again +SESSION_EXPIRED=Your session has expired. Please log in again. SORT ASCENDING=Sort Ascending SORT DESCENDING=Sort Descending SPECIAL=Special @@ -275,9 +278,9 @@ TASK=Task TEMPLATE_WARN=Template File Not Found! Looking for Template: %s THE MEMCACHE EXTENSION IS NOT AVAILABLE=The memcache Extension is not available THE APC EXTENSION IS NOT AVAILABLE=The APC Extension is not available -THE EACCELERATOR EXTENSION IS NOT AVAILABLE=The eAccelerator Extension is not available +THE EACCELERATOR EXTENSION IS NOT AVAILABLE=The eAccelerator Extension is not available THE ITEM=The article -THERE ARE NO PARAMETERS FOR THIS ITEM=There are no Parameters for this Item +THERE ARE NO PARAMETERS FOR THIS ITEM=There are no parameters for this item. THE REQUESTED RESOURCE WAS NOT FOUND=The requested resource was not found. TO VIEW AND APPROVE THIS=to view and approve this TIME ZONE=Time Zone @@ -295,17 +298,17 @@ USERNAME=Username VALID_AZ09=Please enter a valid %s. No spaces, at least %d characters and must contain only letters and numbers. VIEW ALL=View All VIEW NOT FOUND [NAME, TYPE, PREFIX]:=View not found [name, type, prefix]: -WARNINSTALL=For your security please completely remove the installation directory including all files and sub-folders - then refresh this page -WARNNAMETRYAGAIN=There is a %s already with that name, please try again. -WARNFS_ERR01=Warning! - Failed to change file permissions -WARNFS_ERR02=Warning! - Failed to move file -WARNFS_ERR03=Upload failed, directory not writable -WARNFS_ERR04=Upload failed, directory does not exist +WARNINSTALL=For your security, please completely remove the installation directory, including all files and sub-folders. Then refresh this page. +WARNNAMETRYAGAIN=There is a %s already with that name. Please try again. +WARNFS_ERR01=Warning! - Failed to change file permissions. +WARNFS_ERR02=Warning! - Failed to move file. +WARNFS_ERR03=Upload failed. Directory not writable. +WARNFS_ERR04=Upload failed. Directory does not exist. WARNMOSUSER=Error mosUser::setLastVisit cannot call method statically with no ID -WARNREG_EMAIL_INUSE=This e-mail is already registered. If you forgot the password click on Lost your Password and a new password will be sent to you. +WARNREG_EMAIL_INUSE=This e-mail is already registered. If you forgot your password, click on the Lost your Password link and a new password will be sent to you. WARNREG_INUSE=This username/password already in use. Please try another. WARNREG_MAIL=Please enter a valid e-mail address. -WARNSUPERADMINCREATE=You cannot create a User with this User Group Level, only Super Administrators have this ability. +WARNSUPERADMINCREATE=You cannot create a user with this User Group Level. Only Super Administrators have this ability. WEB LINKS=Web Links WRITABLE=Writable WRITTEN BY=Written by @@ -313,6 +316,6 @@ WYSIWYG EDITOR FOR THIS USER=WYSIWYG Editor for this User YEAR=Year YOU HAVE NO ACCESS TO THIS PAGE=you have no access to this page YOU MAY NOT BE ABLE TO VISIT THIS PAGE BECAUSE OF:=You may not be able to visit this page because of: -YOU MUST LOGIN FIRST=You must login first -YOU NEED TO LOGIN.=You need to Login. +YOU MUST LOGIN FIRST=You must log in first +YOU NEED TO LOGIN.=You need to log in. YOUR=Your diff --git a/language/en-GB/en-GB.mod_archive.ini b/language/en-GB/en-GB.mod_archive.ini index 620991ffece43..1fa42bfa03219 100644 --- a/language/en-GB/en-GB.mod_archive.ini +++ b/language/en-GB/en-GB.mod_archive.ini @@ -1,11 +1,11 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ARCHIVED CONTENT=Archived Content -COUNT=Count -DESCARCHIVE=This Module shows a list of the calendar months, which contain Archived Articles. After you have changed the status of an Article to Archived this list will be automatically generated. -MOD_ARCHIVE=mod_archive -THE NUMBER OF ITEMS TO DISPLAY (DEFAULT IS 10)=The number of Articles to display (the default is 10) +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ARCHIVED CONTENT=Archived Content +COUNT=Count +DESCARCHIVE=This Module shows a list of the calendar months containing Archived Articles. After you have changed the status of an Article to Archived, this list will be automatically generated. +MOD_ARCHIVE=mod_archive +THE NUMBER OF ITEMS TO DISPLAY (DEFAULT IS 10)=The number of Articles to display (the default is 10) diff --git a/language/en-GB/en-GB.mod_banners.ini b/language/en-GB/en-GB.mod_banners.ini index e5779e2e17807..652efcaa25489 100644 --- a/language/en-GB/en-GB.mod_banners.ini +++ b/language/en-GB/en-GB.mod_banners.ini @@ -1,27 +1,27 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -BANNER=Banner -BANNER CLIENT=Banner Client -COUNT=Count -DESCBANNER=The Banner Module allows to show the active Banners out of the Component within your site. -FOOTER TEXT=Footer Text -HEADER TEXT=Header Text -MOD_BANNERS=mod_banners -PARAMCATEGORY=Select Banners only from a single Category. -PARAMFOOTERTEXT=Text to display after the group of Banners -PARAMHEADERTEXT=A heading to display before the group of Banners -PARAMRANDOMISE=Randomise the ordering of the Banners -PARAMSEARCHBYTAG=Banner is selected by matching the Banner Tags to the current document keywords. -PARAMSINGLECLIENT=Select Banners only from a single Client. -PARAMTARGET=Target window when the link is clicked -PARAMNUMBERITEMS=The number of Banners to display (default 5) -RANDOMISE=Randomise -SEARCH BY TAGS=Search By Tags -STICKY,ORDERING=Sticky,Ordering -STICKY,RANDOMISE=Sticky,Randomise -TARGET=Target - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +BANNER=Banner +BANNER CLIENT=Banner Client +COUNT=Count +DESCBANNER=The Banner Module allows to show the active Banners out of the Component within your site. +FOOTER TEXT=Footer Text +HEADER TEXT=Header Text +MOD_BANNERS=mod_banners +PARAMCATEGORY=Select Banners only from a single Category. +PARAMFOOTERTEXT=Text to display after the group of Banners +PARAMHEADERTEXT=A heading to display before the group of Banners +PARAMRANDOMISE=Randomise the ordering of the Banners +PARAMSEARCHBYTAG=Banner is selected by matching the Banner Tags to the current document keywords. +PARAMSINGLECLIENT=Select Banners only from a single Client. +PARAMTARGET=Target window when the link is clicked +PARAMNUMBERITEMS=The number of Banners to display (default 5) +RANDOMISE=Randomise +SEARCH BY TAGS=Search By Tags +STICKY,ORDERING=Sticky, Ordering +STICKY,RANDOMISE=Sticky, Randomise +TARGET=Target + diff --git a/language/en-GB/en-GB.mod_breadcrumbs.ini b/language/en-GB/en-GB.mod_breadcrumbs.ini index 5cde42c5d426d..48ecbc3c3bd8e 100644 --- a/language/en-GB/en-GB.mod_breadcrumbs.ini +++ b/language/en-GB/en-GB.mod_breadcrumbs.ini @@ -1,18 +1,19 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -A TEXT SEPARATOR=A text separator -MOD_BREADCRUMBS=mod_breadcrumbs -BREADCRUMBS=Breadcrumbs -PARAMSHOWHOME=Show/Hide the Home element in the Pathway -PARAMHOMETEXT=This text will be shown as Home entry -PARAMSHOWCOMPONENT=Show/Hide the Component element in the Pathway -SHOW HOME=Show Home -TEXT FOR HOME ENTRY=Text for Home entry -SHOW COMPONENT=Show Component -TEXT SEPARATOR=Text Separator -THIS MODULE DISPLAYS THE BREADCRUMBS=This Module displays the Breadcrumbs - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +A TEXT SEPARATOR=A text separator +MOD_BREADCRUMBS=mod_breadcrumbs +BREADCRUMBS=Breadcrumbs +PARAMSHOWHOME=Show/Hide the Home element in the Pathway +PARAMSHOWLAST=Show/Hide the last element in the Pathway +PARAMHOMETEXT=This text will be shown as Home entry +PARAMSHOWCOMPONENT=Show/Hide the Component element in the Pathway +SHOW HOME=Show Home +TEXT FOR HOME ENTRY=Text for Home entry +SHOW COMPONENT=Show Component +TEXT SEPARATOR=Text Separator +THIS MODULE DISPLAYS THE BREADCRUMBS=This Module displays the Breadcrumbs + diff --git a/language/en-GB/en-GB.mod_custom.ini b/language/en-GB/en-GB.mod_custom.ini index cb61bcf6cce8d..26d2f654a3e99 100644 --- a/language/en-GB/en-GB.mod_custom.ini +++ b/language/en-GB/en-GB.mod_custom.ini @@ -1,10 +1,10 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCMODCUSTOM=This Module allows you to create your own Module using HTML in a WYSIWYG Editor -MOD_CUSTOM=mod_custom -CUSTOM HTML=Custom HTML - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCMODCUSTOM=This Module allows you to create your own HTML Module using a WYSIWYG editor. +MOD_CUSTOM=mod_custom +CUSTOM HTML=Custom HTML + diff --git a/language/en-GB/en-GB.mod_feed.ini b/language/en-GB/en-GB.mod_feed.ini index c9105334b58bf..a4227d0f93bf1 100644 --- a/language/en-GB/en-GB.mod_feed.ini +++ b/language/en-GB/en-GB.mod_feed.ini @@ -1,29 +1,27 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DISPLAY FEED IN RTL DIRECTION=Display Feed in RTL direction -DISPLAY NEWS FEED TITLE=Display News Feed Title -ENTER NUMBER OF RSS ITEMS TO DISPLAY=Enter number of RSS Items to display -ENTER THE URL OF THE RSS/RDF FEED=Enter the URL of the RSS/RDF Feed -FEED DESCRIPTION=Feed Description -FEED IMAGE=Feed Image -FEED DISPLAY=Feed Display -FEED TITLE=Feed Title -ITEM DESCRIPTION=Item Description -ITEMS=Items -MOD_FEED=mod_Feed -NO FEED URL SPECIFIED.=No Feed URL specified. -PARAMITEMDESC=Show the Description or Intro text of individual RSS Items -PARAMWORDCOUNT=Allows you to limit the amount of visible Item description text. 0 will show all the text -PLEASE MAKE CACHE DIRECTORY WRITABLE.=Please make the Cache directory writable. -RSS=RSS -RTL FEED=RTL Feed -FEED URL=Feed URL -SHOW THE DESCRIPTION TEXT FOR THE WHOLE FEED=Show the description text for the whole Feed -SHOW THE IMAGE ASSOCIATED WITH THE WHOLE FEED=Show the image associated with the whole Feed -THIS MODULE ALLOWS THE DISPLAYING OF A SYNDICATED FEED=This Module allows the displaying of a Syndicated Feed -WORD COUNT=Word Count - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DISPLAY NEWS FEED TITLE=Display news feed title +ENTER NUMBER OF RSS ITEMS TO DISPLAY=Enter number of RSS Items to display +ENTER THE URL OF THE RSS/RDF FEED=Enter the URL of the RSS/RDF Feed +FEED DESCRIPTION=Feed Description +FEED IMAGE=Feed Image +FEED DISPLAY=Feed Display +FEED TITLE=Feed Title +ITEM DESCRIPTION=Item Description +ITEMS=Items +MOD_FEED=mod_Feed +NO FEED URL SPECIFIED.=No Feed URL specified. +PARAMITEMDESC=Show the Description or Intro text of individual RSS Items +PARAMWORDCOUNT=Allows you to limit the amount of visible Item description text. 0 will show all the text +PLEASE MAKE CACHE DIRECTORY WRITABLE.=Please make the Cache directory writable. +RSS=RSS +FEED URL=Feed URL +SHOW THE DESCRIPTION TEXT FOR THE WHOLE FEED=Show the description text for the whole feed. +SHOW THE IMAGE ASSOCIATED WITH THE WHOLE FEED=Show the image associated with the whole feed. +THIS MODULE ALLOWS THE DISPLAYING OF A SYNDICATED FEED=This Module allows the displaying of a syndicated feed. +WORD COUNT=Word Count + diff --git a/language/en-GB/en-GB.mod_footer.ini b/language/en-GB/en-GB.mod_footer.ini index 75a78478ec0ff..076c692f624a0 100644 --- a/language/en-GB/en-GB.mod_footer.ini +++ b/language/en-GB/en-GB.mod_footer.ini @@ -1,13 +1,13 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM -# Note : %date% will be auto replaced by current year !Don't translate - -FOOTER=Footer -FOOTER_LINE1=Copyright © %date% %sitename%. All Rights Reserved. -FOOTER_LINE2=Joomla! is Free Software released under the GNU/GPL License. -MOD_FOOTER=mod_footer -THIS MODULE SHOWS THE JOOMLA! COPYRIGHT INFORMATION=This Module shows the Joomla! Copyright information - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM +# Note : %date% will be auto replaced by current year !Don't translate + +FOOTER=Footer +FOOTER_LINE1=Copyright © %date% %sitename%. All Rights Reserved. +FOOTER_LINE2=Joomla! is Free Software released under the GNU/GPL License. +MOD_FOOTER=mod_footer +THIS MODULE SHOWS THE JOOMLA! COPYRIGHT INFORMATION=This module shows the Joomla! copyright information. + diff --git a/language/en-GB/en-GB.mod_latestnews.ini b/language/en-GB/en-GB.mod_latestnews.ini index 550f3e461e8c5..6562cef61f0a1 100644 --- a/language/en-GB/en-GB.mod_latestnews.ini +++ b/language/en-GB/en-GB.mod_latestnews.ini @@ -1,28 +1,28 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -BOTH=Both -CATEGORY ID=Category ID -COUNT=Count -DESCLATESTNEWS=This Module shows a list of the most recently published Articles that are still current. Some that are shown may have expired even though they are the most recent. -FRONTPAGE ITEMS=Front Page Articles -LATEST NEWS=Latest News -MOD_LATESTNEWS=mod_latestnews -MODULE MODE=Module Mode -PARAMCATEGORYID=Selects Articles from a specific Category or set of Categories. Enter the CategoryID taken from the Category Manager. To specify more than one Category, separate each ID with a comma , . -PARAMENABLECACHE=Select whether to Cache the content of this Module -PARAMFRONTPAGEITEMS=Show/Hide Articles designated for the Front Page -PARAMSECTIONID=Selects Articles from a specific Section or set of Sections. Enter the Section ID taken from the Section Manager. To specify more than one Section, separate with a comma , . -SECTION ID=Section ID -THE NUMBER OF ITEMS TO DISPLAY (DEFAULT 5)=The number of Articles to display (default 5) -RECENTLY ADDED FIRST=Recently Added First -RECENTLY MODIFIED FIRST=Recently Modified First -AUTHORS=Authors -ANYONE=Anyone -ORDERING OPTIONS=Ordering Options -ADDED OR MODIFIED BY ME=Added or modified by me -NOT ADDED OR MODIFIED BY ME=Not added or modified by me -A FILTER FOR THE AUTHORS=A Filter for the Authors +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +BOTH=Both +CATEGORY ID=Category ID +COUNT=Count +DESCLATESTNEWS=This Module shows a list of the most recently published anc current Articles. Some that are shown may have expired even though they are the most recent. +FRONTPAGE ITEMS=Front Page Articles +LATEST NEWS=Latest News +MOD_LATESTNEWS=mod_latestnews +MODULE MODE=Module Mode +PARAMCATEGORYID=Selects Articles from a specific Category or set of Categories. Enter the Category ID from the Category Manager. To specify more than one Category, separate each ID with a comma. +PARAMENABLECACHE=Select whether to Cache the content of this Module +PARAMFRONTPAGEITEMS=Show/Hide Articles designated for the Front Page +PARAMSECTIONID=Selects Articles from a specific Section or set of Sections. Enter the Section ID taken from the Section Manager. To specify more than one Section, separate each ID with a comma. +SECTION ID=Section ID +THE NUMBER OF ITEMS TO DISPLAY (DEFAULT 5)=The number of Articles to display (the default is 5) +RECENTLY ADDED FIRST=Recently Added First +RECENTLY MODIFIED FIRST=Recently Modified First +AUTHORS=Authors +ANYONE=Anyone +ORDERING OPTIONS=Ordering Options +ADDED OR MODIFIED BY ME=Added or modified by me +NOT ADDED OR MODIFIED BY ME=Not added or modified by me +A FILTER FOR THE AUTHORS=Filter by author diff --git a/language/en-GB/en-GB.mod_login.ini b/language/en-GB/en-GB.mod_login.ini index 2fa075dd6cfcc..f3d1bf4e1bb86 100644 --- a/language/en-GB/en-GB.mod_login.ini +++ b/language/en-GB/en-GB.mod_login.ini @@ -4,9 +4,9 @@ # License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php # Note : All ini files need to be saved as UTF-8 - No BOM -BUTTON_LOGIN=Login -BUTTON_LOGOUT=Logout -DESCLOGINFORM=This Module displays a username and password Login form. It also displays a link to retrieve a forgotten password. If User registration is enabled, (refer to the Global Configuration settings), then another link will be shown to invite Users to self-register. +BUTTON_LOGIN=Log in +BUTTON_LOGOUT=Log out +DESCLOGINFORM=This Module displays a username and password login form. It also displays a link to retrieve a forgotten password. If user registration is enabled (in the Global Configuration settings), another link will be shown to enable self-registration for users. ENCRYPT LOGIN FORM=Encrypt Login Form FORGOT_YOUR_PASSWORD=Forgot your password? FORGOT_YOUR_USERNAME=Forgot your username? @@ -19,10 +19,10 @@ LOGOUT REDIRECTION URL=Logout Redirection Page MOD_LOGIN=mod_login NAME/USERNAME=Name/Username NO ACCOUNT YET?=No Account Yet? -PARAMPOSTTEXT=This is the text or HTML that is displayed below the Login form -PARAMPRETEXT=This is the text or HTML that is displayed above the Login form -PARAMLOGINREDIRECTURL=Select the page the User will be redirected to after a successful Login. Select from all the pages listed in the drop down list. If no selection is made the Front Page will be loaded by default. -PARAMLOGOUTREDIRECTURL=Select the page the User will be redirected to after successfully ending their current session by Logging Out. Select from all the pages listed in the drop down list. If no selection is made the Front Page will be loaded by default. +PARAMPOSTTEXT=This is the text or HTML that is displayed below the login form. +PARAMPRETEXT=This is the text or HTML that is displayed above the login form. +PARAMLOGINREDIRECTURL=Select the page the user will be redirected to after a successful login. Select from all the pages listed in the dropdown menu. If no selection is made, the Front Page will be loaded by default. +PARAMLOGOUTREDIRECTURL=Select the page the user will be redirected to after successfully ending their current session by logging out. Select from all the pages listed in the dropdown menu. If no selection is made, the Front Page will be loaded by default. PARAMLOGINMESSAGE=Show/Hide the JavaScript Pop-up indicating Login Success PARAMLOGOUTMESSAGE=Show/Hide the JavaScript Pop-up indicating Logout Success PASSWORD=Password @@ -31,4 +31,4 @@ PRE-TEXT=Pre-text REGISTER=Create an account REMEMBER ME=Remember Me SHOW/HIDE THE SIMPLE GREETING TEXT=Show/Hide the simple greeting text -SUBMIT ENCRYPTED LOGIN DATA (REQUIRES SSL)=Submit encrypted login data (requires SSL). Do not enable this option if Joomla is not accessible using the https:// protocol prefix. \ No newline at end of file +SUBMIT ENCRYPTED LOGIN DATA (REQUIRES SSL)=Submit encrypted login data (requires SSL). Do not enable this option if Joomla is not accessible using the https:// protocol prefix. diff --git a/language/en-GB/en-GB.mod_mainmenu.ini b/language/en-GB/en-GB.mod_mainmenu.ini index 4db0bbde21b66..9328f8e47d4e4 100644 --- a/language/en-GB/en-GB.mod_mainmenu.ini +++ b/language/en-GB/en-GB.mod_mainmenu.ini @@ -1,70 +1,70 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ACTIVATE PARENT=Activate Parent +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ACTIVATE PARENT=Activate Parent ALIGNMENT OF THE MENU ICONS=Alignment of the Menu Images -ALWAYS SHOW SUBMENU ITEMS=Always show sub-menu Items -CHOOSE WHICH INDENT IMAGE SYSTEM TO UTILISE=Choose which indent image system to utilise -DISPLAYS A MENU.=Displays a Menu. -END LEVEL=End Level -END SPACER=End Spacer -END SPACER FOR HORIZONTAL MENU=End spacer for horizontal Menu -EXPAND MENU=Expand Menu -FLAT LIST=Flat List -FULL ACTIVE HIGHLIGHTING=Full Active Highlighting -HORIZONTAL=Horizontal -IMAGE FOR THE FIRST SUB-LEVEL=Image for the first sub-level -IMAGE FOR THE SECOND SUB-LEVEL=Image for the second sub-level -IMAGE FOR THE THIRD SUB-LEVEL=Image for the third sub-level -IMAGE FOR THE FOURTH SUB-LEVEL=Image for the fourth sub-level -IMAGE FOR THE FIFTH SUB-LEVEL=Image for the fifth sub-level -IMAGE FOR THE SIXTH SUB-LEVEL=Image for the sixth sub-level -INDENT IMAGE=Indent Image -INDENT IMAGE 1=Indent Image 1 -INDENT IMAGE 2=Indent Image 2 -INDENT IMAGE 3=Indent Image 3 -INDENT IMAGE 4=Indent Image 4 -INDENT IMAGE 5=Indent Image 5 -INDENT IMAGE 6=Indent Image 6 -JOOMLA! DEFAULT IMAGES=Joomla! default images -LEGACY - FLAT LIST=Legacy - Flat List -LEGACY - HORIZONTAL=Legacy - Horizontal -LEGACY - VERTICAL=Legacy - Vertical -LIST=List -MENU=Menu -MENU CLASS SUFFIX=Menu Class Suffix +ALWAYS SHOW SUBMENU ITEMS=Always show sub-menu Items +CHOOSE WHICH INDENT IMAGE SYSTEM TO UTILISE=Choose which indent image system to utilise +DISPLAYS A MENU.=Displays a Menu. +END LEVEL=End Level +END SPACER=End Spacer +END SPACER FOR HORIZONTAL MENU=End spacer for horizontal Menu +EXPAND MENU=Expand Menu +FLAT LIST=Flat List +FULL ACTIVE HIGHLIGHTING=Full Active Highlighting +HORIZONTAL=Horizontal +IMAGE FOR THE FIRST SUB-LEVEL=Image for the first sub-level +IMAGE FOR THE SECOND SUB-LEVEL=Image for the second sub-level +IMAGE FOR THE THIRD SUB-LEVEL=Image for the third sub-level +IMAGE FOR THE FOURTH SUB-LEVEL=Image for the fourth sub-level +IMAGE FOR THE FIFTH SUB-LEVEL=Image for the fifth sub-level +IMAGE FOR THE SIXTH SUB-LEVEL=Image for the sixth sub-level +INDENT IMAGE=Indent Image +INDENT IMAGE 1=Indent Image 1 +INDENT IMAGE 2=Indent Image 2 +INDENT IMAGE 3=Indent Image 3 +INDENT IMAGE 4=Indent Image 4 +INDENT IMAGE 5=Indent Image 5 +INDENT IMAGE 6=Indent Image 6 +JOOMLA! DEFAULT IMAGES=Joomla! default images +LEGACY - FLAT LIST=Legacy - Flat List +LEGACY - HORIZONTAL=Legacy - Horizontal +LEGACY - VERTICAL=Legacy - Vertical +LIST=List +MENU=Menu +MENU CLASS SUFFIX=Menu Class Suffix MENU ICON ALIGNMENT=Menu Image Alignment MENU ICON LINK=Menu Image Link -MENU MODULE=Menu Module -MENU NAME=Menu Name -MENU STYLE=Menu Style -MOD_MAINMENU=mod_mainmenu -PARAMACTIVATEPARENT=Sets the activation ID also for all parent Menus in the tree -PARAMEXPANDMENU=Expand the Menu and make its sub-menu Items always visible -PARAMFULLACTIVEHIGHLIGHTING=Enable Full Active Menu Item Highlighting, including for Link - Article and Link - URL, which can cause loss of XHTML compliance, if more than one Item is active. -PARAMMENUCLASSSUFFIX=A suffix to be applied to the CSS class of the Menu Items -PARAMMENUICONLINK=Link on Images instead of text. Image must be selected in the Menu Items -PARAMMENUTAGID=An id attribute to assign to the root ul tag of the menu (optional) +MENU MODULE=Menu Module +MENU NAME=Menu Name +MENU STYLE=Menu Style +MOD_MAINMENU=mod_mainmenu +PARAMACTIVATEPARENT=Sets the activation ID also for all parent Menus in the tree +PARAMEXPANDMENU=Expand the Menu and make its sub-menu Items always visible +PARAMFULLACTIVEHIGHLIGHTING=Enable Full Active Menu Item Highlighting, including Link-Article and Link-URL. This can cause loss of XHTML compliance if more than one item is active. +PARAMMENUCLASSSUFFIX=A suffix to be applied to the CSS class of the Menu Items +PARAMMENUICONLINK=Link on images instead of text. Image must be selected in the Menu Items. +PARAMMENUTAGID=An id attribute to assign to the root ul tag of the menu (optional) PARAMSHOWMENUICONS=Show the Menu Images you have selected for your Menu Items -PARAMSHOWSUBMENUITEMS=Display all sub-menu Items regardless of whether parent is active or not. -PARAMSTARTLEVEL=Level to start rendering the Menu at. -PARAMSTOPLEVEL=Level to stop rendering the Menu at. -PARAMTARGETPOSITION=JavaScript values to position a Popup window, eg, top=50,left=50,width=200,height=300 -PARAMMENUMAXDEPTH=This is the maximum number of depths before menu items are ignored due to absent parents. Increase this if you find deep child menu items not appearing in your menu. -MAXIMUM MENU DEPTH=Maximum Menu Depth -SELECT MENU=Select Menu -SHOW MENU ICONS=Show Menu Imagess -SHOW WHITESPACE=Show Whitespace -SHOW WHITESPACE DESC=Select whether to show whitespace in rendered XHTML -SPACER=Spacer -SPACER FOR HORIZONTAL MENU=Spacer for horizontal Menu -START LEVEL=Start Level -TARGET POSITION=Target Position -THE MENU STYLE=The Menu style -THE NAME OF THE MENU (DEFAULT IS MAINMENU)=The name of the Menu. The default is mainmenu. -USE PARAMS BELOW=Use Parameters below -VERTICAL=Vertical - +PARAMSHOWSUBMENUITEMS=Display all sub-menu items regardless of whether or not parent is active. +PARAMSTARTLEVEL=Level to start rendering the Menu at. +PARAMSTOPLEVEL=Level to stop rendering the Menu at. +PARAMTARGETPOSITION=JavaScript values to position a Popup window, eg, top=50,left=50,width=200,height=300 +PARAMMENUMAXDEPTH=This is the maximum number of depths before menu items are ignored due to absent parents. Increase this if you find deep child menu items not appearing in your menu. +MAXIMUM MENU DEPTH=Maximum Menu Depth +SELECT MENU=Select Menu +SHOW MENU ICONS=Show Menu Images +SHOW WHITESPACE=Show Whitespace +SHOW WHITESPACE DESC=Select whether to show whitespace in rendered XHTML +SPACER=Spacer +SPACER FOR HORIZONTAL MENU=Spacer for horizontal Menu +START LEVEL=Start Level +TARGET POSITION=Target Position +THE MENU STYLE=The Menu style +THE NAME OF THE MENU (DEFAULT IS MAINMENU)=The name of the Menu. The default is mainmenu. +USE PARAMS BELOW=Use Parameters below +VERTICAL=Vertical + diff --git a/language/en-GB/en-GB.mod_mostread.ini b/language/en-GB/en-GB.mod_mostread.ini index 4f86856443271..b57c2cba428ad 100644 --- a/language/en-GB/en-GB.mod_mostread.ini +++ b/language/en-GB/en-GB.mod_mostread.ini @@ -1,20 +1,20 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -BOTH=Both -CATEGORY ID=Category ID -COUNT=Count -DESCMOSTREAD=This Module shows a list of the currently published Articles that have been viewed the most - determined by the number of times the page has been viewed. -FRONTPAGE ITEMS=Front Page Articles -MOD_MOSTREAD=mod_mostread -MODULE MODE=Module Mode -MOST READ CONTENT=Most Read Content -PARAMCATEGORYID=Selects Articles from a specific Category or set of Categories. Enter the CategoryID taken from the Category Manager. To specify more than one Category, separate each ID with a comma , . -PARAMFRONTPAGEITEMS=Show/Hide Articles designated for the Front Page - only works when in Article only mode -PARAMSECTIONID=Selects Articles from a specific Section or set of Sections. Enter the Section ID taken from the Section Manager. To specify more than one Section, separate with a comma , . -SECTION ID=Section ID -THE NUMBER OF ITEMS TO DISPLAY (DEFAULT IS 5)=The number of Articles to display (default is 5) - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +BOTH=Both +CATEGORY ID=Category ID +COUNT=Count +DESCMOSTREAD=This Module shows a list of the currently published Articles which have the highest number of page views. +FRONTPAGE ITEMS=Front Page Articles +MOD_MOSTREAD=mod_mostread +MODULE MODE=Module Mode +MOST READ CONTENT=Most Read Content +PARAMCATEGORYID=Selects Articles from a specific Category or set of Categories. Enter the Category ID from the Category Manager. To specify more than one Category, separate each ID with a comma. +PARAMFRONTPAGEITEMS=Show/Hide Articles designated for the Front Page. This only works when in Article-only mode. +PARAMSECTIONID=Selects Articles from a specific Section or set of Sections. Enter the Section ID taken from the Section Manager. To specify more than one Section, separate each ID with a comma. +SECTION ID=Section ID +THE NUMBER OF ITEMS TO DISPLAY (DEFAULT IS 5)=The number of Articles to display (the default is 5) + diff --git a/language/en-GB/en-GB.mod_newsflash.ini b/language/en-GB/en-GB.mod_newsflash.ini index f189e4678031b..e57716b9eccb6 100644 --- a/language/en-GB/en-GB.mod_newsflash.ini +++ b/language/en-GB/en-GB.mod_newsflash.ini @@ -1,32 +1,33 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -A CONTENT CATEGORY=An Article Category -ARTICLE TITLE=Article Title -CATEGORY=Category -DESCNEWSFLASH=The Newsflash Module randomly selects one of the published Articles from a Category upon each page refresh. It may also display multiple Articles in a horizontal or vertical configuration. -DISPLAY ARTICLE IMAGES=Display Article images -HORIZONTAL=Horizontal -ITEM TITLE=Article Title -LAYOUT=Layout -LINKED TITLES=Title Linkable -MAKE THE ITEM TITLES LINKABLE=Make the Article titles linkable to open the actual Article -MOD_NEWSFLASH=mod_newsflash/ -NEWSFLASH=Newsflash -NO OF ITEMS TO DISPLAY=The number of Articles to display within this Module -NO. OF ITEMS=# of Articles -RANDOMLY CHOOSE ONE AT A TIME=Randomly choose one at a time -READ MORE=Read more...Link +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +A CONTENT CATEGORY=An Article Category +ARTICLE TITLE=Article Title +CATEGORY=Category +DESCNEWSFLASH=The Newsflash Module will either randomly display one article OR display a fixed number of articles in a horizontal or vertical configuration. +DISPLAY ARTICLE IMAGES=Display Article images +HORIZONTAL=Horizontal +ITEM TITLE=Article Title +LAYOUT=Layout +LINKED TITLES=Title Linkable +MAKE THE ITEM TITLES LINKABLE=Make the Article titles linkable to open the actual Article. +MOD_NEWSFLASH=mod_newsflash +NEWSFLASH=Newsflash +NO OF ITEMS TO DISPLAY=The number of Articles to display within this Module +NO. OF ITEMS=# of Articles +RANDOMLY CHOOSE ONE AT A TIME=Randomly choose one at a time +READ MORE=Read more... Link READ MORE TEXT=Read more... -SELECT CONTENT CATEGORY=Select Article Category -SHOW ARTICLE TITLE=Show Article Title -SHOW IMAGES=Show Images -SHOW ITEM TITLE=Show Item Title -SHOW/HIDE THE READ MORE BUTTON=Show/Hide the Read more... +REGISTER TO READ MORE=Register to Read More +SELECT CONTENT CATEGORY=Select Article Category +SHOW ARTICLE TITLE=Show Article Title +SHOW IMAGES=Show Images +SHOW ITEM TITLE=Show Item Title +SHOW/HIDE THE READ MORE BUTTON=Show/Hide the Read more... SHOW LAST SEPARATOR=Show last separator SHOW SEPARATOR AFTER LAST ARTICLE=Show separator after last article -THE LAYOUT TO DISPLAY THE CATEGORY=The layout form in which to display the Category -VERTICAL=Vertical +THE LAYOUT TO DISPLAY THE CATEGORY=The layout form in which to display the Category +VERTICAL=Vertical diff --git a/language/en-GB/en-GB.mod_online.ini b/language/en-GB/en-GB.mod_online.ini index 189f8077f01a4..bd1da59feb3c6 100644 --- a/language/en-GB/en-GB.mod_online.ini +++ b/language/en-GB/en-GB.mod_online.ini @@ -1,7 +1,7 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ONLINE USERS=Online Users +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ONLINE USERS=Online Users diff --git a/language/en-GB/en-GB.mod_poll.ini b/language/en-GB/en-GB.mod_poll.ini index 7e09255d8d8cf..c24b9c72269a4 100644 --- a/language/en-GB/en-GB.mod_poll.ini +++ b/language/en-GB/en-GB.mod_poll.ini @@ -1,13 +1,13 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCPOLL=This Module complements the Polls Component. It is used to display the configured Polls. You can select a specific Poll to display in the Poll Module. -MOD_POLL=mod_poll -POLL=Poll -VOTE=Vote -PARAMMODULEPOLL=The Poll to display -SELECT POLL=Select Poll - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCPOLL=This Module complements the Polls Component. It is used to display the configured Polls. You can select a specific Poll to display in the Poll Module. +MOD_POLL=mod_poll +POLL=Poll +VOTE=Vote +PARAMMODULEPOLL=The Poll to display +SELECT POLL=Select Poll + diff --git a/language/en-GB/en-GB.mod_random_image.ini b/language/en-GB/en-GB.mod_random_image.ini index 2f5b323aabe91..5a785cd3f986c 100644 --- a/language/en-GB/en-GB.mod_random_image.ini +++ b/language/en-GB/en-GB.mod_random_image.ini @@ -1,21 +1,21 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCRANDOMIMAGE=This Module displays a random image from your chosen directory -HEIGHT (PX)=Height (px) -IMAGE FOLDER=Image Folder -IMAGE TYPE=Image Type -LINK=Link -MOD_RANDOM_IMAGE=mod_random_image -NO IMAGES=No Images -PARAMHEIGHTPX=Image Height forces all images to be displayed with the height in pixels. -PARAMIMAGEFOLDER=Path to the image folder relative to the site URL, eg: images/stories -PARAMLINK=A URL to redirect to if the image is clicked upon, for example, http://www.joomla.org -PARAMWIDTHPX=Image Width forces all images to be displayed with this width in pixels. -RANDOM IMAGE=Random Image -TYPE OF IMAGE PNG/GIF/JPG ETC. (DEFAULT IS JPG)=Type of image PNG/GIF/JPG etc. (default is JPG) -WIDTH (PX)=Width (px) - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCRANDOMIMAGE=This Module displays a random image from your chosen directory. +HEIGHT (PX)=Height (px) +IMAGE FOLDER=Image Folder +IMAGE TYPE=Image Type +LINK=Link +MOD_RANDOM_IMAGE=mod_random_image +NO IMAGES=No Images +PARAMHEIGHTPX=Image Height forces all images to be displayed with the height in pixels. +PARAMIMAGEFOLDER=Path to the image folder relative to the site URL (e.g. images/stories). +PARAMLINK=A URL to redirect to if the image is clicked upon (e.g. http://www.joomla.org). +PARAMWIDTHPX=Image Width forces all images to be displayed with this width in pixels. +RANDOM IMAGE=Random Image +TYPE OF IMAGE PNG/GIF/JPG ETC. (DEFAULT IS JPG)=Type of image PNG/GIF/JPG etc. (the default is JPG) +WIDTH (PX)=Width (px) + diff --git a/language/en-GB/en-GB.mod_related_items.ini b/language/en-GB/en-GB.mod_related_items.ini index d18d84ebd3b39..35fa383923410 100644 --- a/language/en-GB/en-GB.mod_related_items.ini +++ b/language/en-GB/en-GB.mod_related_items.ini @@ -1,12 +1,12 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DESCRELATEDITEMS=This Module displays other Articles that are related to the one currently being viewed. These relations are established by the Meta Keywords.
      All the keywords of the current Article are searched against all the keywords of all other published Articles. For example, you may have an Article on "Breeding Parrots" and another on "Hand Raising Black Cockatoos". If you include the keyword "parrot" in both Articles, then the Related Items Module will list the "Breeding Parrots" Article when viewing "Hand Raising Black Cockatoos" and vice-versa. -MOD_RELATED_ITEMS=mod_related_items -RELATED ITEMS=Related Articles -SHOW DATE=Show Date -SHOW/HIDE DATE=Show/Hide Date - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +DESCRELATEDITEMS=This Module displays other Articles that are related to the one currently being viewed. These relations are established by the Meta Keywords.
      All the keywords of the current Article are searched against all the keywords of all other published Articles. For example, you may have an Article on "Breeding Parrots" and another on "Hand Raising Black Cockatoos". If you include the keyword "parrot" in both Articles, then the Related Items Module will list the "Breeding Parrots" Article when viewing "Hand Raising Black Cockatoos" and vice-versa. +MOD_RELATED_ITEMS=mod_related_items +RELATED ITEMS=Related Articles +SHOW DATE=Show Date +SHOW/HIDE DATE=Show/Hide Date + diff --git a/language/en-GB/en-GB.mod_search.ini b/language/en-GB/en-GB.mod_search.ini index c2495ce4e7788..bca5364b16d42 100644 --- a/language/en-GB/en-GB.mod_search.ini +++ b/language/en-GB/en-GB.mod_search.ini @@ -1,25 +1,25 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -BOX WIDTH=Box Width -BUTTON POSITION=Button Position -BUTTON TEXT=Button Text -DISPLAY A SEARCH BUTTON=Display a Search Button -MOD_SEARCH=mod_search -PARAMBUTTONTEXT=The text that appears in the Search button, if left blank it will load the 'search' string from your Language file -PARAMTEXT=The text that appears in the search text box, if left blank it will load 'search box' string from your Language file -POSITION OF THE BUTTON RELATIVE TO THE SEARCH BOX=Position of the button relative to the search box -SEARCH=Search -SEARCH BUTTON=Search button -SEARCH BUTTON AS IMAGE=Search button as image -SEARCH...=search... -SEARCH MODULE=Search Module -SET ITEMID=Set ItemID -SIZE OF THE SEARCH TEXT BOX=Size of the search text box -TEXT=Text -THIS MODULE WILL DISPLAY A SEARCH BOX=This Module will display a search box -USE AN IMAGE AS BUTTON=Use an image as button. This image has to be named searchButton.gif and must be located in /images/M_images/ - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +BOX WIDTH=Box Width +BUTTON POSITION=Button Position +BUTTON TEXT=Button Text +DISPLAY A SEARCH BUTTON=Display a Search Button +MOD_SEARCH=mod_search +PARAMBUTTONTEXT=The text that appears in the search button. If left blank, it will load the 'search' string from your language file. +PARAMTEXT=The text that appears in the search text box. If left blank, it will load 'search box' string from your language file. +POSITION OF THE BUTTON RELATIVE TO THE SEARCH BOX=Position of the button relative to the search box. +SEARCH=Search +SEARCH BUTTON=Search button +SEARCH BUTTON AS IMAGE=Search button as image +SEARCH...=search... +SEARCH MODULE=Search Module +SET ITEMID=Set ItemID +SIZE OF THE SEARCH TEXT BOX=Size of the search text box +TEXT=Text +THIS MODULE WILL DISPLAY A SEARCH BOX=This module will display a search box. +USE AN IMAGE AS BUTTON=Use an image as button. This image has to be named searchButton.gif and must be located in /images/M_images/ + diff --git a/language/en-GB/en-GB.mod_sections.ini b/language/en-GB/en-GB.mod_sections.ini index e49722c823a7c..44eff754ea4a4 100644 --- a/language/en-GB/en-GB.mod_sections.ini +++ b/language/en-GB/en-GB.mod_sections.ini @@ -1,13 +1,13 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -COUNT=Count -DESCSECTIONS=The Section Module shows a list of all Sections configured in your database. The Sections refer here to the Article Sections only. If the parameter Show Unauthorized Links is set to No, the list will be limited to the Sections the User's access level permits them to see. -MOD_SECTIONS=mod_sections -SECTIONS=Sections -SHOW UNAUTHORIZED LINKS=Show Unauthorized Links -THE NUMBER OF ITEMS TO DISPLAY (DEFAULT IS 5)=The number of Sections to display. The default is five. -TIPLINKS=If set to NO, the list will be limited to the Sections the User's access level permits them to see. \ No newline at end of file +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +COUNT=Count +DESCSECTIONS=The Section Module shows a list of all Sections configured in your database. The Sections refer here to the Article Sections only. If the parameter Show Unauthorised Links is set to No, the list will be limited to the Sections the user's access level permits them to see. +MOD_SECTIONS=mod_sections +SECTIONS=Sections +SHOW UNAUTHORIZED LINKS=Show Unauthorised Links +THE NUMBER OF ITEMS TO DISPLAY (DEFAULT IS 5)=The number of Sections to display (the default is five). +TIPLINKS=If set to NO, the list will be limited to the Sections the User's access level permits them to see. diff --git a/language/en-GB/en-GB.mod_stats.ini b/language/en-GB/en-GB.mod_stats.ini index eb959c3fc5097..d996be2fc5c17 100644 --- a/language/en-GB/en-GB.mod_stats.ini +++ b/language/en-GB/en-GB.mod_stats.ini @@ -1,32 +1,32 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -CACHING=Caching -CONTENT=Content -CONTENT VIEW HITS=Content View Hits -DESCSTATISTICS=The Statistics Module shows information about your server installation together with statistics on the web site Users, number of Articles in your database, and the number of Web Links you provide. -DISABLED=Disabled -DISPLAY HIT COUNTER=Display Hit Counter -DISPLAY SERVER INFORMATION=Display Server Information -DISPLAY SITE INFORMATION=Display Site Information -ENABLED=Enabled -ENTER THE AMOUNT OF HITS TO INCREASE COUNTER BY=Enter the amount of Hits to increase the counter by -GZIP=GZIP -HIT COUNTER=Hit Counter -HITS_STAT=Hits -INCREASE COUNTER=Increase Counter -MEMBERS=Members -MOD_STATS=mod_stats -MYSQL=MySQL -NEWS=News -OS=OS -PHP=PHP -SERVER INFO=Server Info -SITE INFO=Site Info -STATISTICS=Statistics -TIME=Time -VISITORS=Visitors -WEBLINKS=Web Links +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +CACHING=Caching +CONTENT=Content +CONTENT VIEW HITS=Content View Hits +DESCSTATISTICS=The Statistics Module shows information about your server installation together with statistics on the Web site users, number of Articles in your database and the number of Web links you provide. +DISABLED=Disabled +DISPLAY HIT COUNTER=Display Hit Counter +DISPLAY SERVER INFORMATION=Display Server Information +DISPLAY SITE INFORMATION=Display Site Information +ENABLED=Enabled +ENTER THE AMOUNT OF HITS TO INCREASE COUNTER BY=Enter the amount of hits to increase the counter by. +GZIP=GZIP +HIT COUNTER=Hit Counter +HITS_STAT=Hits +INCREASE COUNTER=Increase Counter +MEMBERS=Members +MOD_STATS=mod_stats +MYSQL=MySQL +NEWS=News +OS=OS +PHP=PHP +SERVER INFO=Server Info +SITE INFO=Site Info +STATISTICS=Statistics +TIME=Time +VISITORS=Visitors +WEBLINKS=Web Links diff --git a/language/en-GB/en-GB.mod_syndicate.ini b/language/en-GB/en-GB.mod_syndicate.ini index 6fb381c0c6986..a291500381df1 100644 --- a/language/en-GB/en-GB.mod_syndicate.ini +++ b/language/en-GB/en-GB.mod_syndicate.ini @@ -1,15 +1,15 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -ATOM 1.0=Atom 1.0 -FORMAT=Format -MOD_SYNDICATE=mod_syndicate -PARAMFEEDFORMAT=Select the format for the Syndication Feed -PARAMTEXT=Enter the text to be displayed along with the RSS Links -RSS 2.0=RSS 2.0 -SMART SYNDICATION MODULE THAT CREATES SYNDICATED FEED FOR THE PAGE WHERE THE MODULE IS DISPLAYED=Smart Syndication Module that creates a Syndicated Feed for the page where the Module is displayed. -SYNDICATE=Syndicate -TEXT=Text +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ATOM 1.0=Atom 1.0 +FORMAT=Format +MOD_SYNDICATE=mod_syndicate +PARAMFEEDFORMAT=Select the format for the Syndication Feed +PARAMTEXT=Enter the text to be displayed along with the RSS Links +RSS 2.0=RSS 2.0 +SMART SYNDICATION MODULE THAT CREATES SYNDICATED FEED FOR THE PAGE WHERE THE MODULE IS DISPLAYED=Smart Syndication Module that creates a Syndicated Feed for the page where the Module is displayed. +SYNDICATE=Syndicate +TEXT=Text diff --git a/language/en-GB/en-GB.mod_whosonline.ini b/language/en-GB/en-GB.mod_whosonline.ini index 218ead8065ff3..8bca2029200a3 100644 --- a/language/en-GB/en-GB.mod_whosonline.ini +++ b/language/en-GB/en-GB.mod_whosonline.ini @@ -1,25 +1,25 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -AND=and -BOTH=Both -DESCWHOSONLINE=The Who's Online Module displays the number of Anonymous (that is, Guest) Users and Registered Users, (those that are Logged In) that are currently accessing the web site. -DISPLAY=Display -MEMBER NAMES=Member Names -MEMBER ONLINE= %s member online -MEMBERS ONLINE= %s members online -MOD_WHOSONLINE=mod_whosonline -NO USERS ONLINE=No Users Online -NUMBER OF GUESTS/MEMBERS=# of Guests / Members -ONLINE=online -SELECT WHAT SHALL BE SHOWN=Select what shall be shown -GUEST=%s guest -GUESTS=%s guests -MEMBER=%s member -MEMBERS=%s members -WE HAVE= We have -WHO'S ONLINE=Who's Online - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +AND=and +BOTH=Both +DESCWHOSONLINE=The Who's Online Module displays the number of Anonymous Users (e.g. Guest) and Registered Users (ones logged in) that are currently accessing the Web site. +DISPLAY=Display +MEMBER NAMES=Member Names +MEMBER ONLINE= %s member online +MEMBERS ONLINE= %s members online +MOD_WHOSONLINE=mod_whosonline +NO USERS ONLINE=No users online. +NUMBER OF GUESTS/MEMBERS=# of Guests / Members +ONLINE=online +SELECT WHAT SHALL BE SHOWN=Select what shall be shown +GUEST=%s guest +GUESTS=%s guests +MEMBER=%s member +MEMBERS=%s members +WE HAVE= We have +WHO'S ONLINE=Who's Online + diff --git a/language/en-GB/en-GB.mod_wrapper.ini b/language/en-GB/en-GB.mod_wrapper.ini index 59a876231147a..56bcce7a432af 100644 --- a/language/en-GB/en-GB.mod_wrapper.ini +++ b/language/en-GB/en-GB.mod_wrapper.ini @@ -1,26 +1,26 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -AUTO=Auto -AUTO ADD=Auto Add -AUTO HEIGHT=Auto Height -HEIGHT=Height -HEIGHT OF THE IFRAME WINDOW=Height of the IFrame Window -MOD_WRAPPER=mod_wrapper -NAME OF THE IFRAME WHEN USED AS TARGET=Name of the IFrame when used as Target -NO_IFRAMES=No Iframes -PARAMAUTOADD=By default http:// will be added unless it detects http:// or https:// in the URL Link you provide, this allow you to switch this ability off -PARAMAUTOHEIGHT=The height will automatically be set to the size of the external page. This will only work for pages on your own domain. -PARAMWIDTH=Width of the IFrame Window, you can enter an absolute figure in pixels, or a relative figure by adding a % -SCROLL BARS=Scroll Bars -SHOW/HIDE HORIZONTAL AND VERTICAL SCROLL BARS.=Show/Hide Horizontal & Vertical Scroll Bars. -TARGET NAME=Target Name -THIS MODULE SHOWS AN IFRAME WINDOW TO SPECIFIED LOCATION=This Module shows an IFrame window to specified location -URL=URL -URL TO SITE/FILE YOU WISH TO DISPLAY WITHIN THE IFRAME=URL to site/file you wish to display within the Iframe -WRAPPER=Wrapper -WIDTH=Width -WRAPPER MODULE=Wrapper Module +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +AUTO=Auto +AUTO ADD=Auto Add +AUTO HEIGHT=Auto Height +HEIGHT=Height +HEIGHT OF THE IFRAME WINDOW=Height of the IFrame Window +MOD_WRAPPER=mod_wrapper +NAME OF THE IFRAME WHEN USED AS TARGET=Name of the IFrame when used as Target +NO_IFRAMES=No Iframes +PARAMAUTOADD=By default, http:// will be added unless it detects http:// or https:// in the URL you provide. This allows you to switch this ability off. +PARAMAUTOHEIGHT=The height will automatically be set to the size of the external page. This will only work for pages on your own domain. +PARAMWIDTH=Width of the iframe window. You can enter an absolute figure in pixels or a relative figure by adding a %. +SCROLL BARS=Scroll Bars +SHOW/HIDE HORIZONTAL AND VERTICAL SCROLL BARS.=Show/Hide Horizontal & Vertical Scroll Bars. +TARGET NAME=Target Name +THIS MODULE SHOWS AN IFRAME WINDOW TO SPECIFIED LOCATION=This Module shows an iframe window to specified location. +URL=URL +URL TO SITE/FILE YOU WISH TO DISPLAY WITHIN THE IFRAME=URL to site/file you wish to display within the iframe. +WRAPPER=Wrapper +WIDTH=Width +WRAPPER MODULE=Wrapper Module diff --git a/language/en-GB/en-GB.plg_system_debug.ini b/language/en-GB/en-GB.plg_system_debug.ini index 8940808330a99..a501fdbc25e00 100644 --- a/language/en-GB/en-GB.plg_system_debug.ini +++ b/language/en-GB/en-GB.plg_system_debug.ini @@ -1,19 +1,33 @@ -# $Id: en-GB.plg_system_debug.ini 8057 2007-07-18 15:05:56Z humvee $ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -DISPLAY SQL QUERY LOG=Display SQL query log -DISPLAY MEMORY USAGE=Display memory usage -DISPLAY UNDEFINED LANGUAGE STRINGS=Display undefined language strings -IF YES, DISPLAY SQL QUERY LOG=If Yes, display SQL query log -IF YES, DISPLAY MEMORY USAGE=If Yes, display memory usage -IF YES, DISPLAY UNDEFINED LANGUAGE STRINGS=If Yes, display undefined language strings -LANGUAGE FILES LOADED=Language Files Loaded -MEMORY USAGE=Memory Usage -PROFILE INFORMATION=Profile Information -PROVIDES DEBUG INFORMATION=Provides debug information -QUERIES LOGGED=%s queries logged -LEGACY QUERIES LOGGED=%s legacy queries logged -UNTRANSLATED STRINGS=Untranslated strings +# $Id: en-GB.plg_system_debug.ini 8057 2007-07-18 15:05:56Z humvee $ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +ALL MODES=All modes +DESIGNER MODE=Designer mode +DIAGNOSTIC MODE=Diagnostic mode +DISPLAY LOADED LANGUAGE FILES=Display loaded language files +DISPLAYS ORPHANED STRINGS IN DIFFERENT WAYS=Displays orphaned strings in different ways +IF YES, DISPLAY A LIST OF THE LANGUAGE FILES LOADED=If yes, display a list of the language files loaded +STRING FORMAT=String Format +STRIP STRING PREFIX=Strip Key Prefix +STRIP STRING PREFIX DESC=Strips this prefix from the actual string prior to displaying designer results +DISPLAY PROFILING INFORMATION=Display Profiling Information +IF YES, DISPLAY PROFILING INFORMATION=If yes, display profiling information + +DISPLAY SQL QUERY LOG=Display SQL query log +DISPLAY MEMORY USAGE=Display memory usage +DISPLAY UNDEFINED LANGUAGE STRINGS=Display undefined language strings +IF YES, DISPLAY SQL QUERY LOG=If Yes, display SQL query log +IF YES, DISPLAY MEMORY USAGE=If Yes, display memory usage +IF YES, DISPLAY UNDEFINED LANGUAGE STRINGS=If Yes, display undefined language strings +LANGUAGE FILES LOADED=Language Files Loaded +MEMORY USAGE=Memory Usage +PROFILE INFORMATION=Profile Information +PROVIDES DEBUG INFORMATION=Provides debug information +QUERIES LOGGED=%s queries logged +LEGACY QUERIES LOGGED=%s legacy queries logged +UNTRANSLATED STRINGS=Untranslated strings +UNTRANSLATED STRINGS DESIGNER=Untranslated Strings Designer +UNTRANSLATED STRINGS DIAGNOSTIC=Untranslated Strings Diagnostic diff --git a/language/en-GB/en-GB.tpl_rhuk_milkyway.ini b/language/en-GB/en-GB.tpl_rhuk_milkyway.ini index 3f6f0d646b79d..d8d0e7f7b6a9a 100644 --- a/language/en-GB/en-GB.tpl_rhuk_milkyway.ini +++ b/language/en-GB/en-GB.tpl_rhuk_milkyway.ini @@ -1,9 +1,9 @@ -# $Id$ -# Joomla! Project -# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. -# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php -# Note : All ini files need to be saved as UTF-8 - No BOM - -AND=and -VALID=valid - +# $Id$ +# Joomla! Project +# Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. +# License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php +# Note : All ini files need to be saved as UTF-8 - No BOM + +AND=and +VALID=valid + diff --git a/language/en-GB/index.html b/language/en-GB/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/language/en-GB/index.html +++ b/language/en-GB/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/language/index.html b/language/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/language/index.html +++ b/language/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/language/pdf_fonts/index.html b/language/pdf_fonts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/language/pdf_fonts/index.html +++ b/language/pdf_fonts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/bitfolge/feedcreator.php b/libraries/bitfolge/feedcreator.php deleted file mode 100644 index ebfdacabe3ebf..0000000000000 --- a/libraries/bitfolge/feedcreator.php +++ /dev/null @@ -1,1883 +0,0 @@ -useCached(); // use cached version if age<1 hour -$rss->title = "PHP news"; -$rss->description = "daily news from the PHP scripting world"; - -//optional -$rss->descriptionTruncSize = 500; -$rss->descriptionHtmlSyndicated = true; - -$rss->link = "http://www.dailyphp.net/news"; -$rss->syndicationURL = "http://www.dailyphp.net/".$_SERVER["PHP_SELF"]; - -$image = new FeedImage(); -$image->title = "dailyphp.net logo"; -$image->url = "http://www.dailyphp.net/images/logo.gif"; -$image->link = "http://www.dailyphp.net"; -$image->description = "Feed provided by dailyphp.net. Click to visit."; - -//optional -$image->descriptionTruncSize = 500; -$image->descriptionHtmlSyndicated = true; - -$rss->image = $image; - -// get your news items from somewhere, e.g. your database: -mysql_select_db($dbHost, $dbUser, $dbPass); -$res = mysql_query('SELECT * FROM news ORDER BY newsdate DESC'); -while ($data = mysql_fetch_object($res)) { - $item = new FeedItem(); - $item->title = $data->title; - $item->link = $data->url; - $item->description = $data->short; - - //optional - item->descriptionTruncSize = 500; - item->descriptionHtmlSyndicated = true; - - //optional (enclosure) - $item->enclosure = new EnclosureItem(); - $item->enclosure->url='http://http://www.dailyphp.net/media/voice.mp3'; - $item->enclosure->length="950230"; - $item->enclosure->type='audio/x-mpeg' - - - - $item->date = $data->newsdate; - $item->source = "http://www.dailyphp.net"; - $item->author = "John Doe"; - - $rss->addItem($item); -} - -// valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated), -// MBOX, OPML, ATOM, ATOM10, ATOM0.3, HTML, JS -echo $rss->saveFeed("RSS1.0", "news/feed.xml"); - -//to generate "on-the-fly" -$rss->outputFeed("RSS1.0"); - - -*************************************************************************** -* A little setup * -**************************************************************************/ - -// your local timezone, set to "" to disable or for GMT -define("TIME_ZONE","+01:00"); - -/** - * Version string. - **/ -define("FEEDCREATOR_VERSION", "FeedCreator 1.7.3"); - - - -/** - * A FeedItem is a part of a FeedCreator feed. - * - * @author Kai Blankenhorn - * @since 1.3 - */ -class FeedItem extends HtmlDescribable { - /** - * Mandatory attributes of an item. - */ - var $title, $description, $link; - - /** - * Optional attributes of an item. - */ - var $author, $authorEmail, $image, $category, $comments, $guid, $source, $creator; - - /** - * Publishing date of an item. May be in one of the following formats: - * - * RFC 822: - * "Mon, 20 Jan 03 18:05:41 +0400" - * "20 Jan 03 18:05:41 +0000" - * - * ISO 8601: - * "2003-01-20T18:05:41+04:00" - * - * Unix: - * 1043082341 - */ - var $date; - - /** - * Add element tag RSS 2.0 - * modified by : Mohammad Hafiz bin Ismail (mypapit@gmail.com) - * - * - * display : - * - * - */ - var $enclosure; - - /** - * Any additional elements to include as an assiciated array. All $key => $value pairs - * will be included unencoded in the feed item in the form - * <$key>$value - * Again: No encoding will be used! This means you can invalidate or enhance the feed - * if $value contains markup. This may be abused to embed tags not implemented by - * the FeedCreator class used. - */ - var $additionalElements = Array(); - - - /** - * Any additional markup to include as a string. This can be used in places where - * $additionalElements isn't sufficient (for example, if you need to add elements with - * attributes, eg: ). - * @since 1.7.3 - */ - var $additionalMarkup = ""; - - - // Added by Joseph LeBlanc, contact@jlleblanc.com - - var $enclosures = Array(); - - function addEnclosure($url, $length = 0, $type) { - $this->enclosures[] = array("url" => $url, "length" => $length, "type" => $type); - } - - // end add, Joseph LeBlanc - - // on hold - // var $source; -} - -class EnclosureItem extends HtmlDescribable { - /* - * - * core variables - * - **/ - var $url,$length,$type; - - /* - * For use with another extension like Yahoo mRSS - * Warning : - * These variables might not show up in - * later release / not finalize yet! - * - */ - var $width, $height, $title, $description, $keywords, $thumburl; - - var $additionalElements = Array(); - -} - - -/** - * An FeedImage may be added to a FeedCreator feed. - * @author Kai Blankenhorn - * @since 1.3 - */ -class FeedImage extends HtmlDescribable { - /** - * Mandatory attributes of an image. - */ - var $title, $url, $link; - - /** - * Optional attributes of an image. - */ - var $width, $height, $description; -} - - - -/** - * An HtmlDescribable is an item within a feed that can have a description that may - * include HTML markup. - */ -class HtmlDescribable { - /** - * Indicates whether the description field should be rendered in HTML. - */ - var $descriptionHtmlSyndicated; - - /** - * Indicates whether and to how many characters a description should be truncated. - */ - var $descriptionTruncSize; - - /** - * Returns a formatted description field, depending on descriptionHtmlSyndicated and - * $descriptionTruncSize properties - * @return string the formatted description - */ - function getDescription() { - $descriptionField = new FeedHtmlField($this->description); - $descriptionField->syndicateHtml = $this->descriptionHtmlSyndicated; - $descriptionField->truncSize = $this->descriptionTruncSize; - return $descriptionField->output(); - } - -} - - -/** - * An FeedHtmlField describes and generates - * a feed, item or image html field (probably a description). Output is - * generated based on $truncSize, $syndicateHtml properties. - * @author Pascal Van Hecke - * @version 1.6 - */ -class FeedHtmlField { - /** - * Mandatory attributes of a FeedHtmlField. - */ - var $rawFieldContent; - - /** - * Optional attributes of a FeedHtmlField. - * - */ - var $truncSize, $syndicateHtml; - - /** - * Creates a new instance of FeedHtmlField. - * @param $string: if given, sets the rawFieldContent property - */ - function FeedHtmlField($parFieldContent) { - if ($parFieldContent) { - $this->rawFieldContent = $parFieldContent; - } - } - - - /** - * Creates the right output, depending on $truncSize, $syndicateHtml properties. - * @return string the formatted field - */ - function output() { - // when field available and syndicated in html we assume - // - valid html in $rawFieldContent and we enclose in CDATA tags - // - no truncation (truncating risks producing invalid html) - if (!$this->rawFieldContent) { - $result = ""; - } elseif ($this->syndicateHtml) { - $result = "rawFieldContent."]]>"; - } else { - if ($this->truncSize and is_int($this->truncSize)) { - $result = FeedCreator::iTrunc(htmlspecialchars($this->rawFieldContent),$this->truncSize); - } else { - $result = htmlspecialchars($this->rawFieldContent); - } - } - return $result; - } - -} - - - -/** - * UniversalFeedCreator lets you choose during runtime which - * format to build. - * For general usage of a feed class, see the FeedCreator class - * below or the example above. - * - * @since 1.3 - * @author Kai Blankenhorn - */ -class UniversalFeedCreator extends FeedCreator { - var $_feed; - - function _setMIME($format) { - switch (strtoupper($format)) { - - case "2.0": - // fall through - case "RSS2.0": - header('Content-type: text/xml', true); - break; - - case "1.0": - // fall through - case "RSS1.0": - header('Content-type: text/xml', true); - break; - - case "PIE0.1": - header('Content-type: text/xml', true); - break; - - case "MBOX": - header('Content-type: text/plain', true); - break; - - case "OPML": - header('Content-type: text/xml', true); - break; - - case "ATOM": - // fall through: always the latest ATOM version - case "ATOM1.0": - header('Content-type: application/xml', true); - break; - - case "ATOM0.3": - header('Content-type: application/xml', true); - break; - - - case "HTML": - header('Content-type: text/html', true); - break; - - case "JS": - // fall through - case "JAVASCRIPT": - header('Content-type: text/javascript', true); - break; - - default: - case "0.91": - // fall through - case "RSS0.91": - header('Content-type: text/xml', true); - break; - } - } - - function _setFormat($format) { - switch (strtoupper($format)) { - - case "PODCAST": - $this->_feed = new RSSCreatorPodcast(); - break; - - case "2.0": - // fall through - case "RSS2.0": - $this->_feed = new RSSCreator20(); - break; - - case "1.0": - // fall through - case "RSS1.0": - $this->_feed = new RSSCreator10(); - break; - - case "0.91": - // fall through - case "RSS0.91": - $this->_feed = new RSSCreator091(); - break; - - case "PIE0.1": - $this->_feed = new PIECreator01(); - break; - - case "MBOX": - $this->_feed = new MBOXCreator(); - break; - - case "OPML": - $this->_feed = new OPMLCreator(); - break; - - case "ATOM": - // fall through: always the latest ATOM version - case "ATOM1.0": - $this->_feed = new AtomCreator10(); - break; - - - case "ATOM0.3": - $this->_feed = new AtomCreator03(); - break; - - case "HTML": - $this->_feed = new HTMLCreator(); - break; - - case "JS": - // fall through - case "JAVASCRIPT": - $this->_feed = new JSCreator(); - break; - - default: - $this->_feed = new RSSCreator091(); - break; - } - - $vars = get_object_vars($this); - foreach ($vars as $key => $value) { - // prevent overwriting of properties "contentType", "encoding"; do not copy "_feed" itself - if (!in_array($key, array("_feed", "contentType", "encoding"))) { - $this->_feed->{$key} = $this->{$key}; - } - } - } - - /** - * Creates a syndication feed based on the items previously added. - * - * @see FeedCreator::addItem() - * @param string format format the feed should comply to. Valid values are: - * "PIE0.1", "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3", "HTML", "JS" - * @return string the contents of the feed. - */ - function createFeed($format = "RSS0.91") { - $this->_setFormat($format); - return $this->_feed->createFeed(); - } - - - - /** - * Saves this feed as a file on the local disk. After the file is saved, an HTTP redirect - * header may be sent to redirect the use to the newly created file. - * @since 1.4 - * - * @param string format format the feed should comply to. Valid values are: - * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM", "ATOM0.3", "HTML", "JS" - * @param string filename optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). - * @param boolean displayContents optional send the content of the file or not. If true, the file will be sent in the body of the response. - */ - function saveFeed($format="RSS0.91", $filename="", $displayContents=true) { - $this->_setFormat($format); - $this->_feed->saveFeed($filename, $displayContents); - } - - - /** - * Turns on caching and checks if there is a recent version of this feed in the cache. - * If there is, an HTTP redirect header is sent. - * To effectively use caching, you should create the FeedCreator object and call this method - * before anything else, especially before you do the time consuming task to build the feed - * (web fetching, for example). - * - * @param string format format the feed should comply to. Valid values are: - * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3". - * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). - * @param timeout int optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour) - */ - function useCached($format="RSS0.91", $filename="", $timeout=3600) { - $this->_setFormat($format); - $this->_feed->useCached($filename, $timeout); - } - - - /** - * Outputs feed to the browser - needed for on-the-fly feed generation (like it is done in WordPress, etc.) - * - * @param format string format the feed should comply to. Valid values are: - * "PIE0.1" (deprecated), "mbox", "RSS0.91", "RSS1.0", "RSS2.0", "OPML", "ATOM0.3". - */ - function outputFeed($format='RSS0.91') { - $this->_setFormat($format); - $this->_setMIME($format); - $this->_feed->outputFeed(); - } - - -} - - -/** - * FeedCreator is the abstract base implementation for concrete - * implementations that implement a specific format of syndication. - * - * @abstract - * @author Kai Blankenhorn - * @since 1.4 - */ -class FeedCreator extends HtmlDescribable { - - /** - * Mandatory attributes of a feed. - */ - var $title, $description, $link; - - - /** - * Optional attributes of a feed. - */ - var $syndicationURL, $image, $language, $copyright, $pubDate, $lastBuildDate, $editor, $editorEmail, $webmaster, $category, $docs, $ttl, $rating, $skipHours, $skipDays, $podcast; - - /** - * The url of the external xsl stylesheet used to format the naked rss feed. - * Ignored in the output when empty. - */ - var $xslStyleSheet = ""; - - - /** - * @access private - */ - var $items = Array(); - - - /** - * This feed's MIME content type. - * @since 1.4 - * @access private - */ - var $contentType = "application/xml"; - - - /** - * This feed's character encoding. - * @since 1.6.1 - **/ - var $encoding = "UTF-8"; - - - /** - * Any additional elements to include as an assiciated array. All $key => $value pairs - * will be included unencoded in the feed in the form - * <$key>$value - * Again: No encoding will be used! This means you can invalidate or enhance the feed - * if $value contains markup. This may be abused to embed tags not implemented by - * the FeedCreator class used. - */ - var $additionalElements = Array(); - - - /** - * Any additional markup to include as a string. This can be used in places where - * $additionalElements isn't sufficient (for example, if you need to add elements with - * attributes, eg: ). - * @since 1.7.3 - */ - var $additionalMarkup = ""; - - - /** - * Determines whether or not error messages are displayed by this class. - * @since 1.7.3 - **/ - var $verbose = true; - - - /** - * Specifies the generator of the feed. - * @since 1.7.3 - **/ - var $generator = FEEDCREATOR_VERSION; - - - /** - * Adds an FeedItem to the feed. - * - * @param object FeedItem $item The FeedItem to add to the feed. - * @access public - */ - function addItem($item) { - $this->items[] = $item; - } - - - /** - * Truncates a string to a certain length at the most sensible point. - * First, if there's a '.' character near the end of the string, the string is truncated after this character. - * If there is no '.', the string is truncated after the last ' ' character. - * If the string is truncated, " ..." is appended. - * If the string is already shorter than $length, it is returned unchanged. - * - * @static - * @param string string A string to be truncated. - * @param int length the maximum length the string should be truncated to - * @return string the truncated string - */ - function iTrunc($string, $length) { - if (strlen($string)<=$length) { - return $string; - } - - $pos = strrpos($string,"."); - if ($pos>=$length-4) { - $string = substr($string,0,$length-4); - $pos = strrpos($string,"."); - } - if ($pos>=$length*0.4) { - return substr($string,0,$pos+1)." ..."; - } - - $pos = strrpos($string," "); - if ($pos>=$length-4) { - $string = substr($string,0,$length-4); - $pos = strrpos($string," "); - } - if ($pos>=$length*0.4) { - return substr($string,0,$pos)." ..."; - } - - return substr($string,0,$length-4)." ..."; - - } - - - /** - * Creates a comment indicating the generator of this feed. - * The format of this comment seems to be recognized by - * Syndic8.com. - */ - function _createGeneratorComment() { - return "\n"; - } - - - /** - * Creates a string containing all additional elements specified in - * $additionalElements. - * @param elements array an associative array containing key => value pairs - * @param indentString string a string that will be inserted before every generated line - * @return string the XML tags corresponding to $additionalElements - */ - function _createAdditionalElements($elements, $indentString="") { - $ae = ""; - if (is_array($elements)) { - foreach($elements AS $key => $value) { - $ae.= $indentString."<$key>$value\n"; - } - } - return $ae; - } - - function _createStylesheetReferences() { - $xml = ""; - if ($this->cssStyleSheet) $xml .= "cssStyleSheet."\" type=\"text/css\"?>\n"; - if ($this->xslStyleSheet) $xml .= "xslStyleSheet."\" type=\"text/xsl\"?>\n"; - return $xml; - } - - - /** - * Builds the feed's text. - * @abstract - * @return string the feed's complete text - */ - function createFeed() { - } - - /** - * Generate a filename for the feed cache file. The result will be $_SERVER["PHP_SELF"] with the extension changed to .xml. - * For example: - * - * echo $_SERVER["PHP_SELF"]."\n"; - * echo FeedCreator::_generateFilename(); - * - * would produce: - * - * /rss/latestnews.php - * latestnews.xml - * - * @return string the feed cache filename - * @since 1.4 - * @access private - */ - function _generateFilename() { - $fileInfo = pathinfo($_SERVER["PHP_SELF"]); - return substr($fileInfo["basename"],0,-(strlen($fileInfo["extension"])+1)).".xml"; - } - - - /** - * @since 1.4 - * @access private - */ - function _redirect($filename) { - // attention, heavily-commented-out-area - - // maybe use this in addition to file time checking - //Header("Expires: ".date("r",time()+$this->_timeout)); - - /* no caching at all, doesn't seem to work as good: - Header("Cache-Control: no-cache"); - Header("Pragma: no-cache"); - */ - - // HTTP redirect, some feed readers' simple HTTP implementations don't follow it - //Header("Location: ".$filename); - - Header("Content-Type: ".$this->contentType."; charset=".$this->encoding."; filename=".basename($filename)); - Header("Content-Disposition: inline; filename=".basename($filename)); - readfile($filename, "r"); - die(); - } - - /** - * Turns on caching and checks if there is a recent version of this feed in the cache. - * If there is, an HTTP redirect header is sent. - * To effectively use caching, you should create the FeedCreator object and call this method - * before anything else, especially before you do the time consuming task to build the feed - * (web fetching, for example). - * @since 1.4 - * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). - * @param timeout int optional the timeout in seconds before a cached version is refreshed (defaults to 3600 = 1 hour) - */ - function useCached($filename="", $timeout=3600) { - $this->_timeout = $timeout; - if ($filename=="") { - $filename = $this->_generateFilename(); - } - if (file_exists($filename) AND (time()-filemtime($filename) < $timeout)) { - $this->_redirect($filename); - } - } - - - /** - * Saves this feed as a file on the local disk. After the file is saved, a redirect - * header may be sent to redirect the user to the newly created file. - * @since 1.4 - * - * @param filename string optional the filename where a recent version of the feed is saved. If not specified, the filename is $_SERVER["PHP_SELF"] with the extension changed to .xml (see _generateFilename()). - * @param redirect boolean optional send an HTTP redirect header or not. If true, the user will be automatically redirected to the created file. - */ - function saveFeed($filename="", $displayContents=true) { - if ($filename=="") { - $filename = $this->_generateFilename(); - } - $feedFile = fopen($filename, "w+"); - if ($feedFile) { - fputs($feedFile,$this->createFeed()); - fclose($feedFile); - if ($displayContents) { - $this->_redirect($filename); - } - - return true; - } else { - echo "
      Error creating feed file, please check write permissions.
      "; - } - } - - /** - * Outputs this feed directly to the browser - for on-the-fly feed generation - * @since 1.7.2-mod - * - * still missing: proper header output - currently you have to add it manually - */ - function outputFeed() { - echo $this->createFeed(); - } - - -} - - -/** - * FeedDate is an internal class that stores a date for a feed or feed item. - * Usually, you won't need to use this. - */ -class FeedDate { - var $unix; - - /** - * Creates a new instance of FeedDate representing a given date. - * Accepts RFC 822, ISO 8601 date formats as well as unix time stamps. - * @param mixed $dateString optional the date this FeedDate will represent. If not specified, the current date and time is used. - */ - function FeedDate($dateString="") { - if ($dateString=="") $dateString = date("r"); - - if (is_numeric($dateString)) { - $this->unix = $dateString; - return; - } - if (preg_match("~(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s+)?(\\d{1,2})\\s+([a-zA-Z]{3})\\s+(\\d{4})\\s+(\\d{2}):(\\d{2}):(\\d{2})\\s+(.*)~",$dateString,$matches)) { - $months = Array("Jan"=>1,"Feb"=>2,"Mar"=>3,"Apr"=>4,"May"=>5,"Jun"=>6,"Jul"=>7,"Aug"=>8,"Sep"=>9,"Oct"=>10,"Nov"=>11,"Dec"=>12); - $this->unix = mktime($matches[4],$matches[5],$matches[6],$months[$matches[2]],$matches[1],$matches[3]); - if (substr($matches[7],0,1)=='+' OR substr($matches[7],0,1)=='-') { - $tzOffset = (substr($matches[7],0,3) * 60 + substr($matches[7],-2)) * 60; - } else { - if (strlen($matches[7])==1) { - $oneHour = 3600; - $ord = ord($matches[7]); - if ($ord < ord("M")) { - $tzOffset = (ord("A") - $ord - 1) * $oneHour; - } elseif ($ord >= ord("M") AND $matches[7]!="Z") { - $tzOffset = ($ord - ord("M")) * $oneHour; - } elseif ($matches[7]=="Z") { - $tzOffset = 0; - } - } - switch ($matches[7]) { - case "UT": - case "GMT": $tzOffset = 0; - } - } - $this->unix += $tzOffset; - return; - } - if (preg_match("~(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(.*)~",$dateString,$matches)) { - $this->unix = mktime($matches[4],$matches[5],$matches[6],$matches[2],$matches[3],$matches[1]); - if (substr($matches[7],0,1)=='+' OR substr($matches[7],0,1)=='-') { - $tzOffset = (substr($matches[7],0,3) * 60 + substr($matches[7],-2)) * 60; - } else { - if ($matches[7]=="Z") { - $tzOffset = 0; - } - } - $this->unix += $tzOffset; - return; - } - $this->unix = 0; - } - - /** - * Gets the date stored in this FeedDate as an RFC 822 date. - * - * @return a date in RFC 822 format - */ - function rfc822() { - //return gmdate("r",$this->unix); - $date = @gmdate("D, d M Y H:i:s", $this->unix); - if (TIME_ZONE!="") $date .= " ".str_replace(":","",TIME_ZONE); - return $date; - } - - /** - * Gets the date stored in this FeedDate as an ISO 8601 date. - * - * @return a date in ISO 8601 (RFC 3339) format - */ - function iso8601() { - $date = @gmdate("Y-m-d\TH:i:sO",$this->unix); - $date = substr($date,0,22) . ':' . substr($date,-2); - if (TIME_ZONE!="") $date = str_replace("+00:00",TIME_ZONE,$date); - return $date; - } - - /** - * Gets the date stored in this FeedDate as unix time stamp. - * - * @return a date as a unix time stamp - */ - function unix() { - return $this->unix; - } -} - - -/** - * RSSCreator10 is a FeedCreator that implements RDF Site Summary (RSS) 1.0. - * - * @see http://www.purl.org/rss/1.0/ - * @since 1.3 - * @author Kai Blankenhorn - */ -class RSSCreator10 extends FeedCreator { - - /** - * Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0. - * The feed will contain all items previously added in the same order. - * @return string the feed's complete text - */ - function createFeed() { - $feed = "encoding."\"?>\n"; - $feed.= $this->_createGeneratorComment(); - if ($this->cssStyleSheet=="") { - $cssStyleSheet = "http://www.w3.org/2000/08/w3c-synd/style.css"; - } - $feed.= $this->_createStylesheetReferences(); - $feed.= "\n"; - $feed.= " syndicationURL."\">\n"; - $feed.= " ".htmlspecialchars($this->title)."\n"; - $feed.= " ".htmlspecialchars($this->description)."\n"; - $feed.= " ".$this->link."\n"; - if ($this->image!=null) { - $feed.= " image->url."\" />\n"; - } - $now = new FeedDate(); - $feed.= " ".htmlspecialchars($now->iso8601())."\n"; - $feed.= " \n"; - $feed.= " \n"; - for ($i=0;$iitems);$i++) { - $feed.= " items[$i]->link)."\"/>\n"; - } - $feed.= " \n"; - $feed.= " \n"; - $feed.= " \n"; - if ($this->image!=null) { - $feed.= " image->url."\">\n"; - $feed.= " ".$this->image->title."\n"; - $feed.= " ".$this->image->link."\n"; - $feed.= " ".$this->image->url."\n"; - $feed.= " \n"; - } - $feed.= $this->_createAdditionalElements($this->additionalElements, " "); - $feed.= $this->additionalMarkup; - - for ($i=0;$iitems);$i++) { - $feed.= " items[$i]->link)."\">\n"; - //$feed.= " Posting\n"; - $feed.= " text/html\n"; - if ($this->items[$i]->date!=null) { - $itemDate = new FeedDate($this->items[$i]->date); - $feed.= " ".htmlspecialchars($itemDate->iso8601())."\n"; - } - if ($this->items[$i]->source!="") { - $feed.= " ".htmlspecialchars($this->items[$i]->source)."\n"; - } - if ($this->items[$i]->author!="") { - $feed.= " ".htmlspecialchars($this->items[$i]->author)."\n"; - } - $feed.= " ".htmlspecialchars(strip_tags(strtr($this->items[$i]->title,"\n\r"," ")))."\n"; - $feed.= " ".htmlspecialchars($this->items[$i]->link)."\n"; - $feed.= " ".htmlspecialchars($this->items[$i]->description)."\n"; - $feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " "); - $feed.= $this->items[$i]->additionalMarkup; - $feed.= " \n"; - } - $feed.= "\n"; - return $feed; - } -} - - - -/** - * RSSCreator091 is a FeedCreator that implements RSS 0.91 Spec, revision 3. - * - * @see http://my.netscape.com/publish/formats/rss-spec-0.91.html - * @since 1.3 - * @author Kai Blankenhorn - */ -class RSSCreator091 extends FeedCreator { - - /** - * Stores this RSS feed's version number. - * @access private - */ - var $RSSVersion; - - var $namespaces; - - function RSSCreator091() { - $this->_setRSSVersion("0.91"); - $this->contentType = "application/rss+xml"; - $this->namespaces = array(); - } - - /** - * Sets this RSS feed's version number. - * @access private - */ - function _setRSSVersion($version) { - $this->RSSVersion = $version; - } - - function _getNameSpaces() { - if (!is_array($this->namespaces)) return ""; - - $output = ""; - foreach ($this->namespaces as $namespace=>$dtd) { - $output .= " ".$namespace."=\"".$dtd."\""; - } - - return $output; - } - - function addNameSpace($namespace,$dtd) { - $this->namespaces[$namespace] = $dtd; - } - - /** - * Builds the RSS feed's text. The feed will be compliant to RDF Site Summary (RSS) 1.0. - * The feed will contain all items previously added in the same order. - * @return string the feed's complete text - */ - function createFeed() { - $feed = "encoding."\"?>\n"; - $feed.= $this->_createGeneratorComment(); - $feed.= $this->_createStylesheetReferences(); - $feed.= "RSSVersion."\"".$this->_getNameSpaces().">\n"; - $feed.= " \n"; - $feed.= " ".FeedCreator::iTrunc(htmlspecialchars($this->title),100)."\n"; - $this->descriptionTruncSize = 500; - $feed.= " ".$this->getDescription()."\n"; - $feed.= " ".$this->link."\n"; - $now = new FeedDate(); - $feed.= " ".htmlspecialchars($now->rfc822())."\n"; - $feed.= " ".$this->generator."\n"; - - if ($this->image!=null) { - $feed.= " \n"; - $feed.= " ".$this->image->url."\n"; - $feed.= " ".FeedCreator::iTrunc(htmlspecialchars($this->image->title),100)."\n"; - $feed.= " ".$this->image->link."\n"; - if ($this->image->width!="") { - $feed.= " ".$this->image->width."\n"; - } - if ($this->image->height!="") { - $feed.= " ".$this->image->height."\n"; - } - if ($this->image->description!="") { - $feed.= " ".$this->image->getDescription()."\n"; - } - $feed.= " \n"; - } - if ($this->language!="") { - $feed.= " ".$this->language."\n"; - } - if ($this->copyright!="") { - $feed.= " ".FeedCreator::iTrunc(htmlspecialchars($this->copyright),100)."\n"; - } - if ($this->editor!="") { - $feed.= " ".FeedCreator::iTrunc(htmlspecialchars($this->editor),100)."\n"; - } - if ($this->webmaster!="") { - $feed.= " ".FeedCreator::iTrunc(htmlspecialchars($this->webmaster),100)."\n"; - } - if ($this->pubDate!="") { - $pubDate = new FeedDate($this->pubDate); - $feed.= " ".htmlspecialchars($pubDate->rfc822())."\n"; - } - if ($this->category!="") { - $feed.= " ".htmlspecialchars($this->category)."\n"; - } - if ($this->docs!="") { - $feed.= " ".FeedCreator::iTrunc(htmlspecialchars($this->docs),500)."\n"; - } - if ($this->ttl!="") { - $feed.= " ".htmlspecialchars($this->ttl)."\n"; - } - if ($this->rating!="") { - $feed.= " ".FeedCreator::iTrunc(htmlspecialchars($this->rating),500)."\n"; - } - if ($this->skipHours!="") { - $feed.= " ".htmlspecialchars($this->skipHours)."\n"; - } - if ($this->skipDays!="") { - $feed.= " ".htmlspecialchars($this->skipDays)."\n"; - } - $feed.= $this->_createAdditionalElements($this->additionalElements, " "); - $feed.= $this->additionalMarkup; - - for ($i=0;$iitems);$i++) { - $feed.= " \n"; - $feed.= " ".FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)),100)."\n"; - $feed.= " ".htmlspecialchars($this->items[$i]->link)."\n"; - $feed.= " ".$this->items[$i]->getDescription()."\n"; - - if ($this->items[$i]->author!="") { - $feed.= " ".htmlspecialchars($this->items[$i]->author)."\n"; - } - /* - // on hold - if ($this->items[$i]->source!="") { - $feed.= " ".htmlspecialchars($this->items[$i]->source)."\n"; - } - */ - if ($this->items[$i]->category!="") { - $feed.= " ".htmlspecialchars($this->items[$i]->category)."\n"; - } - if ($this->items[$i]->comments!="") { - $feed.= " ".htmlspecialchars($this->items[$i]->comments)."\n"; - } - if ($this->items[$i]->date!="") { - $itemDate = new FeedDate($this->items[$i]->date); - $feed.= " ".htmlspecialchars($itemDate->rfc822())."\n"; - } - if ($this->items[$i]->guid!="") { - $feed.= " ".htmlspecialchars($this->items[$i]->guid)."\n"; - } - $feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " "); - $feed.= $this->items[$i]->additionalMarkup; - if ($this->RSSVersion == "2.0" && $this->items[$i]->enclosure != NULL) - { - $feed.= " items[$i]->enclosure->url; - $feed.= "\" length=\""; - $feed.= $this->items[$i]->enclosure->length; - $feed.= "\" type=\""; - $feed.= $this->items[$i]->enclosure->type; - $feed.= "\"/>\n"; - } - - - - $feed.= " \n"; - } - $feed.= " \n"; - $feed.= "\n"; - return $feed; - } -} - - - -/** - * RSSCreator20 is a FeedCreator that implements RDF Site Summary (RSS) 2.0. - * - * @see http://backend.userland.com/rss - * @since 1.3 - * @author Kai Blankenhorn - */ -class RSSCreator20 extends RSSCreator091 { - - function RSSCreator20() { - parent::_setRSSVersion("2.0"); - } - -} - - -/** - * PIECreator01 is a FeedCreator that implements the emerging PIE specification, - * as in http://intertwingly.net/wiki/pie/Syntax. - * - * @deprecated - * @since 1.3 - * @author Scott Reynen and Kai Blankenhorn - */ -class PIECreator01 extends FeedCreator { - - function PIECreator01() { - $this->encoding = "utf-8"; - } - - function createFeed() { - $feed = "encoding."\"?>\n"; - $feed.= $this->_createStylesheetReferences(); - $feed.= "\n"; - $feed.= " ".FeedCreator::iTrunc(htmlspecialchars($this->title),100)."\n"; - $this->truncSize = 500; - $feed.= " ".$this->getDescription()."\n"; - $feed.= " ".$this->link."\n"; - for ($i=0;$iitems);$i++) { - $feed.= " \n"; - $feed.= " ".FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)),100)."\n"; - $feed.= " ".htmlspecialchars($this->items[$i]->link)."\n"; - $itemDate = new FeedDate($this->items[$i]->date); - $feed.= " ".htmlspecialchars($itemDate->iso8601())."\n"; - $feed.= " ".htmlspecialchars($itemDate->iso8601())."\n"; - $feed.= " ".htmlspecialchars($itemDate->iso8601())."\n"; - $feed.= " ".htmlspecialchars($this->items[$i]->guid)."\n"; - if ($this->items[$i]->author!="") { - $feed.= " \n"; - $feed.= " ".htmlspecialchars($this->items[$i]->author)."\n"; - if ($this->items[$i]->authorEmail!="") { - $feed.= " ".$this->items[$i]->authorEmail."\n"; - } - $feed.=" \n"; - } - $feed.= " \n"; - $feed.= "
      ".$this->items[$i]->getDescription()."
      \n"; - $feed.= "
      \n"; - $feed.= "
      \n"; - } - $feed.= "
      \n"; - return $feed; - } -} - -/** - * AtomCreator10 is a FeedCreator that implements the atom specification, - * as in http://www.atomenabled.org/developers/syndication/atom-format-spec.php - * Please note that just by using AtomCreator10 you won't automatically - * produce valid atom files. For example, you have to specify either an editor - * for the feed or an author for every single feed item. - * - * Some elements have not been implemented yet. These are (incomplete list): - * author URL, item author's email and URL, item contents, alternate links, - * other link content types than text/html. Some of them may be created with - * AtomCreator10::additionalElements. - * - * @see FeedCreator#additionalElements - * @since 1.7.2-mod (modified) - * @author Mohammad Hafiz Ismail (mypapit@gmail.com) - */ - class AtomCreator10 extends FeedCreator { - - function AtomCreator10() { - $this->contentType = "application/atom+xml"; - $this->encoding = "utf-8"; - } - - function createFeed() { - $feed = "encoding."\"?>\n"; - $feed.= $this->_createGeneratorComment(); - $feed.= $this->_createStylesheetReferences(); - $feed.= "language!="") { - $feed.= " xml:lang=\"".$this->language."\""; - } - $feed.= ">\n"; - $feed.= " ".htmlspecialchars($this->title)."\n"; - $feed.= " ".htmlspecialchars($this->description)."\n"; - $feed.= " link)."\"/>\n"; - $feed.= " ".htmlspecialchars($this->link)."\n"; - $now = new FeedDate(); - $feed.= " ".htmlspecialchars($now->iso8601())."\n"; - if ($this->editor!="") { - $feed.= " \n"; - $feed.= " ".$this->editor."\n"; - if ($this->editorEmail!="") { - $feed.= " ".$this->editorEmail."\n"; - } - $feed.= " \n"; - } - $feed.= " ".FEEDCREATOR_VERSION."\n"; - $feed.= "syndicationURL . "\" />\n"; - $feed.= $this->_createAdditionalElements($this->additionalElements, " "); - for ($i=0;$iitems);$i++) { - $feed.= " \n"; - $feed.= " ".htmlspecialchars(strip_tags($this->items[$i]->title))."\n"; - $feed.= " items[$i]->link)."\"/>\n"; - if ($this->items[$i]->date=="") { - $this->items[$i]->date = time(); - } - $itemDate = new FeedDate($this->items[$i]->date); - $feed.= " ".htmlspecialchars($itemDate->iso8601())."\n"; - $feed.= " ".htmlspecialchars($itemDate->iso8601())."\n"; - $feed.= " ".htmlspecialchars($this->items[$i]->link)."\n"; - $feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " "); - if ($this->items[$i]->author!="") { - $feed.= " \n"; - $feed.= " ".htmlspecialchars($this->items[$i]->author)."\n"; - $feed.= " \n"; - } - if ($this->items[$i]->description!="") { - $feed.= " ".htmlspecialchars($this->items[$i]->description)."\n"; - } - if ($this->items[$i]->enclosure != NULL) { - $feed.=" items[$i]->enclosure->url ."\" type=\"". $this->items[$i]->enclosure->type."\" length=\"". $this->items[$i]->enclosure->length . "\" />\n"; - } - $feed.= " \n"; - } - $feed.= "\n"; - return $feed; - } - - -} - - -/** - * AtomCreator03 is a FeedCreator that implements the atom specification, - * as in http://www.intertwingly.net/wiki/pie/FrontPage. - * Please note that just by using AtomCreator03 you won't automatically - * produce valid atom files. For example, you have to specify either an editor - * for the feed or an author for every single feed item. - * - * Some elements have not been implemented yet. These are (incomplete list): - * author URL, item author's email and URL, item contents, alternate links, - * other link content types than text/html. Some of them may be created with - * AtomCreator03::additionalElements. - * - * @see FeedCreator#additionalElements - * @since 1.6 - * @author Kai Blankenhorn , Scott Reynen - */ -class AtomCreator03 extends FeedCreator { - - function AtomCreator03() { - $this->contentType = "application/atom+xml"; - $this->encoding = "utf-8"; - } - - function createFeed() { - $feed = "encoding."\"?>\n"; - $feed.= $this->_createGeneratorComment(); - $feed.= $this->_createStylesheetReferences(); - $feed.= "language!="") { - $feed.= " xml:lang=\"".$this->language."\""; - } - $feed.= ">\n"; - $feed.= " ".htmlspecialchars($this->title)."\n"; - $feed.= " ".htmlspecialchars($this->description)."\n"; - $feed.= " link)."\"/>\n"; - $feed.= " ".htmlspecialchars($this->link)."\n"; - $now = new FeedDate(); - $feed.= " ".htmlspecialchars($now->iso8601())."\n"; - if ($this->editor!="") { - $feed.= " \n"; - $feed.= " ".$this->editor."\n"; - if ($this->editorEmail!="") { - $feed.= " ".$this->editorEmail."\n"; - } - $feed.= " \n"; - } - $feed.= " ".$this->generator."\n"; - $feed.= $this->_createAdditionalElements($this->additionalElements, " "); - $feed.= $this->additionalMarkup; - for ($i=0;$iitems);$i++) { - $feed.= " \n"; - $feed.= " ".htmlspecialchars(strip_tags($this->items[$i]->title))."\n"; - $feed.= " items[$i]->link)."\"/>\n"; - if ($this->items[$i]->date=="") { - $this->items[$i]->date = time(); - } - $itemDate = new FeedDate($this->items[$i]->date); - $feed.= " ".htmlspecialchars($itemDate->iso8601())."\n"; - $feed.= " ".htmlspecialchars($itemDate->iso8601())."\n"; - $feed.= " ".htmlspecialchars($itemDate->iso8601())."\n"; - $feed.= " ".htmlspecialchars($this->items[$i]->link)."\n"; - $feed.= $this->_createAdditionalElements($this->items[$i]->additionalElements, " "); - $feed.= $this->items[$i]->additionalMarkup; - if ($this->items[$i]->author!="") { - $feed.= " \n"; - $feed.= " ".htmlspecialchars($this->items[$i]->author)."\n"; - $feed.= " \n"; - } - if ($this->items[$i]->description!="") { - $feed.= " ".htmlspecialchars($this->items[$i]->description)."\n"; - } - $feed.= " \n"; - } - $feed.= "\n"; - return $feed; - } -} - - -/** - * MBOXCreator is a FeedCreator that implements the mbox format - * as described in http://www.qmail.org/man/man5/mbox.html - * - * @since 1.3 - * @author Kai Blankenhorn - */ -class MBOXCreator extends FeedCreator { - - function MBOXCreator() { - $this->contentType = "text/plain"; - $this->encoding = "utf-8"; - } - - function qp_enc($input = "", $line_max = 76) { - $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); - $lines = preg_split("/(?:\r\n|\r|\n)/", $input); - $eol = "\r\n"; - $escape = "="; - $output = ""; - while( list(, $line) = each($lines) ) { - //$line = rtrim($line); // remove trailing white space -> no =20\r\n necessary - $linlen = strlen($line); - $newline = ""; - for($i = 0; $i < $linlen; $i++) { - $c = substr($line, $i, 1); - $dec = ord($c); - if ( ($dec == 32) && ($i == ($linlen - 1)) ) { // convert space at eol only - $c = "=20"; - } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required - $h2 = floor($dec/16); $h1 = floor($dec%16); - $c = $escape.$hex["$h2"].$hex["$h1"]; - } - if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted - $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay - $newline = ""; - } - $newline .= $c; - } // end of for - $output .= $newline.$eol; - } - return trim($output); - } - - - /** - * Builds the MBOX contents. - * @return string the feed's complete text - */ - function createFeed() { - for ($i=0;$iitems);$i++) { - if ($this->items[$i]->author!="") { - $from = $this->items[$i]->author; - } else { - $from = $this->title; - } - $itemDate = new FeedDate($this->items[$i]->date); - $feed.= "From ".strtr(MBOXCreator::qp_enc($from)," ","_")." ".date("D M d H:i:s Y",$itemDate->unix())."\n"; - $feed.= "Content-Type: text/plain;\n"; - $feed.= " charset=\"".$this->encoding."\"\n"; - $feed.= "Content-Transfer-Encoding: quoted-printable\n"; - $feed.= "Content-Type: text/plain\n"; - $feed.= "From: \"".MBOXCreator::qp_enc($from)."\"\n"; - $feed.= "Date: ".$itemDate->rfc822()."\n"; - $feed.= "Subject: ".MBOXCreator::qp_enc(FeedCreator::iTrunc($this->items[$i]->title,100))."\n"; - $feed.= "\n"; - $body = chunk_split(MBOXCreator::qp_enc($this->items[$i]->description)); - $feed.= preg_replace("~\nFrom ([^\n]*)(\n?)~","\n>From $1$2\n",$body); - $feed.= "\n"; - $feed.= "\n"; - } - return $feed; - } - - /** - * Generate a filename for the feed cache file. Overridden from FeedCreator to prevent XML data types. - * @return string the feed cache filename - * @since 1.4 - * @access private - */ - function _generateFilename() { - $fileInfo = pathinfo($_SERVER["PHP_SELF"]); - return substr($fileInfo["basename"],0,-(strlen($fileInfo["extension"])+1)).".mbox"; - } -} - - -/** - * OPMLCreator is a FeedCreator that implements OPML 1.0. - * - * @see http://opml.scripting.com/spec - * @author Dirk Clemens, Kai Blankenhorn - * @since 1.5 - */ -class OPMLCreator extends FeedCreator { - - function OPMLCreator() { - $this->encoding = "utf-8"; - } - - function createFeed() { - $feed = "encoding."\"?>\n"; - $feed.= $this->_createGeneratorComment(); - $feed.= $this->_createStylesheetReferences(); - $feed.= "\n"; - $feed.= " \n"; - $feed.= " ".htmlspecialchars($this->title)."\n"; - if ($this->pubDate!="") { - $date = new FeedDate($this->pubDate); - $feed.= " ".$date->rfc822()."\n"; - } - if ($this->lastBuildDate!="") { - $date = new FeedDate($this->lastBuildDate); - $feed.= " ".$date->rfc822()."\n"; - } - if ($this->editor!="") { - $feed.= " ".$this->editor."\n"; - } - if ($this->editorEmail!="") { - $feed.= " ".$this->editorEmail."\n"; - } - $feed.= " \n"; - $feed.= " \n"; - for ($i=0;$iitems);$i++) { - $feed.= " items[$i]->title,"\n\r"," "))); - $feed.= " title=\"".$title."\""; - $feed.= " text=\"".$title."\""; - //$feed.= " description=\"".htmlspecialchars($this->items[$i]->description)."\""; - $feed.= " url=\"".htmlspecialchars($this->items[$i]->link)."\""; - $feed.= "/>\n"; - } - $feed.= " \n"; - $feed.= "\n"; - return $feed; - } -} - - - -/** - * HTMLCreator is a FeedCreator that writes an HTML feed file to a specific - * location, overriding the createFeed method of the parent FeedCreator. - * The HTML produced can be included over http by scripting languages, or serve - * as the source for an IFrame. - * All output by this class is embedded in
      tags to enable formatting - * using CSS. - * - * @author Pascal Van Hecke - * @since 1.7 - */ -class HTMLCreator extends FeedCreator { - - var $contentType = "text/html"; - - /** - * Contains HTML to be output at the start of the feed's html representation. - */ - var $header; - - /** - * Contains HTML to be output at the end of the feed's html representation. - */ - var $footer ; - - /** - * Contains HTML to be output between entries. A separator is only used in - * case of multiple entries. - */ - var $separator; - - /** - * Used to prefix the stylenames to make sure they are unique - * and do not clash with stylenames on the users' page. - */ - var $stylePrefix; - - /** - * Determines whether the links open in a new window or not. - */ - var $openInNewWindow = true; - - var $imageAlign ="right"; - - /** - * In case of very simple output you may want to get rid of the style tags, - * hence this variable. There's no equivalent on item level, but of course you can - * add strings to it while iterating over the items ($this->stylelessOutput .= ...) - * and when it is non-empty, ONLY the styleless output is printed, the rest is ignored - * in the function createFeed(). - */ - var $stylelessOutput =""; - - /** - * Writes the HTML. - * @return string the scripts's complete text - */ - function createFeed() { - // if there is styleless output, use the content of this variable and ignore the rest - if ($this->stylelessOutput!="") { - return $this->stylelessOutput; - } - - //if no stylePrefix is set, generate it yourself depending on the script name - if ($this->stylePrefix=="") { - $this->stylePrefix = str_replace(".", "_", $this->_generateFilename())."_"; - } - - //set an openInNewWindow_token_to be inserted or not - if ($this->openInNewWindow) { - $targetInsert = " target='_blank'"; - } - - // use this array to put the lines in and implode later with "document.write" javascript - $feedArray = array(); - if ($this->image!=null) { - $imageStr = "". - "".
-							FeedCreator::iTrunc(htmlspecialchars($this->image->title),100).
-							"image->width) { - $imageStr .=" width='".$this->image->width. "' "; - } - if ($this->image->height) { - $imageStr .=" height='".$this->image->height."' "; - } - $imageStr .="/>"; - $feedArray[] = $imageStr; - } - - if ($this->title) { - $feedArray[] = ""; - } - if ($this->getDescription()) { - $feedArray[] = "
      ". - str_replace("]]>", "", str_replace("getDescription())). - "
      "; - } - - if ($this->header) { - $feedArray[] = "
      ".$this->header."
      "; - } - - for ($i=0;$iitems);$i++) { - if ($this->separator and $i > 0) { - $feedArray[] = "
      ".$this->separator."
      "; - } - - if ($this->items[$i]->title) { - if ($this->items[$i]->link) { - $feedArray[] = - ""; - } else { - $feedArray[] = - "
      ". - FeedCreator::iTrunc(htmlspecialchars(strip_tags($this->items[$i]->title)),100). - "
      "; - } - } - if ($this->items[$i]->getDescription()) { - $feedArray[] = - "
      ". - str_replace("]]>", "", str_replace("items[$i]->getDescription())). - "
      "; - } - } - if ($this->footer) { - $feedArray[] = "
      ".$this->footer."
      "; - } - - $feed= "".join($feedArray, "\r\n"); - return $feed; - } - - /** - * Overrrides parent to produce .html extensions - * - * @return string the feed cache filename - * @since 1.4 - * @access private - */ - function _generateFilename() { - $fileInfo = pathinfo($_SERVER["PHP_SELF"]); - return substr($fileInfo["basename"],0,-(strlen($fileInfo["extension"])+1)).".html"; - } -} - - -/** - * JSCreator is a class that writes a js file to a specific - * location, overriding the createFeed method of the parent HTMLCreator. - * - * @author Pascal Van Hecke - */ -class JSCreator extends HTMLCreator { - var $contentType = "text/javascript"; - - /** - * writes the javascript - * @return string the scripts's complete text - */ - function createFeed() - { - $feed = parent::createFeed(); - $feedArray = explode("\n",$feed); - - $jsFeed = ""; - foreach ($feedArray as $value) { - $jsFeed .= "document.write('".trim(addslashes($value))."');\n"; - } - return $jsFeed; - } - - /** - * Overrrides parent to produce .js extensions - * - * @return string the feed cache filename - * @since 1.4 - * @access private - */ - function _generateFilename() { - $fileInfo = pathinfo($_SERVER["PHP_SELF"]); - return substr($fileInfo["basename"],0,-(strlen($fileInfo["extension"])+1)).".js"; - } - -} - - -/** -* GoogleSiteMapIndex is a FeedCreator that implements Google Sitemap Index 0.84. -* -* @see https://www.google.com/webmasters/sitemaps/docs/en/protocol.html#sitemapFileRequirements -* taken from http://phpbb.bitfolge.de/viewtopic.php?t=102 -*/ -class GoogleSiteMapIndex extends FeedCreator { - /** - * Builds the Google Sitemap feed's text. - * The feed will contain all items previously added in the same order. - * @return string the feed's complete text - */ - function createFeed() { - $feed = "\n"; - $feed .= "\n"; - - $total = count( $this->items ) ; - for ( $i=0; $i < $total; $i++ ) { - $feed .= " \n"; - $feed .= " ".htmlspecialchars($this->items[$i]->link)."\n"; - if ( $this->items[$i]->date != "" ) { - $itemDate = new FeedDate( $this->items[$i]->date ); - $feed .= " ".htmlspecialchars($itemDate->iso8601())."\n"; - } - $feed.= " \n"; - } - $feed.= "\n"; - - return $feed; - } -} - -/*** TEST SCRIPT ********************************************************* - -//include("feedcreator.class.php"); - -$rss = new UniversalFeedCreator(); -$rss->useCached(); -$rss->title = "PHP news"; -$rss->description = "daily news from the PHP scripting world"; - -//optional -//$rss->descriptionTruncSize = 500; -//$rss->descriptionHtmlSyndicated = true; -//$rss->xslStyleSheet = "http://feedster.com/rss20.xsl"; - -$rss->link = "http://www.dailyphp.net/news"; -$rss->feedURL = "http://www.dailyphp.net/".$PHP_SELF; - -$image = new FeedImage(); -$image->title = "dailyphp.net logo"; -$image->url = "http://www.dailyphp.net/images/logo.gif"; -$image->link = "http://www.dailyphp.net"; -$image->description = "Feed provided by dailyphp.net. Click to visit."; - -//optional -$image->descriptionTruncSize = 500; -$image->descriptionHtmlSyndicated = true; - -$rss->image = $image; - -// get your news items from somewhere, e.g. your database: -//mysql_select_db($dbHost, $dbUser, $dbPass); -//$res = mysql_query("SELECT * FROM news ORDER BY newsdate DESC"); -//while ($data = mysql_fetch_object($res)) { - $item = new FeedItem(); - $item->title = "This is an the test title of an item"; - $item->link = "http://localhost/item/"; - $item->description = "description in
      HTML"; - - //optional - //item->descriptionTruncSize = 500; - $item->descriptionHtmlSyndicated = true; - - $item->date = time(); - $item->source = "http://www.dailyphp.net"; - $item->author = "John Doe"; - - $rss->addItem($item); -//} - -// valid format strings are: RSS0.91, RSS1.0, RSS2.0, PIE0.1, MBOX, OPML, ATOM0.3, HTML, JS -echo $rss->saveFeed("RSS0.91", "feed.xml"); - - - -***************************************************************************/ \ No newline at end of file diff --git a/libraries/bitfolge/index.html b/libraries/bitfolge/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/libraries/bitfolge/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libraries/bitfolge/vcard.php b/libraries/bitfolge/vcard.php deleted file mode 100644 index 11bb76801944a..0000000000000 --- a/libraries/bitfolge/vcard.php +++ /dev/null @@ -1,208 +0,0 @@ - 126) ) { // always encode "\t", which is *not* required - $h2 = floor($dec/16); - $h1 = floor($dec%16); - $c = $escape.$hex["$h2"] . $hex["$h1"]; - } - if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted - $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay - $newline = " "; - } - $newline .= $c; - } // end of for - $output .= $newline; - if ($jproperties[$key] = quoted_printable_encode($number); - } - - // UNTESTED !!! - function setPhoto($type, $photo) { // $type = "GIF" | "JPEG" - $this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo); - } - - function setFormattedName($name) { - $this->properties['FN'] = quoted_printable_encode($name); - } - - function setName($family='', $first='', $additional='', $prefix='', $suffix='') { - $this->properties['N'] = "$family;$first;$additional;$prefix;$suffix"; - $this->filename = "$first%20$family.vcf"; - if ($this->properties['FN']=='') { - $this->setFormattedName(trim("$prefix $first $additional $family $suffix")); - } - } - - function setBirthday($date) { // $date format is YYYY-MM-DD - $this->properties['BDAY'] = $date; - } - - function setAddress($postoffice='', $extended='', $street='', $city='', $region='', $zip='', $country='', $type='HOME;POSTAL') { - // $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL" - $key = 'ADR'; - if ($type!='') { - $key.= ";$type"; - } - - $key.= ';ENCODING=QUOTED-PRINTABLE'; - $this->properties[$key] = encode($name).';'.encode($extended).';'.encode($street).';'.encode($city).';'.encode($region).';'.encode($zip).';'.encode($country); - - if ($this->properties["LABEL;$type;ENCODING=QUOTED-PRINTABLE"] == '') { - //$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type); - } - } - - function setLabel($postoffice='', $extended='', $street='', $city='', $region='', $zip='', $country='', $type='HOME;POSTAL') { - $label = ''; - if ($postoffice!='') { - $label.= $postoffice; - $label.= "\r\n"; - } - - if ($extended!='') { - $label.= $extended; - $label.= "\r\n"; - } - - if ($street!='') { - $label.= $street; - $label.= "\r\n"; - } - - if ($zip!='') { - $label.= $zip .' '; - } - - if ($city!='') { - $label.= $city; - $label.= "\r\n"; - } - - if ($region!='') { - $label.= $region; - $label.= "\r\n"; - } - - if ($country!='') { - $country.= $country; - $label.= "\r\n"; - } - - $this->properties["LABEL;$type;ENCODING=QUOTED-PRINTABLE"] = quoted_printable_encode($label); - } - - function setEmail($address) { - $this->properties['EMAIL;INTERNET'] = $address; - } - - function setNote($note) { - $this->properties['NOTE;ENCODING=QUOTED-PRINTABLE'] = quoted_printable_encode($note); - } - - function setURL($url, $type='') { - // $type may be WORK | HOME - $key = 'URL'; - if ($type!='') { - $key.= ";$type"; - } - - $this->properties[$key] = $url; - } - - function getVCard() { - $text = 'BEGIN:VCARD'; - $text.= "\r\n"; - $text.= 'VERSION:2.1'; - $text.= "\r\n"; - - foreach($this->properties as $key => $value) { - $text.= "$key:$value\r\n"; - } - - $text.= 'REV:'. date('Y-m-d') .'T'. date('H:i:s') .'Z'; - $text.= "\r\n"; - $text.= 'MAILER:PHP vCard class by Kai Blankenhorn'; - $text.= "\r\n"; - $text.= 'END:VCARD'; - $text.= "\r\n"; - - return $text; - } - - function getFileName() { - return $this->filename; - } -} -?> \ No newline at end of file diff --git a/libraries/domit/index.html b/libraries/domit/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/domit/index.html +++ b/libraries/domit/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/domit/php_http_connector.php b/libraries/domit/php_http_connector.php index de23c546677e7..d572939f262cd 100644 --- a/libraries/domit/php_http_connector.php +++ b/libraries/domit/php_http_connector.php @@ -35,7 +35,7 @@ class php_http_connector { * @param string The password, if authentication is required */ function setConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) { - require_once(PHP_HTTP_TOOLS_INCLUDE_PATH . 'php_http_client_generic.php'); + require_once(PHP_HTTP_TOOLS_INCLUDE_PATH . 'php_http_client_generic.php'); $this->httpConnection = new php_http_client_generic($host, $path, $port, $timeout, $user, $password); } //setConnection @@ -59,7 +59,7 @@ function setAuthorization($user, $password) { * @param string The password, if authentication is required */ function setProxyConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) { - require_once(PHP_HTTP_TOOLS_INCLUDE_PATH . 'php_http_proxy.php'); + require_once(PHP_HTTP_TOOLS_INCLUDE_PATH . 'php_http_proxy.php'); $this->httpConnection = new php_http_proxy($host, $path, $port, $timeout, $user, $password); } //setProxyConnection diff --git a/libraries/domit/xml_domit_getelementsbypath.php b/libraries/domit/xml_domit_getelementsbypath.php index 7473dcd55736f..66085d4de3364 100644 --- a/libraries/domit/xml_domit_getelementsbypath.php +++ b/libraries/domit/xml_domit_getelementsbypath.php @@ -25,7 +25,7 @@ * getElementsByPath is a simple utility for path-based access to nodes in a DOMIT! document. */ class DOMIT_GetElementsByPath { - /** @var Object The node from which the search is called */ + /** @var Object The node from which the search is called */ var $callingNode; /** @var int The type of search to be performed, i.e., relative, absolute, or variable */ var $searchType; @@ -214,10 +214,10 @@ function selectNamedChild(&$node, $pIndex) { * This class may be absent from future versions of DOMIT! */ class DOMIT_GetElementsByAttributePath { - /** @var Object A DOMIT_NodeList of matching attribute nodes */ + /** @var Object A DOMIT_NodeList of matching attribute nodes */ var $nodeList; - /** + /** * Constructor - creates an empty DOMIT_NodeList to store matching nodes */ function DOMIT_GetElementsByAttributePath() { diff --git a/libraries/domit/xml_domit_lite_parser.php b/libraries/domit/xml_domit_lite_parser.php index 49908ab68b8ba..520b0ee9f2a10 100644 --- a/libraries/domit/xml_domit_lite_parser.php +++ b/libraries/domit/xml_domit_lite_parser.php @@ -261,18 +261,18 @@ function onLoad() { * Clears previousSibling, nextSibling, and parentNode references from a node that has been removed */ function clearReferences() { - if ($this->previousSibling != null) { - unset($this->previousSibling); - $this->previousSibling = null; - } - if ($this->nextSibling != null) { - unset($this->nextSibling); - $this->nextSibling = null; - } - if ($this->parentNode != null) { - unset($this->parentNode); - $this->parentNode = null; - } + if ($this->previousSibling != null) { + unset($this->previousSibling); + $this->previousSibling = null; + } + if ($this->nextSibling != null) { + unset($this->nextSibling); + $this->nextSibling = null; + } + if ($this->parentNode != null) { + unset($this->parentNode); + $this->parentNode = null; + } } //clearReferences /** @@ -580,7 +580,7 @@ function &getElementsByAttribute($attrName = 'id', $attrValue = '', if ($nodelist->getLength() > 0) { return $nodelist->item(0); } - $null = null; + $null = null; return $null; } @@ -641,20 +641,20 @@ class DOMIT_Lite_Document extends DOMIT_Lite_ChildNodes_Interface { var $implementation; /** @var Array User defined translation table for XML entities */ var $definedEntities = array(); - /** @var boolean If true, loadXML or parseXML will attempt to detect and repair invalid xml */ - var $doResolveErrors = false; + /** @var boolean If true, loadXML or parseXML will attempt to detect and repair invalid xml */ + var $doResolveErrors = false; /** @var boolean True if whitespace is to be preserved during parsing */ var $preserveWhitespace = false; - /** @var boolean If true, elements tags will be rendered to string as rather than */ - var $doExpandEmptyElementTags = false; + /** @var boolean If true, elements tags will be rendered to string as rather than */ + var $doExpandEmptyElementTags = false; /** @var array A list of exceptions to the empty element expansion rule */ var $expandEmptyElementExceptions = array(); /** @var int The error code returned by the SAX parser */ - var $errorCode = 0; + var $errorCode = 0; /** @var string The error string returned by the SAX parser */ - var $errorString = ''; + var $errorString = ''; /** @var object A reference to a http connection or proxy server, if one is required */ - var $httpConnection = null; + var $httpConnection = null; /** @var boolean True if php_http_client_generic is to be used instead of PHP get_file_contents to retrieve xml data */ var $doUseHTTPClient = false; @@ -678,7 +678,7 @@ function DOMIT_Lite_Document() { * @param boolean True if errors are to be resolved */ function resolveErrors($truthVal) { - $this->doResolveErrors = $truthVal; + $this->doResolveErrors = $truthVal; } //resolveErrors /** @@ -691,7 +691,7 @@ function resolveErrors($truthVal) { * @param string The password, if authentication is required */ function setConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) { - require_once(DOMIT_INCLUDE_PATH . 'php_http_client_generic.php'); + require_once(DOMIT_INCLUDE_PATH . 'php_http_client_generic.php'); $this->httpConnection = new php_http_client_generic($host, $path, $port, $timeout, $user, $password); } //setConnection @@ -701,7 +701,7 @@ function setConnection($host, $path = '/', $port = 80, $timeout = 0, $user = nul * @param boolean True if whitespace is to be preserved */ function preserveWhitespace($truthVal) { - $this->preserveWhitespace = $truthVal; + $this->preserveWhitespace = $truthVal; } //preserveWhitespace /** @@ -723,7 +723,7 @@ function setAuthorization($user, $password) { * @param string The password, if authentication is required */ function setProxyConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) { - require_once(DOMIT_INCLUDE_PATH . 'php_http_proxy.php'); + require_once(DOMIT_INCLUDE_PATH . 'php_http_proxy.php'); $this->httpConnection = new php_http_proxy($host, $path, $port, $timeout, $user, $password); } //setProxyConnection @@ -750,7 +750,7 @@ function useHTTPClient($truthVal) { * @return int The error code */ function getErrorCode() { - return $this->errorCode; + return $this->errorCode; } //getErrorCode /** @@ -758,7 +758,7 @@ function getErrorCode() { * @return string The error string */ function getErrorString() { - return $this->errorString; + return $this->errorString; } //getErrorString /** @@ -996,10 +996,10 @@ function parseXML_utf8($xmlText, $useSAXY = true, $preserveCDATA = true, $fireLo function parseXML($xmlText, $useSAXY = true, $preserveCDATA = true, $fireLoadEvent = false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); - if ($this->doResolveErrors) { - require_once(DOMIT_INCLUDE_PATH . 'xml_domit_doctor.php'); - $xmlText = DOMIT_Doctor::fixAmpersands($xmlText); - } + if ($this->doResolveErrors) { + require_once(DOMIT_INCLUDE_PATH . 'xml_domit_doctor.php'); + $xmlText = DOMIT_Doctor::fixAmpersands($xmlText); + } if (DOMIT_Utilities::validateXML($xmlText)) { $domParser = new DOMIT_Lite_Parser(); @@ -1078,9 +1078,9 @@ function getTextFromFile($filename) { return $response->getResponse(); } else if (function_exists('file_get_contents')) { - //if (file_exists($filename)) { + //if (file_exists($filename)) { return file_get_contents($filename); - //} + //} } else { require_once(DOMIT_INCLUDE_PATH . 'php_file_utilities.php'); @@ -1358,21 +1358,21 @@ function getText() { * @param string The text data of the node */ function setText($data) { - switch ($this->childCount) { - case 1: - if ($this->firstChild->nodeType == DOMIT_TEXT_NODE) { - $this->firstChild->setText($data); - } - break; - - case 0: - $childTextNode =& $this->ownerDocument->createTextNode($data); - $this->appendChild($childTextNode); - break; - - default: - //do nothing. Maybe throw error??? - } + switch ($this->childCount) { + case 1: + if ($this->firstChild->nodeType == DOMIT_TEXT_NODE) { + $this->firstChild->setText($data); + } + break; + + case 0: + $childTextNode =& $this->ownerDocument->createTextNode($data); + $this->appendChild($childTextNode); + break; + + default: + //do nothing. Maybe throw error??? + } } //setText /** @@ -1553,17 +1553,17 @@ function toString($htmlSafe = false, $subEntities = false) { $result .= ' />'; } else { - $result .= '>nodeName . '>'; + $result .= '>nodeName . '>'; } - } - else { + } + else { if (in_array($this->nodeName, $this->ownerDocument->expandEmptyElementExceptions)) { $result .= '>nodeName . '>'; } else { $result .= ' />'; } - } + } } if ($htmlSafe) $result = $this->forHTML($result); @@ -1604,7 +1604,7 @@ function getText() { * @param string The text data of the node */ function setText($data) { - $this->nodeValue = $data; + $this->nodeValue = $data; } //setText /** @@ -1799,7 +1799,7 @@ function parseSAXY(&$myXMLDoc, $xmlText, $preserveCDATA, $definedEntities) { */ function dumpTextNode() { //traps for mixed content - $currentNode =& $this->xmlDoc->createTextNode($this->parseContainer); + $currentNode =& $this->xmlDoc->createTextNode($this->parseContainer); $this->lastChild->appendChild($currentNode); $this->inTextNode = false; $this->parseContainer = ''; diff --git a/libraries/domit/xml_domit_nodemaps.php b/libraries/domit/xml_domit_nodemaps.php index 5ab837ab507b6..f243aebf0b1de 100644 --- a/libraries/domit/xml_domit_nodemaps.php +++ b/libraries/domit/xml_domit_nodemaps.php @@ -192,13 +192,13 @@ function &getNamedItem($name) { * Reindexes the numerical index for the named node map */ function reindexNodeMap() { - $this->indexedNodeMap = array(); + $this->indexedNodeMap = array(); - foreach ($this->arNodeMap as $key => $value) { - $this->indexedNodeMap[] = $key; - } + foreach ($this->arNodeMap as $key => $value) { + $this->indexedNodeMap[] = $key; + } - $this->isDirty = false; + $this->isDirty = false; } //reindexNodeMap /** @@ -213,7 +213,7 @@ function &setNamedItem(&$arg) { $returnNode =& $this->arNodeMap[$arg->nodeName]; } else { - $this->isDirty = true; + $this->isDirty = true; } $this->arNodeMap[$arg->nodeName] =& $arg; @@ -244,7 +244,7 @@ function &removeNamedItem($name) { * @return mixed A reference to the requested node, or null */ function &getNamedItemNS($namespaceURI, $localName) { - $key = $this->getKeyNS($namespaceURI, $localName); + $key = $this->getKeyNS($namespaceURI, $localName); //check for explicit namespaces if (isset($this->arNodeMap[$key])) { @@ -280,7 +280,7 @@ function &setNamedItemNS(&$arg) { $returnNode =& $this->arNodeMap[$key]; } else { - $this->isDirty = true; + $this->isDirty = true; } $this->arNodeMap[$key] =& $arg; @@ -313,9 +313,9 @@ function &removeNamedItemNS($namespaceURI, $localName) { * @return string The key of the NamedNodeMap */ function getKeyNS($namespaceURI, $localName) { - if ($namespaceURI != '') { - return $namespaceURI . ":" . $localName; - } + if ($namespaceURI != '') { + return $namespaceURI . ":" . $localName; + } return $localName; } //getKeyNS diff --git a/libraries/domit/xml_domit_nodetools.php b/libraries/domit/xml_domit_nodetools.php index 8b34c58ab71db..0c1a5012b8d93 100644 --- a/libraries/domit/xml_domit_nodetools.php +++ b/libraries/domit/xml_domit_nodetools.php @@ -92,7 +92,7 @@ function parseAttributes($attrText, $convertEntities = true, $definedEntities = else { if ($quoteType == $currentChar) { if ($convertEntities && $maybeEntity) { - $valueDump = strtr($valueDump, DOMIT_PREDEFINED_ENTITIES); + $valueDump = strtr($valueDump, DOMIT_PREDEFINED_ENTITIES); $valueDump = strtr($valueDump, $definedEntities); } @@ -115,7 +115,7 @@ function parseAttributes($attrText, $convertEntities = true, $definedEntities = else { if ($quoteType == $currentChar) { if ($convertEntities && $maybeEntity) { - $valueDump = strtr($valueDump, $predefinedEntities); + $valueDump = strtr($valueDump, $predefinedEntities); $valueDump = strtr($valueDump, $definedEntities); } diff --git a/libraries/domit/xml_domit_parseattributes.php b/libraries/domit/xml_domit_parseattributes.php index 43ae1163456a9..3afada3fcbbb8 100644 --- a/libraries/domit/xml_domit_parseattributes.php +++ b/libraries/domit/xml_domit_parseattributes.php @@ -85,7 +85,7 @@ function parseAttributes($attrText, $convertEntities = true, $definedEntities = else { if ($quoteType == $currentChar) { if ($convertEntities && $maybeEntity) { - $valueDump = strtr($valueDump, DOMIT_PREDEFINED_ENTITIES); + $valueDump = strtr($valueDump, DOMIT_PREDEFINED_ENTITIES); $valueDump = strtr($valueDump, $definedEntities); } @@ -108,7 +108,7 @@ function parseAttributes($attrText, $convertEntities = true, $definedEntities = else { if ($quoteType == $currentChar) { if ($convertEntities && $maybeEntity) { - $valueDump = strtr($valueDump, $predefinedEntities); + $valueDump = strtr($valueDump, $predefinedEntities); $valueDump = strtr($valueDump, $definedEntities); } diff --git a/libraries/domit/xml_domit_parser.php b/libraries/domit/xml_domit_parser.php index 7f715712c8392..99a41782e9210 100644 --- a/libraries/domit/xml_domit_parser.php +++ b/libraries/domit/xml_domit_parser.php @@ -343,18 +343,18 @@ function onLoad() { * Clears previousSibling, nextSibling, and parentNode references from a node that has been removed */ function clearReferences() { - if ($this->previousSibling != null) { - unset($this->previousSibling); - $this->previousSibling = null; - } - if ($this->nextSibling != null) { - unset($this->nextSibling); - $this->nextSibling = null; - } - if ($this->parentNode != null) { - unset($this->parentNode); - $this->parentNode = null; - } + if ($this->previousSibling != null) { + unset($this->previousSibling); + $this->previousSibling = null; + } + if ($this->nextSibling != null) { + unset($this->nextSibling); + $this->nextSibling = null; + } + if ($this->parentNode != null) { + unset($this->parentNode); + $this->parentNode = null; + } } //clearReferences /** @@ -408,7 +408,7 @@ function DOMIT_ChildNodes_Interface() { */ function &appendChild(&$child) { if ($child->nodeType == DOMIT_ATTRIBUTE_NODE) { - DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, + DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, ('Cannot add a node of type ' . get_class($child) . ' using appendChild')); } else if ($child->nodeType == DOMIT_DOCUMENT_FRAGMENT_NODE) { @@ -474,10 +474,10 @@ function &appendChild(&$child) { * @return Object The inserted node */ function &insertBefore(&$newChild, &$refChild) { - if ($newChild->nodeType == DOMIT_ATTRIBUTE_NODE) { - DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, + if ($newChild->nodeType == DOMIT_ATTRIBUTE_NODE) { + DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, ('Cannot add a node of type ' . get_class($newChild) . ' using insertBefore')); - } + } if (($refChild->nodeType == DOMIT_DOCUMENT_NODE) || //($refChild->parentNode->nodeType == DOMIT_DOCUMENT_NODE) || @@ -564,10 +564,10 @@ function &insertBefore(&$newChild, &$refChild) { * @return Object The new node */ function &replaceChild(&$newChild, &$oldChild) { - if ($newChild->nodeType == DOMIT_ATTRIBUTE_NODE) { - DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, + if ($newChild->nodeType == DOMIT_ATTRIBUTE_NODE) { + DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, ('Cannot add a node of type ' . get_class($newChild) . ' using replaceChild')); - } + } else if ($newChild->nodeType == DOMIT_DOCUMENT_FRAGMENT_NODE) { //if $newChild is a DocumentFragment //replace the first node then loop through and insert each node separately $total = $newChild->childCount; @@ -821,20 +821,20 @@ class DOMIT_Document extends DOMIT_ChildNodes_Interface { var $preserveWhitespace = false; /** @var Array User defined translation table for XML entities; passed to SAXY */ var $definedEntities = array(); - /** @var boolean If true, loadXML or parseXML will attempt to detect and repair invalid xml */ - var $doResolveErrors = false; - /** @var boolean If true, elements tags will be rendered to string as rather than */ - var $doExpandEmptyElementTags = false; + /** @var boolean If true, loadXML or parseXML will attempt to detect and repair invalid xml */ + var $doResolveErrors = false; + /** @var boolean If true, elements tags will be rendered to string as rather than */ + var $doExpandEmptyElementTags = false; /** @var array A list of exceptions to the empty element expansion rule */ var $expandEmptyElementExceptions = array(); - /** @var boolean If true, namespaces will be processed */ - var $isNamespaceAware = false; + /** @var boolean If true, namespaces will be processed */ + var $isNamespaceAware = false; /** @var int The error code returned by the SAX parser */ - var $errorCode = 0; + var $errorCode = 0; /** @var string The error string returned by the SAX parser */ - var $errorString = ''; + var $errorString = ''; /** @var object A reference to a http connection or proxy server, if one is required */ - var $httpConnection = null; + var $httpConnection = null; /** @var boolean True if php_http_client_generic is to be used instead of PHP get_file_contents to retrieve xml data */ var $doUseHTTPClient = false; /** @var array An array of namespacesURIs mapped to prefixes */ @@ -860,7 +860,7 @@ function DOMIT_Document() { * @param boolean True if errors are to be resolved */ function resolveErrors($truthVal) { - $this->doResolveErrors = $truthVal; + $this->doResolveErrors = $truthVal; } //resolveErrors /** @@ -868,7 +868,7 @@ function resolveErrors($truthVal) { * @param boolean True if namespaces are to be processed */ function setNamespaceAwareness($truthVal) { - $this->isNamespaceAware = $truthVal; + $this->isNamespaceAware = $truthVal; } //setNamespaceAwareness /** @@ -876,7 +876,7 @@ function setNamespaceAwareness($truthVal) { * @param boolean True if whitespace is to be preserved */ function preserveWhitespace($truthVal) { - $this->preserveWhitespace = $truthVal; + $this->preserveWhitespace = $truthVal; } //preserveWhitespace /** @@ -889,7 +889,7 @@ function preserveWhitespace($truthVal) { * @param string The password, if authentication is required */ function setConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) { - require_once(DOMIT_INCLUDE_PATH . 'php_http_client_generic.php'); + require_once(DOMIT_INCLUDE_PATH . 'php_http_client_generic.php'); $this->httpConnection = new php_http_client_generic($host, $path, $port, $timeout, $user, $password); } //setConnection @@ -913,7 +913,7 @@ function setAuthorization($user, $password) { * @param string The password, if authentication is required */ function setProxyConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) { - require_once(DOMIT_INCLUDE_PATH . 'php_http_proxy.php'); + require_once(DOMIT_INCLUDE_PATH . 'php_http_proxy.php'); $this->httpConnection = new php_http_proxy($host, $path, $port, $timeout, $user, $password); } //setProxyConnection @@ -940,7 +940,7 @@ function useHTTPClient($truthVal) { * @return int The error code */ function getErrorCode() { - return $this->errorCode; + return $this->errorCode; } //getErrorCode /** @@ -948,7 +948,7 @@ function getErrorCode() { * @return string The error string */ function getErrorString() { - return $this->errorString; + return $this->errorString; } //getErrorString /** @@ -1096,9 +1096,9 @@ function &_importNode(&$parentNode, &$sourceNode, $deep) { * @return Object The appended node */ function &appendChild(&$node) { - switch ($node->nodeType) { - case DOMIT_ELEMENT_NODE: - if ($this->documentElement == null) { + switch ($node->nodeType) { + case DOMIT_ELEMENT_NODE: + if ($this->documentElement == null) { parent::appendChild($node); $this->setDocumentElement($node); } @@ -1107,36 +1107,36 @@ function &appendChild(&$node) { DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, ('Cannot have more than one root node (documentElement) in a DOMIT_Document.')); } - break; + break; case DOMIT_PROCESSING_INSTRUCTION_NODE: case DOMIT_COMMENT_NODE: - parent::appendChild($node); - break; + parent::appendChild($node); + break; case DOMIT_DOCUMENT_TYPE_NODE: - if ($this->doctype == null) { + if ($this->doctype == null) { parent::appendChild($node); } else { DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, ('Cannot have more than one doctype node in a DOMIT_Document.')); } - break; + break; case DOMIT_DOCUMENT_FRAGMENT_NODE: - $total = $node->childCount; + $total = $node->childCount; for ($i = 0; $i < $total; $i++) { $currChild =& $node->childNodes[$i]; $this->appendChild($currChild); } - break; + break; default: - DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, + DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, ('Cannot add a node of type ' . get_class($node) . ' to a DOMIT_Document.')); - } + } return $node; } //appendChild @@ -1174,23 +1174,23 @@ function &replaceChild(&$newChild, &$oldChild) { } else { switch ($newChild->nodeType) { - case DOMIT_ELEMENT_NODE: - if ($this->documentElement != null) { + case DOMIT_ELEMENT_NODE: + if ($this->documentElement != null) { DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, ('Cannot have more than one root node (documentElement) in a DOMIT_Document.')); } else { parent::replaceChild($newChild, $oldChild); } - break; + break; case DOMIT_PROCESSING_INSTRUCTION_NODE: case DOMIT_COMMENT_NODE: - parent::replaceChild($newChild, $oldChild); - break; + parent::replaceChild($newChild, $oldChild); + break; case DOMIT_DOCUMENT_TYPE_NODE: - if ($this->doctype != null) { + if ($this->doctype != null) { if ($this->doctype->uid == $oldChild->uid) { parent::replaceChild($newChild, $oldChild); } @@ -1202,10 +1202,10 @@ function &replaceChild(&$newChild, &$oldChild) { else { parent::replaceChild($newChild, $oldChild); } - break; + break; default: - DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, + DOMIT_DOMException::raiseException(DOMIT_HIERARCHY_REQUEST_ERR, ('Nodes of class ' . get_class($newChild) . ' cannot be children of a DOMIT_Document.')); } } @@ -1326,8 +1326,8 @@ function &createAttributeNS($namespaceURI, $qualifiedName) { $colonIndex = strpos($qualifiedName, ":"); if ($colonIndex !== false) { - $node->prefix = substr($qualifiedName, 0, $colonIndex); - $node->localName = substr($qualifiedName, ($colonIndex + 1)); + $node->prefix = substr($qualifiedName, 0, $colonIndex); + $node->localName = substr($qualifiedName, ($colonIndex + 1)); } else { $node->prefix = ''; @@ -1356,20 +1356,20 @@ function &createElement($tagName) { * @return Object The new element */ function &createElementNS($namespaceURI, $qualifiedName) { - $node = new DOMIT_Element($qualifiedName); + $node = new DOMIT_Element($qualifiedName); - $colonIndex = strpos($qualifiedName, ":"); + $colonIndex = strpos($qualifiedName, ":"); if ($colonIndex !== false) { - $node->prefix = substr($qualifiedName, 0, $colonIndex); - $node->localName = substr($qualifiedName, ($colonIndex + 1)); + $node->prefix = substr($qualifiedName, 0, $colonIndex); + $node->localName = substr($qualifiedName, ($colonIndex + 1)); } else { $node->prefix = ''; - $node->localName = $qualifiedName; + $node->localName = $qualifiedName; } - $node->namespaceURI = $namespaceURI; + $node->namespaceURI = $namespaceURI; $node->ownerDocument =& $this; @@ -1569,10 +1569,10 @@ function &getNodesByNodeValue($value, &$contextNode) { function parseXML($xmlText, $useSAXY = true, $preserveCDATA = true, $fireLoadEvent = false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); - if ($this->doResolveErrors) { - require_once(DOMIT_INCLUDE_PATH . 'xml_domit_doctor.php'); - $xmlText = DOMIT_Doctor::fixAmpersands($xmlText); - } + if ($this->doResolveErrors) { + require_once(DOMIT_INCLUDE_PATH . 'xml_domit_doctor.php'); + $xmlText = DOMIT_Doctor::fixAmpersands($xmlText); + } if (DOMIT_Utilities::validateXML($xmlText)) { $domParser = new DOMIT_Parser(); @@ -1641,9 +1641,9 @@ function getTextFromFile($filename) { return $response->getResponse(); } else if (function_exists('file_get_contents')) { - //if (file_exists($filename)) { + //if (file_exists($filename)) { return file_get_contents($filename); - //} + //} } else { require_once(DOMIT_INCLUDE_PATH . 'php_file_utilities.php'); @@ -1983,10 +1983,10 @@ function copyNamespaceDeclarationsLocally() { * @param string The localName of matching elements */ function getNamedElementsNS(&$nodeList, $namespaceURI, $localName) { - if ((($namespaceURI == $this->namespaceURI) || ($namespaceURI == '*')) && - (($localName == $this->localName) || ($localName == '*'))) { - $nodeList->appendNode($this); - } + if ((($namespaceURI == $this->namespaceURI) || ($namespaceURI == '*')) && + (($localName == $this->localName) || ($localName == '*'))) { + $nodeList->appendNode($this); + } $total = $this->childCount; @@ -2018,21 +2018,21 @@ function getText() { * @param string The text data of the node */ function setText($data) { - switch ($this->childCount) { - case 1: - if ($this->firstChild->nodeType == DOMIT_TEXT_NODE) { - $this->firstChild->setText($data); - } - break; - - case 0: - $childTextNode =& $this->ownerDocument->createTextNode($data); - $this->appendChild($childTextNode); - break; - - default: - //do nothing. Maybe throw error??? - } + switch ($this->childCount) { + case 1: + if ($this->firstChild->nodeType == DOMIT_TEXT_NODE) { + $this->firstChild->setText($data); + } + break; + + case 0: + $childTextNode =& $this->ownerDocument->createTextNode($data); + $this->appendChild($childTextNode); + break; + + default: + //do nothing. Maybe throw error??? + } } //setText /** @@ -2225,11 +2225,11 @@ function setAttribute($name, $value) { * @param string The desired attribute value */ function setAttributeNS($namespaceURI, $qualifiedName, $value) { - //get localName - $colonIndex = strpos($qualifiedName, ":"); + //get localName + $colonIndex = strpos($qualifiedName, ":"); if ($colonIndex !== false) { - $localName = substr($qualifiedName, ($colonIndex + 1)); + $localName = substr($qualifiedName, ($colonIndex + 1)); } else { $localName = $qualifiedName; @@ -2240,9 +2240,9 @@ function setAttributeNS($namespaceURI, $qualifiedName, $value) { if ($returnNode == null) { //create this manually in case element has no ownerDocument to reference $newAttr = new DOMIT_Attr($qualifiedName); - $newAttr->prefix = substr($qualifiedName, 0, $colonIndex); - $newAttr->localName = $localName; - $newAttr->namespaceURI = $namespaceURI; + $newAttr->prefix = substr($qualifiedName, 0, $colonIndex); + $newAttr->localName = $localName; + $newAttr->namespaceURI = $namespaceURI; $newAttr->setValue($value); $this->attributes->setNamedItemNS($newAttr); @@ -2464,22 +2464,22 @@ function toString($htmlSafe = false, $subEntities = false) { $result .= 'nodeName . '>'; } else { - if ($this->ownerDocument->doExpandEmptyElementTags) { + if ($this->ownerDocument->doExpandEmptyElementTags) { if (in_array($this->nodeName, $this->ownerDocument->expandEmptyElementExceptions)) { $result .= ' />'; } else { - $result .= '>nodeName . '>'; + $result .= '>nodeName . '>'; } - } - else { + } + else { if (in_array($this->nodeName, $this->ownerDocument->expandEmptyElementExceptions)) { $result .= '>nodeName . '>'; } else { $result .= ' />'; } - } + } } if ($htmlSafe) $result = $this->forHTML($result); @@ -2518,7 +2518,7 @@ function getData() { * @param string The text data of the node */ function setData($data) { - $this->nodeValue = $data; + $this->nodeValue = $data; } //setData @@ -2662,7 +2662,7 @@ function getText() { * @param string The text data of the node */ function setText($data) { - $this->nodeValue = $data; + $this->nodeValue = $data; } //setText /** @@ -2846,7 +2846,7 @@ function getText() { * @param string The text data of the node */ function setText($data) { - $this->nodeValue = $data; + $this->nodeValue = $data; } //setText /** @@ -2999,7 +2999,7 @@ function getText() { * @param string The text data of the node */ function setText($data) { - $this->nodeValue = $data; + $this->nodeValue = $data; } //setText /** @@ -3269,7 +3269,7 @@ function parse (&$myXMLDoc, $xmlText, $preserveCDATA = true) { $parser = xml_parser_create_ns(''); } else { - $parser = xml_parser_create(''); + $parser = xml_parser_create(''); } } else { @@ -3277,7 +3277,7 @@ function parse (&$myXMLDoc, $xmlText, $preserveCDATA = true) { $parser = xml_parser_create_ns(); } else { - $parser = xml_parser_create(); + $parser = xml_parser_create(); } } @@ -3298,7 +3298,7 @@ function parse (&$myXMLDoc, $xmlText, $preserveCDATA = true) { if ($this->xmlDoc->isNamespaceAware) { xml_set_start_namespace_decl_handler($parser, 'startNamespaceDeclaration'); - xml_set_end_namespace_decl_handler($parser, 'endNamespaceDeclaration'); + xml_set_end_namespace_decl_handler($parser, 'endNamespaceDeclaration'); xml_set_element_handler($parser, 'startElementNS', 'endElement'); $this->xmlDoc->namespaceURIMap[DOMIT_XML_NAMESPACE] = 'xml'; } @@ -3343,9 +3343,9 @@ function parseSAXY(&$myXMLDoc, $xmlText, $preserveCDATA = true, $definedEntities $parser->preserveWhitespace = $this->xmlDoc->preserveWhitespace; if ($this->xmlDoc->isNamespaceAware) { - $parser->setNamespaceAwareness(true); - $parser->xml_set_start_namespace_decl_handler(array(&$this, 'startNamespaceDeclaration')); - $parser->xml_set_end_namespace_decl_handler(array(&$this, 'endNamespaceDeclaration')); + $parser->setNamespaceAwareness(true); + $parser->xml_set_start_namespace_decl_handler(array(&$this, 'startNamespaceDeclaration')); + $parser->xml_set_end_namespace_decl_handler(array(&$this, 'endNamespaceDeclaration')); $parser->xml_set_element_handler(array(&$this, 'startElementNS'), array(&$this, 'endElement')); $this->xmlDoc->namespaceURIMap[DOMIT_XML_NAMESPACE] = 'xml'; } @@ -3374,7 +3374,7 @@ function parseSAXY(&$myXMLDoc, $xmlText, $preserveCDATA = true, $definedEntities * Generates and appends a new text node from the parseContainer text */ function dumpTextNode() { - $currentNode =& $this->xmlDoc->createTextNode($this->parseContainer); + $currentNode =& $this->xmlDoc->createTextNode($this->parseContainer); $this->lastChild->appendChild($currentNode); $this->inTextNode = false; $this->parseContainer = ''; @@ -3411,8 +3411,8 @@ function startElement(&$parser, $name, $attrs) { */ function startElementNS(&$parser, $name, $attrs) { if ($this->inTextNode) { - $this->dumpTextNode(); - } + $this->dumpTextNode(); + } $colonIndex = strrpos($name, ":"); diff --git a/libraries/domit/xml_domit_rss.php b/libraries/domit/xml_domit_rss.php index ecf4550fd6f3b..f79135f316686 100644 --- a/libraries/domit/xml_domit_rss.php +++ b/libraries/domit/xml_domit_rss.php @@ -105,7 +105,7 @@ class xml_domit_rss_document extends xml_domit_rss_base_document { * @return Object A new instance of xml_domit_rss_document */ function xml_domit_rss_document($url = '', $cacheDir = './', $cacheTime = '3600') { - $this->parser = 'DOMIT_RSS'; + $this->parser = 'DOMIT_RSS'; $this->xml_domit_rss_base_document($url, $cacheDir, $cacheTime); } //xml_domit_rss_document @@ -145,9 +145,9 @@ function _init() { $this->indexer[$tagName] = new xml_domit_rss_textinput($currNode); break; case DOMIT_RSS_ELEMENT_TITLE: - case DOMIT_RSS_ELEMENT_LINK: - case DOMIT_RSS_ELEMENT_DESCRIPTION: - case DOMIT_RSS_ELEMENT_LANGUAGE: + case DOMIT_RSS_ELEMENT_LINK: + case DOMIT_RSS_ELEMENT_DESCRIPTION: + case DOMIT_RSS_ELEMENT_LANGUAGE: case DOMIT_RSS_ELEMENT_COPYRIGHT: case DOMIT_RSS_ELEMENT_MANAGINGEDITOR: case DOMIT_RSS_ELEMENT_WEBMASTER: @@ -159,10 +159,10 @@ function _init() { case DOMIT_RSS_ELEMENT_RATING: case DOMIT_RSS_ELEMENT_SKIPHOURS: case DOMIT_RSS_ELEMENT_SKIPDAYS: - $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); - break; + $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); + break; default: - $this->addIndexedElement($currNode); + $this->addIndexedElement($currNode); //$this->indexer[$tagName] =& $currNode; } } @@ -256,10 +256,10 @@ function _init() { case DOMIT_RSS_ELEMENT_SKIPDAYS: $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_skipdays($currNode); break; - case DOMIT_RSS_ELEMENT_TITLE: - case DOMIT_RSS_ELEMENT_LINK: - case DOMIT_RSS_ELEMENT_DESCRIPTION: - case DOMIT_RSS_ELEMENT_LANGUAGE: + case DOMIT_RSS_ELEMENT_TITLE: + case DOMIT_RSS_ELEMENT_LINK: + case DOMIT_RSS_ELEMENT_DESCRIPTION: + case DOMIT_RSS_ELEMENT_LANGUAGE: case DOMIT_RSS_ELEMENT_COPYRIGHT: case DOMIT_RSS_ELEMENT_MANAGINGEDITOR: case DOMIT_RSS_ELEMENT_WEBMASTER: @@ -269,10 +269,10 @@ function _init() { case DOMIT_RSS_ELEMENT_DOCS: case DOMIT_RSS_ELEMENT_TTL: case DOMIT_RSS_ELEMENT_RATING: - $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); - break; + $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); + break; default: - $this->addIndexedElement($currNode); + $this->addIndexedElement($currNode); //$this->DOMIT_RSS_indexer[$tagName] =& $currNode; } } @@ -518,32 +518,32 @@ function _init(){ $currNode =& $this->node->childNodes[$i]; $tagName = strtolower($currNode->nodeName); - switch ($tagName) { - case DOMIT_RSS_ELEMENT_CATEGORY: - $this->categories[$categoryCounter] = new xml_domit_rss_category($currNode); + switch ($tagName) { + case DOMIT_RSS_ELEMENT_CATEGORY: + $this->categories[$categoryCounter] = new xml_domit_rss_category($currNode); $categoryCounter++; - break; - case DOMIT_RSS_ELEMENT_ENCLOSURE: - $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_enclosure($currNode); - break; - case DOMIT_RSS_ELEMENT_SOURCE: - $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_source($currNode); - break; - case DOMIT_RSS_ELEMENT_GUID: - $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_guid($currNode); - break; - case DOMIT_RSS_ELEMENT_TITLE: - case DOMIT_RSS_ELEMENT_LINK: - case DOMIT_RSS_ELEMENT_DESCRIPTION: - case DOMIT_RSS_ELEMENT_AUTHOR: + break; + case DOMIT_RSS_ELEMENT_ENCLOSURE: + $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_enclosure($currNode); + break; + case DOMIT_RSS_ELEMENT_SOURCE: + $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_source($currNode); + break; + case DOMIT_RSS_ELEMENT_GUID: + $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_guid($currNode); + break; + case DOMIT_RSS_ELEMENT_TITLE: + case DOMIT_RSS_ELEMENT_LINK: + case DOMIT_RSS_ELEMENT_DESCRIPTION: + case DOMIT_RSS_ELEMENT_AUTHOR: case DOMIT_RSS_ELEMENT_COMMENTS: case DOMIT_RSS_ELEMENT_PUBDATE: - $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); - break; + $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); + break; default: - $this->addIndexedElement($currNode); - //$this->DOMIT_RSS_indexer[$tagName] =& $currNode; - } + $this->addIndexedElement($currNode); + //$this->DOMIT_RSS_indexer[$tagName] =& $currNode; + } } if ($categoryCounter != 0) { @@ -717,19 +717,19 @@ function _init(){ $currNode =& $this->node->childNodes[$i]; $tagName = strtolower($currNode->nodeName); - switch ($tagName) { - case DOMIT_RSS_ELEMENT_TITLE: - case DOMIT_RSS_ELEMENT_LINK: - case DOMIT_RSS_ELEMENT_DESCRIPTION: - case DOMIT_RSS_ELEMENT_URL: + switch ($tagName) { + case DOMIT_RSS_ELEMENT_TITLE: + case DOMIT_RSS_ELEMENT_LINK: + case DOMIT_RSS_ELEMENT_DESCRIPTION: + case DOMIT_RSS_ELEMENT_URL: case DOMIT_RSS_ELEMENT_WIDTH: case DOMIT_RSS_ELEMENT_HEIGHT: - $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); - break; + $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); + break; default: - $this->addIndexedElement($currNode); - //$this->DOMIT_RSS_indexer[$tagName] =& $currNode; - } + $this->addIndexedElement($currNode); + //$this->DOMIT_RSS_indexer[$tagName] =& $currNode; + } } } //_init @@ -768,7 +768,7 @@ function getWidth() { $myWidth = '88'; } else if (intval($myWidth) > 144) { - $myWidth = '144'; + $myWidth = '144'; } return $myWidth; @@ -785,7 +785,7 @@ function getHeight() { $myHeight = '31'; } else if (intval($myHeight) > 400) { - $myHeight = '400'; + $myHeight = '400'; } return $myHeight; @@ -828,17 +828,17 @@ function _init(){ $currNode =& $this->node->childNodes[$i]; $tagName = strtolower($currNode->nodeName); - switch ($tagName) { - case DOMIT_RSS_ELEMENT_TITLE: - case DOMIT_RSS_ELEMENT_LINK: - case DOMIT_RSS_ELEMENT_DESCRIPTION: - case DOMIT_RSS_ELEMENT_NAME: - $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); - break; + switch ($tagName) { + case DOMIT_RSS_ELEMENT_TITLE: + case DOMIT_RSS_ELEMENT_LINK: + case DOMIT_RSS_ELEMENT_DESCRIPTION: + case DOMIT_RSS_ELEMENT_NAME: + $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); + break; default: - $this->addIndexedElement($currNode); - //$this->DOMIT_RSS_indexer[$tagName] =& $currNode; - } + $this->addIndexedElement($currNode); + //$this->DOMIT_RSS_indexer[$tagName] =& $currNode; + } } } //_init @@ -997,7 +997,7 @@ function xml_domit_rss_guid(&$guid) { * @return string The guid text */ function getGuid() { - return $this->node->getText(); + return $this->node->getText(); } //getGuid /** @@ -1005,12 +1005,12 @@ function getGuid() { * @return boolean True if the guid is a permalink (default true) */ function isPermaLink() { - if (!$this->node->hasAttribute(DOMIT_RSS_ATTR_ISPERMALINK)) { - return true; - } - else { + if (!$this->node->hasAttribute(DOMIT_RSS_ATTR_ISPERMALINK)) { + return true; + } + else { return (strtolower($this->node->getAttribute(DOMIT_RSS_ATTR_ISPERMALINK)) == "true"); - } + } } //isPermaLink } //xml_domit_rss_guid @@ -1036,7 +1036,7 @@ function xml_domit_rss_source(&$source) { * @return string The source text */ function getSource() { - return $this->node->getText(); + return $this->node->getText(); } //getSource /** @@ -1070,7 +1070,7 @@ function xml_domit_rss_skipdays(&$skipdays) { * @return int The number of skip day items */ function getSkipDayCount() { - return $this->node->childCount; + return $this->node->childCount; } //getSkipDayCount /** @@ -1105,7 +1105,7 @@ function xml_domit_rss_skiphours(&$skiphours) { * @return int The number of skip hour items */ function getSkipHourCount() { - return $this->node->childCount; + return $this->node->childCount; } //getSkipHourCount /** diff --git a/libraries/domit/xml_domit_rss_lite.php b/libraries/domit/xml_domit_rss_lite.php index 0dacfa3a3fe48..41b427d16f57f 100644 --- a/libraries/domit/xml_domit_rss_lite.php +++ b/libraries/domit/xml_domit_rss_lite.php @@ -35,8 +35,8 @@ class xml_domit_rss_document_lite extends xml_domit_rss_base_document { * @param int Expiration time for a cache file */ function xml_domit_rss_document_lite($url = '', $cacheDir = './', $cacheTime = 3600) { - $this->parser = 'DOMIT_RSS_LITE'; - $this->xml_domit_rss_base_document($url, $cacheDir, $cacheTime); + $this->parser = 'DOMIT_RSS_LITE'; + $this->xml_domit_rss_base_document($url, $cacheDir, $cacheTime); } //xml_domit_rss_document_lite /** @@ -60,11 +60,11 @@ function _init() { $this->domit_rss_channels[$channelCounter] = new xml_domit_rss_channel_lite($currNode); $channelCounter++; break; - case DOMIT_RSS_ELEMENT_TITLE: - case DOMIT_RSS_ELEMENT_LINK: - case DOMIT_RSS_ELEMENT_DESCRIPTION: - $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); - break; + case DOMIT_RSS_ELEMENT_TITLE: + case DOMIT_RSS_ELEMENT_LINK: + case DOMIT_RSS_ELEMENT_DESCRIPTION: + $this->DOMIT_RSS_indexer[$tagName] = new xml_domit_rss_simpleelement($currNode); + break; } } diff --git a/libraries/domit/xml_domit_rss_shared.php b/libraries/domit/xml_domit_rss_shared.php index 1962d79cbaf0a..b036629f5fa21 100644 --- a/libraries/domit/xml_domit_rss_shared.php +++ b/libraries/domit/xml_domit_rss_shared.php @@ -54,7 +54,7 @@ * @author John Heinstein */ class xml_domit_rss_base { - /** @var Object The underlying DOMIT! node of the element */ + /** @var Object The underlying DOMIT! node of the element */ var $node = null; /** @var array A list of valid RSS defined child elements */ var $rssDefinedElements = array(); @@ -64,7 +64,7 @@ class xml_domit_rss_base { * @return Object The underlying DOMIT node */ function getNode() { - return $this->node; + return $this->node; } //getNode /** @@ -86,7 +86,7 @@ function getAttribute($attr) { * @return boolean True if the attribute exists */ function hasAttribute($attr) { - return (($this->node->nodeType == DOMIT_ELEMENT_NODE) && $this->node->hasAttribute($attr)); + return (($this->node->nodeType == DOMIT_ELEMENT_NODE) && $this->node->hasAttribute($attr)); } //hasAttribute /** @@ -95,16 +95,16 @@ function hasAttribute($attr) { * @return boolean True if the element is predefined by the RSS spec */ function isRSSDefined($elementName) { - $isDefined = false; + $isDefined = false; - foreach ($this->rssDefinedElements as $key => $value) { - if ($elementName == $value) { - $isDefined = true; - break; - } - } + foreach ($this->rssDefinedElements as $key => $value) { + if ($elementName == $value) { + $isDefined = true; + break; + } + } - return $isDefined; + return $isDefined; } //isRSSDefined /** @@ -113,13 +113,13 @@ function isRSSDefined($elementName) { * @return boolean True if the named element has a single child text node */ function isSimpleRSSElement($elementName) { - $elementName = strtolower($elementName); + $elementName = strtolower($elementName); if (isset($this->DOMIT_RSS_indexer[$elementName])) { - return (get_class($this->getElement($elementName)) == 'xml_domit_rss_simpleelement'); + return (get_class($this->getElement($elementName)) == 'xml_domit_rss_simpleelement'); } else { - return false; + return false; } } //isSimpleRSSElement @@ -129,18 +129,18 @@ function isSimpleRSSElement($elementName) { * @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities * @return string The string representation */ - function get($htmlSafe = false, $subEntities = false) { - return $this->node->toString($htmlSafe, $subEntities); + function get($htmlSafe = false, $subEntities = false) { + return $this->node->toString($htmlSafe, $subEntities); } //toString - /** + /** * Generates a normalized (formatted for readability) representation of the node and its children * @param boolean True if HTML readable output is desired * @param boolean True if illegal xml characters in text nodes and attributes should be converted to entities * @return string The formatted string representation */ function toNormalizedString($htmlSafe = false, $subEntities = false) { - return $this->node->toNormalizedString($htmlSafe, $subEntities); + return $this->node->toNormalizedString($htmlSafe, $subEntities); } //toNormalizedString } //xml_domit_rss_base @@ -153,7 +153,7 @@ function toNormalizedString($htmlSafe = false, $subEntities = false) { * @author John Heinstein */ class xml_domit_rss_collection extends xml_domit_rss_elementindexer { - /** @var array An array holding the collection of custom elements */ + /** @var array An array holding the collection of custom elements */ var $elements = array(); /** @var int The number of custom elements in the collection */ var $elementCount = 0; @@ -190,7 +190,7 @@ function &getElement($index) { * @return int The number of members in the collection */ function getElementCount() { - return $this->elementCount; + return $this->elementCount; } //getElementCount /** @@ -201,11 +201,11 @@ function getElementText() { $total = $this->getElementCount(); $result = ''; - for ($i = 0; $i < $total; $i++) { - $result .= $currElement->toString(); - } + for ($i = 0; $i < $total; $i++) { + $result .= $currElement->toString(); + } - return $result; + return $result; } //getElementText } //xml_domit_rss_collection @@ -240,23 +240,23 @@ function _init(){ * @param Object A DOMIT! node representing the custom element */ function addIndexedElement(&$node) { - $tagName = strtolower($node->nodeName); - - if (isset($this->DOMIT_RSS_indexer[$tagName])) { - if (strtolower(get_class($this->DOMIT_RSS_indexer[$tagName])) == 'domit_element') { - $collection = new xml_domit_rss_collection(); - $collection->addElement($this->DOMIT_RSS_indexer[$tagName]); - $collection->addElement($node); - $this->DOMIT_RSS_indexer[$tagName] =& $collection; - } - else { + $tagName = strtolower($node->nodeName); + + if (isset($this->DOMIT_RSS_indexer[$tagName])) { + if (strtolower(get_class($this->DOMIT_RSS_indexer[$tagName])) == 'domit_element') { + $collection = new xml_domit_rss_collection(); + $collection->addElement($this->DOMIT_RSS_indexer[$tagName]); + $collection->addElement($node); + $this->DOMIT_RSS_indexer[$tagName] =& $collection; + } + else { //Don't think I need this case??? - //$this->DOMIT_RSS_indexer[$tagName]->addElement($node); - } - } - else { - $this->DOMIT_RSS_indexer[$tagName] =& $node; - } + //$this->DOMIT_RSS_indexer[$tagName]->addElement($node); + } + } + else { + $this->DOMIT_RSS_indexer[$tagName] =& $node; + } } //addIndexedElement /** @@ -265,7 +265,7 @@ function addIndexedElement(&$node) { * @return boolean True if a collection of elements exists */ function isCollection($elementName) { - $elementName = strtolower($elementName); + $elementName = strtolower($elementName); if (isset($this->DOMIT_RSS_indexer[$elementName])) { return (get_class($this->DOMIT_RSS_indexer[$elementName]) == 'xml_domit_rss_collection'); @@ -281,7 +281,7 @@ function isCollection($elementName) { * @return boolean True if the requested element is a DOMIT! node */ function isNode($elementName) { - $elementName = strtolower($elementName); + $elementName = strtolower($elementName); if (isset($this->DOMIT_RSS_indexer[$elementName])) { return (strtolower(get_class($this->DOMIT_RSS_indexer[$elementName])) == 'domit_element'); @@ -297,7 +297,7 @@ function isNode($elementName) { * @return boolean True if the requested element is a DOMIT! node */ function isCustomRSSElement($elementName) { - return isNode($elementName); + return isNode($elementName); } //isCustomRSSElement /** @@ -342,7 +342,7 @@ function &getElement($elementName) { function &getElementAt($index) { $this->indexNumerically(); - if (isset($this->DOMIT_RSS_numericalIndexer[$index])) { + if (isset($this->DOMIT_RSS_numericalIndexer[$index])) { return $this->DOMIT_RSS_numericalIndexer[$index]; } else { @@ -358,10 +358,10 @@ function indexNumerically() { if (!isset($this->DOMIT_RSS_numericalIndexer)) { $counter = 0; - foreach ($this->DOMIT_RSS_indexer as $key => $value) { + foreach ($this->DOMIT_RSS_indexer as $key => $value) { $this->DOMIT_RSS_numericalIndexer[$counter] =& $this->DOMIT_RSS_indexer[$key]; $counter++; - } + } } } //indexNumerically @@ -372,7 +372,7 @@ function indexNumerically() { */ function getElementText($elementName) { $elementName = strtolower($elementName); - return $this->_getElementText($elementName, $this->DOMIT_RSS_indexer); + return $this->_getElementText($elementName, $this->DOMIT_RSS_indexer); } //getElementText /** @@ -381,9 +381,9 @@ function getElementText($elementName) { * @return string The element text, or an empty string */ function getElementTextAt($index) { - $this->indexNumerically(); + $this->indexNumerically(); - return $this->_getElementText($index, $this->DOMIT_RSS_numericalIndexer); + return $this->_getElementText($index, $this->DOMIT_RSS_numericalIndexer); } //getElementTextAt /** @@ -393,7 +393,7 @@ function getElementTextAt($index) { * @return string The element text, or an empty string */ function _getElementText($index, &$myArray) { - if (isset($myArray[$index])) { + if (isset($myArray[$index])) { $element =& $myArray[$index]; $result = ''; @@ -403,16 +403,16 @@ function _getElementText($index, &$myArray) { } else { switch (strtolower(get_class($element))) { - case 'xml_domit_rss_simpleelement': - $result = $element->getElementText(); - break; + case 'xml_domit_rss_simpleelement': + $result = $element->getElementText(); + break; - case 'xml_domit_rss_collection': - $result = $element->getElementText(); - break; + case 'xml_domit_rss_collection': + $result = $element->getElementText(); + break; case 'domit_element': - $total = $element->childCount; + $total = $element->childCount; for ($i = 0; $i < $total; $i++) { $currNode =& $element->childNodes[$i]; @@ -472,10 +472,10 @@ class xml_domit_rss_base_document extends xml_domit_rss_elementindexer { * @return mixed Null if an url was not provided, true if an url was provided and parsing was successful, false otherwise */ function xml_domit_rss_base_document ($url = '', $cacheDir = './', $cacheTime = 3600) { - $success = null; - $this->createDocument(); + $success = null; + $this->createDocument(); - if ($url != '') { //if rss data is from filesystem + if ($url != '') { //if rss data is from filesystem if (substr($url, 0, 4) != "http") { $rssText = $this->getTextFromFile($url); $this->parseRSS($rssText); @@ -484,9 +484,9 @@ function xml_domit_rss_base_document ($url = '', $cacheDir = './', $cacheTime = $this->createDefaultCache($cacheDir, $cacheTime); $success = $this->loadRSS($url, $cacheDir, $cacheTime); } - } + } - return $success; + return $success; } //xml_domit_rss_base_document /** @@ -511,7 +511,7 @@ function setRSSTimeout($rssTimeout) { * @param string The password, if authentication is required */ function setConnection($host, $path = '/', $port = 80, $timeout = 0, $user = null, $password = null) { - require_once(DOMIT_RSS_INCLUDE_PATH . 'php_http_client_generic.php'); + require_once(DOMIT_RSS_INCLUDE_PATH . 'php_http_client_generic.php'); $this->httpConnection = new php_http_client_generic($host, $path, $port, $timeout, $user, $password); } //setConnection @@ -562,14 +562,14 @@ function useHTTPClient($truthVal) { *@return string Either 'DOMIT_RSS' or 'DOMIT_RSS_LITE' */ function parsedBy() { - return $this->parser; + return $this->parser; } //parsedBy /** * Creates an empty DOMIT! document to contain the RSS nodes */ function createDocument() { - require_once(DOMIT_RSS_INCLUDE_PATH . 'xml_domit_include.php'); + require_once(DOMIT_RSS_INCLUDE_PATH . 'xml_domit_include.php'); $this->node = new DOMIT_Document(); $this->node->resolveErrors(true); } //createDocument @@ -585,18 +585,18 @@ function useCacheLite($doUseCacheLite, $pathToLibrary = './Lite.php', $cacheDir $this->useCacheLite = $doUseCacheLite; if ($doUseCacheLite) { - if (!file_exists($pathToLibrary)) { + if (!file_exists($pathToLibrary)) { $this->useCacheLite(false); - } - else { + } + else { require_once($pathToLibrary); $cacheOptions = array('cacheDir' => $cacheDir, 'lifeTime' => $cacheTime); $this->cache = new Cache_Lite($cacheOptions); - } + } } else { - $this->createDefaultCache($cacheDir, $cacheTime); + $this->createDefaultCache($cacheDir, $cacheTime); } } //useCacheLite @@ -606,7 +606,7 @@ function useCacheLite($doUseCacheLite, $pathToLibrary = './Lite.php', $cacheDir * @param int Expiration time for a cache file */ function createDefaultCache($cacheDir = './', $cacheTime = 3600) { - require_once(DOMIT_RSS_INCLUDE_PATH . 'php_text_cache.php'); + require_once(DOMIT_RSS_INCLUDE_PATH . 'php_text_cache.php'); $this->cache = new php_text_cache($cacheDir, $cacheTime, $this->rssTimeout); } //initDefaultCache @@ -628,10 +628,10 @@ function loadRSS($url) { return $this->parseRSS($rssText); } else { - if ($this->cacheEnabled && !isset($this->cache)) { + if ($this->cacheEnabled && !isset($this->cache)) { $this->createDefaultCache(); $this->cache->httpConnection =& $this->httpConnection; - } + } $success = $this->loadRSSData($url); @@ -649,8 +649,8 @@ function loadRSS($url) { * @return boolean True if parsing is successful */ function parseRSS($rssText) { - if ($this->cacheEnabled && !isset($this->cache)) $this->createDefaultCache(); - $success = $this->parseRSSData($rssText); + if ($this->cacheEnabled && !isset($this->cache)) $this->createDefaultCache(); + $success = $this->parseRSSData($rssText); if ($success) { $this->_init(); @@ -676,20 +676,20 @@ function loadRSSData($url) { */ function getDataFromCache($url) { if ($this->cacheEnabled) { - if ($this->useCacheLite) { - if ($rssText = $this->cache->get($url)) { - return $rssText; - } - else { - $rssText = $this->getTextFromFile($url); + if ($this->useCacheLite) { + if ($rssText = $this->cache->get($url)) { + return $rssText; + } + else { + $rssText = $this->getTextFromFile($url); if ($rssText != '') $this->cache->save($rssText, $url); - return $rssText; - } - } - else { + return $rssText; + } + } + else { $this->cache->useHTTPClient($this->doUseHTTPClient); - return $this->cache->getData($url); - } + return $this->cache->getData($url); + } } else { return $this->getTextFromFile($url); @@ -702,7 +702,7 @@ function getDataFromCache($url) { * @return boolean True if parsing is successful */ function parseRSSData($rssText) { - if ($rssText != '') { + if ($rssText != '') { return $this->fromString($rssText); } else { @@ -829,18 +829,18 @@ function getRSSVersion() { $total = strlen($xmlns); if (substr($xmlns, $total) == '/') { - $total--; + $total--; } for ($i = ($total - 1); $i > -1; $i--) { - $currentChar = substr($xmlns, $i); - - if ($currentChar == '/') { - break; - } - else { - $version = $currentChar . $version; - } + $currentChar = substr($xmlns, $i); + + if ($currentChar == '/') { + break; + } + else { + $version = $currentChar . $version; + } } } @@ -886,9 +886,9 @@ function xml_domit_rss_simpleelement(&$element) { * @return string The element text */ function getElementText() { - $element =& $this->node; - $result = ''; - $total = $element->childCount; + $element =& $this->node; + $result = ''; + $total = $element->childCount; for ($i = 0; $i < $total; $i++) { $currNode =& $element->childNodes[$i]; @@ -899,9 +899,9 @@ function getElementText() { else { $result .= $currNode->toString(); } - } + } - return $result; + return $result; } //getElementText } //xml_domit_rss_simpleelement diff --git a/libraries/domit/xml_domit_utilities.php b/libraries/domit/xml_domit_utilities.php index e51e4b7fb0cad..46f22bd576f72 100644 --- a/libraries/domit/xml_domit_utilities.php +++ b/libraries/domit/xml_domit_utilities.php @@ -27,9 +27,9 @@ class DOMIT_Utilities { * Raises an error if an attempt to instantiate the class is made */ function DOMIT_Utilities() { - die("DOMIT_Utilities Error: this is a static class that should never be instantiated.\n" . - "Please use the following syntax to access methods of this class:\n" . - 'DOMIT_Utilities::methodName(parameters)'); + die("DOMIT_Utilities Error: this is a static class that should never be instantiated.\n" . + "Please use the following syntax to access methods of this class:\n" . + 'DOMIT_Utilities::methodName(parameters)'); } //DOMIT_Utilities /** @@ -189,22 +189,22 @@ function getNormalizedElementString(&$node, $response, $node_level, //if node is childless if ($node->childCount == 0) { - if ($node->ownerDocument->doExpandEmptyElementTags) { + if ($node->ownerDocument->doExpandEmptyElementTags) { if (in_array($node->nodeName, $node->ownerDocument->expandEmptyElementExceptions)) { $response .= ' />'; } else { - $response .= '>nodeName . '>'; + $response .= '>nodeName . '>'; } - } - else { + } + else { if (in_array($node->nodeName, $node->ownerDocument->expandEmptyElementExceptions)) { $response .= '>nodeName . '>'; } else { $response .= ' />'; } - } + } } else { $response .= '>'; @@ -259,7 +259,7 @@ function isTextNode(&$node) { * @return string The indentation required for the specified node level */ function getIndentation($node_level) { - $INDENT_LEN = ' '; + $INDENT_LEN = ' '; $indentation = "\n"; for ($i = 0; $i < $node_level; $i++) { diff --git a/libraries/domit/xml_domit_xpath.php b/libraries/domit/xml_domit_xpath.php index de1e6fae369b3..fb36803ab91c0 100644 --- a/libraries/domit/xml_domit_xpath.php +++ b/libraries/domit/xml_domit_xpath.php @@ -32,7 +32,7 @@ * DOMIT! XPath is an XPath parser. */ class DOMIT_XPath { - /** @var Object The node from which the search is called */ + /** @var Object The node from which the search is called */ var $callingNode; /** @var Object The node that is the current parent of the search */ var $searchType; diff --git a/libraries/domit/xml_saxy_parser.php b/libraries/domit/xml_saxy_parser.php index a468a909dcba9..4fd6af7043dc1 100644 --- a/libraries/domit/xml_saxy_parser.php +++ b/libraries/domit/xml_saxy_parser.php @@ -94,7 +94,7 @@ * @author John Heinstein */ class SAXY_Parser extends SAXY_Parser_Base { - /** @var int The current error number */ + /** @var int The current error number */ var $errorCode = SAXY_XML_ERROR_NONE; /** @var Object A reference to the DocType event handler */ var $DTDHandler = null; @@ -501,16 +501,16 @@ function parseTag($tagText) { * @param Array The start element attributes */ function _fireStartElementEvent($tagName, &$myAttributes) { - $this->elementNameStack[] = $tagName; + $this->elementNameStack[] = $tagName; - if ($this->isNamespaceAware) { + if ($this->isNamespaceAware) { $this->detectStartNamespaceDeclaration($myAttributes); $tagName = $this->expandNamespacePrefix($tagName); $this->expandAttributePrefixes($myAttributes); - } + } - $this->fireStartElementEvent($tagName, $myAttributes); + $this->fireStartElementEvent($tagName, $myAttributes); } //_fireStartElementEvent /** @@ -518,21 +518,21 @@ function _fireStartElementEvent($tagName, &$myAttributes) { * @param Array The start element attributes */ function expandAttributePrefixes(&$myAttributes) { - $arTransform = array(); - - foreach ($myAttributes as $key => $value) { - if (strpos($key, 'xmlns') === false) { - if (strpos($key, ':') !== false) { - $expandedTag = $this->expandNamespacePrefix($key); - $arTransform[$key] = $expandedTag; - } - } - } - - foreach ($arTransform as $key => $value) { - $myAttributes[$value] = $myAttributes[$key]; - unset($myAttributes[$key]); - } + $arTransform = array(); + + foreach ($myAttributes as $key => $value) { + if (strpos($key, 'xmlns') === false) { + if (strpos($key, ':') !== false) { + $expandedTag = $this->expandNamespacePrefix($key); + $arTransform[$key] = $expandedTag; + } + } + } + + foreach ($arTransform as $key => $value) { + $myAttributes[$value] = $myAttributes[$key]; + unset($myAttributes[$key]); + } } //expandAttributePrefixes /** @@ -541,26 +541,26 @@ function expandAttributePrefixes(&$myAttributes) { * @return string The tagName, with the prefix expanded to the namespace uri */ function expandNamespacePrefix($tagName) { - $stackLen = count($this->defaultNamespaceStack); - $defaultNamespace = $this->defaultNamespaceStack[($stackLen - 1)]; + $stackLen = count($this->defaultNamespaceStack); + $defaultNamespace = $this->defaultNamespaceStack[($stackLen - 1)]; - $colonIndex = strpos($tagName, ':'); + $colonIndex = strpos($tagName, ':'); - if ($colonIndex !== false) { + if ($colonIndex !== false) { $prefix = substr($tagName, 0, $colonIndex); if ($prefix != 'xml') { - $tagName = $this->getNamespaceURI($prefix) . substr($tagName, $colonIndex); + $tagName = $this->getNamespaceURI($prefix) . substr($tagName, $colonIndex); } else { $tagName = SAXY_XML_NAMESPACE . substr($tagName, $colonIndex); } - } - else if ($defaultNamespace != '') { - $tagName = $defaultNamespace . ':' . $tagName; - } + } + else if ($defaultNamespace != '') { + $tagName = $defaultNamespace . ':' . $tagName; + } - return $tagName; + return $tagName; } //expandNamespacePrefix /** @@ -569,21 +569,21 @@ function expandNamespacePrefix($tagName) { * @return string The namespace uri */ function getNamespaceURI($prefix) { - $total = count($this->namespaceMap); - $uri = $prefix; //in case uri can't be found, just send back prefix - //should really generate an error, but worry about this later + $total = count($this->namespaceMap); + $uri = $prefix; //in case uri can't be found, just send back prefix + //should really generate an error, but worry about this later //reset($this->namespaceMap); - for ($i = ($total - 1); $i >= 0; $i--) { - $currMap =& $this->namespaceMap[$i]; + for ($i = ($total - 1); $i >= 0; $i--) { + $currMap =& $this->namespaceMap[$i]; - if (isset($currMap[$prefix])) { - $uri = $currMap[$prefix]; - break; - } - } + if (isset($currMap[$prefix])) { + $uri = $currMap[$prefix]; + break; + } + } - return $uri; + return $uri; } //getNamespaceURI /** @@ -591,26 +591,26 @@ function getNamespaceURI($prefix) { * @param Array The start element attributes */ function detectStartNamespaceDeclaration(&$myAttributes) { - $namespaceExists = false; - $namespaceMapUpper = 0; - $userDefinedDefaultNamespace = false; - $total = count($myAttributes); - - foreach ($myAttributes as $key => $value) { - if (strpos($key, 'xmlns') !== false) { - //add an array to store all namespaces for the current element - if (!$namespaceExists) { + $namespaceExists = false; + $namespaceMapUpper = 0; + $userDefinedDefaultNamespace = false; + $total = count($myAttributes); + + foreach ($myAttributes as $key => $value) { + if (strpos($key, 'xmlns') !== false) { + //add an array to store all namespaces for the current element + if (!$namespaceExists) { $this->namespaceMap[] = array(); $namespaceMapUpper = count($this->namespaceMap) - 1; - } + } //check for default namespace override, i.e. xmlns='...' if (strpos($key, ':') !== false) { - $prefix = $namespaceMapKey = substr($key, 6); - $this->namespaceMap[$namespaceMapUpper][$namespaceMapKey] = $value; + $prefix = $namespaceMapKey = substr($key, 6); + $this->namespaceMap[$namespaceMapUpper][$namespaceMapKey] = $value; } else { - $prefix = ''; + $prefix = ''; $userDefinedDefaultNamespace = true; //if default namespace '', store in map using key ':' @@ -618,26 +618,26 @@ function detectStartNamespaceDeclaration(&$myAttributes) { $this->defaultNamespaceStack[] = $value; } - $this->fireStartNamespaceDeclarationEvent($prefix, $value); - $namespaceExists = true; + $this->fireStartNamespaceDeclarationEvent($prefix, $value); + $namespaceExists = true; unset($myAttributes[$key]); - } - } + } + } - //store the default namespace (inherited from the parent elements so grab last one) + //store the default namespace (inherited from the parent elements so grab last one) if (!$userDefinedDefaultNamespace) { - $stackLen = count($this->defaultNamespaceStack); - if ($stackLen == 0) { - $this->defaultNamespaceStack[] = ''; - } - else { + $stackLen = count($this->defaultNamespaceStack); + if ($stackLen == 0) { + $this->defaultNamespaceStack[] = ''; + } + else { $this->defaultNamespaceStack[] = $this->defaultNamespaceStack[($stackLen - 1)]; - } + } } - $this->namespaceStack[] = $namespaceExists; + $this->namespaceStack[] = $namespaceExists; } //detectStartNamespaceDeclaration /** @@ -645,7 +645,7 @@ function detectStartNamespaceDeclaration(&$myAttributes) { * @param string The end element tag name */ function _fireEndElementEvent($tagName) { - $lastTagName = array_pop($this->elementNameStack); + $lastTagName = array_pop($this->elementNameStack); //check for mismatched tag error if ($lastTagName != $tagName) { @@ -653,13 +653,13 @@ function _fireEndElementEvent($tagName) { } if ($this->isNamespaceAware) { - $tagName = $this->expandNamespacePrefix($tagName); - $this->fireEndElementEvent($tagName); + $tagName = $this->expandNamespacePrefix($tagName); + $this->fireEndElementEvent($tagName); $this->detectEndNamespaceDeclaration(); $defaultNamespace = array_pop($this->defaultNamespaceStack); } else { - $this->fireEndElementEvent($tagName); + $this->fireEndElementEvent($tagName); } } //_fireEndElementEvent @@ -667,17 +667,17 @@ function _fireEndElementEvent($tagName) { * Determines whether an end namespace declaration event should be fired */ function detectEndNamespaceDeclaration() { - $isNamespaceEnded = array_pop($this->namespaceStack); + $isNamespaceEnded = array_pop($this->namespaceStack); - if ($isNamespaceEnded) { + if ($isNamespaceEnded) { $map = array_pop($this->namespaceMap); - foreach ($map as $key => $value) { - if ($key == ':') { + foreach ($map as $key => $value) { + if ($key == ':') { $key = ''; - } + } $this->fireEndNamespaceDeclarationEvent($key); - } + } } } //detectEndNamespaceDeclaration @@ -771,75 +771,75 @@ function xml_get_error_code() { */ function xml_error_string($code) { switch ($code) { - case SAXY_XML_ERROR_NONE: - return "No error"; - break; + case SAXY_XML_ERROR_NONE: + return "No error"; + break; case SAXY_XML_ERROR_NO_MEMORY: - return "Out of memory"; - break; + return "Out of memory"; + break; case SAXY_XML_ERROR_SYNTAX: - return "Syntax error"; - break; + return "Syntax error"; + break; case SAXY_XML_ERROR_NO_ELEMENTS: - return "No elements in document"; - break; + return "No elements in document"; + break; case SAXY_XML_ERROR_INVALID_TOKEN: - return "Invalid token"; - break; + return "Invalid token"; + break; case SAXY_XML_ERROR_UNCLOSED_TOKEN: - return "Unclosed token"; - break; + return "Unclosed token"; + break; case SAXY_XML_ERROR_PARTIAL_CHAR: - return "Partial character"; - break; + return "Partial character"; + break; case SAXY_XML_ERROR_TAG_MISMATCH: - return "Tag mismatch"; - break; + return "Tag mismatch"; + break; case SAXY_XML_ERROR_DUPLICATE_ATTRIBUTE: - return "Duplicate attribute"; - break; + return "Duplicate attribute"; + break; case SAXY_XML_ERROR_JUNK_AFTER_DOC_ELEMENT: - return "Junk encountered after document element"; - break; + return "Junk encountered after document element"; + break; case SAXY_XML_ERROR_PARAM_ENTITY_REF: - return "Parameter entity reference error"; - break; + return "Parameter entity reference error"; + break; case SAXY_XML_ERROR_UNDEFINED_ENTITY: - return "Undefined entity"; - break; + return "Undefined entity"; + break; case SAXY_XML_ERROR_RECURSIVE_ENTITY_REF: - return "Recursive entity reference"; - break; + return "Recursive entity reference"; + break; case SAXY_XML_ERROR_ASYNC_ENTITY: - return "Asynchronous internal entity found in external entity"; - break; + return "Asynchronous internal entity found in external entity"; + break; case SAXY_XML_ERROR_BAD_CHAR_REF: - return "Bad character reference"; - break; + return "Bad character reference"; + break; case SAXY_XML_ERROR_BINARY_ENTITY_REF: return "Binary entity reference"; - break; + break; case SAXY_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF: - return "Attribute external entity reference"; - break; + return "Attribute external entity reference"; + break; case SAXY_XML_ERROR_MISPLACED_XML_PI: - return "Misplaced processing instruction"; - break; + return "Misplaced processing instruction"; + break; case SAXY_XML_ERROR_UNKNOWN_ENCODING: - return "Unknown encoding"; - break; + return "Unknown encoding"; + break; case SAXY_XML_ERROR_INCORRECT_ENCODING: return "Incorrect encoding"; - break; + break; case SAXY_XML_ERROR_UNCLOSED_CDATA_SECTION: - return "Unclosed CDATA Section"; - break; + return "Unclosed CDATA Section"; + break; case SAXY_XML_ERROR_EXTERNAL_ENTITY_HANDLING: - return "Problem in external entity handling"; - break; + return "Problem in external entity handling"; + break; default: - return "No definition for error code " . $code; - break; + return "No definition for error code " . $code; + break; } } //xml_error_string diff --git a/libraries/domit/xml_saxy_shared.php b/libraries/domit/xml_saxy_shared.php index 6d7600776ec10..690947fd491e7 100644 --- a/libraries/domit/xml_saxy_shared.php +++ b/libraries/domit/xml_saxy_shared.php @@ -182,7 +182,7 @@ function parseAttributes($attrText) { if ($quoteType == $currentChar) { // Joomla! hack if (isset( $this ) && $this->convertEntities && $maybeEntity) { - $valueDump = strtr($valueDump, $this->predefinedEntities); + $valueDump = strtr($valueDump, $this->predefinedEntities); $valueDump = strtr($valueDump, $this->definedEntities); } @@ -207,7 +207,7 @@ function parseAttributes($attrText) { if ($quoteType == $currentChar) { // Joomla! hack if (isset( $this ) && $this->convertEntities && $maybeEntity) { - $valueDump = strtr($valueDump, $this->predefinedEntities); + $valueDump = strtr($valueDump, $this->predefinedEntities); $valueDump = strtr($valueDump, $this->definedEntities); } diff --git a/libraries/geshi/geshi/index.html b/libraries/geshi/geshi/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/geshi/geshi/index.html +++ b/libraries/geshi/geshi/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/geshi/index.html b/libraries/geshi/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/geshi/index.html +++ b/libraries/geshi/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/index.html b/libraries/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/index.html +++ b/libraries/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/joomla/application/application.php b/libraries/joomla/application/application.php index 86a2949c750e3..cbe50f1097aeb 100644 --- a/libraries/joomla/application/application.php +++ b/libraries/joomla/application/application.php @@ -28,7 +28,7 @@ * @since 1.5 */ -class JApplication extends JObject +abstract class JApplication extends JObject { /** * The client identifier. @@ -37,7 +37,7 @@ class JApplication extends JObject * @access protected * @since 1.5 */ - var $_clientId = null; + protected $_clientId = null; /** * The application message queue. @@ -45,7 +45,7 @@ class JApplication extends JObject * @var array * @access protected */ - var $_messageQueue = array(); + protected $_messageQueue = array(); /** * The name of the application @@ -53,7 +53,7 @@ class JApplication extends JObject * @var array * @access protected */ - var $_name = null; + protected $_name = null; /** * The scope of the application @@ -61,14 +61,16 @@ class JApplication extends JObject * @var string * @access public */ - var $scope = null; + public $scope = null; + + public $requestTime = null; /** * Class constructor. * * @param integer A client identifier. */ - function __construct($config = array()) + protected function __construct($config = array()) { jimport('joomla.utilities.utility'); @@ -115,7 +117,7 @@ function __construct($config = array()) * @return JApplication The appliction object. * @since 1.5 */ - function &getInstance($client, $config = array(), $prefix = 'J') + public static function &getInstance($client, $config = array(), $prefix = 'J') { static $instances; @@ -140,8 +142,7 @@ function &getInstance($client, $config = array(), $prefix = 'J') } else { - $error = JError::raiseError(500, 'Unable to load application: '.$client); - return $error; + throw new JException('Unable to load application: '.$client, 500, E_ERROR, $info, true); } $instances[$client] =& $instance; @@ -156,7 +157,7 @@ function &getInstance($client, $config = array(), $prefix = 'J') * @param array An optional associative array of configuration settings. * @access public */ - function initialise($options = array()) + public function initialise($options = array()) { jimport('joomla.plugin.helper'); @@ -186,7 +187,7 @@ function initialise($options = array()) * @abstract * @access public */ - function route() + public function route() { // get the full request URI $uri = clone(JURI::getInstance()); @@ -207,7 +208,7 @@ function route() * @abstract * @access public */ - function dispatch($component) + public function dispatch($component) { $document =& JFactory::getDocument(); @@ -228,7 +229,7 @@ function dispatch($component) * @abstract * @access public */ - function render() + public function render() { $params = array( 'template' => $this->getTemplate(), @@ -247,7 +248,7 @@ function render() * @access public * @param int Exit code */ - function close( $code = 0 ) { + public function close( $code = 0 ) { exit($code); } @@ -261,14 +262,14 @@ function close( $code = 0 ) { * sent this will be accomplished using a JavaScript statement. * * @access public - * @param string $url The URL to redirect to. + * @param string $url The URL to redirect to. Can only be http/https URL * @param string $msg An optional message to display on redirect. * @param string $msgType An optional message type. * @return none; calls exit(). * @since 1.5 * @see JApplication::enqueueMessage() */ - function redirect( $url, $msg='', $msgType='message' ) + public function redirect( $url, $msg='', $msgType='message' ) { // check for relative internal links if (preg_match( '#^index[2]?.php#', $url )) { @@ -279,6 +280,25 @@ function redirect( $url, $msg='', $msgType='message' ) $url = preg_split("/[\r\n]/", $url); $url = $url[0]; + // If we don't start with a http we need to fix this before we proceed + // We could validly start with something else (e.g. ftp), though this would + // be unlikely and isn't supported by this API + if(!preg_match( '#^http#', $url )) { + $uri =& JURI::getInstance(); + $prefix = $uri->toString(Array('scheme', 'user', 'pass', 'host', 'port')); + if($url[0] == '/') { + // we just need the prefix since we have a path relative to the root + $url = $prefix . $url; + } else { + // its relative to where we are now, so lets add that + $parts = explode('/', $uri->toString(Array('path'))); + array_pop($parts); + $path = implode('/',$parts).'/'; + $url = $prefix . $path . $url; + } + } + + // If the message exists, enqueue it if (trim( $msg )) { $this->enqueueMessage($msg, $msgType); @@ -314,7 +334,7 @@ function redirect( $url, $msg='', $msgType='message' ) * @return void * @since 1.5 */ - function enqueueMessage( $msg, $type = 'message' ) + public function enqueueMessage( $msg, $type = 'message' ) { // For empty queue, if messages exists in the session, enqueue them first if (!count($this->_messageQueue)) @@ -337,7 +357,7 @@ function enqueueMessage( $msg, $type = 'message' ) * @return The system message queue. * @since 1.5 */ - function getMessageQueue() + public function getMessageQueue() { // For empty queue, if messages exists in the session, enqueue them if (!count($this->_messageQueue)) @@ -360,7 +380,7 @@ function getMessageQueue() * @return mixed The user state. * @example application/japplication-getcfg.php Getting a configuration value */ - function getCfg( $varname ) + public function getCfg( $varname ) { $config =& JFactory::getConfig(); return $config->getValue('config.' . $varname); @@ -376,7 +396,7 @@ function getCfg( $varname ) * @return string The name of the dispatcher * @since 1.5 */ - function getName() + public function getName() { $name = $this->_name; @@ -384,7 +404,7 @@ function getName() { $r = null; if ( !preg_match( '/J(.*)/i', get_class( $this ), $r ) ) { - JError::raiseError(500, "JApplication::getName() : Can\'t get or parse class name."); + throw new JException("JApplication::getName() : Can\'t get or parse class name.", 500, E_ERROR, $name, true); } $name = strtolower( $r[1] ); } @@ -399,7 +419,7 @@ function getName() * @param string The path of the state. * @return mixed The user state. */ - function getUserState( $key ) + public function getUserState( $key ) { $session =& JFactory::getSession(); $registry =& $session->get('registry'); @@ -417,7 +437,7 @@ function getUserState( $key ) * @param string The value of the variable. * @return mixed The previous state, if one existed. */ - function setUserState( $key, $value ) + public function setUserState( $key, $value ) { $session =& JFactory::getSession(); $registry =& $session->get('registry'); @@ -437,7 +457,7 @@ function setUserState( $key, $value ) * @param string Filter for the variable, for valid values see {@link JFilterInput::clean()}. Optional. * @return The request user state. */ - function getUserStateFromRequest( $key, $request, $default = null, $type = 'none' ) + public function getUserStateFromRequest( $key, $request, $default = null, $type = 'none' ) { $old_state = $this->getUserState( $key ); $cur_state = (!is_null($old_state)) ? $old_state : $default; @@ -462,7 +482,7 @@ function getUserStateFromRequest( $key, $request, $default = null, $type = 'none * @return void * @since 1.5 */ - function registerEvent($event, $handler) + public function registerEvent($event, $handler) { $dispatcher =& JDispatcher::getInstance(); $dispatcher->register($event, $handler); @@ -477,7 +497,7 @@ function registerEvent($event, $handler) * @return array An array of results from each function call. * @since 1.5 */ - function triggerEvent($event, $args=null) + public function triggerEvent($event, $args=null) { $dispatcher =& JDispatcher::getInstance(); return $dispatcher->trigger($event, $args); @@ -501,12 +521,12 @@ function triggerEvent($event, $args=null) * @access public * @since 1.5 */ - function login($credentials, $options = array()) + public function login($credentials, $options = array()) { // Get the global JAuthentication object jimport( 'joomla.user.authentication'); - $authenticate = & JAuthentication::getInstance(); - $response = $authenticate->authenticate($credentials, $options); + $authenticate = &JAuthentication::getInstance(); + $response = $authenticate->authenticate($credentials, $options); if ($response->status === JAUTHENTICATE_STATUS_SUCCESS) { @@ -568,7 +588,7 @@ function login($credentials, $options = array()) * * @access public */ - function logout($userid = null, $options = array()) + public function logout($userid = null, $options = array()) { // Initialize variables $retval = false; @@ -613,7 +633,7 @@ function logout($userid = null, $options = array()) * * @return string */ - function getTemplate() + public function getTemplate() { return 'system'; } @@ -626,7 +646,7 @@ function getTemplate() * @return JRouter. * @since 1.5 */ - function &getRouter($name = null, $options = array()) + public function &getRouter($name = null, $options = array()) { if(!isset($name)) { $name = $this->_name; @@ -634,10 +654,6 @@ function &getRouter($name = null, $options = array()) jimport( 'joomla.application.router' ); $router =& JRouter::getInstance($name, $options); - if (JError::isError($router)) { - $null = null; - return $null; - } return $router; } @@ -649,7 +665,7 @@ function &getRouter($name = null, $options = array()) * @return object JPathway. * @since 1.5 */ - function &getPathway($name = null, $options = array()) + public function &getPathway($name = null, $options = array()) { if(!isset($name)) { $name = $this->_name; @@ -657,10 +673,6 @@ function &getPathway($name = null, $options = array()) jimport( 'joomla.application.pathway' ); $pathway =& JPathway::getInstance($name, $options); - if (JError::isError($pathway)) { - $null = null; - return $null; - } return $pathway; } @@ -672,7 +684,7 @@ function &getPathway($name = null, $options = array()) * @return object JMenu. * @since 1.5 */ - function &getMenu($name = null, $options = array()) + public function &getMenu($name = null, $options = array()) { if(!isset($name)) { $name = $this->_name; @@ -680,10 +692,6 @@ function &getMenu($name = null, $options = array()) jimport( 'joomla.application.menu' ); $menu =& JMenu::getInstance($name, $options); - if (JError::isError($menu)) { - $null = null; - return $null; - } return $menu; } @@ -694,11 +702,11 @@ function &getMenu($name = null, $options = array()) * @param string $file The path to the configuration file * return JConfig */ - function &_createConfiguration($file) + protected function &_createConfiguration($file) { jimport( 'joomla.registry.registry' ); - require_once( $file ); + require_once $file; // Create the JConfig object $config = new JConfig(); @@ -725,7 +733,7 @@ function &_createConfiguration($file) * @return object JSession on success. May call exit() on database error. * @since 1.5 */ - function &_createSession( $name ) + protected function &_createSession( $name ) { $options = array(); $options['name'] = $name; @@ -744,7 +752,7 @@ function &_createSession( $name ) //Session doesn't exist yet, initalise and store it in the session table $session->set('registry', new JRegistry('session')); - $session->set('user', new JUser()); + $session->set('user', JUser::getInstance()); if (!$storage->insert( $session->getId(), $this->getClientId())) { jexit( $storage->getError()); @@ -761,7 +769,7 @@ function &_createSession( $name ) * @return int A client identifier. * @since 1.5 */ - function getClientId( ) + public function getClientId( ) { return $this->_clientId; } @@ -773,9 +781,9 @@ function getClientId( ) * @return boolean True if this application is administrator. * @since 1.0.2 */ - function isAdmin() + public function isAdmin() { - return ($this->_clientId == 1); + return ($this->_name == 'administrator'); } /** @@ -785,295 +793,8 @@ function isAdmin() * @return boolean True if this application is site. * @since 1.5 */ - function isSite() - { - return ($this->_clientId == 0); - } - - /** - * Deprecated functions - */ - - /** - * Deprecated, use JPathWay->addItem() method instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @see JPathWay::addItem() - */ - function appendPathWay( $name, $link = null ) - { - /* - * To provide backward compatability if no second parameter is set - * set it to null - */ - if ($link == null) { - $link = ''; - } - - $pathway =& $this->getPathway(); - - if( defined( '_JLEGACY' ) && $link == '' ) - { - $matches = array(); - - $links = preg_match_all ( '/]+href="([^"]*)"[^>]*>([^<]*)<\/a>/ui', $name, $matches, PREG_SET_ORDER ); - - foreach( $matches AS $match) { - // Add each item to the pathway object - if( !$pathway->addItem( $match[2], $match[1] ) ) { - return false; - } - } - return true; - } - else - { - // Add item to the pathway object - if ($pathway->addItem($name, $link)) { - return true; - } - } - - return false; - } - - /** - * Deprecated, use JPathway->getPathWayNames() method instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @see JPathWay::getPathWayNames() - */ - function getCustomPathWay() - { - $pathway = $this->getPathway(); - return $pathway->getPathWayNames(); - } - - /** - * Deprecated, use JDocument->get( 'head' ) instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @see JDocument - * @see JObject::get() - */ - function getHead() - { - $document=& JFactory::getDocument(); - return $document->get('head'); - } - - /** - * Deprecated, use JDocument->setMetaData instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @param string Name of the metadata tag - * @param string Content of the metadata tag - * @param string Deprecated, ignored - * @param string Deprecated, ignored - * @see JDocument::setMetaData() - */ - function addMetaTag( $name, $content, $prepend = '', $append = '' ) - { - $document=& JFactory::getDocument(); - $document->setMetadata($name, $content); - } - - /** - * Deprecated, use JDocument->setMetaData instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @param string Name of the metadata tag - * @param string Content of the metadata tag - * @see JDocument::setMetaData() - */ - function appendMetaTag( $name, $content ) - { - $this->addMetaTag($name, $content); - } - - /** - * Deprecated, use JDocument->setMetaData instead - * - * @since 1.0 - * @deprecated As of version 1.5 - * @param string Name of the metadata tag - * @param string Content of the metadata tag - * @see JDocument::setMetaData() - */ - function prependMetaTag( $name, $content ) - { - $this->addMetaTag($name, $content); - } - - /** - * Deprecated, use JDocument->addCustomTag instead (only when document type is HTML). - * - * @since 1.0 - * @deprecated As of version 1.5 - * @param string Valid HTML - * @see JDocumentHTML::addCustomTag() - */ - function addCustomHeadTag( $html ) - { - $document=& JFactory::getDocument(); - if($document->getType() == 'html') { - $document->addCustomTag($html); - } - } - - /** - * Deprecated. - * - * @since 1.0 - * @deprecated As of version 1.5 - */ - function getBlogSectionCount( ) - { - $menus = &JSite::getMenu(); - return count($menus->getItems('type', 'content_blog_section')); - } - - /** - * Deprecated. - * - * @since 1.0 - * @deprecated As of version 1.5 - */ - function getBlogCategoryCount( ) - { - $menus = &JSite::getMenu(); - return count($menus->getItems('type', 'content_blog_category')); - } - - /** - * Deprecated. - * - * @since 1.0 - * @deprecated As of version 1.5 - */ - function getGlobalBlogSectionCount( ) - { - $menus = &JSite::getMenu(); - return count($menus->getItems('type', 'content_blog_section')); - } - - /** - * Deprecated. - * - * @since 1.0 - * @deprecated As of version 1.5 - */ - function getStaticContentCount( ) - { - $menus = &JSite::getMenu(); - return count($menus->getItems('type', 'content_typed')); - } - - /** - * Deprecated. - * - * @since 1.0 - * @deprecated As of version 1.5 - */ - function getContentItemLinkCount( ) - { - $menus = &JSite::getMenu(); - return count($menus->getItems('type', 'content_item_link')); - } - - /** - * Deprecated, use JApplicationHelper::getPath instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @see JApplicationHelper::getPath() - */ - function getPath($varname, $user_option = null) - { - jimport('joomla.application.helper'); - return JApplicationHelper::getPath ($varname, $user_option); - } - - /** - * Deprecated, use JURI::base() instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @see JURI::base() - */ - function getBasePath($client=0, $addTrailingSlash = true) - { - return JURI::base(); - } - - /** - * Deprecated, use JFactory::getUser instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @see JFactory::getUser() - */ - function &getUser() - { - $user =& JFactory::getUser(); - return $user; - } - - /** - * Deprecated, use ContentHelper::getItemid instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @see ContentHelperRoute::getArticleRoute() - */ - function getItemid( $id ) - { - require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'; - - // Load the article data to know what section/category it is in. - $article =& JTable::getInstance('content'); - $article->load($id); - - $needles = array( - 'article' => (int) $id, - 'category' => (int) $article->catid, - 'section' => (int) $article->sectionid, - ); - - $item = ContentHelperRoute::_findItem($needles); - $return = is_object($item) ? $item->id : null; - - return $return; - } - - /** - * Deprecated, use JDocument::setTitle instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @see JDocument::setTitle() - */ - function setPageTitle( $title=null ) - { - $document=& JFactory::getDocument(); - $document->setTitle($title); - } - - /** - * Deprecated, use JDocument::getTitle instead. - * - * @since 1.0 - * @deprecated As of version 1.5 - * @see JDocument::getTitle() - */ - function getPageTitle() + public function isSite() { - $document=& JFactory::getDocument(); - return $document->getTitle(); + return ($this->_name == 'site'); } } diff --git a/libraries/joomla/application/component/controller.php b/libraries/joomla/application/component/controller.php index cac4935e42726..64bf309643f1f 100644 --- a/libraries/joomla/application/component/controller.php +++ b/libraries/joomla/application/component/controller.php @@ -1,721 +1,724 @@ - array() - ); - - /** - * URL for redirection. - * - * @var string - * @access protected - */ - var $_redirect = null; - - /** - * Redirect message. - * - * @var string - * @access protected - */ - var $_message = null; - - /** - * Redirect message type. - * - * @var string - * @access protected - */ - var $_messageType = null; - - /** - * ACO Section for the controller. - * - * @var string - * @access protected - */ - var $_acoSection = null; - - /** - * Default ACO Section value for the controller. - * - * @var string - * @access protected - */ - var $_acoSectionValue = null; - - /** - * Constructor. - * - * @access protected - * @param array An optional associative array of configuration settings. - * Recognized key values include 'name', 'default_task', 'model_path', and - * 'view_path' (this list is not meant to be comprehensive). - * @since 1.5 - */ - function __construct( $config = array() ) - { - //Initialize private variables - $this->_redirect = null; - $this->_message = null; - $this->_messageType = 'message'; - $this->_taskMap = array(); - $this->_methods = array(); - $this->_data = array(); - - // Get the methods only for the final controller class - $thisMethods = get_class_methods( get_class( $this ) ); - $baseMethods = get_class_methods( 'JController' ); - $methods = array_diff( $thisMethods, $baseMethods ); - - // Add default display method - $methods[] = 'display'; - - // Iterate through methods and map tasks - foreach ( $methods as $method ) - { - if ( substr( $method, 0, 1 ) != '_' ) { - $this->_methods[] = strtolower( $method ); - // auto register public methods as tasks - $this->_taskMap[strtolower( $method )] = $method; - } - } - - //set the view name - if (empty( $this->_name )) - { - if (array_key_exists('name', $config)) { - $this->_name = $config['name']; - } else { - $this->_name = $this->getName(); - } - } - - // Set a base path for use by the controller - if (array_key_exists('base_path', $config)) { - $this->_basePath = $config['base_path']; - } else { - $this->_basePath = JPATH_COMPONENT; - } - - // If the default task is set, register it as such - if ( array_key_exists( 'default_task', $config ) ) { - $this->registerDefaultTask( $config['default_task'] ); - } else { - $this->registerDefaultTask( 'display' ); - } - - // set the default model search path - if ( array_key_exists( 'model_path', $config ) ) { - // user-defined dirs - $this->addModelPath($config['model_path']); - } else { - $this->addModelPath($this->_basePath.DS.'models'); - } - - // set the default view search path - if ( array_key_exists( 'view_path', $config ) ) { - // user-defined dirs - $this->_setPath( 'view', $config['view_path'] ); - } else { - $this->_setPath( 'view', $this->_basePath.DS.'views' ); - } - } - - /** - * Execute a task by triggering a method in the derived class. - * - * @access public - * @param string The task to perform. If no matching task is found, the - * '__default' task is executed, if defined. - * @return mixed|false The value returned by the called method, false in - * error case. - * @since 1.5 - */ - function execute( $task ) - { - $this->_task = $task; - - $task = strtolower( $task ); - if (isset( $this->_taskMap[$task] )) { - $doTask = $this->_taskMap[$task]; - } elseif (isset( $this->_taskMap['__default'] )) { - $doTask = $this->_taskMap['__default']; - } else { - return JError::raiseError( 404, JText::_('Task ['.$task.'] not found') ); - } - - // Record the actual task being fired - $this->_doTask = $doTask; - - // Make sure we have access - if ($this->authorize( $doTask )) - { - $retval = $this->$doTask(); - return $retval; - } - else - { - return JError::raiseError( 403, JText::_('Access Forbidden') ); - } - - } - - /** - * Authorization check - * - * @access public - * @param string $task The ACO Section Value to check access on - * @return boolean True if authorized - * @since 1.5 - */ - function authorize( $task ) - { - // Only do access check if the aco section is set - if ($this->_acoSection) - { - // If we have a section value set that trumps the passed task ??? - if ($this->_acoSectionValue) { - // We have one, so set it and lets do the check - $task = $this->_acoSectionValue; - } - // Get the JUser object for the current user and return the authorization boolean - $user = & JFactory::getUser(); - return $user->authorize( $this->_acoSection, $task ); - } - else - { - // Nothing set, nothing to check... so obviously its ok :) - return true; - } - } - - /** - * Typical view method for MVC based architecture - * - * This function is provide as a default implementation, in most cases - * you will need to override it in your own controllers. - * - * @access public - * @param string $cachable If true, the view output will be cached - * @since 1.5 - */ - function display($cachable=false) - { - $document =& JFactory::getDocument(); - - $viewType = $document->getType(); - $viewName = JRequest::getCmd( 'view', $this->getName() ); - $viewLayout = JRequest::getCmd( 'layout', 'default' ); - - $view = & $this->getView( $viewName, $viewType, '', array( 'base_path'=>$this->_basePath)); - - // Get/Create the model - if ($model = & $this->getModel($viewName)) { - // Push the model into the view (as default) - $view->setModel($model, true); - } - - // Set the layout - $view->setLayout($viewLayout); - - // Display the view - if ($cachable) { - global $option; - $cache =& JFactory::getCache($option, 'view'); - $cache->get($view, 'display'); - } else { - $view->display(); - } - } - - /** - * Redirects the browser or returns false if no redirect is set. - * - * @access public - * @return boolean False if no redirect exists. - * @since 1.5 - */ - function redirect() - { - if ($this->_redirect) { - global $mainframe; - $mainframe->redirect( $this->_redirect, $this->_message, $this->_messageType ); - } - return false; - } - - /** - * Method to get a model object, loading it if required. - * - * @access public - * @param string The model name. Optional. - * @param string The class prefix. Optional. - * @param array Configuration array for model. Optional. - * @return object The model. - * @since 1.5 - */ - function &getModel( $name = '', $prefix = '', $config = array() ) - { - if ( empty( $name ) ) { - $name = $this->getName(); - } - - if ( empty( $prefix ) ) { - $prefix = $this->getName() . 'Model'; - } - - if ( $model = & $this->_createModel( $name, $prefix, $config ) ) - { - // task is a reserved state - $model->setState( 'task', $this->_task ); - - // Lets get the application object and set menu information if its available - $app = &JFactory::getApplication(); - $menu = &$app->getMenu(); - if (is_object( $menu )) - { - if ($item = $menu->getActive()) - { - $params =& $menu->getParams($item->id); - // Set Default State Data - $model->setState( 'parameters.menu', $params ); - } - } - } - return $model; - } - - /** - * Adds to the stack of model paths in LIFO order. - * - * @static - * @param string|array The directory (string), or list of directories - * (array) to add. - * @return void - */ - function addModelPath( $path ) - { - jimport('joomla.application.component.model'); - JModel::addIncludePath($path); - } - - /** - * Gets the available tasks in the controller. - * @access public - * @return array Array[i] of task names. - * @since 1.5 - */ - function getTasks() - { - return $this->_methods; - } - - /** - * Get the last task that is or was to be performed. - * - * @access public - * @return string The task that was or is being performed. - * @since 1.5 - */ - function getTask() - { - return $this->_task; - } - - /** - * Method to get the controller name - * - * The dispatcher name by default parsed using the classname, or it can be set - * by passing a $config['name'] in the class constructor - * - * @access public - * @return string The name of the dispatcher - * @since 1.5 - */ - function getName() - { - $name = $this->_name; - - if (empty( $name )) - { - $r = null; - if ( !preg_match( '/(.*)Controller/i', get_class( $this ), $r ) ) { - JError::raiseError(500, "JController::getName() : Cannot get or parse class name."); - } - $name = strtolower( $r[1] ); - } - - return $name; - } - - /** - * Method to get a reference to the current view and load it if necessary. - * - * @access public - * @param string The view name. Optional, defaults to the controller - * name. - * @param string The view type. Optional. - * @param string The class prefix. Optional. - * @param array Configuration array for view. Optional. - * @return object Reference to the view or an error. - * @since 1.5 - */ - function &getView( $name = '', $type = '', $prefix = '', $config = array() ) - { - static $views; - - if ( !isset( $views ) ) { - $views = array(); - } - - if ( empty( $name ) ) { - $name = $this->getName(); - } - - if ( empty( $prefix ) ) { - $prefix = $this->getName() . 'View'; - } - - if ( empty( $views[$name] ) ) - { - if ( $view = & $this->_createView( $name, $prefix, $type, $config ) ) { - $views[$name] = & $view; - } else { - $result = JError::raiseError( - 500, JText::_( 'View not found [name, type, prefix]:' ) - . ' ' . $name . ',' . $type . ',' . $prefix - ); - return $result; - } - } - - return $views[$name]; - } - - /** - * Add one or more view paths to the controller's stack, in LIFO order. - * - * @static - * @param string|array The directory (string), or list of directories - * (array) to add. - * @return void - */ - function addViewPath( $path ) - { - $this->_addPath( 'view', $path ); - } - - /** - * Register (map) a task to a method in the class. - * - * @access public - * @param string The task. - * @param string The name of the method in the derived class to perform - * for this task. - * @return void - * @since 1.5 - */ - function registerTask( $task, $method ) - { - if ( in_array( strtolower( $method ), $this->_methods ) ) { - $this->_taskMap[strtolower( $task )] = $method; - } - } - - /** - * Register the default task to perform if a mapping is not found. - * - * @access public - * @param string The name of the method in the derived class to perform if - * a named task is not found. - * @return void - * @since 1.5 - */ - function registerDefaultTask( $method ) - { - $this->registerTask( '__default', $method ); - } - - /** - * Sets the internal message that is passed with a redirect - * - * @access public - * @param string The message - * @return string Previous message - * @since 1.5 - */ - function setMessage( $text ) - { - $previous = $this->_message; - $this->_message = $text; - return $previous; - } - - /** - * Set a URL for browser redirection. - * - * @access public - * @param string URL to redirect to. - * @param string Message to display on redirect. Optional, defaults to - * value set internally by controller, if any. - * @param string Message type. Optional, defaults to 'message'. - * @return void - * @since 1.5 - */ - function setRedirect( $url, $msg = null, $type = 'message' ) - { - $this->_redirect = $url; - if ($msg !== null) { - // controller may have set this directly - $this->_message = $msg; - } - $this->_messageType = $type; - } - - /** - * Sets the access control levels. - * - * @access public - * @param string The ACO section (eg, the component). - * @param string The ACO section value (if using a constant value). - * @return void - * @since 1.5 - */ - function setAccessControl( $section, $value = null ) - { - $this->_acoSection = $section; - $this->_acoSectionValue = $value; - } - - /** - * Method to load and return a model object. - * - * @access private - * @param string The name of the model. - * @param string Optional model prefix. - * @param array Configuration array for the model. Optional. - * @return mixed Model object on success; otherwise null - * failure. - * @since 1.5 - */ - function &_createModel( $name, $prefix = '', $config = array()) - { - $result = null; - - // Clean the model name - $modelName = preg_replace( '/[^A-Z0-9_]/i', '', $name ); - $classPrefix = preg_replace( '/[^A-Z0-9_]/i', '', $prefix ); - - $result =& JModel::getInstance($modelName, $classPrefix, $config); - return $result; - } - - /** - * Method to load and return a view object. This method first looks in the - * current template directory for a match, and failing that uses a default - * set path to load the view class file. - * - * Note the "name, prefix, type" order of parameters, which differs from the - * "name, type, prefix" order used in related public methods. - * - * @access private - * @param string The name of the view. - * @param string Optional prefix for the view class name. - * @param string The type of view. - * @param array Configuration array for the view. Optional. - * @return mixed View object on success; null or error result on failure. - * @since 1.5 - */ - function &_createView( $name, $prefix = '', $type = '', $config = array() ) - { - $result = null; - - // Clean the view name - $viewName = preg_replace( '/[^A-Z0-9_]/i', '', $name ); - $classPrefix = preg_replace( '/[^A-Z0-9_]/i', '', $prefix ); - $viewType = preg_replace( '/[^A-Z0-9_]/i', '', $type ); - - // Build the view class name - $viewClass = $classPrefix . $viewName; - - if ( !class_exists( $viewClass ) ) - { - jimport( 'joomla.filesystem.path' ); - $path = JPath::find( - $this->_path['view'], - $this->_createFileName( 'view', array( 'name' => $viewName, 'type' => $viewType) ) - ); - if ($path) { - require_once $path; - - if ( !class_exists( $viewClass ) ) { - $result = JError::raiseError( - 500, JText::_( 'View class not found [class, file]:' ) - . ' ' . $viewClass . ', ' . $path ); - return $result; - } - } else { - return $result; - } - } - - $result = new $viewClass($config); - return $result; - } - - /** - * Sets an entire array of search paths for resources. - * - * @access protected - * @param string The type of path to set, typically 'view' or 'model'. - * @param string|array The new set of search paths. If null or false, - * resets to the current directory only. - */ - function _setPath( $type, $path ) - { - // clear out the prior search dirs - $this->_path[$type] = array(); - - // actually add the user-specified directories - $this->_addPath( $type, $path ); - } - - /** - * Adds to the search path for templates and resources. - * - * @access protected - * @param string The path type (e.g. 'model', 'view'. - * @param string|array The directory or stream to search. - * @return void - */ - function _addPath( $type, $path ) - { - // just force path to array - settype( $path, 'array' ); - - // loop through the path directories - foreach ( $path as $dir ) - { - // no surrounding spaces allowed! - $dir = trim( $dir ); - - // add trailing separators as needed - if ( substr( $dir, -1 ) != DIRECTORY_SEPARATOR ) { - // directory - $dir .= DIRECTORY_SEPARATOR; - } - - // add to the top of the search dirs - array_unshift( $this->_path[$type], $dir ); - } - } - - /** - * Create the filename for a resource. - * - * @access private - * @param string The resource type to create the filename for. - * @param array An associative array of filename information. Optional. - * @return string The filename. - * @since 1.5 - */ - function _createFileName( $type, $parts = array() ) - { - $filename = ''; - - switch ( $type ) - { - case 'view': - if ( !empty( $parts['type'] ) ) { - $parts['type'] = '.'.$parts['type']; - } - - $filename = strtolower($parts['name']).DS.'view'.$parts['type'].'.php'; - break; - } - return $filename; - } -} \ No newline at end of file + array() + ); + + /** + * URL for redirection. + * + * @var string + * @access protected + */ + protected $_redirect = null; + + /** + * Redirect message. + * + * @var string + * @access protected + */ + protected $_message = null; + + /** + * Redirect message type. + * + * @var string + * @access protected + */ + protected $_messageType = null; + + /** + * ACO Section for the controller. + * + * @var string + * @access protected + */ + protected $_acoSection = null; + + /** + * Default ACO Section value for the controller. + * + * @var string + * @access protected + */ + protected $_acoSectionValue = null; + + protected $_params = null; + + /** + * Constructor. + * + * @access protected + * @param array An optional associative array of configuration settings. + * Recognized key values include 'name', 'default_task', 'model_path', and + * 'view_path' (this list is not meant to be comprehensive). + * @since 1.5 + */ + public function __construct( $config = array() ) + { + //Initialize private variables + $this->_redirect = null; + $this->_message = null; + $this->_messageType = 'message'; + $this->_taskMap = array(); + $this->_methods = array(); + $this->_data = array(); + + // Get the methods only for the final controller class + $thisMethods = get_class_methods( get_class( $this ) ); + $baseMethods = get_class_methods( 'JController' ); + $methods = array_diff( $thisMethods, $baseMethods ); + + // Add default display method + $methods[] = 'display'; + + // Iterate through methods and map tasks + foreach ( $methods as $method ) + { + if ( substr( $method, 0, 1 ) != '_' ) { + $this->_methods[] = strtolower( $method ); + // auto register public methods as tasks + $this->_taskMap[strtolower( $method )] = $method; + } + } + + //set the view name + if (empty( $this->_name )) + { + if (array_key_exists('name', $config)) { + $this->_name = $config['name']; + } else { + $this->_name = $this->getName(); + } + } + + // Set a base path for use by the controller + if (array_key_exists('base_path', $config)) { + $this->_basePath = $config['base_path']; + } else { + $this->_basePath = JPATH_COMPONENT; + } + + // If the default task is set, register it as such + if ( array_key_exists( 'default_task', $config ) ) { + $this->registerDefaultTask( $config['default_task'] ); + } else { + $this->registerDefaultTask( 'display' ); + } + + // set the default model search path + if ( array_key_exists( 'model_path', $config ) ) { + // user-defined dirs + $this->addModelPath($config['model_path']); + } else { + $this->addModelPath($this->_basePath.DS.'models'); + } + + // set the default view search path + if ( array_key_exists( 'view_path', $config ) ) { + // user-defined dirs + $this->_setPath( 'view', $config['view_path'] ); + } else { + $this->_setPath( 'view', $this->_basePath.DS.'views' ); + } + } + + /** + * Execute a task by triggering a method in the derived class. + * + * @access public + * @param string The task to perform. If no matching task is found, the + * '__default' task is executed, if defined. + * @return mixed|false The value returned by the called method, false in + * error case. + * @since 1.5 + */ + public function execute( $task ) + { + $this->_task = $task; + + $task = strtolower( $task ); + if (isset( $this->_taskMap[$task] )) { + $doTask = $this->_taskMap[$task]; + } elseif (isset( $this->_taskMap['__default'] )) { + $doTask = $this->_taskMap['__default']; + } else { + return JError::raiseError( 404, JText::_('Task ['.$task.'] not found') ); + } + + // Record the actual task being fired + $this->_doTask = $doTask; + + // Make sure we have access + if ($this->authorize( $doTask )) + { + $retval = $this->$doTask(); + return $retval; + } + else + { + return JError::raiseError( 403, JText::_('Access Forbidden') ); + } + + } + + /** + * Authorization check + * + * @access public + * @param string $task The ACO Section Value to check access on + * @return boolean True if authorized + * @since 1.5 + */ + public function authorize( $task ) + { + // Only do access check if the aco section is set + if ($this->_acoSection) + { + // If we have a section value set that trumps the passed task ??? + if ($this->_acoSectionValue) { + // We have one, so set it and lets do the check + $task = $this->_acoSectionValue; + } + // Get the JUser object for the current user and return the authorization boolean + $user = & JFactory::getUser(); + return $user->authorize( $this->_acoSection, $task ); + } + else + { + // Nothing set, nothing to check... so obviously its ok :) + return true; + } + } + + /** + * Typical view method for MVC based architecture + * + * This function is provide as a default implementation, in most cases + * you will need to override it in your own controllers. + * + * @access public + * @param string $cachable If true, the view output will be cached + * @since 1.5 + */ + public function display($cachable=false) + { + $document =& JFactory::getDocument(); + + $viewType = $document->getType(); + $viewName = JRequest::getCmd( 'view', $this->getName() ); + $viewLayout = JRequest::getCmd( 'layout', 'default' ); + + $view = & $this->getView( $viewName, $viewType, '', array( 'base_path'=>$this->_basePath)); + + // Get/Create the model + if ($model = & $this->getModel($viewName)) { + // Push the model into the view (as default) + $view->setModel($model, true); + } + + // Set the layout + $view->setLayout($viewLayout); + + // Display the view + if ($cachable && $viewType != 'feed') { + $component = JApplicationHelper::getComponentName(); + $cache = JFactory::getCache($component, 'view'); + $cache->get($view, 'display'); + } else { + $view->display(); + } + } + + /** + * Redirects the browser or returns false if no redirect is set. + * + * @access public + * @return boolean False if no redirect exists. + * @since 1.5 + */ + public function redirect() + { + if ($this->_redirect) { + $appl = JFactory::getApplication(); + $appl->redirect( $this->_redirect, $this->_message, $this->_messageType ); + } + return false; + } + + /** + * Method to get a model object, loading it if required. + * + * @access public + * @param string The model name. Optional. + * @param string The class prefix. Optional. + * @param array Configuration array for model. Optional. + * @return object The model. + * @since 1.5 + */ + public function &getModel( $name = '', $prefix = '', $config = array() ) + { + if ( empty( $name ) ) { + $name = $this->getName(); + } + + if ( empty( $prefix ) ) { + $prefix = $this->getName() . 'Model'; + } + + if ( $model = & $this->_createModel( $name, $prefix, $config ) ) + { + // task is a reserved state + $model->setState( 'task', $this->_task ); + + // Lets get the application object and set menu information if its available + $app = &JFactory::getApplication(); + $menu = &$app->getMenu(); + if (is_object( $menu )) + { + if ($item = $menu->getActive()) + { + $params =& $menu->getParams($item->id); + // Set Default State Data + $model->setState( 'parameters.menu', $params ); + } + } + } + return $model; + } + + /** + * Adds to the stack of model paths in LIFO order. + * + * @static + * @param string|array The directory (string), or list of directories (array) to add. + * @return void + */ + public function addModelPath( $path ) + { + jimport('joomla.application.component.model'); + JModel::addIncludePath($path); + } + + /** + * Gets the available tasks in the controller. + * @access public + * @return array Array[i] of task names. + * @since 1.5 + */ + public function getTasks() + { + return $this->_methods; + } + + /** + * Get the last task that is or was to be performed. + * + * @access public + * @return string The task that was or is being performed. + * @since 1.5 + */ + public function getTask() + { + return $this->_task; + } + + /** + * Method to get the controller name + * + * The dispatcher name by default parsed using the classname, or it can be set + * by passing a $config['name'] in the class constructor + * + * @access public + * @return string The name of the dispatcher + * @since 1.5 + */ + public function getName() + { + $name = $this->_name; + + if (empty( $name )) + { + $r = null; + if ( !preg_match( '/(.*)Controller/i', get_class( $this ), $r ) ) { + throw new JException('Cannot get or parse class name', 500, E_ERROR, $name, true); + } + $name = strtolower( $r[1] ); + } + + return $name; + } + + /** + * Method to get a reference to the current view and load it if necessary. + * + * @access public + * @param string The view name. Optional, defaults to the controller + * name. + * @param string The view type. Optional. + * @param string The class prefix. Optional. + * @param array Configuration array for view. Optional. + * @return object Reference to the view or an error. + * @since 1.5 + */ + public function &getView( $name = '', $type = '', $prefix = '', $config = array() ) + { + static $views; + + if ( !isset( $views ) ) { + $views = array(); + } + + if ( empty( $name ) ) { + $name = $this->getName(); + } + + if ( empty( $prefix ) ) { + $prefix = $this->getName() . 'View'; + } + + if ( empty( $views[$name] ) ) + { + if ( $view = & $this->_createView( $name, $prefix, $type, $config ) ) { + $views[$name] = & $view; + } else { + $result = JError::raiseError( + 500, JText::_( 'View not found [name, type, prefix]:' ) + . ' ' . $name . ',' . $type . ',' . $prefix + ); + return $result; + } + } + + return $views[$name]; + } + + /** + * Add one or more view paths to the controller's stack, in LIFO order. + * + * @static + * @param string|array The directory (string), or list of directories + * (array) to add. + * @return void + */ + public function addViewPath( $path ) + { + $this->_addPath( 'view', $path ); + } + + /** + * Register (map) a task to a method in the class. + * + * @access public + * @param string The task. + * @param string The name of the method in the derived class to perform for this task. + * @return void + * @since 1.5 + */ + public function registerTask( $task, $method ) + { + if ( in_array( strtolower( $method ), $this->_methods ) ) { + $this->_taskMap[strtolower( $task )] = $method; + } + } + + /** + * Register the default task to perform if a mapping is not found. + * + * @access public + * @param string The name of the method in the derived class to perform if + * a named task is not found. + * @return void + * @since 1.5 + */ + public function registerDefaultTask( $method ) + { + $this->registerTask( '__default', $method ); + } + + /** + * Sets the internal message that is passed with a redirect + * + * @access public + * @param string The message + * @return string Previous message + * @since 1.5 + */ + public function setMessage( $text ) + { + $previous = $this->_message; + $this->_message = $text; + return $previous; + } + + /** + * Set a URL for browser redirection. + * + * @access public + * @param string URL to redirect to. + * @param string Message to display on redirect. Optional, defaults to + * value set internally by controller, if any. + * @param string Message type. Optional, defaults to 'message'. + * @return void + * @since 1.5 + */ + public function setRedirect( $url, $msg = null, $type = 'message' ) + { + $this->_redirect = $url; + if ($msg !== null) { + // controller may have set this directly + $this->_message = $msg; + } + $this->_messageType = $type; + } + + /** + * Sets the access control levels. + * + * @access public + * @param string The ACO section (eg, the component). + * @param string The ACO section value (if using a constant value). + * @return void + * @since 1.5 + */ + public function setAccessControl( $section, $value = null ) + { + $this->_acoSection = $section; + $this->_acoSectionValue = $value; + } + + /** + * Method to load and return a model object. + * + * @access private + * @param string The name of the model. + * @param string Optional model prefix. + * @param array Configuration array for the model. Optional. + * @return mixed Model object on success; otherwise null + * failure. + * @since 1.5 + */ + private function &_createModel( $name, $prefix = '', $config = array()) + { + $result = null; + + // Clean the model name + $modelName = preg_replace( '/[^A-Z0-9_]/i', '', $name ); + $classPrefix = preg_replace( '/[^A-Z0-9_]/i', '', $prefix ); + + $result =& JModel::getInstance($modelName, $classPrefix, $config); + return $result; + } + + /** + * Method to load and return a view object. This method first looks in the + * current template directory for a match, and failing that uses a default + * set path to load the view class file. + * + * Note the "name, prefix, type" order of parameters, which differs from the + * "name, type, prefix" order used in related public methods. + * + * @access private + * @param string The name of the view. + * @param string Optional prefix for the view class name. + * @param string The type of view. + * @param array Configuration array for the view. Optional. + * @return mixed View object on success; null or error result on failure. + * @since 1.5 + */ + private function &_createView( $name, $prefix = '', $type = '', $config = array() ) + { + $result = null; + + // Clean the view name + $viewName = preg_replace( '/[^A-Z0-9_]/i', '', $name ); + $classPrefix = preg_replace( '/[^A-Z0-9_]/i', '', $prefix ); + $viewType = preg_replace( '/[^A-Z0-9_]/i', '', $type ); + + // Build the view class name + $viewClass = $classPrefix . $viewName; + + if ( !class_exists( $viewClass ) ) + { + jimport( 'joomla.filesystem.path' ); + $path = JPath::find( + $this->_path['view'], + $this->_createFileName( 'view', array( 'name' => $viewName, 'type' => $viewType) ) + ); + if ($path) { + require_once $path; + + if ( !class_exists( $viewClass ) ) { + $result = JError::raiseError( + 500, JText::_( 'View class not found [class, file]:' ) + . ' ' . $viewClass . ', ' . $path ); + return $result; + } + } else { + return $result; + } + } + + $result = new $viewClass($config); + return $result; + } + + /** + * Sets an entire array of search paths for resources. + * + * @access protected + * @param string The type of path to set, typically 'view' or 'model'. + * @param string|array The new set of search paths. If null or false, + * resets to the current directory only. + */ + protected function _setPath( $type, $path ) + { + // clear out the prior search dirs + $this->_path[$type] = array(); + + // actually add the user-specified directories + $this->_addPath( $type, $path ); + } + + /** + * Adds to the search path for templates and resources. + * + * @access protected + * @param string The path type (e.g. 'model', 'view'. + * @param string|array The directory or stream to search. + * @return void + */ + protected function _addPath( $type, $path ) + { + // just force path to array + settype( $path, 'array' ); + + // loop through the path directories + foreach ( $path as $dir ) + { + // no surrounding spaces allowed! + $dir = trim( $dir ); + + // add trailing separators as needed + if ( substr( $dir, -1 ) != DIRECTORY_SEPARATOR ) { + // directory + $dir .= DIRECTORY_SEPARATOR; + } + + // add to the top of the search dirs + array_unshift( $this->_path[$type], $dir ); + } + } + + /** + * Create the filename for a resource. + * + * @access private + * @param string The resource type to create the filename for. + * @param array An associative array of filename information. Optional. + * @return string The filename. + * @since 1.5 + */ + private function _createFileName( $type, $parts = array() ) + { + $filename = ''; + + switch ( $type ) + { + case 'view': + if ( !empty( $parts['type'] ) ) { + $parts['type'] = '.'.$parts['type']; + } + + $filename = strtolower($parts['name']).DS.'view'.$parts['type'].'.php'; + break; + } + return $filename; + } +} + diff --git a/libraries/joomla/application/component/helper.php b/libraries/joomla/application/component/helper.php index 65f9c3786f18c..499bf0a78c328 100644 --- a/libraries/joomla/application/component/helper.php +++ b/libraries/joomla/application/component/helper.php @@ -1,211 +1,203 @@ -enabled = $strict ? false : true; - $result->params = null; - } - - return $result; - } - - /** - * Checks if the component is enabled - * - * @access public - * @param string $component The component name - * @param boolean $string If set and a component does not exist, false will be returned - * @return boolean - */ - function isEnabled( $component, $strict = false ) - { - global $mainframe; - - $result = &JComponentHelper::getComponent( $component, $strict ); - return ($result->enabled | $mainframe->isAdmin()); - } - - /** - * Gets the parameter object for the component - * - * @access public - * @param string $name The component name - * @return object A JParameter object - */ - function &getParams( $name ) - { - static $instances; - if (!isset( $instances[$name] )) - { - $component = &JComponentHelper::getComponent( $name ); - $instances[$name] = new JParameter($component->params); - } - return $instances[$name]; - } - - function renderComponent($name = null, $params = array()) - { - global $mainframe, $option; - - if(empty($name)) { - // Throw 404 if no component - JError::raiseError(404, JText::_("Component Not Found")); - return; - } - - $scope = $mainframe->scope; //record the scope - $mainframe->scope = $name; //set scope to component name - - // Build the component path - $name = preg_replace('/[^A-Z0-9_\.-]/i', '', $name); - $file = substr( $name, 4 ); - - // Define component path - define( 'JPATH_COMPONENT', JPATH_BASE.DS.'components'.DS.$name); - define( 'JPATH_COMPONENT_SITE', JPATH_SITE.DS.'components'.DS.$name); - define( 'JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR.DS.'components'.DS.$name); - - // get component path - if ( $mainframe->isAdmin() && file_exists(JPATH_COMPONENT.DS.'admin.'.$file.'.php') ) { - $path = JPATH_COMPONENT.DS.'admin.'.$file.'.php'; - } else { - $path = JPATH_COMPONENT.DS.$file.'.php'; - } - - // If component disabled throw error - if (!JComponentHelper::isEnabled( $name ) || !file_exists($path)) { - JError::raiseError( 404, JText::_( 'Component Not Found' ) ); - } - - // Handle legacy globals if enabled - if ($mainframe->getCfg('legacy')) - { - // Include legacy globals - global $my, $database, $id, $acl, $task; - - // For backwards compatibility extract the config vars as globals - $registry =& JFactory::getConfig(); - foreach (get_object_vars($registry->toObject()) as $k => $v) - { - $varname = 'mosConfig_'.$k; - $$varname = $v; - } - $contentConfig = &JComponentHelper::getParams( 'com_content' ); - foreach (get_object_vars($contentConfig->toObject()) as $k => $v) - { - $varname = 'mosConfig_'.$k; - $$varname = $v; - } - $usersConfig = &JComponentHelper::getParams( 'com_users' ); - foreach (get_object_vars($usersConfig->toObject()) as $k => $v) - { - $varname = 'mosConfig_'.$k; - $$varname = $v; - } - - } - +enabled = $strict ? false : true; + $result->params = null; + } + + return $result; + } + + /** + * Checks if the component is enabled + * + * @access public + * @param string $component The component name + * @param boolean $string If set and a component does not exist, false will be returned + * @return boolean + */ + public static function isEnabled( $component, $strict = false ) + { + $appl = JFactory::getApplication(); + + $result = &JComponentHelper::getComponent( $component, $strict ); + return ($result->enabled | $appl->isAdmin()); + } + + /** + * Gets the parameter object for the component + * + * @access public + * @param string $name The component name + * @return object A JParameter object + */ + public static function &getParams( $name ) + { + static $instances; + if (!isset( $instances[$name] )) + { + $component = &JComponentHelper::getComponent( $name ); + $instances[$name] = new JParameter($component->params); + } + return $instances[$name]; + } + + /** + * Render a component + * + * @param string $name Name of the component + * @param array $params + * @return string Output from rendering the component + * @since 1.5 + */ + public static function renderComponent($name = null, $params = array()) + { + $component = JApplicationHelper::getComponentName(); + $appl = JFactory::getApplication(); + + //needed for backwards compatibility + // @todo if legacy ... + $mainframe =& $appl; + + if(empty($name)) { + // Throw 404 if no component + JError::raiseError(404, JText::_("Component Not Found")); + return; + } + + $scope = $appl->scope; //record the scope + $appl->scope = $name; //set scope to component name + + // Build the component path + $name = preg_replace('/[^A-Z0-9_\.-]/i', '', $name); + $file = substr( $name, 4 ); + + // Define component path + define( 'JPATH_COMPONENT', JPATH_BASE.DS.'components'.DS.$name); + define( 'JPATH_COMPONENT_SITE', JPATH_SITE.DS.'components'.DS.$name); + define( 'JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR.DS.'components'.DS.$name); + + // get component path + if ( $appl->isAdmin() && file_exists(JPATH_COMPONENT.DS.'admin.'.$file.'.php') ) { + $path = JPATH_COMPONENT.DS.'admin.'.$file.'.php'; + } else { + $path = JPATH_COMPONENT.DS.$file.'.php'; + } + + // If component disabled throw error + if (!JComponentHelper::isEnabled( $name ) || !file_exists($path)) { + JError::raiseError( 404, JText::_( 'Component Not Found' ) ); + } + $task = JRequest::getString( 'task' ); - - // Load common language files - $lang =& JFactory::getLanguage(); - $lang->load($name); - - // Handle template preview outlining - $contents = null; - - // Execute the component - ob_start(); - require_once $path; - $contents = ob_get_contents(); - ob_end_clean(); - - // Build the component toolbar - jimport( 'joomla.application.helper' ); - if (($path = JApplicationHelper::getPath( 'toolbar' )) && $mainframe->isAdmin()) { - - // Get the task again, in case it has changed - $task = JRequest::getString( 'task' ); - - // Make the toolbar - include_once( $path ); - } - - $mainframe->scope = $scope; //revert the scope - - return $contents; - } - - /** - * Load components - * - * @access private - * @return array - */ - function _load() - { - static $components; - - if (isset($components)) { - return $components; - } - - $db = &JFactory::getDBO(); - - $query = 'SELECT *' . - ' FROM #__components' . - ' WHERE parent = 0'; - $db->setQuery( $query ); - - if (!($components = $db->loadObjectList( 'option' ))) { - JError::raiseWarning( 'SOME_ERROR_CODE', "Error loading Components: " . $db->getErrorMsg()); - return false; - } - - return $components; - - } -} \ No newline at end of file + + // Load common language files + $lang =& JFactory::getLanguage(); + $lang->load($name); + + // @todo if ( $legacy ) + $option = $component; + + // Handle template preview outlining + $contents = null; + + // Execute the component + ob_start(); + require_once $path; + $contents = ob_get_contents(); + ob_end_clean(); + + // Build the component toolbar + jimport( 'joomla.application.helper' ); + if (($path = JApplicationHelper::getPath( 'toolbar' )) && $appl->isAdmin()) { + + // Get the task again, in case it has changed + $task = JRequest::getString( 'task' ); + + // Make the toolbar + include_once( $path ); + } + + $appl->scope = $scope; //revert the scope + + return $contents; + } + + /** + * Load components + * + * @access private + * @return array + */ + protected static function _load() + { + static $components; + + if (isset($components)) { + return $components; + } + + $db = &JFactory::getDBO(); + + $query = 'SELECT *' . + ' FROM #__components' . + ' WHERE parent = 0'; + $db->setQuery( $query ); + + try { + $components = $db->loadObjectList( 'option' ); + } catch (JException $e) { + JError::raiseWarning( 'SOME_ERROR_CODE', "Error loading Components: " . $db->getErrorMsg()); + return false; + } + + return $components; + + } +} + diff --git a/libraries/joomla/application/component/index.html b/libraries/joomla/application/component/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/application/component/index.html +++ b/libraries/joomla/application/component/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/application/component/model.php b/libraries/joomla/application/component/model.php index fc7e67e0c407b..4e9e75a550348 100644 --- a/libraries/joomla/application/component/model.php +++ b/libraries/joomla/application/component/model.php @@ -5,11 +5,6 @@ * @subpackage Application * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php -* Joomla! is free software. This version may have been modified pursuant -* to the GNU General Public License, and as distributed it includes or -* is derivative of works licensed under the GNU General Public License or -* other free or open source software licenses. -* See COPYRIGHT.php for copyright notices and details. */ // Check to ensure this file is within the rest of the framework @@ -26,38 +21,43 @@ * @subpackage Application * @since 1.5 */ -class JModel extends JObject +abstract class JModel extends JObject { /** * The model (base) name * * @var string - * @access protected */ - var $_name; + protected $_name; /** * Database Connector * * @var object - * @access protected */ - var $_db; + protected $_db; /** * An state object * * @var string - * @access protected */ - var $_state; + protected $_state; + + /** + * Indicates if the internal state has been set + * + * @var bool + * @since 1.6 + */ + protected $__state_set = null; /** * Constructor * * @since 1.5 */ - function __construct($config = array()) + public function __construct($config = array()) { //set the view name if (empty( $this->_name )) @@ -73,7 +73,7 @@ function __construct($config = array()) if (array_key_exists('state', $config)) { $this->_state = $config['state']; } else { - $this->_state = new JObject(); + $this->_state = new JStdClass(); } //set the model dbo @@ -89,6 +89,11 @@ function __construct($config = array()) } else if (defined( 'JPATH_COMPONENT_ADMINISTRATOR' )){ $this->addTablePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables'); } + + // set the internal state marker - used to ignore setting state from the request + if (!empty($config['ignore_request'])) { + $this->__state_set = true; + } } /** @@ -100,7 +105,7 @@ function __construct($config = array()) * @return mixed A model object, or false on failure * @since 1.5 */ - function &getInstance( $type, $prefix = '', $config = array() ) + public static function &getInstance( $type, $prefix = '', $config = array() ) { $type = preg_replace('/[^A-Z0-9_\.-]/i', '', $type); $modelClass = $prefix.ucfirst($type); @@ -119,8 +124,7 @@ function &getInstance( $type, $prefix = '', $config = array() ) if (!class_exists( $modelClass )) { - JError::raiseWarning( 0, 'Model class ' . $modelClass . ' not found in file.' ); - return $result; + throw new JException('Model class not found in file', 500, E_ERROR, $modelClass, true); } } else return $result; @@ -139,7 +143,7 @@ function &getInstance( $type, $prefix = '', $config = array() ) * @return mixed The previous value of the property * @since 1.5 */ - function setState( $property, $value=null ) + public function setState( $property, $value=null ) { return $this->_state->set($property, $value); } @@ -149,12 +153,13 @@ function setState( $property, $value=null ) * * @access public * @param string Optional parameter name + * @param mixed Optional default value * @return object The property where specified, the state object where omitted * @since 1.5 */ - function getState($property = null) + public function getState($property = null, $default = null) { - return $property === null ? $this->_state : $this->_state->get($property); + return $property === null ? $this->_state : $this->_state->get($property, $default); } /** @@ -164,7 +169,7 @@ function getState($property = null) * @return object JDatabase connector object * @since 1.5 */ - function &getDBO() + public function &getDBO() { return $this->_db; } @@ -176,7 +181,7 @@ function &getDBO() * @return void * @since 1.5 */ - function setDBO(&$db) + public function setDBO(&$db) { $this->_db =& $db; } @@ -191,7 +196,7 @@ function setDBO(&$db) * @return string The name of the model * @since 1.5 */ - function getName() + public function getName() { $name = $this->_name; @@ -199,7 +204,7 @@ function getName() { $r = null; if (!preg_match('/Model(.*)/i', get_class($this), $r)) { - JError::raiseError (500, "JModel::getName() : Can't get or parse class name."); + throw new JException('Can\'t get or parse class name', 500, E_ERROR, get_class($this), true); } $name = strtolower( $r[1] ); } @@ -217,7 +222,7 @@ function getName() * @return object The table * @since 1.5 */ - function &getTable($name='', $prefix='Table', $options = array()) + public function &getTable($name='', $prefix='Table', $options = array()) { if (empty($name)) { $name = $this->getName(); @@ -227,9 +232,7 @@ function &getTable($name='', $prefix='Table', $options = array()) return $table; } - JError::raiseError( 0, 'Table ' . $name . ' not supported. File not found.' ); - $null = null; - return $null; + throw new JException('Table not supported. File not found.', 500, E_ERROR, $name, true); } /** @@ -241,7 +244,7 @@ function &getTable($name='', $prefix='Table', $options = array()) * @return array An array with directory elements * @since 1.5 */ - function addIncludePath( $path='' ) + public function addIncludePath( $path='' ) { static $paths; @@ -262,7 +265,7 @@ function addIncludePath( $path='' ) * @param string|array The directory (-ies) to add. * @return void */ - function addTablePath($path) + public function addTablePath($path) { jimport('joomla.database.table'); JTable::addIncludePath($path); @@ -278,7 +281,7 @@ function addTablePath($path) * @access protected * @since 1.5 */ - function &_getList( $query, $limitstart=0, $limit=0 ) + protected function &_getList( $query, $limitstart=0, $limit=0 ) { $this->_db->setQuery( $query, $limitstart, $limit ); $result = $this->_db->loadObjectList(); @@ -294,7 +297,7 @@ function &_getList( $query, $limitstart=0, $limit=0 ) * @access protected * @since 1.5 */ - function _getListCount( $query ) + protected function _getListCount( $query ) { $this->_db->setQuery( $query ); $this->_db->query(); @@ -311,7 +314,7 @@ function _getListCount( $query ) * @return mixed Model object or boolean false if failed * @since 1.5 */ - function &_createTable( $name, $prefix = 'Table', $config = array()) + private function &_createTable( $name, $prefix = 'Table', $config = array()) { $result = null; @@ -337,7 +340,7 @@ function &_createTable( $name, $prefix = 'Table', $config = array()) * @return string The filename * @since 1.5 */ - function _createFileName($type, $parts = array()) + private function _createFileName($type, $parts = array()) { $filename = ''; @@ -350,4 +353,4 @@ function _createFileName($type, $parts = array()) } return $filename; } -} \ No newline at end of file +} diff --git a/libraries/joomla/application/component/view.php b/libraries/joomla/application/component/view.php index d791b014e6424..1d7b19c32c9a1 100644 --- a/libraries/joomla/application/component/view.php +++ b/libraries/joomla/application/component/view.php @@ -25,7 +25,7 @@ * @subpackage Application * @since 1.5 */ -class JView extends JObject +abstract class JView extends JObject { /** * The name of the view @@ -33,7 +33,7 @@ class JView extends JObject * @var array * @access protected */ - var $_name = null; + protected $_name = null; /** * Registered models @@ -41,7 +41,7 @@ class JView extends JObject * @var array * @access protected */ - var $_models = array(); + protected $_models = array(); /** * The base path of the view @@ -49,7 +49,7 @@ class JView extends JObject * @var string * @access protected */ - var $_basePath = null; + protected $_basePath = null; /** * The default model @@ -57,7 +57,7 @@ class JView extends JObject * @var string * @access protected */ - var $_defaultModel = null; + protected $_defaultModel = null; /** * Layout name @@ -65,7 +65,7 @@ class JView extends JObject * @var string * @access protected */ - var $_layout = 'default'; + protected $_layout = 'default'; /** * Layout extension @@ -73,7 +73,7 @@ class JView extends JObject * @var string * @access protected */ - var $_layoutExt = 'php'; + protected $_layoutExt = 'php'; /** * The set of search directories for resources (templates) @@ -81,7 +81,7 @@ class JView extends JObject * @var array * @access protected */ - var $_path = array( + protected $_path = array( 'template' => array(), 'helper' => array() ); @@ -92,7 +92,7 @@ class JView extends JObject * @var string * @access private */ - var $_template = null; + protected $_template = null; /** * The output of the template script. @@ -100,30 +100,34 @@ class JView extends JObject * @var string * @access private */ - var $_output = null; + protected $_output = null; /** - * Callback for escaping. - * - * @var string - * @access private - */ - var $_escape = 'htmlspecialchars'; + * Callback for escaping. + * + * @var string + * @access private + */ + protected $_escape = 'htmlspecialchars'; /** - * Charset to use in escaping mechanisms; defaults to urf8 (UTF-8) - * - * @var string - * @access private - */ - var $_charset = 'UTF-8'; + * Charset to use in escaping mechanisms; defaults to urf8 (UTF-8) + * + * @var string + * @access private + */ + protected $_charset = 'UTF-8'; + + public $baseurl = ''; + + protected $_data = array(); /** * Constructor * * @access protected */ - function __construct($config = array()) + public function __construct($config = array()) { //set the view name if (empty( $this->_name )) @@ -136,14 +140,14 @@ function __construct($config = array()) } // set the charset (used by the variable escaping functions) - if (array_key_exists('charset', $config)) { - $this->_charset = $config['charset']; - } + if (array_key_exists('charset', $config)) { + $this->_charset = $config['charset']; + } // user-defined escaping callback - if (array_key_exists('escape', $config)) { - $this->setEscape($config['escape']); - } + if (array_key_exists('escape', $config)) { + $this->setEscape($config['escape']); + } // Set a base path for use by the view if (array_key_exists('base_path', $config)) { @@ -178,6 +182,33 @@ function __construct($config = array()) $this->baseurl = JURI::base(true); } + /** + * Provides interception of default php error handling logic for objects. Enforceing class definitions + * + * @access public + * @throw Jexception + * @since 1.6 + */ + public function &__get($var) { + if(isset($this->_data[$var])) { + return $this->_data[$var]; + } + JError::raiseNotice(0, 'Attempted to access undefined object propery', $var); + return $this->$var; + } + + /** + * Provides interception of default php error handling logic for objects. Enforceing class definitions + * + * @access public + * @throw Jexception + * @since 1.6 + */ + public function __set($var, $val) { + JError::raiseNotice(0, 'Attempted to set undefined object propery', array('var'=>$var, 'val'=>$val)); + $this->_data[$var] = $val; + } + /** * Execute and display a template script. * @@ -187,13 +218,9 @@ function __construct($config = array()) * @throws object An JError object. * @see fetch() */ - function display($tpl = null) + public function display($tpl = null) { $result = $this->loadTemplate($tpl); - if (JError::isError($result)) { - return $result; - } - echo $result; } @@ -233,7 +260,7 @@ function display($tpl = null) * @access public * @return bool True on success, false on failure. */ - function assign() + public function assign() { // get the arguments; there may be 1 or 2. $arg0 = @func_get_arg(0); @@ -304,11 +331,15 @@ function assign() * @return bool True on success, false on failure. */ - function assignRef($key, &$val) + public function assignRef($key, &$val) { if (is_string($key) && substr($key, 0, 1) != '_') { - $this->$key =& $val; + if(array_key_exists($key, get_object_vars($this))) { + $this->$key =& $val; + } else { + $this->_data[$key] =& $val; + } return true; } @@ -316,22 +347,22 @@ function assignRef($key, &$val) } /** - * Escapes a value for output in a view script. - * - * If escaping mechanism is one of htmlspecialchars or htmlentities, uses - * {@link $_encoding} setting. - * - * @param mixed $var The output to escape. - * @return mixed The escaped value. - */ - function escape($var) - { - if (in_array($this->_escape, array('htmlspecialchars', 'htmlentities'))) { - return call_user_func($this->_escape, $var, ENT_COMPAT, $this->_charset); - } - - return call_user_func($this->_escape, $var); - } + * Escapes a value for output in a view script. + * + * If escaping mechanism is one of htmlspecialchars or htmlentities, uses + * {@link $_encoding} setting. + * + * @param mixed $var The output to escape. + * @return mixed The escaped value. + */ + public function escape($var) + { + if (in_array($this->_escape, array('htmlspecialchars', 'htmlentities'))) { + return call_user_func($this->_escape, $var, ENT_COMPAT, $this->_charset); + } + + return call_user_func($this->_escape, $var); + } /** * Method to get data from a registered model or a property of the view @@ -341,9 +372,8 @@ function escape($var) * @param string The name of the model to reference, or the default value [optional] * @return mixed The return value of the method */ - function &get( $property, $default = null ) + public function &get( $property, $default = null ) { - // If $model is null we use the default model if (is_null($default)) { $model = $this->_defaultModel; @@ -361,8 +391,8 @@ function &get( $property, $default = null ) if (method_exists($this->_models[$model], $method)) { // The method exists, lets call it and return what we get - $result = $this->_models[$model]->$method(); - return $result; + $result = $this->_models[$model]->$method(); + return $result; } } @@ -380,7 +410,7 @@ function &get( $property, $default = null ) * @param string $name The name of the model (optional) * @return mixed JModel object */ - function &getModel( $name = null ) + public function &getModel( $name = null ) { if ($name === null) { $name = $this->_defaultModel; @@ -395,7 +425,7 @@ function &getModel( $name = null ) * @return string The layout name */ - function getLayout() + public function getLayout() { return $this->_layout; } @@ -410,7 +440,7 @@ function getLayout() * @return string The name of the model * @since 1.5 */ - function getName() + public function getName() { $name = $this->_name; @@ -418,7 +448,7 @@ function getName() { $r = null; if (!preg_match('/View((view)*(.*(view)?.*))$/i', get_class($this), $r)) { - JError::raiseError (500, "JView::getName() : Cannot get or parse class name."); + throw new JException('Cannot get or parse class name', 500, E_ERROR, get_class($this), true); } if (strpos($r[3], "view")) { @@ -444,7 +474,7 @@ function getName() * @param boolean $default Is this the default model? * @return object The added model */ - function &setModel( &$model, $default = false ) + public function &setModel( &$model, $default = false ) { $name = strtolower($model->getName()); $this->_models[$name] = &$model; @@ -464,7 +494,7 @@ function &setModel( &$model, $default = false ) * @since 1.5 */ - function setLayout($layout) + public function setLayout($layout) { $previous = $this->_layout; $this->_layout = $layout; @@ -479,7 +509,7 @@ function setLayout($layout) * @return string Previous value * @since 1.5 */ - function setLayoutExt( $value ) + public function setLayoutExt( $value ) { $previous = $this->_layoutExt; if ($value = preg_replace( '#[^A-Za-z0-9]#', '', trim( $value ) )) { @@ -489,14 +519,14 @@ function setLayoutExt( $value ) } /** - * Sets the _escape() callback. - * - * @param mixed $spec The callback for _escape() to use. - */ - function setEscape($spec) - { - $this->_escape = $spec; - } + * Sets the _escape() callback. + * + * @param mixed $spec The callback for _escape() to use. + */ + public function setEscape($spec) + { + $this->_escape = $spec; + } /** * Adds to the stack of view script paths in LIFO order. @@ -504,7 +534,7 @@ function setEscape($spec) * @param string|array The directory (-ies) to add. * @return void */ - function addTemplatePath($path) + public function addTemplatePath($path) { $this->_addPath('template', $path); } @@ -515,7 +545,7 @@ function addTemplatePath($path) * @param string|array The directory (-ies) to add. * @return void */ - function addHelperPath($path) + public function addHelperPath($path) { $this->_addPath('helper', $path); } @@ -528,9 +558,10 @@ function addHelperPath($path) * automatically searches the template paths and compiles as needed. * @return string The output of the the template script. */ - function loadTemplate( $tpl = null) + public function loadTemplate( $tpl = null) { - global $mainframe, $option; + $appl = JFactory::getApplication(); + $option = JApplicationHelper::getComponentName(); // clear prior output $this->_output = null; @@ -571,7 +602,7 @@ function loadTemplate( $tpl = null) return $this->_output; } else { - return JError::raiseError( 500, 'Layout "' . $file . '" not found' ); + throw new JException('Layout file not found', 500, E_ERROR, $file, true); } } @@ -583,7 +614,7 @@ function loadTemplate( $tpl = null) * automatically searches the helper paths and compiles as needed. * @return boolean Returns true if the file was loaded */ - function loadHelper( $hlp = null) + public function loadHelper( $hlp = null) { // clean the file name $file = preg_replace('/[^A-Z0-9_\.-]/i', '', $hlp); @@ -607,9 +638,10 @@ function loadHelper( $hlp = null) * @param string|array $path The new set of search paths. If null or * false, resets to the current directory only. */ - function _setPath($type, $path) + protected function _setPath($type, $path) { - global $mainframe, $option; + $component = JApplicationHelper::getComponentName(); + $appl = JFactory::getApplication(); // clear out the prior search dirs $this->_path[$type] = array(); @@ -623,10 +655,10 @@ function _setPath($type, $path) case 'template': { // set the alternative template search dir - if (isset($mainframe)) + if (isset($appl)) { - $option = preg_replace('/[^A-Z0-9_\.-]/i', '', $option); - $fallback = JPATH_BASE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.$option.DS.$this->getName(); + $component = preg_replace('/[^A-Z0-9_\.-]/i', '', $component); + $fallback = JPATH_BASE.DS.'templates'.DS.$appl->getTemplate().DS.'html'.DS.$component.DS.$this->getName(); $this->_addPath('template', $fallback); } } break; @@ -639,7 +671,7 @@ function _setPath($type, $path) * @access protected * @param string|array $path The directory or stream to search. */ - function _addPath($type, $path) + protected function _addPath($type, $path) { // just force to array settype($path, 'array'); @@ -670,7 +702,7 @@ function _addPath($type, $path) * @return string The filename * @since 1.5 */ - function _createFileName($type, $parts = array()) + private function _createFileName($type, $parts = array()) { $filename = ''; @@ -686,4 +718,4 @@ function _createFileName($type, $parts = array()) } return $filename; } -} \ No newline at end of file +} diff --git a/libraries/joomla/application/helper.php b/libraries/joomla/application/helper.php index 278e2b2de7555..a2a510d7493be 100644 --- a/libraries/joomla/application/helper.php +++ b/libraries/joomla/application/helper.php @@ -23,8 +23,35 @@ * @subpackage Application * @since 1.5 */ -class JApplicationHelper +abstract class JApplicationHelper { + /** + * Return the name of the request component [main component] + * + * @param string $default The default option + * @access public + * @return string Option + * @since 1.6 + */ + function getComponentName($default = NULL) + { + static $option; + + if ( $option ) + { + return $option; + } + + $option = strtolower(JRequest::getCmd('option')); + + if(empty($option)) { + $option = $default; + } + + JRequest::setVar('option', $option); + return $option; + } + /** * Gets information on a specific client id. This method will be useful in * future versions when we start mapping applications in the database. @@ -35,7 +62,7 @@ class JApplicationHelper * @return mixed Object describing the client or false if not known * @since 1.5 */ - function &getClientInfo($id = null, $byName = false) + public static function &getClientInfo($id = null, $byName = false) { static $clients; @@ -103,7 +130,7 @@ function &getClientInfo($id = null, $byName = false) * @return string The requested path * @since 1.0 */ - function getPath( $varname, $user_option=null ) + public static function getPath( $varname, $user_option=null ) { // check needed for handling of custom/new module xml file loading $check = ( ( $varname == 'mod0_xml' ) || ( $varname == 'mod1_xml' ) ); @@ -145,6 +172,10 @@ function getPath( $varname, $user_option=null ) case 'admin': $path = DS.'components'.DS. $user_option .DS.'admin.'. $name .'.php'; $result = JApplicationHelper::_checkPath( $path, -1 ); + if ($result == null) { + $path = DS.'components'.DS. $user_option .DS. $name .'.php'; + $result = JApplicationHelper::_checkPath( $path, -1 ); + } break; case 'admin_html': @@ -201,7 +232,7 @@ function getPath( $varname, $user_option=null ) return $result; } - function parseXMLInstallFile($path) + public static function parseXMLInstallFile($path) { // Read the file to see if it's a valid component XML file $xml = & JFactory::getXMLParser('Simple'); @@ -222,6 +253,7 @@ function parseXMLInstallFile($path) } $data = array(); + $data['legacy'] = $xml->document->name() == 'mosinstall'; $element = & $xml->document->name[0]; $data['name'] = $element ? $element->data() : ''; @@ -254,7 +286,7 @@ function parseXMLInstallFile($path) return $data; } - function parseXMLLangMetaFile($path) + public static function parseXMLLangMetaFile($path) { // Read the file to see if it's a valid component XML file $xml = & JFactory::getXMLParser('Simple'); @@ -315,7 +347,7 @@ function parseXMLLangMetaFile($path) * @param integer $checkAdmin 0 to check site only, 1 to check site and admin, -1 to check admin only * @since 1.5 */ - function _checkPath( $path, $checkAdmin=1 ) + protected static function _checkPath( $path, $checkAdmin=1 ) { $file = JPATH_SITE . $path; if ($checkAdmin > -1 && file_exists( $file )) { diff --git a/libraries/joomla/application/index.html b/libraries/joomla/application/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/application/index.html +++ b/libraries/joomla/application/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/application/menu.php b/libraries/joomla/application/menu.php index 819687f9b4142..c600dc3f927e3 100644 --- a/libraries/joomla/application/menu.php +++ b/libraries/joomla/application/menu.php @@ -1,290 +1,287 @@ - - * @author Johan Janssens - * @package Joomla.Framework - * @subpackage Application - * @since 1.5 - */ -class JMenu extends JObject -{ - /** - * Array to hold the menu items - * - * @access private - * @param array - */ - var $_items = array (); - - /** - * Identifier of the default menu item - * - * @access private - * @param integer - */ - var $_default = 0; - - /** - * Identifier of the active menu item - * - * @access private - * @param integer - */ - var $_active = 0; - - - /** - * Class constructor - * - * @access public - * @return boolean True on success - */ - function __construct($options = array()) - { - $this->load(); //load the menu items - - foreach ($this->_items as $k => $item) - { - if ($item->home) { - $this->_default = $item->id; - } - } - } - - /** - * Returns a reference to a JMenu object - * - * This method must be invoked as: - *
        $menu = &JSite::getMenu();
      - * - * @access public - * @param string $client The name of the client - * @param array $options An associative array of options - * @return JMenu A menu object. - * @since 1.5 - */ - function &getInstance($client, $options = array()) - { - static $instances; - - if (!isset( $instances )) { - $instances = array(); - } - - if (empty($instances[$client])) - { - //Load the router object - $info =& JApplicationHelper::getClientInfo($client, true); - - $path = $info->path.DS.'includes'.DS.'menu.php'; - if(file_exists($path)) - { - require_once $path; - - // Create a JPathway object - $classname = 'JMenu'.ucfirst($client); - $instance = new $classname($options); - } - else - { - //$error = JError::raiseError( 500, 'Unable to load menu: '.$client); - $error = null; //Jinx : need to fix this - return $error; - } - - $instances[$client] = & $instance; - } - - return $instances[$client]; - } - - /** - * Get menu item by id - * - * @access public - * @param int The item id - * @return mixed The item object, or null if not found - */ - function &getItem($id) - { - $result = null; - if (isset($this->_items[$id])) { - $result = &$this->_items[$id]; - } - - return $result; - } - - /** - * Set the default item by id - * - * @param int The item id - * @access public - * @return True, if succesfull - */ - function setDefault($id) - { - if(isset($this->_items[$id])) { - $this->_default = $id; - return true; - } - - return false; - } - - /** - * Get menu item by id - * - * @access public - * - * @return object The item object - */ - function &getDefault() - { - $item =& $this->_items[$this->_default]; - return $item; - } - - /** - * Set the default item by id - * - * @param int The item id - * @access public - * @return If successfull the active item, otherwise null - */ - function &setActive($id) - { - if(isset($this->_items[$id])) - { - $this->_active = $id; - $result = &$this->_items[$id]; - return $result; - } - - $result = null; - return $result; - } - - /** - * Get menu item by id - * - * @access public - * - * @return object The item object - */ - function &getActive() - { - if ($this->_active) { - $item =& $this->_items[$this->_active]; - return $item; - } - - $result = null; - return $result; - } - - /** - * Gets menu items by attribute - * - * @access public - * @param string The field name - * @param string The value of the field - * @param boolean If true, only returns the first item found - * @return array - */ - function getItems($attribute, $value, $firstonly = false) - { - $items = null; - - foreach ($this->_items as $item) - { - if ( ! is_object($item) ) - continue; - - if ($item->$attribute == $value) - { - if($firstonly) { - return $item; - } - - $items[] = $item; - } - } - - return $items; - } - - /** - * Gets the parameter object for a certain menu item - * - * @access public - * @param int The item id - * @return object A JParameter object - */ - function &getParams($id) - { - $ini = ''; - if ($menu =& $this->getItem($id)) { - $ini = $menu->params; - } - $result = new JParameter( $ini ); - - return $result; - } - - /** - * Getter for the menu array - * - * @access public - * @param string $name The menu name - * @return array - */ - function getMenu() { - return $this->_items; - } - - /** - * Method to check JMenu object authorization against an access control - * object and optionally an access extension object - * - * @access public - * @param integer $id The menu id - * @param integer $accessid The users access identifier - * @return boolean True if authorized - */ - function authorize($id, $accessid = 0) - { - $menu =& $this->getItem($id); - return ((isset($menu->access) ? $menu->access : 0) <= $accessid); - } - - /** - * Loads the menu items - * - * @abstract - * @access public - * @return array - */ - function load() - { - return array(); - } -} \ No newline at end of file +load(); //load the menu items + + foreach ($this->_items as $k => $item) + { + if ($item->home) { + $this->_default = $item->id; + } + } + } + + /** + * Returns a reference to a JMenu object + * + * This method must be invoked as: + *
        $menu = &JSite::getMenu();
      + * + * @access public + * @param string $client The name of the client + * @param array $options An associative array of options + * @return JMenu A menu object. + * @since 1.5 + */ + public static function &getInstance($client, $options = array()) + { + static $instances; + + if (!isset( $instances )) { + $instances = array(); + } + + if (empty($instances[$client])) + { + //Load the router object + $info =& JApplicationHelper::getClientInfo($client, true); + + $path = $info->path.DS.'includes'.DS.'menu.php'; + if(file_exists($path)) + { + require_once $path; + + // Create a JPathway object + $classname = 'JMenu'.ucfirst($client); + $instance = new $classname($options); + } + else + { + throw new JException('Unable to load menu client', 500, E_ERROR, $client, true); + } + + $instances[$client] = & $instance; + } + + return $instances[$client]; + } + + /** + * Get menu item by id + * + * @access public + * @param int The item id + * @return mixed The item object, or null if not found + */ + public function &getItem($id) + { + $result = null; + if (isset($this->_items[$id])) { + $result = &$this->_items[$id]; + } + + return $result; + } + + /** + * Set the default item by id + * + * @param int The item id + * @access public + * @return True, if succesfull + */ + public function setDefault($id) + { + if(isset($this->_items[$id])) { + $this->_default = $id; + return true; + } + + return false; + } + + /** + * Get menu item by id + * + * @access public + * + * @return object The item object + */ + public function &getDefault() + { + $item =& $this->_items[$this->_default]; + return $item; + } + + /** + * Set the default item by id + * + * @param int The item id + * @access public + * @return If successfull the active item, otherwise null + */ + public function &setActive($id) + { + if(isset($this->_items[$id])) + { + $this->_active = $id; + $result = &$this->_items[$id]; + return $result; + } + + $result = null; + return $result; + } + + /** + * Get menu item by id + * + * @access public + * + * @return object The item object + */ + public function &getActive() + { + if ($this->_active) { + $item =& $this->_items[$this->_active]; + return $item; + } + + $result = null; + return $result; + } + + /** + * Gets menu items by attribute + * + * @access public + * @param string The field name + * @param string The value of the field + * @param boolean If true, only returns the first item found + * @return array + */ + public function getItems($attribute, $value, $firstonly = false) + { + $items = null; + + foreach ($this->_items as $item) + { + if ( ! is_object($item) ) + continue; + + if ($item->$attribute == $value) + { + if($firstonly) { + return $item; + } + + $items[] = $item; + } + } + + return $items; + } + + /** + * Gets the parameter object for a certain menu item + * + * @access public + * @param int The item id + * @return object A JParameter object + */ + public function &getParams($id) + { + $ini = ''; + if ($menu =& $this->getItem($id)) { + $ini = $menu->params; + } + $result = new JParameter( $ini ); + + return $result; + } + + /** + * Getter for the menu array + * + * @access public + * @param string $name The menu name + * @return array + */ + public function getMenu() { + return $this->_items; + } + + /** + * Method to check JMenu object authorization against an access control + * object and optionally an access extension object + * + * @access public + * @param integer $id The menu id + * @param integer $accessid The users access identifier + * @return boolean True if authorized + */ + public function authorize($id, $accessid = 0) + { + $menu =& $this->getItem($id); + return ((isset($menu->access) ? $menu->access : 0) <= $accessid); + } + + /** + * Loads the menu items + * + * @abstract + * @access public + * @return array + */ + public function load() + { + return array(); + } +} + diff --git a/libraries/joomla/application/module/helper.php b/libraries/joomla/application/module/helper.php index 3f340280868b8..e2c584b1fb399 100644 --- a/libraries/joomla/application/module/helper.php +++ b/libraries/joomla/application/module/helper.php @@ -22,12 +22,11 @@ * Module helper class * * @static - * @author Johan Janssens * @package Joomla.Framework * @subpackage Application * @since 1.5 */ -class JModuleHelper +abstract class JModuleHelper { /** * Get module by name (real, eg 'Breadcrumbs' or folder, eg 'mod_breadcrumbs') @@ -37,7 +36,7 @@ class JModuleHelper * @param string $title The title of the module, optional * @return object The Module object */ - function &getModule($name, $title = null ) + public static function &getModule($name, $title = null ) { $result = null; $modules =& JModuleHelper::_load(); @@ -81,7 +80,7 @@ function &getModule($name, $title = null ) * @param string $position The position of the module * @return array An array of module objects */ - function &getModules($position) + public static function &getModules($position) { $position = strtolower( $position ); $result = array(); @@ -113,48 +112,25 @@ function &getModules($position) * @param string $module The module name * @return boolean */ - function isEnabled( $module ) + public static function isEnabled( $module ) { $result = &JModuleHelper::getModule( $module); return (!is_null($result)); } - function renderModule($module, $attribs = array()) + public static function renderModule($module, $attribs = array()) { static $chrome; - global $mainframe, $option; + $option = JRequest::getCMD('option'); - $scope = $mainframe->scope; //record the scope - $mainframe->scope = $module->module; //set scope to component name + $appl = JFactory::getApplication(); - // Handle legacy globals if enabled - if ($mainframe->getCfg('legacy')) - { - // Include legacy globals - global $my, $database, $acl, $mosConfig_absolute_path; - - // Get the task variable for local scope - $task = JRequest::getString('task'); + //needed for backwards compatibility + // @todo if legacy ... + $mainframe =& $appl; - // For backwards compatibility extract the config vars as globals - $registry =& JFactory::getConfig(); - foreach (get_object_vars($registry->toObject()) as $k => $v) { - $name = 'mosConfig_'.$k; - $$name = $v; - } - $contentConfig = &JComponentHelper::getParams( 'com_content' ); - foreach (get_object_vars($contentConfig->toObject()) as $k => $v) - { - $name = 'mosConfig_'.$k; - $$name = $v; - } - $usersConfig = &JComponentHelper::getParams( 'com_users' ); - foreach (get_object_vars($usersConfig->toObject()) as $k => $v) - { - $name = 'mosConfig_'.$k; - $$name = $v; - } - } + $scope = $appl->scope; //record the scope + $appl->scope = $module->module; //set scope to component name // Get module parameters $params = new JParameter( $module->params ); @@ -181,12 +157,12 @@ function renderModule($module, $attribs = array()) $chrome = array(); } - require_once (JPATH_BASE.DS.'templates'.DS.'system'.DS.'html'.DS.'modules.php'); - $chromePath = JPATH_BASE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.'modules.php'; + require_once JPATH_BASE.DS.'templates'.DS.'system'.DS.'html'.DS.'modules.php'; + $chromePath = JPATH_BASE.DS.'templates'.DS.$appl->getTemplate().DS.'html'.DS.'modules.php'; if (!isset( $chrome[$chromePath])) { if (file_exists($chromePath)) { - require_once ($chromePath); + require_once $chromePath; } $chrome[$chromePath] = true; } @@ -217,7 +193,7 @@ function renderModule($module, $attribs = array()) } } - $mainframe->scope = $scope; //revert the scope + $appl->scope = $scope; //revert the scope return $module->content; } @@ -231,12 +207,12 @@ function renderModule($module, $attribs = array()) * @return string The path to the module layout * @since 1.5 */ - function getLayoutPath($module, $layout = 'default') + public static function getLayoutPath($module, $layout = 'default') { - global $mainframe; + $appl = JFactory::getApplication(); // Build the template and base path for the layout - $tPath = JPATH_BASE.DS.'templates'.DS.$mainframe->getTemplate().DS.'html'.DS.$module.DS.$layout.'.php'; + $tPath = JPATH_BASE.DS.'templates'.DS.$appl->getTemplate().DS.'html'.DS.$module.DS.$layout.'.php'; $bPath = JPATH_BASE.DS.'modules'.DS.$module.DS.'tmpl'.DS.$layout.'.php'; // If the template has a layout override use it @@ -253,56 +229,88 @@ function getLayoutPath($module, $layout = 'default') * @access private * @return array */ - function &_load() + protected static function &_load() { - global $mainframe, $Itemid; + $Itemid = JRequest::getInt('Itemid'); + $appl = JFactory::getApplication(); - static $modules; + static $clean; - if (isset($modules)) { - return $modules; + if (isset($clean)) { + return $clean; } - $user =& JFactory::getUser(); - $db =& JFactory::getDBO(); + $user = &JFactory::getUser(); + $db = &JFactory::getDBO(); - $aid = $user->get('aid', 0); + $aid = $user->get('aid', 0); - $modules = array(); + $modules = array(); - $wheremenu = isset( $Itemid ) ? ' AND ( mm.menuid = '. (int) $Itemid .' OR mm.menuid = 0 )' : ''; + $wheremenu = !empty($Itemid) + ? ' AND (mm.menuid = ' . (int)$Itemid . ' OR mm.menuid <= 0)' + : ''; - $query = 'SELECT id, title, module, position, content, showtitle, control, params' + $query = 'SELECT id, title, module, position, content, showtitle, control, params, mm.menuid' . ' FROM #__modules AS m' . ' LEFT JOIN #__modules_menu AS mm ON mm.moduleid = m.id' . ' WHERE m.published = 1' . ' AND m.access <= '. (int)$aid - . ' AND m.client_id = '. (int)$mainframe->getClientId() + . ' AND m.client_id = '. (int)$appl->getClientId() . $wheremenu . ' ORDER BY position, ordering'; - $db->setQuery( $query ); + $db->setQuery($query); - if (null === ($modules = $db->loadObjectList())) { - JError::raiseWarning( 'SOME_ERROR_CODE', JText::_( 'Error Loading Modules' ) . $db->getErrorMsg()); + try { + $modules = $db->loadObjectList(); + } catch(JException $e) { + JError::raiseWarning( + 'SOME_ERROR_CODE', + JText::_('Error Loading Modules') . $db->getErrorMsg() + ); return false; } - $total = count($modules); - for($i = 0; $i < $total; $i++) + // Apply negative selections and eliminate duplicates + $negId = $Itemid ? -(int)$Itemid : false; + $dups = array(); + $clean = array(); + foreach ($modules as $i => $module) { - //determine if this is a custom module - $file = $modules[$i]->module; - $custom = substr( $file, 0, 4 ) == 'mod_' ? 0 : 1; - $modules[$i]->user = $custom; - // CHECK: custom module name is given by the title field, otherwise it's just 'om' ?? - $modules[$i]->name = $custom ? $modules[$i]->title : substr( $file, 4 ); - $modules[$i]->style = null; - $modules[$i]->position = strtolower($modules[$i]->position); + /* + * The module is excluded if there is an explicit prohibition, or if + * the Itemid is missing or zero and the module is in exclude mode. + */ + $negHit = $negId === (int)$module->menuid + || (!$negId && (int)$module->menuid < 0); + if (isset($dups[$module->id])) { + /* + * If this item has been excluded, keep the duplicate flag set, + * but remove any item from the cleaned array. + */ + if ($negHit) { + unset($clean[$module->id]); + } + continue; + } + $dups[$module->id] = true; + // Only accept modules without explicit exclusions. + if (! $negHit) { + //determine if this is a custom module + $file = $module->module; + $custom = substr($file, 0, 4) == 'mod_' ? 0 : 1; + $module->user = $custom; + // Custom module name is given by the title field, otherwise strip off "com_" + $module->name = $custom ? $module->title : substr($file, 4); + $module->style = null; + $module->position = strtolower($module->position); + $clean[$module->id] = $module; + } } + // Return to simple indexing that matches the query order. + $clean = array_values($clean); - return $modules; + return $clean; } - } - diff --git a/libraries/joomla/application/module/index.html b/libraries/joomla/application/module/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/application/module/index.html +++ b/libraries/joomla/application/module/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/application/pathway.php b/libraries/joomla/application/pathway.php index 531ac0755bd2d..ec856552db219 100644 --- a/libraries/joomla/application/pathway.php +++ b/libraries/joomla/application/pathway.php @@ -1,215 +1,214 @@ - - * @package Joomla.Framework - * @subpackage Application - * @since 1.5 - */ -class JPathway extends JObject -{ - /** - * Array to hold the pathway item objects - * @access private - */ - var $_pathway = null; - - /** - * Integer number of items in the pathway - * @access private - */ - var $_count = 0; - - /** - * Class constructor - */ - function __construct($options = array()) - { - //Initialise the array - $this->_pathway = array(); - } - - /** - * Returns a reference a JPathway object - * - * This method must be invoked as: - *
        $menu = &JPathway::getInstance();
      - * - * @access public - * @param string $client The name of the client - * @param array $options An associative array of options - * @return JPathway A pathway object. - * @since 1.5 - */ - function &getInstance($client, $options = array()) - { - static $instances; - - if (!isset( $instances )) { - $instances = array(); - } - - if (empty($instances[$client])) - { - //Load the router object - $info =& JApplicationHelper::getClientInfo($client, true); - - $path = $info->path.DS.'includes'.DS.'pathway.php'; - if(file_exists($path)) - { - require_once $path; - - // Create a JPathway object - $classname = 'JPathway'.ucfirst($client); - $instance = new $classname($options); - } - else - { - $error = JError::raiseError( 500, 'Unable to load pathway: '.$client); - return $error; - } - - $instances[$client] = & $instance; - } - - return $instances[$client]; - } - - /** - * Return the JPathWay items array - * - * @access public - * @return array Array of pathway items - * @since 1.5 - */ - function getPathway() - { - $pw = $this->_pathway; - - // Use array_values to reset the array keys numerically - return array_values($pw); - } - - /** - * Set the JPathway items array. - * - * @access public - * @param array $pathway An array of pathway objects. - * @return array The previous pathway data. - * @since 1.5 - */ - function setPathway($pathway) - { - $oldPathway = $this->_pathway; - $pathway = (array) $pathway; - - // Set the new pathway. - $this->_pathway = array_values($pathway); - - return array_values($oldPathway); - } - - /** - * Create and return an array of the pathway names. - * - * @access public - * @return array Array of names of pathway items - * @since 1.5 - */ - function getPathwayNames() - { - // Initialize variables - $names = array (null); - - // Build the names array using just the names of each pathway item - foreach ($this->_pathway as $item) { - $names[] = $item->name; - } - - //Use array_values to reset the array keys numerically - return array_values($names); - } - - /** - * Create and add an item to the pathway. - * - * @access public - * @param string $name - * @param string $link - * @return boolean True on success - * @since 1.5 - */ - function addItem($name, $link='') - { - // Initalize variables - $ret = false; - - if ($this->_pathway[] = $this->_makeItem($name, $link)) { - $ret = true; - $this->_count++; - } - - return $ret; - } - - /** - * Set item name. - * - * @access public - * @param integer $id - * @param string $name - * @return boolean True on success - * @since 1.5 - */ - function setItemName($id, $name) - { - // Initalize variables - $ret = false; - - if (isset($this->_pathway[$id])) { - $this->_pathway[$id]->name = $name; - $ret = true; - } - - return $ret; - } - - /** - * Create and return a new pathway object. - * - * @access private - * @param string $name Name of the item - * @param string $link Link to the item - * @return object Pathway item object - * @since 1.5 - */ - function _makeItem($name, $link) - { - $item = new stdClass(); - $item->name = html_entity_decode($name); - $item->link = $link; - - return $item; - } -} \ No newline at end of file +_pathway = array(); + } + + /** + * Returns a reference a JPathway object + * + * This method must be invoked as: + *
        $menu = &JPathway::getInstance();
      + * + * @access public + * @param string $client The name of the client + * @param array $options An associative array of options + * @return JPathway A pathway object. + * @since 1.5 + */ + public static function &getInstance($client, $options = array()) + { + static $instances; + + if (!isset( $instances )) { + $instances = array(); + } + + if (!isset($instances[$client]) || empty($instances[$client])) + { + //Load the router object + $info =& JApplicationHelper::getClientInfo($client, true); + + $path = $info->path.DS.'includes'.DS.'pathway.php'; + if(file_exists($path)) + { + require_once $path; + + // Create a JPathway object + $classname = 'JPathway'.ucfirst($client); + $instance = new $classname($options); + } + else + { + throw new JException('Unable to load pathway', 500, E_ERROR, $client, true); + } + + $instances[$client] = & $instance; + } + + return $instances[$client]; + } + + /** + * Return the JPathWay items array + * + * @access public + * @return array Array of pathway items + * @since 1.5 + */ + public function getPathway() + { + $pw = $this->_pathway; + + // Use array_values to reset the array keys numerically + return array_values($pw); + } + + /** + * Set the JPathway items array. + * + * @access public + * @param array $pathway An array of pathway objects. + * @return array The previous pathway data. + * @since 1.5 + */ + public function setPathway($pathway) + { + $oldPathway = $this->_pathway; + $pathway = (array) $pathway; + + // Set the new pathway. + $this->_pathway = array_values($pathway); + + return array_values($oldPathway); + } + + /** + * Create and return an array of the pathway names. + * + * @access public + * @return array Array of names of pathway items + * @since 1.5 + */ + public function getPathwayNames() + { + // Initialize variables + $names = array (null); + + // Build the names array using just the names of each pathway item + foreach ($this->_pathway as $item) { + $names[] = $item->name; + } + + //Use array_values to reset the array keys numerically + return array_values($names); + } + + /** + * Create and add an item to the pathway. + * + * @access public + * @param string $name + * @param string $link + * @return boolean True on success + * @since 1.5 + */ + public function addItem($name, $link='') + { + // Initalize variables + $ret = false; + + if ($this->_pathway[] = $this->_makeItem($name, $link)) { + $ret = true; + $this->_count++; + } + + return $ret; + } + + /** + * Set item name. + * + * @access public + * @param integer $id + * @param string $name + * @return boolean True on success + * @since 1.5 + */ + public function setItemName($id, $name) + { + // Initalize variables + $ret = false; + + if (isset($this->_pathway[$id])) { + $this->_pathway[$id]->name = $name; + $ret = true; + } + + return $ret; + } + + /** + * Create and return a new pathway object. + * + * @access private + * @param string $name Name of the item + * @param string $link Link to the item + * @return object Pathway item object + * @since 1.5 + */ + protected function _makeItem($name, $link) + { + $item = new stdClass(); + $item->name = html_entity_decode($name); + $item->link = $link; + + return $item; + } +} + diff --git a/libraries/joomla/application/router.php b/libraries/joomla/application/router.php index e11e39f912663..d937c7102f5b4 100644 --- a/libraries/joomla/application/router.php +++ b/libraries/joomla/application/router.php @@ -1,417 +1,416 @@ - - * @package Joomla.Framework - * @subpackage Application - * @since 1.5 - */ -class JRouter extends JObject -{ - /** - * The rewrite mode - * - * @access protected - * @var integer - */ - var $_mode = null; - - /** - * An array of variables - * - * @access protected - * @var array - */ - var $_vars = array(); - - /** - * An array of rules - * - * @access protected - * @var array - */ - var $_rules = array( - 'build' => array(), - 'parse' => array() - ); - - /** - * Class constructor - * - * @access public - */ - function __construct($options = array()) - { - if(array_key_exists('mode', $options)) { - $this->_mode = $options['mode']; - } else { - $this->_mode = JROUTER_MODE_RAW; - } - } - - /** - * Returns a reference to the global JRouter object, only creating it if it - * doesn't already exist. - * - * This method must be invoked as: - *
        $menu = &JRouter::getInstance();
      - * - * @access public - * @param string $client The name of the client - * @param array $options An associative array of options - * @return JRouter A router object. - */ - function &getInstance($client, $options = array()) - { - static $instances; - - if (!isset( $instances )) { - $instances = array(); - } - - if (empty($instances[$client])) - { - //Load the router object - $info =& JApplicationHelper::getClientInfo($client, true); - - $path = $info->path.DS.'includes'.DS.'router.php'; - if(file_exists($path)) - { - require_once $path; - - // Create a JRouter object - $classname = 'JRouter'.ucfirst($client); - $instance = new $classname($options); - } - else - { - $error = JError::raiseError( 500, 'Unable to load router: '.$client); - return $error; - } - - $instances[$client] = & $instance; - } - - return $instances[$client]; - } - - /** - * Function to convert a route to an internal URI - * - * @access public - */ - function parse(&$uri) - { - $vars = array(); - - // Process the parsed variables based on custom defined rules - $vars = $this->_processParseRules($uri); - - // Parse RAW URL - if($this->_mode == JROUTER_MODE_RAW) { - $vars += $this->_parseRawRoute($uri); - } - - // Parse SEF URL - if($this->_mode == JROUTER_MODE_SEF) { - $vars += $vars + $this->_parseSefRoute($uri); - } - - return array_merge($this->getVars(), $vars); - } - - /** - * Function to convert an internal URI to a route - * - * @param string $string The internal URL - * @return string The absolute search engine friendly URL - */ - function &build($url) - { - //Create the URI object - $uri =& $this->_createURI($url); - - //Process the uri information based on custom defined rules - $this->_processBuildRules($uri); - - // Build RAW URL - if($this->_mode == JROUTER_MODE_RAW) { - $this->_buildRawRoute($uri); - } - - // Build SEF URL : mysite/route/index.php?var=x - if ($this->_mode == JROUTER_MODE_SEF) { - $this->_buildSefRoute($uri); - } - - return $uri; - } - - /** - * Get the router mode - * - * @access public - */ - function getMode() { - return $this->_mode; - } - - /** - * Get the router mode - * - * @access public - */ - function setMode($mode) { - $this->_mode = $mode; - } - - /** - * Set a router variable, creating it if it doesn't exist - * - * @access public - * @param string $key The name of the variable - * @param mixed $value The value of the variable - * @param boolean $create If True, the variable will be created if it doesn't exist yet - */ - function setVar($key, $value, $create = true) { - - if(!$create && array_key_exists($key, $this->_vars)) { - $this->_vars[$key] = $value; - } else { - $this->_vars[$key] = $value; - } - } - - /** - * Set the router variable array - * - * @access public - * @param array $vars An associative array with variables - * @param boolean $create If True, the array will be merged instead of overwritten - */ - function setVars($vars = array(), $merge = true) { - - if($merge) { - $this->_vars = array_merge($this->_vars, $vars); - } else { - $this->_vars = $vars; - } - } - - /** - * Get a router variable - * - * @access public - * @param string $key The name of the variable - * $return mixed Value of the variable - */ - function getVar($key) - { - $result = null; - if(isset($this->_vars[$key])) { - $result = $this->_vars[$key]; - } - return $result; - } - - /** - * Get the router variable array - * - * @access public - * @return array An associative array of router variables - */ - function getVars() { - return $this->_vars; - } - - /** - * Attach a build rule - * - * @access public - * @param callback $callback The function to be called. - */ - function attachBuildRule($callback) - { - $this->_rules['build'][] = $callback; - } - - /** - * Attach a parse rule - * - * @access public - * @param callback $callback The function to be called. - */ - function attachParseRule($callback) - { - $this->_rules['parse'][] = $callback; - } - - /** - * Function to convert a raw route to an internal URI - * - * @abstract - * @access protected - */ - function _parseRawRoute(&$uri) - { - return false; - } - - /** - * Function to convert a sef route to an internal URI - * - * @abstract - * @access protected - */ - function _parseSefRoute(&$uri) - { - return false; - } - - /** - * Function to build a raw route - * - * @abstract - * @access protected - */ - function _buildRawRoute(&$uri) - { - - } - - /** - * Function to build a sef route - * - * @abstract - * @access protected - */ - function _buildSefRoute(&$uri) - { - - } - - /** - * Process the parsed router variables based on custom defined rules - * - * @abstract - * @access protected - */ - function _processParseRules(&$uri) - { - $vars = array(); - - foreach($this->_rules['parse'] as $rule) { - $vars = call_user_func( $rule, $this, $uri); - } - - return $vars; - } - - /** - * Process the build uri query data based on custom defined rules - * - * @abstract - * @access protected - */ - function _processBuildRules(&$uri) - { - foreach($this->_rules['build'] as $rule) { - call_user_func($rule, $this, $uri) ; - } - } - - /** - * Create a uri based on a full or partial url string - * - * @access protected - * @return JURI A JURI object - */ - function &_createURI($url) - { - // Create full URL if we are only appending variables to it - if(substr($url, 0, 1) == '&') - { - $vars = array(); - if(strpos($url, '&') !== false) - { - $url = str_replace('&','&',$url); - } - - parse_str($url, $vars); - - $vars = array_merge($this->getVars(), $vars); - - foreach($vars as $key => $var) - { - if($var == "") { - unset($vars[$key]); - } - } - - $url = 'index.php?'.JURI::buildQuery($vars); - } - - // Decompose link into url component parts - $uri = new JURI($url); - - return $uri; - } - - /** - * Encode route segments - * - * @access protected - * @param array An array of route segments - * @return array - */ - function _encodeSegments($segments) - { - $total = count($segments); - for($i=0; $i<$total; $i++) { - $segments[$i] = str_replace(':', '-', $segments[$i]); - } - - return $segments; - } - - /** - * Decode route segments - * - * @access protected - * @param array An array of route segments - * @return array - */ - function _decodeSegments($segments) - { - $total = count($segments); - for($i=0; $i<$total; $i++) { - $segments[$i] = preg_replace('/-/', ':', $segments[$i], 1); - } - - return $segments; - } -} + array(), + 'parse' => array() + ); + + /** + * Class constructor + * + * @access public + */ + protected function __construct($options = array()) + { + if(array_key_exists('mode', $options)) { + $this->_mode = $options['mode']; + } else { + $this->_mode = JROUTER_MODE_RAW; + } + } + + /** + * Returns a reference to the global JRouter object, only creating it if it + * doesn't already exist. + * + * This method must be invoked as: + *
        $menu = &JRouter::getInstance();
      + * + * @access public + * @param string $client The name of the client + * @param array $options An associative array of options + * @return JRouter A router object. + */ + public static function &getInstance($client, $options = array()) + { + static $instances; + + if (!isset( $instances )) { + $instances = array(); + } + + if (!isset($instances[$client]) || empty($instances[$client])) + { + //Load the router object + $info =& JApplicationHelper::getClientInfo($client, true); + + $path = $info->path.DS.'includes'.DS.'router.php'; + if(file_exists($path)) + { + require_once $path; + + // Create a JRouter object + $classname = 'JRouter'.ucfirst($client); + $instance = new $classname($options); + } + else + { + throw new JException('Unable to load router', 500, E_ERROR, $client, true); + } + + $instances[$client] = & $instance; + } + + return $instances[$client]; + } + + /** + * Function to convert a route to an internal URI + * + * @access public + */ + public function parse(&$uri) + { + $vars = array(); + + // Process the parsed variables based on custom defined rules + $vars = $this->_processParseRules($uri); + + // Parse RAW URL + if($this->_mode == JROUTER_MODE_RAW) { + $vars += $this->_parseRawRoute($uri); + } + + // Parse SEF URL + if($this->_mode == JROUTER_MODE_SEF) { + $vars += $vars + $this->_parseSefRoute($uri); + } + + return array_merge($this->getVars(), $vars); + } + + /** + * Function to convert an internal URI to a route + * + * @param string $string The internal URL + * @return string The absolute search engine friendly URL + */ + public function &build($url) + { + //Create the URI object + $uri =& $this->_createURI($url); + + //Process the uri information based on custom defined rules + $this->_processBuildRules($uri); + + // Build RAW URL + if($this->_mode == JROUTER_MODE_RAW) { + $this->_buildRawRoute($uri); + } + + // Build SEF URL : mysite/route/index.php?var=x + if ($this->_mode == JROUTER_MODE_SEF) { + $this->_buildSefRoute($uri); + } + + return $uri; + } + + /** + * Get the router mode + * + * @access public + */ + public function getMode() { + return $this->_mode; + } + + /** + * Get the router mode + * + * @access public + */ + public function setMode($mode) { + $this->_mode = $mode; + } + + /** + * Set a router variable, creating it if it doesn't exist + * + * @access public + * @param string $key The name of the variable + * @param mixed $value The value of the variable + * @param boolean $create If True, the variable will be created if it doesn't exist yet + */ + public function setVar($key, $value, $create = true) { + + if(!$create && array_key_exists($key, $this->_vars)) { + $this->_vars[$key] = $value; + } else { + $this->_vars[$key] = $value; + } + } + + /** + * Set the router variable array + * + * @access public + * @param array $vars An associative array with variables + * @param boolean $create If True, the array will be merged instead of overwritten + */ + public function setVars($vars = array(), $merge = true) { + + if($merge) { + $this->_vars = array_merge($this->_vars, $vars); + } else { + $this->_vars = $vars; + } + } + + /** + * Get a router variable + * + * @access public + * @param string $key The name of the variable + * $return mixed Value of the variable + */ + public function getVar($key) + { + $result = null; + if(isset($this->_vars[$key])) { + $result = $this->_vars[$key]; + } + return $result; + } + + /** + * Get the router variable array + * + * @access public + * @return array An associative array of router variables + */ + public function getVars() { + return $this->_vars; + } + + /** + * Attach a build rule + * + * @access public + * @param callback $callback The function to be called. + */ + public function attachBuildRule($callback) + { + $this->_rules['build'][] = $callback; + } + + /** + * Attach a parse rule + * + * @access public + * @param callback $callback The function to be called. + */ + public function attachParseRule($callback) + { + $this->_rules['parse'][] = $callback; + } + + /** + * Function to convert a raw route to an internal URI + * + * @abstract + * @access protected + */ + protected function _parseRawRoute(&$uri) + { + return false; + } + + /** + * Function to convert a sef route to an internal URI + * + * @abstract + * @access protected + */ + protected function _parseSefRoute(&$uri) + { + return false; + } + + /** + * Function to build a raw route + * + * @abstract + * @access protected + */ + protected function _buildRawRoute(&$uri) + { + + } + + /** + * Function to build a sef route + * + * @abstract + * @access protected + */ + protected function _buildSefRoute(&$uri) + { + + } + + /** + * Process the parsed router variables based on custom defined rules + * + * @abstract + * @access protected + */ + protected function _processParseRules(&$uri) + { + $vars = array(); + + foreach($this->_rules['parse'] as $rule) { + $vars = call_user_func_array($rule, array(&$this, &$uri)); + } + + return $vars; + } + + /** + * Process the build uri query data based on custom defined rules + * + * @abstract + * @access protected + */ + protected function _processBuildRules(&$uri) + { + foreach($this->_rules['build'] as $rule) { + call_user_func_array($rule, array(&$this, &$uri)); + } + } + + /** + * Create a uri based on a full or partial url string + * + * @access protected + * @return JURI A JURI object + */ + protected function &_createURI($url) + { + // Create full URL if we are only appending variables to it + if(substr($url, 0, 1) == '&') + { + $vars = array(); + if(strpos($url, '&') !== false) + { + $url = str_replace('&','&',$url); + } + + parse_str($url, $vars); + + $vars = array_merge($this->getVars(), $vars); + + foreach($vars as $key => $var) + { + if($var == "") { + unset($vars[$key]); + } + } + + $url = 'index.php?'.JURI::buildQuery($vars); + } + + // Decompose link into url component parts + $uri = JURI::getInstance($url); + + return $uri; + } + + /** + * Encode route segments + * + * @access protected + * @param array An array of route segments + * @return array + */ + protected function _encodeSegments($segments) + { + $total = count($segments); + for($i=0; $i<$total; $i++) { + $segments[$i] = str_replace(':', '-', $segments[$i]); + } + + return $segments; + } + + /** + * Decode route segments + * + * @access protected + * @param array An array of route segments + * @return array + */ + protected function _decodeSegments($segments) + { + $total = count($segments); + for($i=0; $i<$total; $i++) { + $segments[$i] = preg_replace('/-/', ':', $segments[$i], 1); + } + + return $segments; + } +} + diff --git a/libraries/joomla/base/index.html b/libraries/joomla/base/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/base/index.html +++ b/libraries/joomla/base/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/base/object.php b/libraries/joomla/base/object.php index 037b8077c90bc..2b0df684a647b 100644 --- a/libraries/joomla/base/object.php +++ b/libraries/joomla/base/object.php @@ -1,26 +1,25 @@ - - * @package Joomla.Framework - * @subpackage Base - * @since 1.5 - */ -class JObject +$property)) { - return $this->$property; - } - return $default; - } - - /** - * Returns an associative array of object properties - * - * @access public - * @param boolean $public If true, returns only the public properties - * @return array - * @see get() - * @since 1.5 - */ - function getProperties( $public = true ) - { - $vars = get_object_vars($this); - - if($public) - { - foreach ($vars as $key => $value) - { - if ('_' == substr($key, 0, 1)) { - unset($vars[$key]); - } - } - } - - return $vars; - } + protected $_errors = array(); /** - * Get the most recent error message + * Class constructor, overridden in descendant classes. * - * @param integer $i Option error index - * @param boolean $toString Indicates if JError objects should return their error message - * @return string Error message - * @access public + * @access protected * @since 1.5 */ - function getError($i = null, $toString = true ) - { - // Find the error - if ( $i === null) { - // Default, return the last message - $error = end($this->_errors); - } - else - if ( ! array_key_exists($i, $this->_errors) ) { - // If $i has been specified but does not exist, return false - return false; - } - else { - $error = $this->_errors[$i]; - } - - // Check if only the string is requested - if ( JError::isError($error) && $toString ) { - return $error->toString(); - } - - return $error; - } + protected function __construct() {} /** - * Return all errors, if any + * Provides interception of default php error handling logic for objects. Enforceing class definitions * * @access public - * @return array Array of error messages or JErrors - * @since 1.5 - */ - function getErrors() - { - return $this->_errors; + * @throw Jexception + * @since 1.6 + */ + public function __get($var) { + throw new JException('Attempted to access undefined object variable', 0, E_NOTICE, $var, true); } - /** - * Modifies a property of the object, creating it if it does not already exist. + * Provides interception of default php error handling logic for objects. Enforceing class definitions * * @access public - * @param string $property The name of the property - * @param mixed $value The value of the property to set - * @return mixed Previous value of the property - * @see setProperties() - * @since 1.5 - */ - function set( $property, $value = null ) - { - $previous = isset($this->$property) ? $this->$property : null; - $this->$property = $value; - return $previous; - } - - /** - * Set the object properties based on a named array/hash - * - * @access protected - * @param $array mixed Either and associative array or another object - * @return boolean - * @see set() - * @since 1.5 - */ - function setProperties( $properties ) - { - $properties = (array) $properties; //cast to an array - - if (is_array($properties)) - { - foreach ($properties as $k => $v) { - $this->$k = $v; - } - - return true; - } - - return false; + * @throw Jexception + * @since 1.6 + */ + public function __set($var, $val) { + throw new JException('Attempted to set undefined object variable', 0, E_NOTICE, array($var, $val), true); } /** - * Add an error message + * Provides interception of default php error handling logic for objects. Enforceing class definitions * - * @param string $error Error message * @access public - * @since 1.0 - */ - function setError($error) - { - array_push($this->_errors, $error); + * @throw Jexception + * @since 1.6 + */ + public function __call($func, $args) { + throw new JException('Attempted to call non-existant method on object',0, E_ERROR, array($func, $args), true); } - - /** - * Object-to-string conversion. - * Each class can override it as necessary. - * - * @access public - * @return string This name of this class - * @since 1.5 - */ - function toString() - { - return get_class($this); - } - - /** - * Legacy Method, use {@link JObject::getProperties()} instead - * - * @deprecated as of 1.5 - * @since 1.0 - */ - function getPublicProperties() - { - return $this->getProperties(); - } -} +} diff --git a/libraries/joomla/base/observable.php b/libraries/joomla/base/observable.php index 236823ef1fd7d..f588c00615693 100644 --- a/libraries/joomla/base/observable.php +++ b/libraries/joomla/base/observable.php @@ -1,127 +1,155 @@ - - * @package Joomla.Framework - * @subpackage Base - * @since 1.5 - */ -class JObservable extends JObject -{ - /** - * An array of Observer objects to notify - * - * @access private - * @var array - */ - var $_observers = array(); - - /** - * The state of the observable object - * - * @access private - * @var mixed - */ - var $_state = null; - - - /** - * Constructor - */ - function __construct() { - $this->_observers = array(); - } - - /** - * Get the state of the JObservable object - * - * @access public - * @return mixed The state of the object - * @since 1.5 - */ - function getState() { - return $this->_state; - } - - /** - * Update each attached observer object and return an array of their return values - * - * @access public - * @return array Array of return values from the observers - * @since 1.5 - */ - function notify() - { - // Iterate through the _observers array - foreach ($this->_observers as $observer) { - $return[] = $observer->update(); - } - return $return; - } - - /** - * Attach an observer object - * - * @access public - * @param object $observer An observer object to attach - * @return void - * @since 1.5 - */ - function attach( &$observer) - { - // Make sure we haven't already attached this object as an observer - if (is_object($observer)) - { - $class = get_class($observer); - foreach ($this->_observers as $check) { - if (is_a($check, $class)) { - return; - } - } - $this->_observers[] =& $observer; - } else { - $this->_observers[] =& $observer; - } - } - - /** - * Detach an observer object - * - * @access public - * @param object $observer An observer object to detach - * @return boolean True if the observer object was detached - * @since 1.5 - */ - function detach( $observer) - { - // Initialize variables - $retval = false; + +/** + * Abstract observable class to implement the observer design pattern + * + * @abstract + * @author Louis Landry + * @package Joomla.Framework + * @subpackage Base + * @since 1.5 + */ +class JObservable extends JObject +{ + /** + * An array of Observer objects to notify + * + * @access private + * @var array + */ + protected $_observers = array(); + + /** + * The state of the observable object + * + * @access private + * @var mixed + */ + protected $_state = null; + + /** + * A multi dimensional array of [function][] = key for observers + * + * @access protected + * @var array + */ + protected $_methods = array(); + + /** + * Constructor + * + * @access protected - Make Sure it's not directly instansiated + */ + protected function __construct() { + $this->_observers = array(); + } + + /** + * Get the state of the JObservable object + * + * @access public + * @return mixed The state of the object + * @since 1.5 + */ + public function getState() { + return $this->_state; + } + + /** + * Update each attached observer object and return an array of their return values + * + * @access public + * @return array Array of return values from the observers + * @since 1.5 + */ + public function notify() + { + // Iterate through the _observers array + foreach ($this->_observers as $observer) { + $return[] = $observer->update(); + } + return $return; + } + + /** + * Attach an observer object + * + * @access public + * @param object $observer An observer object to attach + * @return void + * @since 1.5 + */ + public function attach( &$observer) + { + // Make sure we haven't already attached this object as an observer + if (is_object($observer)) + { + + $class = get_class($observer); + foreach ($this->_observers as $check) { + if ($check INSTANCEOF $class) { + return; + } + } + $this->_observers[] =& $observer; + $methods = get_class_methods($observer); + } else { + $this->_observers[] =& $observer; + $methods = array($observer['event']); + } + end($this->_observers); + $key = key($this->_observers); + foreach($methods AS $method) { + $method = strtolower($method); + if(!isset($this->_methods[$method])) { + $this->_methods[$method] = array(); + } + $this->_methods[$method][] = $key; + } + } + + /** + * Detach an observer object + * + * @access public + * @param object $observer An observer object to detach + * @return boolean True if the observer object was detached + * @since 1.5 + */ + public function detach( $observer) + { + // Initialize variables + $retval = false; $key = array_search($observer, $this->_observers); - - if ( $key !== false ) - { - unset($this->_observers[$key]); - $retval = true; - } - return $retval; - } -} \ No newline at end of file + + if ( $key !== false ) + { + unset($this->_observers[$key]); + $retval = true; + foreach($this->_methods AS &$method) { + $k = array_search($key, $method); + if($k !== false) { + unset($method[$k]); + } + } + } + return $retval; + } +} + diff --git a/libraries/joomla/base/observer.php b/libraries/joomla/base/observer.php index 20a34f3c9a52a..1b672f8e79343 100644 --- a/libraries/joomla/base/observer.php +++ b/libraries/joomla/base/observer.php @@ -1,60 +1,57 @@ - - * @package Joomla.Framework - * @subpackage Base - * @since 1.5 - */ -class JObserver extends JObject -{ - - /** - * Event object to observe - * - * @access private - * @var object - */ - var $_subject = null; - - /** - * Constructor - */ - function __construct(& $subject) - { - // Register the observer ($this) so we can be notified - $subject->attach($this); - - // Set the subject to observe - $this->_subject = & $subject; - } - - /** - * Method to update the state of observable objects - * - * @abstract Implement in child classes - * @access public - * @return mixed - */ - function update() { - return JError::raiseError('9', 'JObserver::update: Method not implemented', 'This method should be implemented in a child class'); - } -} \ No newline at end of file + +/** + * Abstract observer class to implement the observer design pattern + * + * @abstract + * @package Joomla.Framework + * @subpackage Base + * @since 1.5 + */ +abstract class JObserver extends JObject +{ + + /** + * Event object to observe + * + * @access private + * @var object + */ + protected $_subject = null; + + /** + * Constructor + */ + protected function __construct(& $subject) + { + // Register the observer ($this) so we can be notified + $subject->attach($this); + + // Set the subject to observe + $this->_subject = & $subject; + } + + /** + * Method to update the state of observable objects + * + * @abstract Implement in child classes + * @access public + * @return mixed + */ + abstract public function update( &$args ); +} diff --git a/libraries/joomla/base/stdclass.php b/libraries/joomla/base/stdclass.php new file mode 100644 index 0000000000000..ca4e918aaf1ba --- /dev/null +++ b/libraries/joomla/base/stdclass.php @@ -0,0 +1,189 @@ +$property)) { + return $this->$property; + } + return $default; + } + + /** + * Returns an associative array of object properties + * + * @access public + * @param boolean $public If true, returns only the public properties + * @return array + * @see get() + * @since 1.5 + */ + public function getProperties( $public = true ) + { + $vars = get_object_vars($this); + if($public) + { + foreach ($vars as $key => $value) + { + if ('_' == substr($key, 0, 1)) { + unset($vars[$key]); + } + } + } + return $vars; + } + + /** + * Get the most recent error message + * + * @param integer $i Option error index + * @param boolean $toString Indicates if JError objects should return their error message + * @return string Error message + * @access public + * @since 1.5 + */ + public function getError($i = null, $toString = true ) + { + // Find the error + if ( $i === null) { + // Default, return the last message + $error = end($this->_errors); + } + else + if ( ! array_key_exists($i, $this->_errors) ) { + // If $i has been specified but does not exist, return false + return false; + } + else { + $error = $this->_errors[$i]; + } + + // Check if only the string is requested + if ( JError::isError($error) && $toString ) { + return $error->toString(); + } + + return $error; + } + + /** + * Return all errors, if any + * + * @access public + * @return array Array of error messages or JErrors + * @since 1.5 + */ + public function getErrors() + { + return $this->_errors; + } + + + /** + * Modifies a property of the object, creating it if it does not already exist. + * + * @access public + * @param string $property The name of the property + * @param mixed $value The value of the property to set + * @return mixed Previous value of the property + * @see setProperties() + * @since 1.5 + */ + public function set( $property, $value = null ) + { + $previous = isset($this->$property) ? $this->$property : null; + $this->$property = $value; + return $previous; + } + + /** + * Set the object properties based on a named array/hash + * + * @access protected + * @param $array mixed Either and associative array or another object + * @return boolean + * @see set() + * @since 1.5 + */ + public function setProperties( $properties ) + { + $properties = (array) $properties; //cast to an array + + if (is_array($properties)) + { + foreach ($properties as $k => $v) { + $this->$k = $v; + } + + return true; + } + + return false; + } + + /** + * Add an error message + * + * @param string $error Error message + * @access public + * @since 1.0 + */ + public function setError($error) + { + array_push($this->_errors, $error); + } + + /** + * Object-to-string conversion. + * Each class can override it as necessary. + * + * @access public + * @return string This name of this class + * @since 1.5 + */ + public function toString() + { + return get_class($this); + } + +} diff --git a/libraries/joomla/base/tree.php b/libraries/joomla/base/tree.php index aa590f0326aa3..85a85fef70c72 100644 --- a/libraries/joomla/base/tree.php +++ b/libraries/joomla/base/tree.php @@ -1,113 +1,111 @@ - - * @package Joomla.Framework - * @subpackage Base - * @since 1.5 - */ -class JTree extends JObject -{ - /** - * Root node - */ - var $_root = null; - - /** - * Current working node - */ - var $_current = null; - - function __construct() - { - $this->_root = new JNode('ROOT'); - $this->_current = & $this->_root; - } - - function addChild(&$node, $setCurrent = false) - { - $this->_current->addChild($node); - if ($setCurrent) { - $this->_current =& $node; - } - } - - function getParent() - { - $this->_current =& $this->_current->getParent(); - } - - function reset() - { - $this->_current =& $this->_root; - } -} - -/** - * Tree Node Class. - * - * @author Louis Landry - * @package Joomla.Framework - * @subpackage Base - * @since 1.5 - */ -class JNode extends JObject -{ - /** - * Parent node - */ - var $_parent = null; - - /** - * Array of Children - */ - var $_children = array(); - - function __construct() - { - return true; - } - - function addChild( &$node ) - { - $node->setParent($this); - $this->_children[] = & $node; - } - - function &getParent() - { - return $this->_parent; - } - - function setParent( &$node ) - { - $this->_parent = & $node; - } - - function hasChildren() - { - return count($this->_children); - } - - function &getChildren() - { - return $this->_children; - } -} \ No newline at end of file + +/** + * Tree Class. + * + * @package Joomla.Framework + * @subpackage Base + * @since 1.5 + */ +class JTree extends JObject +{ + /** + * Root node + */ + protected $_root = null; + + /** + * Current working node + */ + protected $_current = null; + + public function __construct() + { + $this->_root = new JNode('ROOT'); + $this->_current = & $this->_root; + } + + public function addChild(&$node, $setCurrent = false) + { + $this->_current->addChild($node); + if ($setCurrent) { + $this->_current =& $node; + } + } + + public function getParent() + { + $this->_current =& $this->_current->getParent(); + } + + public function reset() + { + $this->_current =& $this->_root; + } +} + +/** + * Tree Node Class. + * + * @package Joomla.Framework + * @subpackage Base + * @since 1.5 + */ +class JNode extends JObject +{ + /** + * Parent node + */ + protected $_parent = null; + + /** + * Array of Children + */ + protected $_children = array(); + + public function __construct() + { + return true; + } + + public function addChild( &$node ) + { + $node->setParent($this); + $this->_children[] = & $node; + } + + public function &getParent() + { + return $this->_parent; + } + + public function setParent( &$node ) + { + $this->_parent = & $node; + } + + public function hasChildren() + { + return count($this->_children); + } + + public function &getChildren() + { + return $this->_children; + } +} diff --git a/libraries/joomla/cache/cache.php b/libraries/joomla/cache/cache.php index 0cf7a88101d57..1152f3a02efeb 100644 --- a/libraries/joomla/cache/cache.php +++ b/libraries/joomla/cache/cache.php @@ -1,317 +1,316 @@ - - * @package Joomla.Framework - * @subpackage Cache - * @since 1.5 - */ -class JCache extends JObject -{ - /** - * Storage Handler - * @access private - * @var object - */ - var $_handler; - - /** - * Cache Options - * @access private - * @var array - */ - var $_options; - - /** - * Constructor - * - * @access protected - * @param array $options options - */ - function __construct($options) - { - $this->_options =& $options; - - // Get the default group and caching - if(isset($options['language'])) { - $this->_options['language'] = $options['language']; - } else { - $options['language'] = 'en-GB'; - } - - if(isset($options['cachebase'])) { - $this->_options['cachebase'] = $options['cachebase']; - } else { - $this->_options['cachebase'] = JPATH_ROOT.DS.'cache'; - } - - if(isset($options['defaultgroup'])) { - $this->_options['defaultgroup'] = $options['defaultgroup']; - } else { - $this->_options['defaultgroup'] = 'default'; - } - - if(isset($options['caching'])) { - $this->_options['caching'] = $options['caching']; - } else { - $this->_options['caching'] = true; - } - - if( isset($options['storage'])) { - $this->_options['storage'] = $options['storage']; - } else { - $this->_options['storage'] = 'file'; - } - - //Fix to detect if template positions are enabled... - if(JRequest::getCMD('tpl',0)) { - $this->_options['caching'] = false; - } - } - - /** - * Returns a reference to a cache adapter object, always creating it - * - * @static - * @param string $type The cache object type to instantiate - * @return object A JCache object - * @since 1.5 - */ - function &getInstance($type = 'output', $options = array()) - { - $type = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', $type)); - - $class = 'JCache'.ucfirst($type); - - if(!class_exists($class)) - { - $path = dirname(__FILE__).DS.'handler'.DS.$type.'.php'; - - if (file_exists($path)) { - require_once($path); - } else { - JError::raiseError(500, 'Unable to load Cache Handler: '.$type); - } - } - - $instance = new $class($options); - - return $instance; - } - - /** - * Get the storage handlers - * - * @access public - * @return array An array of available storage handlers - */ - function getStores() - { - jimport('joomla.filesystem.folder'); - $handlers = JFolder::files(dirname(__FILE__).DS.'storage', '.php$'); - - $names = array(); - foreach($handlers as $handler) - { - $name = substr($handler, 0, strrpos($handler, '.')); - $class = 'JCacheStorage'.$name; - - if(!class_exists($class)) { - require_once(dirname(__FILE__).DS.'storage'.DS.$name.'.php'); - } - - if(call_user_func_array( array( trim($class), 'test' ), null)) { - $names[] = $name; - } - } - - return $names; - } - - /** - * Set caching enabled state - * - * @access public - * @param boolean $enabled True to enable caching - * @return void - * @since 1.5 - */ - function setCaching($enabled) - { - $this->_options['caching'] = $enabled; - } - - /** - * Set cache lifetime - * - * @access public - * @param int $lt Cache lifetime - * @return void - * @since 1.5 - */ - function setLifeTime($lt) - { - $this->_options['lifetime'] = $lt; - } - - /** - * Set cache validation - * - * @access public - * @return void - * @since 1.5 - */ - function setCacheValidation() - { - // Deprecated - } - - /** - * Get cached data by id and group - * - * @abstract - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @return mixed Boolean false on failure or a cached data string - * @since 1.5 - */ - function get($id, $group=null) - { - // Get the default group - $group = ($group) ? $group : $this->_options['defaultgroup']; - - // Get the storage handler - $handler =& $this->_getStorage(); - if (!JError::isError($handler) && $this->_options['caching']) { - return $handler->get($id, $group, (isset($this->_options['checkTime']))? $this->_options['checkTime'] : true); - } - return false; - } - - /** - * Store the cached data by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param mixed $data The data to store - * @return boolean True if cache stored - * @since 1.5 - */ - function store($data, $id, $group=null) - { - // Get the default group - $group = ($group) ? $group : $this->_options['defaultgroup']; - - // Get the storage handler and store the cached data - $handler =& $this->_getStorage(); - if (!JError::isError($handler) && $this->_options['caching']) { - return $handler->store($id, $group, $data); - } - return false; - } - - /** - * Remove a cached data entry by id and group - * - * @abstract - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function remove($id, $group=null) - { - // Get the default group - $group = ($group) ? $group : $this->_options['defaultgroup']; - - // Get the storage handler - $handler =& $this->_getStorage(); - if (!JError::isError($handler)) { - return $handler->remove($id, $group); - } - return false; - } - - /** - * Clean cache for a group given a mode. - * - * group mode : cleans all cache in the group - * notgroup mode : cleans all cache not in the group - * - * @access public - * @param string $group The cache data group - * @param string $mode The mode for cleaning cache [group|notgroup] - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function clean($group=null, $mode='group') - { - // Get the default group - $group = ($group) ? $group : $this->_options['defaultgroup']; - - // Get the storage handler - $handler =& $this->_getStorage(); - if (!JError::isError($handler)) { - return $handler->clean($group, $mode); - } - return false; - } - - /** - * Garbage collect expired cache data - * - * @access public - * @return boolean True on success, false otherwise. - * @since 1.5 - */ - function gc() - { - // Get the storage handler - $handler =& $this->_getStorage(); - if (!JError::isError($handler)) { - return $handler->gc(); - } - return false; - } - - /** - * Get the cache storage handler - * - * @access protected - * @return object A JCacheStorage object - * @since 1.5 - */ - function &_getStorage() - { - if (is_a($this->_handler, 'JCacheStorage')) { - return $this->_handler; - } - - $this->_handler =& JCacheStorage::getInstance($this->_options['storage'], $this->_options); - return $this->_handler; - } -} +_options =& $options; + + // Get the default group and caching + if(isset($options['language'])) { + $this->_options['language'] = $options['language']; + } else { + $options['language'] = 'en-GB'; + } + + if(isset($options['cachebase'])) { + $this->_options['cachebase'] = $options['cachebase']; + } else { + $this->_options['cachebase'] = JPATH_ROOT.DS.'cache'; + } + + if(isset($options['defaultgroup'])) { + $this->_options['defaultgroup'] = $options['defaultgroup']; + } else { + $this->_options['defaultgroup'] = 'default'; + } + + if(isset($options['caching'])) { + $this->_options['caching'] = $options['caching']; + } else { + $this->_options['caching'] = true; + } + + if( isset($options['storage'])) { + $this->_options['storage'] = $options['storage']; + } else { + $this->_options['storage'] = 'file'; + } + + //Fix to detect if template positions are enabled... + if(JRequest::getCMD('tpl',0)) { + $this->_options['caching'] = false; + } + } + + /** + * Returns a reference to a cache adapter object, always creating it + * + * @static + * @param string $type The cache object type to instantiate + * @return object A JCache object + * @since 1.5 + */ + public static function &getInstance($type = 'output', $options = array()) + { + $type = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', $type)); + + $class = 'JCache'.ucfirst($type); + + if(!class_exists($class)) + { + $path = dirname(__FILE__).DS.'handler'.DS.$type.'.php'; + + if (file_exists($path)) { + require_once($path); + } else { + JError::raiseError(500, 'Unable to load Cache Handler: '.$type); + } + } + + $instance = new $class($options); + + return $instance; + } + + /** + * Get the storage handlers + * + * @access public + * @return array An array of available storage handlers + */ + public static function getStores() + { + jimport('joomla.filesystem.folder'); + $handlers = JFolder::files(dirname(__FILE__).DS.'storage', '.php$'); + + $names = array(); + foreach($handlers as $handler) + { + $name = substr($handler, 0, strrpos($handler, '.')); + $class = 'JCacheStorage'.$name; + + if(!class_exists($class)) { + require_once(dirname(__FILE__).DS.'storage'.DS.$name.'.php'); + } + + if(call_user_func_array( array( trim($class), 'test' ), null)) { + $names[] = $name; + } + } + + return $names; + } + + /** + * Set caching enabled state + * + * @access public + * @param boolean $enabled True to enable caching + * @return void + * @since 1.5 + */ + function setCaching($enabled) + { + $this->_options['caching'] = $enabled; + } + + /** + * Set cache lifetime + * + * @access public + * @param int $lt Cache lifetime + * @return void + * @since 1.5 + */ + function setLifeTime($lt) + { + $this->_options['lifetime'] = $lt; + } + + /** + * Set cache validation + * + * @access public + * @return void + * @since 1.5 + */ + function setCacheValidation() + { + // Deprecated + } + + /** + * Get cached data by id and group + * + * @abstract + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @return mixed Boolean false on failure or a cached data string + * @since 1.5 + */ + function get($id, $group=null) + { + // Get the default group + $group = ($group) ? $group : $this->_options['defaultgroup']; + + // Get the storage handler + $handler =& $this->_getStorage(); + if (!JError::isError($handler) && $this->_options['caching']) { + return $handler->get($id, $group, (isset($this->_options['checkTime']))? $this->_options['checkTime'] : true); + } + return false; + } + + /** + * Store the cached data by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param mixed $data The data to store + * @return boolean True if cache stored + * @since 1.5 + */ + function store($data, $id, $group=null) + { + // Get the default group + $group = ($group) ? $group : $this->_options['defaultgroup']; + + // Get the storage handler and store the cached data + $handler =& $this->_getStorage(); + if (!JError::isError($handler) && $this->_options['caching']) { + return $handler->store($id, $group, $data); + } + return false; + } + + /** + * Remove a cached data entry by id and group + * + * @abstract + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function remove($id, $group=null) + { + // Get the default group + $group = ($group) ? $group : $this->_options['defaultgroup']; + + // Get the storage handler + $handler =& $this->_getStorage(); + if (!JError::isError($handler)) { + return $handler->remove($id, $group); + } + return false; + } + + /** + * Clean cache for a group given a mode. + * + * group mode : cleans all cache in the group + * notgroup mode : cleans all cache not in the group + * + * @access public + * @param string $group The cache data group + * @param string $mode The mode for cleaning cache [group|notgroup] + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function clean($group=null, $mode='group') + { + // Get the default group + $group = ($group) ? $group : $this->_options['defaultgroup']; + + // Get the storage handler + $handler =& $this->_getStorage(); + if (!JError::isError($handler)) { + return $handler->clean($group, $mode); + } + return false; + } + + /** + * Garbage collect expired cache data + * + * @access public + * @return boolean True on success, false otherwise. + * @since 1.5 + */ + function gc() + { + // Get the storage handler + $handler =& $this->_getStorage(); + if (!JError::isError($handler)) { + return $handler->gc(); + } + return false; + } + + /** + * Get the cache storage handler + * + * @access protected + * @return object A JCacheStorage object + * @since 1.5 + */ + function &_getStorage() + { + if (is_a($this->_handler, 'JCacheStorage')) { + return $this->_handler; + } + + $this->_handler =& JCacheStorage::getInstance($this->_options['storage'], $this->_options); + return $this->_handler; + } +} diff --git a/libraries/joomla/cache/handler/callback.php b/libraries/joomla/cache/handler/callback.php index a9eacd28e3c91..ec19c6a0f27da 100644 --- a/libraries/joomla/cache/handler/callback.php +++ b/libraries/joomla/cache/handler/callback.php @@ -18,7 +18,6 @@ /** * Joomla! Cache callback type object * - * @author Louis Landry * @package Joomla.Framework * @subpackage Cache * @since 1.5 diff --git a/libraries/joomla/cache/handler/index.html b/libraries/joomla/cache/handler/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/cache/handler/index.html +++ b/libraries/joomla/cache/handler/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/cache/handler/output.php b/libraries/joomla/cache/handler/output.php index 337afe966841f..cad2f44e7e17f 100644 --- a/libraries/joomla/cache/handler/output.php +++ b/libraries/joomla/cache/handler/output.php @@ -18,7 +18,6 @@ /** * Joomla! Cache output type object * - * @author Louis Landry * @package Joomla.Framework * @subpackage Cache * @since 1.5 diff --git a/libraries/joomla/cache/handler/page.php b/libraries/joomla/cache/handler/page.php index 2842f16edb13b..4a46e9be07f28 100644 --- a/libraries/joomla/cache/handler/page.php +++ b/libraries/joomla/cache/handler/page.php @@ -18,8 +18,6 @@ /** * Joomla! Cache page type object * - * @author Johan Janssens - * @author Louis Landry * @package Joomla.Framework * @subpackage Cache * @since 1.5 @@ -117,11 +115,11 @@ function _makeId() */ function _noChange() { - global $mainframe; + $appl = JFactory::getApplication(); // Send not modified header and exit gracefully header( 'HTTP/1.x 304 Not Modified', true ); - $mainframe->close(); + $appl->close(); } /** diff --git a/libraries/joomla/cache/handler/view.php b/libraries/joomla/cache/handler/view.php index 49c1761cac8ab..65e8c6f9c3050 100644 --- a/libraries/joomla/cache/handler/view.php +++ b/libraries/joomla/cache/handler/view.php @@ -18,7 +18,6 @@ /** * Joomla! Cache view type object * - * @author Louis Landry * @package Joomla.Framework * @subpackage Cache * @since 1.5 @@ -38,7 +37,7 @@ class JCacheView extends JCache */ function get( &$view, $method, $id=false ) { - global $mainframe; + $appl = JFactory::getApplication(); // Initialize variables $data = false; @@ -60,7 +59,7 @@ function get( &$view, $method, $id=false ) if (isset($data['pathway']) && is_array($data['pathway'])) { // Push the pathway data into the pathway object. - $pathway = &$mainframe->getPathWay(); + $pathway = &$appl->getPathWay(); $pathway->setPathway($data['pathway']); } @@ -115,7 +114,7 @@ function get( &$view, $method, $id=false ) $cached['head'] = $document->getHeadData(); // Pathway data - $pathway = &$mainframe->getPathWay(); + $pathway = &$appl->getPathWay(); $cached['pathway'] = $pathway->getPathway(); // Get the module buffer after component execution. @@ -148,4 +147,4 @@ function _makeId(&$view, $method) { return md5(serialize(array(JRequest::getURI(), get_class($view), $method))); } -} \ No newline at end of file +} diff --git a/libraries/joomla/cache/index.html b/libraries/joomla/cache/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/cache/index.html +++ b/libraries/joomla/cache/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/cache/storage.php b/libraries/joomla/cache/storage.php index 3d8f09b01435b..3c8e07eb3c8ca 100644 --- a/libraries/joomla/cache/storage.php +++ b/libraries/joomla/cache/storage.php @@ -1,177 +1,180 @@ - - * @package Joomla.Framework - * @subpackage Cache - * @since 1.5 - */ -class JCacheStorage extends JObject -{ - /** - * Constructor - * - * @access protected - * @param array $options optional parameters - */ - function __construct( $options = array() ) - { - $this->_application = (isset($options['application'])) ? $options['application'] : null; - $this->_language = (isset($options['language'])) ? $options['language'] : 'en-GB'; - $this->_locking = (isset($options['locking'])) ? $options['locking'] : true; - $this->_lifetime = (isset($options['lifetime'])) ? $options['lifetime'] : null; - $this->_now = time(); - - // Set time threshold value - if (is_null($this->_lifetime)) { - $this->_threshold = 0; - } else { - $this->_threshold = $this->_now - $this->_lifetime; - } - } - - /** - * Returns a reference to a cache storage hanlder object, only creating it - * if it doesn't already exist. - * - * @static - * @param string $handler The cache storage handler to instantiate - * @return object A JCacheStorageHandler object - * @since 1.5 - */ - function &getInstance($handler = 'file', $options = array()) - { - static $instances; - - if (!isset ($instances)) { - $instances = array (); - } - - $handler = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', $handler)); - if (!isset($instances[$handler])) - { - $class = 'JCacheStorage'.ucfirst($handler); - if(!class_exists($class)) - { - $path = dirname(__FILE__).DS.'storage'.DS.$handler.'.php'; - - if (file_exists($path) ) { - require_once($path); - } else { - return JError::raiseWarning(500, 'Unable to load Cache Storage: '.$handler); - } - } - - $instances[$handler] = new $class($options); - } - return $instances[$handler]; - } - - /** - * Get cached data by id and group - * - * @abstract - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param boolean $checkTime True to verify cache time expiration threshold - * @return mixed Boolean false on failure or a cached data string - * @since 1.5 - */ - function get($id, $group, $checkTime) - { - return; - } - - /** - * Store the data to cache by id and group - * - * @abstract - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param string $data The data to store in cache - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function store($id, $group, $data) - { - return true; - } - - /** - * Remove a cached data entry by id and group - * - * @abstract - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function remove($id, $group) - { - return true; - } - - /** - * Clean cache for a group given a mode. - * - * group mode : cleans all cache in the group - * notgroup mode : cleans all cache not in the group - * - * @abstract - * @access public - * @param string $group The cache data group - * @param string $mode The mode for cleaning cache [group|notgroup] - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function clean($group, $mode) - { - return true; - } - - /** - * Garbage collect expired cache data - * - * @abstract - * @access public - * @return boolean True on success, false otherwise. - */ - function gc() - { - return true; - } - - /** - * Test to see if the storage handler is available. - * - * @abstract - * @static - * @access public - * @return boolean True on success, false otherwise. - */ - function test() - { - return true; - } -} \ No newline at end of file +_application = (isset($options['application'])) ? $options['application'] : null; + $this->_language = (isset($options['language'])) ? $options['language'] : 'en-GB'; + $this->_locking = (isset($options['locking'])) ? $options['locking'] : true; + $this->_lifetime = (isset($options['lifetime'])) ? $options['lifetime'] : null; + $this->_now = (isset($options['now'])) ? $options['now'] : time(); + + // Set time threshold value. If the lifetime is not set, default to 60 (0 is BAD) + // _threshold is now available ONLY as a legacy (it's deprecated). It's no longer used in the core. + if (empty($this->_lifetime)) { + $this->_threshold = $this->_now - 60; + $this->_lifetime = 60; + } else { + $this->_threshold = $this->_now - $this->_lifetime; + } + } + + /** + * Returns a reference to a cache storage hanlder object, only creating it + * if it doesn't already exist. + * + * @static + * @param string $handler The cache storage handler to instantiate + * @return object A JCacheStorageHandler object + * @since 1.5 + */ + function &getInstance($handler = 'file', $options = array()) + { + static $now = null; + if(is_null($now)) { + $now = time(); + } + $options['now'] = $now; + //We can't cache this since options may change... + $handler = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', $handler)); + $class = 'JCacheStorage'.ucfirst($handler); + if(!class_exists($class)) + { + $path = dirname(__FILE__).DS.'storage'.DS.$handler.'.php'; + if (file_exists($path) ) { + require_once($path); + } else { + return JError::raiseWarning(500, 'Unable to load Cache Storage: '.$handler); + } + } + $return = new $class($options); + return $return; + } + + /** + * Get cached data by id and group + * + * @abstract + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param boolean $checkTime True to verify cache time expiration threshold + * @return mixed Boolean false on failure or a cached data string + * @since 1.5 + */ + function get($id, $group, $checkTime) + { + return; + } + + /** + * Store the data to cache by id and group + * + * @abstract + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param string $data The data to store in cache + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function store($id, $group, $data) + { + return true; + } + + /** + * Remove a cached data entry by id and group + * + * @abstract + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function remove($id, $group) + { + return true; + } + + /** + * Clean cache for a group given a mode. + * + * group mode : cleans all cache in the group + * notgroup mode : cleans all cache not in the group + * + * @abstract + * @access public + * @param string $group The cache data group + * @param string $mode The mode for cleaning cache [group|notgroup] + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function clean($group, $mode) + { + return true; + } + + /** + * Garbage collect expired cache data + * + * @abstract + * @access public + * @return boolean True on success, false otherwise. + */ + function gc() + { + return true; + } + + /** + * Test to see if the storage handler is available. + * + * @abstract + * @static + * @access public + * @return boolean True on success, false otherwise. + */ + function test() + { + return true; + } +} diff --git a/libraries/joomla/cache/storage/apc.php b/libraries/joomla/cache/storage/apc.php index 82ee52ed2eb47..31e26d146942a 100644 --- a/libraries/joomla/cache/storage/apc.php +++ b/libraries/joomla/cache/storage/apc.php @@ -1,157 +1,156 @@ - - * @package Joomla.Framework - * @subpackage Cache - * @since 1.5 - */ -class JCacheStorageApc extends JCacheStorage -{ - /** - * Constructor - * - * @access protected - * @param array $options optional parameters - */ - function __construct( $options = array() ) - { - parent::__construct($options); - - $config =& JFactory::getConfig(); - $this->_hash = $config->getValue('config.secret'); - } - - /** - * Get cached data from APC by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param boolean $checkTime True to verify cache time expiration threshold - * @return mixed Boolean false on failure or a cached data string - * @since 1.5 - */ - function get($id, $group, $checkTime) - { - $cache_id = $this->_getCacheId($id, $group); - $this->_setExpire($cache_id); - return apc_fetch($cache_id); - } - - /** - * Store the data to APC by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param string $data The data to store in cache - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function store($id, $group, $data) - { - $cache_id = $this->_getCacheId($id, $group); - apc_store($cache_id.'_expire', time()); - return apc_store($cache_id, $data, $this->_lifetime); - } - - /** - * Remove a cached data entry by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function remove($id, $group) - { - $cache_id = $this->_getCacheId($id, $group); - apc_delete($cache_id.'_expire'); - return apc_delete($cache_id); - } - - /** - * Clean cache for a group given a mode. - * - * group mode : cleans all cache in the group - * notgroup mode : cleans all cache not in the group - * - * @access public - * @param string $group The cache data group - * @param string $mode The mode for cleaning cache [group|notgroup] - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function clean($group, $mode) - { - return true; - } - - /** - * Test to see if the cache storage is available. - * - * @static - * @access public - * @return boolean True on success, false otherwise. - */ - function test() - { - return extension_loaded('apc'); - } - - /** - * Set expire time on each call since memcache sets it on cache creation. - * - * @access private - * - * @param string $key Cache key to expire. - * @param integer $lifetime Lifetime of the data in seconds. - */ - function _setExpire($key) - { - $lifetime = $this->_lifetime; - $expire = apc_fetch($key.'_expire'); - - // set prune period - if ($expire + $lifetime < time()) { - apc_delete($key); - apc_delete($key.'_expire'); - } else { - apc_store($key.'_expire', time()); - } - } - - /** - * Get a cache_id string from an id/group pair - * - * @access private - * @param string $id The cache data id - * @param string $group The cache data group - * @return string The cache_id string - * @since 1.5 - */ - function _getCacheId($id, $group) - { - $name = md5($this->_application.'-'.$id.'-'.$this->_hash.'-'.$this->_language); - return 'cache_'.$group.'-'.$name; - } -} \ No newline at end of file + +/** + * APC cache storage handler + * + * @package Joomla.Framework + * @subpackage Cache + * @since 1.5 + */ +class JCacheStorageApc extends JCacheStorage +{ + /** + * Constructor + * + * @access protected + * @param array $options optional parameters + */ + function __construct( $options = array() ) + { + parent::__construct($options); + + $config =& JFactory::getConfig(); + $this->_hash = $config->getValue('config.secret'); + } + + /** + * Get cached data from APC by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param boolean $checkTime True to verify cache time expiration threshold + * @return mixed Boolean false on failure or a cached data string + * @since 1.5 + */ + function get($id, $group, $checkTime) + { + $cache_id = $this->_getCacheId($id, $group); + $this->_setExpire($cache_id); + return apc_fetch($cache_id); + } + + /** + * Store the data to APC by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param string $data The data to store in cache + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function store($id, $group, $data) + { + $cache_id = $this->_getCacheId($id, $group); + apc_store($cache_id.'_expire', time()); + return apc_store($cache_id, $data, $this->_lifetime); + } + + /** + * Remove a cached data entry by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function remove($id, $group) + { + $cache_id = $this->_getCacheId($id, $group); + apc_delete($cache_id.'_expire'); + return apc_delete($cache_id); + } + + /** + * Clean cache for a group given a mode. + * + * group mode : cleans all cache in the group + * notgroup mode : cleans all cache not in the group + * + * @access public + * @param string $group The cache data group + * @param string $mode The mode for cleaning cache [group|notgroup] + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function clean($group, $mode) + { + return true; + } + + /** + * Test to see if the cache storage is available. + * + * @static + * @access public + * @return boolean True on success, false otherwise. + */ + function test() + { + return extension_loaded('apc'); + } + + /** + * Set expire time on each call since memcache sets it on cache creation. + * + * @access private + * + * @param string $key Cache key to expire. + * @param integer $lifetime Lifetime of the data in seconds. + */ + function _setExpire($key) + { + $lifetime = $this->_lifetime; + $expire = apc_fetch($key.'_expire'); + + // set prune period + if ($expire + $lifetime < time()) { + apc_delete($key); + apc_delete($key.'_expire'); + } else { + apc_store($key.'_expire', time()); + } + } + + /** + * Get a cache_id string from an id/group pair + * + * @access private + * @param string $id The cache data id + * @param string $group The cache data group + * @return string The cache_id string + * @since 1.5 + */ + function _getCacheId($id, $group) + { + $name = md5($this->_application.'-'.$id.'-'.$this->_hash.'-'.$this->_language); + return 'cache_'.$group.'-'.$name; + } +} diff --git a/libraries/joomla/cache/storage/eaccelerator.php b/libraries/joomla/cache/storage/eaccelerator.php index fe01363c6bcfa..4f7dd131c9d8a 100644 --- a/libraries/joomla/cache/storage/eaccelerator.php +++ b/libraries/joomla/cache/storage/eaccelerator.php @@ -1,173 +1,172 @@ - - * @package Joomla.Framework - * @subpackage Cache - * @since 1.5 - */ -class JCacheStorageEaccelerator extends JCacheStorage -{ - /** - * Constructor - * - * @access protected - * @param array $options optional parameters - */ - function __construct( $options = array() ) - { - parent::__construct($options); - - $config =& JFactory::getConfig(); - $this->_hash = $config->getValue('config.secret'); - } - - /** - * Get cached data by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param boolean $checkTime True to verify cache time expiration threshold - * @return mixed Boolean false on failure or a cached data string - * @since 1.5 - */ - function get($id, $group, $checkTime) - { - $cache_id = $this->_getCacheId($id, $group); - $this->_setExpire($cache_id); - $cache_content = eaccelerator_get($cache_id); + +/** + * eAccelerator cache storage handler + * + * @package Joomla.Framework + * @subpackage Cache + * @since 1.5 + */ +class JCacheStorageEaccelerator extends JCacheStorage +{ + /** + * Constructor + * + * @access protected + * @param array $options optional parameters + */ + function __construct( $options = array() ) + { + parent::__construct($options); + + $config =& JFactory::getConfig(); + $this->_hash = $config->getValue('config.secret'); + } + + /** + * Get cached data by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param boolean $checkTime True to verify cache time expiration threshold + * @return mixed Boolean false on failure or a cached data string + * @since 1.5 + */ + function get($id, $group, $checkTime) + { + $cache_id = $this->_getCacheId($id, $group); + $this->_setExpire($cache_id); + $cache_content = eaccelerator_get($cache_id); if($cache_content === null) { return false; } return $cache_content; - } - - /** - * Store the data to by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param string $data The data to store in cache - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function store($id, $group, $data) - { - $cache_id = $this->_getCacheId($id, $group); - eaccelerator_put($cache_id.'_expire', time()); - return eaccelerator_put($cache_id, $data, $this->_lifetime); - } - - /** - * Remove a cached data entry by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function remove($id, $group) - { - $cache_id = $this->_getCacheId($id, $group); - eaccelerator_rm($cache_id.'_expire'); - return eaccelerator_rm($cache_id); - } - - /** - * Clean cache for a group given a mode. - * - * group mode : cleans all cache in the group - * notgroup mode : cleans all cache not in the group - * - * @access public - * @param string $group The cache data group - * @param string $mode The mode for cleaning cache [group|notgroup] - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function clean($group, $mode) - { - return true; - } - - /** - * Garbage collect expired cache data - * - * @access public - * @return boolean True on success, false otherwise. - */ - function gc() - { - return eaccelerator_gc(); - } - - /** - * Test to see if the cache storage is available. - * - * @static - * @access public - * @return boolean True on success, false otherwise. - */ - function test() - { - return (extension_loaded('eaccelerator') && function_exists('eaccelerator_get')); - } - - /** - * Set expire time on each call since memcache sets it on cache creation. - * - * @access private - * - * @param string $key Cache key to expire. - * @param integer $lifetime Lifetime of the data in seconds. - */ - function _setExpire($key) - { - $lifetime = $this->_lifetime; - $expire = eaccelerator_get($key.'_expire'); - - // set prune period - if ($expire + $lifetime < time()) { - eaccelerator_rm($key); - eaccelerator_rm($key.'_expire'); - } else { - eaccelerator_put($key.'_expire', time()); - } - } - - /** - * Get a cache_id string from an id/group pair - * - * @access private - * @param string $id The cache data id - * @param string $group The cache data group - * @return string The cache_id string - * @since 1.5 - */ - function _getCacheId($id, $group) - { - $name = md5($this->_application.'-'.$id.'-'.$this->_hash.'-'.$this->_language); - return 'cache_'.$group.'-'.$name; - } + } + + /** + * Store the data to by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param string $data The data to store in cache + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function store($id, $group, $data) + { + $cache_id = $this->_getCacheId($id, $group); + eaccelerator_put($cache_id.'_expire', time()); + return eaccelerator_put($cache_id, $data, $this->_lifetime); + } + + /** + * Remove a cached data entry by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function remove($id, $group) + { + $cache_id = $this->_getCacheId($id, $group); + eaccelerator_rm($cache_id.'_expire'); + return eaccelerator_rm($cache_id); + } + + /** + * Clean cache for a group given a mode. + * + * group mode : cleans all cache in the group + * notgroup mode : cleans all cache not in the group + * + * @access public + * @param string $group The cache data group + * @param string $mode The mode for cleaning cache [group|notgroup] + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function clean($group, $mode) + { + return true; + } + + /** + * Garbage collect expired cache data + * + * @access public + * @return boolean True on success, false otherwise. + */ + function gc() + { + return eaccelerator_gc(); + } + + /** + * Test to see if the cache storage is available. + * + * @static + * @access public + * @return boolean True on success, false otherwise. + */ + function test() + { + return (extension_loaded('eaccelerator') && function_exists('eaccelerator_get')); + } + + /** + * Set expire time on each call since memcache sets it on cache creation. + * + * @access private + * + * @param string $key Cache key to expire. + * @param integer $lifetime Lifetime of the data in seconds. + */ + function _setExpire($key) + { + $lifetime = $this->_lifetime; + $expire = eaccelerator_get($key.'_expire'); + + // set prune period + if ($expire + $lifetime < time()) { + eaccelerator_rm($key); + eaccelerator_rm($key.'_expire'); + } else { + eaccelerator_put($key.'_expire', time()); + } + } + + /** + * Get a cache_id string from an id/group pair + * + * @access private + * @param string $id The cache data id + * @param string $group The cache data group + * @return string The cache_id string + * @since 1.5 + */ + function _getCacheId($id, $group) + { + $name = md5($this->_application.'-'.$id.'-'.$this->_hash.'-'.$this->_language); + return 'cache_'.$group.'-'.$name; + } } diff --git a/libraries/joomla/cache/storage/file.php b/libraries/joomla/cache/storage/file.php index 2605498f4a21d..a21d32c685872 100644 --- a/libraries/joomla/cache/storage/file.php +++ b/libraries/joomla/cache/storage/file.php @@ -1,230 +1,266 @@ - - * @package Joomla.Framework - * @subpackage Cache - * @since 1.5 - */ -class JCacheStorageFile extends JCacheStorage -{ - /** - * Constructor - * - * @access protected - * @param array $options optional parameters - */ - function __construct( $options = array() ) - { - parent::__construct($options); - - $config =& JFactory::getConfig(); - $this->_root = $options['cachebase']; - $this->_hash = $config->getValue('config.secret'); - } - - /** - * Get cached data from a file by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param boolean $checkTime True to verify cache time expiration threshold - * @return mixed Boolean false on failure or a cached data string - * @since 1.5 - */ - function get($id, $group, $checkTime) - { - $data = false; - - $path = $this->_getFilePath($id, $group); - clearstatcache(); - if (is_file($path)) { - if ($checkTime) { - if (@ filemtime($path) > $this->_threshold) { - $data = file_get_contents($path); - } - } else { - $data = file_get_contents($path); - } - } - return $data; - } - - /** - * Store the data to a file by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param string $data The data to store in cache - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function store($id, $group, $data) - { - $written = false; - $path = $this->_getFilePath($id, $group); - - $fp = @fopen($path, "wb"); - if ($fp) { - if ($this->_locking) { - @flock($fp, LOCK_EX); - } - $len = strlen($data); - @fwrite($fp, $data, $len); - if ($this->_locking) { - @flock($fp, LOCK_UN); - } - @fclose($fp); - $written = true; - } - // Data integrity check - if ($written && ($data == file_get_contents($path))) { - return true; - } else { - return false; - } - } - - /** - * Remove a cached data file by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function remove($id, $group) - { - $path = $this->_getFilePath($id, $group); - if (!@unlink($path)) { - return false; - } - return true; - } - - /** - * Clean cache for a group given a mode. - * - * group mode : cleans all cache in the group - * notgroup mode : cleans all cache not in the group - * - * @access public - * @param string $group The cache data group - * @param string $mode The mode for cleaning cache [group|notgroup] - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function clean($group, $mode) - { - jimport('joomla.filesystem.folder'); - - $return = true; - $folder = $group; - - if(trim($folder) == '') { - $mode = 'notgroup'; - } - - switch ($mode) - { - case 'notgroup': - $folders = JFolder::folders($this->_root); - for ($i=0,$n=count($folders);$i<$n;$i++) - { - if ($folders[$i] != $folder) { - $return |= JFolder::delete($this->_root.DS.$folders[$i]); - } - } - break; - case 'group': - default: - if (is_dir($this->_root.DS.$folder)) { - $return = JFolder::delete($this->_root.DS.$folder); - } - break; - } - return $return; - } - - /** - * Garbage collect expired cache data - * - * @access public - * @return boolean True on success, false otherwise. - */ - function gc() - { - $result = true; - // files older than lifeTime get deleted from cache - if (!is_null($this->_lifeTime)) { - $files = JFolder::files($this->_root, '.', true, true); - for ($i=0,$n=count($files);$i<$n;$i++) - { - if (@ filemtime($files[$i]) < $this->_threshold) { - $result |= JFile::delete($files[$i]); - } - } - } - return $result; - } - - /** - * Test to see if the cache storage is available. - * - * @static - * @access public - * @return boolean True on success, false otherwise. - */ - function test() - { - $config =& JFactory::getConfig(); - $root = $config->getValue('config.cache_path', JPATH_ROOT.DS.'cache'); - return is_writable($root); - } - - /** - * Get a cache file path from an id/group pair - * - * @access private - * @param string $id The cache data id - * @param string $group The cache data group - * @return string The cache file path - * @since 1.5 - */ - function _getFilePath($id, $group) - { - $folder = $group; - $name = md5($this->_application.'-'.$id.'-'.$this->_hash.'-'.$this->_language).'.cache'; - - // If the folder doesn't exist try to create it - if (!is_dir($this->_root.DS.$folder)) { - @mkdir($this->_root.DS.$folder); - } - - // Make sure the folder exists - if (!is_dir($this->_root.DS.$folder)) { - return false; - } - return $this->_root.DS.$folder.DS.$name; - } -} \ No newline at end of file + +/** + * File cache storage handler + * + * @package Joomla.Framework + * @subpackage Cache + * @since 1.5 + */ +class JCacheStorageFile extends JCacheStorage +{ + protected $_root = ''; + protected $_hash = ''; + + /** + * Constructor + * + * @access protected + * @param array $options optional parameters + */ + function __construct( $options = array() ) + { + parent::__construct($options); + + $config =& JFactory::getConfig(); + $this->_root = $options['cachebase']; + $this->_hash = $config->getValue('config.secret'); + } + + /** + * Get cached data from a file by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param boolean $checkTime True to verify cache time expiration threshold + * @return mixed Boolean false on failure or a cached data string + * @since 1.5 + */ + function get($id, $group, $checkTime) + { + $data = false; + + $path = $this->_getFilePath($id, $group); + $this->_setExpire($id, $group); + if (file_exists($path)) { + $data = file_get_contents($path); + if($data) { + // Remove the initial die() statement + $data = preg_replace('/^.*\n/', '', $data); + } + } + + return $data; + } + + /** + * Store the data to a file by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param string $data The data to store in cache + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function store($id, $group, $data) + { + $written = false; + $path = $this->_getFilePath($id, $group); + $expirePath = $path . '_expire'; + $die = ''."\n"; + + // Prepend a die string + + $data = $die.$data; + + $fp = @fopen($path, "wb"); + if ($fp) { + if ($this->_locking) { + @flock($fp, LOCK_EX); + } + $len = strlen($data); + @fwrite($fp, $data, $len); + if ($this->_locking) { + @flock($fp, LOCK_UN); + } + @fclose($fp); + $written = true; + } + // Data integrity check + if ($written && ($data == file_get_contents($path))) { + @file_put_contents($expirePath, ($this->_now + $this->_lifetime)); + return true; + } else { + return false; + } + } + + /** + * Remove a cached data file by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function remove($id, $group) + { + $path = $this->_getFilePath($id, $group); + @unlink($path.'_expire'); + if (!@unlink($path)) { + return false; + } + return true; + } + + /** + * Clean cache for a group given a mode. + * + * group mode : cleans all cache in the group + * notgroup mode : cleans all cache not in the group + * + * @access public + * @param string $group The cache data group + * @param string $mode The mode for cleaning cache [group|notgroup] + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function clean($group, $mode) + { + jimport('joomla.filesystem.folder'); + + $return = true; + $folder = $group; + + if(trim($folder) == '') { + $mode = 'notgroup'; + } + + switch ($mode) + { + case 'notgroup': + $folders = JFolder::folders($this->_root); + for ($i=0,$n=count($folders);$i<$n;$i++) + { + if ($folders[$i] != $folder) { + $return |= JFolder::delete($this->_root.DS.$folders[$i]); + } + } + break; + case 'group': + default: + if (is_dir($this->_root.DS.$folder)) { + $return = JFolder::delete($this->_root.DS.$folder); + } + break; + } + return $return; + } + + /** + * Garbage collect expired cache data + * + * @access public + * @return boolean True on success, false otherwise. + */ + function gc() + { + $result = true; + // files older than lifeTime get deleted from cache + $files = JFolder::files($this->_root, '_expire', true, true); + foreach($files As $file) { + $time = @file_get_contents($file); + if ($time < $this->_now) { + $result |= JFile::delete($file); + $result |= JFile::delete(str_replace('_expire', '', $file)); + } + } + return $result; + } + + /** + * Test to see if the cache storage is available. + * + * @static + * @access public + * @return boolean True on success, false otherwise. + */ + function test() + { + $config =& JFactory::getConfig(); + $root = $config->getValue('config.cache_path', JPATH_ROOT.DS.'cache'); + return is_writable($root); + } + + /** + * Check to make sure cache is still valid, if not, delete it. + * + * @access private + * + * @param string $id Cache key to expire. + * @param string $group The cache data group. + */ + function _setExpire($id, $group) + { + $path = $this->_getFilePath($id, $group); + + // set prune period + if(file_exists($path.'_expire')) { + $time = @file_get_contents($path.'_expire'); + if ($time < $this->_now || empty($time)) { + $this->remove($id, $group); + } + } elseif(file_exists($path)) { + //This means that for some reason there's no expire file, remove it + $this->remove($id, $group); + } + } + + /** + * Get a cache file path from an id/group pair + * + * @access private + * @param string $id The cache data id + * @param string $group The cache data group + * @return string The cache file path + * @since 1.5 + */ + function _getFilePath($id, $group) + { + $folder = $group; + $name = md5($this->_application.'-'.$id.'-'.$this->_hash.'-'.$this->_language).'.php'; + $dir = $this->_root.DS.$folder; + + // If the folder doesn't exist try to create it + if (!is_dir($dir)) { + + // Make sure the index file is there + $indexFile = $dir . DS . 'index.html'; + @ mkdir($dir) && file_put_contents($indexFile, ''); + } + + // Make sure the folder exists + if (!is_dir($dir)) { + return false; + } + return $dir.DS.$name; + } +} diff --git a/libraries/joomla/cache/storage/index.html b/libraries/joomla/cache/storage/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/cache/storage/index.html +++ b/libraries/joomla/cache/storage/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/cache/storage/memcache.php b/libraries/joomla/cache/storage/memcache.php index 7132810f0c611..514216f17b630 100644 --- a/libraries/joomla/cache/storage/memcache.php +++ b/libraries/joomla/cache/storage/memcache.php @@ -1,216 +1,215 @@ - - * @author Mitch Pirtle - * @package Joomla.Framework - * @subpackage Cache - * @since 1.5 - */ -class JCacheStorageMemcache extends JCacheStorage -{ - /** - * Resource for the current memcached connection. - * @var resource - */ - var $_db; - - /** - * Use compression? - * @var int - */ - var $_compress = null; - - /** - * Use persistent connections - * @var boolean - */ - var $_persistent = false; - - /** - * Constructor - * - * @access protected - * @param array $options optional parameters - */ - function __construct( $options = array() ) - { - if (!$this->test()) { - return JError::raiseError(404, "The memcache extension is not available"); - } - - parent::__construct($options); - - $config =& JFactory::getConfig(); - - $params = $config->getValue('config.memcache_settings'); - if (!is_array($params)) { - $params = unserialize(stripslashes($params)); - } - - if (!$params) { - $params = array(); - } - - $this->_compress = (isset($params['compression'])) ? $params['compression'] : 0; - $this->_persistent = (isset($params['persistent'])) ? $params['persistent'] : false; - - // This will be an array of loveliness - $this->_servers = (isset($params['servers'])) ? $params['servers'] : array(); - - // Create the memcache connection - $this->_db = new Memcache; - for ($i=0, $n=count($this->_servers); $i < $n; $i++) - { - $server = $this->_servers[$i]; - $this->_db->addServer($server['host'], $server['port'], $this->_persistent); - } - - // Get the site hash - $this->_hash = $config->getValue('config.secret'); - } - - /** - * Get cached data from memcache by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param boolean $checkTime True to verify cache time expiration threshold - * @return mixed Boolean false on failure or a cached data string - * @since 1.5 - */ - function get($id, $group, $checkTime) - { - $cache_id = $this->_getCacheId($id, $group); - $this->_setExpire($cache_id); - return $this->_db->get($cache_id); - } - - /** - * Store the data to memcache by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @param string $data The data to store in cache - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function store($id, $group, $data) - { - $cache_id = $this->_getCacheId($id, $group); - $this->_db->set($cache_id.'_expire', time(), 0, 0); - return $this->_db->set($cache_id, $data, $this->_compress, 0); - } - - /** - * Remove a cached data entry by id and group - * - * @access public - * @param string $id The cache data id - * @param string $group The cache data group - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function remove($id, $group) - { - $cache_id = $this->_getCacheId($id, $group); - $this->_db->delete($cache_id.'_expire'); - return $this->_db->delete($cache_id); - } - - /** - * Clean cache for a group given a mode. - * - * group mode : cleans all cache in the group - * notgroup mode : cleans all cache not in the group - * - * @access public - * @param string $group The cache data group - * @param string $mode The mode for cleaning cache [group|notgroup] - * @return boolean True on success, false otherwise - * @since 1.5 - */ - function clean($group, $mode) - { - return true; - } - - /** - * Garbage collect expired cache data - * - * @access public - * @return boolean True on success, false otherwise. - */ - function gc() - { - return true; - } - - /** - * Test to see if the cache storage is available. - * - * @static - * @access public - * @return boolean True on success, false otherwise. - */ - function test() - { - return (extension_loaded('memcache') && class_exists('Memcache')); - } - - /** - * Set expire time on each call since memcache sets it on cache creation. - * - * @access private - * - * @param string $key Cache key to expire. - * @param integer $lifetime Lifetime of the data in seconds. - */ - function _setExpire($key) - { - $lifetime = $this->_lifetime; - $expire = $this->_db->get($key.'_expire'); - - // set prune period - if ($expire + $lifetime < time()) { - $this->_db->delete($key); - $this->_db->delete($key.'_expire'); - } else { - $this->_db->replace($key.'_expire', time()); - } - } - - /** - * Get a cache_id string from an id/group pair - * - * @access private - * @param string $id The cache data id - * @param string $group The cache data group - * @return string The cache_id string - * @since 1.5 - */ - function _getCacheId($id, $group) - { - $name = md5($this->_application.'-'.$id.'-'.$this->_hash.'-'.$this->_language); - return 'cache_'.$group.'-'.$name; - } -} \ No newline at end of file +test()) { + return JError::raiseError(404, "The memcache extension is not available"); + } + parent::__construct($options); + + $params =& JCacheStorageMemcache::getConfig(); + $this->_compress = (isset($params['compression'])) ? $params['compression'] : 0; + $this->_db =& JCacheStorageMemcache::getConnection(); + + // Get the site hash + $this->_hash = $params['hash']; + } + + /** + * return memcache connection object + * + * @static + * @access private + * @return object memcache connection object + */ + function &getConnection() { + static $db = null; + if(is_null($db)) { + $params =& JCacheStorageMemcache::getConfig(); + $persistent = (isset($params['persistent'])) ? $params['persistent'] : false; + // This will be an array of loveliness + $servers = (isset($params['servers'])) ? $params['servers'] : array(); + + // Create the memcache connection + $db = new Memcache; + foreach($servers AS $server) { + $db->addServer($server['host'], $server['port'], $persistent); + } + } + return $db; + } + + /** + * Return memcache related configuration + * + * @static + * @access private + * @return array options + */ + function &getConfig() { + static $params = null; + if(is_null($params)) { + $config =& JFactory::getConfig(); + $params = $config->getValue('config.memcache_settings'); + if (!is_array($params)) { + $params = unserialize(stripslashes($params)); + } + + if (!$params) { + $params = array(); + } + $params['hash'] = $config->getValue('config.secret'); + } + return $params; + } + + /** + * Get cached data from memcache by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param boolean $checkTime True to verify cache time expiration threshold + * @return mixed Boolean false on failure or a cached data string + * @since 1.5 + */ + function get($id, $group, $checkTime) + { + $cache_id = $this->_getCacheId($id, $group); + return $this->_db->get($cache_id); + } + + /** + * Store the data to memcache by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @param string $data The data to store in cache + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function store($id, $group, $data) + { + $cache_id = $this->_getCacheId($id, $group); + return $this->_db->set($cache_id, $data, $this->_compress, $this->_lifetime); + } + + /** + * Remove a cached data entry by id and group + * + * @access public + * @param string $id The cache data id + * @param string $group The cache data group + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function remove($id, $group) + { + $cache_id = $this->_getCacheId($id, $group); + return $this->_db->delete($cache_id); + } + + /** + * Clean cache for a group given a mode. + * + * group mode : cleans all cache in the group + * notgroup mode : cleans all cache not in the group + * + * @access public + * @param string $group The cache data group + * @param string $mode The mode for cleaning cache [group|notgroup] + * @return boolean True on success, false otherwise + * @since 1.5 + */ + function clean($group, $mode) + { + return true; + } + + /** + * Garbage collect expired cache data + * + * @access public + * @return boolean True on success, false otherwise. + */ + function gc() + { + return true; + } + + /** + * Test to see if the cache storage is available. + * + * @static + * @access public + * @return boolean True on success, false otherwise. + */ + function test() + { + return (extension_loaded('memcache') && class_exists('Memcache')); + } + + /** + * Get a cache_id string from an id/group pair + * + * @access private + * @param string $id The cache data id + * @param string $group The cache data group + * @return string The cache_id string + * @since 1.5 + */ + function _getCacheId($id, $group) + { + $name = md5($this->_application.'-'.$id.'-'.$this->_hash.'-'.$this->_language); + return 'cache_'.$group.'-'.$name; + } +} diff --git a/libraries/joomla/cache/storage/xcache.php b/libraries/joomla/cache/storage/xcache.php index f18c2199672c8..7446a8078f5e6 100644 --- a/libraries/joomla/cache/storage/xcache.php +++ b/libraries/joomla/cache/storage/xcache.php @@ -18,7 +18,6 @@ /** * XCache cache storage handler * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Cache * @since 1.5 @@ -58,7 +57,6 @@ function get($id, $group, $checkTime) return false; } - $this->_setExpire($cache_id); return xcache_get($cache_id); } @@ -75,7 +73,6 @@ function get($id, $group, $checkTime) function store($id, $group, $data) { $cache_id = $this->_getCacheId($id, $group); - xcache_set($cache_id.'_expire', time() ); return xcache_set($cache_id, $data, $this->_lifetime); } @@ -128,28 +125,6 @@ function test() return (extension_loaded('xcache')); } - /** - * Set expire time on each call since memcache sets it on cache creation. - * - * @access private - * - * @param string $key Cache key to expire. - * @param integer $lifetime Lifetime of the data in seconds. - */ - function _setExpire($key) - { - $lifetime = $this->_lifetime; - $expire = xcache_get($key.'_expire'); - - // set prune period - if ($expire + $lifetime < time()) { - xcache_unset($key); - xcache_unset($key.'_expire'); - } else { - xcache_set($key.'_expire', time()); - } - } - /** * Get a cache_id string from an id/group pair * diff --git a/libraries/joomla/client/ftp.php b/libraries/joomla/client/ftp.php index 23d36d928932c..f2899d4758d75 100644 --- a/libraries/joomla/client/ftp.php +++ b/libraries/joomla/client/ftp.php @@ -53,7 +53,6 @@ /** * FTP client class * - * @author Louis Landry * @package Joomla.Framework * @subpackage Client * @since 1.5 @@ -67,7 +66,7 @@ class JFTP extends JObject * @access private * @var socket resource */ - var $_conn = null; + protected $_conn = null; /** * Data port connection resource @@ -75,7 +74,7 @@ class JFTP extends JObject * @access private * @var socket resource */ - var $_dataconn = null; + protected $_dataconn = null; /** * Passive connection information @@ -83,7 +82,7 @@ class JFTP extends JObject * @access private * @var array */ - var $_pasv = null; + protected $_pasv = null; /** * Response Message @@ -91,7 +90,7 @@ class JFTP extends JObject * @access private * @var string */ - var $_response = null; + protected $_response = null; /** * Timeout limit @@ -99,7 +98,7 @@ class JFTP extends JObject * @access private * @var int */ - var $_timeout = 15; + protected $_timeout = 15; /** * Transfer Type @@ -107,7 +106,7 @@ class JFTP extends JObject * @access private * @var int */ - var $_type = null; + protected $_type = null; /** * Native OS Type @@ -115,7 +114,7 @@ class JFTP extends JObject * @access private * @var string */ - var $_OS = null; + protected $_OS = null; /** * Array to hold ascii format file extensions @@ -124,7 +123,7 @@ class JFTP extends JObject * @access private * @var array */ - var $_autoAscii = array ("asp", "bat", "c", "cpp", "csv", "h", "htm", "html", "shtml", "ini", "inc", "log", "php", "php3", "pl", "perl", "sh", "sql", "txt", "xhtml", "xml"); + protected $_autoAscii = array ("asp", "bat", "c", "cpp", "csv", "h", "htm", "html", "shtml", "ini", "inc", "log", "php", "php3", "pl", "perl", "sh", "sql", "txt", "xhtml", "xml"); /** * Array to hold native line ending characters @@ -133,7 +132,7 @@ class JFTP extends JObject * @access private * @var array */ - var $_lineEndings = array ('UNIX' => "\n", 'MAC' => "\r", 'WIN' => "\r\n"); + protected $_lineEndings = array ('UNIX' => "\n", 'MAC' => "\r", 'WIN' => "\r\n"); /** * JFTP object constructor @@ -142,7 +141,7 @@ class JFTP extends JObject * @param array $options Associative array of options to set * @since 1.5 */ - function __construct($options=array()) { + protected function __construct($options=array()) { // If default transfer type is no set, set it to autoascii detect if (!isset ($options['type'])) { @@ -164,11 +163,6 @@ function __construct($options=array()) { // Autoloading fails for JBuffer as the class is used as a stream handler JLoader::load('JBuffer'); } - - // Register faked "destructor" in PHP4 to close all connections we might have made - if (version_compare(PHP_VERSION, '5') == -1) { - register_shutdown_function(array(&$this, '__destruct')); - } } /** @@ -179,7 +173,7 @@ function __construct($options=array()) { * @access protected * @since 1.5 */ - function __destruct() { + public function __destruct() { if (is_resource($this->_conn)) { $this->quit(); } @@ -205,7 +199,7 @@ function __destruct() { * @return JFTP The FTP Client object. * @since 1.5 */ - function &getInstance($host = '127.0.0.1', $port = '21', $options = null, $user = null, $pass = null) + public static function &getInstance($host = '127.0.0.1', $port = '21', $options = null, $user = null, $pass = null) { static $instances = array(); @@ -236,7 +230,7 @@ function &getInstance($host = '127.0.0.1', $port = '21', $options = null, $user * @param array $options Associative array of options to set * @return boolean True if successful */ - function setOptions($options) { + public function setOptions($options) { if (isset ($options['type'])) { $this->_type = $options['type']; @@ -255,7 +249,7 @@ function setOptions($options) { * @param string $port Port to connect on [Default: port 21] * @return boolean True if successful */ - function connect($host = '127.0.0.1', $port = 21) { + public function connect($host = '127.0.0.1', $port = 21) { // Initialize variables $errno = null; @@ -269,7 +263,7 @@ function connect($host = '127.0.0.1', $port = 21) { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { $this->_conn = @ftp_connect($host, $port, $this->_timeout); - if ($this->_conn === false) { + if ( ! $this->_conn ) { JError::raiseWarning('30', 'JFTP::connect: Could not connect to host "'.$host.'" on port '.$port); return false; } @@ -304,7 +298,7 @@ function connect($host = '127.0.0.1', $port = 21) { * @return boolean True if connected * @since 1.5 */ - function isConnected() + public function isConnected() { return is_resource($this->_conn); } @@ -317,7 +311,7 @@ function isConnected() * @param string $pass Password to login to the server * @return boolean True if successful */ - function login($user = 'anonymous', $pass = 'jftp@joomla.org') { + public function login($user = 'anonymous', $pass = 'jftp@joomla.org') { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -354,7 +348,7 @@ function login($user = 'anonymous', $pass = 'jftp@joomla.org') { * @access public * @return boolean True if successful */ - function quit() { + public function quit() { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -375,7 +369,7 @@ function quit() { * @access public * @return string Current working directory */ - function pwd() { + public function pwd() { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -408,7 +402,7 @@ function pwd() { * @access public * @return string System identifier string */ - function syst() { + public function syst() { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -445,7 +439,7 @@ function syst() { * @param string $path Path to change into on the server * @return boolean True if successful */ - function chdir($path) { + public function chdir($path) { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -473,7 +467,7 @@ function chdir($path) { * @access public * @return boolean True if successful */ - function reinit() { + public function reinit() { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -501,7 +495,7 @@ function reinit() { * @param string $to Path to change file/folder to * @return boolean True if successful */ - function rename($from, $to) { + public function rename($from, $to) { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -535,7 +529,7 @@ function rename($from, $to) { * @param string/int $mode Octal value to change mode to, e.g. '0777', 0777 or 511 * @return boolean True if successful */ - function chmod($path, $mode) { + public function chmod($path, $mode) { // If no filename is given, we assume the current directory is the target if ($path == '') { @@ -575,7 +569,7 @@ function chmod($path, $mode) { * @param string $path Path to delete * @return boolean True if successful */ - function delete($path) { + public function delete($path) { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -605,7 +599,7 @@ function delete($path) { * @param string $path Directory to create * @return boolean True if successful */ - function mkdir($path) { + public function mkdir($path) { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -631,7 +625,7 @@ function mkdir($path) { * @param int $point Byte to restart transfer at * @return boolean True if successful */ - function restart($point) { + public function restart($point) { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -658,7 +652,7 @@ function restart($point) { * @param string $path Path local file to store on the FTP server * @return boolean True if successful */ - function create($path) { + public function create($path) { // If native FTP support is enabled lets use it... if (FTP_NATIVE) { @@ -709,7 +703,7 @@ function create($path) { * @param string $buffer Buffer variable to read file contents into * @return boolean True if successful */ - function read($remote, &$buffer) { + public function read($remote, &$buffer) { // Determine file type $mode = $this->_findMode($remote); @@ -782,7 +776,7 @@ function read($remote, &$buffer) { * @param string $remote Path to remote file to get on the FTP server * @return boolean True if successful */ - function get($local, $remote) { + public function get($local, $remote) { // Determine file type $mode = $this->_findMode($remote); @@ -849,7 +843,7 @@ function get($local, $remote) { * @param string $remote FTP path to file to create * @return boolean True if successful */ - function store($local, $remote = null) { + public function store($local, $remote = null) { // If remote file not given, use the filename of the local file in the current // working directory @@ -935,7 +929,7 @@ function store($local, $remote = null) { * @param string $buffer Contents to write to the FTP server * @return boolean True if successful */ - function write($remote, $buffer) { + public function write($remote, &$buffer) { // Determine file type $mode = $this->_findMode($remote); @@ -1007,7 +1001,7 @@ function write($remote, $buffer) { * @param string $path Path local file to store on the FTP server * @return string Directory listing */ - function listNames($path = null) { + public function listNames($path = null) { // Initialize variables $data = null; @@ -1091,7 +1085,7 @@ function listNames($path = null) { * @param boolean $search Recursively search subdirectories * @return mixed : if $type is raw: string Directory listing, otherwise array of string with file-names */ - function listDetails($path = null, $type = 'all') { + public function listDetails($path = null, $type = 'all') { // Initialize variables $dir_list = array(); @@ -1288,7 +1282,7 @@ function listDetails($path = null, $type = 'all') { * @param mixed $expected Integer response code or array of integer response codes * @return boolean True if command executed successfully */ - function _putCmd($cmd, $expectedResponse) { + private function _putCmd($cmd, $expectedResponse) { // Make sure we have a connection to the server if (!is_resource($this->_conn)) { @@ -1311,7 +1305,7 @@ function _putCmd($cmd, $expectedResponse) { * @param mixed $expected Integer response code or array of integer response codes * @return boolean True if response code from the server is expected */ - function _verifyResponse($expected) { + private function _verifyResponse($expected) { // Initialize variables $parts = null; @@ -1356,7 +1350,7 @@ function _verifyResponse($expected) { * @access private * @return boolean True if successful */ - function _passive() { + private function _passive() { //Initialize variables $match = array(); @@ -1425,7 +1419,7 @@ function _passive() { * @param string $fileName Name of the file * @return integer Transfer-mode for this filetype [FTP_ASCII|FTP_BINARY] */ - function _findMode($fileName) { + private function _findMode($fileName) { if ($this->_type == FTP_AUTOASCII) { $dot = strrpos($fileName, '.') + 1; $ext = substr($fileName, $dot); @@ -1451,7 +1445,7 @@ function _findMode($fileName) { * Defined constants can also be used [FTP_BINARY|FTP_ASCII] * @return boolean True if successful */ - function _mode($mode) { + private function _mode($mode) { if ($mode == FTP_BINARY) { if (!$this->_putCmd("TYPE I", 200)) { JError::raiseWarning('35', 'JFTP::_mode: Bad response', 'Server response: '.$this->_response.' [Expected: 200] Mode sent: Binary' ); diff --git a/libraries/joomla/client/helper.php b/libraries/joomla/client/helper.php index 2628d256d3722..33bb60b9b3672 100644 --- a/libraries/joomla/client/helper.php +++ b/libraries/joomla/client/helper.php @@ -14,13 +14,11 @@ * Client helper class * * @static - * @author Louis Landry - * @author Enno Klasing * @package Joomla.Framework * @subpackage Client * @since 1.5 */ -class JClientHelper +abstract class JClientHelper { /** * Method to return the array of client layer configuration options @@ -33,7 +31,7 @@ class JClientHelper * these fields: enabled, host, port, user, pass, root * @since 1.5 */ - function getCredentials($client, $force=false) + public static function getCredentials($client, $force=false) { static $credentials = array(); @@ -100,7 +98,7 @@ function getCredentials($client, $force=false) * @return boolean True if the given login credentials have been set and are valid * @since 1.5 */ - function setCredentials($client, $user, $pass) + public static function setCredentials($client, $user, $pass) { $return = false; $client = strtolower($client); @@ -157,7 +155,7 @@ function setCredentials($client, $user, $pass) * @return boolean True if login credentials are available * @since 1.5 */ - function hasCredentials($client) + public static function hasCredentials($client) { $return = false; $client = strtolower($client); @@ -218,7 +216,7 @@ function hasCredentials($client) * @return boolean|JExeption True, if FTP settings should be shown, or an exeption * @since 1.5 */ - function &setCredentialsFromRequest($client) + public static function &setCredentialsFromRequest($client) { // Determine wether FTP credentials have been passed along with the current request $user = JRequest::getString('username', null, 'POST', JREQUEST_ALLOWRAW); @@ -240,4 +238,4 @@ function &setCredentialsFromRequest($client) return $return; } -} \ No newline at end of file +} diff --git a/libraries/joomla/client/index.html b/libraries/joomla/client/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/client/index.html +++ b/libraries/joomla/client/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/client/ldap.php b/libraries/joomla/client/ldap.php index 35606509b7e94..20a7e0c98c9b4 100644 --- a/libraries/joomla/client/ldap.php +++ b/libraries/joomla/client/ldap.php @@ -1,407 +1,483 @@ - - * @package Joomla.Framework - * @subpackage Client - * @since 1.5 - */ -class JLDAP extends JObject -{ - /** @var string Hostname of LDAP server - @access public */ - var $host = null; - /** @var bool Authorization Method to use - @access public */ - var $auth_method = null; - /** @var int Port of LDAP server - @access public */ - var $port = null; - /** @var string Base DN (e.g. o=MyDir) - @access public */ - var $base_dn = null; - /** @var string User DN (e.g. cn=Users,o=MyDir) - @access public */ - var $users_dn = null; - /** @var string Search String - @access public */ - var $search_string = null; - /** @var boolean Use LDAP Version 3 - @access public */ - var $use_ldapV3 = null; - /** @var boolean No referrals (server transfers) - @access public */ - var $no_referrals = null; - /** @var boolean Negotiate TLS (encrypted communications) - @access public */ - var $negotiate_tls = null; - - /** @var string Username to connect to server - @access public */ - var $username = null; - /** @var string Password to connect to server - @access public */ - var $password = null; - - /** @var mixed LDAP Resource Identifier - @access private */ - var $_resource = null; - /** @var string Current DN - @access private */ - var $_dn = null; - - /** - * Constructor - * - * @param object An object of configuration variables - * @access public - */ - function __construct($configObj = null) - { - if (is_object($configObj)) - { - $vars = get_class_vars(get_class($this)); - foreach (array_keys($vars) as $var) - { - if (substr($var, 0, 1) != '_') { - if ($param = $configObj->get($var)) { - $this-> $var = $param; - } - } - } - } - } - - /** - * Connect to server - * @return boolean True if successful - * @access public - */ - function connect() - { - if ($this->host == '') { - return false; - } - $this->_resource = @ ldap_connect($this->host, $this->port); - if ($this->_resource) - { - if ($this->use_ldapV3) { - if (!@ldap_set_option($this->_resource, LDAP_OPT_PROTOCOL_VERSION, 3)) { - return false; - } - } - if (!@ldap_set_option($this->_resource, LDAP_OPT_REFERRALS, intval($this->no_referrals))) { - return false; - } - if ($this->negotiate_tls) { - if (!@ldap_start_tls($this->_resource)) { - return false; - } - } - return true; - } else { - return false; - } - } - - /** - * Close the connection - * @access public - */ - function close() { - @ ldap_close($this->_resource); - } - - /** - * Sets the DN with some template replacements - * - * @param string The username - * @access public - */ - function setDN($username,$nosub = 0) - { - if ($this->users_dn == '' || $nosub) { - $this->_dn = $username; - } else if(strlen($username)) { - $this->_dn = str_replace('[username]', $username, $this->users_dn); +get($var)) { + $this-> $var = $param; + } + } + } + } + } + + /** + * Connect to server + * @return boolean True if successful + * @access public + */ + public function connect() + { + if ($this->host == '') { + return false; + } + $this->_resource = @ ldap_connect($this->host, $this->port); + if ($this->_resource) + { + if ($this->use_ldapV3) { + if (!@ldap_set_option($this->_resource, LDAP_OPT_PROTOCOL_VERSION, 3)) { + return false; + } + } + if (!@ldap_set_option($this->_resource, LDAP_OPT_REFERRALS, intval($this->no_referrals))) { + return false; + } + if ($this->negotiate_tls) { + if (!@ldap_start_tls($this->_resource)) { + return false; + } + } + return true; + } else { + return false; + } + } + + /** + * Close the connection + * @access public + */ + public function close() { + @ ldap_close($this->_resource); + } + + /** + * Sets the DN with some template replacements + * + * @param string The username + * @access public + */ + public function setDN($username,$nosub = 0) + { + if ($this->users_dn == '' || $nosub) { + $this->_dn = $username; + } else if(strlen($username)) { + $this->_dn = str_replace('[username]', $username, $this->users_dn); } else { $this->_dn = ''; - } - } - - /** - * @return string The current dn - * @access public - */ - function getDN() { - return $this->_dn; - } - - /** - * Anonymously Binds to LDAP Directory - */ - function anonymous_bind() - { - $bindResult = @ldap_bind($this->_resource); - return $bindResult; - } - - /** - * Binds to the LDAP directory - * - * @param string The username - * @param string The password - * @return boolean Result - * @access public - */ - function bind($username = null, $password = null, $nosub = 0) - { - if (is_null($username)) { - $username = $this->username; - } - if (is_null($password)) { - $password = $this->password; - } + } + } + + /** + * @return string The current dn + * @access public + */ + public function getDN() { + return $this->_dn; + } + + /** + * Anonymously Binds to LDAP Directory + */ + public function anonymous_bind() + { + $bindResult = @ldap_bind($this->_resource); + return $bindResult; + } + + /** + * Binds to the LDAP directory + * + * @param string The username + * @param string The password + * @return boolean Result + * @access public + */ + public function bind($username = null, $password = null, $nosub = 0) + { + if (is_null($username)) { + $username = $this->username; + } + if (is_null($password)) { + $password = $this->password; + } $this->setDN($username,$nosub); - //if(strlen($this->getDN())) - $bindResult = @ldap_bind($this->_resource, $this->getDN(), $password); - return $bindResult; - } - - /** - * Perform an LDAP search using comma seperated search strings - * - * @param string search string of search values - */ - function simple_search($search) - { - $results = explode(';', $search); - foreach($results as $key=>$result) { - $results[$key] = '('.$result.')'; - } - return $this->search($results); - } - - - /** - * Perform an LDAP search - * - * @param array Search Filters (array of strings) - * @param string DN Override - * @return array Multidimensional array of results - * @access public - */ - function search($filters, $dnoverride = null) - { - $attributes = array (); - if ($dnoverride) { - $dn = $dnoverride; - } else { - $dn = $this->base_dn; - } - - $resource = $this->_resource; - - foreach ($filters as $search_filter) - { - $search_result = @ldap_search($resource, $dn, $search_filter); - if ($search_result && ($count = @ldap_count_entries($resource, $search_result)) > 0) - { - for ($i = 0; $i < $count; $i++) - { - $attributes[$i] = Array (); - if (!$i) { - $firstentry = ldap_first_entry($resource, $search_result); - } else { - $firstentry = ldap_next_entry($resource, $firstentry); - } - $attributes_array = ldap_get_attributes($resource, $firstentry); // load user-specified attributes - // ldap returns an array of arrays, fit this into attributes result array - foreach ($attributes_array as $ki => $ai) - { - if (is_array($ai)) - { - $subcount = $ai['count']; - $attributes[$i][$ki] = Array (); - for ($k = 0; $k < $subcount; $k++) { - $attributes[$i][$ki][$k] = $ai[$k]; - } - } - } - $attributes[$i]['dn'] = ldap_get_dn($resource, $firstentry); - } - } - } - return $attributes; - } - - /** - * Replace an entry and return a true or false result - * - * @param string dn The DN which contains the attribute you want to replace - * @param string attribute The attribute values you want to replace - * @return mixed result of comparison (true, false, -1 on error) - */ - - function replace($dn, $attribute) { - return ldap_mod_replace($this->_resource, $dn, $attribute); - } - - - /** - * Modifies an entry and return a true or false result - * - * @param string dn The DN which contains the attribute you want to modify - * @param string attribute The attribute values you want to modify - * @return mixed result of comparison (true, false, -1 on error) - */ - function modify($dn, $attribute) { - return ldap_modify($this->_resource, $dn, $attribute); - } - - /** - * Removes attribute value from given dn and return a true or false result - * - * @param string dn The DN which contains the attribute you want to remove - * @param string attribute The attribute values you want to remove - * @return mixed result of comparison (true, false, -1 on error) - */ - function remove($dn, $attribute) - { - $resource = $this->_resource; - return ldap_mod_del($resource, $dn, $attribute); - } - - /** - * Compare an entry and return a true or false result - * - * @param string dn The DN which contains the attribute you want to compare - * @param string attribute The attribute whose value you want to compare - * @param string value The value you want to check against the LDAP attribute - * @return mixed result of comparison (true, false, -1 on error) - */ - function compare($dn, $attribute, $value) { - return ldap_compare($this->_resource, $dn, $attribute, $value); - } - - /** - * Read all or specified attributes of given dn - * - * @param string dn The DN of the object you want to read - * @param string attribute The attribute values you want to read (Optional) - * @return array of attributes or -1 on error - */ - function read($dn, $attribute = array()) - { - $base = substr($dn,strpos($dn,',')+1); - $cn = substr($dn,0,strpos($dn,',')); - $result = ldap_read($this->_resource, $base, $cn); - - if ($result) { - // TODO: instead of just returning array of attributes, convert to object before returning - return ldap_get_entries($this->_resource, $result); - } else { - return $result; - } - } - - /** - * Converts a dot notation IP address to net address (e.g. for Netware, etc) - * - * @param string IP Address (e.g. xxx.xxx.xxx.xxx) - * @return string Net address - * @access public - */ - function ipToNetAddress($ip) - { - $parts = explode('.', $ip); - $address = '1#'; - - foreach ($parts as $int) { - $tmp = dechex($int); - if (strlen($tmp) != 2) { - $tmp = '0' . $tmp; - } - $address .= '\\' . $tmp; - } - return $address; - } - - /** - * extract readable network address from the LDAP encoded networkAddress attribute. - * @author Jay Burrell, Systems & Networks, Mississippi State University - * Please keep this document block and author attribution in place. - * - * Novell Docs, see: http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5624.html#sdk5624 - * for Address types: http://developer.novell.com/ndk/doc/ndslib/index.html?page=/ndk/doc/ndslib/schm_enu/data/sdk4170.html - * LDAP Format, String: - * taggedData = uint32String "#" octetstring - * byte 0 = uint32String = Address Type: 0= IPX Address; 1 = IP Address - * byte 1 = char = "#" - separator - * byte 2+ = octetstring - the ordinal value of the address - * Note: with eDirectory 8.6.2, the IP address (type 1) returns - * correctly, however, an IPX address does not seem to. eDir 8.7 may correct this. - * Enhancement made by Merijn van de Schoot: - * If addresstype is 8 (UDP) or 9 (TCP) do some additional parsing like still returning the IP address - * TODO: Return an extra value with UDP or TCP portnumber - */ - function LDAPNetAddr($networkaddress) - { - $addr = ""; - $addrtype = intval(substr($networkaddress, 0, 1)); - $networkaddress = substr($networkaddress, 2); // throw away bytes 0 and 1 which should be the addrtype and the "#" separator - - if (($addrtype == 8) || ($addrtype = 9)) { // if udp or tcp, (TODO fill addrport and) strip portnumber information from address - $networkaddress = substr($networkaddress, (strlen($networkaddress)-4)); - } - - $addrtypes = array ( - 'IPX', - 'IP', - 'SDLC', - 'Token Ring', - 'OSI', - 'AppleTalk', - 'NetBEUI', - 'Socket', - 'UDP', - 'TCP', - 'UDP6', - 'TCP6', - 'Reserved (12)', - 'URL', - 'Count' - ); - $len = strlen($networkaddress); - if ($len > 0) - { - for ($i = 0; $i < $len; $i += 1) - { - $byte = substr($networkaddress, $i, 1); - $addr .= ord($byte); - if ( ($addrtype == 1) || ($addrtype == 8) || ($addrtype = 9) ) { // dot separate IP addresses... - $addr .= "."; - } - } - if ( ($addrtype == 1) || ($addrtype == 8) || ($addrtype = 9) ) { // strip last period from end of $addr - $addr = substr($addr, 0, strlen($addr) - 1); - } - } else { - $addr .= "address not available."; - } - return Array('protocol'=>$addrtypes[$addrtype], 'address'=>$addr); - } -} \ No newline at end of file + //if(strlen($this->getDN())) + $bindResult = @ldap_bind($this->_resource, $this->getDN(), $password); + return $bindResult; + } + + /** + * Perform an LDAP search using comma seperated search strings + * + * @param string search string of search values + */ + public function simple_search($search) + { + $results = explode(';', $search); + foreach($results as $key=>$result) { + $results[$key] = '('.$result.')'; + } + return $this->search($results); + } + + + /** + * Perform an LDAP search + * + * @param array Search Filters (array of strings) + * @param string DN Override + * @return array Multidimensional array of results + * @access public + */ + public function search($filters, $dnoverride = null) + { + $attributes = array (); + if ($dnoverride) { + $dn = $dnoverride; + } else { + $dn = $this->base_dn; + } + + $resource = $this->_resource; + + foreach ($filters as $search_filter) + { + $search_result = @ldap_search($resource, $dn, $search_filter); + if ($search_result && ($count = @ldap_count_entries($resource, $search_result)) > 0) + { + for ($i = 0; $i < $count; $i++) + { + $attributes[$i] = Array (); + if (!$i) { + $firstentry = @ldap_first_entry($resource, $search_result); + } else { + $firstentry = @ldap_next_entry($resource, $firstentry); + } + $attributes_array = @ldap_get_attributes($resource, $firstentry); // load user-specified attributes + // ldap returns an array of arrays, fit this into attributes result array + foreach ($attributes_array as $ki => $ai) + { + if (is_array($ai)) + { + $subcount = $ai['count']; + $attributes[$i][$ki] = Array (); + for ($k = 0; $k < $subcount; $k++) { + $attributes[$i][$ki][$k] = $ai[$k]; + } + } + } + $attributes[$i]['dn'] = @ldap_get_dn($resource, $firstentry); + } + } + } + return $attributes; + } + + /** + * Replace an entry and return a true or false result + * + * @param string dn The DN which contains the attribute you want to replace + * @param string attribute The attribute values you want to replace + * @return mixed result of comparison (true, false, -1 on error) + */ + + public function replace($dn, $attribute) { + return @ldap_mod_replace($this->_resource, $dn, $attribute); + } + + + /** + * Modifies an entry and return a true or false result + * + * @param string dn The DN which contains the attribute you want to modify + * @param string attribute The attribute values you want to modify + * @return mixed result of comparison (true, false, -1 on error) + */ + public function modify($dn, $attribute) { + return @ldap_modify($this->_resource, $dn, $attribute); + } + + /** + * Removes attribute value from given dn and return a true or false result + * + * @param string dn The DN which contains the attribute you want to remove + * @param string attribute The attribute values you want to remove + * @return mixed result of comparison (true, false, -1 on error) + */ + public function remove($dn, $attribute) + { + $resource = $this->_resource; + return @ldap_mod_del($resource, $dn, $attribute); + } + + /** + * Compare an entry and return a true or false result + * + * @param string dn The DN which contains the attribute you want to compare + * @param string attribute The attribute whose value you want to compare + * @param string value The value you want to check against the LDAP attribute + * @return mixed result of comparison (true, false, -1 on error) + * @access public + */ + public function compare($dn, $attribute, $value) { + return @ldap_compare($this->_resource, $dn, $attribute, $value); + } + + /** + * Read all or specified attributes of given dn + * + * @param string dn The DN of the object you want to read + * @param string attribute The attribute values you want to read (Optional) + * @return array of attributes or -1 on error + * @access public + */ + public function read($dn, $attribute = array()) + { + $base = substr($dn,strpos($dn,',')+1); + $cn = substr($dn,0,strpos($dn,',')); + $result = @ldap_read($this->_resource, $base, $cn); + + if ($result) { + return @ldap_get_entries($this->_resource, $result); + } else { + return $result; + } + } + + /** + * Deletes a given DN from the tree + * + * @param string dn The DN of the object you want to delete + * @return bool result of operation + * @access public + */ + public function delete($dn) { + return @ldap_delete($this->_resource, $dn); + } + + /** + * Create a new DN + * + * @param string dn The DN where you want to put the object + * @param array entries An array of arrays describing the object to add + * @return bool result of operation + */ + public function create($dn, $entries) { + return @ldap_add($this->_resource, $dn, $entries); + } + + /** + * Add an attribute to the given DN + * Note: DN has to exist already + * + * @param string dn The DN of the entry to add the attribute + * @param array entry An array of arrays with attributes to add + * @return bool Result of operation + */ + public function add($dn, $entry) { + return @ldap_mod_add($this->_resource, $dn, $entry); + } + + /** + * Rename the entry + * + * @param string dn The DN of the entry at the moment + * @param string newdn The DN of the entry should be (only cn=newvalue) + * @param string newparent The full DN of the parent (null by default) + * @param bool deleteolddn Delete the old values (default) + * @return bool Result of operation + */ + public function rename($dn, $newdn, $newparent, $deleteolddn) { + return @ldap_rename($this->_resource, $dn, $newdn, $newparent, $deleteolddn); + } + + /** + * Returns the error message + * + * @return string error message + */ + public function getErrorMsg() { + return @ldap_error($this->_resource); + } + + /** + * Converts a dot notation IP address to net address (e.g. for Netware, etc) + * + * @param string IP Address (e.g. xxx.xxx.xxx.xxx) + * @return string Net address + * @access public + */ + public function ipToNetAddress($ip) + { + $parts = explode('.', $ip); + $address = '1#'; + + foreach ($parts as $int) { + $tmp = dechex($int); + if (strlen($tmp) != 2) { + $tmp = '0' . $tmp; + } + $address .= '\\' . $tmp; + } + return $address; + } + + /** + * extract readable network address from the LDAP encoded networkAddress attribute. + * @author Jay Burrell, Systems & Networks, Mississippi State University + * Please keep this document block and author attribution in place. + * + * Novell Docs, see: http://developer.novell.com/ndk/doc/ndslib/schm_enu/data/sdk5624.html#sdk5624 + * for Address types: http://developer.novell.com/ndk/doc/ndslib/index.html?page=/ndk/doc/ndslib/schm_enu/data/sdk4170.html + * LDAP Format, String: + * taggedData = uint32String "#" octetstring + * byte 0 = uint32String = Address Type: 0= IPX Address; 1 = IP Address + * byte 1 = char = "#" - separator + * byte 2+ = octetstring - the ordinal value of the address + * Note: with eDirectory 8.6.2, the IP address (type 1) returns + * correctly, however, an IPX address does not seem to. eDir 8.7 may correct this. + * Enhancement made by Merijn van de Schoot: + * If addresstype is 8 (UDP) or 9 (TCP) do some additional parsing like still returning the IP address + */ + public function LDAPNetAddr($networkaddress) + { + $addr = ""; + $addrtype = intval(substr($networkaddress, 0, 1)); + $networkaddress = substr($networkaddress, 2); // throw away bytes 0 and 1 which should be the addrtype and the "#" separator + + if (($addrtype == 8) || ($addrtype = 9)) { + // TODO 1.6: If UDP or TCP, (TODO fill addrport and) strip portnumber information from address + $networkaddress = substr($networkaddress, (strlen($networkaddress)-4)); + } + + $addrtypes = array ( + 'IPX', + 'IP', + 'SDLC', + 'Token Ring', + 'OSI', + 'AppleTalk', + 'NetBEUI', + 'Socket', + 'UDP', + 'TCP', + 'UDP6', + 'TCP6', + 'Reserved (12)', + 'URL', + 'Count' + ); + $len = strlen($networkaddress); + if ($len > 0) + { + for ($i = 0; $i < $len; $i += 1) + { + $byte = substr($networkaddress, $i, 1); + $addr .= ord($byte); + if ( ($addrtype == 1) || ($addrtype == 8) || ($addrtype = 9) ) { // dot separate IP addresses... + $addr .= "."; + } + } + if ( ($addrtype == 1) || ($addrtype == 8) || ($addrtype = 9) ) { // strip last period from end of $addr + $addr = substr($addr, 0, strlen($addr) - 1); + } + } else { + $addr .= "address not available."; + } + return Array('protocol'=>$addrtypes[$addrtype], 'address'=>$addr); + } + + /** + * Generates a LDAP compatible password + * + * @param string password Clear text password to encrypt + * @param string type Type of password hash, either md5 or SHA + * @return string encrypted password + */ + public function generatePassword($password, $type='md5') { + $userpassword = ''; + switch(strtolower($type)) { + case 'sha': + $userpassword = '{SHA}' . base64_encode( pack( 'H*', sha1( $password ) ) ); + case 'md5': + default: + $userpassword = '{MD5}' . base64_encode( pack( 'H*', md5( $password ) ) ); + break; + } + return $userpassword; + } +} diff --git a/libraries/joomla/config.php b/libraries/joomla/config.php index 38bfa1410305f..318d40b006b63 100644 --- a/libraries/joomla/config.php +++ b/libraries/joomla/config.php @@ -1,34 +1,34 @@ _utf = $this->hasUTF(); - - //Set charactersets (needed for MySQL 4.1.2+) - if ($this->_utf){ - $this->setUTF(); - } - - $this->_table_prefix = $prefix; - $this->_ticker = 0; - $this->_errorNum = 0; - $this->_log = array(); - $this->_quoted = array(); - $this->_hasQuoted = false; - - // Register faked "destructor" in PHP4 to close all connections we might have made - if (version_compare(PHP_VERSION, '5') == -1) { - register_shutdown_function(array(&$this, '__destruct')); - } - } - - /** - * Returns a reference to the global Database object, only creating it - * if it doesn't already exist. - * - * The 'driver' entry in the parameters array specifies the database driver - * to be used (defaults to 'mysql' if omitted). All other parameters are - * database driver dependent. - * - * @param array Parameters to be passed to the database driver - * @return JDatabase A database object - * @since 1.5 - */ - function &getInstance( $options = array() ) - { - static $instances; - - if (!isset( $instances )) { - $instances = array(); - } - - $signature = serialize( $options ); - - if (empty($instances[$signature])) - { - $driver = array_key_exists('driver', $options) ? $options['driver'] : 'mysql'; - $select = array_key_exists('select', $options) ? $options['select'] : true; - $database = array_key_exists('database', $options) ? $options['database'] : null; - - $driver = preg_replace('/[^A-Z0-9_\.-]/i', '', $driver); - $path = dirname(__FILE__).DS.'database'.DS.$driver.'.php'; - - if (file_exists($path)) { - require_once($path); - } else { - JError::setErrorHandling(E_ERROR, 'die'); //force error type to die - $error = JError::raiseError( 500, JTEXT::_('Unable to load Database Driver:') .$driver); - return $error; - } - - $adapter = 'JDatabase'.$driver; - $instance = new $adapter($options); - - if ( $error = $instance->getErrorMsg() ) - { - JError::setErrorHandling(E_ERROR, 'ignore'); //force error type to die - $error = JError::raiseError( 500, JTEXT::_('Unable to connect to the database:') .$error); - return $error; - } - - - $instances[$signature] = & $instance; - } - - return $instances[$signature]; - } - - /** - * Database object destructor - * - * @abstract - * @access private - * @return boolean - * @since 1.5 - */ - function __destruct() - { - return true; - } - - /** - * Get the database connectors - * - * @access public - * @return array An array of available session handlers - */ - function getConnectors() - { - jimport('joomla.filesystem.folder'); - $handlers = JFolder::files(dirname(__FILE__).DS.'database', '.php$'); - - $names = array(); - foreach($handlers as $handler) - { - $name = substr($handler, 0, strrpos($handler, '.')); - $class = 'JDatabase'.ucfirst($name); - - if(!class_exists($class)) { - require_once(dirname(__FILE__).DS.'database'.DS.$name.'.php'); - } - - if(call_user_func_array( array( trim($class), 'test' ), null)) { - $names[] = $name; - } - } - - return $names; - } - - /** - * Test to see if the MySQLi connector is available - * - * @static - * @access public - * @return boolean True on success, false otherwise. - */ - function test() - { - return false; - } - - /** - * Determines if the connection to the server is active. - * - * @access public - * @return boolean - * @since 1.5 - */ - function connected() - { - return false; - } - - /** - * Determines UTF support - * - * @abstract - * @access public - * @return boolean - * @since 1.5 - */ - function hasUTF() { - return false; - } - - /** - * Custom settings for UTF support - * - * @abstract - * @access public - * @since 1.5 - */ - function setUTF() { - } - - /** - * Adds a field or array of field names to the list that are to be quoted - * - * @access public - * @param mixed Field name or array of names - * @since 1.5 - */ - function addQuoted( $quoted ) - { - if (is_string( $quoted )) { - $this->_quoted[] = $quoted; - } else { - $this->_quoted = array_merge( $this->_quoted, (array)$quoted ); - } - $this->_hasQuoted = true; - } - - /** - * Splits a string of queries into an array of individual queries - * - * @access public - * @param string The queries to split - * @return array queries - */ - function splitSql( $queries ) - { - $start = 0; - $open = false; - $open_char = ''; - $end = strlen($queries); - $query_split = array(); - for($i=0;$i<$end;$i++) { - $current = substr($queries,$i,1); - if(($current == '"' || $current == '\'')) { - $n = 2; - while(substr($queries,$i - $n + 1, 1) == '\\' && $n < $i) { - $n ++; - } - if($n%2==0) { - if ($open) { - if($current == $open_char) { - $open = false; - $open_char = ''; - } - } else { - $open = true; - $open_char = $current; - } - } - } - if(($current == ';' && !$open)|| $i == $end - 1) { - $query_split[] = substr($queries, $start, ($i - $start + 1)); - $start = $i + 1; - } - } - - return $query_split; - } - - - - /** - * Checks if field name needs to be quoted - * - * @access public - * @param string The field name - * @return bool - */ - function isQuoted( $fieldName ) - { - if ($this->_hasQuoted) { - return in_array( $fieldName, $this->_quoted ); - } else { - return true; - } - } - - /** - * Sets the debug level on or off - * - * @access public - * @param int 0 = off, 1 = on - */ - function debug( $level ) { - $this->_debug = intval( $level ); - } - - /** - * Get the database UTF-8 support - * - * @access public - * @return boolean - * @since 1.5 - */ - function getUTFSupport() { - return $this->_utf; - } - - /** - * Get the error number - * - * @access public - * @return int The error number for the most recent query - */ - function getErrorNum() { - return $this->_errorNum; - } - - - /** - * Get the error message - * - * @access public - * @return string The error message for the most recent query - */ - function getErrorMsg($escaped = false) - { - if($escaped) { - return addslashes($this->_errorMsg); - } else { - return $this->_errorMsg; - } - } - - /** - * Get a database escaped string - * - * @param string The string to be escaped - * @param boolean Optional parameter to provide extra escaping - * @return string - * @access public - * @abstract - */ - function getEscaped( $text, $extra = false ) - { - return; - } - - /** - * Get a database error log - * - * @access public - * @return array - */ - function getLog( ) - { - return $this->_log; - } - - /** - * Get the total number of queries made - * - * @access public - * @return array - */ - function getTicker( ) - { - return $this->_ticker; - } - - /** - * Quote an identifier name (field, table, etc) - * - * @access public - * @param string The name - * @return string The quoted name - */ - function nameQuote( $s ) - { - $q = $this->_nameQuote; - if (strlen( $q ) == 1) { - return $q . $s . $q; - } else { - return $q{0} . $s . $q{1}; - } - } - /** - * Get the database table prefix - * - * @access public - * @return string The database prefix - */ - function getPrefix() - { - return $this->_table_prefix; - } - - /** - * Get the database null date - * - * @access public - * @return string Quoted null/zero date string - */ - function getNullDate() - { - return $this->_nullDate; - } - - /** - * Sets the SQL query string for later execution. - * - * This function replaces a string identifier $prefix with the - * string held is the _table_prefix class variable. - * - * @access public - * @param string The SQL query - * @param string The offset to start selection - * @param string The number of results to return - * @param string The common table prefix - */ - function setQuery( $sql, $offset = 0, $limit = 0, $prefix='#__' ) - { - $this->_sql = $this->replacePrefix( $sql, $prefix ); - $this->_limit = (int) $limit; - $this->_offset = (int) $offset; - } - - /** - * This function replaces a string identifier $prefix with the - * string held is the _table_prefix class variable. - * - * @access public - * @param string The SQL query - * @param string The common table prefix - */ - function replacePrefix( $sql, $prefix='#__' ) - { - $sql = trim( $sql ); - - $escaped = false; - $quoteChar = ''; - - $n = strlen( $sql ); - - $startPos = 0; - $literal = ''; - while ($startPos < $n) { - $ip = strpos($sql, $prefix, $startPos); - if ($ip === false) { - break; - } - - $j = strpos( $sql, "'", $startPos ); - $k = strpos( $sql, '"', $startPos ); - if (($k !== FALSE) && (($k < $j) || ($j === FALSE))) { - $quoteChar = '"'; - $j = $k; - } else { - $quoteChar = "'"; - } - - if ($j === false) { - $j = $n; - } - - $literal .= str_replace( $prefix, $this->_table_prefix,substr( $sql, $startPos, $j - $startPos ) ); - $startPos = $j; - - $j = $startPos + 1; - - if ($j >= $n) { - break; - } - - // quote comes first, find end of quote - while (TRUE) { - $k = strpos( $sql, $quoteChar, $j ); - $escaped = false; - if ($k === false) { - break; - } - $l = $k - 1; - while ($l >= 0 && $sql{$l} == '\\') { - $l--; - $escaped = !$escaped; - } - if ($escaped) { - $j = $k+1; - continue; - } - break; - } - if ($k === FALSE) { - // error in the query - no end quote; ignore it - break; - } - $literal .= substr( $sql, $startPos, $k - $startPos + 1 ); - $startPos = $k+1; - } - if ($startPos < $n) { - $literal .= substr( $sql, $startPos, $n - $startPos ); - } - return $literal; - } - - /** - * Get the active query - * - * @access public - * @return string The current value of the internal SQL vairable - */ - function getQuery() - { - return $this->_sql; - } - - /** - * Execute the query - * - * @abstract - * @access public - * @return mixed A database resource if successful, FALSE if not. - */ - function query() - { - return; - } - - /** - * Get the affected rows by the most recent query - * - * @abstract - * @access public - * @return int The number of affected rows in the previous operation - * @since 1.0.5 - */ - function getAffectedRows() - { - return; - } - - /** - * Execute a batch query - * - * @abstract - * @access public - * @return mixed A database resource if successful, FALSE if not. - */ - function queryBatch( $abort_on_error=true, $p_transaction_safe = false) - { - return false; - } - - /** - * Diagnostic function - * - * @abstract - * @access public - */ - function explain() - { - return; - } - - /** - * Get the number of rows returned by the most recent query - * - * @abstract - * @access public - * @param object Database resource - * @return int The number of rows - */ - function getNumRows( $cur=null ) - { - return; - } - - /** - * This method loads the first field of the first row returned by the query. - * - * @abstract - * @access public - * @return The value returned in the query or null if the query failed. - */ - function loadResult() - { - return; - } - - /** - * Load an array of single field results into an array - * - * @abstract - */ - function loadResultArray($numinarray = 0) - { - return; - } - - /** - * Fetch a result row as an associative array - * - * @abstract - */ - function loadAssoc() - { - return; - } - - /** - * Load a associactive list of database rows - * - * @abstract - * @access public - * @param string The field name of a primary key - * @return array If key is empty as sequential list of returned records. - */ - function loadAssocList( $key='' ) - { - return; - } - - /** - * This global function loads the first row of a query into an object - * - * - * @abstract - * @access public - * @param object - */ - function loadObject( ) - { - return; - } - - /** - * Load a list of database objects - * - * @abstract - * @access public - * @param string The field name of a primary key - * @return array If key is empty as sequential list of returned records. - - * If key is not empty then the returned array is indexed by the value - * the database key. Returns null if the query fails. - */ - function loadObjectList( $key='' ) - { - return; - } - - /** - * Load the first row returned by the query - * - * @abstract - * @access public - * @return The first row of the query. - */ - function loadRow() - { - return; - } - - /** - * Load a list of database rows (numeric column indexing) - * - * If key is not empty then the returned array is indexed by the value - * the database key. Returns null if the query fails. - * - * @abstract - * @access public - * @param string The field name of a primary key - * @return array - */ - function loadRowList( $key='' ) - { - return; - } - - /** - * Inserts a row into a table based on an objects properties - * @param string The name of the table - * @param object An object whose properties match table fields - * @param string The name of the primary key. If provided the object property is updated. - */ - function insertObject( $table, &$object, $keyName = NULL ) - { - return; - } - - /** - * Update ab object in the database - * - * @abstract - * @access public - * @param string - * @param object - * @param string - * @param boolean - */ - function updateObject( $table, &$object, $keyName, $updateNulls=true ) - { - return; - } - - /** - * Print out an error statement - * - * @param boolean If TRUE, displays the last SQL statement sent to the database - * @return string A standised error message - */ - function stderr( $showSQL = false ) - { - if ( $this->_errorNum != 0 ) { - return "DB function failed with error number $this->_errorNum" - ."
      $this->_errorMsg" - .($showSQL ? "
      SQL =
      $this->_sql
      " : ''); - } else { - return "DB function reports no errors"; - } - } - - /** - * Get the ID generated from the previous INSERT operation - * - * @abstract - * @access public - * @return mixed - */ - function insertid() - { - return; - } - - /** - * Get the database collation - * - * @abstract - * @access public - * @return string Collation in use - */ - function getCollation() - { - return; - } - - /** - * Get the version of the database connector - * - * @abstract - */ - function getVersion() - { - return 'Not available for this connector'; - } - - /** - * List tables in a database - * - * @abstract - * @access public - * @return array A list of all the tables in the database - */ - function getTableList() - { - return; - } - - /** - * Shows the CREATE TABLE statement that creates the given tables - * - * @abstract - * @access public - * @param array|string A table name or a list of table names - * @return array A list the create SQL for the tables - */ - function getTableCreate( $tables ) - { - return; - } - - /** - * Retrieves information about the given tables - * - * @abstract - * @access public - * @param array|string A table name or a list of table names - * @param boolean Only return field types, default true - * @return array An array of fields by table - */ - function getTableFields( $tables, $typeonly = true ) - { - return; - } - - // ---- - // ADODB Compatibility Functions - // ---- - - /** - * Get a quoted database escaped string - * - * @param string A string - * @param boolean Default true to escape string, false to leave the string unchanged - * @return string - * @access public - */ - function Quote( $text, $escaped = true ) - { - return '\''.($escaped ? $this->getEscaped( $text ) : $text).'\''; - } - - /** - * ADODB compatability function - * - * @access public - * @param string SQL - * @since 1.5 - */ - function GetCol( $query ) - { - $this->setQuery( $query ); - return $this->loadResultArray(); - } - - /** - * ADODB compatability function - * - * @access public - * @param string SQL - * @return object - * @since 1.5 - */ - function Execute( $query ) - { - jimport( 'joomla.database.recordset' ); - - $query = trim( $query ); - $this->setQuery( $query ); - if (eregi( '^select', $query )) { - $result = $this->loadRowList(); - return new JRecordSet( $result ); - } else { - $result = $this->query(); - if ($result === false) { - return false; - } else { - return new JRecordSet( array() ); - } - } - } - - /** - * ADODB compatability function - * - * @access public - * @since 1.5 - */ - function SelectLimit( $query, $count, $offset=0 ) - { - jimport( 'joomla.database.recordset' ); - - $this->setQuery( $query, $offset, $count ); - $result = $this->loadRowList(); - return new JRecordSet( $result ); - } - - /** - * ADODB compatability function - * - * @access public - * @since 1.5 - */ - function PageExecute( $sql, $nrows, $page, $inputarr=false, $secs2cache=0 ) - { - jimport( 'joomla.database.recordset' ); - - $this->setQuery( $sql, $page*$nrows, $nrows ); - $result = $this->loadRowList(); - return new JRecordSet( $result ); - } - /** - * ADODB compatability function - * - * @access public - * @param string SQL - * @return array - * @since 1.5 - */ - function GetRow( $query ) - { - $this->setQuery( $query ); - $result = $this->loadRowList(); - return $result[0]; - } - - /** - * ADODB compatability function - * - * @access public - * @param string SQL - * @return mixed - * @since 1.5 - */ - function GetOne( $query ) - { - $this->setQuery( $query ); - $result = $this->loadResult(); - return $result; - } - - /** - * ADODB compatability function - * - * @since 1.5 - */ - function BeginTrans() - { - } - - /** - * ADODB compatability function - * - * @since 1.5 - */ - function RollbackTrans() - { - } - - /** - * ADODB compatability function - * - * @since 1.5 - */ - function CommitTrans() - { - } - - /** - * ADODB compatability function - * - * @since 1.5 - */ - function ErrorMsg() - { - return $this->getErrorMsg(); - } - - /** - * ADODB compatability function - * - * @since 1.5 - */ - function ErrorNo() - { - return $this->getErrorNum(); - } - - /** - * ADODB compatability function - * - * @since 1.5 - */ - function GenID( $foo1=null, $foo2=null ) - { - return '0'; - } -} +_utf = $this->hasUTF(); + + //Set charactersets (needed for MySQL 4.1.2+) + if ($this->_utf){ + $this->setUTF(); + } + + $this->_table_prefix = $prefix; + $this->_ticker = 0; + $this->_errorNum = 0; + $this->_log = array(); + $this->_quoted = array(); + $this->_hasQuoted = false; + } + + /** + * Returns a reference to the global Database object, only creating it + * if it doesn't already exist. + * + * The 'driver' entry in the parameters array specifies the database driver + * to be used (defaults to 'mysql' if omitted). All other parameters are + * database driver dependent. + * + * @param array Parameters to be passed to the database driver + * @return JDatabase A database object + * @since 1.5 + */ + public static function &getInstance($options = array()) + { + static $instances; + + if (!isset( $instances )) { + $instances = array(); + } + + $signature = serialize( $options ); + + if (empty($instances[$signature])) + { + $driver = array_key_exists('driver', $options) ? $options['driver'] : 'mysql'; + $select = array_key_exists('select', $options) ? $options['select'] : true; + $database = array_key_exists('database', $options) ? $options['database'] : null; + + $driver = preg_replace('/[^A-Z0-9_\.-]/i', '', $driver); + $path = dirname(__FILE__).DS.'database'.DS.$driver.'.php'; + + if (file_exists($path)) { + require_once $path; + } else { + JError::setErrorHandling(E_ERROR, 'die'); //force error type to die + $error = JError::raiseError( 500, JTEXT::_('Unable to load Database Driver:') .$driver); + return $error; + } + + $adapter = 'JDatabase'.$driver; + $instance = new $adapter($options); + + if ( $error = $instance->getErrorMsg() ) + { + JError::setErrorHandling(E_ERROR, 'ignore'); //force error type to die + $error = JError::raiseError( 500, JTEXT::_('Unable to connect to the database:') .$error); + return $error; + } + + + $instances[$signature] = & $instance; + } + + return $instances[$signature]; + } + + /** + * Database object destructor + * + * @abstract + * @access private + * @return boolean + * @since 1.5 + */ + public function __destruct() + { + return true; + } + + /** + * Get the database connectors + * + * @access public + * @return array An array of available session handlers + */ + public function getConnectors() + { + jimport('joomla.filesystem.folder'); + $handlers = JFolder::files(dirname(__FILE__).DS.'database', '.php$'); + + $names = array(); + foreach($handlers as $handler) + { + $name = substr($handler, 0, strrpos($handler, '.')); + $class = 'JDatabase'.ucfirst($name); + + if(!class_exists($class)) { + require_once dirname(__FILE__).DS.'database'.DS.$name.'.php'; + } + + if(call_user_func_array( array( trim($class), 'test' ), null)) { + $names[] = $name; + } + } + + return $names; + } + + /** + * Test to see if the MySQLi connector is available + * + * @static + * @access public + * @return boolean True on success, false otherwise. + */ + abstract public static function test(); + + /** + * Determines if the connection to the server is active. + * + * @access public + * @return boolean + * @since 1.5 + */ + abstract public function connected(); + + /** + * Determines UTF support + * + * @abstract + * @access public + * @return boolean + * @since 1.5 + */ + abstract public function hasUTF(); + + /** + * Custom settings for UTF support + * + * @abstract + * @access public + * @since 1.5 + */ + abstract public function setUTF(); + + /** + * Adds a field or array of field names to the list that are to be quoted + * + * @access public + * @param mixed Field name or array of names + * @since 1.5 + */ + public function addQuoted( $quoted ) + { + if (is_string( $quoted )) { + $this->_quoted[] = $quoted; + } else { + $this->_quoted = array_merge( $this->_quoted, (array)$quoted ); + } + $this->_hasQuoted = true; + } + + /** + * Splits a string of queries into an array of individual queries + * + * @access public + * @param string The queries to split + * @return array queries + */ + public function splitSql( $queries ) + { + $start = 0; + $open = false; + $open_char = ''; + $end = strlen($queries); + $query_split = array(); + for($i=0;$i<$end;$i++) { + $current = substr($queries,$i,1); + if(($current == '"' || $current == '\'')) { + $n = 2; + while(substr($queries,$i - $n + 1, 1) == '\\' && $n < $i) { + $n ++; + } + if($n%2==0) { + if ($open) { + if($current == $open_char) { + $open = false; + $open_char = ''; + } + } else { + $open = true; + $open_char = $current; + } + } + } + if(($current == ';' && !$open)|| $i == $end - 1) { + $query_split[] = substr($queries, $start, ($i - $start + 1)); + $start = $i + 1; + } + } + + return $query_split; + } + + + + /** + * Checks if field name needs to be quoted + * + * @access public + * @param string The field name + * @return bool + */ + public function isQuoted( $fieldName ) + { + if ($this->_hasQuoted) { + return in_array( $fieldName, $this->_quoted ); + } else { + return true; + } + } + + /** + * Sets the debug level on or off + * + * @access public + * @param int 0 = off, 1 = on + */ + public function debug( $level ) { + $this->_debug = intval( $level ); + } + + /** + * Get the database UTF-8 support + * + * @access public + * @return boolean + * @since 1.5 + */ + public function getUTFSupport() { + return $this->_utf; + } + + /** + * Get the error number + * + * @access public + * @return int The error number for the most recent query + */ + public function getErrorNum() { + return $this->_errorNum; + } + + + /** + * Get the error message + * + * @access public + * @return string The error message for the most recent query + */ + public function getErrorMsg($escaped = false) + { + if($escaped) { + return addslashes($this->_errorMsg); + } else { + return $this->_errorMsg; + } + } + + /** + * Get a database escaped string + * + * @param string The string to be escaped + * @param boolean Optional parameter to provide extra escaping + * @return string + * @access public + * @abstract + */ + abstract public function getEscaped( $text, $extra = false ); + + /** + * Get a database error log + * + * @access public + * @return array + */ + public function getLog( ) + { + return $this->_log; + } + + /** + * Get the total number of queries made + * + * @access public + * @return array + */ + public function getTicker( ) + { + return $this->_ticker; + } + + /** + * Quote an identifier name (field, table, etc) + * + * @access public + * @param string The name + * @return string The quoted name + */ + public function nameQuote( $s ) + { + // Only quote if the name is not using dot-notation + if (strpos( '.', $s ) === false) + { + $q = $this->_nameQuote; + if (strlen( $q ) == 1) { + return $q . $s . $q; + } else { + return $q{0} . $s . $q{1}; + } + } + else { + return $s; + } + } + /** + * Get the database table prefix + * + * @access public + * @return string The database prefix + */ + public function getPrefix() + { + return $this->_table_prefix; + } + + /** + * Get the database null date + * + * @access public + * @return string Quoted null/zero date string + */ + public function getNullDate() + { + return $this->_nullDate; + } + + /** + * Sets the SQL query string for later execution. + * + * This function replaces a string identifier $prefix with the + * string held is the _table_prefix class variable. + * + * @access public + * @param string The SQL query + * @param string The offset to start selection + * @param string The number of results to return + * @param string The common table prefix + */ + public function setQuery( $sql, $offset = 0, $limit = 0, $prefix='#__' ) + { + $this->_sql = $this->replacePrefix( (string)$sql, $prefix ); + $this->_limit = (int) $limit; + $this->_offset = (int) $offset; + } + + /** + * This function replaces a string identifier $prefix with the + * string held is the _table_prefix class variable. + * + * @access public + * @param string The SQL query + * @param string The common table prefix + */ + public function replacePrefix( $sql, $prefix='#__' ) + { + $sql = trim( $sql ); + + $escaped = false; + $quoteChar = ''; + + $n = strlen( $sql ); + + $startPos = 0; + $literal = ''; + while ($startPos < $n) { + $ip = strpos($sql, $prefix, $startPos); + if ($ip === false) { + break; + } + + $j = strpos( $sql, "'", $startPos ); + $k = strpos( $sql, '"', $startPos ); + if (($k !== FALSE) && (($k < $j) || ($j === FALSE))) { + $quoteChar = '"'; + $j = $k; + } else { + $quoteChar = "'"; + } + + if ($j === false) { + $j = $n; + } + + $literal .= str_replace( $prefix, $this->_table_prefix,substr( $sql, $startPos, $j - $startPos ) ); + $startPos = $j; + + $j = $startPos + 1; + + if ($j >= $n) { + break; + } + + // quote comes first, find end of quote + while (TRUE) { + $k = strpos( $sql, $quoteChar, $j ); + $escaped = false; + if ($k === false) { + break; + } + $l = $k - 1; + while ($l >= 0 && $sql{$l} == '\\') { + $l--; + $escaped = !$escaped; + } + if ($escaped) { + $j = $k+1; + continue; + } + break; + } + if ($k === FALSE) { + // error in the query - no end quote; ignore it + break; + } + $literal .= substr( $sql, $startPos, $k - $startPos + 1 ); + $startPos = $k+1; + } + if ($startPos < $n) { + $literal .= substr( $sql, $startPos, $n - $startPos ); + } + return $literal; + } + + /** + * Get the active query + * + * @access public + * @return string The current value of the internal SQL vairable + */ + public function getQuery() + { + return $this->_sql; + } + + /** + * Execute the query + * + * @abstract + * @access public + * @return mixed A database resource if successful, FALSE if not. + */ + abstract public function query(); + + /** + * Get the affected rows by the most recent query + * + * @abstract + * @access public + * @return int The number of affected rows in the previous operation + * @since 1.0.5 + */ + abstract public function getAffectedRows(); + + /** + * Execute a batch query + * + * @abstract + * @access public + * @return mixed A database resource if successful, FALSE if not. + */ + abstract public function queryBatch( $abort_on_error=true, $p_transaction_safe = false); + + /** + * Diagnostic function + * + * @abstract + * @access public + */ + abstract public function explain(); + + /** + * Get the number of rows returned by the most recent query + * + * @abstract + * @access public + * @param object Database resource + * @return int The number of rows + */ + abstract public function getNumRows( $cur=null ); + + /** + * This method loads the first field of the first row returned by the query. + * + * @abstract + * @access public + * @return The value returned in the query or null if the query failed. + */ + abstract public function loadResult(); + + /** + * Load an array of single field results into an array + * + * @abstract + */ + abstract public function loadResultArray($numinarray = 0); + + /** + * Fetch a result row as an associative array + * + * @abstract + */ + abstract public function loadAssoc(); + + /** + * Load a associactive list of database rows + * + * @abstract + * @access public + * @param string The field name of a primary key + * @return array If key is empty as sequential list of returned records. + */ + abstract public function loadAssocList( $key='' ); + + /** + * This global function loads the first row of a query into an object + * + * + * @abstract + * @access public + * @param object + */ + abstract public function loadObject( ); + + /** + * Load a list of database objects + * + * @abstract + * @access public + * @param string The field name of a primary key + * @return array If key is empty as sequential list of returned records. + + * If key is not empty then the returned array is indexed by the value + * the database key. Returns null if the query fails. + */ + abstract public function loadObjectList( $key='' ); + + /** + * Load the first row returned by the query + * + * @abstract + * @access public + * @return The first row of the query. + */ + abstract public function loadRow(); + + /** + * Load a list of database rows (numeric column indexing) + * + * If key is not empty then the returned array is indexed by the value + * the database key. Returns null if the query fails. + * + * @abstract + * @access public + * @param string The field name of a primary key + * @return array + */ + abstract public function loadRowList( $key='' ); + + /** + * Inserts a row into a table based on an objects properties + * @param string The name of the table + * @param object An object whose properties match table fields + * @param string The name of the primary key. If provided the object property is updated. + */ + abstract public function insertObject( $table, &$object, $keyName = NULL ); + + /** + * Update an object in the database + * + * @abstract + * @access public + * @param string + * @param object + * @param string + * @param boolean + */ + abstract public function updateObject( $table, &$object, $keyName, $updateNulls=true ); + + /** + * Print out an error statement + * + * @param boolean If TRUE, displays the last SQL statement sent to the database + * @return string A standised error message + */ + public function stderr( $showSQL = false ) + { + if ( $this->_errorNum != 0 ) { + return "DB function failed with error number $this->_errorNum" + ."
      $this->_errorMsg" + .($showSQL ? "
      SQL =
      $this->_sql
      " : ''); + } else { + return "DB function reports no errors"; + } + } + + /** + * Get the ID generated from the previous INSERT operation + * + * @abstract + * @access public + * @return mixed + */ + abstract public function insertid(); + + /** + * Get the database collation + * + * @abstract + * @access public + * @return string Collation in use + */ + abstract public function getCollation(); + + /** + * Get the version of the database connector + * + * @abstract + */ + public function getVersion() + { + return 'Not available for this connector'; + } + + /** + * List tables in a database + * + * @abstract + * @access public + * @return array A list of all the tables in the database + */ + abstract public function getTableList(); + + /** + * Shows the CREATE TABLE statement that creates the given tables + * + * @abstract + * @access public + * @param array|string A table name or a list of table names + * @return array A list the create SQL for the tables + */ + abstract public function getTableCreate( $tables ); + + /** + * Retrieves information about the given tables + * + * @abstract + * @access public + * @param array|string A table name or a list of table names + * @param boolean Only return field types, default true + * @return array An array of fields by table + */ + abstract public function getTableFields( $tables, $typeonly = true ); + + /** + * Get a quoted database escaped string + * + * @param string A string + * @param boolean Default true to escape string, false to leave the string unchanged + * @return string + * @access public + */ + public function Quote( $text, $escaped = true ) + { + return '\''.($escaped ? $this->getEscaped( $text ) : $text).'\''; + } + + /** + * ADODB compatability function + * + * @access public + * @param string SQL + * @since 1.5 + */ + public function GetCol( $query ) + { + $this->setQuery( $query ); + return $this->loadResultArray(); + } + + /** + * ADODB compatability function + * + * @access public + * @param string SQL + * @return object + * @since 1.5 + */ + public function Execute( $query ) + { + jimport( 'joomla.database.recordset' ); + + $query = trim( $query ); + $this->setQuery( $query ); + if (eregi( '^select', $query )) { + $result = $this->loadRowList(); + return new JRecordSet( $result ); + } else { + $result = $this->query(); + if ($result === false) { + return false; + } else { + return new JRecordSet( array() ); + } + } + } + + /** + * ADODB compatability function + * + * @access public + * @since 1.5 + */ + public function SelectLimit( $query, $count, $offset=0 ) + { + jimport( 'joomla.database.recordset' ); + + $this->setQuery( $query, $offset, $count ); + $result = $this->loadRowList(); + return new JRecordSet( $result ); + } + + /** + * ADODB compatability function + * + * @access public + * @since 1.5 + */ + public function PageExecute( $sql, $nrows, $page, $inputarr=false, $secs2cache=0 ) + { + jimport( 'joomla.database.recordset' ); + + $this->setQuery( $sql, $page*$nrows, $nrows ); + $result = $this->loadRowList(); + return new JRecordSet( $result ); + } + /** + * ADODB compatability function + * + * @access public + * @param string SQL + * @return array + * @since 1.5 + */ + public function GetRow( $query ) + { + $this->setQuery( $query ); + $result = $this->loadRowList(); + return $result[0]; + } + + /** + * ADODB compatability function + * + * @access public + * @param string SQL + * @return mixed + * @since 1.5 + */ + public function GetOne( $query ) + { + $this->setQuery( $query ); + $result = $this->loadResult(); + return $result; + } + + /** + * ADODB compatability function + * + * @since 1.5 + */ + public function BeginTrans() + { + } + + /** + * ADODB compatability function + * + * @since 1.5 + */ + public function RollbackTrans() + { + } + + /** + * ADODB compatability function + * + * @since 1.5 + */ + public function CommitTrans() + { + } + + /** + * ADODB compatability function + * + * @since 1.5 + */ + public function ErrorMsg() + { + return $this->getErrorMsg(); + } + + /** + * ADODB compatability function + * + * @since 1.5 + */ + public function ErrorNo() + { + return $this->getErrorNum(); + } + + /** + * ADODB compatability function + * + * @since 1.5 + */ + public function GenID( $foo1=null, $foo2=null ) + { + return '0'; + } +} diff --git a/libraries/joomla/database/database/index.html b/libraries/joomla/database/database/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/database/database/index.html +++ b/libraries/joomla/database/database/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/database/database/mysql.php b/libraries/joomla/database/database/mysql.php index 8b02aab4d203f..b55c713bf1e82 100644 --- a/libraries/joomla/database/database/mysql.php +++ b/libraries/joomla/database/database/mysql.php @@ -29,21 +29,21 @@ class JDatabaseMySQL extends JDatabase * * @var string */ - var $name = 'mysql'; + public $name = 'mysql'; /** * The null/zero date string * * @var string */ - var $_nullDate = '0000-00-00 00:00:00'; + protected $_nullDate = '0000-00-00 00:00:00'; /** * Quote for named objects * * @var string */ - var $_nameQuote = '`'; + protected $_nameQuote = '`'; /** * Database object constructor @@ -53,27 +53,22 @@ class JDatabaseMySQL extends JDatabase * @since 1.5 * @see JDatabase */ - function __construct( $options ) + protected function __construct( $options ) { $host = array_key_exists('host', $options) ? $options['host'] : 'localhost'; $user = array_key_exists('user', $options) ? $options['user'] : ''; $password = array_key_exists('password',$options) ? $options['password'] : ''; $database = array_key_exists('database',$options) ? $options['database'] : ''; - $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : 'jos_'; $select = array_key_exists('select', $options) ? $options['select'] : true; // perform a number of fatality checks, then return gracefully if (!function_exists( 'mysql_connect' )) { - $this->_errorNum = 1; - $this->_errorMsg = 'The MySQL adapter "mysql" is not available.'; - return; + throw new JException('The MySQL adapter "mysql" is not available', 1, E_WARNING); } // connect to the server if (!($this->_resource = @mysql_connect( $host, $user, $password, true ))) { - $this->_errorNum = 2; - $this->_errorMsg = 'Could not connect to MySQL'; - return; + throw new JException('Could not connect to MySQL database', 2, E_WARNING, mysql_error(), true); } // finalize initialization @@ -91,7 +86,7 @@ function __construct( $options ) * @return boolean * @since 1.5 */ - function __destruct() + public function __destruct() { $return = false; if (is_resource($this->_resource)) { @@ -107,7 +102,7 @@ function __destruct() * @access public * @return boolean True on success, false otherwise. */ - function test() + public static function test() { return (function_exists( 'mysql_connect' )); } @@ -119,7 +114,7 @@ function test() * @return boolean * @since 1.5 */ - function connected() + public function connected() { if(is_resource($this->_resource)) { return mysql_ping($this->_resource); @@ -135,7 +130,7 @@ function connected() * @return boolean True if the database has been successfully selected * @since 1.5 */ - function select($database) + public function select($database) { if ( ! $database ) { @@ -143,9 +138,7 @@ function select($database) } if ( !mysql_select_db( $database, $this->_resource )) { - $this->_errorNum = 3; - $this->_errorMsg = 'Could not connect to database'; - return false; + throw new JException('Could not selecte database', 3, E_WARNING, $database); } // if running mysql 5, set sql-mode to mysql40 - thereby circumventing strict mode problems @@ -163,7 +156,7 @@ function select($database) * @access public * @return boolean True - UTF is supported */ - function hasUTF() + public function hasUTF() { $verParts = explode( '.', $this->getVersion() ); return ($verParts[0] == 5 || ($verParts[0] == 4 && $verParts[1] == 1 && (int)$verParts[2] >= 2)); @@ -174,7 +167,7 @@ function hasUTF() * * @access public */ - function setUTF() + public function setUTF() { mysql_query( "SET NAMES 'utf8'", $this->_resource ); } @@ -188,7 +181,7 @@ function setUTF() * @access public * @abstract */ - function getEscaped( $text, $extra = false ) + public function getEscaped( $text, $extra = false ) { $result = mysql_real_escape_string( $text, $this->_resource ); if ($extra) { @@ -203,10 +196,10 @@ function getEscaped( $text, $extra = false ) * @access public * @return mixed A database resource if successful, FALSE if not. */ - function query() + public function query() { if (!is_resource($this->_resource)) { - return false; + throw new JException('Database not connected', 10, E_WARNING); } if ($this->_limit > 0 || $this->_offset > 0) { @@ -224,11 +217,7 @@ function query() { $this->_errorNum = mysql_errno( $this->_resource ); $this->_errorMsg = mysql_error( $this->_resource )." SQL=$this->_sql"; - - if ($this->_debug) { - JError::raiseError(500, 'JDatabaseMySQL::query: '.$this->_errorNum.' - '.$this->_errorMsg ); - } - return false; + throw new JException('Database query error', 11, E_WARNING, array('errorNum'=>$this->_errorNum, 'errorMsg'=>$this->_errorMsg), true); } return $this->_cursor; } @@ -240,7 +229,7 @@ function query() * @return int The number of affected rows in the previous operation * @since 1.0.5 */ - function getAffectedRows() + public function getAffectedRows() { return mysql_affected_rows( $this->_resource ); } @@ -251,7 +240,7 @@ function getAffectedRows() * @access public * @return mixed A database resource if successful, FALSE if not. */ - function queryBatch( $abort_on_error=true, $p_transaction_safe = false) + public function queryBatch( $abort_on_error=true, $p_transaction_safe = false) { $this->_errorNum = 0; $this->_errorMsg = ''; @@ -273,12 +262,16 @@ function queryBatch( $abort_on_error=true, $p_transaction_safe = false) $command_line = trim( $command_line ); if ($command_line != '') { $this->_cursor = mysql_query( $command_line, $this->_resource ); + if ($this->_debug) { + $this->_ticker++; + $this->_log[] = $command_line; + } if (!$this->_cursor) { $error = 1; $this->_errorNum .= mysql_errno( $this->_resource ) . ' '; $this->_errorMsg .= mysql_error( $this->_resource )." SQL=$command_line
      "; if ($abort_on_error) { - return $this->_cursor; + throw new JException('Database query error', 11, E_WARNING, array('errorNum'=>$this->_errorNum, 'errorMsg'=>$this->_errorMsg), true); } } } @@ -292,13 +285,14 @@ function queryBatch( $abort_on_error=true, $p_transaction_safe = false) * @access public * @return string */ - function explain() + public function explain() { $temp = $this->_sql; $this->_sql = "EXPLAIN $this->_sql"; - - if (!($cur = $this->query())) { - return null; + try { + $cur = $this->query(); + } catch(JException $e) { + return ''; } $first = true; @@ -333,7 +327,7 @@ function explain() * @access public * @return int The number of rows returned from the most recent query. */ - function getNumRows( $cur=null ) + public function getNumRows( $cur=null ) { return mysql_num_rows( $cur ? $cur : $this->_cursor ); } @@ -344,11 +338,9 @@ function getNumRows( $cur=null ) * @access public * @return The value returned in the query or null if the query failed. */ - function loadResult() + public function loadResult() { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $ret = null; if ($row = mysql_fetch_row( $cur )) { $ret = $row[0]; @@ -362,11 +354,9 @@ function loadResult() * * @access public */ - function loadResultArray($numinarray = 0) + public function loadResultArray($numinarray = 0) { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $array = array(); while ($row = mysql_fetch_row( $cur )) { $array[] = $row[$numinarray]; @@ -381,12 +371,10 @@ function loadResultArray($numinarray = 0) * @access public * @return array */ - function loadAssoc() + public function loadAssoc() { - if (!($cur = $this->query())) { - return null; - } - $ret = null; + $cur = $this->query(); + $ret = array(); if ($array = mysql_fetch_assoc( $cur )) { $ret = $array; } @@ -401,11 +389,9 @@ function loadAssoc() * @param string The field name of a primary key * @return array If key is empty as sequential list of returned records. */ - function loadAssocList( $key='' ) + public function loadAssocList( $key='' ) { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $array = array(); while ($row = mysql_fetch_assoc( $cur )) { if ($key) { @@ -424,11 +410,9 @@ function loadAssocList( $key='' ) * @access public * @return object */ - function loadObject( ) + public function loadObject( ) { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $ret = null; if ($object = mysql_fetch_object( $cur )) { $ret = $object; @@ -447,11 +431,9 @@ function loadObject( ) * @param string The field name of a primary key * @return array If key is empty as sequential list of returned records. */ - function loadObjectList( $key='' ) + public function loadObjectList( $key='' ) { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $array = array(); while ($row = mysql_fetch_object( $cur )) { if ($key) { @@ -470,11 +452,9 @@ function loadObjectList( $key='' ) * @access public * @return The first row of the query. */ - function loadRow() + public function loadRow() { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $ret = null; if ($row = mysql_fetch_row( $cur )) { $ret = $row; @@ -492,11 +472,9 @@ function loadRow() * If key is not empty then the returned array is indexed by the value * the database key. Returns null if the query fails. */ - function loadRowList( $key=null ) + public function loadRowList( $key=null ) { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $array = array(); while ($row = mysql_fetch_row( $cur )) { if ($key !== null) { @@ -517,11 +495,13 @@ function loadRowList( $key=null ) * @param object An object whose properties match table fields * @param string The name of the primary key. If provided the object property is updated. */ - function insertObject( $table, &$object, $keyName = NULL ) + public function insertObject( $table, &$object, $keyName = NULL ) { - $fmtsql = "INSERT INTO $table ( %s ) VALUES ( %s ) "; + $fmtsql = 'INSERT INTO '.$this->nameQuote($table).' ( %s ) VALUES ( %s ) '; $fields = array(); - foreach (get_object_vars( $object ) as $k => $v) { + $values = array(); + $vars = ($object INSTANCEOF JObject) ? $object->getProperties() : get_object_vars($object); + foreach ($vars as $k => $v) { if (is_array($v) or is_object($v) or $v === NULL) { continue; } @@ -532,9 +512,7 @@ function insertObject( $table, &$object, $keyName = NULL ) $values[] = $this->isQuoted( $k ) ? $this->Quote( $v ) : (int) $v; } $this->setQuery( sprintf( $fmtsql, implode( ",", $fields ) , implode( ",", $values ) ) ); - if (!$this->query()) { - return false; - } + $this->query(); $id = $this->insertid(); if ($keyName && $id) { $object->$keyName = $id; @@ -548,11 +526,12 @@ function insertObject( $table, &$object, $keyName = NULL ) * @access public * @param [type] $updateNulls */ - function updateObject( $table, &$object, $keyName, $updateNulls=true ) + public function updateObject( $table, &$object, $keyName, $updateNulls=true ) { - $fmtsql = "UPDATE $table SET %s WHERE %s"; + $fmtsql = 'UPDATE '.$this->nameQuote($table).' SET %s WHERE %s'; $tmp = array(); - foreach (get_object_vars( $object ) as $k => $v) + $vars = ($object INSTANCEOF JObject) ? $object->getProperties() : get_object_vars($object); + foreach ($vars as $k => $v) { if( is_array($v) or is_object($v) or $k[0] == '_' ) { // internal or NA field continue; @@ -582,7 +561,7 @@ function updateObject( $table, &$object, $keyName, $updateNulls=true ) * * @access public */ - function insertid() + public function insertid() { return mysql_insert_id( $this->_resource ); } @@ -592,7 +571,7 @@ function insertid() * * @access public */ - function getVersion() + public function getVersion() { return mysql_get_server_info( $this->_resource ); } @@ -603,7 +582,7 @@ function getVersion() * @access public * @return string Collation in use */ - function getCollation () + public function getCollation () { if ( $this->hasUTF() ) { $this->setQuery( 'SHOW FULL COLUMNS FROM #__content' ); @@ -620,7 +599,7 @@ function getCollation () * @access public * @return array A list of all the tables in the database */ - function getTableList() + public function getTableList() { $this->setQuery( 'SHOW TABLES' ); return $this->loadResultArray(); @@ -633,7 +612,7 @@ function getTableList() * @param array|string A table name or a list of table names * @return array A list the create SQL for the tables */ - function getTableCreate( $tables ) + public function getTableCreate( $tables ) { settype($tables, 'array'); //force to array $result = array(); @@ -657,7 +636,7 @@ function getTableCreate( $tables ) * @param boolean Only return field types, default true * @return array An array of fields by table */ - function getTableFields( $tables, $typeonly = true ) + public function getTableFields( $tables, $typeonly = true ) { settype($tables, 'array'); //force to array $result = array(); diff --git a/libraries/joomla/database/database/mysqli.php b/libraries/joomla/database/database/mysqli.php index 7e326b7b6e0e4..398a0314d7bad 100644 --- a/libraries/joomla/database/database/mysqli.php +++ b/libraries/joomla/database/database/mysqli.php @@ -29,21 +29,21 @@ class JDatabaseMySQLi extends JDatabase * * @var string */ - var $name = 'mysqli'; + public $name = 'mysqli'; /** * The null/zero date string * * @var string */ - var $_nullDate = '0000-00-00 00:00:00'; + protected $_nullDate = '0000-00-00 00:00:00'; /** * Quote for named objects * * @var string */ - var $_nameQuote = '`'; + protected $_nameQuote = '`'; /** * Database object constructor @@ -53,13 +53,12 @@ class JDatabaseMySQLi extends JDatabase * @since 1.5 * @see JDatabase */ - function __construct( $options ) + protected function __construct( $options ) { $host = array_key_exists('host', $options) ? $options['host'] : 'localhost'; $user = array_key_exists('user', $options) ? $options['user'] : ''; $password = array_key_exists('password',$options) ? $options['password'] : ''; $database = array_key_exists('database',$options) ? $options['database'] : ''; - $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : 'jos_'; $select = array_key_exists('select', $options) ? $options['select'] : true; // Unlike mysql_connect(), mysqli_connect() takes the port and socket @@ -83,17 +82,15 @@ function __construct( $options ) } // perform a number of fatality checks, then return gracefully - if (!function_exists( 'mysqli_connect' )) { - $this->_errorNum = 1; - $this->_errorMsg = 'The MySQL adapter "mysqli" is not available.'; - return; + if (!class_exists( 'mysqli' )) { + throw new JException('The MySQL adapter "mysqli" is not available', 1, E_WARNING); } // connect to the server - if (!($this->_resource = @mysqli_connect($host, $user, $password, NULL, $port, $socket))) { - $this->_errorNum = 2; - $this->_errorMsg = 'Could not connect to MySQL'; - return; + $this->_resource = new mysqli($host, $user, $password, null, $port, $socket); + + if($this->_resource->connect_error) { + throw new JException('Could not connect to MySQL database', 2, E_WARNING, $this->_resource->connect_error, true); } // finalize initialization @@ -111,11 +108,11 @@ function __construct( $options ) * @return boolean * @since 1.5 */ - function __destruct() + public function __destruct() { $return = false; - if (is_resource($this->_resource)) { - $return = mysqli_close($this->_resource); + if (is_object($this->_resource)) { + $return = $this->_resource->close(); } return $return; } @@ -127,9 +124,9 @@ function __destruct() * @access public * @return boolean True on success, false otherwise. */ - function test() + public static function test() { - return (function_exists( 'mysqli_connect' )); + return (class_exists( 'mysqli' )); } /** @@ -139,7 +136,7 @@ function test() * @return boolean * @since 1.5 */ - function connected() + public function connected() { return $this->_resource->ping(); } @@ -152,16 +149,15 @@ function connected() * @return boolean True if the database has been successfully selected * @since 1.5 */ - function select($database) + public function select($database) { if ( ! $database ) { return false; } - if ( !mysqli_select_db($this->_resource, $database)) { - $this->_errorNum = 3; - $this->_errorMsg = 'Could not connect to database'; + if ( !$this->_resource->select_db($database)) { + throw new JException('Could not select database', 3, E_WARNING, $this->stderr()); return false; } @@ -180,7 +176,7 @@ function select($database) * @access public * @return boolean True - UTF is supported */ - function hasUTF() + public function hasUTF() { $verParts = explode( '.', $this->getVersion() ); return ($verParts[0] == 5 || ($verParts[0] == 4 && $verParts[1] == 1 && (int)$verParts[2] >= 2)); @@ -191,9 +187,9 @@ function hasUTF() * * @access public */ - function setUTF() + public function setUTF() { - mysqli_query( $this->_resource, "SET NAMES 'utf8'" ); + $this->_resource->query( "SET NAMES 'utf8'" ); } /** @@ -205,9 +201,9 @@ function setUTF() * @access public * @abstract */ - function getEscaped( $text, $extra = false ) + public function getEscaped( $text, $extra = false ) { - $result = mysqli_real_escape_string( $this->_resource, $text ); + $result = $this->_resource->real_escape_string( $text ); if ($extra) { $result = addcslashes( $result, '%_' ); } @@ -219,10 +215,10 @@ function getEscaped( $text, $extra = false ) * @access public * @return mixed A database resource if successful, FALSE if not. */ - function query() + public function query() { if (!is_object($this->_resource)) { - return false; + throw new JException('Database not connected', 10, E_WARNING); } if ($this->_limit > 0 || $this->_offset > 0) { @@ -234,17 +230,13 @@ function query() } $this->_errorNum = 0; $this->_errorMsg = ''; - $this->_cursor = mysqli_query( $this->_resource, $this->_sql ); + $this->_cursor = $this->_resource->query( $this->_sql ); if (!$this->_cursor) { $this->_errorNum = mysqli_errno( $this->_resource ); $this->_errorMsg = mysqli_error( $this->_resource )." SQL=$this->_sql"; - - if ($this->_debug) { - JError::raiseError(500, 'JDatabaseMySQL::query: '.$this->_errorNum.' - '.$this->_errorMsg ); - } - return false; + throw new JException('Database Error', 11, E_WARNING, $this->stderr(true), true); } return $this->_cursor; } @@ -256,9 +248,9 @@ function query() * @return int The number of affected rows in the previous operation * @since 1.0.5 */ - function getAffectedRows() + public function getAffectedRows() { - return mysqli_affected_rows( $this->_resource ); + return $this->_resource->affected_rows; } /** @@ -267,7 +259,7 @@ function getAffectedRows() * @access public * @return mixed A database resource if successful, FALSE if not. */ - function queryBatch( $abort_on_error=true, $p_transaction_safe = false) + public function queryBatch( $abort_on_error=true, $p_transaction_safe = false) { $this->_errorNum = 0; $this->_errorMsg = ''; @@ -288,13 +280,17 @@ function queryBatch( $abort_on_error=true, $p_transaction_safe = false) foreach ($query_split as $command_line) { $command_line = trim( $command_line ); if ($command_line != '') { - $this->_cursor = mysqli_query( $this->_resource, $command_line ); + $this->_cursor = $this->_resource->query( $command_line ); + if ($this->_debug) { + $this->_ticker++; + $this->_log[] = $command_line; + } if (!$this->_cursor) { $error = 1; $this->_errorNum .= mysqli_errno( $this->_resource ) . ' '; $this->_errorMsg .= mysqli_error( $this->_resource )." SQL=$command_line
      "; if ($abort_on_error) { - return $this->_cursor; + throw new JException('Database query error', 11, E_WARNING, array('errorNum'=>$this->_errorNum, 'errorMsg'=>$this->_errorMsg), true); } } } @@ -308,19 +304,18 @@ function queryBatch( $abort_on_error=true, $p_transaction_safe = false) * @access public * @return string */ - function explain() + public function explain() { $temp = $this->_sql; $this->_sql = "EXPLAIN $this->_sql"; - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); + $first = true; $buffer = ''; $buffer .= ''; - while ($row = mysqli_fetch_assoc( $cur )) { + while ($row = $cur->fetch_assoc()) { if ($first) { $buffer .= ''; foreach ($row as $k=>$v) { @@ -336,7 +331,7 @@ function explain() $buffer .= ''; } $buffer .= '
      '.$this->getQuery().'
      '; - mysqli_free_result( $cur ); + $cur->free(); $this->_sql = $temp; @@ -349,9 +344,9 @@ function explain() * @access public * @return int The number of rows returned from the most recent query. */ - function getNumRows( $cur=null ) + public function getNumRows( $cur=null ) { - return mysqli_num_rows( $cur ? $cur : $this->_cursor ); + return $cur ? $cur->num_rows : $this->_cursor->num_rows; } /** @@ -360,16 +355,14 @@ function getNumRows( $cur=null ) * @access public * @return The value returned in the query or null if the query failed. */ - function loadResult() + public function loadResult() { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $ret = null; - if ($row = mysqli_fetch_row( $cur )) { + if ($row = $cur->fetch_row()) { $ret = $row[0]; } - mysqli_free_result( $cur ); + $cur->free(); return $ret; } @@ -378,16 +371,14 @@ function loadResult() * * @access public */ - function loadResultArray($numinarray = 0) + public function loadResultArray($numinarray = 0) { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $array = array(); - while ($row = mysqli_fetch_row( $cur )) { + while ($row = $cur->fetch_row()) { $array[] = $row[$numinarray]; } - mysqli_free_result( $cur ); + $cur->free(); return $array; } @@ -397,16 +388,14 @@ function loadResultArray($numinarray = 0) * @access public * @return array */ - function loadAssoc() + public function loadAssoc() { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $ret = null; - if ($array = mysqli_fetch_assoc( $cur )) { + if ($array = $cur->fetch_assoc()) { $ret = $array; } - mysqli_free_result( $cur ); + $cur->free(); return $ret; } @@ -417,20 +406,18 @@ function loadAssoc() * @param string The field name of a primary key * @return array If key is empty as sequential list of returned records. */ - function loadAssocList( $key='' ) + public function loadAssocList( $key='' ) { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $array = array(); - while ($row = mysqli_fetch_assoc( $cur )) { + while ($row = $cur->fetch_assoc()) { if ($key) { $array[$row[$key]] = $row; } else { $array[] = $row; } } - mysqli_free_result( $cur ); + $cur->free(); return $array; } @@ -440,16 +427,14 @@ function loadAssocList( $key='' ) * @access public * @return object */ - function loadObject( ) + public function loadObject( ) { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $ret = null; - if ($object = mysqli_fetch_object( $cur )) { + if ($object = $cur->fetch_object()) { $ret = $object; } - mysqli_free_result( $cur ); + $cur->free(); return $ret; } @@ -463,20 +448,18 @@ function loadObject( ) * @param string The field name of a primary key * @return array If key is empty as sequential list of returned records. */ - function loadObjectList( $key='' ) + public function loadObjectList( $key='' ) { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $array = array(); - while ($row = mysqli_fetch_object( $cur )) { + while ($row = $cur->fetch_object()) { if ($key) { $array[$row->$key] = $row; } else { $array[] = $row; } } - mysqli_free_result( $cur ); + $cur->free(); return $array; } @@ -486,16 +469,14 @@ function loadObjectList( $key='' ) * @access public * @return The first row of the query. */ - function loadRow() + public function loadRow() { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $ret = null; - if ($row = mysqli_fetch_row( $cur )) { + if ($row = $cur->fetch_row()) { $ret = $row; } - mysqli_free_result( $cur ); + $cur->free(); return $ret; } @@ -509,20 +490,18 @@ function loadRow() * @param string The field name of a primary key * @return array If key is empty as sequential list of returned records. */ - function loadRowList( $key=null ) + public function loadRowList( $key=null ) { - if (!($cur = $this->query())) { - return null; - } + $cur = $this->query(); $array = array(); - while ($row = mysqli_fetch_row( $cur )) { + while ($row = $cur->fetch_row()) { if ($key !== null) { $array[$row[$key]] = $row; } else { $array[] = $row; } } - mysqli_free_result( $cur ); + $cur->free(); return $array; } @@ -534,11 +513,13 @@ function loadRowList( $key=null ) * @param object An object whose properties match table fields * @param string The name of the primary key. If provided the object property is updated. */ - function insertObject( $table, &$object, $keyName = NULL ) + public function insertObject( $table, &$object, $keyName = NULL ) { - $fmtsql = "INSERT INTO $table ( %s ) VALUES ( %s ) "; + $fmtsql = 'INSERT INTO '.$this->nameQuote($table).' ( %s ) VALUES ( %s ) '; $fields = array(); - foreach (get_object_vars( $object ) as $k => $v) { + $values = array(); + $vars = ($object INSTANCEOF JObject) ? $object->getProperties() : get_object_vars($object); + foreach ($vars as $k => $v) { if (is_array($v) or is_object($v) or $v === NULL) { continue; } @@ -549,9 +530,7 @@ function insertObject( $table, &$object, $keyName = NULL ) $values[] = $this->isQuoted( $k ) ? $this->Quote( $v ) : (int) $v; } $this->setQuery( sprintf( $fmtsql, implode( ",", $fields ) , implode( ",", $values ) ) ); - if (!$this->query()) { - return false; - } + $this->query(); $id = $this->insertid(); if ($keyName && $id) { $object->$keyName = $id; @@ -565,11 +544,12 @@ function insertObject( $table, &$object, $keyName = NULL ) * @access public * @param [type] $updateNulls */ - function updateObject( $table, &$object, $keyName, $updateNulls=true ) + public function updateObject( $table, &$object, $keyName, $updateNulls=true ) { - $fmtsql = "UPDATE $table SET %s WHERE %s"; + $fmtsql = 'UPDATE '.$this->nameQuote($table).' SET %s WHERE %s'; $tmp = array(); - foreach (get_object_vars( $object ) as $k => $v) { + $vars = ($object INSTANCEOF JObject) ? $object->getProperties() : get_object_vars($object); + foreach ($vars as $k => $v) { if( is_array($v) or is_object($v) or $k[0] == '_' ) { // internal or NA field continue; } @@ -598,9 +578,9 @@ function updateObject( $table, &$object, $keyName, $updateNulls=true ) * * @access public */ - function insertid() + public function insertid() { - return mysqli_insert_id( $this->_resource ); + return $this->_resource->insert_id; } /** @@ -608,9 +588,9 @@ function insertid() * * @access public */ - function getVersion() + public function getVersion() { - return mysqli_get_server_info( $this->_resource ); + return $this->_resource->server_info; } /** @@ -619,7 +599,7 @@ function getVersion() * @access public * @return string Collation in use */ - function getCollation () + public function getCollation () { if ( $this->hasUTF() ) { $this->setQuery( 'SHOW FULL COLUMNS FROM #__content' ); @@ -636,7 +616,7 @@ function getCollation () * @access public * @return array A list of all the tables in the database */ - function getTableList() + public function getTableList() { $this->setQuery( 'SHOW TABLES' ); return $this->loadResultArray(); @@ -649,7 +629,7 @@ function getTableList() * @param array|string A table name or a list of table names * @return array A list the create SQL for the tables */ - function getTableCreate( $tables ) + public function getTableCreate( $tables ) { settype($tables, 'array'); //force to array $result = array(); @@ -674,7 +654,7 @@ function getTableCreate( $tables ) * @param boolean Only return field types, default true * @return array An array of fields by table */ - function getTableFields( $tables, $typeonly = true ) + public function getTableFields( $tables, $typeonly = true ) { settype($tables, 'array'); //force to array $result = array(); diff --git a/libraries/joomla/database/index.html b/libraries/joomla/database/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/database/index.html +++ b/libraries/joomla/database/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/database/query.php b/libraries/joomla/database/query.php new file mode 100644 index 0000000000000..212b99061c834 --- /dev/null +++ b/libraries/joomla/database/query.php @@ -0,0 +1,220 @@ +_elements = array(); + $this->_name = $name; + $this->append( $elements ); + $this->_glue = $glue; + } + + /** + * Appends element parts to the internal list + * @param mixed String or array + */ + function append( $elements ) + { + if (is_array( $elements )) { + $this->_elements = array_unique( array_merge( $this->_elements, $elements ) ); + } else { + $this->_elements = array_unique( array_merge( $this->_elements, array( $elements ) ) ); + } + } + + /** + * Render the query element + * @return string + */ + function toString() + { + return "\n{$this->_name} " . implode( $this->_glue, $this->_elements ); + } +} + +/** + * Query Building Class + * + * @package JXtended + * @subpackage Database + */ +class JQuery +{ + /** @var string The query type */ + var $_type = ''; + /** @var object The select element */ + var $_select = null; + /** @var object The from element */ + var $_from = null; + /** @var object The join element */ + var $_join = null; + /** @var object The where element */ + var $_where = null; + /** @var object The where element */ + var $_group = null; + /** @var object The where element */ + var $_having = null; + /** @var object The where element */ + var $_order = null; + + /** + * @param mixed A string or an array of field names + */ + function select( $columns ) + { + $this->_type = 'select'; + if (is_null( $this->_select )) { + $this->_select = new JQueryElement( 'SELECT', $columns ); + } else { + $this->_select->append( $columns ); + } + } + + /** + * @param mixed A string or array of table names + */ + function from( $tables ) + { + if (is_null( $this->_from )) { + $this->_from = new JQueryElement( 'FROM', $tables ); + } else { + $this->_from->append( $tables ); + } + } + + /** + * @param string + * @param string + */ + function join( $type, $conditions ) + { + if (is_null( $this->_join )) { + $this->_join = array(); + } + $this->_join[] = new JQueryElement( strtoupper( $type ) . ' JOIN', $conditions ); + } + + /** + * @param mixed A string or array of where conditions + * @param string + */ + function where( $conditions, $glue='AND' ) + { + if (is_null( $this->_where )) { + $glue = strtoupper( $glue ); + $this->_where = new JQueryElement( 'WHERE', $conditions, "\n\t$glue " ); + } else { + $this->_where->append( $conditions ); + } + } + + /** + * @param mixed A string or array of ordering columns + */ + function group( $columns ) + { + if (is_null( $this->_group )) { + $this->_group = new JQueryElement( 'GROUP BY', $columns ); + } else { + $this->_group->append( $columns ); + } + } + + /** + * @param mixed A string or array of ordering columns + */ + function having( $columns ) + { + if (is_null( $this->_having )) { + $this->_having = new JQueryElement( 'HAVING', $columns ); + } else { + $this->_having->append( $columns ); + } + } + + /** + * @param mixed A string or array of ordering columns + */ + function order( $columns ) + { + if (is_null( $this->_order )) { + $this->_order = new JQueryElement( 'ORDER BY', $columns ); + } else { + $this->_order->append( $columns ); + } + } + + /** + * @return string The completed query + */ + function __toString() + { + $query = ''; + + switch ($this->_type) + { + case 'select': + $query .= $this->_select->toString(); + $query .= $this->_from->toString(); + if ($this->_join) { + // special case for joins + foreach ($this->_join as $join) { + $query .= $join->toString(); + } + } + if ($this->_where) { + $query .= $this->_where->toString(); + } + if ($this->_group) { + $query .= $this->_group->toString(); + } + if ($this->_having) { + $query .= $this->_having->toString(); + } + if ($this->_order) { + $query .= $this->_order->toString(); + } + break; + } + + return $query; + } + + /** + * @return string The completed query + */ + function toString() + { + return (string) $this; + } + +} \ No newline at end of file diff --git a/libraries/joomla/database/recordset.php b/libraries/joomla/database/recordset.php index 3276c43e4d657..28db204947330 100644 --- a/libraries/joomla/database/recordset.php +++ b/libraries/joomla/database/recordset.php @@ -1,96 +1,67 @@ -data = $data; - $this->pointer = 0; - $this->count = count( $data ); - } - /** - * @return int - */ - function RecordCount() { - return $this->count; - } - /** - * @return mixed A row from the data array or null - */ - function FetchRow() - { - if ($this->pointer < $this->count) { - $result = $this->data[$this->pointer]; - $this->pointer++; - return $result; - } else { - return null; - } - } - /** - * @return array - */ - function GetRows() { - return $this->data; - } - /** - * TODO: No working - */ - function absolutepage() { - return 1; - } - /** - * TODO: No working - */ - function atfirstpage() { - return 1; - } - /** - * TODO: No working - */ - function atlastpage() { - return 1; - } - /** - * TODO: No working - */ - function lastpageno() { - return 1; - } - /** - * TODO: No working - */ - function Close() { - } -} \ No newline at end of file +data = $data; + $this->pointer = 0; + $this->count = count( $data ); + } + /** + * @return int + */ + public function RecordCount() { + return $this->count; + } + /** + * @return mixed A row from the data array or null + */ + public function FetchRow() + { + if ($this->pointer < $this->count) { + $result = $this->data[$this->pointer]; + $this->pointer++; + return $result; + } else { + return null; + } + } + /** + * @return array + */ + public function GetRows() { + return $this->data; + } +} diff --git a/libraries/joomla/database/table.php b/libraries/joomla/database/table.php index 0383ab2ac9da6..b193518f6215f 100644 --- a/libraries/joomla/database/table.php +++ b/libraries/joomla/database/table.php @@ -27,7 +27,7 @@ * @since 1.0 * @tutorial Joomla.Framework/jtable.cls */ -class JTable extends JObject +abstract class JTable extends JObject { /** * Name of the table in the db schema relating to child class @@ -35,7 +35,7 @@ class JTable extends JObject * @var string * @access protected */ - var $_tbl = ''; + protected $_tbl = ''; /** * Name of the primary key field in the table @@ -43,7 +43,7 @@ class JTable extends JObject * @var string * @access protected */ - var $_tbl_key = ''; + protected $_tbl_key = ''; /** * Database connector @@ -51,7 +51,7 @@ class JTable extends JObject * @var JDatabase * @access protected */ - var $_db = null; + protected $_db = null; /** * Object constructor to set table and key field @@ -63,13 +63,25 @@ class JTable extends JObject * @param string $key name of the primary key field in the table * @param object $db JDatabase object */ - function __construct( $table, $key, &$db ) + protected function __construct( $table, $key, &$db ) { $this->_tbl = $table; $this->_tbl_key = $key; $this->_db =& $db; } + public function __get($var) { + if(isset($this->$var)) { + return $this->$var; + } else { + return null; + } + } + + public function __set($var, $val) { + return $this->bind(array($var=>$val)); + } + /** * Returns a reference to the a Table object, always creating it * @@ -79,7 +91,7 @@ function __construct( $table, $key, &$db ) * @return database A database object * @since 1.5 */ - function &getInstance( $type, $prefix = 'JTable', $config = array() ) + public static function &getInstance( $type, $prefix = 'JTable', $config = array() ) { $false = false; @@ -124,7 +136,7 @@ function &getInstance( $type, $prefix = 'JTable', $config = array() ) * * @return object A JDatabase based object */ - function &getDBO() + public function &getDBO() { return $this->_db; } @@ -135,7 +147,7 @@ function &getDBO() * @param object $db A JDatabase based object * @return void */ - function setDBO(&$db) + public function setDBO(&$db) { $this->_db =& $db; } @@ -146,7 +158,7 @@ function setDBO(&$db) * @return string * @since 1.5 */ - function getTableName() + public function getTableName() { return $this->_tbl; } @@ -157,7 +169,7 @@ function getTableName() * @return string * @since 1.5 */ - function getKeyName() + public function getKeyName() { return $this->_tbl_key; } @@ -166,7 +178,7 @@ function getKeyName() * Resets the default properties * @return void */ - function reset() + public function reset() { $k = $this->_tbl_key; foreach ($this->getProperties() as $name => $value) @@ -188,7 +200,7 @@ function reset() * @param $ignore mixed An array or space separated list of fields not to bind * @return boolean */ - function bind( $from, $ignore=array() ) + public function bind( $from, $ignore=array() ) { $fromArray = is_array( $from ); $fromObject = is_object( $from ); @@ -223,7 +235,7 @@ function bind( $from, $ignore=array() ) * @param mixed Optional primary key. If not specifed, the value of current key is used * @return boolean True if successful */ - function load( $oid=null ) + public function load( $oid=null ) { $k = $this->_tbl_key; @@ -263,7 +275,7 @@ function load( $oid=null ) * @access public * @return boolean True if the object is ok */ - function check() + public function check() { return true; } @@ -277,27 +289,23 @@ function check() * @param boolean If false, null object variables are not updated * @return null|string null if successful otherwise returns and error message */ - function store( $updateNulls=false ) + public function store( $updateNulls=false ) { $k = $this->_tbl_key; - - if( $this->$k) - { - $ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls ); - } - else - { - $ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key ); - } - if( !$ret ) - { - $this->setError(get_class( $this ).'::store failed - '.$this->_db->getErrorMsg()); + try { + if( $this->$k) + { + $ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls ); + } + else + { + $ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key ); + } + } catch(JException $e) { + $this->setError(get_class( $this ).'::store failed - '.$e->getMessage()); return false; } - else - { - return true; - } + return true; } /** @@ -307,7 +315,7 @@ function store( $updateNulls=false ) * @param $dirn * @param $where */ - function move( $dirn, $where='' ) + public function move( $dirn, $where='' ) { if (!in_array( 'ordering', array_keys($this->getProperties()))) { @@ -341,49 +349,46 @@ function move( $dirn, $where='' ) $this->_db->setQuery( $sql, 0, 1 ); - $row = null; - $row = $this->_db->loadObject(); - if (isset($row)) - { - $query = 'UPDATE '. $this->_tbl - . ' SET ordering = '. (int) $row->ordering - . ' WHERE '. $this->_tbl_key .' = '. $this->_db->Quote($this->$k) - ; - $this->_db->setQuery( $query ); - - if (!$this->_db->query()) - { - $err = $this->_db->getErrorMsg(); - JError::raiseError( 500, $err ); - } - - $query = 'UPDATE '.$this->_tbl - . ' SET ordering = '.(int) $this->ordering - . ' WHERE '.$this->_tbl_key.' = '.$this->_db->Quote($row->$k) - ; - $this->_db->setQuery( $query ); - - if (!$this->_db->query()) + try { + $row = $this->_db->loadObject(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + try { + if (!empty($row)) { - $err = $this->_db->getErrorMsg(); - JError::raiseError( 500, $err ); + $query = 'UPDATE '. $this->_tbl + . ' SET ordering = '. (int) $row->ordering + . ' WHERE '. $this->_tbl_key .' = '. $this->_db->Quote($this->$k) + ; + $this->_db->setQuery( $query ); + + $this->_db->query(); + + $query = 'UPDATE '.$this->_tbl + . ' SET ordering = '.(int) $this->ordering + . ' WHERE '.$this->_tbl_key.' = '.$this->_db->Quote($row->$k) + ; + $this->_db->setQuery( $query ); + + $this->_db->query(); + + $this->ordering = $row->ordering; } - - $this->ordering = $row->ordering; - } - else - { - $query = 'UPDATE '. $this->_tbl - . ' SET ordering = '.(int) $this->ordering - . ' WHERE '. $this->_tbl_key .' = '. $this->_db->Quote($this->$k) - ; - $this->_db->setQuery( $query ); - - if (!$this->_db->query()) + else { - $err = $this->_db->getErrorMsg(); - JError::raiseError( 500, $err ); + $query = 'UPDATE '. $this->_tbl + . ' SET ordering = '.(int) $this->ordering + . ' WHERE '. $this->_tbl_key .' = '. $this->_db->Quote($this->$k) + ; + $this->_db->setQuery( $query ); + + $this->_db->query(); } + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; } } @@ -393,7 +398,7 @@ function move( $dirn, $where='' ) * @access public * @param string query WHERE clause for selecting MAX(ordering). */ - function getNextOrder ( $where='' ) + public function getNextOrder ( $where='' ) { if (!in_array( 'ordering', array_keys($this->getProperties()) )) { @@ -406,11 +411,10 @@ function getNextOrder ( $where='' ) ($where ? ' WHERE '.$where : ''); $this->_db->setQuery( $query ); - $maxord = $this->_db->loadResult(); - - if ($this->_db->getErrorNum()) - { - $this->setError($this->_db->getErrorMsg()); + try { + $maxord = $this->_db->loadResult(); + } catch(JException $e) { + $this->setError($e->getMessage()); return false; } return $maxord + 1; @@ -422,7 +426,7 @@ function getNextOrder ( $where='' ) * @access public * @param string Additional where query to limit ordering to a particular subset of records */ - function reorder( $where='' ) + public function reorder( $where='' ) { $k = $this->_tbl_key; @@ -447,9 +451,10 @@ function reorder( $where='' ) . ' ORDER BY ordering'.$order2 ; $this->_db->setQuery( $query ); - if (!($orders = $this->_db->loadObjectList())) - { - $this->setError($this->_db->getErrorMsg()); + try { + $orders = $this->_db->loadObjectList(); + } catch(JException $e) { + $this->setError($e->getMessage()); return false; } // compact the ordering numbers @@ -465,7 +470,12 @@ function reorder( $where='' ) . ' WHERE '. $k .' = '. $this->_db->Quote($orders[$i]->$k) ; $this->_db->setQuery( $query); - $this->_db->query(); + try { + $this->_db->query(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } } } } @@ -484,7 +494,7 @@ function reorder( $where='' ) * @param array Optional array to compiles standard joins: format [label=>'Label',name=>'table name',idfield=>'field',joinfield=>'field'] * @return true|false */ - function canDelete( $oid=null, $joins=null ) + public function canDelete( $oid=null, $joins=null ) { $k = $this->_tbl_key; if ($oid) { @@ -509,9 +519,10 @@ function canDelete( $oid=null, $joins=null ) ; $this->_db->setQuery( $query ); - if (!$obj = $this->_db->loadObject()) - { - $this->setError($this->_db->getErrorMsg()); + try { + $obj = $this->_db->loadObject(); + } catch(JException $e) { + $this->setError($e->getMessage()); return false; } $msg = array(); @@ -548,7 +559,7 @@ function canDelete( $oid=null, $joins=null ) * @access public * @return true if successful otherwise returns and error message */ - function delete( $oid=null ) + public function delete( $oid=null ) { //if (!$this->canDelete( $msg )) //{ @@ -564,13 +575,11 @@ function delete( $oid=null ) ' WHERE '.$this->_tbl_key.' = '. $this->_db->Quote($this->$k); $this->_db->setQuery( $query ); - if ($this->_db->query()) - { + try { + $this->_db->query(); return true; - } - else - { - $this->setError($this->_db->getErrorMsg()); + } catch (JException $e) { + $this->setError($e->getMessage()); return false; } } @@ -583,7 +592,7 @@ function delete( $oid=null ) * @param mixed The primary key value for the row * @return boolean True if successful, or if checkout is not supported */ - function checkout( $who, $oid = null ) + public function checkout( $who, $oid = null ) { if (!in_array( 'checked_out', array_keys($this->getProperties()) )) { return true; @@ -604,8 +613,12 @@ function checkout( $who, $oid = null ) $this->checked_out = $who; $this->checked_out_time = $time; - - return $this->_db->query(); + try { + return $this->_db->query(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } } /** @@ -615,7 +628,7 @@ function checkout( $who, $oid = null ) * @param mixed The primary key value for the row * @return boolean True if successful, or if checkout is not supported */ - function checkin( $oid=null ) + public function checkin( $oid=null ) { if (!( in_array( 'checked_out', array_keys($this->getProperties()) ) || @@ -642,7 +655,12 @@ function checkin( $oid=null ) $this->checked_out = 0; $this->checked_out_time = ''; - return $this->_db->query(); + try { + return $this->_db->query(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } } /** @@ -652,7 +670,7 @@ function checkin( $oid=null ) * @param $oid * @param $log */ - function hit( $oid=null, $log=false ) + public function hit( $oid=null, $log=false ) { if (!in_array( 'hits', array_keys($this->getProperties()) )) { return; @@ -668,8 +686,14 @@ function hit( $oid=null, $log=false ) . ' SET hits = ( hits + 1 )' . ' WHERE '. $this->_tbl_key .'='. $this->_db->Quote($this->$k); $this->_db->setQuery( $query ); - $this->_db->query(); - $this->hits++; + try { + $this->_db->query(); + $this->hits++; + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + return true; } /** @@ -681,14 +705,14 @@ function hit( $oid=null, $log=false ) * @static * @access public * @param integer $with The userid to preform the match with, if an item is checked out - * by this user the function will return false + * by this user the function will return false * @param integer $against The userid to perform the match against when the function is used as * a static function. * @return boolean */ - function isCheckedOut( $with = 0, $against = null) + public function isCheckedOut( $with = 0, $against = null) { - if(isset($this) && is_a($this, 'JTable') && is_null($against)) { + if(isset($this) && $this INSTANCEOF JTable && is_null($against)) { $against = $this->get( 'checked_out' ); } @@ -710,7 +734,7 @@ function isCheckedOut( $with = 0, $against = null) * @param mixed An array or space separated list of fields not to bind * @returns TRUE if completely successful, FALSE if partially or not succesful. */ - function save( $source, $order_filter='', $ignore='' ) + public function save( $source, $order_filter='', $ignore='' ) { if (!$this->bind( $source, $ignore )) { return false; @@ -742,7 +766,7 @@ function save( $source, $order_filter='', $ignore='' ) * @param integer The id of the user performnig the operation * @since 1.0.4 */ - function publish( $cid=null, $publish=1, $user_id=0 ) + public function publish( $cid=null, $publish=1, $user_id=0 ) { JArrayHelper::toInteger( $cid ); $user_id = (int) $user_id; @@ -773,9 +797,10 @@ function publish( $cid=null, $publish=1, $user_id=0 ) } $this->_db->setQuery( $query ); - if (!$this->_db->query()) - { - $this->setError($this->_db->getErrorMsg()); + try { + $this->_db->query(); + } catch(JException $e) { + $this->setError($e->getMessage()); return false; } @@ -798,7 +823,7 @@ function publish( $cid=null, $publish=1, $user_id=0 ) * @access public * @param boolean Map foreign keys to text values */ - function toXML( $mapKeysToText=false ) + public function toXML( $mapKeysToText=false ) { $xml = '_tbl_key; + $key = $this->$k; + $groupId = $acl->get_group_id($this->access, '', 'AXO'); + $axoTitle = $this->getAxoTitle(); + $axoSection = $this->getAxoSection(); + + try { + if ($key) + { + // existing record + if ($ret = $this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls)) { + // consistency check + $axoId = $acl->get_object_id($axoSection, $key, 'AXO'); + if (!$axoId) { + $axoId = $acl->add_object($axoSection, $axoTitle, $key, null, null, 'AXO'); + } else { + // update the AXO object + $ret = $acl->edit_object($axoId, $axoSection, $axoTitle, $key, 0, 0, 'AXO'); + } + + // syncronise ACL - single group handled at the moment + if ($groups = $acl->get_object_groups($axoId, 'AXO')) { + $acl->del_group_object($groups[0], $axoSection, $key, 'AXO'); + } + $acl->add_group_object($groupId, $axoSection, $key, 'AXO'); + } + } + else { + // new record + if ($ret = $this->_db->insertObject($this->_tbl, $this, $this->_tbl_key)) { + $key = $this->$k; + // syncronise ACL + $acl->add_object($axoSection, $axoTitle, $key, null, null, 'AXO'); + $acl->add_group_object($groupId, $axoSection, $key, 'AXO'); + } + } + } catch(JException $e) { + $this->setError(get_class($this).'::'. JText::_('store failed') .'
      ' . $e->getMessage()); + return false; + } + return true; + } +} diff --git a/libraries/joomla/database/table/category.php b/libraries/joomla/database/table/category.php index a25f83354f0ab..ba04e88ef17b8 100644 --- a/libraries/joomla/database/table/category.php +++ b/libraries/joomla/database/table/category.php @@ -1,107 +1,107 @@ -title ) == '') { - $this->setError(JText::sprintf( 'must contain a title', JText::_( 'Category') )); - return false; - } - - // check for existing name - /*$query = 'SELECT id' - . ' FROM #__categories ' - . ' WHERE title = '.$this->_db->Quote($this->title) - . ' AND section = '.$this->_db->Quote($this->section) - ; - $this->_db->setQuery( $query ); - - $xid = intval( $this->_db->loadResult() ); - if ($xid && $xid != intval( $this->id )) { - $this->_error = JText::sprintf( 'WARNNAMETRYAGAIN', JText::_( 'Category') ); - return false; - }*/ - - if(empty($this->alias)) { - $this->alias = $this->title; - } - $this->alias = JFilterOutput::stringURLSafe($this->alias); - if(trim(str_replace('-','',$this->alias)) == '') { - $datenow =& JFactory::getDate(); - $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); - } - - return true; - } -} +title ) == '') { + $this->setError(JText::sprintf( 'must contain a title', JText::_( 'Category') )); + return false; + } + + // check for existing name + /*$query = 'SELECT id' + . ' FROM #__categories ' + . ' WHERE title = '.$this->_db->Quote($this->title) + . ' AND section = '.$this->_db->Quote($this->section) + ; + $this->_db->setQuery( $query ); + + $xid = intval( $this->_db->loadResult() ); + if ($xid && $xid != intval( $this->id )) { + $this->_error = JText::sprintf( 'WARNNAMETRYAGAIN', JText::_( 'Category') ); + return false; + }*/ + + if(empty($this->alias)) { + $this->alias = $this->title; + } + $this->alias = JFilterOutput::stringURLSafe($this->alias); + if(trim(str_replace('-','',$this->alias)) == '') { + $datenow =& JFactory::getDate(); + $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); + } + + return true; + } +} diff --git a/libraries/joomla/database/table/component.php b/libraries/joomla/database/table/component.php index 91ef49ca58a50..d6c3e20cb334a 100644 --- a/libraries/joomla/database/table/component.php +++ b/libraries/joomla/database/table/component.php @@ -1,114 +1,118 @@ -getDBO(); - $query = 'SELECT id' . - ' FROM #__components' . - ' WHERE ' . $db->nameQuote( 'option' ) . '=' . $db->Quote( $option ) . - ' AND parent = 0'; - $db->setQuery( $query, 0, 1 ); - $id = $db->loadResult(); - - if ($id === null) { - return false; - } else { - return $this->load( $id ); - } - } - - /** - * Validate and filter fields - */ - function check() - { - $this->parent = intval( $this->parent ); - $this->ordering = intval( $this->ordering ); - return true; - } - - /** - * Overloaded bind function - * - * @access public - * @param array $hash named array - * @return null|string null is operation was satisfactory, otherwise returns an error - * @see JTable:bind - * @since 1.5 - */ - function bind($array, $ignore = '') - { - if (is_array( $array['params'] )) - { - $registry = new JRegistry(); - $registry->loadArray($array['params']); - $array['params'] = $registry->toString(); - } - - return parent::bind($array, $ignore); - } -} \ No newline at end of file + +/** + * Component table + * + * @package Joomla.Framework + * @subpackage Table + * @since 1.0 + */ +class JTableComponent extends JTable +{ + /** @var int Primary key */ + protected $id = null; + /** @var string */ + protected $name = null; + /** @var string */ + protected $link = null; + /** @var int */ + protected $menuid = null; + /** @var int */ + protected $parent = null; + /** @var string */ + protected $admin_menu_link = null; + /** @var string */ + protected $admin_menu_alt = null; + /** @var string */ + protected $option = null; + /** @var string */ + protected $ordering = null; + /** @var string */ + protected $admin_menu_img = null; + /** @var int */ + protected $iscore = null; + /** @var string */ + protected $params = null; + /** @var int */ + protected $enabled = null; + + /** + * @param database A database connector object + */ + protected function __construct( &$db ) { + parent::__construct( '#__components', 'id', $db ); + } + + /** + * Loads a data row by option + * + * @param string The component option value + * @return boolean + */ + public function loadByOption( $option ) + { + $db = &$this->getDBO(); + $query = 'SELECT id' . + ' FROM #__components' . + ' WHERE ' . $db->nameQuote( 'option' ) . '=' . $db->Quote( $option ) . + ' AND parent = 0'; + $db->setQuery( $query, 0, 1 ); + try { + $id = $db->loadResult(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + if (empty($id)) { + return false; + } else { + return $this->load( $id ); + } + } + + /** + * Validate and filter fields + */ + public function check() + { + $this->parent = intval( $this->parent ); + $this->ordering = intval( $this->ordering ); + return true; + } + + /** + * Overloaded bind function + * + * @access public + * @param array $hash named array + * @return null|string null is operation was satisfactory, otherwise returns an error + * @see JTable:bind + * @since 1.5 + */ + public function bind($array, $ignore = '') + { + if (is_array( $array['params'] )) + { + $registry = new JRegistry(); + $registry->loadArray($array['params']); + $array['params'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } +} diff --git a/libraries/joomla/database/table/content.php b/libraries/joomla/database/table/content.php index dacf5cd15bd46..c26a60810d72e 100644 --- a/libraries/joomla/database/table/content.php +++ b/libraries/joomla/database/table/content.php @@ -1,179 +1,183 @@ -introtext = trim( $filter->clean( $this->introtext ) ); - $this->fulltext = trim( $filter->clean( $this->fulltext ) ); - */ - - - if(empty($this->title)) { - $this->setError(JText::_('Article must have a title')); - return false; - } - - if(empty($this->alias)) { - $this->alias = $this->title; - } - $this->alias = JFilterOutput::stringURLSafe($this->alias); - - if(trim(str_replace('-','',$this->alias)) == '') { - $datenow =& JFactory::getDate(); - $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); - } - - if (trim( str_replace( ' ', '', $this->fulltext ) ) == '') { - $this->fulltext = ''; - } - - if(empty($this->introtext) && empty($this->fulltext)) { - $this->setError(JText::_('Article must have some text')); - return false; - } - - return true; - } - - /** - * Converts record to XML - * @param boolean Map foreign keys to text values - */ - function toXML( $mapKeysToText=false ) - { - $db =& JFactory::getDBO(); - - if ($mapKeysToText) { - $query = 'SELECT name' - . ' FROM #__sections' - . ' WHERE id = '. (int) $this->sectionid - ; - $db->setQuery( $query ); - $this->sectionid = $db->loadResult(); - - $query = 'SELECT name' - . ' FROM #__categories' - . ' WHERE id = '. (int) $this->catid - ; - $db->setQuery( $query ); - $this->catid = $db->loadResult(); - - $query = 'SELECT name' - . ' FROM #__users' - . ' WHERE id = ' . (int) $this->created_by - ; - $db->setQuery( $query ); - $this->created_by = $db->loadResult(); - } - - return parent::toXML( $mapKeysToText ); - } -} +introtext = trim( $filter->clean( $this->introtext ) ); + $this->fulltext = trim( $filter->clean( $this->fulltext ) ); + */ + + + if(empty($this->title)) { + $this->setError(JText::_('Article must have a title')); + return false; + } + + if(empty($this->alias)) { + $this->alias = $this->title; + } + $this->alias = JFilterOutput::stringURLSafe($this->alias); + + if(trim(str_replace('-','',$this->alias)) == '') { + $datenow =& JFactory::getDate(); + $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); + } + + if (trim( str_replace( ' ', '', $this->fulltext ) ) == '') { + $this->fulltext = ''; + } + + if(empty($this->introtext) && empty($this->fulltext)) { + $this->setError(JText::_('Article must have some text')); + return false; + } + + return true; + } + + /** + * Converts record to XML + * @param boolean Map foreign keys to text values + */ + public function toXML( $mapKeysToText=false ) + { + $db =& JFactory::getDBO(); + try { + if ($mapKeysToText) { + $query = 'SELECT name' + . ' FROM #__sections' + . ' WHERE id = '. (int) $this->sectionid + ; + $db->setQuery( $query ); + $this->sectionid = $db->loadResult(); + + $query = 'SELECT name' + . ' FROM #__categories' + . ' WHERE id = '. (int) $this->catid + ; + $db->setQuery( $query ); + $this->catid = $db->loadResult(); + + $query = 'SELECT name' + . ' FROM #__users' + . ' WHERE id = ' . (int) $this->created_by + ; + $db->setQuery( $query ); + $this->created_by = $db->loadResult(); + } + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + + return parent::toXML( $mapKeysToText ); + } +} diff --git a/libraries/joomla/database/table/group.php b/libraries/joomla/database/table/group.php new file mode 100644 index 0000000000000..94dce8604991d --- /dev/null +++ b/libraries/joomla/database/table/group.php @@ -0,0 +1,105 @@ +_db; + + $parent_id = (int) $parent_id; + + // get all children of this node + $query = 'SELECT id FROM '. $this->_tbl .' WHERE parent_id='. $parent_id; + + $db->setQuery( $query ); + try { + $children = $db->loadResultArray(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + + // the right value of this node is the left value + 1 + $right = $left + 1; + + $n = count( $children ); + foreach ($children as $id) + { + // recursive execution of this function for each + // child of this node + // $right is the current right value, which is + // incremented by the rebuild_tree function + $right = $this->rebuild( $id, $right ); + + if ($right === FALSE) { + return FALSE; + } + } + + // we've got the left value, and now that we've processed + // the children of this node we also know the right value + $query = 'UPDATE '. $this->_tbl .' SET lft='. $left .', rgt='. $right .' WHERE id='. $parent_id; + + $db->setQuery( $query ); + try { + $db->query(); + } catch(JException $e) { + $this->setError($e->getMessage); + return false; + } + + // return the right value of this node + 1 + return $right + 1; + } +} + diff --git a/libraries/joomla/database/table/index.html b/libraries/joomla/database/table/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/database/table/index.html +++ b/libraries/joomla/database/table/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/database/table/menu.php b/libraries/joomla/database/table/menu.php index b1e41fd79604d..22467394b39e8 100644 --- a/libraries/joomla/database/table/menu.php +++ b/libraries/joomla/database/table/menu.php @@ -1,123 +1,123 @@ -alias)) { - $this->alias = $this->name; - } - $this->alias = JFilterOutput::stringURLSafe($this->alias); - if(trim(str_replace('-','',$this->alias)) == '') { - $datenow =& JFactory::getDate(); - $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); - } - - return true; - } - - /** - * Overloaded bind function - * - * @access public - * @param array $hash named array - * @return null|string null is operation was satisfactory, otherwise returns an error - * @see JTable:bind - * @since 1.5 - */ - - function bind($array, $ignore = '') - { - if (is_array( $array['params'] )) - { - $registry = new JRegistry(); - $registry->loadArray($array['params']); - $array['params'] = $registry->toString(); - } - - return parent::bind($array, $ignore); - } -} +alias)) { + $this->alias = $this->name; + } + $this->alias = JFilterOutput::stringURLSafe($this->alias); + if(trim(str_replace('-','',$this->alias)) == '') { + $datenow =& JFactory::getDate(); + $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); + } + + return true; + } + + /** + * Overloaded bind function + * + * @access public + * @param array $hash named array + * @return null|string null is operation was satisfactory, otherwise returns an error + * @see JTable:bind + * @since 1.5 + */ + + public function bind($array, $ignore = '') + { + if (isset($array['params']) && is_array( $array['params'] )) + { + $registry = new JRegistry(); + $registry->loadArray($array['params']); + $array['params'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } +} diff --git a/libraries/joomla/database/table/menutypes.php b/libraries/joomla/database/table/menutypes.php index 14b8c274fe1ec..a4809efa27405 100644 --- a/libraries/joomla/database/table/menutypes.php +++ b/libraries/joomla/database/table/menutypes.php @@ -1,86 +1,92 @@ -menutype, '\'' )) - { - $this->setError(JText::_( 'The menu name cannot contain a \'', true )); - return false; - } - - // correct spurious data - if (trim( $this->title) == '') { - $this->title = $this->menutype; - } - - $db =& JFactory::getDBO(); - - // check for unique menutype for new menu copy - $query = 'SELECT menutype' . - ' FROM #__menu_types'; - if ($this->id) { - $query .= ' WHERE id != '.(int) $this->id; - } - - $db->setQuery( $query ); - $menus = $db->loadResultArray(); - - foreach ($menus as $menutype) - { - if ($menutype == $this->menutype) - { - $this->setError( "Cannot save: Duplicate menu type '$this->menutype'" ); - return false; - } - } - - return true; - } -} \ No newline at end of file +menutype = JFilterOutput::stringURLSafe($this->menutype); + if(empty($this->menutype)) { + $this->setError( "Cannot save: Empty menu type" ); + return false; + } + + // correct spurious data + if (trim( $this->title) == '') { + $this->title = $this->menutype; + } + + $db =& JFactory::getDBO(); + + // check for unique menutype for new menu copy + $query = 'SELECT menutype' . + ' FROM #__menu_types'; + if ($this->id) { + $query .= ' WHERE id != '.(int) $this->id; + } + + $db->setQuery( $query ); + try { + $menus = $db->loadResultArray(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + + foreach ($menus as $menutype) + { + if ($menutype == $this->menutype) + { + $this->setError( "Cannot save: Duplicate menu type '{$this->menutype}'" ); + return false; + } + } + + return true; + } +} + diff --git a/libraries/joomla/database/table/module.php b/libraries/joomla/database/table/module.php index 8642f724ed9a6..9e066576d1003 100644 --- a/libraries/joomla/database/table/module.php +++ b/libraries/joomla/database/table/module.php @@ -1,115 +1,115 @@ -title ) == '') { - $this->setError(JText::sprintf( 'must contain a title', JText::_( 'Module') )); - return false; - } - - return true; - } - - /** - * Overloaded bind function - * - * @access public - * @param array $hash named array - * @return null|string null is operation was satisfactory, otherwise returns an error - * @see JTable:bind - * @since 1.5 - */ - function bind($array, $ignore = '') - { - if (is_array( $array['params'] )) - { - $registry = new JRegistry(); - $registry->loadArray($array['params']); - $array['params'] = $registry->toString(); - } - - if (isset( $array['control'] ) && is_array( $array['control'] )) - { - $registry = new JRegistry(); - $registry->loadArray($array['control']); - $array['control'] = $registry->toString(); - } - - return parent::bind($array, $ignore); - } -} \ No newline at end of file + +/** + * Module table + * + * @package Joomla.Framework + * @subpackage Table + * @since 1.0 + */ +class JTableModule extends JTable +{ + /** @var int Primary key */ + protected $id = null; + /** @var string */ + protected $title = null; + /** @var string */ + protected $showtitle = null; + /** @var int */ + protected $content = null; + /** @var int */ + protected $ordering = null; + /** @var string */ + protected $position = null; + /** @var boolean */ + protected $checked_out = 0; + /** @var time */ + protected $checked_out_time = 0; + /** @var boolean */ + protected $published = null; + /** @var string */ + protected $module = null; + /** @var int */ + protected $numnews = null; + /** @var int */ + protected $access = null; + /** @var string */ + protected $params = null; + /** @var string */ + protected $iscore = null; + /** @var string */ + protected $client_id = null; + /** @var string */ + protected $control = null; + + /** + * Contructore + * + * @access protected + * @param database A database connector object + */ + protected function __construct( &$db ) { + parent::__construct( '#__modules', 'id', $db ); + } + + /** + * Overloaded check function + * + * @access public + * @return boolean True if the object is ok + * @see JTable:bind + */ + public function check() + { + // check for valid name + if (trim( $this->title ) == '') { + $this->setError(JText::sprintf( 'must contain a title', JText::_( 'Module') )); + return false; + } + + return true; + } + + /** + * Overloaded bind function + * + * @access public + * @param array $hash named array + * @return null|string null is operation was satisfactory, otherwise returns an error + * @see JTable:bind + * @since 1.5 + */ + public function bind($array, $ignore = '') + { + if (is_array( $array['params'] )) + { + $registry = new JRegistry(); + $registry->loadArray($array['params']); + $array['params'] = $registry->toString(); + } + + if (isset( $array['control'] ) && is_array( $array['control'] )) + { + $registry = new JRegistry(); + $registry->loadArray($array['control']); + $array['control'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } +} diff --git a/libraries/joomla/database/table/plugin.php b/libraries/joomla/database/table/plugin.php index ceff3a3319603..fef5f163dbc42 100644 --- a/libraries/joomla/database/table/plugin.php +++ b/libraries/joomla/database/table/plugin.php @@ -1,135 +1,135 @@ -loadArray($array['params']); - $array['params'] = $registry->toString(); - } - - return parent::bind($array, $ignore); - } -} \ No newline at end of file + +/** + * Plugin table + * + * @package Joomla.Framework + * @subpackage Table + * @since 1.0 + */ +class JTablePlugin extends JTable +{ + /** + * Primary Key + * + * @var int + */ + protected $id = null; + + /** + * + * + * @var varchar + */ + protected $name = null; + + /** + * + * + * @var varchar + */ + protected $element = null; + + /** + * + * + * @var varchar + */ + protected $folder = null; + + /** + * + * + * @var tinyint unsigned + */ + protected $access = null; + + /** + * + * + * @var int + */ + protected $ordering = null; + + /** + * + * + * @var tinyint + */ + protected $published = null; + + /** + * + * + * @var tinyint + */ + protected $iscore = null; + + /** + * + * + * @var tinyint + */ + protected $client_id = null; + + /** + * + * + * @var int unsigned + */ + protected $checked_out = 0; + + /** + * + * + * @var datetime + */ + protected $checked_out_time = 0; + + /** + * + * + * @var text + */ + protected $params = null; + + protected function __construct(& $db) { + parent::__construct('#__plugins', 'id', $db); + } + + /** + * Overloaded bind function + * + * @access public + * @param array $hash named array + * @return null|string null is operation was satisfactory, otherwise returns an error + * @see JTable:bind + * @since 1.5 + */ + public function bind($array, $ignore = '') + { + if (isset( $array['params'] ) && is_array($array['params'])) + { + $registry = new JRegistry(); + $registry->loadArray($array['params']); + $array['params'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } +} diff --git a/libraries/joomla/database/table/section.php b/libraries/joomla/database/table/section.php index 51f798085b5b4..337002e94135e 100644 --- a/libraries/joomla/database/table/section.php +++ b/libraries/joomla/database/table/section.php @@ -1,124 +1,124 @@ -title ) == '') { - $this->setError( JText::_( 'SECTION MUST HAVE A TITLE') ); - return false; - } - - // check for existing name - /*$query = "SELECT id" - . ' FROM #__sections " - . ' WHERE title = '. $this->_db->Quote($this->title) - . ' AND scope = ' . $this->_db->Quote($this->scope) - ; - $this->_db->setQuery( $query ); - - $xid = intval( $this->_db->loadResult() ); - if ($xid && $xid != intval( $this->id )) { - $this->_error = JText::sprintf( 'WARNNAMETRYAGAIN', JText::_( 'Section') ); - return false; - }*/ - - if(empty($this->alias)) { - $this->alias = $this->title; - } - $this->alias = JFilterOutput::stringURLSafe($this->alias); - if(trim(str_replace('-','',$this->alias)) == '') { - $datenow =& JFactory::getDate(); - $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); - } - - return true; - } - - /** - * Overloaded bind function - * - * @access public - * @param array $hash named array - * @return null|string null is operation was satisfactory, otherwise returns an error - * @see JTable:bind - * @since 1.5 - */ - function bind($array, $ignore = '') - { - if (isset( $array['params'] ) && is_array($array['params'])) - { - $registry = new JRegistry(); - $registry->loadArray($array['params']); - $array['params'] = $registry->toString(); - } - - return parent::bind($array, $ignore); - } -} +title ) == '') { + $this->setError( JText::_( 'SECTION MUST HAVE A TITLE') ); + return false; + } + + // check for existing name + /*$query = "SELECT id" + . ' FROM #__sections " + . ' WHERE title = '. $this->_db->Quote($this->title) + . ' AND scope = ' . $this->_db->Quote($this->scope) + ; + $this->_db->setQuery( $query ); + + $xid = intval( $this->_db->loadResult() ); + if ($xid && $xid != intval( $this->id )) { + $this->_error = JText::sprintf( 'WARNNAMETRYAGAIN', JText::_( 'Section') ); + return false; + }*/ + + if(empty($this->alias)) { + $this->alias = $this->title; + } + $this->alias = JFilterOutput::stringURLSafe($this->alias); + if(trim(str_replace('-','',$this->alias)) == '') { + $datenow =& JFactory::getDate(); + $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S"); + } + + return true; + } + + /** + * Overloaded bind function + * + * @access public + * @param array $hash named array + * @return null|string null is operation was satisfactory, otherwise returns an error + * @see JTable:bind + * @since 1.5 + */ + public function bind($array, $ignore = '') + { + if (isset( $array['params'] ) && is_array($array['params'])) + { + $registry = new JRegistry(); + $registry->loadArray($array['params']); + $array['params'] = $registry->toString(); + } + + return parent::bind($array, $ignore); + } +} diff --git a/libraries/joomla/database/table/session.php b/libraries/joomla/database/table/session.php index 5c67f0babc681..ce70c291f37ee 100644 --- a/libraries/joomla/database/table/session.php +++ b/libraries/joomla/database/table/session.php @@ -1,213 +1,217 @@ -guest = 1; - $this->username = ''; - $this->gid = 0; - } - - function insert($sessionId, $clientId) - { - $this->session_id = $sessionId; - $this->client_id = $clientId; - - $this->time = time(); - $ret = $this->_db->insertObject( $this->_tbl, $this, 'session_id' ); - - if( !$ret ) { - $this->setError(strtolower(get_class( $this ))."::". JText::_( 'store failed' ) ."
      " . $this->_db->stderr()); - return false; - } else { - return true; - } - } - - function update( $updateNulls = false ) - { - $this->time = time(); - $ret = $this->_db->updateObject( $this->_tbl, $this, 'session_id', $updateNulls ); - - if( !$ret ) { - $this->setError(strtolower(get_class( $this ))."::". JText::_( 'store failed' ) ."
      " . $this->_db->stderr()); - return false; - } else { - return true; - } - } - - /** - * Destroys the pesisting session - */ - function destroy($userId, $clientIds = array()) - { - $clientIds = implode( ',', $clientIds ); - - $query = 'DELETE FROM #__session' - . ' WHERE userid = '. $this->_db->Quote( $userId ) - . ' AND client_id IN ( '.$clientIds.' )' - ; - $this->_db->setQuery( $query ); - - if ( !$this->_db->query() ) { - $this->setError( $this->_db->stderr()); - return false; - } - - return true; - } - - /** - * Purge old sessions - * - * @param int Session age in seconds - * @return mixed Resource on success, null on fail - */ - function purge( $maxLifetime = 1440 ) - { - $past = time() - $maxLifetime; - $query = 'DELETE FROM '. $this->_tbl .' WHERE ( time < \''. (int) $past .'\' )'; // Index on 'VARCHAR' - $this->_db->setQuery($query); - - return $this->_db->query(); - } - - /** - * Find out if a user has a one or more active sessions - * - * @param int $userid The identifier of the user - * @return boolean True if a session for this user exists - */ - function exists($userid) - { - $query = 'SELECT COUNT(userid) FROM #__session' - . ' WHERE userid = '. $this->_db->Quote( $userid ); - $this->_db->setQuery( $query ); - - if ( !$result = $this->_db->loadResult() ) { - $this->setError($this->_db->stderr()); - return false; - } - - return (boolean) $result; - } - - /** - * Overloaded delete method - * - * We must override it because of the non-integer primary key - * - * @access public - * @return true if successful otherwise returns and error message - */ - function delete( $oid=null ) - { - //if (!$this->canDelete( $msg )) - //{ - // return $msg; - //} - - $k = $this->_tbl_key; - if ($oid) { - $this->$k = $oid; - } - - $query = 'DELETE FROM '.$this->_db->nameQuote( $this->_tbl ). - ' WHERE '.$this->_tbl_key.' = '. $this->_db->Quote($this->$k); - $this->_db->setQuery( $query ); - - if ($this->_db->query()) - { - return true; - } - else - { - $this->setError($this->_db->getErrorMsg()); - return false; - } - } -} +guest = 1; + $this->username = ''; + $this->gid = 0; + } + + public function insert($sessionId, $clientId) + { + $this->session_id = $sessionId; + $this->client_id = $clientId; + + $this->time = time(); + try { + $this->_db->insertObject( $this->_tbl, $this, 'session_id' ); + } catch(JException $e) { + $this->setError(strtolower(get_class( $this ))."::". JText::_( 'store failed' ) ."
      " . $e->getMessage()); + return false; + } + return true; + } + + public function update( $updateNulls = false ) + { + $this->time = time(); + try { + $this->_db->updateObject( $this->_tbl, $this, 'session_id', $updateNulls ); + } catch(JException $e) { + $this->setError(strtolower(get_class( $this ))."::". JText::_( 'store failed' ) ."
      " . $e->getMessage()); + return false; + } + return true; + } + + /** + * Destroys the pesisting session + */ + public function destroy($userId, $clientIds = array()) + { + $clientIds = implode( ',', $clientIds ); + + $query = 'DELETE FROM #__session' + . ' WHERE userid = '. $this->_db->Quote( $userId ) + . ' AND client_id IN ( '.$clientIds.' )' + ; + $this->_db->setQuery( $query ); + + try { + $this->_db->query(); + } catch(JException $e) { + $this->setError( $e->getMessage()); + return false; + } + + return true; + } + + /** + * Purge old sessions + * + * @param int Session age in seconds + * @return mixed Resource on success, null on fail + */ + public function purge( $maxLifetime = 1440 ) + { + $past = time() - $maxLifetime; + $query = 'DELETE FROM '. $this->_tbl .' WHERE ( time < \''. (int) $past .'\' )'; // Index on 'VARCHAR' + $this->_db->setQuery($query); + try { + return $this->_db->query(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + } + + /** + * Find out if a user has a one or more active sessions + * + * @param int $userid The identifier of the user + * @return boolean True if a session for this user exists + */ + public function exists($userid) + { + $query = 'SELECT COUNT(userid) FROM #__session' + . ' WHERE userid = '. $this->_db->Quote( $userid ); + $this->_db->setQuery( $query ); + + try { + $result = $this->_db->loadResult(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + + return (boolean) $result; + } + + /** + * Overloaded delete method + * + * We must override it because of the non-integer primary key + * + * @access public + * @return true if successful otherwise returns and error message + */ + public function delete( $oid=null ) + { + //if (!$this->canDelete( $msg )) + //{ + // return $msg; + //} + + $k = $this->_tbl_key; + if ($oid) { + $this->$k = $oid; + } + + $query = 'DELETE FROM '.$this->_db->nameQuote( $this->_tbl ). + ' WHERE '.$this->_tbl_key.' = '. $this->_db->Quote($this->$k); + $this->_db->setQuery( $query ); + + try { + $this->_db->query(); + return true; + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + } +} diff --git a/libraries/joomla/database/table/tree.php b/libraries/joomla/database/table/tree.php new file mode 100644 index 0000000000000..fdc6617bb2bf1 --- /dev/null +++ b/libraries/joomla/database/table/tree.php @@ -0,0 +1,98 @@ +rebuild(); + } + return $result; + } + + /** + * Recursive method + * @param int parent id + * @param int Left value + */ + public function rebuild( $parent_id = 0, $left = 1 ) + { + $db = &$this->_db; + + $parent_id = (int) $parent_id; + + // get all children of this node + $query = 'SELECT id FROM '. $this->_tbl .' WHERE parent_id='. $parent_id; + + $db->setQuery( $query ); + try { + $children = $db->loadResultArray(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + + // the right value of this node is the left value + 1 + $right = $left + 1; + + $n = count( $children ); + foreach ($children as $id) { + // recursive execution of this function for each + // child of this node + // $right is the current right value, which is + // incremented by the rebuild_tree function + $right = $this->rebuild( $id, $right ); + + if ($right === FALSE) { + return FALSE; + } + } + + // we've got the left value, and now that we've processed + // the children of this node we also know the right value + $query = 'UPDATE '. $this->_tbl .' SET lft='. $left .', rgt='. $right .' WHERE id='. $parent_id; + + $db->setQuery( $query ); + try { + $db->query(); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } + + // return the right value of this node + 1 + return $right + 1; + } +} diff --git a/libraries/joomla/database/table/user.php b/libraries/joomla/database/table/user.php index 5646f7bd462bf..23dd91499cd0c 100644 --- a/libraries/joomla/database/table/user.php +++ b/libraries/joomla/database/table/user.php @@ -29,102 +29,102 @@ class JTableUser extends JTable * * @var int */ - var $id = null; + protected $id = null; /** * The users real name (or nickname) * * @var string */ - var $name = null; + protected $name = null; /** * The login name * * @var string */ - var $username = null; + protected $username = null; /** * The email * * @var string */ - var $email = null; + protected $email = null; /** * MD5 encrypted password * * @var string */ - var $password = null; + protected $password = null; /** * Description * * @var string */ - var $usertype = null; + protected $usertype = null; /** * Description * * @var int */ - var $block = null; + protected $block = null; /** * Description * * @var int */ - var $sendEmail = null; + protected $sendEmail = null; /** * The group id number * * @var int */ - var $gid = null; + protected $gid = null; /** * Description * * @var datetime */ - var $registerDate = null; + protected $registerDate = null; /** * Description * * @var datetime */ - var $lastvisitDate = null; + protected $lastvisitDate = null; /** * Description * * @var string activation hash */ - var $activation = null; + protected $activation = null; /** * Description * * @var string */ - var $params = null; + protected $params = null; /** * @param database A database connector object */ - function __construct( &$db ) + protected function __construct( &$db ) { parent::__construct( '#__users', 'id', $db ); //initialise - $this->id = 0; - $this->gid = 0; + $this->id = 0; + $this->gid = 0; $this->sendEmail = 0; } @@ -133,7 +133,7 @@ function __construct( &$db ) * * @return boolean True is satisfactory */ - function check() + public function check() { jimport('joomla.mail.helper'); @@ -173,7 +173,12 @@ function check() . ' AND id != '. (int) $this->id; ; $this->_db->setQuery( $query ); - $xid = intval( $this->_db->loadResult() ); + try { + $xid = intval( $this->_db->loadResult() ); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } if ($xid && $xid != intval( $this->id )) { $this->setError( JText::_('WARNREG_INUSE')); return false; @@ -187,7 +192,12 @@ function check() . ' AND id != '. (int) $this->id ; $this->_db->setQuery( $query ); - $xid = intval( $this->_db->loadResult() ); + try { + $xid = intval( $this->_db->loadResult() ); + } catch(JException $e) { + $this->setError($e->getMessage()); + return false; + } if ($xid && $xid != intval( $this->id )) { $this->setError( JText::_( 'WARNREG_EMAIL_INUSE' ) ); return false; @@ -196,51 +206,46 @@ function check() return true; } - function store( $updateNulls=false ) + public function store( $updateNulls=false ) { $acl =& JFactory::getACL(); $section_value = 'users'; $k = $this->_tbl_key; $key = $this->$k; - - if ($key) - { - // existing record - $ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls ); - - // syncronise ACL - // single group handled at the moment - // trivial to expand to multiple groups - $object_id = $acl->get_object_id( $section_value, $this->$k, 'ARO' ); - - $groups = $acl->get_object_groups( $object_id, 'ARO' ); - $acl->del_group_object( $groups[0], $section_value, $this->$k, 'ARO' ); - $acl->add_group_object( $this->gid, $section_value, $this->$k, 'ARO' ); - - $acl->edit_object( $object_id, $section_value, $this->_db->getEscaped( $this->name ), $this->$k, 0, 0, 'ARO' ); - } - else - { - // new record - $ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key ); - // syncronise ACL - $acl->add_object( $section_value, $this->name, $this->$k, null, null, 'ARO' ); - $acl->add_group_object( $this->gid, $section_value, $this->$k, 'ARO' ); - } - - if( !$ret ) - { - $this->setError( strtolower(get_class( $this ))."::". JText::_( 'store failed' ) ."
      " . $this->_db->getErrorMsg() ); + try { + if ($key) + { + // existing record + $ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls ); + + // syncronise ACL + // single group handled at the moment + // trivial to expand to multiple groups + $object_id = $acl->get_object_id( $section_value, $this->$k, 'ARO' ); + + $groups = $acl->get_object_groups( $object_id, 'ARO' ); + $acl->del_group_object( $groups[0], $section_value, $this->$k, 'ARO' ); + $acl->add_group_object( $this->gid, $section_value, $this->$k, 'ARO' ); + + $acl->edit_object( $object_id, $section_value, $this->_db->getEscaped( $this->name ), $this->$k, 0, 0, 'ARO' ); + } + else + { + // new record + $ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key ); + // syncronise ACL + $acl->add_object( $section_value, $this->name, $this->$k, null, null, 'ARO' ); + $acl->add_group_object( $this->gid, $section_value, $this->$k, 'ARO' ); + } + } catch(JException $e) { + $this->setError( strtolower(get_class( $this ))."::". JText::_( 'store failed' ) ."
      " . $e->getMessage() ); return false; } - else - { - return true; - } + return true; } - function delete( $oid=null ) + public function delete( $oid=null ) { $acl =& JFactory::getACL(); @@ -256,7 +261,8 @@ function delete( $oid=null ) ; $this->_db->setQuery( $query ); - if ($this->_db->query()) { + try { + $this->_db->query(); // cleanup related data // private messaging @@ -264,24 +270,18 @@ function delete( $oid=null ) . ' WHERE user_id = '. (int) $this->$k ; $this->_db->setQuery( $query ); - if (!$this->_db->query()) { - $this->setError( $this->_db->getErrorMsg() ); - return false; - } + $this->_db->query(); + $query = 'DELETE FROM #__messages' . ' WHERE user_id_to = '. (int) $this->$k ; $this->_db->setQuery( $query ); - if (!$this->_db->query()) { - $this->setError( $this->_db->getErrorMsg() ); - return false; - } - - return true; - } else { - $this->setError( $this->_db->getErrorMsg() ); + $this->_db->query(); + } catch(JException $e) { + $this->setError($e->getMessage()); return false; } + return true; } /** @@ -290,7 +290,7 @@ function delete( $oid=null ) * @param int The timestamp, defaults to 'now' * @return boolean False if an error occurs */ - function setLastVisit( $timeStamp=null, $id=null ) + public function setLastVisit( $timeStamp=null, $id=null ) { // check for User ID if (is_null( $id )) { @@ -311,8 +311,10 @@ function setLastVisit( $timeStamp=null, $id=null ) . ' WHERE id = '. (int) $id ; $this->_db->setQuery( $query ); - if (!$this->_db->query()) { - $this->setError( $this->_db->getErrorMsg() ); + try { + $this->_db->query(); + } catch(JException $e) { + $this->setError( $e->getMessage() ); return false; } @@ -320,16 +322,16 @@ function setLastVisit( $timeStamp=null, $id=null ) } /** - * Overloaded bind function - * - * @access public - * @param array $hash named array - * @return null|string null is operation was satisfactory, otherwise returns an error - * @see JTable:bind - * @since 1.5 - */ + * Overloaded bind function + * + * @access public + * @param array $hash named array + * @return null|string null is operation was satisfactory, otherwise returns an error + * @see JTable:bind + * @since 1.5 + */ - function bind($array, $ignore = '') + public function bind($array, $ignore = '') { if (key_exists( 'params', $array ) && is_array( $array['params'] )) { $registry = new JRegistry(); diff --git a/libraries/joomla/document/document.php b/libraries/joomla/document/document.php index 5fc83ebac6d34..a04b3a7450b96 100644 --- a/libraries/joomla/document/document.php +++ b/libraries/joomla/document/document.php @@ -22,12 +22,11 @@ * Document class, provides an easy interface to parse and display a document * * @abstract - * @author Johan Janssens * @package Joomla.Framework * @subpackage Document * @since 1.5 */ -class JDocument extends JObject +abstract class JDocument extends JObject { /** * Document title @@ -35,7 +34,7 @@ class JDocument extends JObject * @var string * @access public */ - var $title = ''; + public $title = ''; /** * Document description @@ -43,7 +42,7 @@ class JDocument extends JObject * @var string * @access public */ - var $description = ''; + public $description = ''; /** * Document full URL @@ -51,7 +50,7 @@ class JDocument extends JObject * @var string * @access public */ - var $link = ''; + public $link = ''; /** * Document base URL @@ -59,7 +58,7 @@ class JDocument extends JObject * @var string * @access public */ - var $base = ''; + public $base = ''; /** * Contains the document language setting @@ -67,7 +66,7 @@ class JDocument extends JObject * @var string * @access public */ - var $language = 'en-gb'; + public $language = 'en-gb'; /** * Contains the document direction setting @@ -75,7 +74,7 @@ class JDocument extends JObject * @var string * @access public */ - var $direction = 'ltr'; + public $direction = 'ltr'; /** * Document generator @@ -83,7 +82,7 @@ class JDocument extends JObject * @var string * @access public */ - var $_generator = 'Joomla! 1.5 - Open Source Content Management'; + public $_generator = 'Joomla! 1.5 - Open Source Content Management'; /** * Document modified date @@ -91,7 +90,7 @@ class JDocument extends JObject * @var string * @access private */ - var $_mdate = ''; + public $_mdate = ''; /** * Tab string @@ -99,7 +98,7 @@ class JDocument extends JObject * @var string * @access private */ - var $_tab = "\11"; + public $_tab = "\11"; /** * Contains the line end string @@ -107,7 +106,7 @@ class JDocument extends JObject * @var string * @access private */ - var $_lineEnd = "\12"; + public $_lineEnd = "\12"; /** * Contains the character encoding string @@ -115,7 +114,7 @@ class JDocument extends JObject * @var string * @access private */ - var $_charset = 'utf-8'; + public $_charset = 'utf-8'; /** * Document mime type @@ -123,7 +122,7 @@ class JDocument extends JObject * @var string * @access private */ - var $_mime = ''; + public $_mime = ''; /** * Document namespace @@ -131,7 +130,7 @@ class JDocument extends JObject * @var string * @access private */ - var $_namespace = ''; + public $_namespace = ''; /** * Document profile @@ -139,7 +138,7 @@ class JDocument extends JObject * @var string * @access private */ - var $_profile = ''; + public $_profile = ''; /** * Array of linked scripts @@ -147,7 +146,7 @@ class JDocument extends JObject * @var array * @access private */ - var $_scripts = array(); + public $_scripts = array(); /** * Array of scripts placed in the header @@ -155,7 +154,7 @@ class JDocument extends JObject * @var array * @access private */ - var $_script = array(); + public $_script = array(); /** * Array of linked style sheets @@ -163,7 +162,7 @@ class JDocument extends JObject * @var array * @access private */ - var $_styleSheets = array(); + public $_styleSheets = array(); /** * Array of included style declarations @@ -171,7 +170,7 @@ class JDocument extends JObject * @var array * @access private */ - var $_style = array(); + public $_style = array(); /** * Array of meta tags @@ -179,7 +178,7 @@ class JDocument extends JObject * @var array * @access private */ - var $_metaTags = array(); + public $_metaTags = array(); /** * The rendering engine @@ -187,7 +186,7 @@ class JDocument extends JObject * @var object * @access private */ - var $_engine = null; + public $_engine = null; /** * The document type @@ -195,7 +194,7 @@ class JDocument extends JObject * @var string * @access private */ - var $_type = null; + public $_type = null; /** * Array of buffered output @@ -203,16 +202,16 @@ class JDocument extends JObject * @var mixed (depends on the renderer) * @access private */ - var $_buffer = null; + public $_buffer = null; /** * Class constructor * - * @access protected + * @access public * @param array $options Associative array of options */ - function __construct( $options = array()) + public function __construct( $options = array()) { parent::__construct(); @@ -256,7 +255,7 @@ function __construct( $options = array()) * @param type $type The document type to instantiate * @return object The document object. */ - function &getInstance($type = 'html', $attributes = array()) + public static function &getInstance($type = 'html', $attributes = array()) { static $instances; @@ -286,9 +285,9 @@ function &getInstance($type = 'html', $attributes = array()) { $path = dirname(__FILE__).DS.$type.DS.$type.'.php'; if (file_exists($path)) { - require_once($path); + require_once $path; } else { - JError::raiseError(500,JText::_('Unable to load document class')); + throw new JException(JText::_('Unable to load document class'), 500, E_ERROR, $class, true); } } @@ -311,7 +310,7 @@ function &getInstance($type = 'html', $attributes = array()) * @access public * @param string $type */ - function setType($type) { + public function setType($type) { $this->_type = $type; } @@ -321,7 +320,7 @@ function setType($type) { * @access public * @return string */ - function getType() { + public function getType() { return $this->_type; } @@ -331,9 +330,7 @@ function getType() { * @access public * @return array The document head data in array form */ - function getHeadData() { - // Impelemented in child classes - } + abstract public function getHeadData(); /** * Set the document head data @@ -341,9 +338,7 @@ function getHeadData() { * @access public * @param array $data The document head data in array form */ - function setHeadData($data) { - // Impelemented in child classes - } + abstract public function setHeadData($data); /** * Get the contents of the document buffer @@ -351,7 +346,7 @@ function setHeadData($data) { * @access public * @return The contents of the document buffer */ - function getBuffer() { + public function getBuffer() { return $this->_buffer; } @@ -361,7 +356,7 @@ function getBuffer() { * @access public * @param string $content The content to be set in the buffer */ - function setBuffer($content) { + public function setBuffer($content) { $this->_buffer = $content; } @@ -373,13 +368,20 @@ function setBuffer($content) { * @return string * @access public */ - function getMetaData($name, $http_equiv = false) + public function getMetaData($name, $http_equiv = false) { $result = ''; - if ($http_equiv == true) { - $result = @$this->_metaTags['http-equiv'][$name]; + $name = strtolower($name); + if($name == 'generator') { + $result = $this->getGenerator(); + } elseif($name == 'description') { + $result = $this->getDescription(); } else { - $result = @$this->_metaTags['standard'][$name]; + if ($http_equiv == true) { + $result = @$this->_metaTags['http-equiv'][$name]; + } else { + $result = @$this->_metaTags['standard'][$name]; + } } return $result; } @@ -393,12 +395,19 @@ function getMetaData($name, $http_equiv = false) * @return void * @access public */ - function setMetaData($name, $content, $http_equiv = false) + public function setMetaData($name, $content, $http_equiv = false) { - if ($http_equiv == true) { - $this->_metaTags['http-equiv'][$name] = $content; + $name = strtolower($name); + if($name == 'generator') { + $this->setGenerator($content); + } elseif($name == 'description') { + $this->setDescription($content); } else { - $this->_metaTags['standard'][$name] = $content; + if ($http_equiv == true) { + $this->_metaTags['http-equiv'][$name] = $content; + } else { + $this->_metaTags['standard'][$name] = $content; + } } } @@ -409,7 +418,7 @@ function setMetaData($name, $content, $http_equiv = false) * @param string $type Type of script. Defaults to 'text/javascript' * @access public */ - function addScript($url, $type="text/javascript") { + public function addScript($url, $type="text/javascript") { $this->_scripts[$url] = $type; } @@ -421,7 +430,7 @@ function addScript($url, $type="text/javascript") { * @param string $type Scripting mime (defaults to 'text/javascript') * @return void */ - function addScriptDeclaration($content, $type = 'text/javascript') + public function addScriptDeclaration($content, $type = 'text/javascript') { if (!isset($this->_script[strtolower($type)])) { $this->_script[strtolower($type)] = $content; @@ -438,7 +447,7 @@ function addScriptDeclaration($content, $type = 'text/javascript') * @param string $media Media type that this stylesheet applies to * @access public */ - function addStyleSheet($url, $type = 'text/css', $media = null, $attribs = array()) + public function addStyleSheet($url, $type = 'text/css', $media = null, $attribs = array()) { $this->_styleSheets[$url]['mime'] = $type; $this->_styleSheets[$url]['media'] = $media; @@ -453,7 +462,7 @@ function addStyleSheet($url, $type = 'text/css', $media = null, $attribs = array * @access public * @return void */ - function addStyleDeclaration($content, $type = 'text/css') + public function addStyleDeclaration($content, $type = 'text/css') { if (!isset($this->_style[strtolower($type)])) { $this->_style[strtolower($type)] = $content; @@ -469,7 +478,7 @@ function addStyleDeclaration($content, $type = 'text/css') * @access public * @return void */ - function setCharset($type = 'utf-8') { + public function setCharset($type = 'utf-8') { $this->_charset = $type; } @@ -479,7 +488,7 @@ function setCharset($type = 'utf-8') { * @access public * @return string */ - function getCharset() { + public function getCharset() { return $this->_charset; } @@ -489,7 +498,7 @@ function getCharset() { * @access public * @param string $lang */ - function setLanguage($lang = "en-gb") { + public function setLanguage($lang = "en-gb") { $this->language = strtolower($lang); } @@ -499,7 +508,7 @@ function setLanguage($lang = "en-gb") { * @return string * @access public */ - function getLanguage() { + public function getLanguage() { return $this->language; } @@ -509,7 +518,7 @@ function getLanguage() { * @access public * @param string $lang */ - function setDirection($dir = "ltr") { + public function setDirection($dir = "ltr") { $this->direction = strtolower($dir); } @@ -519,7 +528,7 @@ function setDirection($dir = "ltr") { * @return string * @access public */ - function getDirection() { + public function getDirection() { return $this->direction; } @@ -529,7 +538,7 @@ function getDirection() { * @param string $title * @access public */ - function setTitle($title) { + public function setTitle($title) { $this->title = $title; } @@ -539,7 +548,7 @@ function setTitle($title) { * @return string * @access public */ - function getTitle() { + public function getTitle() { return $this->title; } @@ -549,7 +558,7 @@ function getTitle() { * @param string $base * @access public */ - function setBase($base) { + public function setBase($base) { $this->base = $base; } @@ -559,7 +568,7 @@ function setBase($base) { * @return string * @access public */ - function getBase() { + public function getBase() { return $this->base; } @@ -569,7 +578,7 @@ function getBase() { * @param string $title * @access public */ - function setDescription($description) { + public function setDescription($description) { $this->description = $description; } @@ -579,7 +588,7 @@ function setDescription($description) { * @return string * @access public */ - function getDescription() { + public function getDescription() { return $this->description; } @@ -590,7 +599,7 @@ function getDescription() { * @access public * @return void */ - function setLink($url) { + public function setLink($url) { $this->link = $url; } @@ -600,7 +609,7 @@ function setLink($url) { * @access public * @return string */ - function getLink() { + public function getLink() { return $this->link; } @@ -611,7 +620,7 @@ function getLink() { * @access public * @return void */ - function setGenerator($generator) { + public function setGenerator($generator) { $this->_generator = $generator; } @@ -621,7 +630,7 @@ function setGenerator($generator) { * @access public * @return string */ - function getGenerator() { + public function getGenerator() { return $this->_generator; } @@ -632,7 +641,7 @@ function getGenerator() { * @access public * @return void */ - function setModifiedDate($date) { + public function setModifiedDate($date) { $this->_mdate = $date; } @@ -642,7 +651,7 @@ function setModifiedDate($date) { * @access public * @return string */ - function getModifiedDate() { + public function getModifiedDate() { return $this->_mdate; } @@ -659,7 +668,7 @@ function getModifiedDate() { * @access public * @return void */ - function setMimeEncoding($type = 'text/html') { + public function setMimeEncoding($type = 'text/html') { $this->_mime = strtolower($type); } @@ -670,7 +679,7 @@ function setMimeEncoding($type = 'text/html') { * @access public * @return void */ - function setLineEnd($style) + public function setLineEnd($style) { switch ($style) { case 'win': @@ -693,7 +702,7 @@ function setLineEnd($style) * @access private * @return string */ - function _getLineEnd() { + public function _getLineEnd() { return $this->_lineEnd; } @@ -704,7 +713,7 @@ function _getLineEnd() { * @access public * @return void */ - function setTab($string) { + public function setTab($string) { $this->_tab = $string; } @@ -714,7 +723,7 @@ function setTab($string) { * @access private * @return string */ - function _getTab() { + public function _getTab() { return $this->_tab; } @@ -726,7 +735,7 @@ function _getTab() { * @return object * @since 1.5 */ - function &loadRenderer( $type ) + public function &loadRenderer( $type ) { $null = null; $class = 'JDocumentRenderer'.$type; @@ -735,9 +744,9 @@ function &loadRenderer( $type ) { $path = dirname(__FILE__).DS.$this->_type.DS.'renderer'.DS.$type.'.php'; if(file_exists($path)) { - require_once($path); + require_once $path; } else { - JError::raiseError(500,JText::_('Unable to load renderer class')); + throw new JException(JText::_('Unable to load renderer class'), 500, E_ERROR, $class, true); } } @@ -758,7 +767,7 @@ function &loadRenderer( $type ) * @param array $params Associative array of attributes * @return The rendered data */ - function render( $cache = false, $params = array()) + public function render( $cache = false, $params = array()) { JResponse::setHeader( 'Expires', gmdate( 'D, d M Y H:i:s', time() + 900 ) . ' GMT' ); if ($mdate = $this->getModifiedDate()) { diff --git a/libraries/joomla/document/error/error.php b/libraries/joomla/document/error/error.php index 23d32c0fd825e..ada51a4689888 100644 --- a/libraries/joomla/document/error/error.php +++ b/libraries/joomla/document/error/error.php @@ -1,176 +1,166 @@ - - * @package Joomla.Framework - * @subpackage Document - * @since 1.5 - */ -class JDocumentError extends JDocument -{ - /** - * Error Object - * @var object - */ - var $_error; - - /** - * Class constructor - * - * @access protected - * @param string $type (either html or tex) - * @param array $attributes Associative array of attributes - */ - function __construct($options = array()) - { - parent::__construct($options); - - //set mime type - $this->_mime = 'text/html'; - - //set document type - $this->_type = 'error'; - } - - /** - * Set error object - * - * @access public - * @param object $error Error object to set - * @return boolean True on success - * @since 1.5 - */ - function setError($error) - { - if (JError::isError($error)) { - $this->_error = & $error; - return true; - } else { - return false; - } - } - - /** - * Render the document - * - * @access public - * @param boolean $cache If true, cache the output - * @param array $params Associative array of attributes - */ - function render( $cache = false, $params = array()) - { - // If no error object is set return null - if (!isset($this->_error)) { - return; - } - - //Set the status header - JResponse::setHeader('status', $this->_error->code.' '.str_replace( "\n", ' ', $this->_error->message )); - $file = 'error.php'; - - // check template - $directory = isset($params['directory']) ? $params['directory'] : 'templates'; - $template = isset($params['template']) ? JFilterInput::clean($params['template'], 'cmd') : 'system'; - - if ( !file_exists( $directory.DS.$template.DS.$file) ) { - $template = 'system'; - } - - //set variables - $this->baseurl = JURI::base(true); - $this->template = $template; - $this->debug = isset($params['debug']) ? $params['debug'] : false; - $this->error = $this->_error; - - // load - $data = $this->_loadTemplate($directory.DS.$template, $file); - - parent::render(); - return $data; - } - - /** - * Load a template file - * - * @param string $template The name of the template - * @param string $filename The actual filename - * @return string The contents of the template - */ - function _loadTemplate($directory, $filename) - { - $contents = ''; - - //Check to see if we have a valid template file - if ( file_exists( $directory.DS.$filename ) ) - { - //store the file path - $this->_file = $directory.DS.$filename; - - //get the file content - ob_start(); - require_once $directory.DS.$filename; - $contents = ob_get_contents(); - ob_end_clean(); - } - - return $contents; - } - - function renderBacktrace() - { - $contents = null; - $backtrace = $this->_error->getTrace(); - if( is_array( $backtrace ) ) - { - ob_start(); - $j = 1; - echo ''; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - echo ' '; - for( $i = count( $backtrace )-1; $i >= 0 ; $i-- ) - { - echo ' '; - echo ' '; - if( isset( $backtrace[$i]['class'] ) ) { - echo ' '; - } else { - echo ' '; - } - if( isset( $backtrace[$i]['file'] ) ) { - echo ' '; - } else { - echo ' '; - } - echo ' '; - $j++; - } - echo '
      Call stack
      #FunctionLocation
      '.$j.''.$backtrace[$i]['class'].$backtrace[$i]['type'].$backtrace[$i]['function'].'()'.$backtrace[$i]['function'].'()'.$backtrace[$i]['file'].':'.$backtrace[$i]['line'].' 
      '; - $contents = ob_get_contents(); - ob_end_clean(); - } - return $contents; - } -} \ No newline at end of file +_mime = 'text/html'; + + //set document type + $this->_type = 'error'; + } + + /** + * Set error object + * + * @access public + * @param object $error Error object to set + * @return boolean True on success + * @since 1.5 + */ + public function setError($error) + { + if (JError::isError($error)) { + $this->_error = & $error; + return true; + } else { + return false; + } + } + + /** + * Render the document + * + * @access public + * @param boolean $cache If true, cache the output + * @param array $params Associative array of attributes + */ + public function render( $cache = false, $params = array()) + { + // If no error object is set return null + if (!isset($this->_error)) { + return; + } + + //Set the status header + JResponse::setHeader('status', $this->_error->get('code').' '.str_replace( "\n", ' ', $this->_error->get('message') )); + $file = 'error.php'; + + // check template + $directory = isset($params['directory']) ? $params['directory'] : 'templates'; + $template = isset($params['template']) ? JFilterInput::clean($params['template'], 'cmd') : 'system'; + + if ( !file_exists( $directory.DS.$template.DS.$file) ) { + $template = 'system'; + } + + //set variables + $this->baseurl = JURI::base(true); + $this->template = $template; + $this->debug = isset($params['debug']) ? $params['debug'] : false; + $this->error = $this->_error; + + // load + $data = $this->_loadTemplate($directory.DS.$template, $file); + + parent::render(); + return $data; + } + + /** + * Load a template file + * + * @param string $template The name of the template + * @param string $filename The actual filename + * @return string The contents of the template + */ + public function _loadTemplate($directory, $filename) + { + $contents = ''; + + //Check to see if we have a valid template file + if ( file_exists( $directory.DS.$filename ) ) + { + //store the file path + $this->_file = $directory.DS.$filename; + + //get the file content + ob_start(); + require_once $directory.DS.$filename; + $contents = ob_get_contents(); + ob_end_clean(); + } + + return $contents; + } + + public function renderBacktrace() + { + return JError::renderBacktrace($this->_error); + } + + + /** + * Get the document head data + * + * @access public + * @return array The document head data in array form + */ + public function getHeadData(){ + return false; + } + + /** + * Set the document head data + * + * @access public + * @param array $data The document head data in array form + */ + public function setHeadData($data) { + return false; + } +} diff --git a/libraries/joomla/document/error/index.html b/libraries/joomla/document/error/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/document/error/index.html +++ b/libraries/joomla/document/error/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/document/feed/feed.php b/libraries/joomla/document/feed/feed.php index ee48d562ed7b3..bed6fd3bd8eb6 100644 --- a/libraries/joomla/document/feed/feed.php +++ b/libraries/joomla/document/feed/feed.php @@ -18,7 +18,6 @@ /** * DocumentFeed class, provides an easy interface to parse and display any feed document * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Document * @since 1.5 @@ -34,7 +33,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $syndicationURL = ""; + public $syndicationURL = ""; /** * Image feed element @@ -44,7 +43,7 @@ class JDocumentFeed extends JDocument * @var object * @access public */ - var $image = null; + public $image = null; /** * Copyright feed elememnt @@ -54,7 +53,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $copyright = ""; + public $copyright = ""; /** * Published date feed element @@ -64,7 +63,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $pubDate = ""; + public $pubDate = ""; /** * Lastbuild date feed element @@ -74,7 +73,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $lastBuildDate = ""; + public $lastBuildDate = ""; /** * Editor feed element @@ -84,7 +83,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $editor = ""; + public $editor = ""; /** * Docs feed element @@ -92,7 +91,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $docs = ""; + public $docs = ""; /** * Editor email feed element @@ -102,7 +101,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $editorEmail = ""; + public $editorEmail = ""; /** * Webmaster email feed element @@ -112,7 +111,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $webmaster = ""; + public $webmaster = ""; /** * Category feed element @@ -122,7 +121,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $category = ""; + public $category = ""; /** * TTL feed attribute @@ -132,7 +131,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $ttl = ""; + public $ttl = ""; /** * Rating feed element @@ -142,7 +141,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $rating = ""; + public $rating = ""; /** * Skiphours feed element @@ -152,7 +151,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $skipHours = ""; + public $skipHours = ""; /** * Skipdays feed element @@ -162,7 +161,7 @@ class JDocumentFeed extends JDocument * @var string * @access public */ - var $skipDays = ""; + public $skipDays = ""; /** * The feed items collection @@ -170,15 +169,15 @@ class JDocumentFeed extends JDocument * @var array * @access public */ - var $items = array(); + public $items = array(); /** * Class constructor * - * @access protected + * @access public * @param array $options Associative array of options */ - function __construct($options = array()) + public function __construct($options = array()) { parent::__construct($options); @@ -194,9 +193,9 @@ function __construct($options = array()) * @param array $params Associative array of attributes * @return The rendered data */ - function render( $cache = false, $params = array()) + public function render( $cache = false, $params = array()) { - global $option; + $component = JApplicationHelper::getComponentName(); // Get the feed type $type = JRequest::getCmd('type', 'rss'); @@ -210,12 +209,12 @@ function render( $cache = false, $params = array()) // set filename for rss feeds $file = strtolower( str_replace( '.', '', $type ) ); - $file = $cache_path.DS.$file.'_'.$option.'.xml'; + $file = $cache_path.DS.$file.'_'.$component.'.xml'; // Instantiate feed renderer and set the mime encoding $renderer =& $this->loadRenderer(($type) ? $type : 'rss'); - if (!is_a($renderer, 'JDocumentRenderer')) { + if (!$renderer INSTANCEOF JDocumentRenderer) { JError::raiseError(404, JText::_('Resource Not Found')); } $this->setMimeEncoding($renderer->getContentType()); @@ -243,9 +242,8 @@ function render( $cache = false, $params = array()) * @param object JFeedItem $item The feeditem to add to the feed. * @access public */ - function addItem( &$item ) + public function addItem( &$item ) { - $item->source = $this->link; $this->items[] = $item; } } @@ -253,7 +251,6 @@ function addItem( &$item ) /** * JFeedItem is an internal class that stores feed item information * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Document * @since 1.5 @@ -268,7 +265,7 @@ class JFeedItem extends JObject * @var string * @access public */ - var $title; + public $title; /** * Link item element @@ -278,7 +275,7 @@ class JFeedItem extends JObject * @var string * @access public */ - var $link; + public $link; /** * Description item element @@ -288,7 +285,7 @@ class JFeedItem extends JObject * @var string * @access public */ - var $description; + public $description; /** * Author item element @@ -298,7 +295,7 @@ class JFeedItem extends JObject * @var string * @access public */ - var $author; + public $author; /** * Author email element @@ -308,7 +305,7 @@ class JFeedItem extends JObject * @var string * @access public */ - var $authorEmail; + public $authorEmail; /** @@ -319,7 +316,7 @@ class JFeedItem extends JObject * @var string * @access public */ - var $category; + public $category; /** * Comments element @@ -329,7 +326,7 @@ class JFeedItem extends JObject * @var string * @access public */ - var $comments; + public $comments; /** * Enclosure element @@ -337,7 +334,7 @@ class JFeedItem extends JObject * @var object * @access public */ - var $enclosure = null; + public $enclosure = null; /** * Guid element @@ -347,7 +344,7 @@ class JFeedItem extends JObject * @var string * @access public */ - var $guid; + public $guid; /** * Published date @@ -369,7 +366,7 @@ class JFeedItem extends JObject * @var string * @access public */ - var $pubDate; + public $pubDate; /** * Source element @@ -379,7 +376,7 @@ class JFeedItem extends JObject * @var string * @access public */ - var $source; + public $source; /** @@ -388,7 +385,7 @@ class JFeedItem extends JObject * @access public * @param object $enclosure The JFeedItem to add to the feed. */ - function setEnclosure($enclosure) { + public function setEnclosure($enclosure) { $this->enclosure = $enclosure; } } @@ -396,7 +393,6 @@ function setEnclosure($enclosure) { /** * JFeedEnclosure is an internal class that stores feed enclosure information * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Document * @since 1.5 @@ -411,7 +407,7 @@ class JFeedEnclosure extends JObject * @var string * @access public */ - var $url = ""; + public $url = ""; /** * Lenght enclosure element @@ -421,7 +417,7 @@ class JFeedEnclosure extends JObject * @var string * @access public */ - var $length = ""; + public $length = ""; /** * Type enclosure element @@ -431,13 +427,12 @@ class JFeedEnclosure extends JObject * @var string * @access public */ - var $type = ""; + public $type = ""; } /** * JFeedImage is an internal class that stores feed image information * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Document * @since 1.5 @@ -452,7 +447,7 @@ class JFeedImage extends JObject * @var string * @access public */ - var $title = ""; + public $title = ""; /** * URL image attribute @@ -462,7 +457,7 @@ class JFeedImage extends JObject * @var string * @access public */ - var $url = ""; + public $url = ""; /** * Link image attribute @@ -472,7 +467,7 @@ class JFeedImage extends JObject * @var string * @access public */ - var $link = ""; + public $link = ""; /** * witdh image attribute @@ -482,7 +477,7 @@ class JFeedImage extends JObject * @var string * @access public */ - var $width; + public $width; /** * Title feed attribute @@ -492,7 +487,7 @@ class JFeedImage extends JObject * @var string * @access public */ - var $height; + public $height; /** * Title feed attribute @@ -502,5 +497,5 @@ class JFeedImage extends JObject * @var string * @access public */ - var $description; -} \ No newline at end of file + public $description; +} diff --git a/libraries/joomla/document/feed/index.html b/libraries/joomla/document/feed/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/document/feed/index.html +++ b/libraries/joomla/document/feed/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/document/feed/renderer/atom.php b/libraries/joomla/document/feed/renderer/atom.php index 3030a4e49e94d..efd8fb30b01df 100644 --- a/libraries/joomla/document/feed/renderer/atom.php +++ b/libraries/joomla/document/feed/renderer/atom.php @@ -1,108 +1,106 @@ - - * - * @package Joomla.Framework - * @subpackage Document - * @see http://www.atomenabled.org/developers/syndication/atom-format-spec.php - * @since 1.5 - */ - - class JDocumentRendererAtom extends JDocumentRenderer - { - /** - * Document mime type - * - * @var string - * @access private - */ - var $_mime = "application/atom+xml"; - - /** - * Render the feed - * - * @access public - * @return string - */ - function render() - { - $now =& JFactory::getDate(); - $data =& $this->_doc; - - $feed = "getBase()."\""; - if ($data->language!="") { - $feed.= " xml:lang=\"".$data->language."\""; - } - $feed.= ">\n"; - $feed.= " ".htmlspecialchars($data->title, ENT_COMPAT, 'UTF-8')."\n"; - $feed.= " ".htmlspecialchars($data->description, ENT_COMPAT, 'UTF-8')."\n"; - $feed.= " link."\"/>\n"; - $feed.= " ".$data->link."\n"; - $feed.= " ".htmlspecialchars($now->toISO8601(), ENT_COMPAT, 'UTF-8')."\n"; - if ($data->editor!="") { - $feed.= " \n"; - $feed.= " ".$data->editor."\n"; - if ($data->editorEmail!="") { - $feed.= " ".$data->editorEmail."\n"; - } - $feed.= " \n"; - } - $feed.= " ".$data->getGenerator()."\n"; - $feed.= "syndicationURL . "\" />\n"; - for ($i=0;$iitems);$i++) - { - $feed.= " \n"; - $feed.= " ".htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8')."\n"; - $feed.= ' \n"; - - if ($data->items[$i]->date=="") { - $data->items[$i]->date = $now->toUnix(); - } - $itemDate =& JFactory::getDate($data->items[$i]->date); - $feed.= " ".htmlspecialchars($itemDate->toISO8601(), ENT_COMPAT, 'UTF-8')."\n"; - $feed.= " ".htmlspecialchars($itemDate->toISO8601(),ENT_COMPAT, 'UTF-8')."\n"; - $feed.= " ".htmlspecialchars($data->items[$i]->link, ENT_COMPAT, 'UTF-8')."\n"; - - if ($data->items[$i]->author!="") - { - $feed.= " \n"; - $feed.= " ".htmlspecialchars($data->items[$i]->author, ENT_COMPAT, 'UTF-8')."\n"; - $feed.= " \n"; - } - if ($data->items[$i]->description!="") { - $feed.= " ".htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8')."\n"; - $feed.= " ".htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->items[$i]->enclosure != NULL) { - $feed.=" items[$i]->enclosure->url ."\" type=\"". $data->items[$i]->enclosure->type."\" length=\"". $data->items[$i]->enclosure->length . "\" />\n"; - } - $feed.= " \n"; - } - $feed.= "\n"; - return $feed; - } -} +_doc; + + $feed = "getBase()."\""; + if ($data->language!="") { + $feed.= " xml:lang=\"".$data->language."\""; + } + $feed.= ">\n"; + $feed.= " ".htmlspecialchars($data->title, ENT_COMPAT, 'UTF-8')."\n"; + $feed.= " ".htmlspecialchars($data->description, ENT_COMPAT, 'UTF-8')."\n"; + $feed.= " link."\"/>\n"; + $feed.= " ".$data->link."\n"; + $feed.= " ".htmlspecialchars($now->toISO8601(), ENT_COMPAT, 'UTF-8')."\n"; + if ($data->editor!="") { + $feed.= " \n"; + $feed.= " ".$data->editor."\n"; + if ($data->editorEmail!="") { + $feed.= " ".$data->editorEmail."\n"; + } + $feed.= " \n"; + } + $feed.= " ".$data->getGenerator()."\n"; + $feed.= "syndicationURL . "\" />\n"; + for ($i=0;$iitems);$i++) + { + $feed.= " \n"; + $feed.= " ".htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8')."\n"; + $feed.= ' \n"; + + if ($data->items[$i]->date=="") { + $data->items[$i]->date = $now->toUnix(); + } + $itemDate =& JFactory::getDate($data->items[$i]->date); + $feed.= " ".htmlspecialchars($itemDate->toISO8601(), ENT_COMPAT, 'UTF-8')."\n"; + $feed.= " ".htmlspecialchars($itemDate->toISO8601(),ENT_COMPAT, 'UTF-8')."\n"; + $feed.= " ".htmlspecialchars($data->items[$i]->link, ENT_COMPAT, 'UTF-8')."\n"; + + if ($data->items[$i]->author!="") + { + $feed.= " \n"; + $feed.= " ".htmlspecialchars($data->items[$i]->author, ENT_COMPAT, 'UTF-8')."\n"; + $feed.= " \n"; + } + if ($data->items[$i]->description!="") { + $feed.= " ".htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8')."\n"; + $feed.= " ".htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->items[$i]->enclosure != NULL) { + $feed.=" items[$i]->enclosure->url ."\" type=\"". $data->items[$i]->enclosure->type."\" length=\"". $data->items[$i]->enclosure->length . "\" />\n"; + } + $feed.= " \n"; + } + $feed.= "\n"; + return $feed; + } +} diff --git a/libraries/joomla/document/feed/renderer/index.html b/libraries/joomla/document/feed/renderer/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/document/feed/renderer/index.html +++ b/libraries/joomla/document/feed/renderer/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/document/feed/renderer/rss.php b/libraries/joomla/document/feed/renderer/rss.php index 516d182caad17..80e80596f45c3 100644 --- a/libraries/joomla/document/feed/renderer/rss.php +++ b/libraries/joomla/document/feed/renderer/rss.php @@ -1,174 +1,172 @@ - - * - * @package Joomla.Framework - * @subpackage Document - * @see http://www.rssboard.org/rss-specification - * @since 1.5 - */ - -class JDocumentRendererRSS extends JDocumentRenderer -{ - /** - * Renderer mime type - * - * @var string - * @access private - */ - var $_mime = "application/rss+xml"; - - /** - * Render the feed - * - * @access public - * @return string - */ - function render() - { - $now =& JFactory::getDate(); - $data =& $this->_doc; - - $uri =& JFactory::getURI(); - $url = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); - - $feed = "\n"; - $feed.= " \n"; - $feed.= " ".$data->title."\n"; - $feed.= " ".$data->description."\n"; - $feed.= " ".$url.$data->link."\n"; - $feed.= " ".htmlspecialchars($now->toRFC822(), ENT_COMPAT, 'UTF-8')."\n"; - $feed.= " ".$data->getGenerator()."\n"; - - if ($data->image!=null) - { - $feed.= " \n"; - $feed.= " ".$data->image->url."\n"; - $feed.= " ".htmlspecialchars($data->image->title, ENT_COMPAT, 'UTF-8')."\n"; - $feed.= " ".$data->image->link."\n"; - if ($data->image->width != "") { - $feed.= " ".$data->image->width."\n"; - } - if ($data->image->height!="") { - $feed.= " ".$data->image->height."\n"; - } - if ($data->image->description!="") { - $feed.= " image->description."]]>\n"; - } - $feed.= " \n"; - } - if ($data->language!="") { - $feed.= " ".$data->language."\n"; - } - if ($data->copyright!="") { - $feed.= " ".htmlspecialchars($data->copyright,ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->editor!="") { - $feed.= " ".htmlspecialchars($data->editor, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->webmaster!="") { - $feed.= " ".htmlspecialchars($data->webmaster, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->pubDate!="") { - $pubDate =& JFactory::getDate($data->pubDate); - $feed.= " ".htmlspecialchars($pubDate->toRFC822(),ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->category!="") { - $feed.= " ".htmlspecialchars($data->category, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->docs!="") { - $feed.= " ".htmlspecialchars($data->docs, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->ttl!="") { - $feed.= " ".htmlspecialchars($data->ttl, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->rating!="") { - $feed.= " ".htmlspecialchars($data->rating, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->skipHours!="") { - $feed.= " ".htmlspecialchars($data->skipHours, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->skipDays!="") { - $feed.= " ".htmlspecialchars($data->skipDays, ENT_COMPAT, 'UTF-8')."\n"; - } - - for ($i=0; $iitems); $i++) - { - $feed.= " \n"; - $feed.= " ".htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8')."\n"; - $feed.= " ".$url.$data->items[$i]->link."\n"; - $feed.= " _relToAbs($data->items[$i]->description)."]]>\n"; - - if ($data->items[$i]->author!="") { - $feed.= " ".htmlspecialchars($data->items[$i]->author, ENT_COMPAT, 'UTF-8')."\n"; - } - /* - // on hold - if ($data->items[$i]->source!="") { - $data.= " ".htmlspecialchars($data->items[$i]->source, ENT_COMPAT, 'UTF-8')."\n"; - } - */ - if ($data->items[$i]->category!="") { - $feed.= " ".htmlspecialchars($data->items[$i]->category, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->items[$i]->comments!="") { - $feed.= " ".htmlspecialchars($data->items[$i]->comments, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->items[$i]->date!="") { - $itemDate =& JFactory::getDate($data->items[$i]->date); - $feed.= " ".htmlspecialchars($itemDate->toRFC822(), ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->items[$i]->guid!="") { - $feed.= " ".htmlspecialchars($data->items[$i]->guid, ENT_COMPAT, 'UTF-8')."\n"; - } - if ($data->items[$i]->enclosure != NULL) - { - $feed.= " items[$i]->enclosure->url; - $feed.= "\" length=\""; - $feed.= $data->items[$i]->enclosure->length; - $feed.= "\" type=\""; - $feed.= $data->items[$i]->enclosure->type; - $feed.= "\"/>\n"; - } - - $feed.= " \n"; - } - $feed.= " \n"; - $feed.= "\n"; - return $feed; - } - - /** - * Convert links in a text from relative to absolute - * - * @access public - * @return string - */ - function _relToAbs($text) - { - $base = JURI::base(); - $text = preg_replace("/(href|src)=\"(?!http|ftp|https)([^\"]*)\"/", "$1=\"$base\$2\"", $text); - - return $text; - } -} +_doc; + + $uri =& JFactory::getURI(); + $url = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port')); + + $feed = "\n"; + $feed.= " \n"; + $feed.= " ".$data->title."\n"; + $feed.= " ".$data->description."\n"; + $feed.= " ".$url.$data->link."\n"; + $feed.= " ".htmlspecialchars($now->toRFC822(), ENT_COMPAT, 'UTF-8')."\n"; + $feed.= " ".$data->getGenerator()."\n"; + + if ($data->image!=null) + { + $feed.= " \n"; + $feed.= " ".$data->image->url."\n"; + $feed.= " ".htmlspecialchars($data->image->title, ENT_COMPAT, 'UTF-8')."\n"; + $feed.= " ".$data->image->link."\n"; + if ($data->image->width != "") { + $feed.= " ".$data->image->width."\n"; + } + if ($data->image->height!="") { + $feed.= " ".$data->image->height."\n"; + } + if ($data->image->description!="") { + $feed.= " image->description."]]>\n"; + } + $feed.= " \n"; + } + if ($data->language!="") { + $feed.= " ".$data->language."\n"; + } + if ($data->copyright!="") { + $feed.= " ".htmlspecialchars($data->copyright,ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->editor!="") { + $feed.= " ".htmlspecialchars($data->editor, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->webmaster!="") { + $feed.= " ".htmlspecialchars($data->webmaster, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->pubDate!="") { + $pubDate =& JFactory::getDate($data->pubDate); + $feed.= " ".htmlspecialchars($pubDate->toRFC822(),ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->category!="") { + $feed.= " ".htmlspecialchars($data->category, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->docs!="") { + $feed.= " ".htmlspecialchars($data->docs, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->ttl!="") { + $feed.= " ".htmlspecialchars($data->ttl, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->rating!="") { + $feed.= " ".htmlspecialchars($data->rating, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->skipHours!="") { + $feed.= " ".htmlspecialchars($data->skipHours, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->skipDays!="") { + $feed.= " ".htmlspecialchars($data->skipDays, ENT_COMPAT, 'UTF-8')."\n"; + } + + for ($i=0; $iitems); $i++) + { + if ((strpos($data->items[$i]->link, 'http://') === false) and (strpos($data->items[$i]->link, 'https://') === false)) { + $data->items[$i]->link = $url.$data->items[$i]->link; + } + $feed.= " \n"; + $feed.= " ".htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8')."\n"; + $feed.= " ".$data->items[$i]->link."\n"; + $feed.= " _relToAbs($data->items[$i]->description)."]]>\n"; + + if ($data->items[$i]->author!="") { + $feed.= " ".htmlspecialchars($data->items[$i]->author, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->items[$i]->source!="") { + $feed.= " ".htmlspecialchars($data->items[$i]->source, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->items[$i]->category!="") { + $feed.= " ".htmlspecialchars($data->items[$i]->category, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->items[$i]->comments!="") { + $feed.= " ".htmlspecialchars($data->items[$i]->comments, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->items[$i]->date!="") { + $itemDate =& JFactory::getDate($data->items[$i]->date); + $feed.= " ".htmlspecialchars($itemDate->toRFC822(), ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->items[$i]->guid!="") { + $feed.= " ".htmlspecialchars($data->items[$i]->guid, ENT_COMPAT, 'UTF-8')."\n"; + } + if ($data->items[$i]->enclosure != NULL) + { + $feed.= " items[$i]->enclosure->url; + $feed.= "\" length=\""; + $feed.= $data->items[$i]->enclosure->length; + $feed.= "\" type=\""; + $feed.= $data->items[$i]->enclosure->type; + $feed.= "\"/>\n"; + } + + $feed.= " \n"; + } + $feed.= " \n"; + $feed.= "\n"; + return $feed; + } + + /** + * Convert links in a text from relative to absolute + * + * @access public + * @return string + */ + function _relToAbs($text) + { + $base = JURI::base(); + $text = preg_replace("/(href|src)=\"(?!http|ftp|https)([^\"]*)\"/", "$1=\"$base\$2\"", $text); + + return $text; + } +} diff --git a/libraries/joomla/document/html/html.php b/libraries/joomla/document/html/html.php index 1349a63a38966..ec2c6766c093d 100644 --- a/libraries/joomla/document/html/html.php +++ b/libraries/joomla/document/html/html.php @@ -20,7 +20,6 @@ /** * DocumentHTML class, provides an easy interface to parse and display an html document * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Document * @since 1.5 @@ -34,7 +33,7 @@ class JDocumentHTML extends JDocument * @var array * @access private */ - var $_links = array(); + public $_links = array(); /** * Array of custom tags @@ -42,16 +41,20 @@ class JDocumentHTML extends JDocument * @var string * @access private */ - var $_custom = array(); + public $_custom = array(); + public $template = null; + public $baseurl = null; + public $params = null; + public $_file = null; /** * Class constructor * - * @access protected + * @access public * @param array $options Associative array of options */ - function __construct($options = array()) + public function __construct($options = array()) { parent::__construct($options); @@ -72,7 +75,7 @@ function __construct($options = array()) * @access public * @return array The document head data in array form */ - function getHeadData() + public function getHeadData() { $data = array(); $data['title'] = $this->title; @@ -94,7 +97,7 @@ function getHeadData() * @access public * @param array $data The document head data in array form */ - function setHeadData($data) + public function setHeadData($data) { $this->title = (isset($data['title'])) ? $data['title'] : $this->title; $this->description = (isset($data['description'])) ? $data['description'] : $this->description; @@ -122,7 +125,7 @@ function setHeadData($data) * @param array $attributes Associative array of remaining attributes. * @return void */ - function addHeadLink($href, $relation, $relType = 'rel', $attribs = array()) + public function addHeadLink($href, $relation, $relType = 'rel', $attribs = array()) { $attribs = JArrayHelper::toString($attribs); $generatedTag = '_links[] = '_custom[] = trim( $html ); } @@ -169,7 +172,7 @@ function addCustomTag( $html ) * @param array $attribs Associative array of remaining attributes. * @return The output of the renderer */ - function getBuffer($type = null, $name = null, $attribs = array()) + public function getBuffer($type = null, $name = null, $attribs = array()) { $result = null; @@ -202,7 +205,7 @@ function getBuffer($type = null, $name = null, $attribs = array()) * @param string $name oke The name of the element to render * @param string $content The content to be set in the buffer */ - function setBuffer($contents, $type, $name = null) + public function setBuffer($contents, $type, $name = null) { $this->_buffer[$type][$name] = $contents; } @@ -215,7 +218,7 @@ function setBuffer($contents, $type, $name = null) * @param array $params Associative array of attributes * @return The rendered data */ - function render( $caching = false, $params = array()) + public function render( $caching = false, $params = array()) { // check $directory = isset($params['directory']) ? $params['directory'] : 'templates'; @@ -261,7 +264,7 @@ function render( $caching = false, $params = array()) * @param string $condition The condition to use * @return integer Number of modules found */ - function countModules($condition) + public function countModules($condition) { $result = ''; @@ -278,6 +281,35 @@ function countModules($condition) return eval($str); } + /** + * Count the number of child menu items + * + * @access public + * @return integer Number of child menu items + */ + public function countMenuChildren() { + static $children; + if(!isset($children)) { + $dbo =& JFactory::getDBO(); + $menu =& JSite::getMenu(); + $where = Array(); + $active = $menu->getActive(); + if($active) { + $where[] = 'parent = ' . $active->id; + $where[] = 'published = 1'; + $dbo->setQuery('SELECT COUNT(*) FROM #__menu WHERE '. implode(' AND ', $where)); + try { + $children = $dbo->loadResult(); + } catch(JException $e) { + $children = 0; + } + } else { + $children = 0; + } + } + return $children; + } + /** * Load a template file * @@ -285,21 +317,13 @@ function countModules($condition) * @param string $filename The actual filename * @return string The contents of the template */ - function _loadTemplate($directory, $filename) + public function _loadTemplate($directory, $filename) { - global $mainframe, $option; - - if ($mainframe->getCfg('legacy')) - { - global $task, $_VERSION, $my, $cur_template, $database, $acl, $Itemid; + $component = JApplicationHelper::getComponentName(); - //For backwards compatibility extract the config vars as globals - $registry =& JFactory::getConfig(); - foreach (get_object_vars($registry->toObject()) as $k => $v) { - $name = 'mosConfig_'.$k; - $$name = $v; - } - } + // need for backwards compatibility + // @todo if legacy + $mainframe = JFactory::getApplication(); $contents = ''; @@ -309,6 +333,9 @@ function _loadTemplate($directory, $filename) //store the file path $this->_file = $directory.DS.$filename; + // @todo if ( $legacy ) + $option = $component; + //get the file content ob_start(); require_once $directory.DS.$filename; @@ -341,7 +368,7 @@ function _loadTemplate($directory, $filename) * @param string $data The data too parse * @return The parsed contents of the template */ - function _parseTemplate($data) + public function _parseTemplate($data) { $replace = array(); $matches = array(); @@ -367,4 +394,4 @@ function _parseTemplate($data) return $data; } -} \ No newline at end of file +} diff --git a/libraries/joomla/document/html/index.html b/libraries/joomla/document/html/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/document/html/index.html +++ b/libraries/joomla/document/html/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/document/html/renderer/component.php b/libraries/joomla/document/html/renderer/component.php index b9dcbf80ec6e0..7fbad95ff001f 100644 --- a/libraries/joomla/document/html/renderer/component.php +++ b/libraries/joomla/document/html/renderer/component.php @@ -1,40 +1,39 @@ - - * @package Joomla.Framework - * @subpackage Document - * @since 1.5 - */ -class JDocumentRendererComponent extends JDocumentRenderer -{ - /** - * Renders a component script and returns the results as a string - * - * @access public - * @param string $component The name of the component to render - * @param array $params Associative array of values - * @return string The output of the script - */ - function render( $component = null, $params = array(), $content = null ) - { - return $content; - } + +/** + * Component renderer + * + * @package Joomla.Framework + * @subpackage Document + * @since 1.5 + */ +class JDocumentRendererComponent extends JDocumentRenderer +{ + /** + * Renders a component script and returns the results as a string + * + * @access public + * @param string $component The name of the component to render + * @param array $params Associative array of values + * @return string The output of the script + */ + public function render($component, $params = array(), $content = null) + { + return $content; + } } \ No newline at end of file diff --git a/libraries/joomla/document/html/renderer/head.php b/libraries/joomla/document/html/renderer/head.php index 9cd15a571e55f..07dffd1b56557 100644 --- a/libraries/joomla/document/html/renderer/head.php +++ b/libraries/joomla/document/html/renderer/head.php @@ -1,159 +1,158 @@ - - * @package Joomla.Framework - * @subpackage Document - * @since 1.5 - */ -class JDocumentRendererHead extends JDocumentRenderer -{ - /** - * Renders the document head and returns the results as a string - * - * @access public - * @param string $name (unused) - * @param array $params Associative array of values - * @return string The output of the script - */ - function render( $head = null, $params = array(), $content = null ) - { - ob_start(); - - echo $this->fetchHead($this->_doc); - - $contents = ob_get_contents(); - ob_end_clean(); - - return $contents; - } - - /** - * Generates the head html and return the results as a string - * - * @access public - * @return string - */ - function fetchHead(&$document) - { - // get line endings - $lnEnd = $document->_getLineEnd(); - $tab = $document->_getTab(); - - $tagEnd = ' />'; - - $strHtml = ''; - - // Generate base tag (need to happen first) - $base = $document->getBase(); - if(!empty($base)) { - $strHtml .= $tab.''.$lnEnd; - } - - // Generate META tags (needs to happen as early as possible in the head) - foreach ($document->_metaTags as $type => $tag) - { - foreach ($tag as $name => $content) - { - if ($type == 'http-equiv') { - $strHtml .= $tab.''.$lnEnd; - $strHtml .= $tab.''.$lnEnd; - - $strHtml .= $tab.''.htmlspecialchars($document->getTitle()).''.$lnEnd; - - // Generate link declarations - foreach ($document->_links as $link) { - $strHtml .= $tab.$link.$tagEnd.$lnEnd; - } - - // Generate stylesheet links - foreach ($document->_styleSheets as $strSrc => $strAttr ) - { - $strHtml .= $tab . '_style as $type => $content) - { - $strHtml .= $tab.''.$lnEnd; - } - - // Generate script file links - foreach ($document->_scripts as $strSrc => $strType) { - $strHtml .= $tab.''.$lnEnd; - } - - // Generate script declarations - foreach ($document->_script as $type => $content) - { - $strHtml .= $tab.''.$lnEnd; - } - - foreach($document->_custom as $custom) { - $strHtml .= $tab.$custom.$lnEnd; - } - - return $strHtml; - } -} \ No newline at end of file +fetchHead($this->_doc); + + $contents = ob_get_contents(); + ob_end_clean(); + + return $contents; + } + + /** + * Generates the head html and return the results as a string + * + * @access public + * @return string + */ + public function fetchHead(&$document) + { + // get line endings + $lnEnd = $document->_getLineEnd(); + $tab = $document->_getTab(); + + $tagEnd = ' />'; + + $strHtml = ''; + + // Generate base tag (need to happen first) + $base = $document->getBase(); + if(!empty($base)) { + $strHtml .= $tab.''.$lnEnd; + } + + // Generate META tags (needs to happen as early as possible in the head) + foreach ($document->_metaTags as $type => $tag) + { + foreach ($tag as $name => $content) + { + if ($type == 'http-equiv') { + $strHtml .= $tab.''.$lnEnd; + $strHtml .= $tab.''.$lnEnd; + + $strHtml .= $tab.''.htmlspecialchars($document->getTitle()).''.$lnEnd; + + // Generate link declarations + foreach ($document->_links as $link) { + $strHtml .= $tab.$link.$tagEnd.$lnEnd; + } + + // Generate stylesheet links + foreach ($document->_styleSheets as $strSrc => $strAttr) + { + $strHtml .= $tab . '_style as $type => $content) + { + $strHtml .= $tab.''.$lnEnd; + } + + // Generate script file links + foreach ($document->_scripts as $strSrc => $strType) { + $strHtml .= $tab.''.$lnEnd; + } + + // Generate script declarations + foreach ($document->_script as $type => $content) + { + $strHtml .= $tab.''.$lnEnd; + } + + foreach ($document->_custom as $custom) { + $strHtml .= $tab.$custom.$lnEnd; + } + + return $strHtml; + } +} diff --git a/libraries/joomla/document/html/renderer/index.html b/libraries/joomla/document/html/renderer/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/document/html/renderer/index.html +++ b/libraries/joomla/document/html/renderer/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/system/legacy/profiler.php b/libraries/joomla/document/html/renderer/installation.php similarity index 51% rename from plugins/system/legacy/profiler.php rename to libraries/joomla/document/html/renderer/installation.php index 55294b7624d52..b8e032e586fd1 100644 --- a/plugins/system/legacy/profiler.php +++ b/libraries/joomla/document/html/renderer/installation.php @@ -1,38 +1,39 @@ - - * @package Joomla.Framework - * @subpackage Document - * @since 1.5 - */ -class JDocumentRendererMessage extends JDocumentRenderer -{ - /** - * Renders the error stack and returns the results as a string - * - * @access public - * @param string $name (unused) - * @param array $params Associative array of values - * @return string The output of the script - */ - function render($name = null, $params = array (), $content = null) - { - global $mainframe; - - // Initialize variables - $contents = null; - $lists = null; - - // Get the message queue - $messages = $mainframe->getMessageQueue(); - - // Build the sorted message list - if (is_array($messages) && count($messages)) { - foreach ($messages as $msg) - { - if (isset($msg['type']) && isset($msg['message'])) { - $lists[$msg['type']][] = $msg['message']; - } - } - } - - // If messages exist render them - if (is_array($lists)) - { - // Build the return string - $contents .= "\n
      "; - foreach ($lists as $type => $msgs) - { - if (count($msgs)) { - $contents .= "\n
      ".JText::_( $type )."
      "; - $contents .= "\n
      "; - $contents .= "\n\t
        "; - foreach ($msgs as $msg) - { - $contents .="\n\t\t
      • ".$msg."
      • "; - } - $contents .= "\n\t
      "; - $contents .= "\n
      "; - } - } - $contents .= "\n
      "; - } - return $contents; - } -} \ No newline at end of file + +/** + * JDocument system message renderer + * + * @package Joomla.Framework + * @subpackage Document + * @since 1.5 + */ +class JDocumentRendererMessage extends JDocumentRenderer +{ + /** + * Renders the error stack and returns the results as a string + * + * @access public + * @param string $name (unused) + * @param array $params Associative array of values + * @return string The output of the script + */ + public function render($name, $params = array (), $content = null) + { + $appl = JFactory::getApplication(); + + // Initialize variables + $contents = null; + $lists = null; + + // Get the message queue + $messages = $appl->getMessageQueue(); + + // Build the sorted message list + if (is_array($messages) && count($messages)) { + foreach ($messages as $msg) + { + if (isset($msg['type']) && isset($msg['message'])) { + $lists[$msg['type']][] = $msg['message']; + } + } + } + + // If messages exist render them + if (is_array($lists)) + { + // Build the return string + $contents .= "\n
      "; + foreach ($lists as $type => $msgs) + { + if (count($msgs)) { + $contents .= "\n
      ".JText::_( $type )."
      "; + $contents .= "\n
      "; + $contents .= "\n\t
        "; + foreach ($msgs as $msg) + { + $contents .="\n\t\t
      • ".$msg."
      • "; + } + $contents .= "\n\t
      "; + $contents .= "\n
      "; + } + } + $contents .= "\n
      "; + } + return $contents; + } +} diff --git a/libraries/joomla/document/html/renderer/module.php b/libraries/joomla/document/html/renderer/module.php index 42e23f34b843f..27add5b747793 100644 --- a/libraries/joomla/document/html/renderer/module.php +++ b/libraries/joomla/document/html/renderer/module.php @@ -1,90 +1,89 @@ - - * @package Joomla.Framework - * @subpackage Document - * @since 1.5 - */ -class JDocumentRendererModule extends JDocumentRenderer -{ - /** - * Renders a module script and returns the results as a string - * - * @access public - * @param string $name The name of the module to render - * @param array $params Associative array of values - * @return string The output of the script - */ - function render( $module, $params = array(), $content = null ) - { - if (!is_object($module)) - { + +/** + * JDocument Module renderer + * + * @package Joomla.Framework + * @subpackage Document + * @since 1.5 + */ +class JDocumentRendererModule extends JDocumentRenderer +{ + /** + * Renders a module script and returns the results as a string + * + * @access public + * @param string $name The name of the module to render + * @param array $params Associative array of values + * @return string The output of the script + */ + public function render($module, $params = array(), $content = null) + { + if (!is_object($module)) + { $title = isset($params['title']) ? $params['title'] : null; - - $module =& JModuleHelper::getModule($module, $title); - - if (!is_object($module)) - { - if (is_null($content)) { - return ''; - } else { - /** - * If module isn't found in the database but data has been pushed in the buffer - * we want to render it - */ - $tmp = $module; - $module = new stdClass(); - $module->params = null; - $module->module = $tmp; - $module->id = 0; - $module->user = 0; - } - } - } - - // get the user and configuration object - $user =& JFactory::getUser(); - $conf =& JFactory::getConfig(); - - // set the module content - if (!is_null($content)) { - $module->content = $content; - } - - //get module parameters - $mod_params = new JParameter( $module->params ); - - $contents = ''; - if ($mod_params->get('cache', 0) && $conf->getValue( 'config.caching' )) - { - $cache =& JFactory::getCache( $module->module ); - - $cache->setLifeTime( $mod_params->get( 'cache_time', $conf->getValue( 'config.cachetime' ) * 60 ) ); - $cache->setCacheValidation(true); - - $contents = $cache->get( array('JModuleHelper', 'renderModule'), array( $module, $params ), $module->id. $user->get('aid', 0) ); - } else { - $contents = JModuleHelper::renderModule($module, $params); - } - - return $contents; - } + + $module =& JModuleHelper::getModule($module, $title); + + if (!is_object($module)) + { + if (is_null($content)) { + return ''; + } else { + /** + * If module isn't found in the database but data has been pushed in the buffer + * we want to render it + */ + $tmp = $module; + $module = new stdClass(); + $module->params = null; + $module->module = $tmp; + $module->id = 0; + $module->user = 0; + } + } + } + + // get the user and configuration object + $user =& JFactory::getUser(); + $conf =& JFactory::getConfig(); + + // set the module content + if (!is_null($content)) { + $module->content = $content; + } + + //get module parameters + $mod_params = new JParameter($module->params); + + $contents = ''; + if ($mod_params->get('cache', 0) && $conf->getValue('config.caching')) + { + $cache =& JFactory::getCache($module->module); + + $cache->setLifeTime($mod_params->get('cache_time', $conf->getValue('config.cachetime') * 60)); + $cache->setCacheValidation(true); + + $contents = $cache->get(array('JModuleHelper', 'renderModule'), array($module, $params), $module->id. $user->get('aid', 0)); + } else { + $contents = JModuleHelper::renderModule($module, $params); + } + + return $contents; + } } \ No newline at end of file diff --git a/libraries/joomla/document/html/renderer/modules.php b/libraries/joomla/document/html/renderer/modules.php index 41499ba3defa9..e33031c9b9d57 100644 --- a/libraries/joomla/document/html/renderer/modules.php +++ b/libraries/joomla/document/html/renderer/modules.php @@ -1,46 +1,45 @@ - - * @package Joomla.Framework - * @subpackage Document - * @since 1.5 - */ -class JDocumentRendererModules extends JDocumentRenderer -{ - /** - * Renders multiple modules script and returns the results as a string - * - * @access public - * @param string $name The position of the modules to render - * @param array $params Associative array of values - * @return string The output of the script - */ - function render( $position, $params = array(), $content = null ) - { - $renderer =& $this->_doc->loadRenderer('module'); - - $contents = ''; - foreach (JModuleHelper::getModules($position) as $mod) { - $contents .= $renderer->render($mod, $params, $content); - } - return $contents; - } -} \ No newline at end of file +_doc->loadRenderer('module'); + + $contents = ''; + foreach (JModuleHelper::getModules($position) as $mod) { + $contents .= $renderer->render($mod, $params, $content); + } + return $contents; + } +} diff --git a/libraries/joomla/document/index.html b/libraries/joomla/document/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/document/index.html +++ b/libraries/joomla/document/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/document/pdf/index.html b/libraries/joomla/document/pdf/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/document/pdf/index.html +++ b/libraries/joomla/document/pdf/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/document/pdf/pdf.php b/libraries/joomla/document/pdf/pdf.php index e48fdd8378203..087d90301ee1a 100644 --- a/libraries/joomla/document/pdf/pdf.php +++ b/libraries/joomla/document/pdf/pdf.php @@ -1,249 +1,247 @@ - - * @author Louis Landry - * @package Joomla.Framework - * @subpackage Document - * @since 1.5 - */ -class JDocumentPDF extends JDocument -{ - var $_engine = null; - - var $_name = 'joomla'; - - var $_header = null; - - var $_margin_header = 5; - var $_margin_footer = 10; - var $_margin_top = 27; - var $_margin_bottom = 25; - var $_margin_left = 15; - var $_margin_right = 15; - - // Scale ratio for images [number of points in user unit] - var $_image_scale = 4; - - /** - * Class constructore - * - * @access protected - * @param array $options Associative array of options - */ - function __construct($options = array()) - { - parent::__construct($options); - - if (isset($options['margin-header'])) { - $this->_margin_header = $options['margin-header']; - } - - if (isset($options['margin-footer'])) { - $this->_margin_footer = $options['margin-footer']; - } - - if (isset($options['margin-top'])) { - $this->_margin_top = $options['margin-top']; - } - - if (isset($options['margin-bottom'])) { - $this->_margin_bottom = $options['margin-bottom']; - } - - if (isset($options['margin-left'])) { - $this->_margin_left = $options['margin-left']; - } - - if (isset($options['margin-right'])) { - $this->_margin_right = $options['margin-right']; - } - - if (isset($options['image-scale'])) { - $this->_image_scale = $options['image-scale']; - } - - //set mime type - $this->_mime = 'application/pdf'; - - //set document type - $this->_type = 'pdf'; - /* - * Setup external configuration options - */ - define('K_TCPDF_EXTERNAL_CONFIG', true); - - /* - * Path options - */ - - // Installation path - define("K_PATH_MAIN", JPATH_LIBRARIES.DS."tcpdf"); - - // URL path - define("K_PATH_URL", JPATH_BASE); - - // Fonts path - define("K_PATH_FONTS", JPATH_SITE.DS.'language'.DS."pdf_fonts".DS); - - // Cache directory path - define("K_PATH_CACHE", K_PATH_MAIN.DS."cache"); - - // Cache URL path - define("K_PATH_URL_CACHE", K_PATH_URL.DS."cache"); - - // Images path - define("K_PATH_IMAGES", K_PATH_MAIN.DS."images"); - - // Blank image path - define("K_BLANK_IMAGE", K_PATH_IMAGES.DS."_blank.png"); - - /* - * Format options - */ - - // Cell height ratio - define("K_CELL_HEIGHT_RATIO", 1.25); - - // Magnification scale for titles - define("K_TITLE_MAGNIFICATION", 1.3); - - // Reduction scale for small font - define("K_SMALL_RATIO", 2/3); - - // Magnication scale for head - define("HEAD_MAGNIFICATION", 1.1); - - /* - * Create the pdf document - */ - - jimport('tcpdf.tcpdf'); - - // Default settings are a portrait layout with an A4 configuration using millimeters as units - $this->_engine = new TCPDF(); - - //set margins - $this->_engine->SetMargins($this->_margin_left, $this->_margin_top, $this->_margin_right); - //set auto page breaks - $this->_engine->SetAutoPageBreak(TRUE, $this->_margin_bottom); - $this->_engine->SetHeaderMargin($this->_margin_header); - $this->_engine->SetFooterMargin($this->_margin_footer); - $this->_engine->setImageScale($this->_image_scale); - } - - /** - * Sets the document name - * - * @param string $name Document name - * @access public - * @return void - */ - function setName($name = 'joomla') { - $this->_name = $name; - } - - /** - * Returns the document name - * - * @access public - * @return string - */ - function getName() { - return $this->_name; - } - - /** - * Sets the document header string - * - * @param string $text Document header string - * @access public - * @return void - */ - function setHeader($text) { - $this->_header = $text; - } - - /** - * Returns the document header string - * - * @access public - * @return string - */ - function getHeader() { - return $this->_header; - } - - /** - * Render the document. - * - * @access public - * @param boolean $cache If true, cache the output - * @param array $params Associative array of attributes - * @return The rendered data - */ - function render( $cache = false, $params = array()) - { - $pdf = &$this->_engine; - - // Set PDF Metadata - $pdf->SetCreator($this->getGenerator()); - $pdf->SetTitle($this->getTitle()); - $pdf->SetSubject($this->getDescription()); - $pdf->SetKeywords($this->getMetaData('keywords')); - - // Set PDF Header data - $pdf->setHeaderData('',0,$this->getTitle(), $this->getHeader()); - - // Set PDF Header and Footer fonts - $lang = &JFactory::getLanguage(); - $font = $lang->getPdfFontName(); - $font = ($font) ? $font : 'freesans'; - - $pdf->setRTL($lang->isRTL()); - - $pdf->setHeaderFont(array($font, '', 10)); - $pdf->setFooterFont(array($font, '', 8)); - - // Initialize PDF Document - $pdf->AliasNbPages(); - $pdf->AddPage(); - - // Build the PDF Document string from the document buffer - $this->fixLinks(); - $pdf->WriteHTML($this->getBuffer(), true); - $data = $pdf->Output('', 'S'); - - // Set document type headers - parent::render(); - - //JResponse::setHeader('Content-Length', strlen($data), true); - - JResponse::setHeader('Content-disposition', 'inline; filename="'.$this->getName().'.pdf"', true); - - //Close and output PDF document - return $data; - } - - function fixLinks() - { - - } -} \ No newline at end of file +_margin_header = $options['margin-header']; + } + + if (isset($options['margin-footer'])) { + $this->_margin_footer = $options['margin-footer']; + } + + if (isset($options['margin-top'])) { + $this->_margin_top = $options['margin-top']; + } + + if (isset($options['margin-bottom'])) { + $this->_margin_bottom = $options['margin-bottom']; + } + + if (isset($options['margin-left'])) { + $this->_margin_left = $options['margin-left']; + } + + if (isset($options['margin-right'])) { + $this->_margin_right = $options['margin-right']; + } + + if (isset($options['image-scale'])) { + $this->_image_scale = $options['image-scale']; + } + + //set mime type + $this->_mime = 'application/pdf'; + + //set document type + $this->_type = 'pdf'; + /* + * Setup external configuration options + */ + define('K_TCPDF_EXTERNAL_CONFIG', true); + + /* + * Path options + */ + + // Installation path + define("K_PATH_MAIN", JPATH_LIBRARIES.DS."tcpdf"); + + // URL path + define("K_PATH_URL", JPATH_BASE); + + // Fonts path + define("K_PATH_FONTS", JPATH_SITE.DS.'language'.DS."pdf_fonts".DS); + + // Cache directory path + define("K_PATH_CACHE", K_PATH_MAIN.DS."cache"); + + // Cache URL path + define("K_PATH_URL_CACHE", K_PATH_URL.DS."cache"); + + // Images path + define("K_PATH_IMAGES", K_PATH_MAIN.DS."images"); + + // Blank image path + define("K_BLANK_IMAGE", K_PATH_IMAGES.DS."_blank.png"); + + /* + * Format options + */ + + // Cell height ratio + define("K_CELL_HEIGHT_RATIO", 1.25); + + // Magnification scale for titles + define("K_TITLE_MAGNIFICATION", 1.3); + + // Reduction scale for small font + define("K_SMALL_RATIO", 2/3); + + // Magnication scale for head + define("HEAD_MAGNIFICATION", 1.1); + + /* + * Create the pdf document + */ + + jimport('tcpdf.tcpdf'); + + // Default settings are a portrait layout with an A4 configuration using millimeters as units + $this->_engine = new TCPDF(); + + //set margins + $this->_engine->SetMargins($this->_margin_left, $this->_margin_top, $this->_margin_right); + //set auto page breaks + $this->_engine->SetAutoPageBreak(TRUE, $this->_margin_bottom); + $this->_engine->SetHeaderMargin($this->_margin_header); + $this->_engine->SetFooterMargin($this->_margin_footer); + $this->_engine->setImageScale($this->_image_scale); + } + + /** + * Sets the document name + * + * @param string $name Document name + * @access public + * @return void + */ + public function setName($name = 'joomla') { + $this->_name = $name; + } + + /** + * Returns the document name + * + * @access public + * @return string + */ + public function getName() { + return $this->_name; + } + + /** + * Sets the document header string + * + * @param string $text Document header string + * @access public + * @return void + */ + public function setHeader($text) { + $this->_header = $text; + } + + /** + * Returns the document header string + * + * @access public + * @return string + */ + public function getHeader() { + return $this->_header; + } + + /** + * Render the document. + * + * @access public + * @param boolean $cache If true, cache the output + * @param array $params Associative array of attributes + * @return The rendered data + */ + public function render( $cache = false, $params = array()) + { + $pdf = &$this->_engine; + + // Set PDF Metadata + $pdf->SetCreator($this->getGenerator()); + $pdf->SetTitle($this->getTitle()); + $pdf->SetSubject($this->getDescription()); + $pdf->SetKeywords($this->getMetaData('keywords')); + + // Set PDF Header data + $pdf->setHeaderData('',0,$this->getTitle(), $this->getHeader()); + + // Set PDF Header and Footer fonts + $lang = &JFactory::getLanguage(); + $font = $lang->getPdfFontName(); + $font = ($font) ? $font : 'freesans'; + + $pdf->setRTL($lang->isRTL()); + + $pdf->setHeaderFont(array($font, '', 10)); + $pdf->setFooterFont(array($font, '', 8)); + + // Initialize PDF Document + $pdf->AliasNbPages(); + $pdf->AddPage(); + + // Build the PDF Document string from the document buffer + $this->fixLinks(); + $pdf->WriteHTML($this->getBuffer(), true); + $data = $pdf->Output('', 'S'); + + // Set document type headers + parent::render(); + + //JResponse::setHeader('Content-Length', strlen($data), true); + + JResponse::setHeader('Content-disposition', 'inline; filename="'.$this->getName().'.pdf"', true); + + //Close and output PDF document + return $data; + } + + public function fixLinks() + { + + } +} diff --git a/libraries/joomla/document/raw/index.html b/libraries/joomla/document/raw/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/document/raw/index.html +++ b/libraries/joomla/document/raw/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/document/raw/raw.php b/libraries/joomla/document/raw/raw.php index 64fd6272e6900..d82e11c5bbd0a 100644 --- a/libraries/joomla/document/raw/raw.php +++ b/libraries/joomla/document/raw/raw.php @@ -18,7 +18,6 @@ /** * DocumentRAW class, provides an easy interface to parse and display raw output * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Document * @since 1.5 @@ -30,10 +29,10 @@ class JDocumentRAW extends JDocument /** * Class constructore * - * @access protected + * @access public * @param array $options Associative array of options */ - function __construct($options = array()) + public function __construct($options = array()) { parent::__construct($options); @@ -52,9 +51,9 @@ function __construct($options = array()) * @param array $params Associative array of attributes * @return The rendered data */ - function render( $cache = false, $params = array()) + public function render( $cache = false, $params = array()) { parent::render(); return $this->getBuffer(); } -} \ No newline at end of file +} diff --git a/libraries/joomla/document/renderer.php b/libraries/joomla/document/renderer.php index f3d04f78df6b1..2ef968672e4f5 100644 --- a/libraries/joomla/document/renderer.php +++ b/libraries/joomla/document/renderer.php @@ -1,78 +1,74 @@ - - * @package Joomla.Framework - * @subpackage Document - * @since 1.5 - */ -class JDocumentRenderer extends JObject -{ - /** - * reference to the JDocument object that instantiated the renderer - * - * @var object - * @access protected - */ - var $_doc = null; - - /** - * Renderer mime type - * - * @var string - * @access private - */ - var $_mime = "text/html"; - - /** - * Class constructor - * - * @access protected - * @param object A reference to the JDocument object that instantiated the renderer - */ - function __construct(&$doc) { - $this->_doc =& $doc; - } - - /** - * Renders a script and returns the results as a string - * - * @abstract - * @access public - * @param string $name The name of the element to render - * @param array $array Array of values - * @param string $content Override the output of the renderer - * @return string The output of the script - */ - function render( $name, $params = array(), $content = null ) - { - - } - - /** - * Return the content type of the renderer - * - * @return string The contentType - */ - function getContentType() { - return $this->_mime; - } -} \ No newline at end of file + +/** + * Abstract class for a renderer + * + * @abstract + * @package Joomla.Framework + * @subpackage Document + * @since 1.5 + */ +abstract class JDocumentRenderer extends JObject +{ + /** + * reference to the JDocument object that instantiated the renderer + * + * @var object + * @access protected + */ + protected $_doc = null; + + /** + * Renderer mime type + * + * @var string + * @access private + */ + protected $_mime = "text/html"; + + /** + * Class constructor + * + * @access protected + * @param object A reference to the JDocument object that instantiated the renderer + */ + public function __construct(&$doc) { + $this->_doc =& $doc; + } + + /** + * Renders a script and returns the results as a string + * + * @abstract + * @access public + * @param string $name The name of the element to render + * @param array $array Array of values + * @param string $content Override the output of the renderer + * @return string The output of the script + */ + abstract public function render( $name, $params = array(), $content = null ); + + /** + * Return the content type of the renderer + * + * @return string The contentType + */ + public function getContentType() { + return $this->_mime; + } +} diff --git a/libraries/joomla/document/vcard/index.html b/libraries/joomla/document/vcard/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/libraries/joomla/document/vcard/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/joomla/document/vcard/vcard.php b/libraries/joomla/document/vcard/vcard.php new file mode 100644 index 0000000000000..d46bfc9111077 --- /dev/null +++ b/libraries/joomla/document/vcard/vcard.php @@ -0,0 +1,276 @@ +_mime = 'text/x-vcard'; + + //set document type + $this->_type = 'vcard'; + } + + /** + * Render the document. + * + * @access public + * @param boolean $cache If true, cache the output + * @param array $params Associative array of attributes + * @return The rendered data + */ + public function render( $cache = false, $params = array()) + { + $data = 'BEGIN:VCARD'; + $data .= "\r\n"; + $data .= 'VERSION:2.1'; + $data .= "\r\n"; + + foreach( $this->_properties as $key => $value ) { + $data .= "$key:$value"; + $data .= "\r\n"; + } + $data .= 'REV:'. date( 'Y-m-d' ) .'T'. date( 'H:i:s' ). 'Z'; + $data .= "\r\n"; + $data .= 'MAILER: Joomla! vCard for '. $this->getBase(); + $data .= "\r\n"; + $data .= 'END:VCARD'; + $data .= "\r\n"; + + // Set document type headers + parent::render(); + + //JResponse::setHeader('Content-Length', strlen($data), true); + JResponse::setHeader('Content-disposition: attachment; filename="'.$this->_filename.'"', true); + + return $data; + } + + // type may be PREF | WORK | HOME | VOICE | FAX | MSG | CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO or any senseful combination, e.g. "PREF;WORK;VOICE" + public function setPhoneNumber($number, $type='') + { + $key = 'TEL'; + if ($type!='') { + $key .= ';'. $type; + } + $key.= ';ENCODING=QUOTED-PRINTABLE'; + + $this->_properties[$key] = $this->quoted_printable_encode($number); + } + + // $type = "GIF" | "JPEG" + public function setPhoto($type, $photo) + { + $this->_properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo); + } + + public function setFormattedName($name) + { + $this->_properties['FN'] = $this->quoted_printable_encode($name); + } + + public function setName( $family='', $first='', $additional='', $prefix='', $suffix='' ) + { + $this->_properties["N"] = "$family;$first;$additional;$prefix;$suffix"; + $this->setFormattedName( trim( "$prefix $first $additional $family $suffix" ) ); + } + + // $date format is YYYY-MM-DD + public function setBirthday($date) + { + $this->_properties['BDAY'] = $date; + } + + // $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL" + public function setAddress( $postoffice='', $extended='', $street='', $city='', $region='', $zip='', $country='', $type='HOME;POSTAL' ) + { + $separator = ';'; + + $key = 'ADR'; + if ( $type != '' ) { + $key .= $separator . $type; + } + $key.= ';ENCODING=QUOTED-PRINTABLE'; + + $return = $this->encode( $postoffice ); + $return .= $separator . $this->encode( $extended ); + $return .= $separator . $this->encode( $street ); + $return .= $separator . $this->encode( $city ); + $return .= $separator . $this->encode( $region); + $return .= $separator . $this->encode( $zip ); + $return .= $separator . $this->encode( $country ); + + $this->_properties[$key] = $return; + } + + public function setLabel($postoffice='', $extended='', $street='', $city='', $region='', $zip='', $country='', $type='HOME;POSTAL') + { + $label = ''; + if ($postoffice!='') { + $label.= $postoffice; + $label.= "\r\n"; + } + + if ($extended!='') { + $label.= $extended; + $label.= "\r\n"; + } + + if ($street!='') { + $label.= $street; + $label.= "\r\n"; + } + + if ($zip!='') { + $label.= $zip .' '; + } + + if ($city!='') { + $label.= $city; + $label.= "\r\n"; + } + + if ($region!='') { + $label.= $region; + $label.= "\r\n"; + } + + if ($country!='') { + $country.= $country; + $label.= "\r\n"; + } + + $this->_properties["LABEL;$type;ENCODING=QUOTED-PRINTABLE"] = $this->quoted_printable_encode($label); + } + + public function setEmail($address) + { + $this->_properties['EMAIL;INTERNET'] = $address; + } + + public function setNote($note) + { + $this->_properties['NOTE;ENCODING=QUOTED-PRINTABLE'] = $this->quoted_printable_encode($note); + } + + // $type may be WORK | HOME + public function setURL($url, $type='') + { + $key = 'URL'; + if ($type!='') { + $key.= ";$type"; + } + + $this->_properties[$key] = $url; + } + + public function setFilename( $filename ) + { + $this->_filename = $filename .'.vcf'; + } + + public function setTitle( $title ) + { + $title = trim( $title ); + $this->_properties['TITLE'] = $title; + } + + public function setOrg( $org ) + { + $org = trim( $org ); + $this->_properties['ORG'] = $org; + } + + + public function encode($string) { + return $this->escape($this->quoted_printable_encode($string)); + } + + public function escape($string) { + return str_replace(';',"\;",$string); + } + + public function quoted_printable_encode($input, $line_max = 76) + { + $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); + $lines = preg_split("/(?:\r\n|\r|\n)/", $input); + $eol = "\r\n"; + $linebreak = '=0D=0A'; + $escape = '='; + $output = ''; + + for ($j=0;$j 126) ) { // always encode "\t", which is *not* required + $h2 = floor($dec/16); + $h1 = floor($dec%16); + $c = $escape.$hex["$h2"] . $hex["$h1"]; + } + if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted + $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay + $newline = " "; + } + $newline .= $c; + } // end of for + $output .= $newline; + if ($j - * @author Jon Parise - * @author Johan Janssens - * - * @package Joomla.Framework - * @subpackage Environment - * @since 1.5 - */ - -class JBrowser extends JObject -{ - /** - * Major version number. - * - * @var integer - */ - var $_majorVersion = 0; - - /** - * Minor version number. - * - * @var integer - */ - var $_minorVersion = 0; - - /** - * Browser name. - * - * @var string - */ - var $_browser = ''; - - /** - * Full user agent string. - * - * @var string - */ - var $_agent = ''; - - /** - * Lower-case user agent string. - * - * @var string - */ - var $_lowerAgent = ''; - - /** - * HTTP_ACCEPT string - * - * @var string - */ - var $_accept = ''; - - /** - * Platform the browser is running on. - * - * @var string - */ - var $_platform = ''; - - /** - * Known robots. - * - * @var array - */ - var $_robots = array( - /* The most common ones. */ - 'Googlebot', - 'msnbot', - 'Slurp', - 'Yahoo', - /* The rest alphabetically. */ - 'Arachnoidea', - 'ArchitextSpider', - 'Ask Jeeves', - 'B-l-i-t-z-Bot', - 'Baiduspider', - 'BecomeBot', - 'cfetch', - 'ConveraCrawler', - 'ExtractorPro', - 'FAST-WebCrawler', - 'FDSE robot', - 'fido', - 'geckobot', - 'Gigabot', - 'Girafabot', - 'grub-client', - 'Gulliver', - 'HTTrack', - 'ia_archiver', - 'InfoSeek', - 'kinjabot', - 'KIT-Fireball', - 'larbin', - 'LEIA', - 'lmspider', - 'Lycos_Spider', - 'Mediapartners-Google', - 'MuscatFerret', - 'NaverBot', - 'OmniExplorer_Bot', - 'polybot', - 'Pompos', - 'Scooter', - 'Teoma', - 'TheSuBot', - 'TurnitinBot', - 'Ultraseek', - 'ViolaBot', - 'webbandit', - 'www.almaden.ibm.com/cs/crawler', - 'ZyBorg', - ); - - /** - * Is this a mobile browser? - * - * @var boolean - */ - var $_mobile = false; - - /** - * Features. - * - * @var array - */ - var $_features = array( - 'html' => true, - 'hdml' => false, - 'wml' => false, - 'images' => true, - 'iframes' => false, - 'frames' => true, - 'tables' => true, - 'java' => true, - 'javascript' => true, - 'dom' => false, - 'utf' => false, - 'rte' => false, - 'homepage' => false, - 'accesskey' => false, - 'optgroup' => false, - 'xmlhttpreq' => false, - 'cite' => false, - 'xhtml+xml' => false, - 'mathml' => false, - 'svg' => false - ); - - /** - * Quirks - * - * @var array - */ - var $_quirks = array( - 'avoid_popup_windows' => false, - 'break_disposition_header' => false, - 'break_disposition_filename' => false, - 'broken_multipart_form' => false, - 'cache_same_url' => false, - 'cache_ssl_downloads' => false, - 'double_linebreak_textarea' => false, - 'empty_file_input_value' => false, - 'must_cache_forms' => false, - 'no_filename_spaces' => false, - 'no_hidden_overflow_tables' => false, - 'ow_gui_1.3' => false, - 'png_transparency' => false, - 'scrollbar_in_way' => false, - 'scroll_tds' => false, - 'windowed_controls' => false, - ); - - /** - * List of viewable image MIME subtypes. - * This list of viewable images works for IE and Netscape/Mozilla. - * - * @var array - */ - var $_images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp'); - - - /** - * Create a browser instance (Constructor). - * - * @param string $userAgent The browser string to parse. - * @param string $accept The HTTP_ACCEPT settings to use. - */ - function __construct($userAgent = null, $accept = null) - { - $this->match($userAgent, $accept); - } - - /** - * Returns a reference to the global Browser object, only creating it - * if it doesn't already exist. - * - * This method must be invoked as: - *
        $browser = &JBrowser::getInstance([$userAgent[, $accept]]);
      - * - * @access public - * @param string $userAgent The browser string to parse. - * @param string $accept The HTTP_ACCEPT settings to use. - * @return JBrowser The Browser object. - */ - function &getInstance($userAgent = null, $accept = null) - { - static $instances; - - if (!isset($instances)) { - $instances = array(); - } - - $signature = serialize(array($userAgent, $accept)); - - if (empty($instances[$signature])) { - $instances[$signature] = new JBrowser($userAgent, $accept); - } - - return $instances[$signature]; - } - - /** - * Parses the user agent string and inititializes the object with - * all the known features and quirks for the given browser. - * - * @param string $userAgent The browser string to parse. - * @param string $accept The HTTP_ACCEPT settings to use. - */ - function match($userAgent = null, $accept = null) - { - // Set our agent string. - if (is_null($userAgent)) { - if (isset($_SERVER['HTTP_USER_AGENT'])) { - $this->_agent = trim($_SERVER['HTTP_USER_AGENT']); - } - } else { - $this->_agent = $userAgent; - } - $this->_lowerAgent = strtolower($this->_agent); - - // Set our accept string. - if (is_null($accept)) { - if (isset($_SERVER['HTTP_ACCEPT'])) { - $this->_accept = strtolower(trim($_SERVER['HTTP_ACCEPT'])); - } - } else { - $this->_accept = strtolower($accept); - } - - - // Check if browser excepts content type xhtml+xml - if (strpos($this->_accept, 'application/xhtml+xml')) { - $this->setFeature('xhtml+xml'); - } - - // Check for a mathplayer plugin is installed, so we can use MathML on several browsers - if (strpos($this->_lowerAgent, 'mathplayer') !== false) { - $this->setFeature('mathml'); - } - - // Check for UTF support. - if (isset($_SERVER['HTTP_ACCEPT_CHARSET'])) { - $this->setFeature('utf', strpos(strtolower($_SERVER['HTTP_ACCEPT_CHARSET']), 'utf') !== false); - } - - if (!empty($this->_agent)) { - $this->_setPlatform(); - - if (strpos($this->_lowerAgent, 'mobileexplorer') !== false || - strpos($this->_lowerAgent, 'openwave') !== false || - strpos($this->_lowerAgent, 'opera mini') !== false || - strpos($this->_lowerAgent, 'operamini') !== false) { - $this->setFeature('frames', false); - $this->setFeature('javascript', false); - $this->setQuirk('avoid_popup_windows'); - $this->_mobile = true; - } elseif (preg_match('|Opera[/ ]([0-9.]+)|', $this->_agent, $version)) { - $this->setBrowser('opera'); - list($this->_majorVersion, $this->_minorVersion) = explode('.', $version[1]); - $this->setFeature('javascript', true); - $this->setQuirk('no_filename_spaces'); - - if ($this->_majorVersion >= 7) { - $this->setFeature('dom'); - $this->setFeature('iframes'); - $this->setFeature('accesskey'); - $this->setFeature('optgroup'); - $this->setQuirk('double_linebreak_textarea'); - } - } elseif (strpos($this->_lowerAgent, 'elaine/') !== false || - strpos($this->_lowerAgent, 'palmsource') !== false || - strpos($this->_lowerAgent, 'digital paths') !== false) { - $this->setBrowser('palm'); - $this->setFeature('images', false); - $this->setFeature('frames', false); - $this->setFeature('javascript', false); - $this->setQuirk('avoid_popup_windows'); - $this->_mobile = true; - } elseif ((preg_match('|MSIE ([0-9.]+)|', $this->_agent, $version)) || - (preg_match('|Internet Explorer/([0-9.]+)|', $this->_agent, $version))) { - - $this->setBrowser('msie'); - $this->setQuirk('cache_ssl_downloads'); - $this->setQuirk('cache_same_url'); - $this->setQuirk('break_disposition_filename'); - - if (strpos($version[1], '.') !== false) { - list($this->_majorVersion, $this->_minorVersion) = explode('.', $version[1]); - } else { - $this->_majorVersion = $version[1]; - $this->_minorVersion = 0; - } - - /* IE (< 7) on Windows does not support alpha transparency in - * PNG images. */ - if (($this->_majorVersion < 7) && - preg_match('/windows/i', $this->_agent)) { - $this->setQuirk('png_transparency'); - } - - /* Some Handhelds have their screen resolution in the - * user agent string, which we can use to look for - * mobile agents. */ - if (preg_match('/; (120x160|240x280|240x320|320x320)\)/', $this->_agent)) { - $this->_mobile = true; - } - - switch ($this->_majorVersion) { - case 7: - $this->setFeature('javascript', 1.4); - $this->setFeature('dom'); - $this->setFeature('iframes'); - $this->setFeature('utf'); - $this->setFeature('rte'); - $this->setFeature('homepage'); - $this->setFeature('accesskey'); - $this->setFeature('optgroup'); - $this->setFeature('xmlhttpreq'); - $this->setQuirk('scrollbar_in_way'); - break; - - case 6: - $this->setFeature('javascript', 1.4); - $this->setFeature('dom'); - $this->setFeature('iframes'); - $this->setFeature('utf'); - $this->setFeature('rte'); - $this->setFeature('homepage'); - $this->setFeature('accesskey'); - $this->setFeature('optgroup'); - $this->setFeature('xmlhttpreq'); - $this->setQuirk('scrollbar_in_way'); - $this->setQuirk('broken_multipart_form'); - $this->setQuirk('windowed_controls'); - break; - - case 5: - if ($this->getPlatform() == 'mac') { - $this->setFeature('javascript', 1.2); - $this->setFeature('optgroup'); - } else { - // MSIE 5 for Windows. - $this->setFeature('javascript', 1.4); - $this->setFeature('dom'); - $this->setFeature('xmlhttpreq'); - if ($this->_minorVersion >= 5) { - $this->setFeature('rte'); - $this->setQuirk('windowed_controls'); - } - } - $this->setFeature('iframes'); - $this->setFeature('utf'); - $this->setFeature('homepage'); - $this->setFeature('accesskey'); - if ($this->_minorVersion == 5) { - $this->setQuirk('break_disposition_header'); - $this->setQuirk('broken_multipart_form'); - } - break; - - case 4: - $this->setFeature('javascript', 1.2); - $this->setFeature('accesskey'); - if ($this->_minorVersion > 0) { - $this->setFeature('utf'); - } - break; - - case 3: - $this->setFeature('javascript', 1.5); - $this->setQuirk('avoid_popup_windows'); - break; - } - } elseif (preg_match('|amaya/([0-9.]+)|', $this->_agent, $version)) { - $this->setBrowser('amaya'); - $this->_majorVersion = $version[1]; - if (isset($version[2])) { - $this->_minorVersion = $version[2]; - } - if ($this->_majorVersion > 1) { - $this->setFeature('mathml'); - $this->setFeature('svg'); - } - $this->setFeature('xhtml+xml'); - } elseif (preg_match('|W3C_Validator/([0-9.]+)|', $this->_agent, $version)) { - $this->setFeature('mathml'); - $this->setFeature('svg'); - $this->setFeature('xhtml+xml'); - } elseif (preg_match('|ANTFresco/([0-9]+)|', $this->_agent, $version)) { - $this->setBrowser('fresco'); - $this->setFeature('javascript', 1.5); - $this->setQuirk('avoid_popup_windows'); - } elseif (strpos($this->_lowerAgent, 'avantgo') !== false) { - $this->setBrowser('avantgo'); - $this->_mobile = true; - } elseif (preg_match('|Konqueror/([0-9]+)|', $this->_agent, $version) || - preg_match('|Safari/([0-9]+)\.?([0-9]+)?|', $this->_agent, $version)) { - // Konqueror and Apple's Safari both use the KHTML - // rendering engine. - $this->setBrowser('konqueror'); - $this->setQuirk('empty_file_input_value'); - $this->setQuirk('no_hidden_overflow_tables'); - $this->_majorVersion = $version[1]; - if (isset($version[2])) { - $this->_minorVersion = $version[2]; - } - - if (strpos($this->_agent, 'Safari') !== false && - $this->_majorVersion >= 60) { - // Safari. - $this->setFeature('utf'); - $this->setFeature('javascript', 1.4); - $this->setFeature('dom'); - $this->setFeature('iframes'); - if ($this->_majorVersion > 125 || - ($this->_majorVersion == 125 && - $this->_minorVersion >= 1)) { - $this->setFeature('accesskey'); - $this->setFeature('xmlhttpreq'); - } - if ($this->_majorVersion > 522) { - $this->setFeature('svg'); - $this->setFeature('xhtml+xml'); - } - } else { - // Konqueror. - $this->setFeature('javascript', 1.5); - switch ($this->_majorVersion) { - case 3: - $this->setFeature('dom'); - $this->setFeature('iframes'); - $this->setFeature('xhtml+xml'); - break; - } - } - } elseif (preg_match('|Mozilla/([0-9.]+)|', $this->_agent, $version)) { - $this->setBrowser('mozilla'); - $this->setQuirk('must_cache_forms'); - - list($this->_majorVersion, $this->_minorVersion) = explode('.', $version[1]); - switch ($this->_majorVersion) { - case 5: - if ($this->getPlatform() == 'win') { - $this->setQuirk('break_disposition_filename'); - } - $this->setFeature('javascript', 1.4); - $this->setFeature('dom'); - $this->setFeature('accesskey'); - $this->setFeature('optgroup'); - $this->setFeature('xmlhttpreq'); - $this->setFeature('cite'); - if (preg_match('|rv:(.*)\)|', $this->_agent, $revision)) { - if ($revision[1] >= 1) { - $this->setFeature('iframes'); - } - if ($revision[1] >= 1.3) { - $this->setFeature('rte'); - } - if ($revision[1] >= 1.5) { - $this->setFeature('svg'); - $this->setFeature('mathml'); - $this->setFeature('xhtml+xml'); - } - } - break; - - case 4: - $this->setFeature('javascript', 1.3); - $this->setQuirk('buggy_compression'); - break; - - case 3: - default: - $this->setFeature('javascript', 1); - $this->setQuirk('buggy_compression'); - break; - } - } elseif (preg_match('|Lynx/([0-9]+)|', $this->_agent, $version)) { - $this->setBrowser('lynx'); - $this->setFeature('images', false); - $this->setFeature('frames', false); - $this->setFeature('javascript', false); - $this->setQuirk('avoid_popup_windows'); - } elseif (preg_match('|Links \(([0-9]+)|', $this->_agent, $version)) { - $this->setBrowser('links'); - $this->setFeature('images', false); - $this->setFeature('frames', false); - $this->setFeature('javascript', false); - $this->setQuirk('avoid_popup_windows'); - } elseif (preg_match('|HotJava/([0-9]+)|', $this->_agent, $version)) { - $this->setBrowser('hotjava'); - $this->setFeature('javascript', false); - } elseif (strpos($this->_agent, 'UP/') !== false || - strpos($this->_agent, 'UP.B') !== false || - strpos($this->_agent, 'UP.L') !== false) { - $this->setBrowser('up'); - $this->setFeature('html', false); - $this->setFeature('javascript', false); - $this->setFeature('hdml'); - $this->setFeature('wml'); - - if (strpos($this->_agent, 'GUI') !== false && - strpos($this->_agent, 'UP.Link') !== false) { - /* The device accepts Openwave GUI extensions for - * WML 1.3. Non-UP.Link gateways sometimes have - * problems, so exclude them. */ - $this->setQuirk('ow_gui_1.3'); - } - $this->_mobile = true; - } elseif (strpos($this->_agent, 'Xiino/') !== false) { - $this->setBrowser('xiino'); - $this->setFeature('hdml'); - $this->setFeature('wml'); - $this->_mobile = true; - } elseif (strpos($this->_agent, 'Palmscape/') !== false) { - $this->setBrowser('palmscape'); - $this->setFeature('javascript', false); - $this->setFeature('hdml'); - $this->setFeature('wml'); - $this->_mobile = true; - } elseif (strpos($this->_agent, 'Nokia') !== false) { - $this->setBrowser('nokia'); - $this->setFeature('html', false); - $this->setFeature('wml'); - $this->setFeature('xhtml'); - $this->_mobile = true; - } elseif (strpos($this->_agent, 'Ericsson') !== false) { - $this->setBrowser('ericsson'); - $this->setFeature('html', false); - $this->setFeature('wml'); - $this->_mobile = true; - } elseif (strpos($this->_lowerAgent, 'wap') !== false) { - $this->setBrowser('wap'); - $this->setFeature('html', false); - $this->setFeature('javascript', false); - $this->setFeature('hdml'); - $this->setFeature('wml'); - $this->_mobile = true; - } elseif (strpos($this->_lowerAgent, 'docomo') !== false || - strpos($this->_lowerAgent, 'portalmmm') !== false) { - $this->setBrowser('imode'); - $this->setFeature('images', false); - $this->_mobile = true; - } elseif (strpos($this->_agent, 'BlackBerry') !== false) { - $this->setBrowser('blackberry'); - $this->setFeature('html', false); - $this->setFeature('javascript', false); - $this->setFeature('hdml'); - $this->setFeature('wml'); - $this->_mobile = true; - } elseif (strpos($this->_agent, 'MOT-') !== false) { - $this->setBrowser('motorola'); - $this->setFeature('html', false); - $this->setFeature('javascript', false); - $this->setFeature('hdml'); - $this->setFeature('wml'); - $this->_mobile = true; - } elseif (strpos($this->_lowerAgent, 'j-') !== false) { - $this->setBrowser('mml'); - $this->_mobile = true; - } - } - } - - /** - * Match the platform of the browser. - * - * This is a pretty simplistic implementation, but it's intended - * to let us tell what line breaks to send, so it's good enough - * for its purpose. - */ - function _setPlatform() - { - if (strpos($this->_lowerAgent, 'wind') !== false) { - $this->_platform = 'win'; - } elseif (strpos($this->_lowerAgent, 'mac') !== false) { - $this->_platform = 'mac'; - } else { - $this->_platform = 'unix'; - } - } - - /** - * Return the currently matched platform. - * - * @return string The user's platform. - */ - function getPlatform() { - return $this->_platform; - } - - /** - * Sets the current browser. - * - * @param string $browser The browser to set as current. - */ - function setBrowser($browser) { - $this->_browser = $browser; - } - - /** - * Retrieve the current browser. - * - * @return string The current browser. - */ - function getBrowser() { - return $this->_browser; - } - - /** - * Retrieve the current browser's major version. - * - * @return integer The current browser's major version. - */ - function getMajor() { - return $this->_majorVersion; - } - - /** - * Retrieve the current browser's minor version. - * @return integer The current browser's minor version. - */ - function getMinor() { - return $this->_minorVersion; - } - - /** - * Retrieve the current browser's version. - * @return string The current browser's version. - */ - function getVersion() { - return $this->_majorVersion . '.' . $this->_minorVersion; - } - - /** - * Return the full browser agent string. - * - * @return string The browser agent string. - */ - function getAgentString() { - return $this->_agent; - } - - /** - * Returns the server protocol in use on the current server. - * - * @return string The HTTP server protocol version. - */ - function getHTTPProtocol() - { - if (isset($_SERVER['SERVER_PROTOCOL'])) { - if (($pos = strrpos($_SERVER['SERVER_PROTOCOL'], '/'))) { - return substr($_SERVER['SERVER_PROTOCOL'], $pos + 1); - } - } - return null; - } - - /** - * Set unique behavior for the current browser. - * - * @param string $quirk The behavior to set. - * @param string $value Special behavior parameter. - */ - function setQuirk($quirk, $value = true) { - $this->_quirks[$quirk] = $value; - } - - /** - * Check unique behavior for the current browser. - * - * @param string $quirk The behavior to check. - * @return boolean Does the browser have the behavior set? - */ - function hasQuirk($quirk) { - return !empty($this->_quirks[$quirk]); - } - - /** - * Retrieve unique behavior for the current browser. - * - * @param string $quirk The behavior to retrieve. - * @return string The value for the requested behavior. - */ - function getQuirk($quirk) - { - return isset($this->_quirks[$quirk]) - ? $this->_quirks[$quirk] - : null; - } - - /** - * Set capabilities for the current browser. - * - * @param string $feature The capability to set. - * @param string $value Special capability parameter. - */ - function setFeature($feature, $value = true) { - $this->_features[$feature] = $value; - } - - - /** - * Check the current browser capabilities. - * @param string $feature The capability to check. - * @return boolean Does the browser have the capability set? - */ - function hasFeature($feature) { - return !empty($this->_features[$feature]); - } - - /** - * Retrieve the current browser capability. - * - * @param string $feature The capability to retrieve. - * @return string The value of the requested capability. - */ - function getFeature($feature) { - return isset($this->_features[$feature]) - ? $this->_features[$feature] - : null; - } - - /** - * Determines if a browser can display a given MIME type. - * - * @param string $mimetype The MIME type to check. - * @return boolean True if the browser can display the MIME type. - */ - function isViewable($mimetype) - { - $mimetype = strtolower($mimetype); - list($type, $subtype) = explode('/', $mimetype); - - if (!empty($this->_accept)) { - $wildcard_match = false; - - if (strpos($this->_accept, $mimetype) !== false) { - return true; - } - - if (strpos($this->_accept, '*/*') !== false) { - $wildcard_match = true; - if ($type != 'image') { - return true; - } - } - - /* image/jpeg and image/pjpeg *appear* to be the same - * entity, but Mozilla doesn't seem to want to accept the - * latter. For our purposes, we will treat them the - * same. - */ - if ($this->isBrowser('mozilla') && - ($mimetype == 'image/pjpeg') && - (strpos($this->_accept, 'image/jpeg') !== false)) { - return true; - } - - if (!$wildcard_match) { - return false; - } - } - - if (!$this->hasFeature('images') || ($type != 'image')) { - return false; - } - - return (in_array($subtype, $this->_images)); - } - - /** - * Determine if the given browser is the same as the current. - * - * @param string $browser The browser to check. - * @return boolean Is the given browser the same as the current? - */ - function isBrowser($browser) - { - return ($this->_browser === $browser); - } - - /** - * Determines if the browser is a robot or not. - * - * @return boolean True if browser is a known robot. - */ - function isRobot() - { - foreach ($this->_robots as $robot) { - if (strpos($this->_agent, $robot) !== false) { - return true; - } - } - return false; - } - - /** - * Determine if we are using a secure (SSL) connection. - * - * @return boolean True if using SSL, false if not. - */ - function isSSLConnection() - { - return ((isset($_SERVER['HTTPS']) && - ($_SERVER['HTTPS'] == 'on')) || - getenv('SSL_PROTOCOL_VERSION')); - } -} \ No newline at end of file + + * @author Jon Parise + * + * @package Joomla.Framework + * @subpackage Environment + * @since 1.5 + */ + +class JBrowser extends JObject +{ + /** + * Major version number. + * + * @var integer + */ + protected $_majorVersion = 0; + + /** + * Minor version number. + * + * @var integer + */ + protected $_minorVersion = 0; + + /** + * Browser name. + * + * @var string + */ + protected $_browser = ''; + + /** + * Full user agent string. + * + * @var string + */ + protected $_agent = ''; + + /** + * Lower-case user agent string. + * + * @var string + */ + protected $_lowerAgent = ''; + + /** + * HTTP_ACCEPT string + * + * @var string + */ + protected $_accept = ''; + + /** + * Platform the browser is running on. + * + * @var string + */ + protected $_platform = ''; + + /** + * Known robots. + * + * @var array + */ + protected $_robots = array( + /* The most common ones. */ + 'Googlebot', + 'msnbot', + 'Slurp', + 'Yahoo', + /* The rest alphabetically. */ + 'Arachnoidea', + 'ArchitextSpider', + 'Ask Jeeves', + 'B-l-i-t-z-Bot', + 'Baiduspider', + 'BecomeBot', + 'cfetch', + 'ConveraCrawler', + 'ExtractorPro', + 'FAST-WebCrawler', + 'FDSE robot', + 'fido', + 'geckobot', + 'Gigabot', + 'Girafabot', + 'grub-client', + 'Gulliver', + 'HTTrack', + 'ia_archiver', + 'InfoSeek', + 'kinjabot', + 'KIT-Fireball', + 'larbin', + 'LEIA', + 'lmspider', + 'Lycos_Spider', + 'Mediapartners-Google', + 'MuscatFerret', + 'NaverBot', + 'OmniExplorer_Bot', + 'polybot', + 'Pompos', + 'Scooter', + 'Teoma', + 'TheSuBot', + 'TurnitinBot', + 'Ultraseek', + 'ViolaBot', + 'webbandit', + 'www.almaden.ibm.com/cs/crawler', + 'ZyBorg', + ); + + /** + * Is this a mobile browser? + * + * @var boolean + */ + protected $_mobile = false; + + /** + * Features. + * + * @var array + */ + protected $_features = array( + 'html' => true, + 'hdml' => false, + 'wml' => false, + 'images' => true, + 'iframes' => false, + 'frames' => true, + 'tables' => true, + 'java' => true, + 'javascript' => true, + 'dom' => false, + 'utf' => false, + 'rte' => false, + 'homepage' => false, + 'accesskey' => false, + 'optgroup' => false, + 'xmlhttpreq' => false, + 'cite' => false, + 'xhtml+xml' => false, + 'mathml' => false, + 'svg' => false + ); + + /** + * Quirks + * + * @var array + */ + protected $_quirks = array( + 'avoid_popup_windows' => false, + 'break_disposition_header' => false, + 'break_disposition_filename' => false, + 'broken_multipart_form' => false, + 'cache_same_url' => false, + 'cache_ssl_downloads' => false, + 'double_linebreak_textarea' => false, + 'empty_file_input_value' => false, + 'must_cache_forms' => false, + 'no_filename_spaces' => false, + 'no_hidden_overflow_tables' => false, + 'ow_gui_1.3' => false, + 'png_transparency' => false, + 'scrollbar_in_way' => false, + 'scroll_tds' => false, + 'windowed_controls' => false, + ); + + /** + * List of viewable image MIME subtypes. + * This list of viewable images works for IE and Netscape/Mozilla. + * + * @var array + */ + protected $_images = array('jpeg', 'gif', 'png', 'pjpeg', 'x-png', 'bmp'); + + + /** + * Create a browser instance (Constructor). + * + * @param string $userAgent The browser string to parse. + * @param string $accept The HTTP_ACCEPT settings to use. + */ + protected function __construct($userAgent = null, $accept = null) + { + $this->match($userAgent, $accept); + } + + /** + * Returns a reference to the global Browser object, only creating it + * if it doesn't already exist. + * + * This method must be invoked as: + *
        $browser = &JBrowser::getInstance([$userAgent[, $accept]]);
      + * + * @access public + * @param string $userAgent The browser string to parse. + * @param string $accept The HTTP_ACCEPT settings to use. + * @return JBrowser The Browser object. + */ + public static function &getInstance($userAgent = null, $accept = null) + { + static $instances; + + if (!isset($instances)) { + $instances = array(); + } + + $signature = serialize(array($userAgent, $accept)); + + if (empty($instances[$signature])) { + $instances[$signature] = new JBrowser($userAgent, $accept); + } + + return $instances[$signature]; + } + + /** + * Parses the user agent string and inititializes the object with + * all the known features and quirks for the given browser. + * + * @param string $userAgent The browser string to parse. + * @param string $accept The HTTP_ACCEPT settings to use. + */ + public function match($userAgent = null, $accept = null) + { + // Set our agent string. + if (is_null($userAgent)) { + if (isset($_SERVER['HTTP_USER_AGENT'])) { + $this->_agent = trim($_SERVER['HTTP_USER_AGENT']); + } + } else { + $this->_agent = $userAgent; + } + $this->_lowerAgent = strtolower($this->_agent); + + // Set our accept string. + if (is_null($accept)) { + if (isset($_SERVER['HTTP_ACCEPT'])) { + $this->_accept = strtolower(trim($_SERVER['HTTP_ACCEPT'])); + } + } else { + $this->_accept = strtolower($accept); + } + + + // Check if browser excepts content type xhtml+xml + if (strpos($this->_accept, 'application/xhtml+xml')) { + $this->setFeature('xhtml+xml'); + } + + // Check for a mathplayer plugin is installed, so we can use MathML on several browsers + if (strpos($this->_lowerAgent, 'mathplayer') !== false) { + $this->setFeature('mathml'); + } + + // Check for UTF support. + if (isset($_SERVER['HTTP_ACCEPT_CHARSET'])) { + $this->setFeature('utf', strpos(strtolower($_SERVER['HTTP_ACCEPT_CHARSET']), 'utf') !== false); + } + + if (!empty($this->_agent)) { + $this->_setPlatform(); + + if (strpos($this->_lowerAgent, 'mobileexplorer') !== false || + strpos($this->_lowerAgent, 'openwave') !== false || + strpos($this->_lowerAgent, 'opera mini') !== false || + strpos($this->_lowerAgent, 'operamini') !== false) { + $this->setFeature('frames', false); + $this->setFeature('javascript', false); + $this->setQuirk('avoid_popup_windows'); + $this->_mobile = true; + } elseif (preg_match('|Opera[/ ]([0-9.]+)|', $this->_agent, $version)) { + $this->setBrowser('opera'); + list($this->_majorVersion, $this->_minorVersion) = explode('.', $version[1]); + $this->setFeature('javascript', true); + $this->setQuirk('no_filename_spaces'); + + if ($this->_majorVersion >= 7) { + $this->setFeature('dom'); + $this->setFeature('iframes'); + $this->setFeature('accesskey'); + $this->setFeature('optgroup'); + $this->setQuirk('double_linebreak_textarea'); + } + } elseif (strpos($this->_lowerAgent, 'elaine/') !== false || + strpos($this->_lowerAgent, 'palmsource') !== false || + strpos($this->_lowerAgent, 'digital paths') !== false) { + $this->setBrowser('palm'); + $this->setFeature('images', false); + $this->setFeature('frames', false); + $this->setFeature('javascript', false); + $this->setQuirk('avoid_popup_windows'); + $this->_mobile = true; + } elseif ((preg_match('|MSIE ([0-9.]+)|', $this->_agent, $version)) || + (preg_match('|Internet Explorer/([0-9.]+)|', $this->_agent, $version))) { + + $this->setBrowser('msie'); + $this->setQuirk('cache_ssl_downloads'); + $this->setQuirk('cache_same_url'); + $this->setQuirk('break_disposition_filename'); + + if (strpos($version[1], '.') !== false) { + list($this->_majorVersion, $this->_minorVersion) = explode('.', $version[1]); + } else { + $this->_majorVersion = $version[1]; + $this->_minorVersion = 0; + } + + /* IE (< 7) on Windows does not support alpha transparency in + * PNG images. */ + if (($this->_majorVersion < 7) && + preg_match('/windows/i', $this->_agent)) { + $this->setQuirk('png_transparency'); + } + + /* Some Handhelds have their screen resolution in the + * user agent string, which we can use to look for + * mobile agents. */ + if (preg_match('/; (120x160|240x280|240x320|320x320)\)/', $this->_agent)) { + $this->_mobile = true; + } + + switch ($this->_majorVersion) { + case 7: + $this->setFeature('javascript', 1.4); + $this->setFeature('dom'); + $this->setFeature('iframes'); + $this->setFeature('utf'); + $this->setFeature('rte'); + $this->setFeature('homepage'); + $this->setFeature('accesskey'); + $this->setFeature('optgroup'); + $this->setFeature('xmlhttpreq'); + $this->setQuirk('scrollbar_in_way'); + break; + + case 6: + $this->setFeature('javascript', 1.4); + $this->setFeature('dom'); + $this->setFeature('iframes'); + $this->setFeature('utf'); + $this->setFeature('rte'); + $this->setFeature('homepage'); + $this->setFeature('accesskey'); + $this->setFeature('optgroup'); + $this->setFeature('xmlhttpreq'); + $this->setQuirk('scrollbar_in_way'); + $this->setQuirk('broken_multipart_form'); + $this->setQuirk('windowed_controls'); + break; + + case 5: + if ($this->getPlatform() == 'mac') { + $this->setFeature('javascript', 1.2); + $this->setFeature('optgroup'); + } else { + // MSIE 5 for Windows. + $this->setFeature('javascript', 1.4); + $this->setFeature('dom'); + $this->setFeature('xmlhttpreq'); + if ($this->_minorVersion >= 5) { + $this->setFeature('rte'); + $this->setQuirk('windowed_controls'); + } + } + $this->setFeature('iframes'); + $this->setFeature('utf'); + $this->setFeature('homepage'); + $this->setFeature('accesskey'); + if ($this->_minorVersion == 5) { + $this->setQuirk('break_disposition_header'); + $this->setQuirk('broken_multipart_form'); + } + break; + + case 4: + $this->setFeature('javascript', 1.2); + $this->setFeature('accesskey'); + if ($this->_minorVersion > 0) { + $this->setFeature('utf'); + } + break; + + case 3: + $this->setFeature('javascript', 1.5); + $this->setQuirk('avoid_popup_windows'); + break; + } + } elseif (preg_match('|amaya/([0-9.]+)|', $this->_agent, $version)) { + $this->setBrowser('amaya'); + $this->_majorVersion = $version[1]; + if (isset($version[2])) { + $this->_minorVersion = $version[2]; + } + if ($this->_majorVersion > 1) { + $this->setFeature('mathml'); + $this->setFeature('svg'); + } + $this->setFeature('xhtml+xml'); + } elseif (preg_match('|W3C_Validator/([0-9.]+)|', $this->_agent, $version)) { + $this->setFeature('mathml'); + $this->setFeature('svg'); + $this->setFeature('xhtml+xml'); + } elseif (preg_match('|ANTFresco/([0-9]+)|', $this->_agent, $version)) { + $this->setBrowser('fresco'); + $this->setFeature('javascript', 1.5); + $this->setQuirk('avoid_popup_windows'); + } elseif (strpos($this->_lowerAgent, 'avantgo') !== false) { + $this->setBrowser('avantgo'); + $this->_mobile = true; + } elseif (preg_match('|Konqueror/([0-9]+)|', $this->_agent, $version) || + preg_match('|Safari/([0-9]+)\.?([0-9]+)?|', $this->_agent, $version)) { + // Konqueror and Apple's Safari both use the KHTML + // rendering engine. + $this->setBrowser('konqueror'); + $this->setQuirk('empty_file_input_value'); + $this->setQuirk('no_hidden_overflow_tables'); + $this->_majorVersion = $version[1]; + if (isset($version[2])) { + $this->_minorVersion = $version[2]; + } + + if (strpos($this->_agent, 'Safari') !== false && + $this->_majorVersion >= 60) { + // Safari. + $this->setFeature('utf'); + $this->setFeature('javascript', 1.4); + $this->setFeature('dom'); + $this->setFeature('iframes'); + if ($this->_majorVersion > 125 || + ($this->_majorVersion == 125 && + $this->_minorVersion >= 1)) { + $this->setFeature('accesskey'); + $this->setFeature('xmlhttpreq'); + } + if ($this->_majorVersion > 522) { + $this->setFeature('svg'); + $this->setFeature('xhtml+xml'); + } + } else { + // Konqueror. + $this->setFeature('javascript', 1.5); + switch ($this->_majorVersion) { + case 3: + $this->setFeature('dom'); + $this->setFeature('iframes'); + $this->setFeature('xhtml+xml'); + break; + } + } + } elseif (preg_match('|Mozilla/([0-9.]+)|', $this->_agent, $version)) { + $this->setBrowser('mozilla'); + $this->setQuirk('must_cache_forms'); + + list($this->_majorVersion, $this->_minorVersion) = explode('.', $version[1]); + switch ($this->_majorVersion) { + case 5: + if ($this->getPlatform() == 'win') { + $this->setQuirk('break_disposition_filename'); + } + $this->setFeature('javascript', 1.4); + $this->setFeature('dom'); + $this->setFeature('accesskey'); + $this->setFeature('optgroup'); + $this->setFeature('xmlhttpreq'); + $this->setFeature('cite'); + if (preg_match('|rv:(.*)\)|', $this->_agent, $revision)) { + if ($revision[1] >= 1) { + $this->setFeature('iframes'); + } + if ($revision[1] >= 1.3) { + $this->setFeature('rte'); + } + if ($revision[1] >= 1.5) { + $this->setFeature('svg'); + $this->setFeature('mathml'); + $this->setFeature('xhtml+xml'); + } + } + break; + + case 4: + $this->setFeature('javascript', 1.3); + $this->setQuirk('buggy_compression'); + break; + + case 3: + default: + $this->setFeature('javascript', 1); + $this->setQuirk('buggy_compression'); + break; + } + } elseif (preg_match('|Lynx/([0-9]+)|', $this->_agent, $version)) { + $this->setBrowser('lynx'); + $this->setFeature('images', false); + $this->setFeature('frames', false); + $this->setFeature('javascript', false); + $this->setQuirk('avoid_popup_windows'); + } elseif (preg_match('|Links \(([0-9]+)|', $this->_agent, $version)) { + $this->setBrowser('links'); + $this->setFeature('images', false); + $this->setFeature('frames', false); + $this->setFeature('javascript', false); + $this->setQuirk('avoid_popup_windows'); + } elseif (preg_match('|HotJava/([0-9]+)|', $this->_agent, $version)) { + $this->setBrowser('hotjava'); + $this->setFeature('javascript', false); + } elseif (strpos($this->_agent, 'UP/') !== false || + strpos($this->_agent, 'UP.B') !== false || + strpos($this->_agent, 'UP.L') !== false) { + $this->setBrowser('up'); + $this->setFeature('html', false); + $this->setFeature('javascript', false); + $this->setFeature('hdml'); + $this->setFeature('wml'); + + if (strpos($this->_agent, 'GUI') !== false && + strpos($this->_agent, 'UP.Link') !== false) { + /* The device accepts Openwave GUI extensions for + * WML 1.3. Non-UP.Link gateways sometimes have + * problems, so exclude them. */ + $this->setQuirk('ow_gui_1.3'); + } + $this->_mobile = true; + } elseif (strpos($this->_agent, 'Xiino/') !== false) { + $this->setBrowser('xiino'); + $this->setFeature('hdml'); + $this->setFeature('wml'); + $this->_mobile = true; + } elseif (strpos($this->_agent, 'Palmscape/') !== false) { + $this->setBrowser('palmscape'); + $this->setFeature('javascript', false); + $this->setFeature('hdml'); + $this->setFeature('wml'); + $this->_mobile = true; + } elseif (strpos($this->_agent, 'Nokia') !== false) { + $this->setBrowser('nokia'); + $this->setFeature('html', false); + $this->setFeature('wml'); + $this->setFeature('xhtml'); + $this->_mobile = true; + } elseif (strpos($this->_agent, 'Ericsson') !== false) { + $this->setBrowser('ericsson'); + $this->setFeature('html', false); + $this->setFeature('wml'); + $this->_mobile = true; + } elseif (strpos($this->_lowerAgent, 'wap') !== false) { + $this->setBrowser('wap'); + $this->setFeature('html', false); + $this->setFeature('javascript', false); + $this->setFeature('hdml'); + $this->setFeature('wml'); + $this->_mobile = true; + } elseif (strpos($this->_lowerAgent, 'docomo') !== false || + strpos($this->_lowerAgent, 'portalmmm') !== false) { + $this->setBrowser('imode'); + $this->setFeature('images', false); + $this->_mobile = true; + } elseif (strpos($this->_agent, 'BlackBerry') !== false) { + $this->setBrowser('blackberry'); + $this->setFeature('html', false); + $this->setFeature('javascript', false); + $this->setFeature('hdml'); + $this->setFeature('wml'); + $this->_mobile = true; + } elseif (strpos($this->_agent, 'MOT-') !== false) { + $this->setBrowser('motorola'); + $this->setFeature('html', false); + $this->setFeature('javascript', false); + $this->setFeature('hdml'); + $this->setFeature('wml'); + $this->_mobile = true; + } elseif (strpos($this->_lowerAgent, 'j-') !== false) { + $this->setBrowser('mml'); + $this->_mobile = true; + } + } + } + + /** + * Match the platform of the browser. + * + * This is a pretty simplistic implementation, but it's intended + * to let us tell what line breaks to send, so it's good enough + * for its purpose. + */ + protected function _setPlatform() + { + if (strpos($this->_lowerAgent, 'wind') !== false) { + $this->_platform = 'win'; + } elseif (strpos($this->_lowerAgent, 'mac') !== false) { + $this->_platform = 'mac'; + } else { + $this->_platform = 'unix'; + } + } + + /** + * Return the currently matched platform. + * + * @return string The user's platform. + */ + public function getPlatform() { + return $this->_platform; + } + + /** + * Sets the current browser. + * + * @param string $browser The browser to set as current. + */ + public function setBrowser($browser) { + $this->_browser = $browser; + } + + /** + * Retrieve the current browser. + * + * @return string The current browser. + */ + public function getBrowser() { + return $this->_browser; + } + + /** + * Retrieve the current browser's major version. + * + * @return integer The current browser's major version. + */ + public function getMajor() { + return $this->_majorVersion; + } + + /** + * Retrieve the current browser's minor version. + * @return integer The current browser's minor version. + */ + public function getMinor() { + return $this->_minorVersion; + } + + /** + * Retrieve the current browser's version. + * @return string The current browser's version. + */ + public function getVersion() { + return $this->_majorVersion . '.' . $this->_minorVersion; + } + + /** + * Return the full browser agent string. + * + * @return string The browser agent string. + */ + public function getAgentString() { + return $this->_agent; + } + + /** + * Returns the server protocol in use on the current server. + * + * @return string The HTTP server protocol version. + */ + public function getHTTPProtocol() + { + if (isset($_SERVER['SERVER_PROTOCOL'])) { + if (($pos = strrpos($_SERVER['SERVER_PROTOCOL'], '/'))) { + return substr($_SERVER['SERVER_PROTOCOL'], $pos + 1); + } + } + return null; + } + + /** + * Set unique behavior for the current browser. + * + * @param string $quirk The behavior to set. + * @param string $value Special behavior parameter. + */ + public function setQuirk($quirk, $value = true) { + $this->_quirks[$quirk] = $value; + } + + /** + * Check unique behavior for the current browser. + * + * @param string $quirk The behavior to check. + * @return boolean Does the browser have the behavior set? + */ + public function hasQuirk($quirk) { + return !empty($this->_quirks[$quirk]); + } + + /** + * Retrieve unique behavior for the current browser. + * + * @param string $quirk The behavior to retrieve. + * @return string The value for the requested behavior. + */ + public function getQuirk($quirk) + { + return isset($this->_quirks[$quirk]) + ? $this->_quirks[$quirk] + : null; + } + + /** + * Set capabilities for the current browser. + * + * @param string $feature The capability to set. + * @param string $value Special capability parameter. + */ + public function setFeature($feature, $value = true) { + $this->_features[$feature] = $value; + } + + + /** + * Check the current browser capabilities. + * @param string $feature The capability to check. + * @return boolean Does the browser have the capability set? + */ + public function hasFeature($feature) { + return !empty($this->_features[$feature]); + } + + /** + * Retrieve the current browser capability. + * + * @param string $feature The capability to retrieve. + * @return string The value of the requested capability. + */ + public function getFeature($feature) { + return isset($this->_features[$feature]) + ? $this->_features[$feature] + : null; + } + + /** + * Determines if a browser can display a given MIME type. + * + * @param string $mimetype The MIME type to check. + * @return boolean True if the browser can display the MIME type. + */ + public function isViewable($mimetype) + { + $mimetype = strtolower($mimetype); + list($type, $subtype) = explode('/', $mimetype); + + if (!empty($this->_accept)) { + $wildcard_match = false; + + if (strpos($this->_accept, $mimetype) !== false) { + return true; + } + + if (strpos($this->_accept, '*/*') !== false) { + $wildcard_match = true; + if ($type != 'image') { + return true; + } + } + + /* image/jpeg and image/pjpeg *appear* to be the same + * entity, but Mozilla doesn't seem to want to accept the + * latter. For our purposes, we will treat them the + * same. + */ + if ($this->isBrowser('mozilla') && + ($mimetype == 'image/pjpeg') && + (strpos($this->_accept, 'image/jpeg') !== false)) { + return true; + } + + if (!$wildcard_match) { + return false; + } + } + + if (!$this->hasFeature('images') || ($type != 'image')) { + return false; + } + + return (in_array($subtype, $this->_images)); + } + + /** + * Determine if the given browser is the same as the current. + * + * @param string $browser The browser to check. + * @return boolean Is the given browser the same as the current? + */ + public function isBrowser($browser) + { + return ($this->_browser === $browser); + } + + /** + * Determines if the browser is a robot or not. + * + * @return boolean True if browser is a known robot. + */ + public function isRobot() + { + foreach ($this->_robots as $robot) { + if (strpos($this->_agent, $robot) !== false) { + return true; + } + } + return false; + } + + /** + * Determine if we are using a secure (SSL) connection. + * + * @return boolean True if using SSL, false if not. + */ + public function isSSLConnection() + { + return ((isset($_SERVER['HTTPS']) && + ($_SERVER['HTTPS'] == 'on')) || + getenv('SSL_PROTOCOL_VERSION')); + } +} diff --git a/libraries/joomla/environment/index.html b/libraries/joomla/environment/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/environment/index.html +++ b/libraries/joomla/environment/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/environment/request.php b/libraries/joomla/environment/request.php index 38c36da1aa886..e137c573fcc21 100644 --- a/libraries/joomla/environment/request.php +++ b/libraries/joomla/environment/request.php @@ -15,11 +15,6 @@ // Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die(); -/** - * Create the request global object - */ -$GLOBALS['_JREQUEST'] = array(); - /** * Set the available masks for cleaning variables */ @@ -39,14 +34,16 @@ * @subpackage Environment * @since 1.5 */ -class JRequest +abstract class JRequest { + private static $data = array(); + /** * Gets the full request path * * @return string */ - function getURI() + public static function getURI() { $uri = &JFactory::getURI(); return $uri->toString(array('path', 'query')); @@ -57,7 +54,7 @@ function getURI() * * @return string */ - function getMethod() + public static function getMethod() { $method = strtoupper( $_SERVER['REQUEST_METHOD'] ); return $method; @@ -91,7 +88,7 @@ function getMethod() * @return mixed Requested variable * @since 1.5 */ - function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask = 0) + public static function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask = 0) { // Ensure hash and type are uppercase $hash = strtoupper( $hash ); @@ -116,10 +113,10 @@ function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask case 'COOKIE' : $input = &$_COOKIE; break; - case 'ENV' : + case 'ENV' : $input = &$_ENV; break; - case 'SERVER' : + case 'SERVER' : $input = &$_SERVER; break; default: @@ -128,15 +125,12 @@ function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask break; } - if ( - isset($GLOBALS['_JREQUEST'][$name]['SET.'.$hash]) - && ($GLOBALS['_JREQUEST'][$name]['SET.'.$hash] === true) - ) { + if (isset(JRequest::$data[$name]['SET.'.$hash]) && (JRequest::$data[$name]['SET.'.$hash] === true)) { // Get the variable from the input hash - $var = (isset($input[$name]) && $input[$name] !== null) - ? $input[$name] : $default; + $var = (isset($input[$name]) && $input[$name] !== null) ? $input[$name] : $default; + $var = JRequest::_cleanVar($var, $mask, $type); } - elseif (!isset($GLOBALS['_JREQUEST'][$name][$sig])) + elseif (!isset(JRequest::$data[$name][$sig])) { if (isset($input[$name]) && $input[$name] !== null) { // Get the variable from the input hash and clean it @@ -147,7 +141,7 @@ function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask $var = JRequest::_stripSlashesRecursive( $var ); } - $GLOBALS['_JREQUEST'][$name][$sig] = $var; + JRequest::$data[$name][$sig] = $var; } elseif ($default !== null) { // Clean the default value @@ -157,7 +151,7 @@ function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask $var = $default; } } else { - $var = $GLOBALS['_JREQUEST'][$name][$sig]; + $var = JRequest::$data[$name][$sig]; } return $var; @@ -177,7 +171,7 @@ function getVar($name, $default = null, $hash = 'default', $type = 'none', $mask * @return integer Requested variable * @since 1.5 */ - function getInt($name, $default = 0, $hash = 'default') + public static function getInt($name, $default = 0, $hash = 'default') { return JRequest::getVar($name, $default, $hash, 'int'); } @@ -196,7 +190,7 @@ function getInt($name, $default = 0, $hash = 'default') * @return float Requested variable * @since 1.5 */ - function getFloat($name, $default = 0.0, $hash = 'default') + public static function getFloat($name, $default = 0.0, $hash = 'default') { return JRequest::getVar($name, $default, $hash, 'float'); } @@ -215,7 +209,7 @@ function getFloat($name, $default = 0.0, $hash = 'default') * @return bool Requested variable * @since 1.5 */ - function getBool($name, $default = false, $hash = 'default') + public static function getBool($name, $default = false, $hash = 'default') { return JRequest::getVar($name, $default, $hash, 'bool'); } @@ -234,7 +228,7 @@ function getBool($name, $default = false, $hash = 'default') * @return string Requested variable * @since 1.5 */ - function getWord($name, $default = '', $hash = 'default') + public static function getWord($name, $default = '', $hash = 'default') { return JRequest::getVar($name, $default, $hash, 'word'); } @@ -253,7 +247,7 @@ function getWord($name, $default = '', $hash = 'default') * @return string Requested variable * @since 1.5 */ - function getCmd($name, $default = '', $hash = 'default') + public static function getCmd($name, $default = '', $hash = 'default') { return JRequest::getVar($name, $default, $hash, 'cmd'); } @@ -273,7 +267,7 @@ function getCmd($name, $default = '', $hash = 'default') * @return string Requested variable * @since 1.5 */ - function getString($name, $default = '', $hash = 'default', $mask = 0) + public static function getString($name, $default = '', $hash = 'default', $mask = 0) { // Cast to string, in case JREQUEST_ALLOWRAW was specified for mask return (string) JRequest::getVar($name, $default, $hash, 'string', $mask); @@ -290,7 +284,7 @@ function getString($name, $default = '', $hash = 'default', $mask = 0) * @return string Previous value * @since 1.5 */ - function setVar($name, $value = null, $hash = 'method', $overwrite = true) + public static function setVar($name, $value = null, $hash = 'method', $overwrite = true) { //If overwrite is true, makes sure the variable hasn't been set yet if(!$overwrite && array_key_exists($name, $_REQUEST)) { @@ -298,7 +292,7 @@ function setVar($name, $value = null, $hash = 'method', $overwrite = true) } // Clean global request var - $GLOBALS['_JREQUEST'][$name] = array(); + JRequest::$data[$name] = array(); // Get the request hash value $hash = strtoupper($hash); @@ -325,17 +319,17 @@ function setVar($name, $value = null, $hash = 'method', $overwrite = true) case 'FILES' : $_FILES[$name] = $value; break; - case 'ENV' : + case 'ENV' : $_ENV['name'] = $value; break; - case 'SERVER' : + case 'SERVER' : $_SERVER['name'] = $value; break; } // Mark this variable as 'SET' - $GLOBALS['_JREQUEST'][$name]['SET.'.$hash] = true; - $GLOBALS['_JREQUEST'][$name]['SET.REQUEST'] = true; + JRequest::$data[$name]['SET.'.$hash] = true; + JRequest::$data[$name]['SET.REQUEST'] = true; return $previous; } @@ -364,7 +358,7 @@ function setVar($name, $value = null, $hash = 'method', $overwrite = true) * @return mixed Request hash * @since 1.5 */ - function get($hash = 'default', $mask = 0) + public static function get($hash = 'default', $mask = 0) { $hash = strtoupper($hash); @@ -374,27 +368,27 @@ function get($hash = 'default', $mask = 0) switch ($hash) { - case 'GET' : + case 'GET': $input = $_GET; break; - case 'POST' : + case 'POST': $input = $_POST; break; - case 'FILES' : + case 'FILES': $input = $_FILES; break; - case 'COOKIE' : + case 'COOKIE': $input = $_COOKIE; break; - case 'ENV' : + case 'ENV': $input = &$_ENV; break; - case 'SERVER' : + case 'SERVER': $input = &$_SERVER; break; @@ -420,7 +414,7 @@ function get($hash = 'default', $mask = 0) * @param string The request variable to set (POST, GET, FILES, METHOD) * @param boolean If true and an existing key is found, the value is overwritten, otherwise it is ingored */ - function set( $array, $hash = 'default', $overwrite = true ) + public static function set( $array, $hash = 'default', $overwrite = true ) { foreach ($array as $key => $value) { JRequest::setVar($key, $value, $hash, $overwrite); @@ -435,17 +429,17 @@ function set( $array, $hash = 'default', $overwrite = true ) * @param string The request method in which to look for the token key * @return boolean True if found and valid, false otherwise */ - function checkToken( $method = 'post' ) + public static function checkToken( $method = 'post' ) { $token = JUtility::getToken(); if(!JRequest::getVar( $token, '', $method, 'alnum' )) { $session = JFactory::getSession(); if($session->isNew()) { //Redirect to login screen - global $mainframe; + $appl = JFactory::getApplication(); $return = JRoute::_('index.php'); -; $mainframe->redirect($return, JText::_('SESSION_EXPIRED')); - $mainframe->close(); +; $appl->redirect($return, JText::_('SESSION_EXPIRED')); + $appl->close(); } else { return false; } @@ -461,7 +455,7 @@ function checkToken( $method = 'post' ) * @return void * @since 1.5 */ - function clean() + public static function clean() { JRequest::_cleanArray( $_FILES ); JRequest::_cleanArray( $_ENV ); @@ -505,7 +499,7 @@ function clean() } // Make sure the request hash is clean on file inclusion - $GLOBALS['_JREQUEST'] = array(); + JRequest::$data = array(); } /** @@ -516,7 +510,7 @@ function clean() * @param boolean True if the array is to be added to the GLOBALS * @since 1.5 */ - function _cleanArray( &$array, $globalise=false ) + private static function _cleanArray( &$array, $globalise=false ) { static $banned = array( '_files', '_env', '_get', '_post', '_cookie', '_server', '_session', 'globals' ); @@ -548,24 +542,24 @@ function _cleanArray( &$array, $globalise=false ) * other than the 1 bit is set, a strict filter is applied. * @param string The variable type {@see JFilterInput::clean()}. */ - function _cleanVar($var, $mask = 0, $type = null) + private static function _cleanVar($var, $mask = 0, $type=null) { // Static input filters for specific settings static $noHtmlFilter = null; static $safeHtmlFilter = null; // If the no trim flag is not set, trim the variable - if (!($mask & JREQUEST_NOTRIM) && is_string($var)) { + if (!($mask & 1) && is_string($var)) { $var = trim($var); } // Now we handle input filtering - if ($mask & JREQUEST_ALLOWRAW) + if ($mask & 2) { // If the allow raw flag is set, do not modify the variable $var = $var; } - elseif ($mask & JREQUEST_ALLOWHTML) + elseif ($mask & 4) { // If the allow html flag is set, apply a safe html filter to the variable if (is_null($safeHtmlFilter)) { @@ -591,11 +585,9 @@ function _cleanVar($var, $mask = 0, $type = null) * @param array $array Array of (nested arrays of) strings * @return array The input array with stripshlashes applied to it */ - function _stripSlashesRecursive( $value ) + private static function _stripSlashesRecursive( $value ) { - $value = is_array( $value ) - ? array_map( array( 'JRequest', '_stripSlashesRecursive' ), $value ) - : stripslashes( $value ); + $value = is_array( $value ) ? array_map( array( 'JRequest', '_stripSlashesRecursive' ), $value ) : stripslashes( $value ); return $value; } -} \ No newline at end of file +} diff --git a/libraries/joomla/environment/response.php b/libraries/joomla/environment/response.php index f428f3bb5ac19..93a118c9cfa0e 100644 --- a/libraries/joomla/environment/response.php +++ b/libraries/joomla/environment/response.php @@ -12,14 +12,6 @@ * See COPYRIGHT.php for copyright notices and details. */ -/** - * Create the response global object - */ -$GLOBALS['_JRESPONSE'] = new stdClass(); -$GLOBALS['_JRESPONSE']->cachable = false; -$GLOBALS['_JRESPONSE']->headers = array(); -$GLOBALS['_JRESPONSE']->body = array(); - /** * JResponse Class * @@ -27,13 +19,16 @@ * response variables. This includes header and body. * * @static - * @author Johan Janssens * @package Joomla.Framework * @subpackage Environment * @since 1.5 */ -class JResponse +abstract class JResponse { + private static $cachable = false; + private static $headers = array(); + private static $body = array(); + /** * Set/get cachable state for the response * @@ -44,12 +39,12 @@ class JResponse * @return boolean True of browser caching should be allowed * @since 1.5 */ - function allowCache($allow = null) + public static function allowCache($allow = null) { if (!is_null($allow)) { - $GLOBALS['_JRESPONSE']->cachable = (bool) $allow; + JResponse::$cachable = (bool) $allow; } - return $GLOBALS['_JRESPONSE']->cachable; + return JResponse::$cachable; } /** @@ -63,21 +58,21 @@ function allowCache($allow = null) * @param string $value * @param boolean $replace */ - function setHeader($name, $value, $replace = false) + public static function setHeader($name, $value, $replace = false) { $name = (string) $name; $value = (string) $value; if ($replace) { - foreach ($GLOBALS['_JRESPONSE']->headers as $key => $header) { + foreach (JResponse::$headers as $key => $header) { if ($name == $header['name']) { - unset($GLOBALS['_JRESPONSE']->headers[$key]); + unset(JResponse::$headers[$key]); } } } - $GLOBALS['_JRESPONSE']->headers[] = array( + JResponse::$headers[] = array( 'name' => $name, 'value' => $value ); @@ -89,8 +84,8 @@ function setHeader($name, $value, $replace = false) * @access public * @return array */ - function getHeaders() { - return $GLOBALS['_JRESPONSE']->headers; + public static function getHeaders() { + return JResponse::$headers; } /** @@ -98,8 +93,8 @@ function getHeaders() { * * @access public */ - function clearHeaders() { - $GLOBALS['_JRESPONSE']->headers = array(); + public static function clearHeaders() { + JResponse::$headers = array(); } /** @@ -108,11 +103,11 @@ function clearHeaders() { * @access public * @return void */ - function sendHeaders() + public static function sendHeaders() { if (!headers_sent()) { - foreach ($GLOBALS['_JRESPONSE']->headers as $header) + foreach (JResponse::$headers as $header) { if ('status' == strtolower($header['name'])) { @@ -133,8 +128,8 @@ function sendHeaders() * @access public * @param string $content */ - function setBody($content) { - $GLOBALS['_JRESPONSE']->body = array((string) $content); + public static function setBody($content) { + JResponse::$body = array((string) $content); } /** @@ -143,8 +138,8 @@ function setBody($content) { * @access public * @param string $content */ - function prependBody($content) { - array_unshift($GLOBALS['_JRESPONSE']->body, (string) $content); + public static function prependBody($content) { + array_unshift(JResponse::$body, (string) $content); } /** @@ -153,8 +148,8 @@ function prependBody($content) { * @access public * @param string $content */ - function appendBody($content) { - array_push($GLOBALS['_JRESPONSE']->body, (string) $content); + public static function appendBody($content) { + array_push(JResponse::$body, (string) $content); } /** @@ -165,14 +160,14 @@ function appendBody($content) { * array of strings or as a single string; defaults to false * @return string|array */ - function getBody($toArray = false) + public static function getBody($toArray = false) { if ($toArray) { - return $GLOBALS['_JRESPONSE']->body; + return JResponse::$body; } ob_start(); - foreach ($GLOBALS['_JRESPONSE']->body as $content) { + foreach (JResponse::$body as $content) { echo $content; } return ob_get_clean(); @@ -185,7 +180,7 @@ function getBody($toArray = false) * @param boolean $compress If true, compress the data * @return string */ - function toString($compress = false) + public static function toString($compress = false) { $data = JResponse::getBody(); @@ -216,7 +211,7 @@ function toString($compress = false) * @param string data * @return string compressed data */ - function _compress( $data ) + private static function _compress( $data ) { $encoding = JResponse::_clientEncoding(); @@ -261,7 +256,7 @@ function _compress( $data ) * @access private * @return boolean */ - function _clientEncoding() + private static function _clientEncoding() { if (!isset($_SERVER['HTTP_ACCEPT_ENCODING'])) { return false; diff --git a/libraries/joomla/environment/uri.php b/libraries/joomla/environment/uri.php index 9585fa5f9f7fc..b943bc1e57b05 100644 --- a/libraries/joomla/environment/uri.php +++ b/libraries/joomla/environment/uri.php @@ -1,756 +1,724 @@ - - * @package Joomla.Framework - * @subpackage Environment - * @since 1.5 - */ -class JURI extends JObject -{ - /** - * Original URI - * - * @var string - */ - var $_uri = null; - - /** - * Protocol - * - * @var string - */ - var $_scheme = null; - - /** - * Host - * - * @var string - */ - var $_host = null; - - /** - * Port - * - * @var integer - */ - var $_port = null; - - /** - * Username - * - * @var string - */ - var $_user = null; - - /** - * Password - * - * @var string - */ - var $_pass = null; - - /** - * Path - * - * @var string - */ - var $_path = null; - - /** - * Query - * - * @var string - */ - var $_query = null; - - /** - * Anchor - * - * @var string - */ - var $_fragment = null; - - /** - * Query variable hash - * - * @var array - */ - var $_vars = array (); - - /** - * Constructor. - * You can pass a URI string to the constructor to initialize a specific URI. - * - * @param string $uri The optional URI string - */ - function __construct($uri = null) - { - if ($uri !== null) { - $this->parse($uri); - } - } - - /** - * Returns a reference to a global JURI object, only creating it - * if it doesn't already exist. - * - * This method must be invoked as: - *
        $uri =& JURI::getInstance([$uri]);
      - * - * @static - * @param string $uri The URI to parse. [optional: if null uses script URI] - * @return JURI The URI object. - * @since 1.5 - */ - function &getInstance($uri = 'SERVER') - { - static $instances = array(); - - if (!isset ($instances[$uri])) - { - // Are we obtaining the URI from the server? - if ($uri == 'SERVER') - { - // Determine if the request was over SSL (HTTPS) - if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) { - $https = 's://'; - } else { - $https = '://'; - } - - /* - * Since we are assigning the URI from the server variables, we first need - * to determine if we are running on apache or IIS. If PHP_SELF and REQUEST_URI - * are present, we will assume we are running on apache. - */ - if (!empty ($_SERVER['PHP_SELF']) && !empty ($_SERVER['REQUEST_URI'])) { - - /* - * To build the entire URI we need to prepend the protocol, and the http host - * to the URI string. - */ - $theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - - /* - * Since we do not have REQUEST_URI to work with, we will assume we are - * running on IIS and will therefore need to work some magic with the SCRIPT_NAME and - * QUERY_STRING environment variables. - */ - } - else - { - // IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS - $theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; - - // If the query string exists append it to the URI string - if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { - $theURI .= '?' . $_SERVER['QUERY_STRING']; - } - } - - // Now we need to clean what we got since we can't trust the server var - $theURI = urldecode($theURI); - $theURI = str_replace('"', '"',$theURI); - $theURI = str_replace('<', '<',$theURI); - $theURI = str_replace('>', '>',$theURI); - $theURI = preg_replace('/eval\((.*)\)/', '', $theURI); - $theURI = preg_replace('/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/', '""', $theURI); - } - else - { - // We were given a URI - $theURI = $uri; - } - - // Create the new JURI instance - $instances[$uri] = new JURI($theURI); - } - return $instances[$uri]; - } - - /** - * Returns the base URI for the request. - * - * @access public - * @static - * @param boolean $pathonly If false, prepend the scheme, host and port information. Default is false. - * @return string The base URI string - * @since 1.5 - */ - function base($pathonly = false) - { - static $base; - - // Get the base request path - if (!isset($base)) - { - $config =& JFactory::getConfig(); - $live_site = $config->getValue('config.live_site'); - if(trim($live_site) != '') { - $uri =& JURI::getInstance($live_site); - $base['prefix'] = $uri->toString( array('scheme', 'host', 'port')); - $base['path'] = rtrim($uri->toString( array('path')), '/\\'); - if(JPATH_BASE == JPATH_ADMINISTRATOR) { - $base['path'] .= '/administrator'; - } - } else { - $uri =& JURI::getInstance(); - $base['prefix'] = $uri->toString( array('scheme', 'host', 'port')); - - if (strpos(php_sapi_name(), 'cgi') !== false && !empty($_SERVER['REQUEST_URI'])) { - //Apache CGI - $base['path'] = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); - } else { - //Others - $base['path'] = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\'); - } - } - } - - return $pathonly === false ? $base['prefix'].$base['path'].'/' : $base['path']; - } - - /** - * Returns the root URI for the request. - * - * @access public - * @static - * @param boolean $pathonly If false, prepend the scheme, host and port information. Default is false. - * @return string The root URI string - * @since 1.5 - */ - function root($pathonly = false, $path = null) - { - static $root; - - // Get the scheme - if(!isset($root)) - { - $uri =& JURI::getInstance(); - $root['prefix'] = $uri->toString( array('scheme', 'host', 'port')); - $root['path'] = JURI::base(true); - } - - // Get the scheme - if(isset($path)) { - $root['path'] = $path; - } - - return $pathonly === false ? $root['prefix'].$root['path'].'/' : $root['path']; - } - - /** - * Returns the URL for the request, minus the query - * - * @access public - * @return string - * @since 1.5 - */ - function current() - { - static $current; - - // Get the current URL - if (!isset($current)) - { - $uri = & JURI::getInstance(); - $current = $uri->toString( array('scheme', 'host', 'port', 'path')); - } - - return $current; - } - - /** - * Parse a given URI and populate the class fields - * - * @access public - * @param string $uri The URI string to parse - * @return boolean True on success - * @since 1.5 - */ - function parse($uri) - { - //Initialize variables - $retval = false; - - // Set the original URI to fall back on - $this->_uri = $uri; - - /* - * Parse the URI and populate the object fields. If URI is parsed properly, - * set method return value to true. - */ - if ($_parts = $this->_parseURL($uri)) { - $retval = true; - } - - //We need to replace & with & for parse_str to work right... - if(isset ($_parts['query']) && strpos($_parts['query'], '&')) { - $_parts['query'] = str_replace('&', '&', $_parts['query']); - } - - $this->_scheme = isset ($_parts['scheme']) ? $_parts['scheme'] : null; - $this->_user = isset ($_parts['user']) ? $_parts['user'] : null; - $this->_pass = isset ($_parts['pass']) ? $_parts['pass'] : null; - $this->_host = isset ($_parts['host']) ? $_parts['host'] : null; - $this->_port = isset ($_parts['port']) ? $_parts['port'] : null; - $this->_path = isset ($_parts['path']) ? $_parts['path'] : null; - $this->_query = isset ($_parts['query'])? $_parts['query'] : null; - $this->_fragment = isset ($_parts['fragment']) ? $_parts['fragment'] : null; - - //parse the query - - if(isset ($_parts['query'])) parse_str($_parts['query'], $this->_vars); - return $retval; - } - - /** - * Returns full uri string - * - * @access public - * @param array $parts An array specifying the parts to render - * @return string The rendered URI string - * @since 1.5 - */ - function toString($parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment')) - { - $query = $this->getQuery(); //make sure the query is created - - $uri = ''; - $uri .= in_array('scheme', $parts) ? (!empty($this->_scheme) ? $this->_scheme.'://' : '') : ''; - $uri .= in_array('user', $parts) ? $this->_user : ''; - $uri .= in_array('pass', $parts) ? (!empty ($this->_pass) ? ':' : '') .$this->_pass. (!empty ($this->_user) ? '@' : '') : ''; - $uri .= in_array('host', $parts) ? $this->_host : ''; - $uri .= in_array('port', $parts) ? (!empty ($this->_port) ? ':' : '').$this->_port : ''; - $uri .= in_array('path', $parts) ? $this->_path : ''; - $uri .= in_array('query', $parts) ? (!empty ($query) ? '?'.$query : '') : ''; - $uri .= in_array('fragment', $parts)? (!empty ($this->_fragment) ? '#'.$this->_fragment : '') : ''; - - return $uri; - } - - /** - * Adds a query variable and value, replacing the value if it - * already exists and returning the old value. - * - * @access public - * @param string $name Name of the query variable to set - * @param string $value Value of the query variable - * @return string Previous value for the query variable - * @since 1.5 - */ - function setVar($name, $value) - { - $tmp = @$this->_vars[$name]; - $this->_vars[$name] = $value; - - //empty the query - $this->_query = null; - - return $tmp; - } - - /** - * Returns a query variable by name - * - * @access public - * @param string $name Name of the query variable to get - * @return array Query variables - * @since 1.5 - */ - function getVar($name = null, $default=null) - { - if(isset($this->_vars[$name])) { - return $this->_vars[$name]; - } - return $default; - } - - /** - * Removes an item from the query string variables if it exists - * - * @access public - * @param string $name Name of variable to remove - * @since 1.5 - */ - function delVar($name) - { - if (in_array($name, array_keys($this->_vars))) - { - unset ($this->_vars[$name]); - - //empty the query - $this->_query = null; - } - } - - /** - * Sets the query to a supplied string in format: - * foo=bar&x=y - * - * @access public - * @param mixed (array|string) $query The query string - * @since 1.5 - */ - function setQuery($query) - { - if(!is_array($query)) { - if(strpos($query, '&') !== false) - { - $query = str_replace('&','&',$query); - } - parse_str($query, $this->_vars); - } - - if(is_array($query)) { - $this->_vars = $query; - } - - //empty the query - $this->_query = null; - } - - /** - * Returns flat query string - * - * @access public - * @return string Query string - * @since 1.5 - */ - function getQuery($toArray = false) - { - if($toArray) { - return $this->_vars; - } - - //If the query is empty build it first - if(is_null($this->_query)) { - $this->_query = $this->buildQuery($this->_vars); - } - - return $this->_query; - } - - /** - * Build a query from a array (reverse of the PHP parse_str()) - * - * @access public - * @return string The resulting query string - * @since 1.5 - * @see parse_str() - */ - function buildQuery ($params, $akey = null) - { - if ( !is_array($params) || count($params) == 0 ) { - return false; - } - - $out = array(); - - //reset in case we are looping - if( !isset($akey) && !count($out) ) { - unset($out); - $out = array(); - } - - foreach ( $params as $key => $val ) - { - if ( is_array($val) ) { - $out[] = JURI::buildQuery($val,$key); - continue; - } - - $thekey = ( !$akey ) ? $key : $akey.'[]'; - $out[] = $thekey."=".urlencode($val); - } - - return implode("&",$out); - } - - /** - * Get URI scheme (protocol) - * ie. http, https, ftp, etc... - * - * @access public - * @return string The URI scheme - * @since 1.5 - */ - function getScheme() { - return $this->_scheme; - } - - /** - * Set URI scheme (protocol) - * ie. http, https, ftp, etc... - * - * @access public - * @param string $scheme The URI scheme - * @since 1.5 - */ - function setScheme($scheme) { - $this->_scheme = $scheme; - } - - /** - * Get URI username - * returns the username, or null if no username was specified - * - * @access public - * @return string The URI username - * @since 1.5 - */ - function getUser() { - return $this->_user; - } - - /** - * Set URI username - * - * @access public - * @param string $user The URI username - * @since 1.5 - */ - function setUser($user) { - $this->_user = $user; - } - - /** - * Get URI password - * returns the password, or null if no password was specified - * - * @access public - * @return string The URI password - * @since 1.5 - */ - function getPass() { - return $this->_pass; - } - - /** - * Set URI password - * - * @access public - * @param string $pass The URI password - * @since 1.5 - */ - function setPass($pass) { - $this->_pass = $pass; - } - - /** - * Get URI host - * returns the hostname/ip, or null if no hostname/ip was specified - * - * @access public - * @return string The URI host - * @since 1.5 - */ - function getHost() { - return $this->_host; - } - - /** - * Set URI host - * - * @access public - * @param string $host The URI host - * @since 1.5 - */ - function setHost($host) { - $this->_host = $host; - } - - /** - * Get URI port - * returns the port number, or null if no port was specified - * - * @access public - * @return int The URI port number - */ - function getPort() { - return (isset ($this->_port)) ? $this->_port : null; - } - - /** - * Set URI port - * - * @access public - * @param int $port The URI port number - * @since 1.5 - */ - function setPort($port) { - $this->_port = $port; - } - - /** - * Gets the URI path string - * - * @access public - * @return string The URI path string - * @since 1.5 - */ - function getPath() { - return $this->_path; - } - - /** - * Set the URI path string - * - * @access public - * @param string $path The URI path string - * @since 1.5 - */ - function setPath($path) { - $this->_path = $this->_cleanPath($path); - } - - /** - * Get the URI archor string - * everything after the "#" - * - * @access public - * @return string The URI anchor string - * @since 1.5 - */ - function getFragment() { - return $this->_fragment; - } - - /** - * Set the URI anchor string - * everything after the "#" - * - * @access public - * @param string $anchor The URI anchor string - * @since 1.5 - */ - function setFragment($anchor) { - $this->_fragment = $anchor; - } - - /** - * Checks whether the current URI is using HTTPS - * - * @access public - * @return boolean True if using SSL via HTTPS - * @since 1.5 - */ - function isSSL() { - return $this->getScheme() == 'https' ? true : false; - } - - /** - * Resolves //, ../ and ./ from a path and returns - * the result. Eg: - * - * /foo/bar/../boo.php => /foo/boo.php - * /foo/bar/../../boo.php => /boo.php - * /foo/bar/.././/boo.php => /foo/boo.php - * - * @access private - * @param string $uri The URI path to clean - * @return string Cleaned and resolved URI path - * @since 1.5 - */ - function _cleanPath($path) - { - $path = explode('/', preg_replace('#(/+)#', '/', $path)); - - for ($i = 0; $i < count($path); $i ++) { - if ($path[$i] == '.') { - unset ($path[$i]); - $path = array_values($path); - $i --; - - } - elseif ($path[$i] == '..' AND ($i > 1 OR ($i == 1 AND $path[0] != ''))) { - unset ($path[$i]); - unset ($path[$i -1]); - $path = array_values($path); - $i -= 2; - - } - elseif ($path[$i] == '..' AND $i == 1 AND $path[0] == '') { - unset ($path[$i]); - $path = array_values($path); - $i --; - - } else { - continue; - } - } - - return implode('/', $path); - } - - /** - * Backwards compatibility function for parse_url function - * - * This function solves different bugs in PHP versions lower then - * 4.4, will be deprecated in future versions. - * - * @access private - * @return array Associative array containing the URL parts - * @since 1.5 - * @see parse_url() - */ - function _parseURL($uri) - { - $parts = array(); - if (version_compare( phpversion(), '4.4' ) < 0) - { - $regex = "<^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?>"; - $matches = array(); - preg_match($regex, $uri, $matches, PREG_OFFSET_CAPTURE); - - $authority = @$matches[4][0]; - if (strpos($authority, '@') !== false) { - $authority = explode('@', $authority); - @list($parts['user'], $parts['pass']) = explode(':', $authority[0]); - $authority = $authority[1]; - } - - if (strpos($authority, ':') !== false) { - $authority = explode(':', $authority); - $parts['host'] = $authority[0]; - $parts['port'] = $authority[1]; - } else { - $parts['host'] = $authority; - } - - $parts['scheme'] = @$matches[2][0]; - $parts['path'] = @$matches[5][0]; - $parts['query'] = @$matches[7][0]; - $parts['fragment'] = @$matches[9][0]; - } - else - { - $parts = @parse_url($uri); - } - return $parts; - } - - -} +parse($uri); + } + } + + /** + * Returns a reference to a global JURI object, only creating it + * if it doesn't already exist. + * + * This method must be invoked as: + *
        $uri =& JURI::getInstance([$uri]);
      + * + * @static + * @param string $uri The URI to parse. [optional: if null uses script URI] + * @return JURI The URI object. + * @since 1.5 + */ + public static function &getInstance($uri = 'SERVER') + { + static $instances = array(); + + if (!isset ($instances[$uri])) + { + // Are we obtaining the URI from the server? + if ($uri == 'SERVER') + { + // Determine if the request was over SSL (HTTPS) + if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) { + $https = 's://'; + } else { + $https = '://'; + } + + /* + * Since we are assigning the URI from the server variables, we first need + * to determine if we are running on apache or IIS. If PHP_SELF and REQUEST_URI + * are present, we will assume we are running on apache. + */ + if (!empty ($_SERVER['PHP_SELF']) && !empty ($_SERVER['REQUEST_URI'])) { + + /* + * To build the entire URI we need to prepend the protocol, and the http host + * to the URI string. + */ + $theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + + /* + * Since we do not have REQUEST_URI to work with, we will assume we are + * running on IIS and will therefore need to work some magic with the SCRIPT_NAME and + * QUERY_STRING environment variables. + */ + } + else + { + // IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS + $theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; + + // If the query string exists append it to the URI string + if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) { + $theURI .= '?' . $_SERVER['QUERY_STRING']; + } + } + + // Now we need to clean what we got since we can't trust the server var + $theURI = urldecode($theURI); + $theURI = str_replace('"', '"',$theURI); + $theURI = str_replace('<', '<',$theURI); + $theURI = str_replace('>', '>',$theURI); + $theURI = preg_replace('/eval\((.*)\)/', '', $theURI); + $theURI = preg_replace('/[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']/', '""', $theURI); + } + else + { + // We were given a URI + $theURI = $uri; + } + + // Create the new JURI instance + $instances[$uri] = new JURI($theURI); + } + return $instances[$uri]; + } + + /** + * Returns the base URI for the request. + * + * @access public + * @static + * @param boolean $pathonly If false, prepend the scheme, host and port information. Default is false. + * @return string The base URI string + * @since 1.5 + */ + public static function base($pathonly = false) + { + static $base; + + // Get the base request path + if (!isset($base)) + { + $config =& JFactory::getConfig(); + $live_site = $config->getValue('config.live_site'); + if(trim($live_site) != '') { + $uri =& JURI::getInstance($live_site); + $base['prefix'] = $uri->toString( array('scheme', 'host', 'port')); + $base['path'] = rtrim($uri->toString( array('path')), '/\\'); + if(JPATH_BASE == JPATH_ADMINISTRATOR) { + $base['path'] .= '/administrator'; + } + } else { + $uri =& JURI::getInstance(); + $base['prefix'] = $uri->toString( array('scheme', 'host', 'port')); + + if (strpos(php_sapi_name(), 'cgi') !== false && !empty($_SERVER['REQUEST_URI'])) { + //Apache CGI + $base['path'] = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); + } else { + //Others + $base['path'] = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\'); + } + } + } + + return $pathonly === false ? $base['prefix'].$base['path'].'/' : $base['path']; + } + + /** + * Returns the root URI for the request. + * + * @access public + * @static + * @param boolean $pathonly If false, prepend the scheme, host and port information. Default is false. + * @return string The root URI string + * @since 1.5 + */ + public static function root($pathonly = false, $path = null) + { + static $root; + + // Get the scheme + if(!isset($root)) + { + $uri =& JURI::getInstance(JURI::base()); + $root['prefix'] = $uri->toString( array('scheme', 'host', 'port') ); + $root['path'] = rtrim($uri->toString( array('path') ), '/\\'); + } + + // Get the scheme + if(isset($path)) { + $root['path'] = $path; + } + + return $pathonly === false ? $root['prefix'].$root['path'].'/' : $root['path']; + } + + /** + * Returns the URL for the request, minus the query + * + * @access public + * @return string + * @since 1.5 + */ + public static function current() + { + static $current; + + // Get the current URL + if (!isset($current)) + { + $uri = & JURI::getInstance(); + $current = $uri->toString( array('scheme', 'host', 'port', 'path')); + } + + return $current; + } + + /** + * Parse a given URI and populate the class fields + * + * @access public + * @param string $uri The URI string to parse + * @return boolean True on success + * @since 1.5 + */ + public function parse($uri) + { + //Initialize variables + $retval = false; + + // Set the original URI to fall back on + $this->_uri = $uri; + + /* + * Parse the URI and populate the object fields. If URI is parsed properly, + * set method return value to true. + */ + if ($_parts = parse_url($uri)) { + $retval = true; + } + + //We need to replace & with & for parse_str to work right... + if(isset ($_parts['query']) && strpos($_parts['query'], '&')) { + $_parts['query'] = str_replace('&', '&', $_parts['query']); + } + + $this->_scheme = isset ($_parts['scheme']) ? $_parts['scheme'] : null; + $this->_user = isset ($_parts['user']) ? $_parts['user'] : null; + $this->_pass = isset ($_parts['pass']) ? $_parts['pass'] : null; + $this->_host = isset ($_parts['host']) ? $_parts['host'] : null; + $this->_port = isset ($_parts['port']) ? $_parts['port'] : null; + $this->_path = isset ($_parts['path']) ? $_parts['path'] : null; + $this->_query = isset ($_parts['query'])? $_parts['query'] : null; + $this->_fragment = isset ($_parts['fragment']) ? $_parts['fragment'] : null; + + //parse the query + + if(isset ($_parts['query'])) parse_str($_parts['query'], $this->_vars); + return $retval; + } + + /** + * Returns full uri string + * + * @access public + * @param array $parts An array specifying the parts to render + * @return string The rendered URI string + * @since 1.5 + */ + public function toString($parts = array('scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment')) + { + $query = $this->getQuery(); //make sure the query is created + + $uri = ''; + $uri .= in_array('scheme', $parts) ? (!empty($this->_scheme) ? $this->_scheme.'://' : '') : ''; + $uri .= in_array('user', $parts) ? $this->_user : ''; + $uri .= in_array('pass', $parts) ? (!empty ($this->_pass) ? ':' : '') .$this->_pass. (!empty ($this->_user) ? '@' : '') : ''; + $uri .= in_array('host', $parts) ? $this->_host : ''; + $uri .= in_array('port', $parts) ? (!empty ($this->_port) ? ':' : '').$this->_port : ''; + $uri .= in_array('path', $parts) ? $this->_path : ''; + $uri .= in_array('query', $parts) ? (!empty ($query) ? '?'.$query : '') : ''; + $uri .= in_array('fragment', $parts)? (!empty ($this->_fragment) ? '#'.$this->_fragment : '') : ''; + + return $uri; + } + + /** + * Adds a query variable and value, replacing the value if it + * already exists and returning the old value. + * + * @access public + * @param string $name Name of the query variable to set + * @param string $value Value of the query variable + * @return string Previous value for the query variable + * @since 1.5 + */ + public function setVar($name, $value) + { + $tmp = @$this->_vars[$name]; + $this->_vars[$name] = $value; + + //empty the query + $this->_query = null; + + return $tmp; + } + + /** + * Returns a query variable by name + * + * @access public + * @param string $name Name of the query variable to get + * @return array Query variables + * @since 1.5 + */ + public function getVar($name = null, $default=null) + { + if(isset($this->_vars[$name])) { + return $this->_vars[$name]; + } + return $default; + } + + /** + * Removes an item from the query string variables if it exists + * + * @access public + * @param string $name Name of variable to remove + * @since 1.5 + */ + public function delVar($name) + { + if (in_array($name, array_keys($this->_vars))) + { + unset ($this->_vars[$name]); + + //empty the query + $this->_query = null; + } + } + + /** + * Sets the query to a supplied string in format: + * foo=bar&x=y + * + * @access public + * @param mixed (array|string) $query The query string + * @since 1.5 + */ + public function setQuery($query) + { + if(!is_array($query)) { + if(strpos($query, '&') !== false) + { + $query = str_replace('&','&',$query); + } + parse_str($query, $this->_vars); + } + + if(is_array($query)) { + $this->_vars = $query; + } + + //empty the query + $this->_query = null; + } + + /** + * Returns flat query string + * + * @access public + * @return string Query string + * @since 1.5 + */ + public function getQuery($toArray = false) + { + if($toArray) { + return $this->_vars; + } + + //If the query is empty build it first + if(is_null($this->_query)) { + $this->_query = JURI::buildQuery($this->_vars); + } + + return $this->_query; + } + + /** + * Build a query from a array (reverse of the PHP parse_str()) + * + * @access public + * @return string The resulting query string + * @since 1.5 + * @see parse_str() + */ + public static function buildQuery ($params, $akey = null) + { + if ( !is_array($params) || count($params) == 0 ) { + return false; + } + + $out = array(); + + //reset in case we are looping + if( !isset($akey) && !count($out) ) { + unset($out); + $out = array(); + } + + foreach ( $params as $key => $val ) + { + if ( is_array($val) ) { + $out[] = JURI::buildQuery($val,$key); + continue; + } + + $thekey = ( !$akey ) ? $key : $akey.'['.$key.']'; + $out[] = $thekey."=".urlencode($val); + } + + return implode("&",$out); + } + + /** + * Get URI scheme (protocol) + * ie. http, https, ftp, etc... + * + * @access public + * @return string The URI scheme + * @since 1.5 + */ + public function getScheme() { + return $this->_scheme; + } + + /** + * Set URI scheme (protocol) + * ie. http, https, ftp, etc... + * + * @access public + * @param string $scheme The URI scheme + * @since 1.5 + */ + public function setScheme($scheme) { + $this->_scheme = $scheme; + } + + /** + * Get URI username + * returns the username, or null if no username was specified + * + * @access public + * @return string The URI username + * @since 1.5 + */ + public function getUser() { + return $this->_user; + } + + /** + * Set URI username + * + * @access public + * @param string $user The URI username + * @since 1.5 + */ + public function setUser($user) { + $this->_user = $user; + } + + /** + * Get URI password + * returns the password, or null if no password was specified + * + * @access public + * @return string The URI password + * @since 1.5 + */ + public function getPass() { + return $this->_pass; + } + + /** + * Set URI password + * + * @access public + * @param string $pass The URI password + * @since 1.5 + */ + public function setPass($pass) { + $this->_pass = $pass; + } + + /** + * Get URI host + * returns the hostname/ip, or null if no hostname/ip was specified + * + * @access public + * @return string The URI host + * @since 1.5 + */ + public function getHost() { + return $this->_host; + } + + /** + * Set URI host + * + * @access public + * @param string $host The URI host + * @since 1.5 + */ + public function setHost($host) { + $this->_host = $host; + } + + /** + * Get URI port + * returns the port number, or null if no port was specified + * + * @access public + * @return int The URI port number + */ + public function getPort() { + return (isset ($this->_port)) ? $this->_port : null; + } + + /** + * Set URI port + * + * @access public + * @param int $port The URI port number + * @since 1.5 + */ + public function setPort($port) { + $this->_port = $port; + } + + /** + * Gets the URI path string + * + * @access public + * @return string The URI path string + * @since 1.5 + */ + public function getPath() { + return $this->_path; + } + + /** + * Set the URI path string + * + * @access public + * @param string $path The URI path string + * @since 1.5 + */ + public function setPath($path) { + $this->_path = $this->_cleanPath($path); + } + + /** + * Get the URI archor string + * everything after the "#" + * + * @access public + * @return string The URI anchor string + * @since 1.5 + */ + public function getFragment() { + return $this->_fragment; + } + + /** + * Set the URI anchor string + * everything after the "#" + * + * @access public + * @param string $anchor The URI anchor string + * @since 1.5 + */ + public function setFragment($anchor) { + $this->_fragment = $anchor; + } + + /** + * Checks whether the current URI is using HTTPS + * + * @access public + * @return boolean True if using SSL via HTTPS + * @since 1.5 + */ + public function isSSL() { + return $this->getScheme() == 'https' ? true : false; + } + + /** + * Checks if the supplied URL is internal + * + * @access public + * @param string $url The URL to check + * @return boolean True if Internal + * @since 1.5 + */ + public static function isInternal($url) { + $uri =& JURI::getInstance($url); + $base = $uri->toString(array('scheme', 'host', 'port', 'path')); + $host = $uri->toString(array('scheme', 'host', 'port')); + if(stripos($base, JURI::base()) !== 0 && !empty($host)) { + return false; + } + return true; + } + + /** + * Resolves //, ../ and ./ from a path and returns + * the result. Eg: + * + * /foo/bar/../boo.php => /foo/boo.php + * /foo/bar/../../boo.php => /boo.php + * /foo/bar/.././/boo.php => /foo/boo.php + * + * @access private + * @param string $uri The URI path to clean + * @return string Cleaned and resolved URI path + * @since 1.5 + */ + protected function _cleanPath($path) + { + $path = explode('/', preg_replace('#(/+)#', '/', $path)); + + for ($i = 0; $i < count($path); $i ++) { + if ($path[$i] == '.') { + unset ($path[$i]); + $path = array_values($path); + $i --; + + } + elseif ($path[$i] == '..' AND ($i > 1 OR ($i == 1 AND $path[0] != ''))) { + unset ($path[$i]); + unset ($path[$i -1]); + $path = array_values($path); + $i -= 2; + + } + elseif ($path[$i] == '..' AND $i == 1 AND $path[0] == '') { + unset ($path[$i]); + $path = array_values($path); + $i --; + + } else { + continue; + } + } + + return implode('/', $path); + } +} diff --git a/libraries/joomla/error/error.php b/libraries/joomla/error/error.php index 7ee4507c718bc..f0a6ff8b568a1 100644 --- a/libraries/joomla/error/error.php +++ b/libraries/joomla/error/error.php @@ -1,575 +1,630 @@ - 'Notice', - E_WARNING => 'Warning', - E_ERROR => 'Error' -); - -/* - * Default error handlers - */ -$GLOBALS['_JERROR_HANDLERS'] = array( - E_NOTICE => array( 'mode' => 'message' ), - E_WARNING => array( 'mode' => 'message' ), - E_ERROR => array( 'mode' => 'callback', 'options' => array('JError','customErrorPage') ) -); - -/** - * Error Handling Class - * - * This class is inspired in design and concept by patErrorManager - * - * patErrorManager contributors include: - * - gERD Schaufelberger - * - Sebastian Mordziol - * - Stephan Schmidt - * - * @static - * @author Louis Landry - * @author Johan Janssens - * @package Joomla.Framework - * @subpackage Error - * @since 1.5 - */ -class JError -{ - /** - * Method to determine if a value is an exception object. This check supports both JException and PHP5 Exception objects - * - * @static - * @access public - * @param mixed &$object Object to check - * @return boolean True if argument is an exception, false otherwise. - * @since 1.5 - */ - function isError(& $object) - { - if (!is_object($object)) { - return false; - } - // supports PHP 5 exception handling - return is_a($object, 'JException') || is_a($object, 'JError') || is_a($object, 'Exception'); - } - - /** - * Method for retrieving the last exception object in the error stack - * - * @static - * @access public - * @return mixed Last exception object in the error stack or boolean false if none exist - * @since 1.5 - */ - function & getError($unset = false) - { - if (!isset($GLOBALS['_JERROR_STACK'][0])) { - $false = false; - return $false; - } - if ($unset) { - $error = array_shift($GLOBALS['_JERROR_STACK']); - } else { - $error = &$GLOBALS['_JERROR_STACK'][0]; - } - return $error; - } - - /** - * Method for retrieving the exception stack - * - * @static - * @access public - * @return array Chronological array of errors that have been stored during script execution - * @since 1.5 - */ - function & getErrors() - { - return $GLOBALS['_JERROR_STACK']; - } - - /** - * Create a new JException object given the passed arguments - * - * @static - * @param int $level The error level - use any of PHP's own error levels for this: E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE. - * @param string $code The application-internal error code for this error - * @param string $msg The error message, which may also be shown the user if need be. - * @param mixed $info Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN). - * @return mixed The JException object - * @since 1.5 - * - * @see JException - */ - function & raise($level, $code, $msg, $info = null, $backtrace = false) - { - jimport('joomla.error.exception'); - - // build error object - $exception = new JException($msg, $code, $level, $info, $backtrace); - - // see what to do with this kind of error - $handler = JError::getErrorHandling($level); - - $function = 'handle'.ucfirst($handler['mode']); - if (is_callable(array('JError', $function))) { - $reference =& JError::$function ($exception, (isset($handler['options'])) ? $handler['options'] : array()); - } else { - // This is required to prevent a very unhelpful white-screen-of-death - jexit( - 'JError::raise -> Static method JError::' . $function . ' does not exist.' . - ' Contact a developer to debug' . - '
      Error was ' . - '
      ' . $exception->getMessage() - ); - } - - //store and return the error - $GLOBALS['_JERROR_STACK'][] =& $reference; - return $reference; - } - - /** - * Wrapper method for the {@link raise()} method with predefined error level of E_ERROR and backtrace set to true. - * - * @static - * @param string $code The application-internal error code for this error - * @param string $msg The error message, which may also be shown the user if need be. - * @param mixed $info Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN). - * @return object $error The configured JError object - * @since 1.5 - */ - function & raiseError($code, $msg, $info = null) - { - $reference = & JError::raise(E_ERROR, $code, $msg, $info, true); - return $reference; - } - - /** - * Wrapper method for the {@link raise()} method with predefined error level of E_WARNING and backtrace set to false. - * - * @static - * @param string $code The application-internal error code for this error - * @param string $msg The error message, which may also be shown the user if need be. - * @param mixed $info Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN). - * @return object $error The configured JError object - * @since 1.5 - */ - function & raiseWarning($code, $msg, $info = null) - { - $reference = & JError::raise(E_WARNING, $code, $msg, $info); - return $reference; - } - - /** - * Wrapper method for the {@link raise()} method with predefined error level of E_NOTICE and backtrace set to false. - * - * @static - * @param string $code The application-internal error code for this error - * @param string $msg The error message, which may also be shown the user if need be. - * @param mixed $info Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN). - * @return object $error The configured JError object - * @since 1.5 - */ - function & raiseNotice($code, $msg, $info = null) - { - $reference = & JError::raise(E_NOTICE, $code, $msg, $info); - return $reference; - } - - /** - * Method to get the current error handler settings for a specified error level. - * - * @static - * @param int $level The error level to retrieve. This can be any of PHP's own error levels, e.g. E_ALL, E_NOTICE... - * @return array All error handling details - * @since 1.5 - */ - function getErrorHandling( $level ) - { - return $GLOBALS['_JERROR_HANDLERS'][$level]; - } - - /** - * Method to set the way the JError will handle different error levels. Use this if you want to override the default settings. - * - * Error handling modes: - * - ignore - * - echo - * - verbose - * - die - * - message - * - log - * - callback - * - * You may also set the error handling for several modes at once using PHP's bit operations. - * Examples: - * - E_ALL = Set the handling for all levels - * - E_ERROR | E_WARNING = Set the handling for errors and warnings - * - E_ALL ^ E_ERROR = Set the handling for all levels except errors - * - * @static - * @param int $level The error level for which to set the error handling - * @param string $mode The mode to use for the error handling. - * @param mixed $options Optional: Any options needed for the given mode. - * @return mixed True on success, or a JException object if failed. - * @since 1.5 - */ - function setErrorHandling($level, $mode, $options = null) - { - $levels = $GLOBALS['_JERROR_LEVELS']; - - $function = 'handle'.ucfirst($mode); - if (!is_callable(array ('JError',$function))) { - return JError::raiseError(E_ERROR, 'JError:'.JERROR_ILLEGAL_MODE, 'Error Handling mode is not known', 'Mode: '.$mode.' is not implemented.'); - } - - foreach ($levels as $eLevel => $eTitle) { - if (($level & $eLevel) != $eLevel) { - continue; - } - - // set callback options - if ($mode == 'callback') { - if (!is_array($options)) { - return JError::raiseError(E_ERROR, 'JError:'.JERROR_ILLEGAL_OPTIONS, 'Options for callback not valid'); - } - - if (!is_callable($options)) { - $tmp = array ('GLOBAL'); - if (is_array($options)) { - $tmp[0] = $options[0]; - $tmp[1] = $options[1]; - } else { - $tmp[1] = $options; - } - - return JError::raiseError(E_ERROR, 'JError:'.JERROR_CALLBACK_NOT_CALLABLE, 'Function is not callable', 'Function:'.$tmp[1].' scope '.$tmp[0].'.'); - } - } - - // save settings - $GLOBALS['_JERROR_HANDLERS'][$eLevel] = array ('mode' => $mode); - if ($options != null) { - $GLOBALS['_JERROR_HANDLERS'][$eLevel]['options'] = $options; - } - } - - return true; - } - - /** - * Method that attaches the error handler to JError - * - * @access public - * @see set_error_handler - */ - function attachHandler() - { - set_error_handler(array('JError', 'customErrorHandler')); - } - - /** - * Method that dettaches the error handler from JError - * - * @access public - * @see restore_error_handler - */ - function detachHandler() - { - restore_error_handler(); - } - - /** - * Method to register a new error level for handling errors - * - * This allows you to add custom error levels to the built-in - * - E_NOTICE - * - E_WARNING - * - E_NOTICE - * - * @static - * @param int $level Error level to register - * @param string $name Human readable name for the error level - * @param string $handler Error handler to set for the new error level [optional] - * @return boolean True on success; false if the level already has been registered - * @since 1.5 - */ - function registerErrorLevel( $level, $name, $handler = 'ignore' ) - { - if( isset($GLOBALS['_JERROR_LEVELS'][$level]) ) { - return false; - } - $GLOBALS['_JERROR_LEVELS'][$level] = $name; - JError::setErrorHandling($level, $handler); - return true; - } - - /** - * Translate an error level integer to a human readable string - * e.g. E_ERROR will be translated to 'Error' - * - * @static - * @param int $level Error level to translate - * @return mixed Human readable error level name or boolean false if it doesn't exist - * @since 1.5 - */ - function translateErrorLevel( $level ) - { - if( isset($GLOBALS['_JERROR_LEVELS'][$level]) ) { - return $GLOBALS['_JERROR_LEVELS'][$level]; - } - return false; - } - - /** - * Ignore error handler - * - Ignores the error - * - * @static - * @param object $error Exception object to handle - * @param array $options Handler options - * @return object The exception object - * @since 1.5 - * - * @see raise() - */ - function & handleIgnore(&$error, $options) - { - return $error; - } - - /** - * Echo error handler - * - Echos the error message to output - * - * @static - * @param object $error Exception object to handle - * @param array $options Handler options - * @return object The exception object - * @since 1.5 - * - * @see raise() - */ - function & handleEcho(&$error, $options) - { - $level_human = JError::translateErrorLevel($error->get('level')); - - if (isset ($_SERVER['HTTP_HOST'])) { - // output as html - echo "
      jos-$level_human: ".$error->get('message')."
      \n"; - } else { - // output as simple text - if (defined('STDERR')) { - fwrite(STDERR, "J$level_human: ".$error->get('message')."\n"); - } else { - echo "J$level_human: ".$error->get('message')."\n"; - } - } - return $error; - } - - /** - * Verbose error handler - * - Echos the error message to output as well as related info - * - * @static - * @param object $error Exception object to handle - * @param array $options Handler options - * @return object The exception object - * @since 1.5 - * - * @see raise() - */ - function & handleVerbose(& $error, $options) - { - $level_human = JError::translateErrorLevel($error->get('level')); - $info = $error->get('info'); - - if (isset ($_SERVER['HTTP_HOST'])) { - // output as html - echo "
      J$level_human: ".$error->get('message')."
      \n"; - if ($info != null) { - echo "   ".$info."
      \n"; - } - echo $error->getBacktrace(true); - } else { - // output as simple text - echo "J$level_human: ".$error->get('message')."\n"; - if ($info != null) { - echo "\t".$info."\n"; - } - - } - return $error; - } - - /** - * Die error handler - * - Echos the error message to output and then dies - * - * @static - * @param object $error Exception object to handle - * @param array $options Handler options - * @return object The exception object - * @since 1.5 - * - * @see raise() - */ - function & handleDie(& $error, $options) - { - $level_human = JError::translateErrorLevel($error->get('level')); - - if (isset ($_SERVER['HTTP_HOST'])) { - // output as html - jexit("
      J$level_human ".$error->get('message')."
      \n"); - } else { - // output as simple text - if (defined('STDERR')) { - fwrite(STDERR, "J$level_human ".$error->get('message')."\n"); - } else { - jexit("J$level_human ".$error->get('message')."\n"); - } - } - return $error; - } - - /** - * Message error handler - * - Enqueues the error message into the system queue - * - * @static - * @param object $error Exception object to handle - * @param array $options Handler options - * @return object The exception object - * @since 1.5 - * - * @see raise() - */ - function & handleMessage(& $error, $options) - { - global $mainframe; - $type = ($error->get('level') == E_NOTICE) ? 'notice' : 'error'; - $mainframe->enqueueMessage($error->get('message'), $type); - return $error; - } - - /** - * Log error handler - * - Logs the error message to a system log file - * - * @static - * @param object $error Exception object to handle - * @param array $options Handler options - * @return object The exception object - * @since 1.5 - * - * @see raise() - */ - function & handleLog(& $error, $options) - { - static $log; - - if ($log == null) - { - jimport('joomla.error.log'); - $fileName = date('Y-m-d').'.error.log'; - $options['format'] = "{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}"; - $log = & JLog::getInstance($fileName, $options); - } - - $entry['level'] = $error->get('level'); - $entry['code'] = $error->get('code'); - $entry['message'] = str_replace(array ("\r","\n"), array ('','\\n'), $error->get('message')); - $log->addEntry($entry); - - return $error; - } - - /** - * Callback error handler - * - Send the error object to a callback method for error handling - * - * @static - * @param object $error Exception object to handle - * @param array $options Handler options - * @return object The exception object - * @since 1.5 - * - * @see raise() - */ - function &handleCallback( &$error, $options ) - { - $result = call_user_func( $options, $error ); - return $result; - } - - /** - * Display a custom error page and exit gracefully - * - * @static - * @param object $error Exception object - * @return void - * @since 1.5 - */ - function customErrorPage(& $error) - { - // Initialize variables - jimport('joomla.document.document'); - $app = & JFactory::getApplication(); - $document = & JDocument::getInstance('error'); - $config = & JFactory::getConfig(); - - // Get the current template from the application - $template = $app->getTemplate(); - - // Push the error object into the document - $document->setError($error); - - @ob_end_clean(); - $document->setTitle(JText::_('Error').': '.$error->code); - $data = $document->render(false, array ( - 'template' => $template, - 'directory' => JPATH_THEMES, - 'debug' => $config->getValue('config.debug') - )); - - JResponse::setBody($data); - echo JResponse::toString(); - $app->close(0); - } - - function customErrorHandler($level, $msg) - { - JError::raise($level, '', $msg); - } -} \ No newline at end of file + + * + * patErrorManager contributors include: + * - gERD Schaufelberger + * - Sebastian Mordziol + * - Stephan Schmidt + * + * @static + * @package Joomla.Framework + * @subpackage Error + * @since 1.5 + */ +abstract class JError +{ + protected static $levels = array( + E_NOTICE => 'Notice', + E_WARNING => 'Warning', + E_ERROR => 'Error' + ); + protected static $handlers = array( + E_NOTICE => array( 'mode' => 'message' ), + E_WARNING => array( 'mode' => 'message' ), + E_ERROR => array( 'mode' => 'callback', 'options' => array('JError','customErrorPage') ) + ); + protected static $stack = array(); + + /** + * Method to determine if a value is an exception object. This check supports both JException and PHP5 Exception objects + * + * @static + * @access public + * @param mixed &$object Object to check + * @return boolean True if argument is an exception, false otherwise. + * @since 1.5 +w + */ + public static function isError(& $object) + { + if (!is_object($object)) { + return false; + } + // supports PHP 5 exception handling + return ($object INSTANCEOF JException || $object INSTANCEOF JError || $object INSTANCEOF Exception); + } + + /** + * Method for retrieving the last exception object in the error stack + * + * @static + * @access public + * @return mixed Last exception object in the error stack or boolean false if none exist + * @since 1.5 + */ + public static function & getError($unset = false) + { + if (!isset(JError::$stack[0])) { + $false = false; + return $false; + } + if ($unset) { + $error = array_shift(JError::$stack[0]); + } else { + $error = &JError::$stack[0]; + } + return $error; + } + + /** + * Method for retrieving the exception stack + * + * @static + * @access public + * @return array Chronological array of errors that have been stored during script execution + * @since 1.5 + */ + public static function & getErrors() + { + return JError::$stack[0]; + } + + /** + * Method to add non-JError thrown JExceptions to the JError stack for debugging purposes + * + * @access public + * @param object JException + * @return void + * @since 1.6 + */ + public static function addToStack(JException &$e) { + JError::$stack[0][] =& $e; + } + + /** + * Create a new JException object given the passed arguments + * + * @static + * @param int $level The error level - use any of PHP's own error levels for this: E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE. + * @param string $code The application-internal error code for this error + * @param string $msg The error message, which may also be shown the user if need be. + * @param mixed $info Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN). + * @return mixed The JException object + * @since 1.5 + * + * @see JException + */ + public static function &raise($level, $code, $msg, $info = null, $backtrace = false) + { + jimport('joomla.error.exception'); + + // build error object + $exception = new JException($msg, $code, $level, $info, $backtrace); + return JError::throwError($exception); + } + + public static function &throwError(&$exception) { + static $thrown = false; + + //if thrown is hit again, we've come back to JError in the middle of throwing another JError, so die! + if($thrown) jexit('Infinite loop detected in JError'); + //add loop check + + $thrown = true; + $level = $exception->get('level'); + + // see what to do with this kind of error + $handler = JError::getErrorHandling($level); + + $function = 'handle'.ucfirst($handler['mode']); + if (is_callable(array('JError', $function))) { + $reference =& call_user_func_array(array('JError',$function), array(&$exception, (isset($handler['options'])) ? $handler['options'] : array())); + } else { + // This is required to prevent a very unhelpful white-screen-of-death + jexit( + 'JError::raise -> Static method JError::' . $function . ' does not exist.' . + ' Contact a developer to debug' . + '
      Error was ' . + '
      ' . $exception->getMessage() + ); + } + //we don't need to store the error, since JException already does that for us! + //remove loop check + $thrown = false; + return $reference; + } + + /** + * Wrapper method for the {@link raise()} method with predefined error level of E_ERROR and backtrace set to true. + * + * @static + * @param string $code The application-internal error code for this error + * @param string $msg The error message, which may also be shown the user if need be. + * @param mixed $info Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN). + * @return object $error The configured JError object + * @since 1.5 + */ + public static function & raiseError($code, $msg, $info = null) + { + $reference = & JError::raise(E_ERROR, $code, $msg, $info, true); + return $reference; + } + + /** + * Wrapper method for the {@link raise()} method with predefined error level of E_WARNING and backtrace set to false. + * + * @static + * @param string $code The application-internal error code for this error + * @param string $msg The error message, which may also be shown the user if need be. + * @param mixed $info Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN). + * @return object $error The configured JError object + * @since 1.5 + */ + public static function & raiseWarning($code, $msg, $info = null) + { + $reference = & JError::raise(E_WARNING, $code, $msg, $info); + return $reference; + } + + /** + * Wrapper method for the {@link raise()} method with predefined error level of E_NOTICE and backtrace set to false. + * + * @static + * @param string $code The application-internal error code for this error + * @param string $msg The error message, which may also be shown the user if need be. + * @param mixed $info Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN). + * @return object $error The configured JError object + * @since 1.5 + */ + public static function & raiseNotice($code, $msg, $info = null) + { + $reference = & JError::raise(E_NOTICE, $code, $msg, $info); + return $reference; + } + + /** + * Method to get the current error handler settings for a specified error level. + * + * @static + * @param int $level The error level to retrieve. This can be any of PHP's own error levels, e.g. E_ALL, E_NOTICE... + * @return array All error handling details + * @since 1.5 + */ + public static function getErrorHandling( $level ) + { + return JError::$handlers[$level]; + } + + /** + * Method to set the way the JError will handle different error levels. Use this if you want to override the default settings. + * + * Error handling modes: + * - ignore + * - echo + * - verbose + * - die + * - message + * - log + * - callback + * + * You may also set the error handling for several modes at once using PHP's bit operations. + * Examples: + * - E_ALL = Set the handling for all levels + * - E_ERROR | E_WARNING = Set the handling for errors and warnings + * - E_ALL ^ E_ERROR = Set the handling for all levels except errors + * + * @static + * @param int $level The error level for which to set the error handling + * @param string $mode The mode to use for the error handling. + * @param mixed $options Optional: Any options needed for the given mode. + * @return mixed True on success, or a JException object if failed. + * @since 1.5 + */ + public static function setErrorHandling($level, $mode, $options = null) + { + $levels = JError::$levels; + + $function = 'handle'.ucfirst($mode); + if (!is_callable(array ('JError',$function))) { + return JError::raiseError(E_ERROR, 'JError:'.JERROR_ILLEGAL_MODE, 'Error Handling mode is not known', 'Mode: '.$mode.' is not implemented.'); + } + + foreach ($levels as $eLevel => $eTitle) { + if (($level & $eLevel) != $eLevel) { + continue; + } + + // set callback options + if ($mode == 'callback') { + if (!is_array($options)) { + return JError::raiseError(E_ERROR, 'JError:'.JERROR_ILLEGAL_OPTIONS, 'Options for callback not valid'); + } + + if (!is_callable($options)) { + $tmp = array ('GLOBAL'); + if (is_array($options)) { + $tmp[0] = $options[0]; + $tmp[1] = $options[1]; + } else { + $tmp[1] = $options; + } + + return JError::raiseError(E_ERROR, 'JError:'.JERROR_CALLBACK_NOT_CALLABLE, 'Function is not callable', 'Function:'.$tmp[1].' scope '.$tmp[0].'.'); + } + } + + // save settings + JError::$handlers[$eLevel] = array ('mode' => $mode); + if ($options != null) { + JError::$handlers[$eLevel]['options'] = $options; + } + } + + return true; + } + + /** + * Method that attaches the error handler to JError + * + * @access public + * @see set_error_handler + */ + public static function attachHandler() + { + set_error_handler(array('JError', 'customErrorHandler')); + } + + /** + * Method that dettaches the error handler from JError + * + * @access public + * @see restore_error_handler + */ + public static function detachHandler() + { + restore_error_handler(); + } + + /** + * Method to register a new error level for handling errors + * + * This allows you to add custom error levels to the built-in + * - E_NOTICE + * - E_WARNING + * - E_NOTICE + * + * @static + * @param int $level Error level to register + * @param string $name Human readable name for the error level + * @param string $handler Error handler to set for the new error level [optional] + * @return boolean True on success; false if the level already has been registered + * @since 1.5 + */ + public static function registerErrorLevel( $level, $name, $handler = 'ignore' ) + { + if( isset(JError::$levels[$level]) ) { + return false; + } + JError::$levels[$level] = $name; + JError::setErrorHandling($level, $handler); + return true; + } + + /** + * Translate an error level integer to a human readable string + * e.g. E_ERROR will be translated to 'Error' + * + * @static + * @param int $level Error level to translate + * @return mixed Human readable error level name or boolean false if it doesn't exist + * @since 1.5 + */ + public static function translateErrorLevel( $level ) + { + if( isset(JError::$levels[$level]) ) { + return JError::$levels[$level]; + } + return false; + } + + /** + * Ignore error handler + * - Ignores the error + * + * @static + * @param object $error Exception object to handle + * @param array $options Handler options + * @return object The exception object + * @since 1.5 + * + * @see raise() + */ + public static function &handleIgnore(&$error, $options) + { + return $error; + } + + /** + * Echo error handler + * - Echos the error message to output + * + * @static + * @param object $error Exception object to handle + * @param array $options Handler options + * @return object The exception object + * @since 1.5 + * + * @see raise() + */ + public static function &handleEcho(&$error, $options) + { + $level_human = JError::translateErrorLevel($error->get('level')); + + if (isset ($_SERVER['HTTP_HOST'])) { + // output as html + echo "
      jos-$level_human: ".$error->get('message')."
      \n"; + } else { + // output as simple text + if (defined('STDERR')) { + fwrite(STDERR, "J$level_human: ".$error->get('message')."\n"); + } else { + echo "J$level_human: ".$error->get('message')."\n"; + } + } + return $error; + } + + /** + * Verbose error handler + * - Echos the error message to output as well as related info + * + * @static + * @param object $error Exception object to handle + * @param array $options Handler options + * @return object The exception object + * @since 1.5 + * + * @see raise() + */ + public static function &handleVerbose(& $error, $options) + { + $level_human = JError::translateErrorLevel($error->get('level')); + $info = $error->get('info'); + + if (isset ($_SERVER['HTTP_HOST'])) { + // output as html + echo "
      J$level_human: ".$error->get('message')."
      \n"; + if ($info != null) { + echo "   ".$info."
      \n"; + } + echo $error->getBacktrace(true); + } else { + // output as simple text + echo "J$level_human: ".$error->get('message')."\n"; + if ($info != null) { + echo "\t".$info."\n"; + } + + } + return $error; + } + + /** + * Die error handler + * - Echos the error message to output and then dies + * + * @static + * @param object $error Exception object to handle + * @param array $options Handler options + * @return object The exception object + * @since 1.5 + * + * @see raise() + */ + public static function &handleDie(& $error, $options) + { + $level_human = JError::translateErrorLevel($error->get('level')); + + if (isset ($_SERVER['HTTP_HOST'])) { + // output as html + jexit("
      J$level_human ".$error->get('message')."
      \n"); + } else { + // output as simple text + if (defined('STDERR')) { + fwrite(STDERR, "J$level_human ".$error->get('message')."\n"); + } else { + jexit("J$level_human ".$error->get('message')."\n"); + } + } + return $error; + } + + /** + * Message error handler + * - Enqueues the error message into the system queue + * + * @static + * @param object $error Exception object to handle + * @param array $options Handler options + * @return object The exception object + * @since 1.5 + * + * @see raise() + */ + public static function & handleMessage(& $error, $options) + { + $appl = JFactory::getApplication(); + $type = ($error->get('level') == E_NOTICE) ? 'notice' : 'error'; + $appl->enqueueMessage($error->get('message'), $type); + return $error; + } + + /** + * Log error handler + * - Logs the error message to a system log file + * + * @static + * @param object $error Exception object to handle + * @param array $options Handler options + * @return object The exception object + * @since 1.5 + * + * @see raise() + */ + public static function & handleLog(& $error, $options) + { + static $log; + + if ($log == null) + { + jimport('joomla.error.log'); + $fileName = date('Y-m-d').'.error.log'; + $options['format'] = "{DATE}\t{TIME}\t{LEVEL}\t{CODE}\t{MESSAGE}"; + $log = & JLog::getInstance($fileName, $options); + } + + $entry['level'] = $error->get('level'); + $entry['code'] = $error->get('code'); + $entry['message'] = str_replace(array ("\r","\n"), array ('','\\n'), $error->get('message')); + $log->addEntry($entry); + + return $error; + } + + /** + * Callback error handler + * - Send the error object to a callback method for error handling + * + * @static + * @param object $error Exception object to handle + * @param array $options Handler options + * @return object The exception object + * @since 1.5 + * + * @see raise() + */ + public static function &handleCallback( &$error, $options ) + { + $result = call_user_func( $options, $error ); + return $result; + } + + /** + * Display a custom error page and exit gracefully + * + * @static + * @param object $error Exception object + * @return void + * @since 1.5 + */ + public static function customErrorPage(& $error) + { + // Initialize variables + jimport('joomla.document.document'); + $app = & JFactory::getApplication(); + $document = & JDocument::getInstance('error'); + $config = & JFactory::getConfig(); + + // Get the current template from the application + $template = $app->getTemplate(); + + // Push the error object into the document + $document->setError($error); + + @ob_end_clean(); + $document->setTitle(JText::_('Error').': '.$error->get('code')); + $data = $document->render(false, array ( + 'template' => $template, + 'directory' => JPATH_THEMES, + 'debug' => $config->getValue('config.debug') + )); + + JResponse::setBody($data); + echo JResponse::toString(); + $app->close(0); + } + + public static function customErrorHandler($level, $msg) + { + JError::raise($level, '', $msg); + } + + public static function renderBacktrace($error) + { + $contents = null; + $backtrace = $error->getTrace(); + if( is_array( $backtrace ) ) + { + ob_start(); + $j = 1; + echo ''; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + echo ' '; + for( $i = count( $backtrace )-1; $i >= 0 ; $i-- ) + { + echo ' '; + echo ' '; + if( isset( $backtrace[$i]['class'] ) ) { + echo ' '; + } else { + echo ' '; + } + if( isset( $backtrace[$i]['file'] ) ) { + echo ' '; + } else { + echo ' '; + } + echo ' '; + $j++; + } + echo '
      Call stack
      #FunctionLocation
      '.$j.''.$backtrace[$i]['class'].$backtrace[$i]['type'].$backtrace[$i]['function'].'()'.$backtrace[$i]['function'].'()'.$backtrace[$i]['file'].':'.$backtrace[$i]['line'].' 
      '; + $contents = ob_get_contents(); + ob_end_clean(); + } + return $contents; + } + +} diff --git a/libraries/joomla/error/exception.php b/libraries/joomla/error/exception.php index 47174c43917fb..962e069ec73c0 100644 --- a/libraries/joomla/error/exception.php +++ b/libraries/joomla/error/exception.php @@ -1,252 +1,306 @@ -level = $level; - $this->code = $code; - $this->message = $msg; - - if ($info != null) { - $this->info = $info; - } - - if ($backtrace && function_exists( 'debug_backtrace' )) - { - $this->backtrace = debug_backtrace(); - - for( $i = count( $this->backtrace ) - 1; $i >= 0; --$i ) - { - ++$i; - if (isset( $this->backtrace[$i]['file'] )) { - $this->file = $this->backtrace[$i]['file']; - } - if (isset( $this->backtrace[$i]['line'] )) { - $this->line = $this->backtrace[$i]['line']; - } - if (isset( $this->backtrace[$i]['class'] )) { - $this->class = $this->backtrace[$i]['class']; - } - if (isset( $this->backtrace[$i]['function'] )) { - $this->function = $this->backtrace[$i]['function']; - } - if (isset( $this->backtrace[$i]['type'] )) { - $this->type = $this->backtrace[$i]['type']; - } - - $this->args = false; - if (isset( $this->backtrace[$i]['args'] )) { - $this->args = $this->backtrace[$i]['args']; - } - break; - } - } - } - - /** - * Method to get the exception message - * - * @final - * @access public - * @return string - * @since 1.5 - */ - function getMessage() - { - return $this->message; - } - - /** - * Method to get the exception code - * - * @final - * @access public - * @return integer - * @since 1.5 - */ - function getCode() - { - return $this->code; - } - - /** - * Method to get the source filename where the exception occured - * - * @final - * @access public - * @return string - * @since 1.5 - */ - function getFile() - { - return $this->file; - } - - /** - * Method to get the source line where the exception occured - * - * @final - * @access public - * @return integer - * @since 1.5 - */ - function getLine() - { - return $this->line; - } - - /** - * Method to get the array of the backtrace() - * - * @final - * @access public - * @return array backtrace - * @since 1.5 - */ - function getTrace() - { - if (isset( $this ) && isset( $this->backtrace )) { - $trace = &$this->backtrace; - } else { - $trace = function_exists( 'debug_backtrace' ) ? debug_backtrace() : null; - } - - return $trace; - } - - /** - * Method to get the formatted backtrace information - * - * @final - * @access public - * @return string Formated string of trace - * @since 1.5 - */ - function getTraceAsString( ) - { - //Get the trace array - $trace = JException::getTrace(); - - $result = ''; - foreach ($trace as $back) - { - if (isset($back['file']) && strpos($back['file'], 'error.php') === false) { - $result .= '
      '.$back['file'].':'.$back['line']; - } - } - return $result; - } - - /** - * Returns to error message - * - * @access public - * @return string Error message - * @since 1.5 - */ - function toString() - { - return $this->message; - } -} \ No newline at end of file +level = $level; + $this->code = $code; + $this->message = $msg; + + if ($info != null) { + $this->info = $info; + } + + if ($backtrace && function_exists( 'debug_backtrace' )) + { + $this->backtrace = debug_backtrace(); + + for( $i = count( $this->backtrace ) - 1; $i >= 0; --$i ) + { + ++$i; + if (isset( $this->backtrace[$i]['file'] )) { + $this->file = $this->backtrace[$i]['file']; + } + if (isset( $this->backtrace[$i]['line'] )) { + $this->line = $this->backtrace[$i]['line']; + } + if (isset( $this->backtrace[$i]['class'] )) { + $this->class = $this->backtrace[$i]['class']; + } + if (isset( $this->backtrace[$i]['function'] )) { + $this->function = $this->backtrace[$i]['function']; + } + if (isset( $this->backtrace[$i]['type'] )) { + $this->type = $this->backtrace[$i]['type']; + } + + $this->args = false; + if (isset( $this->backtrace[$i]['args'] )) { + $this->args = $this->backtrace[$i]['args']; + } + break; + } + } + + //Store exception for debugging purposes!!! + JError::addToStack($this); + + parent::__construct($msg, (int) $code); + } + + /** + * Returns to error message + * + * @access public + * @return string Error message + * @since 1.5 + */ + public function toString() + { + return $this->message; + } + + /** + * Returns a property of the object or the default value if the property is not set. + * + * @access public + * @param string $property The name of the property + * @param mixed $default The default value + * @return mixed The value of the property + * @see getProperties() + * @since 1.5 + */ + public function get($property, $default=null) + { + if(isset($this->$property)) { + return $this->$property; + } + return $default; + } + + /** + * Returns an associative array of object properties + * + * @access public + * @param boolean $public If true, returns only the public properties + * @return array + * @see get() + * @since 1.5 + */ + public function getProperties( $public = true ) + { + $vars = get_object_vars($this); + if($public) + { + foreach ($vars as $key => $value) + { + if ('_' == substr($key, 0, 1)) { + unset($vars[$key]); + } + } + } + return $vars; + } + + /** + * Get the most recent error message + * + * @param integer $i Option error index + * @param boolean $toString Indicates if JError objects should return their error message + * @return string Error message + * @access public + * @since 1.5 + */ + public function getError($i = null, $toString = true ) + { + // Find the error + if ( $i === null) { + // Default, return the last message + $error = end($this->_errors); + } + else + if ( ! array_key_exists($i, $this->_errors) ) { + // If $i has been specified but does not exist, return false + return false; + } + else { + $error = $this->_errors[$i]; + } + + // Check if only the string is requested + if ( JError::isError($error) && $toString ) { + return $error->toString(); + } + + return $error; + } + + /** + * Return all errors, if any + * + * @access public + * @return array Array of error messages or JErrors + * @since 1.5 + */ + public function getErrors() + { + return $this->_errors; + } + + + /** + * Modifies a property of the object, creating it if it does not already exist. + * + * @access public + * @param string $property The name of the property + * @param mixed $value The value of the property to set + * @return mixed Previous value of the property + * @see setProperties() + * @since 1.5 + */ + public function set( $property, $value = null ) + { + $previous = isset($this->$property) ? $this->$property : null; + $this->$property = $value; + return $previous; + } + + /** + * Set the object properties based on a named array/hash + * + * @access protected + * @param $array mixed Either and associative array or another object + * @return boolean + * @see set() + * @since 1.5 + */ + public function setProperties( $properties ) + { + $properties = (array) $properties; //cast to an array + + if (is_array($properties)) + { + foreach ($properties as $k => $v) { + $this->$k = $v; + } + + return true; + } + + return false; + } + + /** + * Add an error message + * + * @param string $error Error message + * @access public + * @since 1.0 + */ + public function setError($error) + { + array_push($this->_errors, $error); + } + +} diff --git a/libraries/joomla/error/index.html b/libraries/joomla/error/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/error/index.html +++ b/libraries/joomla/error/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/error/log.php b/libraries/joomla/error/log.php index 8bd5cbfac8b2e..d1db7db8abb3a 100644 --- a/libraries/joomla/error/log.php +++ b/libraries/joomla/error/log.php @@ -21,7 +21,6 @@ * This class is designed to build log files based on the * W3C specification at: http://www.w3.org/TR/WD-logfile.html * - * @author Louis Landry * @package Joomla.Framework * @subpackage Error * @since 1.5 @@ -32,19 +31,19 @@ class JLog extends JObject * Log File Pointer * @var resource */ - var $_file; + protected $_file; /** * Log File Path * @var string */ - var $_path; + protected $_path; /** * Log Format * @var string */ - var $_format = "{DATE}\t{TIME}\t{LEVEL}\t{C-IP}\t{STATUS}\t{COMMENT}"; + protected $_format = "{DATE}\t{TIME}\t{LEVEL}\t{C-IP}\t{STATUS}\t{COMMENT}"; /** * Constructor @@ -54,7 +53,7 @@ class JLog extends JObject * @param array $options Log file options * @since 1.5 */ - function __construct($path, $options) + protected function __construct($path, $options) { // Set default values $this->_path = $path; @@ -73,7 +72,7 @@ function __construct($path, $options) * @return object The JLog object. * @since 1.5 */ - function & getInstance($file = 'error.php', $options = null, $path = null) + public static function &getInstance($file = 'error.php', $options = null, $path = null) { static $instances; @@ -85,7 +84,7 @@ function & getInstance($file = 'error.php', $options = null, $path = null) } jimport('joomla.filesystem.path'); - $path = JPath :: clean($path . DS . $file); + $path = JPath::clean($path . DS . $file); $sig = md5($path); if (!isset ($instances)) { @@ -107,7 +106,7 @@ function & getInstance($file = 'error.php', $options = null, $path = null) * @return boolean True if successful * @since 1.5 */ - function setOptions($options) { + public function setOptions($options) { if (isset ($options['format'])) { $this->_format = $options['format']; @@ -115,7 +114,7 @@ function setOptions($options) { return true; } - function addEntry($entry) + public function addEntry($entry) { // Set some default field values if not already set. $date =& JFactory::getDate(); @@ -165,7 +164,7 @@ function addEntry($entry) * @return boolean True on success * @since 1.5 */ - function _openLog() + protected function _openLog() { // Only open if not already opened... if (is_resource($this->_file)) { @@ -222,7 +221,7 @@ function _openLog() * @return boolean True on success * @since 1.5 */ - function _closeLog() + public function _closeLog() { if (is_resource($this->_file)) { fclose($this->_file); diff --git a/libraries/joomla/error/profiler.php b/libraries/joomla/error/profiler.php index cac260e0494e4..1f43e08ae3615 100644 --- a/libraries/joomla/error/profiler.php +++ b/libraries/joomla/error/profiler.php @@ -1,171 +1,170 @@ - - * @package Joomla.Framework - * @subpackage Error - * @since 1.0 - */ -class JProfiler extends JObject -{ - /** - * - * @var int - */ - var $_start = 0; - - /** - * - * @var string - */ - var $_prefix = ''; - - /** - * - * @var array - */ - var $_buffer= null; - - /** - * Constructor - * - * @access protected - * @param string Prefix for mark messages - */ - function __construct( $prefix = '' ) - { - $this->_start = $this->getmicrotime(); - $this->_prefix = $prefix; - $this->_buffer = array(); - } - - /** - * Returns a reference to the global Profiler object, only creating it - * if it doesn't already exist. - * - * This method must be invoked as: - *
        $browser = & JProfiler::getInstance( $prefix );
      - * - * @access public - * @param string Prefix used to distinguish profiler objects. - * @return JProfiler The Profiler object. - */ - function &getInstance($prefix = '') - { - static $instances; - - if (!isset($instances)) { - $instances = array(); - } - - if (empty($instances[$prefix])) { - $instances[$prefix] = new JProfiler($prefix); - } - - return $instances[$prefix]; - } - - /** - * Output a time mark - * - * The mark is returned as text enclosed in
      tags - * with a CSS class of 'profiler'. - * - * @access public - * @param string A label for the time mark - * @return string Mark enclosed in
      tags - */ - function mark( $label ) - { - $mark = $this->_prefix." $label: "; - $mark .= sprintf('%.3f', $this->getmicrotime() - $this->_start) . ' seconds'; - if ( function_exists('memory_get_usage') ) { - $mark .= ', '.sprintf('%0.2f', memory_get_usage() / 1048576 ).' MB'; - } - - $this->_buffer[] = $mark; - return $mark; - } - - /** - * Get the current time. - * - * @access public - * @return float The current time - */ - function getmicrotime() - { - list( $usec, $sec ) = explode( ' ', microtime() ); - return ((float)$usec + (float)$sec); - } - - /** - * Get information about current memory usage. - * - * @access public - * @return int The memory usage - * @link PHP_MANUAL#memory_get_usage - */ - function getMemory() - { - static $isWin; - - if (function_exists( 'memory_get_usage' )) { - return memory_get_usage(); - } else { - // Determine if a windows server - if (is_null( $isWin )) { - $isWin = (substr(PHP_OS, 0, 3) == 'WIN'); - } - - // Initialize variables - $output = array(); - $pid = getmypid(); - - if ($isWin) { - // Windows workaround - @exec( 'tasklist /FI "PID eq ' . $pid . '" /FO LIST', $output ); - if (!isset($output[5])) { - $output[5] = null; - } - return substr( $output[5], strpos( $output[5], ':' ) + 1 ); - } else { - @exec("ps -o rss -p $pid", $output); - return $output[1] *1024; - } - } - } - - /** - * Get all profiler marks. - * - * Returns an array of all marks created since the Profiler object - * was instantiated. Marks are strings as per {@link JProfiler::mark()}. - * - * @access public - * @return array Array of profiler marks - */ - function getBuffer() { - return $this->_buffer; - } -} \ No newline at end of file +_start = $this->getmicrotime(); + $this->_prefix = $prefix; + $this->_buffer = array(); + } + + /** + * Returns a reference to the global Profiler object, only creating it + * if it doesn't already exist. + * + * This method must be invoked as: + *
        $browser = & JProfiler::getInstance( $prefix );
      + * + * @access public + * @param string Prefix used to distinguish profiler objects. + * @return JProfiler The Profiler object. + */ + public static function &getInstance($prefix = '') + { + static $instances; + + if (!isset($instances)) { + $instances = array(); + } + + if (empty($instances[$prefix])) { + $instances[$prefix] = new JProfiler($prefix); + } + + return $instances[$prefix]; + } + + /** + * Output a time mark + * + * The mark is returned as text enclosed in
      tags + * with a CSS class of 'profiler'. + * + * @access public + * @param string A label for the time mark + * @return string Mark enclosed in
      tags + */ + public function mark( $label ) + { + $mark = $this->_prefix." $label: "; + $mark .= sprintf('%.3f', $this->getmicrotime() - $this->_start) . ' seconds'; + if ( function_exists('memory_get_usage') ) { + $mark .= ', '.sprintf('%0.2f', memory_get_usage() / 1048576 ).' MB'; + } + + $this->_buffer[] = $mark; + return $mark; + } + + /** + * Get the current time. + * + * @access public + * @return float The current time + */ + public function getmicrotime() + { + list( $usec, $sec ) = explode( ' ', microtime() ); + return ((float)$usec + (float)$sec); + } + + /** + * Get information about current memory usage. + * + * @access public + * @return int The memory usage + * @link PHP_MANUAL#memory_get_usage + */ + public function getMemory() + { + static $isWin; + + if (function_exists( 'memory_get_usage' )) { + return memory_get_usage(); + } else { + // Determine if a windows server + if (is_null( $isWin )) { + $isWin = (substr(PHP_OS, 0, 3) == 'WIN'); + } + + // Initialize variables + $output = array(); + $pid = getmypid(); + + if ($isWin) { + // Windows workaround + @exec( 'tasklist /FI "PID eq ' . $pid . '" /FO LIST', $output ); + if (!isset($output[5])) { + $output[5] = null; + } + return substr( $output[5], strpos( $output[5], ':' ) + 1 ); + } else { + @exec("ps -o rss -p $pid", $output); + return $output[1] *1024; + } + } + } + + /** + * Get all profiler marks. + * + * Returns an array of all marks created since the Profiler object + * was instantiated. Marks are strings as per {@link JProfiler::mark()}. + * + * @access public + * @return array Array of profiler marks + */ + public function getBuffer() { + return $this->_buffer; + } +} diff --git a/libraries/joomla/event/dispatcher.php b/libraries/joomla/event/dispatcher.php index c6bf49b957612..304298078e6b9 100644 --- a/libraries/joomla/event/dispatcher.php +++ b/libraries/joomla/event/dispatcher.php @@ -1,194 +1,153 @@ - $dispatcher = &JDispatcher::getInstance(); - * - * @access public - * @return JDispatcher The EventDispatcher object. - * @since 1.5 - */ - function & getInstance() - { - static $instance; - - if (!is_object($instance)) { - $instance = new JDispatcher(); - } - - return $instance; - } - - /** - * Registers an event handler to the event dispatcher - * - * @access public - * @param string $event Name of the event to register handler for - * @param string $handler Name of the event handler - * @return void - * @since 1.5 - */ - function register($event, $handler) - { - // Are we dealing with a class or function type handler? - if (function_exists($handler)) - { - // Ok, function type event handler... lets attach it. - $method = array ('event' => $event, 'handler' => $handler); - $this->attach($method); - } - elseif (class_exists($handler)) - { - //Ok, class type event handler... lets instantiate and attach it. - $this->attach(new $handler($this)); - } - else - { - JError::raiseWarning('SOME_ERROR_CODE', 'JDispatcher::register: Event handler not recognized.', 'Handler: '.$handler ); - } - } - - /** - * Triggers an event by dispatching arguments to all observers that handle - * the event and returning their return values. - * - * @access public - * @param string $event The event name - * @param array $args An array of arguments - * @param boolean $doUnpublished [DEPRECATED] - * @return array An array of results from each function call - * @since 1.5 - */ - function trigger($event, $args = null, $doUnpublished = false) - { - // Initialize variables - $result = array (); - - /* - * If no arguments were passed, we still need to pass an empty array to - * the call_user_func_array function. - */ - if ($args === null) { - $args = array (); - } - - /* - * We need to iterate through all of the registered observers and - * trigger the event for each observer that handles the event. - */ - foreach ($this->_observers as $observer) - { - if (is_array($observer)) - { - /* - * Since we have gotten here, we know a little something about - * the observer. It is a function type observer... lets see if - * it handles our event. - */ - if ($observer['event'] == $event) - { - if (function_exists($observer['handler'])) - { - $result[] = call_user_func_array($observer['handler'], $args); - } - else - { - /* - * Couldn't find the function that the observer specified.. - * wierd, lets throw an error. - */ - JError::raiseWarning('SOME_ERROR_CODE', 'JDispatcher::trigger: Event Handler Method does not exist.', 'Method called: '.$observer['handler']); - } - } - else - { - // Handler doesn't handle this event, move on to next observer. - continue; - } - } - elseif (is_object($observer)) - { - /* - * Since we have gotten here, we know a little something about - * the observer. It is a class type observer... lets see if it - * is an object which has an update method. - */ - if (method_exists($observer, 'update')) - { - /* - * Ok, now we know that the observer is both not an array - * and IS an object. Lets trigger its update method if it - * handles the event and return any results. - */ - if (method_exists($observer, $event)) - { - $args['event'] = $event; - $result[] = $observer->update($args); - } - else - { - /* - * Handler doesn't handle this event, move on to next - * observer. - */ - continue; - } - } - else - { - /* - * At this point, we know that the registered observer is - * neither a function type observer nor an object type - * observer. PROBLEM, lets throw an error. - */ - JError::raiseWarning('SOME_ERROR_CODE', 'JDispatcher::trigger: Unknown Event Handler.', $observer ); - } - } - } - return $result; - } + +jimport('joomla.base.observable'); + +/** + * Class to handle dispatching of events. + * + * This is the Observable part of the Observer design pattern + * for the event architecture. + * + * @package Joomla.Framework + * @subpackage Event + * @since 1.5 + * @see JPlugin + * @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:plugins/ Plugins tutorial + */ +class JDispatcher extends JObservable +{ + /** + * Constructor + * + * @access protected + */ + protected function __construct() + { + parent::__construct(); + } + + /** + * Returns a reference to the global Event Dispatcher object, only creating it + * if it doesn't already exist. + * + * This method must be invoked as: + *
        $dispatcher = &JDispatcher::getInstance();
      + * + * @access public + * @return JDispatcher The EventDispatcher object. + * @since 1.5 + */ + public static function & getInstance() + { + static $instance; + + if (!is_object($instance)) { + $instance = new JDispatcher(); + } + + return $instance; + } + + /** + * Registers an event handler to the event dispatcher + * + * @access public + * @param string $event Name of the event to register handler for + * @param string $handler Name of the event handler + * @return void + * @since 1.5 + */ + public function register($event, $handler) + { + // Are we dealing with a class or function type handler? + if (function_exists($handler)) + { + // Ok, function type event handler... lets attach it. + $method = array ('event' => $event, 'handler' => $handler); + $this->attach($method); + } + elseif (class_exists($handler)) + { + //Ok, class type event handler... lets instantiate and attach it. + $this->attach(new $handler($this)); + } + else + { + JError::raiseWarning('SOME_ERROR_CODE', 'JDispatcher::register: Event handler not recognized.', 'Handler: '.$handler ); + } + } + + /** + * Triggers an event by dispatching arguments to all observers that handle + * the event and returning their return values. + * + * @access public + * @param string $event The event name + * @param array $args An array of arguments + * @param boolean $doUnpublished [DEPRECATED] + * @return array An array of results from each function call + * @since 1.5 + */ + public function trigger($event, $args = null, $doUnpublished = false) + { + // Initialize variables + $result = array (); + + /* + * If no arguments were passed, we still need to pass an empty array to + * the call_user_func_array function. + */ + if ($args === null) { + $args = array (); + } + + $event = strtolower($event); + if(!isset($this->_methods[$event]) || empty($this->_methods[$event])) { + //No Plugins Associated To Event! + return $result; + } + //Loop through all plugins having a method matching our event + foreach($this->_methods[$event] AS $key) { + if(!isset($this->_observers[$key])) { + //for some reason there's a disconnect... Continue to next plugin key + continue; + } + if(is_array($this->_observers[$key])) { + if(is_callable($this->_observers[$key]['handler'])) { + $result[] = call_user_func_array($this->_observers[$key]['handler'], $args); + } else { + JError::raiseWarning('SOME_ERROR_CODE', 'JDispatcher::trigger: Event Handler Method does not exist.', 'Method called: '.$observer['handler']); + } + } elseif(is_object($this->_observers[$key])) { + $args['event'] = $event; + if(is_callable(array($this->_observers[$key], 'update'))) { + $result[] = $this->_observers[$key]->update($args); + } else { + /* + * At this point, we know that the registered observer is + * neither a function type observer nor an object type + * observer. PROBLEM, lets throw an error. + */ + JError::raiseWarning('SOME_ERROR_CODE', 'JDispatcher::trigger: Unknown Event Handler.', $observer ); + } + } + } + return $result; + } } + diff --git a/libraries/joomla/event/event.php b/libraries/joomla/event/event.php index 09b34931c0a0f..8b8e84637d5a7 100644 --- a/libraries/joomla/event/event.php +++ b/libraries/joomla/event/event.php @@ -1,73 +1,68 @@ - - * @package Joomla.Framework - * @subpackage Event - * @since 1.5 - */ -class JEvent extends JObserver -{ - - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @since 1.5 - */ - function JEvent(& $subject) { - parent::__construct($subject); - } - - /** - * Method to trigger events - * - * @access public - * @param array Arguments - * @return mixed Routine return value - * @since 1.5 - */ - function update(& $args) - { - /* - * First lets get the event from the argument array. Next we will unset the - * event argument as it has no bearing on the method to handle the event. - */ - $event = $args['event']; - unset($args['event']); - - /* - * If the method to handle an event exists, call it and return its return - * value. If it does not exist, return null. - */ - if (method_exists($this, $event)) { - return call_user_func_array ( array($this, $event), $args ); - } else { - return null; - } - } + * @package Joomla.Framework + * @subpackage Event + * @since 1.5 + */ +abstract class JEvent extends JObserver +{ + + /** + * Constructor + * + * @param object $subject The object to observe + * @since 1.5 + */ + protected function __construct(& $subject) { + parent::__construct($subject); + } + + /** + * Method to trigger events + * + * @access public + * @param array Arguments + * @return mixed Routine return value + * @since 1.5 + */ + public function update(& $args) + { + /* + * First lets get the event from the argument array. Next we will unset the + * event argument as it has no bearing on the method to handle the event. + */ + $event = $args['event']; + unset($args['event']); + + /* + * If the method to handle an event exists, call it and return its return + * value. If it does not exist, return null. + */ + if (method_exists($this, $event)) { + return call_user_func_array ( array($this, $event), $args ); + } else { + return null; + } + } } diff --git a/libraries/joomla/event/index.html b/libraries/joomla/event/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/event/index.html +++ b/libraries/joomla/event/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/factory.php b/libraries/joomla/factory.php index dcc17b2a0b74e..5e986d5bb73b2 100644 --- a/libraries/joomla/factory.php +++ b/libraries/joomla/factory.php @@ -18,8 +18,18 @@ * @package Joomla.Framework * @since 1.5 */ -class JFactory +abstract class JFactory { + public static $application = null; + public static $config = null; + public static $session = null; + public static $language = null; + public static $document = null; + public static $acl = null; + public static $template = null; + public static $database = null; + public static $mailer = null; + /** * Get a application object * @@ -31,11 +41,9 @@ class JFactory * @param array $config An optional associative array of configuration settings. * @return object JApplication */ - function &getApplication($id = null, $config = array(), $prefix='J') + public static function &getApplication($id = null, $config = array(), $prefix='J') { - static $instance; - - if (!is_object($instance)) + if (!is_object(JFactory::$application)) { jimport( 'joomla.application.application' ); @@ -43,10 +51,10 @@ function &getApplication($id = null, $config = array(), $prefix='J') JError::raiseError(500, 'Application Instantiation Error'); } - $instance = JApplication::getInstance($id, $config, $prefix); + JFactory::$application = JApplication::getInstance($id, $config, $prefix); } - return $instance; + return JFactory::$application; } /** @@ -60,20 +68,18 @@ function &getApplication($id = null, $config = array(), $prefix='J') * @param string The type of the configuration file * @return object JRegistry */ - function &getConfig($file = null, $type = 'PHP') + public static function &getConfig($file = null, $type = 'PHP') { - static $instance; - - if (!is_object($instance)) + if (!is_object(JFactory::$config)) { if ($file === null) { $file = dirname(__FILE__).DS.'config.php'; } - $instance = JFactory::_createConfig($file, $type); + JFactory::$config = JFactory::_createConfig($file, $type); } - return $instance; + return JFactory::$config; } /** @@ -86,15 +92,13 @@ function &getConfig($file = null, $type = 'PHP') * @param array An array containing session options * @return object JSession */ - function &getSession($options = array()) + public static function &getSession($options = array()) { - static $instance; - - if (!is_object($instance)) { - $instance = JFactory::_createSession($options); + if (!is_object(JFactory::$session)) { + JFactory::$session = JFactory::_createSession($options); } - return $instance; + return JFactory::$session; } /** @@ -106,21 +110,19 @@ function &getSession($options = array()) * @access public * @return object JLanguage */ - function &getLanguage() + public static function &getLanguage() { - static $instance; - - if (!is_object($instance)) + if (!is_object(JFactory::$language)) { //get the debug configuration setting $conf =& JFactory::getConfig(); $debug = $conf->getValue('config.debug_lang'); - $instance = JFactory::_createLanguage(); - $instance->setDebug($debug); + JFactory::$language = JFactory::_createLanguage(); + JFactory::$language->setDebug($debug); } - return $instance; + return JFactory::$language; } /** @@ -132,15 +134,13 @@ function &getLanguage() * @access public * @return object JLanguage */ - function &getDocument() + public static function &getDocument() { - static $instance; - - if (!is_object( $instance )) { - $instance = JFactory::_createDocument(); + if (!is_object(JFactory::$document)) { + JFactory::$document = JFactory::_createDocument(); } - return $instance; + return JFactory::$document; } /** @@ -154,7 +154,7 @@ function &getDocument() * @access public * @return object JUser */ - function &getUser($id = null) + public static function &getUser($id = null) { jimport('joomla.user.user'); @@ -162,7 +162,7 @@ function &getUser($id = null) { $session =& JFactory::getSession(); $instance =& $session->get('user'); - if (!is_a($instance, 'JUser')) { + if (!$instance INSTANCEOF JUser) { $instance =& JUser::getInstance(); } } @@ -185,7 +185,7 @@ function &getUser($id = null) * @param string The storage method * @return object JCache */ - function &getCache($group = '', $handler = 'callback', $storage = null) + public static function &getCache($group = '', $handler = 'callback', $storage = null) { $handler = ($handler == 'function') ? 'callback' : $handler; @@ -196,11 +196,11 @@ function &getCache($group = '', $handler = 'callback', $storage = null) } $options = array( - 'defaultgroup' => $group, - 'cachebase' => $conf->getValue('config.cache_path'), - 'lifetime' => $conf->getValue('config.cachetime') * 60, // minutes to seconds - 'language' => $conf->getValue('config.language'), - 'storage' => $storage + 'defaultgroup' => $group, + 'cachebase' => $conf->getValue('config.cache_path'), + 'lifetime' => $conf->getValue('config.cachetime') * 60, // minutes to seconds + 'language' => $conf->getValue('config.language'), + 'storage' => $storage ); jimport('joomla.cache.cache'); @@ -213,21 +213,28 @@ function &getCache($group = '', $handler = 'callback', $storage = null) /** * Get an authorization object * - * Returns a reference to the global {@link JAuthorization} object, only creating it + * Returns a reference to the global {@link JACL} object, only creating it * if it doesn't already exist. * * @access public - * @return object JAuthorization + * @return object JACL */ - function &getACL( ) + public static function &getACL( ) { - static $instance; + if (!is_object(JFactory::$acl)) { + jimport( 'joomla.user.authorization' ); + $db =& JFactory::getDBO(); + + $options = array( + 'db' => &$db, + 'db_table_prefix' => $db->getPrefix() . 'core_acl_', + 'debug' => 0 + ); - if (!is_object($instance)) { - $instance = JFactory::_createACL(); + JFactory::$acl = new JAuthorization($options); } - return $instance; + return JFactory::$acl; } /** @@ -239,15 +246,13 @@ function &getACL( ) * @access public * @return object JTemplate */ - function &getTemplate( ) + public static function &getTemplate( ) { - static $instance; - - if (!is_object($instance)) { - $instance = JFactory::_createTemplate(); + if (!is_object(JFactory::$template)) { + JFactory::$template = JFactory::_createTemplate(); } - return $instance; + return JFactory::$template; } /** @@ -258,21 +263,19 @@ function &getTemplate( ) * * @return object JDatabase */ - function &getDBO() + public static function &getDBO() { - static $instance; - - if (!is_object($instance)) + if (!is_object(JFactory::$database)) { //get the debug configuration setting $conf =& JFactory::getConfig(); $debug = $conf->getValue('config.debug'); - $instance = JFactory::_createDBO(); - $instance->debug($debug); + JFactory::$database = JFactory::_createDBO(); + JFactory::$database->debug($debug); } - return $instance; + return JFactory::$database; } /** @@ -284,18 +287,12 @@ function &getDBO() * @access public * @return object JMail */ - function &getMailer( ) + public static function &getMailer( ) { - static $instance; - - if ( ! is_object($instance) ) { - $instance = JFactory::_createMailer(); + if ( ! is_object(JFactory::$mailer) ) { + JFactory::$mailer = JFactory::_createMailer(); } - - // Create a copy of this object - do not return the original because it may be used several times - // PHP4 copies objects by value whereas PHP5 copies by reference - $copy = (PHP_VERSION < 5) ? $instance : clone($instance); - + $copy = clone(JFactory::$mailer); return $copy; } @@ -310,8 +307,7 @@ function &getMailer( ) * string ['cache_time'] with 'RSS' - feed cache time. If not defined defaults to 3600 sec * @return object Parsed XML document object */ - - function &getXMLParser( $type = 'DOM', $options = array()) + public static function &getXMLParser( $type = 'DOM', $options = array()) { $doc = null; @@ -372,7 +368,7 @@ function &getXMLParser( $type = 'DOM', $options = array()) * @param string $editor The editor to load, depends on the editor plugins that are installed * @return object JEditor */ - function &getEditor($editor = null) + public static function &getEditor($editor = null) { jimport( 'joomla.html.editor' ); @@ -395,7 +391,7 @@ function &getEditor($editor = null) * @return object JURI * @since 1.5 */ - function &getURI($uri = 'SERVER') + public static function &getURI($uri = 'SERVER') { jimport('joomla.environment.uri'); @@ -412,7 +408,7 @@ function &getURI($uri = 'SERVER') * @return object JDate * @since 1.5 */ - function &getDate($time = 'now', $tzOffset = 0) + public static function &getDate($time = 'now', $tzOffset = 0) { jimport('joomla.utilities.date'); static $instances; @@ -466,7 +462,7 @@ function &getDate($time = 'now', $tzOffset = 0) * @return object JRegistry * @since 1.5 */ - function &_createConfig($file, $type = 'PHP') + private static function &_createConfig($file, $type = 'PHP') { jimport('joomla.registry.registry'); @@ -492,7 +488,7 @@ function &_createConfig($file, $type = 'PHP') * @return object JSession * @since 1.5 */ - function &_createSession( $options = array()) + private static function &_createSession( $options = array()) { jimport('joomla.session.session'); @@ -511,30 +507,6 @@ function &_createSession( $options = array()) return $session; } - /** - * Create an ACL object - * - * @access private - * @return object JAuthorization - * @since 1.5 - */ - function &_createACL() - { - //TODO :: take the authorization class out of the application package - jimport( 'joomla.user.authorization' ); - - $db =& JFactory::getDBO(); - - $options = array( - 'db' => &$db, - 'db_table_prefix' => $db->getPrefix() . 'core_acl_', - 'debug' => 0 - ); - $acl = new JAuthorization( $options ); - - return $acl; - } - /** * Create an database object * @@ -542,7 +514,7 @@ function &_createACL() * @return object JDatabase * @since 1.5 */ - function &_createDBO() + private static function &_createDBO() { jimport('joomla.database.database'); jimport( 'joomla.database.table' ); @@ -580,7 +552,7 @@ function &_createDBO() * @return object JMail * @since 1.5 */ - function &_createMailer() + private static function &_createMailer() { jimport('joomla.mail.mail'); @@ -627,7 +599,7 @@ function &_createMailer() * @return object JTemplate * @since 1.5 */ - function &_createTemplate($files = array()) + private static function &_createTemplate($files = array()) { jimport('joomla.template.template'); @@ -672,7 +644,7 @@ function &_createTemplate($files = array()) * @return object JLanguage * @since 1.5 */ - function &_createLanguage() + private static function &_createLanguage() { jimport('joomla.language.language'); @@ -691,7 +663,7 @@ function &_createLanguage() * @return object JDocument * @since 1.5 */ - function &_createDocument() + private static function &_createDocument() { jimport('joomla.document.document'); @@ -713,3 +685,4 @@ function &_createDocument() return $doc; } } + diff --git a/libraries/joomla/filesystem/archive.php b/libraries/joomla/filesystem/archive.php index 06cea80998251..d4cae55a77a00 100644 --- a/libraries/joomla/filesystem/archive.php +++ b/libraries/joomla/filesystem/archive.php @@ -1,189 +1,189 @@ -extract($archivename, $extractdir); - } - break; - case 'tar': - $adapter =& JArchive::getAdapter('tar'); - if ($adapter) { - $result = $adapter->extract($archivename, $extractdir); - } - break; - case 'tgz' : - $untar = true; // This format is a tarball gzip'd - case 'gz' : // This may just be an individual file (e.g. sql script) - case 'gzip' : - $adapter =& JArchive::getAdapter('gzip'); - if ($adapter) - { - $config =& JFactory::getConfig(); - $tmpfname = $config->getValue('config.tmp_path').DS.uniqid('gzip'); - $gzresult = $adapter->extract($archivename, $tmpfname); - if (JError::isError($gzresult)) - { - @unlink($tmpfname); - return false; - } - if($untar) - { - // Try to untar the file - $tadapter =& JArchive::getAdapter('tar'); - if ($tadapter) { - $result = $tadapter->extract($tmpfname, $extractdir); - } - } - else - { - $path = JPath::clean($extractdir); - JFolder::create($path); - $result = JFile::copy($tmpfname,$path.DS.JFile::stripExt(JFile::getName(strtolower($archivename)))); - } - @unlink($tmpfname); - } - break; - case 'tbz2' : - $untar = true; // This format is a tarball bzip2'd - case 'bz2' : // This may just be an individual file (e.g. sql script) - case 'bzip2': - $adapter =& JArchive::getAdapter('bzip2'); - if ($adapter) - { - $config =& JFactory::getConfig(); - $tmpfname = $config->getValue('config.tmp_path').DS.uniqid('bzip2'); - $bzresult = $adapter->extract($archivename, $tmpfname); - if (JError::isError($bzresult)) - { - @unlink($tmpfname); - return false; - } - if ($untar) - { - // Try to untar the file - $tadapter =& JArchive::getAdapter('tar'); - if ($tadapter) { - $result = $tadapter->extract($tmpfname, $extractdir); - } - } - else - { - $path = JPath::clean($extractdir); - JFolder::create($path); - $result = JFile::copy($tmpfname,$path.DS.JFile::stripExt(JFile::getName(strtolower($archivename)))); - } - @unlink($tmpfname); - } - break; - default: - JError::raiseWarning(10, JText::_('UNKNOWNARCHIVETYPE')); - return false; - break; - } - - if (! $result || JError::isError($result)) { - return false; - } - return true; - } - - function &getAdapter($type) - { - static $adapters; - - if (!isset($adapters)) { - $adapters = array(); - } - - if (!isset($adapters[$type])) - { - // Try to load the adapter object - $class = 'JArchive'.ucfirst($type); - - if (!class_exists($class)) - { - $path = dirname(__FILE__).DS.'archive'.DS.strtolower($type).'.php'; - if (file_exists($path)) { - require_once($path); - } else { - JError::raiseError(500,JText::_('Unable to load archive')); - } - } - - $adapters[$type] = new $class(); - } - return $adapters[$type]; - } - - /** - * @param string The name of the archive - * @param mixed The name of a single file or an array of files - * @param string The compression for the archive - * @param string Path to add within the archive - * @param string Path to remove within the archive - * @param boolean Automatically append the extension for the archive - * @param boolean Remove for source files - */ - function create($archive, $files, $compress = 'tar', $addPath = '', $removePath = '', $autoExt = false, $cleanUp = false) - { - jimport( 'pear.archive_tar.Archive_Tar' ); - - if (is_string($files)) { - $files = array ($files); - } - if ($autoExt) { - $archive .= '.'.$compress; - } - - $tar = new Archive_Tar( $archive, $compress ); - $tar->setErrorHandling(PEAR_ERROR_PRINT); - $tar->createModify( $files, $addPath, $removePath ); - - if ($cleanUp) { - JFile::delete( $files ); - } - return $tar; - } -} \ No newline at end of file +extract($archivename, $extractdir); + } + break; + case 'tar': + $adapter =& JArchive::getAdapter('tar'); + if ($adapter) { + $result = $adapter->extract($archivename, $extractdir); + } + break; + case 'tgz' : + $untar = true; // This format is a tarball gzip'd + case 'gz' : // This may just be an individual file (e.g. sql script) + case 'gzip' : + $adapter =& JArchive::getAdapter('gzip'); + if ($adapter) + { + $config =& JFactory::getConfig(); + $tmpfname = $config->getValue('config.tmp_path').DS.uniqid('gzip'); + $gzresult = $adapter->extract($archivename, $tmpfname); + if (JError::isError($gzresult)) + { + @unlink($tmpfname); + return false; + } + if($untar) + { + // Try to untar the file + $tadapter =& JArchive::getAdapter('tar'); + if ($tadapter) { + $result = $tadapter->extract($tmpfname, $extractdir); + } + } + else + { + $path = JPath::clean($extractdir); + JFolder::create($path); + $result = JFile::copy($tmpfname,$path.DS.JFile::stripExt(JFile::getName(strtolower($archivename)))); + } + @unlink($tmpfname); + } + break; + case 'tbz2' : + $untar = true; // This format is a tarball bzip2'd + case 'bz2' : // This may just be an individual file (e.g. sql script) + case 'bzip2': + $adapter =& JArchive::getAdapter('bzip2'); + if ($adapter) + { + $config =& JFactory::getConfig(); + $tmpfname = $config->getValue('config.tmp_path').DS.uniqid('bzip2'); + $bzresult = $adapter->extract($archivename, $tmpfname); + if (JError::isError($bzresult)) + { + @unlink($tmpfname); + return false; + } + if ($untar) + { + // Try to untar the file + $tadapter =& JArchive::getAdapter('tar'); + if ($tadapter) { + $result = $tadapter->extract($tmpfname, $extractdir); + } + } + else + { + $path = JPath::clean($extractdir); + JFolder::create($path); + $result = JFile::copy($tmpfname,$path.DS.JFile::stripExt(JFile::getName(strtolower($archivename)))); + } + @unlink($tmpfname); + } + break; + default: + JError::raiseWarning(10, JText::_('UNKNOWNARCHIVETYPE')); + return false; + break; + } + + if (! $result || JError::isError($result)) { + return false; + } + return true; + } + + public static function &getAdapter($type) + { + static $adapters; + + if (!isset($adapters)) { + $adapters = array(); + } + + if (!isset($adapters[$type])) + { + // Try to load the adapter object + $class = 'JArchive'.ucfirst($type); + + if (!class_exists($class)) + { + $path = dirname(__FILE__).DS.'archive'.DS.strtolower($type).'.php'; + if (file_exists($path)) { + require_once $path; + } else { + JError::raiseError(500,JText::_('Unable to load archive')); + } + } + + $adapters[$type] = new $class(); + } + return $adapters[$type]; + } + + /** + * @param string The name of the archive + * @param mixed The name of a single file or an array of files + * @param string The compression for the archive + * @param string Path to add within the archive + * @param string Path to remove within the archive + * @param boolean Automatically append the extension for the archive + * @param boolean Remove for source files + */ + public static function create($archive, $files, $compress = 'tar', $addPath = '', $removePath = '', $autoExt = false, $cleanUp = false) + { + jimport( 'pear.archive_tar.Archive_Tar' ); + + if (is_string($files)) { + $files = array ($files); + } + if ($autoExt) { + $archive .= '.'.$compress; + } + + $tar = new Archive_Tar( $archive, $compress ); + $tar->setErrorHandling(PEAR_ERROR_PRINT); + $tar->createModify( $files, $addPath, $removePath ); + + if ($cleanUp) { + JFile::delete( $files ); + } + return $tar; + } +} diff --git a/libraries/joomla/filesystem/archive/bzip2.php b/libraries/joomla/filesystem/archive/bzip2.php index d5ddc198d053f..e154ef2be7274 100644 --- a/libraries/joomla/filesystem/archive/bzip2.php +++ b/libraries/joomla/filesystem/archive/bzip2.php @@ -11,14 +11,13 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ - + // Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die(); /** * Bzip2 format adapter for the JArchive class * - * @author Louis Landry * @package Joomla.Framework * @subpackage FileSystem * @since 1.5 @@ -29,7 +28,7 @@ class JArchiveBzip2 extends JObject * Bzip2 file data buffer * @var string */ - var $_data = null; + protected $_data = null; /** * Constructor tries to load the bz2 extension of not loaded @@ -38,7 +37,7 @@ class JArchiveBzip2 extends JObject * @return void * @since 1.5 */ - function __construct() + public function __construct() { // Is bz2 extension loaded? If not try to load it if (!extension_loaded('bz2')) { @@ -60,7 +59,7 @@ function __construct() * @return boolean True if successful * @since 1.5 */ - function extract($archive, $destination, $options = array ()) + public function extract($archive, $destination, $options = array ()) { // Initialize variables $this->_data = null; @@ -87,4 +86,4 @@ function extract($archive, $destination, $options = array ()) } return true; } -} \ No newline at end of file +} diff --git a/libraries/joomla/filesystem/archive/gzip.php b/libraries/joomla/filesystem/archive/gzip.php index a5bcac611b32f..e95ef8fb5f5b4 100644 --- a/libraries/joomla/filesystem/archive/gzip.php +++ b/libraries/joomla/filesystem/archive/gzip.php @@ -11,7 +11,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ - + // Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die(); @@ -24,7 +24,6 @@ * @contributor Michael Slusarz * @contributor Michael Cochrane * - * @author Louis Landry * @package Joomla.Framework * @subpackage FileSystem * @since 1.5 @@ -35,7 +34,7 @@ class JArchiveGzip extends JObject * Gzip file flags. * @var array */ - var $_flags = array ( + protected $_flags = array ( 'FTEXT' => 0x01, 'FHCRC' => 0x02, 'FEXTRA' => 0x04, @@ -47,7 +46,7 @@ class JArchiveGzip extends JObject * Gzip file data buffer * @var string */ - var $_data = null; + protected $_data = null; /** * Extract a Gzip compressed file to a given path @@ -59,7 +58,7 @@ class JArchiveGzip extends JObject * @return boolean True if successful * @since 1.5 */ - function extract($archive, $destination, $options = array ()) + public function extract($archive, $destination, $options = array ()) { // Initialize variables $this->_data = null; @@ -95,7 +94,7 @@ function extract($archive, $destination, $options = array ()) * @return int Data position marker for archive * @since 1.5 */ - function _getFilePosition() + protected function _getFilePosition() { // gzipped file... unpack it first $position = 0; @@ -132,4 +131,4 @@ function _getFilePosition() return $position; } -} \ No newline at end of file +} diff --git a/libraries/joomla/filesystem/archive/index.html b/libraries/joomla/filesystem/archive/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/filesystem/archive/index.html +++ b/libraries/joomla/filesystem/archive/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/filesystem/archive/tar.php b/libraries/joomla/filesystem/archive/tar.php index 43756448f9836..8f3cc9d634d54 100644 --- a/libraries/joomla/filesystem/archive/tar.php +++ b/libraries/joomla/filesystem/archive/tar.php @@ -11,7 +11,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ - + // Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die(); @@ -24,7 +24,6 @@ * @contributor Michael Slusarz * @contributor Michael Cochrane * - * @author Louis Landry * @package Joomla.Framework * @subpackage FileSystem * @since 1.5 @@ -35,7 +34,7 @@ class JArchiveTar extends JObject * Tar file types. * @var array */ - var $_types = array ( + protected $_types = array ( 0x0 => 'Unix file', 0x30 => 'File', 0x31 => 'Link', @@ -51,7 +50,7 @@ class JArchiveTar extends JObject * Tar file flags. * @var array */ - var $_flags = array ( + protected $_flags = array ( 'FTEXT' => 0x01, 'FHCRC' => 0x02, 'FEXTRA' => 0x04, @@ -63,13 +62,13 @@ class JArchiveTar extends JObject * Tar file data buffer * @var string */ - var $_data = null; + protected $_data = null; /** * Tar file metadata array * @var array */ - var $_metadata = null; + protected $_metadata = null; /** * Extract a ZIP compressed file to a given path @@ -81,7 +80,7 @@ class JArchiveTar extends JObject * @return boolean True if successful * @since 1.5 */ - function extract($archive, $destination, $options = array ()) + public function extract($archive, $destination, $options = array ()) { // Initialize variables $this->_data = null; @@ -138,7 +137,7 @@ function extract($archive, $destination, $options = array ()) * * @since 1.5 */ - function _getTarInfo(& $data) + protected function _getTarInfo(& $data) { $position = 0; $return_array = array (); @@ -186,4 +185,4 @@ function _getTarInfo(& $data) $this->_metadata = $return_array; return true; } -} \ No newline at end of file +} diff --git a/libraries/joomla/filesystem/archive/zip.php b/libraries/joomla/filesystem/archive/zip.php index c76ff97b7bdd4..080d429502d4d 100644 --- a/libraries/joomla/filesystem/archive/zip.php +++ b/libraries/joomla/filesystem/archive/zip.php @@ -1,504 +1,501 @@ - - * http://www.zend.com/codex.php?id=535&single=1 - * - * Deins125 - * http://www.zend.com/codex.php?id=470&single=1 - * - * The ZIP compression date code is partially based on code from - * Peter Listiak - * - * This class is inspired from and draws heavily in code and concept from the Compress package of - * The Horde Project - * - * @contributor Chuck Hagenbuch - * @contributor Michael Slusarz - * @contributor Michael Cochrane - * - * @author Louis Landry - * @package Joomla.Framework - * @subpackage FileSystem - * @since 1.5 - */ -class JArchiveZip extends JObject -{ - /** - * ZIP compression methods. - * @var array - */ - var $_methods = array ( - 0x0 => 'None', - 0x1 => 'Shrunk', - 0x2 => 'Super Fast', - 0x3 => 'Fast', - 0x4 => 'Normal', - 0x5 => 'Maximum', - 0x6 => 'Imploded', - 0x8 => 'Deflated' - ); - - /** - * Beginning of central directory record. - * @var string - */ - var $_ctrlDirHeader = "\x50\x4b\x01\x02"; - - /** - * End of central directory record. - * @var string - */ - var $_ctrlDirEnd = "\x50\x4b\x05\x06\x00\x00\x00\x00"; - - /** - * Beginning of file contents. - * @var string - */ - var $_fileHeader = "\x50\x4b\x03\x04"; - - /** - * ZIP file data buffer - * @var string - */ - var $_data = null; - - /** - * ZIP file metadata array - * @var array - */ - var $_metadata = null; - - /** - * Create a ZIP compressed file from an array of file data. - * - * @todo Finish Implementation - * - * @access public - * @param string $archive Path to save archive - * @param array $files Array of files to add to archive - * @param array $options Compression options [unused] - * @return boolean True if successful - * @since 1.5 - */ - function create($archive, $files, $options = array ()) - { - // Initialize variables - $contents = array(); - $ctrldir = array(); - - foreach ($files as $file) - { - $this->_addToZIPFile($file, $contents, $ctrldir); - } - return $this->_createZIPFile($contents, $ctrldir, $archive); - } - - /** - * Extract a ZIP compressed file to a given path - * - * @access public - * @param string $archive Path to ZIP archive to extract - * @param string $destination Path to extract archive into - * @param array $options Extraction options [unused] - * @return boolean True if successful - * @since 1.5 - */ - function extract($archive, $destination, $options = array ()) - { - if ( ! is_file($archive) ) - { - $this->set('error.message', 'Archive does not exist'); - return false; - } - - if ($this->hasNativeSupport()) { - return ($this->_extractNative($archive, $destination, $options))? true : JError::raiseWarning(100, $this->get('error.message')); - } else { - return ($this->_extract($archive, $destination, $options))? true : JError::raiseWarning(100, $this->get('error.message')); - } - } - - /** - * Method to determine if the server has native zip support for faster handling - * - * @access public - * @return boolean True if php has native ZIP support - * @since 1.5 - */ - function hasNativeSupport() - { - return (function_exists('zip_open') && function_exists('zip_read')); - } - - /** - * Checks to see if the data is a valid ZIP file. - * - * @access public - * @param string $data ZIP archive data buffer - * @return boolean True if valid, false if invalid. - * @since 1.5 - */ - function checkZipData(& $data) { - if (strpos($data, $this->_fileHeader) === false) { - return false; - } else { - return true; - } - } - - /** - * Extract a ZIP compressed file to a given path using a php based algorithm that only requires zlib support - * - * @access private - * @param string $archive Path to ZIP archive to extract - * @param string $destination Path to extract archive into - * @param array $options Extraction options [unused] - * @return boolean True if successful - * @since 1.5 - */ - function _extract($archive, $destination, $options) - { - // Initialize variables - $this->_data = null; - $this->_metadata = null; - - if (!extension_loaded('zlib')) { - $this->set('error.message', 'Zlib Not Supported'); - return false; - } - - if (!$this->_data = JFile::read($archive)) { - $this->set('error.message', 'Unable to read archive'); - return false; - } - if (!$this->_getZipInfo($this->_data)) { - return false; - } - - for ($i=0,$n=count($this->_metadata);$i<$n;$i++) { - if (substr($this->_metadata[$i]['name'], -1, 1) != '/' && substr($this->_metadata[$i]['name'], -1, 1) != '\\') { - $buffer = $this->_getFileData($i); - $path = JPath::clean($destination.DS.$this->_metadata[$i]['name']); - // Make sure the destination folder exists - if (!JFolder::create(dirname($path))) { - $this->set('error.message', 'Unable to create destination'); - return false; - } - if (JFile::write($path, $buffer) === false) { - $this->set('error.message', 'Unable to write entry'); - return false; - } - } - } - return true; - } - - /** - * Extract a ZIP compressed file to a given path using native php api calls for speed - * - * @access private - * @param string $archive Path to ZIP archive to extract - * @param string $destination Path to extract archive into - * @param array $options Extraction options [unused] - * @return boolean True if successful - * @since 1.5 - */ - function _extractNative($archive, $destination, $options) - { - if ($zip = zip_open($archive)) { - if ($zip) { - // Make sure the destination folder exists - if (!JFolder::create($destination)) { - $this->set('error.message', 'Unable to create destination'); - return false; - } - // Read files in the archive - while ($file = zip_read($zip)) - { - if (zip_entry_open($zip, $file, "r")) { - if (substr(zip_entry_name($file), strlen(zip_entry_name($file)) - 1) != "/") { - $buffer = zip_entry_read($file, zip_entry_filesize($file)); - if (JFile::write($destination.DS.zip_entry_name($file), $buffer) === false) { - $this->set('error.message', 'Unable to write entry'); - return false; - } - zip_entry_close($file); - } - } else { - $this->set('error.message', 'Unable to read entry'); - return false; - } - } - zip_close($zip); - } - } else { - $this->set('error.message', 'Unable to open archive'); - return false; - } - return true; - } - - /** - * Get the list of files/data from a ZIP archive buffer. - * - * @access private - * @param string $data The ZIP archive buffer. - * @return array Archive metadata array - *
      -	 * KEY: Position in zipfile
      -	 * VALUES: 'attr'    --  File attributes
      -	 *         'crc'     --  CRC checksum
      -	 *         'csize'   --  Compressed file size
      -	 *         'date'    --  File modification time
      -	 *         'name'    --  Filename
      -	 *         'method'  --  Compression method
      -	 *         'size'    --  Original file size
      -	 *         'type'    --  File type
      -	 * 
      - * @since 1.5 - */ - function _getZipInfo(& $data) - { - // Initialize variables - $entries = array (); - - // Get details from Central directory structure. - $fhStart = strpos($data, $this->_ctrlDirHeader); - do { - if (strlen($data) < $fhStart +31) { - $this->set('error.message', 'Invalid ZIP data'); - return false; - } - $info = unpack('vMethod/VTime/VCRC32/VCompressed/VUncompressed/vLength', substr($data, $fhStart +10, 20)); - $name = substr($data, $fhStart +46, $info['Length']); - - $entries[$name] = array('attr' => null, 'crc' => sprintf("%08s", dechex($info['CRC32'] )), 'csize' => $info['Compressed'], 'date' => null, '_dataStart' => null, 'name' => $name, 'method' => $this->_methods[$info['Method']], '_method' => $info['Method'], 'size' => $info['Uncompressed'], 'type' => null); - $entries[$name]['date'] = mktime((($info['Time'] >> 11) & 0x1f), (($info['Time'] >> 5) & 0x3f), (($info['Time'] << 1) & 0x3e), (($info['Time'] >> 21) & 0x07), (($info['Time'] >> 16) & 0x1f), ((($info['Time'] >> 25) & 0x7f) + 1980)); - - if (strlen($data) < $fhStart +43) { - $this->set('error.message', 'Invalid ZIP data'); - return false; - } - $info = unpack('vInternal/VExternal', substr($data, $fhStart +36, 6)); - - $entries[$name]['type'] = ($info['Internal'] & 0x01) ? 'text' : 'binary'; - $entries[$name]['attr'] = (($info['External'] & 0x10) ? 'D' : '-') . - (($info['External'] & 0x20) ? 'A' : '-') . - (($info['External'] & 0x03) ? 'S' : '-') . - (($info['External'] & 0x02) ? 'H' : '-') . - (($info['External'] & 0x01) ? 'R' : '-'); - } while (($fhStart = strpos($data, $this->_ctrlDirHeader, $fhStart +46)) !== false); - - // Get details from local file header. - $fhStart = strpos($data, $this->_fileHeader); - do { - if (strlen($data) < $fhStart +34) { - $this->set('error.message', 'Invalid ZIP data'); - return false; - } - $info = unpack('vMethod/VTime/VCRC32/VCompressed/VUncompressed/vLength/vExtraLength', substr($data, $fhStart +8, 25)); - $name = substr($data, $fhStart +30, $info['Length']); - $entries[$name]['_dataStart'] = $fhStart +30 + $info['Length'] + $info['ExtraLength']; - } while (strlen($data) > $fhStart +30 + $info['Length'] && ($fhStart = strpos($data, $this->_fileHeader, $fhStart +30 + $info['Length'])) !== false); - - $this->_metadata = array_values($entries); - return true; - } - - /** - * Returns the file data for a file by offsest in the ZIP archive - * - * @access private - * @param int $key The position of the file in the archive. - * @return string Uncompresed file data buffer - * @since 1.5 - */ - function _getFileData($key) { - if ($this->_metadata[$key]['_method'] == 0x8) { - // If zlib extention is loaded use it - if (extension_loaded('zlib')) { - return @ gzinflate(substr($this->_data, $this->_metadata[$key]['_dataStart'], $this->_metadata[$key]['csize'])); - } - } - elseif ($this->_metadata[$key]['_method'] == 0x0) { - /* Files that aren't compressed. */ - return substr($this->_data, $this->_metadata[$key]['_dataStart'], $this->_metadata[$key]['csize']); - } elseif ($this->_metadata[$key]['_method'] == 0x12) { - // Is bz2 extension loaded? If not try to load it - if (!extension_loaded('bz2')) { - if (JPATH_ISWIN) { - @ dl('php_bz2.dll'); - } else { - @ dl('bz2.so'); - } - } - // If bz2 extention is sucessfully loaded use it - if (extension_loaded('bz2')) { - return bzdecompress(substr($this->_data, $this->_metadata[$key]['_dataStart'], $this->_metadata[$key]['csize'])); - } - } - return ''; - } - - /** - * Converts a UNIX timestamp to a 4-byte DOS date and time format - * (date in high 2-bytes, time in low 2-bytes allowing magnitude - * comparison). - * - * @access private - * @param int $unixtime The current UNIX timestamp. - * @return int The current date in a 4-byte DOS format. - * @since 1.5 - */ - function _unix2DOSTime($unixtime = null) { - $timearray = (is_null($unixtime)) ? getdate() : getdate($unixtime); - - if ($timearray['year'] < 1980) { - $timearray['year'] = 1980; - $timearray['mon'] = 1; - $timearray['mday'] = 1; - $timearray['hours'] = 0; - $timearray['minutes'] = 0; - $timearray['seconds'] = 0; - } - return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); - } - - /** - * Adds a "file" to the ZIP archive. - * - * @todo Review and finish implementation - * - * @access private - * @param array $file File data array to add - * @param array $contents An array of existing zipped files. - * @param array $ctrldir An array of central directory information. - * @return void - * @since 1.5 - */ - function _addToZIPFile(& $file, & $contents, & $ctrldir) { - $data = & $file['data']; - $name = str_replace('\\', '/', $file['name']); - - /* See if time/date information has been provided. */ - $ftime = null; - if (isset ($file['time'])) { - $ftime = $file['time']; - } - - /* Get the hex time. */ - $dtime = dechex($this->_unix2DosTime($ftime)); - $hexdtime = chr(hexdec($dtime[6] . $dtime[7])) . - chr(hexdec($dtime[4] . $dtime[5])) . - chr(hexdec($dtime[2] . $dtime[3])) . - chr(hexdec($dtime[0] . $dtime[1])); - - $fr = $this->_fileHeader; /* Begin creating the ZIP data. */ - $fr .= "\x14\x00"; /* Version needed to extract. */ - $fr .= "\x00\x00"; /* General purpose bit flag. */ - $fr .= "\x08\x00"; /* Compression method. */ - $fr .= $hexdtime; /* Last modification time/date. */ - - /* "Local file header" segment. */ - $unc_len = strlen($data); - $crc = crc32($data); - $zdata = gzcompress($data); - $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); - $c_len = strlen($zdata); - - $fr .= pack('V', $crc); /* CRC 32 information. */ - $fr .= pack('V', $c_len); /* Compressed filesize. */ - $fr .= pack('V', $unc_len); /* Uncompressed filesize. */ - $fr .= pack('v', strlen($name)); /* Length of filename. */ - $fr .= pack('v', 0); /* Extra field length. */ - $fr .= $name; /* File name. */ - - /* "File data" segment. */ - $fr .= $zdata; - - /* Add this entry to array. */ - $old_offset = strlen(implode('', $contents)); - $contents[] = & $fr; - - /* Add to central directory record. */ - $cdrec = $this->_ctrlDirHeader; - $cdrec .= "\x00\x00"; /* Version made by. */ - $cdrec .= "\x14\x00"; /* Version needed to extract */ - $cdrec .= "\x00\x00"; /* General purpose bit flag */ - $cdrec .= "\x08\x00"; /* Compression method */ - $cdrec .= $hexdtime; /* Last mod time/date. */ - $cdrec .= pack('V', $crc); /* CRC 32 information. */ - $cdrec .= pack('V', $c_len); /* Compressed filesize. */ - $cdrec .= pack('V', $unc_len); /* Uncompressed filesize. */ - $cdrec .= pack('v', strlen($name)); /* Length of filename. */ - $cdrec .= pack('v', 0); /* Extra field length. */ - $cdrec .= pack('v', 0); /* File comment length. */ - $cdrec .= pack('v', 0); /* Disk number start. */ - $cdrec .= pack('v', 0); /* Internal file attributes. */ - $cdrec .= pack('V', 32); /* External file attributes - - 'archive' bit set. */ - $cdrec .= pack('V', $old_offset); /* Relative offset of local - header. */ - $cdrec .= $name; /* File name. */ - /* Optional extra field, file comment goes here. */ - - // Save to central directory array. */ - $ctrldir[] = & $cdrec; - } - - /** - * Creates the ZIP file. - * Official ZIP file format: http://www.pkware.com/appnote.txt - * - * @todo Review and finish implementation - * - * @access private - * @param array $contents An array of existing zipped files. - * @param array $ctrldir An array of central directory information. - * @param string $path The path to store the archive. - * @return boolean True if successful - * @since 1.5 - */ - function _createZIPFile(& $contents, & $ctrlDir, $path) - { - $data = implode('', $contents); - $dir = implode('', $ctrlDir); - - $buffer = $data . $dir . $this->_ctrlDirEnd . - /* Total # of entries "on this disk". */ - pack('v', count($ctrlDir)) . - /* Total # of entries overall. */ - pack('v', count($ctrlDir)) . - /* Size of central directory. */ - pack('V', strlen($dir)) . - /* Offset to start of central dir. */ - pack('V', strlen($data)) . - /* ZIP file comment length. */ - "\x00\x00"; - - if (JFile::write($path, $buffer) === false) { - return false; - } else { - return true; - } - } -} \ No newline at end of file + + * http://www.zend.com/codex.php?id=535&single=1 + * + * Deins125 + * http://www.zend.com/codex.php?id=470&single=1 + * + * The ZIP compression date code is partially based on code from + * Peter Listiak + * + * This class is inspired from and draws heavily in code and concept from the Compress package of + * The Horde Project + * + * @contributor Chuck Hagenbuch + * @contributor Michael Slusarz + * @contributor Michael Cochrane + * + * @package Joomla.Framework + * @subpackage FileSystem + * @since 1.5 + */ +class JArchiveZip extends JObject +{ + /** + * ZIP compression methods. + * @var array + */ + protected $_methods = array ( + 0x0 => 'None', + 0x1 => 'Shrunk', + 0x2 => 'Super Fast', + 0x3 => 'Fast', + 0x4 => 'Normal', + 0x5 => 'Maximum', + 0x6 => 'Imploded', + 0x8 => 'Deflated' + ); + + /** + * Beginning of central directory record. + * @var string + */ + protected $_ctrlDirHeader = "\x50\x4b\x01\x02"; + + /** + * End of central directory record. + * @var string + */ + protected $_ctrlDirEnd = "\x50\x4b\x05\x06\x00\x00\x00\x00"; + + /** + * Beginning of file contents. + * @var string + */ + protected $_fileHeader = "\x50\x4b\x03\x04"; + + /** + * ZIP file data buffer + * @var string + */ + protected $_data = null; + + /** + * ZIP file metadata array + * @var array + */ + protected $_metadata = null; + + /** + * Create a ZIP compressed file from an array of file data. + * + * @todo Finish Implementation + * + * @access public + * @param string $archive Path to save archive + * @param array $files Array of files to add to archive + * @param array $options Compression options [unused] + * @return boolean True if successful + * @since 1.5 + */ + public function create($archive, $files, $options = array ()) + { + // Initialize variables + $contents = array(); + $ctrldir = array(); + + foreach ($files as $file) + { + $this->_addToZIPFile($file, $contents, $ctrldir); + } + return $this->_createZIPFile($contents, $ctrldir, $archive); + } + + /** + * Extract a ZIP compressed file to a given path + * + * @access public + * @param string $archive Path to ZIP archive to extract + * @param string $destination Path to extract archive into + * @param array $options Extraction options [unused] + * @return boolean True if successful + * @since 1.5 + */ + public function extract($archive, $destination, $options = array ()) + { + if ( ! is_file($archive) ) + { + $this->set('error.message', 'Archive does not exist'); + return false; + } + + if ($this->hasNativeSupport()) { + return ($this->_extractNative($archive, $destination, $options))? true : JError::raiseWarning(100, $this->get('error.message')); + } else { + return ($this->_extract($archive, $destination, $options))? true : JError::raiseWarning(100, $this->get('error.message')); + } + } + + /** + * Method to determine if the server has native zip support for faster handling + * + * @access public + * @return boolean True if php has native ZIP support + * @since 1.5 + */ + public function hasNativeSupport() + { + return (function_exists('zip_open') && function_exists('zip_read')); + } + + /** + * Checks to see if the data is a valid ZIP file. + * + * @access public + * @param string $data ZIP archive data buffer + * @return boolean True if valid, false if invalid. + * @since 1.5 + */ + public function checkZipData(& $data) { + if (strpos($data, $this->_fileHeader) === false) { + return false; + } else { + return true; + } + } + + /** + * Extract a ZIP compressed file to a given path using a php based algorithm that only requires zlib support + * + * @access private + * @param string $archive Path to ZIP archive to extract + * @param string $destination Path to extract archive into + * @param array $options Extraction options [unused] + * @return boolean True if successful + * @since 1.5 + */ + protected function _extract($archive, $destination, $options) + { + // Initialize variables + $this->_data = null; + $this->_metadata = null; + + if (!extension_loaded('zlib')) { + $this->set('error.message', 'Zlib Not Supported'); + return false; + } + + if (!$this->_data = JFile::read($archive)) { + $this->set('error.message', 'Unable to read archive'); + return false; + } + if (!$this->_getZipInfo($this->_data)) { + return false; + } + + for ($i=0,$n=count($this->_metadata);$i<$n;$i++) { + if (substr($this->_metadata[$i]['name'], -1, 1) != '/' && substr($this->_metadata[$i]['name'], -1, 1) != '\\') { + $buffer = $this->_getFileData($i); + $path = JPath::clean($destination.DS.$this->_metadata[$i]['name']); + // Make sure the destination folder exists + if (!JFolder::create(dirname($path))) { + $this->set('error.message', 'Unable to create destination'); + return false; + } + if (JFile::write($path, $buffer) === false) { + $this->set('error.message', 'Unable to write entry'); + return false; + } + } + } + return true; + } + + /** + * Extract a ZIP compressed file to a given path using native php api calls for speed + * + * @access private + * @param string $archive Path to ZIP archive to extract + * @param string $destination Path to extract archive into + * @param array $options Extraction options [unused] + * @return boolean True if successful + * @since 1.5 + */ + protected function _extractNative($archive, $destination, $options) + { + if ($zip = zip_open($archive)) { + if ($zip) { + // Make sure the destination folder exists + if (!JFolder::create($destination)) { + $this->set('error.message', 'Unable to create destination'); + return false; + } + // Read files in the archive + while ($file = zip_read($zip)) + { + if (zip_entry_open($zip, $file, "r")) { + if (substr(zip_entry_name($file), strlen(zip_entry_name($file)) - 1) != "/") { + $buffer = zip_entry_read($file, zip_entry_filesize($file)); + if (JFile::write($destination.DS.zip_entry_name($file), $buffer) === false) { + $this->set('error.message', 'Unable to write entry'); + return false; + } + zip_entry_close($file); + } + } else { + $this->set('error.message', 'Unable to read entry'); + return false; + } + } + zip_close($zip); + } + } else { + $this->set('error.message', 'Unable to open archive'); + return false; + } + return true; + } + + /** + * Get the list of files/data from a ZIP archive buffer. + * + * @access private + * @param string $data The ZIP archive buffer. + * @return array Archive metadata array + *
      +	 * KEY: Position in zipfile
      +	 * VALUES: 'attr'    --  File attributes
      +	 *         'crc'     --  CRC checksum
      +	 *         'csize'   --  Compressed file size
      +	 *         'date'    --  File modification time
      +	 *         'name'    --  Filename
      +	 *         'method'  --  Compression method
      +	 *         'size'    --  Original file size
      +	 *         'type'    --  File type
      +	 * 
      + * @since 1.5 + */ + protected function _getZipInfo(& $data) + { + // Initialize variables + $entries = array (); + + // Get details from Central directory structure. + $fhStart = strpos($data, $this->_ctrlDirHeader); + do { + if (strlen($data) < $fhStart +31) { + $this->set('error.message', 'Invalid ZIP data'); + return false; + } + $info = unpack('vMethod/VTime/VCRC32/VCompressed/VUncompressed/vLength', substr($data, $fhStart +10, 20)); + $name = substr($data, $fhStart +46, $info['Length']); + + $entries[$name] = array('attr' => null, 'crc' => sprintf("%08s", dechex($info['CRC32'] )), 'csize' => $info['Compressed'], 'date' => null, '_dataStart' => null, 'name' => $name, 'method' => $this->_methods[$info['Method']], '_method' => $info['Method'], 'size' => $info['Uncompressed'], 'type' => null); + $entries[$name]['date'] = mktime((($info['Time'] >> 11) & 0x1f), (($info['Time'] >> 5) & 0x3f), (($info['Time'] << 1) & 0x3e), (($info['Time'] >> 21) & 0x07), (($info['Time'] >> 16) & 0x1f), ((($info['Time'] >> 25) & 0x7f) + 1980)); + + if (strlen($data) < $fhStart +43) { + $this->set('error.message', 'Invalid ZIP data'); + return false; + } + $info = unpack('vInternal/VExternal', substr($data, $fhStart +36, 6)); + + $entries[$name]['type'] = ($info['Internal'] & 0x01) ? 'text' : 'binary'; + $entries[$name]['attr'] = (($info['External'] & 0x10) ? 'D' : '-') . + (($info['External'] & 0x20) ? 'A' : '-') . + (($info['External'] & 0x03) ? 'S' : '-') . + (($info['External'] & 0x02) ? 'H' : '-') . + (($info['External'] & 0x01) ? 'R' : '-'); + } while (($fhStart = strpos($data, $this->_ctrlDirHeader, $fhStart +46)) !== false); + + // Get details from local file header. + $fhStart = strpos($data, $this->_fileHeader); + do { + if (strlen($data) < $fhStart +34) { + $this->set('error.message', 'Invalid ZIP data'); + return false; + } + $info = unpack('vMethod/VTime/VCRC32/VCompressed/VUncompressed/vLength/vExtraLength', substr($data, $fhStart +8, 25)); + $name = substr($data, $fhStart +30, $info['Length']); + $entries[$name]['_dataStart'] = $fhStart +30 + $info['Length'] + $info['ExtraLength']; + } while (strlen($data) > $fhStart +30 + $info['Length'] && ($fhStart = strpos($data, $this->_fileHeader, $fhStart +30 + $info['Length'])) !== false); + + $this->_metadata = array_values($entries); + return true; + } + + /** + * Returns the file data for a file by offsest in the ZIP archive + * + * @access private + * @param int $key The position of the file in the archive. + * @return string Uncompresed file data buffer + * @since 1.5 + */ + protected function _getFileData($key) { + if ($this->_metadata[$key]['_method'] == 0x8) { + // If zlib extention is loaded use it + if (extension_loaded('zlib')) { + return @ gzinflate(substr($this->_data, $this->_metadata[$key]['_dataStart'], $this->_metadata[$key]['csize'])); + } + } + elseif ($this->_metadata[$key]['_method'] == 0x0) { + /* Files that aren't compressed. */ + return substr($this->_data, $this->_metadata[$key]['_dataStart'], $this->_metadata[$key]['csize']); + } elseif ($this->_metadata[$key]['_method'] == 0x12) { + // Is bz2 extension loaded? If not try to load it + if (!extension_loaded('bz2')) { + if (JPATH_ISWIN) { + @ dl('php_bz2.dll'); + } else { + @ dl('bz2.so'); + } + } + // If bz2 extention is sucessfully loaded use it + if (extension_loaded('bz2')) { + return bzdecompress(substr($this->_data, $this->_metadata[$key]['_dataStart'], $this->_metadata[$key]['csize'])); + } + } + return ''; + } + + /** + * Converts a UNIX timestamp to a 4-byte DOS date and time format + * (date in high 2-bytes, time in low 2-bytes allowing magnitude + * comparison). + * + * @access private + * @param int $unixtime The current UNIX timestamp. + * @return int The current date in a 4-byte DOS format. + * @since 1.5 + */ + protected function _unix2DOSTime($unixtime = null) { + $timearray = (is_null($unixtime)) ? getdate() : getdate($unixtime); + + if ($timearray['year'] < 1980) { + $timearray['year'] = 1980; + $timearray['mon'] = 1; + $timearray['mday'] = 1; + $timearray['hours'] = 0; + $timearray['minutes'] = 0; + $timearray['seconds'] = 0; + } + return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); + } + + /** + * Adds a "file" to the ZIP archive. + * + * @todo Review and finish implementation + * + * @access private + * @param array $file File data array to add + * @param array $contents An array of existing zipped files. + * @param array $ctrldir An array of central directory information. + * @return void + * @since 1.5 + */ + protected function _addToZIPFile(& $file, & $contents, & $ctrldir) { + $data = & $file['data']; + $name = str_replace('\\', '/', $file['name']); + + /* See if time/date information has been provided. */ + $ftime = null; + if (isset ($file['time'])) { + $ftime = $file['time']; + } + + /* Get the hex time. */ + $dtime = dechex($this->_unix2DosTime($ftime)); + $hexdtime = chr(hexdec($dtime[6] . $dtime[7])) . + chr(hexdec($dtime[4] . $dtime[5])) . + chr(hexdec($dtime[2] . $dtime[3])) . + chr(hexdec($dtime[0] . $dtime[1])); + + $fr = $this->_fileHeader; /* Begin creating the ZIP data. */ + $fr .= "\x14\x00"; /* Version needed to extract. */ + $fr .= "\x00\x00"; /* General purpose bit flag. */ + $fr .= "\x08\x00"; /* Compression method. */ + $fr .= $hexdtime; /* Last modification time/date. */ + + /* "Local file header" segment. */ + $unc_len = strlen($data); + $crc = crc32($data); + $zdata = gzcompress($data); + $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); + $c_len = strlen($zdata); + + $fr .= pack('V', $crc); /* CRC 32 information. */ + $fr .= pack('V', $c_len); /* Compressed filesize. */ + $fr .= pack('V', $unc_len); /* Uncompressed filesize. */ + $fr .= pack('v', strlen($name)); /* Length of filename. */ + $fr .= pack('v', 0); /* Extra field length. */ + $fr .= $name; /* File name. */ + + /* "File data" segment. */ + $fr .= $zdata; + + /* Add this entry to array. */ + $old_offset = strlen(implode('', $contents)); + $contents[] = & $fr; + + /* Add to central directory record. */ + $cdrec = $this->_ctrlDirHeader; + $cdrec .= "\x00\x00"; /* Version made by. */ + $cdrec .= "\x14\x00"; /* Version needed to extract */ + $cdrec .= "\x00\x00"; /* General purpose bit flag */ + $cdrec .= "\x08\x00"; /* Compression method */ + $cdrec .= $hexdtime; /* Last mod time/date. */ + $cdrec .= pack('V', $crc); /* CRC 32 information. */ + $cdrec .= pack('V', $c_len); /* Compressed filesize. */ + $cdrec .= pack('V', $unc_len); /* Uncompressed filesize. */ + $cdrec .= pack('v', strlen($name)); /* Length of filename. */ + $cdrec .= pack('v', 0); /* Extra field length. */ + $cdrec .= pack('v', 0); /* File comment length. */ + $cdrec .= pack('v', 0); /* Disk number start. */ + $cdrec .= pack('v', 0); /* Internal file attributes. */ + $cdrec .= pack('V', 32); /* External file attributes - 'archive' bit set. */ + $cdrec .= pack('V', $old_offset); /* Relative offset of local header. */ + $cdrec .= $name; /* File name. */ + /* Optional extra field, file comment goes here. */ + + // Save to central directory array. */ + $ctrldir[] = & $cdrec; + } + + /** + * Creates the ZIP file. + * Official ZIP file format: http://www.pkware.com/appnote.txt + * + * @todo Review and finish implementation + * + * @access private + * @param array $contents An array of existing zipped files. + * @param array $ctrldir An array of central directory information. + * @param string $path The path to store the archive. + * @return boolean True if successful + * @since 1.5 + */ + protected function _createZIPFile(& $contents, & $ctrlDir, $path) + { + $data = implode('', $contents); + $dir = implode('', $ctrlDir); + + $buffer = $data . $dir . $this->_ctrlDirEnd . + /* Total # of entries "on this disk". */ + pack('v', count($ctrlDir)) . + /* Total # of entries overall. */ + pack('v', count($ctrlDir)) . + /* Size of central directory. */ + pack('V', strlen($dir)) . + /* Offset to start of central dir. */ + pack('V', strlen($data)) . + /* ZIP file comment length. */ + "\x00\x00"; + + if (JFile::write($path, $buffer) === false) { + return false; + } else { + return true; + } + } +} diff --git a/libraries/joomla/filesystem/file.php b/libraries/joomla/filesystem/file.php index 1a0e1ec592031..551c45eb67c0b 100644 --- a/libraries/joomla/filesystem/file.php +++ b/libraries/joomla/filesystem/file.php @@ -1,380 +1,269 @@ - - * @package Joomla.Framework - * @subpackage FileSystem - * @since 1.5 - */ -class JFile -{ - /** - * Gets the extension of a file name - * - * @param string $file The file name - * @return string The file extension - * @since 1.5 - */ - function getExt($file) { - $dot = strrpos($file, '.') + 1; - return substr($file, $dot); - } - - /** - * Strips the last extension off a file name - * - * @param string $file The file name - * @return string The file name without the extension - * @since 1.5 - */ - function stripExt($file) { - return preg_replace('#\.[^.]*$#', '', $file); - } - - /** - * Makes file name safe to use - * - * @param string $file The name of the file [not full path] - * @return string The sanitised string - * @since 1.5 - */ - function makeSafe($file) { - $regex = array('#(\.){2,}#', '#[^A-Za-z0-9\.\_\- ]#', '#^\.#'); - return preg_replace($regex, '', $file); - } - - /** - * Copies a file - * - * @param string $src The path to the source file - * @param string $dest The path to the destination file - * @param string $path An optional base path to prefix to the file names - * @return boolean True on success - * @since 1.5 - */ - function copy($src, $dest, $path = null) - { - // Initialize variables - jimport('joomla.client.helper'); - $FTPOptions = JClientHelper::getCredentials('ftp'); - - // Prepend a base path if it exists - if ($path) { - $src = JPath::clean($path.DS.$src); - $dest = JPath::clean($path.DS.$dest); - } - - //Check src path - if (!is_readable($src)) { - JError::raiseWarning(21, 'JFile::copy: '.JText::_('Cannot find or read file' . ": '$src'")); - return false; - } - - if ($FTPOptions['enabled'] == 1) { - // Connect the FTP client - jimport('joomla.client.ftp'); - $ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); - - // If the parent folder doesn't exist we must create it - if (!file_exists(dirname($dest))) { - jimport('joomla.filesystem.folder'); - JFolder::create(dirname($dest)); - } - - //Translate the destination path for the FTP account - $dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $dest), '/'); - if (!$ftp->store($src, $dest)) { - // FTP connector throws an error - return false; - } - $ret = true; - } else { - if (!@ copy($src, $dest)) { - JError::raiseWarning(21, JText::_('Copy failed')); - return false; - } - $ret = true; - } - return $ret; - } - - /** - * Delete a file or array of files - * - * @param mixed $file The file name or an array of file names - * @return boolean True on success - * @since 1.5 - */ - function delete($file) - { - // Initialize variables - jimport('joomla.client.helper'); - $FTPOptions = JClientHelper::getCredentials('ftp'); - - if (is_array($file)) { - $files = $file; - } else { - $files[] = $file; - } - - // Do NOT use ftp if it is not enabled - if ($FTPOptions['enabled'] == 1) - { - // Connect the FTP client - jimport('joomla.client.ftp'); - $ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); - } - - foreach ($files as $file) - { - $file = JPath::clean($file); - - // Try making the file writeable first. If it's read-only, it can't be deleted - // on Windows, even if the parent folder is writeable - @chmod($file, 0777); - - // In case of restricted permissions we zap it one way or the other - // as long as the owner is either the webserver or the ftp - if (@unlink($file)) { - // Do nothing - } elseif ($FTPOptions['enabled'] == 1) { - $file = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $file), '/'); - if (!$ftp->delete($file)) { - // FTP connector throws an error - return false; - } - } else { - $filename = basename($file); - JError::raiseWarning('SOME_ERROR_CODE', JText::_('Delete failed') . ": '$filename'"); - return false; - } - } - - return true; - } - - /** - * Moves a file - * - * @param string $src The path to the source file - * @param string $dest The path to the destination file - * @param string $path An optional base path to prefix to the file names - * @return boolean True on success - * @since 1.5 - */ - function move($src, $dest, $path = '') - { - // Initialize variables - jimport('joomla.client.helper'); - $FTPOptions = JClientHelper::getCredentials('ftp'); - - if ($path) { - $src = JPath::clean($path.DS.$src); - $dest = JPath::clean($path.DS.$dest); - } - - //Check src path - if (!is_readable($src) && !is_writable($src)) { - return JText::_('Cannot find source file'); - } - - if ($FTPOptions['enabled'] == 1) { - // Connect the FTP client - jimport('joomla.client.ftp'); - $ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); - - //Translate path for the FTP account - $src = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $src), '/'); - $dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $dest), '/'); - - // Use FTP rename to simulate move - if (!$ftp->rename($src, $dest)) { - JError::raiseWarning(21, JText::_('Rename failed')); - return false; - } - } else { - if (!@ rename($src, $dest)) { - JError::raiseWarning(21, JText::_('Rename failed')); - return false; - } - } - return true; - } - - /** - * Read the contents of a file - * - * @param string $filename The full file path +isReadable($src)) { + JError::raiseWarning(21, 'JFile::copy: '.JText::_('Cannot find or read file' . ": '$src'")); + return false; + } + if (!$backend->copy($src, $dest)) { + JError::raiseWarning(21, JText::_('Copy failed')); + return false; + } + return true; + } + + /** + * Delete a file or array of files + * + * @param mixed $file The file name or an array of file names + * @return boolean True on success + * @since 1.5 + */ + public static function delete($file) + { + $backend = JFile::getFileSystem(); + + if (is_array($file)) { + $files = $file; + } else { + $files[] = $file; + } + + foreach ($files as $file) + { + $file = JPath::clean($file); + + // Try making the file writeable first. If it's read-only, it can't be deleted + // on Windows, even if the parent folder is writeable + $backend->chmod($file, 0777); + + // In case of restricted permissions we zap it one way or the other + // as long as the owner is either the webserver or the ftp + if(!$backend->delete($file)) { + $filename = basename($file); + JError::raiseWarning('SOME_ERROR_CODE', JText::_('Delete failed') . ": '$filename'"); + return false; + } + } + + return true; + } + + /** + * Moves a file + * + * @param string $src The path to the source file + * @param string $dest The path to the destination file + * @param string $path An optional base path to prefix to the file names + * @return boolean True on success + * @since 1.5 + */ + public static function move($src, $dest, $path = '') + { + $backend = JFile::getFileSystem(); + + if ($path) { + $src = JPath::clean($path.DS.$src); + $dest = JPath::clean($path.DS.$dest); + } + + //Check src path + if (!$backend->isReadable($src) && !$backend->isWritable($src)) { + return JText::_('Cannot find source file'); + } + + if (!$backend->rename($src, $dest)) { + JError::raiseWarning(21, JText::_('Rename failed')); + return false; + } + return true; + } + + /** + * Read the contents of a file + * + * @param string $filename The full file path * @param boolean $incpath Use include path * @param int $amount Amount of file to read - * @param int $chunksize Size of chunks to read - * @param int $offset Offset of the file - * @return mixed Returns file contents or boolean False if failed - * @since 1.5 - */ - function read($filename, $incpath = false, $amount = 0, $chunksize = 8192, $offset = 0) - { - // Initialize variables - $data = null; - if($amount && $chunksize > $amount) { $chunksize = $amount; } - if (false === $fh = fopen($filename, 'rb', $incpath)) { - JError::raiseWarning(21, 'JFile::read: '.JText::_('Unable to open file') . ": '$filename'"); - return false; - } - clearstatcache(); - if($offset) fseek($fh, $offset); - if ($fsize = @ filesize($filename)) { - if($amount && $fsize > $amount) { - $data = fread($fh, $amount); - } else { - $data = fread($fh, $fsize); - } - } else { - $data = ''; - $x = 0; - // While its: - // 1: Not the end of the file AND - // 2a: No Max Amount set OR - // 2b: The length of the data is less than the max amount we want - while (!feof($fh) && (!$amount || strlen($data) < $amount)) { - $data .= fread($fh, $chunksize); - } - } - fclose($fh); - - return $data; - } - - /** - * Write contents to a file - * - * @param string $file The full file path - * @param string $buffer The buffer to write - * @return boolean True on success - * @since 1.5 - */ - function write($file, $buffer) - { - // Initialize variables - jimport('joomla.client.helper'); - $FTPOptions = JClientHelper::getCredentials('ftp'); - - // If the destination directory doesn't exist we need to create it - if (!file_exists(dirname($file))) { - jimport('joomla.filesystem.folder'); - JFolder::create(dirname($file)); - } - - if ($FTPOptions['enabled'] == 1) { - // Connect the FTP client - jimport('joomla.client.ftp'); - $ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); - - // Translate path for the FTP account and use FTP write buffer to file - $file = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $file), '/'); - $ret = $ftp->write($file, $buffer); - } else { - $file = JPath::clean($file); - $ret = file_put_contents($file, $buffer); - } - return $ret; - } - - /** - * Moves an uploaded file to a destination folder - * - * @param string $src The name of the php (temporary) uploaded file - * @param string $dest The path (including filename) to move the uploaded file to - * @return boolean True on success - * @since 1.5 - */ - function upload($src, $dest) - { - // Initialize variables - jimport('joomla.client.helper'); - $FTPOptions = JClientHelper::getCredentials('ftp'); - $ret = false; - - // Ensure that the path is valid and clean - $dest = JPath::clean($dest); - - // Create the destination directory if it does not exist - $baseDir = dirname($dest); - if (!file_exists($baseDir)) { - jimport('joomla.filesystem.folder'); - JFolder::create($baseDir); - } - - if ($FTPOptions['enabled'] == 1) { - // Connect the FTP client - jimport('joomla.client.ftp'); - $ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); - - //Translate path for the FTP account - $dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $dest), '/'); - - // Copy the file to the destination directory - if ($ftp->store($src, $dest)) { - $ftp->chmod($dest, 0777); - $ret = true; - } else { - JError::raiseWarning(21, JText::_('WARNFS_ERR02')); - } - } else { - if (is_writeable($baseDir) && move_uploaded_file($src, $dest)) { // Short circuit to prevent file permission errors - if (JPath::setPermissions($dest)) { - $ret = true; - } else { - JError::raiseWarning(21, JText::_('WARNFS_ERR01')); - } - } else { - JError::raiseWarning(21, JText::_('WARNFS_ERR02')); - } - } - return $ret; - } - - /** - * Wrapper for the standard file_exists function - * - * @param string $file File path - * @return boolean True if path is a file - * @since 1.5 - */ - function exists($file) - { - return is_file(JPath::clean($file)); - } - - /** - * Returns the name, sans any path - * - * param string $file File path - * @return string filename - * @since 1.5 - */ - function getName($file) { - $slash = strrpos($file, DS) + 1; - return substr($file, $slash); - } -} + * @param int $chunksize Size of chunks to read + * @param int $offset Offset of the file + * @return mixed Returns file contents or boolean False if failed + * @since 1.5 + */ + public static function read($filename, $incpath = false, $amount = 0, $chunksize = 8192, $offset = 0) + { + $backend = JFile::getFileSystem(); + return $backend->read($filename, $incpath, $amount, $offset); + } + + /** + * Write contents to a file + * + * @param string $file The full file path + * @param string $buffer The buffer to write + * @return boolean True on success + * @since 1.5 + */ + public static function write($file, &$buffer) + { + $backend = JFile::getFileSystem(); + + // If the destination directory doesn't exist we need to create it + if (!$backend->exists(dirname($file))) { + jimport('joomla.filesystem.folder'); + JFolder::create(dirname($file)); + } + + $file = JPath::clean($file); + $ret = $backend->write($file, $buffer); + return $ret; + } + + /** + * Moves an uploaded file to a destination folder + * + * @param string $src The name of the php (temporary) uploaded file + * @param string $dest The path (including filename) to move the uploaded file to + * @return boolean True on success + * @since 1.5 + */ + public static function upload($src, $dest) + { + $backend = JFile::getFileSystem(); + $ret = false; + + // Ensure that the path is valid and clean + $dest = JPath::clean($dest); + + // Create the destination directory if it does not exist + $baseDir = dirname($dest); + if (!$backend->exists($baseDir)) { + jimport('joomla.filesystem.folder'); + JFolder::create($baseDir); + } + + // Copy the file to the destination directory + if ($backend->rename($src, $dest)) { + $backend->chmod($dest, 0777); + $ret = true; + } else { + JError::raiseWarning(21, JText::_('WARNFS_ERR02')); + } + return $ret; + } + + /** + * Wrapper for the standard file_exists function + * + * @param string $file File path + * @return boolean True if path is a file + * @since 1.5 + */ + public static function exists($file) + { + $backend = JFile::getFileSystem(); + return $backend->exists(JPath::clean($file)); + } + + /** + * Returns the name, sans any path + * + * param string $file File path + * @return string filename + * @since 1.5 + */ + public static function getName($file) { + $slash = strrpos($file, DS) + 1; + return substr($file, $slash); + } +} diff --git a/libraries/joomla/filesystem/filesystem.php b/libraries/joomla/filesystem/filesystem.php new file mode 100644 index 0000000000000..a98b237fe6770 --- /dev/null +++ b/libraries/joomla/filesystem/filesystem.php @@ -0,0 +1,168 @@ +_options = $options; + } + + /* Returns instance of JFileSystem + * + * note, unless force is set, if $instance->check() fails, it will default to php as the type + * + * @static + * @access public + * @param string type of filesystem to instansiate + * @param array options for filesystem + * @param boolean force instansiation (even if it won't work + * @returns object JFileSystem + */ + public static function &getInstance($type = null, $options = array(), $force = false) { + $config = JFactory::getConfig(); + if(empty($type)) { + $types = $config->get('config.filesystem',array()); + $type = isset($types['_default']) ? $types['_default'] : 'php'; + } + $type = strtolower(JFilterInput::clean($type, 'word')); + if(!isset(JFileSystem::$instances[$type]) || $force) { + $path = JPATH_LIBRARIES.DS.'joomla'.DS.'filesystem'.DS.'filesystem'.DS.$type.'.php'; + $class = 'JFileSystem'.ucfirst($type); + if(!class_exists($class) && file_exists($path)) { + require_once $path; + } + + if(empty($options)) { + $alloptions = $config->get('config.filesystem', array()); + if(isset($options[$type])) { + $options = $alloptions[$type]; + } + } + + $instance = new $class($options); + if(!$force && !$instance->check() && $type != 'php') { + JError::raiseNotice('SOME_ERROR_CODE', JText::sprintf('Unable to initialize filesystem %s', $type)); + $path = JPATH_LIBRARIES.DS.'joomla'.DS.'filesystem'.DS.'filesystem'.DS.'php.php'; + require_once $path; + $instance = new JFileSystemPHP(); + } + if(!$force) { + JFileSystem::$instances[$type] = $instance; + } + } else { + $instance = JFileSystem::$instances[$type]; + } + return $instance; + } + + /* Returns array of filesystems. Force determines if to include the backend if the test() fails + * + * @static + * @access public + * @param boolean include all backends, or only working ones + * @returns array of backend names + */ + public static function getBackends($force = false) { + $arr = array(); + $files = JFolder::files(JPATH_LIBRARIES.DS.'joomla'.DS.'filesystem'.DS.'filesystem', '.+\.php$'); + foreach($files AS $file) { + list($name, $ext) = explode('.', $files, 2); + $class = 'JFilesystem'.ucfirst($name); + $path = JPATH_LIBRARIES.DS.'joomla'.DS.'filesystem'.DS.'filesystem'.DS.$file; + if(!class_exists($class)) { + require_once $path; + } + if($force || call_user_func(array($class, 'test'))) { + $arr[] = $type; + } + } + return $arr; + } + + /*Get JParameter object for given filesystem + * + * @static + * @access public + * @param string type of file sysem + * @returns object JParameter instance + */ + public static function &getParams($type) { + $type = strtolower(JFilterInput::clean($type, 'word')); + $options = JFileSystem::getConfig($type); + $xmlPath = JPATH_LIBRARIES.DS.'joomla'.DS.'filesystem'.DS.'filesystem'.DS.$type.'.xml'; + if(!file_exists($xmlPath)) { + $xmlPath = ''; + } + $params = new JParameter($options, $xmlPath); + return $params; + } + + abstract public static function test(); + + abstract public function check(); + + abstract public function copy($src, $dest); + + abstract public function delete($src); + + abstract public function rename($src, $dest); + + abstract public function read($path, $include_path=true, $length=0, $offset=0); + + abstract public function isReadable($path); + + abstract public function write($path, $buffer); + + abstract public function isWritable($path); + + abstract public function chmod($path, $hex); + + abstract public function chgrp($path, $group); + + abstract public function chown($path, $owner); + + abstract public function mkdir($path); + + abstract public function rmdir($path); + + abstract public function perms($path); + + abstract public function owner($path); +} diff --git a/libraries/joomla/filesystem/filesystem/ftp.php b/libraries/joomla/filesystem/filesystem/ftp.php new file mode 100644 index 0000000000000..1c3f584bcf46c --- /dev/null +++ b/libraries/joomla/filesystem/filesystem/ftp.php @@ -0,0 +1,132 @@ +_options['enabled']) { + $this->_ftp = $this->_getFTP(); + } + } + + public static function test() { + return true; + } + + public function check() { + $ret = false; + if(!$this->_options['enabled']) { + return $ret; + } + $config =& JFactory::getConfig(); + $path = $config->get('config.tmp_path'); + $file = md5(rand(0,10000)).'_tmp'; + if($this->write($path . DS . $file, 'write test')) { + $this->delete($path . DS . $file); + $ret = true; + } + return $ret; + } + + public function copy($src, $dest) { + return $this->ftp->store($this->_makePath($src), $this->_makePath($dest)); + } + + public function delete($src) { + return $this->ftp->delete($this->_makePath($src)); + } + + public function rename($src, $dest) { + return $this->ftp->rename($this->_makePath($src), $this->_makePath($dest)); + } + + public function read($src) { + if(!$this->ftp->read($this->_makePath($src), $buffer)) { + $buffer = false; + } + return $buffer; + } + + public function write($file, $buffer) { + return $this->ftp->write($this->_makePath($file), $buffer); + } + + public function isWritable($path) { + $this->ftp->read($this->_makePath($path), $buffer); + return (bool) $this->write($path, $buffer); + } + + public function isReadable($path) { + return (bool) $this->ftp->read($this->_makePath($path), $buffer); + } + + public function chmod($path, $hex) { + return $this->ftp->chmod($this->_makePath($path), $hex); + } + + public function chgrp($file, $group) { + return false; + } + + public function chown($file, $owner) { + return false; + } + + public function exists($file) { + return file_exists($file); + } + + public function mkdir($path) { + return $this->ftp->mkdir($this->_makePath($path)); + } + + public function rmdir($path) { + return $this->ftp->delete($this->_makePath($path)); + } + + public function perms($path) { + return fileperms($path); + } + + public function owner($path) { + return fileowner($path); + } + + protected function &_getFTP() { + static $obj = null; + if(!is_object($obj)) { + jimport('joomla.client.ftp'); + $obj =& JFTP::getInstance($this->_options['host'], $this->_options['port'], null, $this->_options['user'], $this->_options['pass']); + } + return $obj; + } + + protected function _makePath($path) { + return JPath::clean(str_replace(JPATH_ROOT, $this->_options['root'], $path), '/'); + } + +} diff --git a/libraries/joomla/filesystem/filesystem/ftp.xml b/libraries/joomla/filesystem/filesystem/ftp.xml new file mode 100644 index 0000000000000..e3fbdffe19753 --- /dev/null +++ b/libraries/joomla/filesystem/filesystem/ftp.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/libraries/joomla/filesystem/filesystem/php.php b/libraries/joomla/filesystem/filesystem/php.php new file mode 100644 index 0000000000000..5983334c61662 --- /dev/null +++ b/libraries/joomla/filesystem/filesystem/php.php @@ -0,0 +1,97 @@ +get('config.tmp_path'); + $file = md5(rand(0,10000)).'_tmp'; + if($this->write($path . DS . $file, 'write test')) { + $this->delete($path . DS . $file); + $ret = true; + } else { + $ret = false; + } + } + return $ret; + } + + public function copy($src, $dest) { + $con =& $this->_getSSH(); + return ssh2_scp_send($this->_makePath($src), $this->_makePath($dest)); + } + + public function delete($src) { + $con =& $this->_getSFTP(); + return ssh2_sftp_unlink($con, $this->_makePath($src)); + } + + public function rename($src, $dest) { + $con =& $this->_getSFTP(); + return ssh2_sftp_rename($con, $this->_makePath($src), $this->_makePath($dest)); + } + + public function read($src) { + $config =& JFactory::getConfig(); + $path = $config->get('config.tmp_path'); + $file = md5(rand(0,10000)).'_tmp'; + $con =& $this->_getSSH(); + $buffer = false; + if(ssh2_scp_recv($con, $this->_makePath($src), $path . DS . $file)) { + $buffer = @file_get_contents($path. DS . $file); + @unlink($path . DS . $file); + } + + return $buffer; + } + + public function write($file, $buffer) { + //write to temp file + $config =& JFactory::getConfig(); + $path = $config->get('config.tmp_path'); + $file = md5(rand(0,10000)).'_tmp'; + $ret = false; + if(@file_put_contents($path . DS . $file, $buffer)) { + $con =& $this->_getSSH(); + $ret = ssh2_scp_send($con, $path . DS . $file, $this->_makePath($src)); + @unlink($path . DS . $file); + } + return $ret; + } + + public function isWritable($path) { + return false; + } + + public function isReadable($path) { + return false; + } + + public function chmod($path, $hex) { + return false; + } + + public function chgrp($file, $group) { + return false; + } + + public function chown($file, $owner) { + return false; + } + + public function exists($file) { + return file_exists($file); + } + + public function mkdir($path) { + $con =& $this->_getSFTP(); + return ssh2_sftp_mkdir($con, $this->_makePath($path)); + } + + public function rmdir($path) { + $con =& $this->_getSFTP(); + return ssh2_sftp_rmdir($con, $this->_makePath($path)); + } + + public function perms($path) { + return fileperms($path); + } + + public function owner($path) { + return fileowner($path); + } + + protected function &_getSSH() { + static $obj = null; + if(!is_resource($obj)) { + $obj = ssh2_connect($this->_options['host'], $this->_options['port']); + if($obj) { + ssh2_auth_password($obj, $this->_options['user'], $this->_options['pass']); + } + } + return $obj; + } + + protected function &_getSFTP() { + static $obj = null; + if(!is_resource($obj)) { + $obj = false; + $con =& $this->_getSSH; + if($con) { + $obj = ssh2_sftp($con); + } + } + } + + protected function _makePath($path) { + return JPath::clean(str_replace(JPATH_ROOT, $this->_options['root'], $path), '/'); + } + +} diff --git a/libraries/joomla/filesystem/filesystem/ssh.xml b/libraries/joomla/filesystem/filesystem/ssh.xml new file mode 100644 index 0000000000000..582960f78aeda --- /dev/null +++ b/libraries/joomla/filesystem/filesystem/ssh.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/libraries/joomla/filesystem/folder.php b/libraries/joomla/filesystem/folder.php index 516d05506167e..899f1e3194e0a 100644 --- a/libraries/joomla/filesystem/folder.php +++ b/libraries/joomla/filesystem/folder.php @@ -1,525 +1,412 @@ - - * @package Joomla.Framework - * @subpackage FileSystem - * @since 1.5 - */ -class JFolder -{ - /** - * Copies a folder - * - * @param string $src The path to the source folder - * @param string $dest The path to the destination folder - * @param string $path An optional base path to prefix to the file names - * @param boolean $force Optionally force folder/file overwrites - * @return mixed JError object on failure or boolean True on success - * @since 1.5 - */ - function copy($src, $dest, $path = '', $force = false) - { - // Initialize variables - jimport('joomla.client.helper'); - $FTPOptions = JClientHelper::getCredentials('ftp'); - - if ($path) { - $src = JPath::clean($path.DS.$src); - $dest = JPath::clean($path.DS.$dest); - } - - // Eliminate trailing directory separators, if any - $src = rtrim($src, DS); - $dest = rtrim($dest, DS); - - if (!JFolder::exists($src)) { - return JError::raiseError(-1, JText::_('Cannot find source folder')); - } - if (JFolder::exists($dest) && !$force) { - return JError::raiseError(-1, JText::_('Folder already exists')); - } - - // Make sure the destination exists - if (! JFolder::create($dest)) { - return JError::raiseError(-1, JText::_('Unable to create target folder')); - } - - if ($FTPOptions['enabled'] == 1) - { - // Connect the FTP client - jimport('joomla.client.ftp'); - $ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); - - if(! ($dh = @opendir($src))) { - return JError::raiseError(-1, JText::_('Unable to open source folder')); - } - // Walk through the directory copying files and recursing into folders. - while (($file = readdir($dh)) !== false) { - $sfid = $src . DS . $file; - $dfid = $dest . DS . $file; - switch (filetype($sfid)) { - case 'dir': - if ($file != '.' && $file != '..') { - $ret = JFolder::copy($sfid, $dfid, null, $force); - if ($ret !== true) { - return $ret; - } - } - break; - - case 'file': - //Translate path for the FTP account - $dfid = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $dfid), '/'); - if (! $ftp->store($sfid, $dfid)) { - return JError::raiseError(-1, JText::_('Copy failed')); - } - break; - } - } - } else { - if(! ($dh = @opendir($src))) { - return JError::raiseError(-1, JText::_('Unable to open source folder')); - } - // Walk through the directory copying files and recursing into folders. - while (($file = readdir($dh)) !== false) { - $sfid = $src.DS.$file; - $dfid = $dest.DS.$file; - switch (filetype($sfid)) { - case 'dir': - if ($file != '.' && $file != '..') { - $ret = JFolder::copy($sfid, $dfid, null, $force); - if ($ret !== true) { - return $ret; - } - } - break; - - case 'file': - if (!@ copy($sfid, $dfid)) { - return JError::raiseError(-1, JText::_('Copy failed')); - } - break; - } - } - } - return true; - } - - /** - * Create a folder -- and all necessary parent folders - * - * @param string $path A path to create from the base path - * @param int $mode Directory permissions to set for folders created - * @return boolean True if successful - * @since 1.5 - */ - function create($path = '', $mode = 0755) - { - // Initialize variables - jimport('joomla.client.helper'); - $FTPOptions = JClientHelper::getCredentials('ftp'); - static $nested = 0; - - // Check to make sure the path valid and clean - $path = JPath::clean($path); - - // Check if parent dir exists - $parent = dirname($path); - if (!JFolder::exists($parent)) { - // Prevent infinite loops! - $nested++; - if (($nested > 20) || ($parent == $path)) { - JError::raiseWarning('SOME_ERROR_CODE', 'JFolder::create: '.JText::_('Infinite loop detected')); - $nested--; - return false; - } - - // Create the parent directory - if (JFolder::create($parent, $mode) !== true) { - // JFolder::create throws an error - $nested--; - return false; - } - - // OK, parent directory has been created - $nested--; - } - - // Check if dir already exists - if (JFolder::exists($path)) { - return true; - } - - // Check for safe mode - if ($FTPOptions['enabled'] == 1) { - // Connect the FTP client - jimport('joomla.client.ftp'); - $ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); - - // Translate path to FTP path - $path = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $path), '/'); - $ret = $ftp->mkdir($path); - $ftp->chmod($path, $mode); - } - else - { - // We need to get and explode the open_basedir paths - $obd = ini_get('open_basedir'); - - // If open_basedir is set we need to get the open_basedir that the path is in - if ($obd != null) - { - if (JPATH_ISWIN) { - $obdSeparator = ";"; - } else { - $obdSeparator = ":"; - } - // Create the array of open_basedir paths - $obdArray = explode($obdSeparator, $obd); - $inOBD = false; - // Iterate through open_basedir paths looking for a match - foreach ($obdArray as $test) { - $test = JPath::clean($test); - if (strpos($path, $test) === 0) { - $obdpath = $test; - $inOBD = true; - break; - } - } - if ($inOBD == false) { - // Return false for JFolder::create because the path to be created is not in open_basedir - JError::raiseWarning('SOME_ERROR_CODE', 'JFolder::create: '.JText::_('Path not in open_basedir paths')); - return false; - } - } - - // First set umask - $origmask = @ umask(0); - - // Create the path - if (!$ret = @mkdir($path, $mode)) { - @ umask($origmask); - JError::raiseWarning('SOME_ERROR_CODE', 'JFolder::create: '.JText::_('Could not create directory'), 'Path: '.$path); - return false; - } - - // Reset umask - @ umask($origmask); - } - return $ret; - } - - /** - * Delete a folder - * - * @param string $path The path to the folder to delete - * @return boolean True on success - * @since 1.5 - */ - function delete($path) - { - // Sanity check - if ( ! $path ) { - // Bad programmer! Bad Bad programmer! - JError::raiseWarning(500, 'JFolder::delete: '.JText::_('Attempt to delete base directory') ); - return false; - } - - // Initialize variables - jimport('joomla.client.helper'); - $FTPOptions = JClientHelper::getCredentials('ftp'); - - // Check to make sure the path valid and clean - $path = JPath::clean($path); - - // Is this really a folder? - if (!is_dir($path)) { - JError::raiseWarning(21, 'JFolder::delete: '.JText::_('Path is not a folder').' '.$path); - return false; - } - - // Remove all the files in folder if they exist - $files = JFolder::files($path, '.', false, true, array()); - if (count($files)) { - jimport('joomla.filesystem.file'); - if (JFile::delete($files) !== true) { - // JFile::delete throws an error - return false; - } - } - - // Remove sub-folders of folder - $folders = JFolder::folders($path, '.', false, true, array()); - foreach ($folders as $folder) { - if (JFolder::delete($folder) !== true) { - // JFolder::delete throws an error - return false; - } - } - - if ($FTPOptions['enabled'] == 1) { - // Connect the FTP client - jimport('joomla.client.ftp'); - $ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); - } - - // In case of restricted permissions we zap it one way or the other - // as long as the owner is either the webserver or the ftp - if (@rmdir($path)) { - $ret = true; - } elseif ($FTPOptions['enabled'] == 1) { - // Translate path and delete - $path = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $path), '/'); - // FTP connector throws an error - $ret = $ftp->delete($path); - } else { - JError::raiseWarning('SOME_ERROR_CODE', 'JFolder::delete: '.JText::_('Could not delete folder').' '.$path); - $ret = false; - } - - return $ret; - } - - /** - * Moves a folder - * - * @param string $src The path to the source folder - * @param string $dest The path to the destination folder - * @param string $path An optional base path to prefix to the file names - * @return mixed Error message on false or boolean True on success - * @since 1.5 - */ - function move($src, $dest, $path = '') - { - // Initialize variables - jimport('joomla.client.helper'); - $FTPOptions = JClientHelper::getCredentials('ftp'); - - if ($path) { - $src = JPath::clean($path.DS.$src); - $dest = JPath::clean($path.DS.$dest); - } - - if (!JFolder::exists($src) && !is_writable($src)) { - return JText::_('Cannot find source folder'); - } - if (JFolder::exists($dest)) { - return JText::_('Folder already exists'); - } - - if ($FTPOptions['enabled'] == 1) { - // Connect the FTP client - jimport('joomla.client.ftp'); - $ftp = & JFTP::getInstance($FTPOptions['host'], $FTPOptions['port'], null, $FTPOptions['user'], $FTPOptions['pass']); - - //Translate path for the FTP account - $src = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $src), '/'); - $dest = JPath::clean(str_replace(JPATH_ROOT, $FTPOptions['root'], $dest), '/'); - - // Use FTP rename to simulate move - if (!$ftp->rename($src, $dest)) { - return JText::_('Rename failed'); - } - $ret = true; - } else { - if (!@ rename($src, $dest)) { - return JText::_('Rename failed'); - } - $ret = true; - } - return $ret; - } - - /** - * Wrapper for the standard file_exists function - * - * @param string $path Folder name relative to installation dir - * @return boolean True if path is a folder - * @since 1.5 - */ - function exists($path) - { - return is_dir(JPath::clean($path)); - } - - /** - * Utility function to read the files in a folder - * - * @param string $path The path of the folder to read - * @param string $filter A filter for file names - * @param mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth - * @param boolean $fullpath True to return the full path to the file - * @param array $exclude Array with names of files which should not be shown in the result - * @return array Files in the given folder - * @since 1.5 - */ - function files($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS')) - { - // Initialize variables - $arr = array (); - - // Check to make sure the path valid and clean - $path = JPath::clean($path); - - // Is the path a folder? - if (!is_dir($path)) { - JError::raiseWarning(21, 'JFolder::files: '.JText::_('Path is not a folder').' '.$path); - return false; - } - - // read the source directory - $handle = opendir($path); - while (($file = readdir($handle)) !== false) - { - $dir = $path.DS.$file; - $isDir = is_dir($dir); - if (($file != '.') && ($file != '..') && (!in_array($file, $exclude))) { - if ($isDir) { - if ($recurse) { - if (is_integer($recurse)) { - $recurse--; - } - $arr2 = JFolder::files($dir, $filter, $recurse, $fullpath); - $arr = array_merge($arr, $arr2); - } - } else { - if (preg_match("/$filter/", $file)) { - if ($fullpath) { - $arr[] = $path.DS.$file; - } else { - $arr[] = $file; - } - } - } - } - } - closedir($handle); - - asort($arr); - return $arr; - } - - /** - * Utility function to read the folders in a folder - * - * @param string $path The path of the folder to read - * @param string $filter A filter for folder names - * @param mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth - * @param boolean $fullpath True to return the full path to the folders - * @param array $exclude Array with names of folders which should not be shown in the result - * @return array Folders in the given folder - * @since 1.5 - */ - function folders($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS')) - { - // Initialize variables - $arr = array (); - - // Check to make sure the path valid and clean - $path = JPath::clean($path); - - // Is the path a folder? - if (!is_dir($path)) { - JError::raiseWarning(21, 'JFolder::folder: '.JText::_('Path is not a folder').' '.$path); - return false; - } - - // read the source directory - $handle = opendir($path); - while (($file = readdir($handle)) !== false) - { - $dir = $path.DS.$file; - $isDir = is_dir($dir); - if (($file != '.') && ($file != '..') && (!in_array($file, $exclude)) && $isDir) { - // removes SVN directores from list - if (preg_match("/$filter/", $file)) { - if ($fullpath) { - $arr[] = $dir; - } else { - $arr[] = $file; - } - } - if ($recurse) { - if (is_integer($recurse)) { - $recurse--; - } - $arr2 = JFolder::folders($dir, $filter, $recurse, $fullpath); - $arr = array_merge($arr, $arr2); - } - } - } - closedir($handle); - - asort($arr); - return $arr; - } - - /** - * Lists folder in format suitable for tree display - * - * @access public - * @param string $path The path of the folder to read - * @param string $filter A filter for folder names - * @param integer $maxLevel The maximum number of levels to recursively read, default 3 - * @param integer $level The current level, optional - * @param integer $parent - * @return array Folders in the given folder - * @since 1.5 - */ - function listFolderTree($path, $filter, $maxLevel = 3, $level = 0, $parent = 0) - { - $dirs = array (); - if ($level == 0) { - $GLOBALS['_JFolder_folder_tree_index'] = 0; - } - if ($level < $maxLevel) { - $folders = JFolder::folders($path, $filter); - // first path, index foldernames - for ($i = 0, $n = count($folders); $i < $n; $i ++) { - $id = ++ $GLOBALS['_JFolder_folder_tree_index']; - $name = $folders[$i]; - $fullName = JPath::clean($path.DS.$name); - $dirs[] = array ('id' => $id, 'parent' => $parent, 'name' => $name, 'fullname' => $fullName, 'relname' => str_replace(JPATH_ROOT, '', $fullName)); - $dirs2 = JFolder::listFolderTree($fullName, $filter, $maxLevel, $level +1, $id); - $dirs = array_merge($dirs, $dirs2); - } - } - return $dirs; - } - - /** - * Makes path name safe to use - * - * @access public - * @param string $path The full path to sanitise - * @return string The sanitised string - * @since 1.5 - */ - function makeSafe($path) - { - $ds = ( DS == '\\' ) ? '\\'.DS : DS; - $regex = array('#[^A-Za-z0-9:\_\-'.$ds.' ]#'); - return preg_replace($regex, '', $path); - } -} \ No newline at end of file + 20) || ($parent == $path)) { + JError::raiseWarning('SOME_ERROR_CODE', 'JFolder::create: '.JText::_('Infinite loop detected')); + $nested--; + return false; + } + + // Create the parent directory + if (JFolder::create($parent, $mode) !== true) { + // JFolder::create throws an error + $nested--; + return false; + } + + // OK, parent directory has been created + $nested--; + } + + // Check if dir already exists + if (JFolder::exists($path)) { + return true; + } + + $ret = $backend->mkdir($path); + + if(!$ret) { + JError::raiseWarning('SOME_ERROR_CODE', 'JFolder::create: '.JText::_('Could not create directory'), 'Path: '.$path); + return false; + } + $backend->chmod($path, $mode); + return $ret; + } + + /** + * Delete a folder + * + * @param string $path The path to the folder to delete + * @return boolean True on success + * @since 1.5 + */ + public static function delete($path) + { + // Sanity check + if ( ! $path ) { + // Bad programmer! Bad Bad programmer! + JError::raiseWarning(500, 'JFolder::delete: '.JText::_('Attempt to delete base directory') ); + return false; + } + + $backend = JFolder::getFileSystem(); + + // Check to make sure the path valid and clean + $path = JPath::clean($path); + + // Is this really a folder? + if (!is_dir($path)) { + JError::raiseWarning(21, 'JFolder::delete: '.JText::_('Path is not a folder').' '.$path); + return false; + } + + // Remove all the files in folder if they exist + $files = JFolder::files($path, '.', false, true, array()); + if(!empty($files)) { + jimport('joomla.filesystem.file'); + if (JFile::delete($files) !== true) { + // JFile::delete throws an error + return false; + } + } + + // Remove sub-folders of folder + $folders = JFolder::folders($path, '.', false, true, array()); + foreach ($folders as $folder) { + if (JFolder::delete($folder) !== true) { + // JFolder::delete throws an error + return false; + } + } + $ret = true; + if (!$backend->rmdir($path)) { + JError::raiseWarning('SOME_ERROR_CODE', 'JFolder::delete: '.JText::_('Could not delete folder').' '.$path); + $ret = false; + } + + return $ret; + } + + /** + * Moves a folder + * + * @param string $src The path to the source folder + * @param string $dest The path to the destination folder + * @param string $path An optional base path to prefix to the file names + * @return mixed Error message on false or boolean True on success + * @since 1.5 + */ + public static function move($src, $dest, $path = '') + { + $backend = JFolder::getFileSystem(); + + if ($path) { + $src = JPath::clean($path.DS.$src); + $dest = JPath::clean($path.DS.$dest); + } + + if (!JFolder::exists($src) && !$backend->isWritable($src)) { + return JText::_('Cannot find source folder'); + } + if (JFolder::exists($dest)) { + return JText::_('Folder already exists'); + } + + if (!$backend->rename($src, $dest)) { + return JText::_('Rename failed'); + } + $ret = true; + return $ret; + } + + /** + * Wrapper for the standard file_exists function + * + * @param string $path Folder name relative to installation dir + * @return boolean True if path is a folder + * @since 1.5 + */ + public static function exists($path) + { + return is_dir(JPath::clean($path)); + } + + /** + * Utility function to read the files in a folder + * + * @param string $path The path of the folder to read + * @param string $filter A filter for file names + * @param mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth + * @param boolean $fullpath True to return the full path to the file + * @param array $exclude Array with names of files which should not be shown in the result + * @return array Files in the given folder + * @since 1.5 + */ + public static function files($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS')) + { + // Initialize variables + $arr = array (); + + // Check to make sure the path valid and clean + $path = JPath::clean($path); + + // Is the path a folder? + if (!is_dir($path)) { + JError::raiseWarning(21, 'JFolder::files: '.JText::_('Path is not a folder').' '.$path); + return false; + } + + // read the source directory + $handle = opendir($path); + while (($file = readdir($handle)) !== false) + { + $dir = $path.DS.$file; + $isDir = is_dir($dir); + if (($file != '.') && ($file != '..') && (!in_array($file, $exclude))) { + if ($isDir) { + if ($recurse) { + if (is_integer($recurse)) { + $recurse--; + } + $arr2 = JFolder::files($dir, $filter, $recurse, $fullpath); + $arr = array_merge($arr, $arr2); + } + } else { + if (preg_match("/$filter/", $file)) { + if ($fullpath) { + $arr[] = $path.DS.$file; + } else { + $arr[] = $file; + } + } + } + } + } + closedir($handle); + + asort($arr); + return $arr; + } + + /** + * Utility function to read the folders in a folder + * + * @param string $path The path of the folder to read + * @param string $filter A filter for folder names + * @param mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth + * @param boolean $fullpath True to return the full path to the folders + * @param array $exclude Array with names of folders which should not be shown in the result + * @return array Folders in the given folder + * @since 1.5 + */ + public static function folders($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS')) + { + // Initialize variables + $arr = array (); + + // Check to make sure the path valid and clean + $path = JPath::clean($path); + + // Is the path a folder? + if (!is_dir($path)) { + JError::raiseWarning(21, 'JFolder::folder: '.JText::_('Path is not a folder').' '.$path); + return false; + } + + // read the source directory + $handle = opendir($path); + while (($file = readdir($handle)) !== false) + { + $dir = $path.DS.$file; + $isDir = is_dir($dir); + if (($file != '.') && ($file != '..') && (!in_array($file, $exclude)) && $isDir) { + // removes SVN directores from list + if (preg_match("/$filter/", $file)) { + if ($fullpath) { + $arr[] = $dir; + } else { + $arr[] = $file; + } + } + if ($recurse) { + if (is_integer($recurse)) { + $recurse--; + } + $arr2 = JFolder::folders($dir, $filter, $recurse, $fullpath); + $arr = array_merge($arr, $arr2); + } + } + } + closedir($handle); + + asort($arr); + return $arr; + } + + /** + * Lists folder in format suitable for tree display + * + * @access public + * @param string $path The path of the folder to read + * @param string $filter A filter for folder names + * @param integer $maxLevel The maximum number of levels to recursively read, default 3 + * @param integer $level The current level, optional + * @param integer $parent + * @return array Folders in the given folder + * @since 1.5 + */ + public static function listFolderTree($path, $filter, $maxLevel = 3, $level = 0, $parent = 0) + { + $dirs = array (); + if ($level == 0) { + JFolder::$treeLevel = 0; + } + if ($level < $maxLevel) { + $folders = JFolder::folders($path, $filter); + // first path, index foldernames + for ($i = 0, $n = count($folders); $i < $n; $i ++) { + $id = ++ JFolder::$treeLevel; + $name = $folders[$i]; + $fullName = JPath::clean($path.DS.$name); + $dirs[] = array ('id' => $id, 'parent' => $parent, 'name' => $name, 'fullname' => $fullName, 'relname' => str_replace(JPATH_ROOT, '', $fullName)); + $dirs2 = JFolder::listFolderTree($fullName, $filter, $maxLevel, $level +1, $id); + $dirs = array_merge($dirs, $dirs2); + } + } + return $dirs; + } + + /** + * Makes path name safe to use + * + * @access public + * @param string $path The full path to sanitise + * @return string The sanitised string + * @since 1.5 + */ + function makeSafe($path) + { + $ds = ( DS == '\\' ) ? '\\'.DS : DS; + $regex = array('#[^A-Za-z0-9:\_\-'.$ds.' ]#'); + return preg_replace($regex, '', $path); + } +} diff --git a/libraries/joomla/filesystem/index.html b/libraries/joomla/filesystem/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/filesystem/index.html +++ b/libraries/joomla/filesystem/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/filesystem/path.php b/libraries/joomla/filesystem/path.php index 773f2e2ccb1d2..25c560bfe68b0 100644 --- a/libraries/joomla/filesystem/path.php +++ b/libraries/joomla/filesystem/path.php @@ -1,263 +1,279 @@ -perms($path); + if ($perms !== false) + { + if ($backend->chmod($path, $perms ^ 0001)) + { + $backend->chmod($path, $perms); + return true; + } + } + return false; + } + + /** + * Chmods files and directories recursivly to given permissions + * + * @param string $path Root path to begin changing mode [without trailing slash] + * @param string $filemode Octal representation of the value to change file mode to [null = no change] + * @param string $foldermode Octal representation of the value to change folder mode to [null = no change] + * @return boolean True if successful [one fail means the whole operation failed] + * @since 1.5 + */ + public static function setPermissions($path, $filemode = '0644', $foldermode = '0755') { + $backend = JPath::getFileSystem(); + // Initialize return value + $ret = true; + + if (is_dir($path)) + { + $dh = opendir($path); + while ($file = readdir($dh)) + { + if ($file != '.' && $file != '..') { + $fullpath = $path.'/'.$file; + if (is_dir($fullpath)) { + if (!JPath::setPermissions($fullpath, $filemode, $foldermode)) { + $ret = false; + } + } else { + if (isset ($filemode)) { + if (!$backend->chmod($fullpath, octdec($filemode))) { + $ret = false; + } + } + } // if + } // if + } // while + closedir($dh); + if (isset ($foldermode)) { + if (!$backend->chmod($path, octdec($foldermode))) { + $ret = false; + } + } + } + else + { + if (isset ($filemode)) { + $ret = $backend->chmod($path, octdec($filemode)); + } + } // if + return $ret; + } + + /** + * Get the permissions of the file/folder at a give path + * + * @param string $path The path of a file/folder + * @return string Filesystem permissions + * @since 1.5 + */ + public static function getPermissions($path) + { + $backend = JPath::getFileSystem(); + $path = JPath::clean($path); + $mode = @ decoct($backend->perms($path) & 0777); + + if (strlen($mode) < 3) { + return '---------'; + } + $parsed_mode = ''; + for ($i = 0; $i < 3; $i ++) + { + // read + $parsed_mode .= ($mode { $i } & 04) ? "r" : "-"; + // write + $parsed_mode .= ($mode { $i } & 02) ? "w" : "-"; + // execute + $parsed_mode .= ($mode { $i } & 01) ? "x" : "-"; + } + return $parsed_mode; + } + + /** + * Checks for snooping outside of the file system root + * + * @param string $path A file system path to check + * @return string A cleaned version of the path + * @since 1.5 + */ + public static function check($path) + { + if (strpos($path, '..') !== false) { + JError::raiseError( 20, 'JPath::check Use of relative paths not permitted'); // don't translate + jexit(); + } + $path = JPath::clean($path); + if (strpos($path, JPath::clean(JPATH_ROOT)) !== 0) { + JError::raiseError( 20, 'JPath::check Snooping out of bounds @ '.$path); // don't translate + jexit(); + } + } + + /** + * Function to strip additional / or \ in a path name + * + * @static + * @param string $path The path to clean + * @param string $ds Directory separator (optional) + * @return string The cleaned path + * @since 1.5 + */ + public static function clean($path, $ds=DS) + { + $path = trim($path); + + if (empty($path)) { + $path = JPATH_ROOT; + } else { + // Remove double slashes and backslahses and convert all slashes and backslashes to DS + $path = preg_replace('#[/\\\\]+#', $ds, $path); + } + + return $path; + } + + /** + * Method to determine if script owns the path + * + * @static + * @param string $path Path to check ownership + * @return boolean True if the php script owns the path passed + * @since 1.5 + */ + public static function isOwner($path) + { + $backend = JPath::getFileSystem(); + jimport('joomla.filesystem.file'); + jimport('joomla.user.helper'); + + $tmp = md5(JUserHelper::genRandomPassword(16)); + $ssp = ini_get('session.save_path'); + $jtp = JPATH_SITE.DS.'tmp'; + + // Try to find a writable directory + $dir = is_writable('/tmp') ? '/tmp' : false; + $dir = (!$dir && is_writable($ssp)) ? $ssp : false; + $dir = (!$dir && is_writable($jtp)) ? $jtp : false; + + if ($dir) + { + $test = $dir.DS.$tmp; + + // Create the test file + $blank = ''; + JFile::write($test, $blank); + + // Test ownership + $return = ($backend->owner($test) == $backend->owner($path)); + + // Delete the test file + JFile::delete($test); + + return $return; + } + + return false; + } + + /** + * Searches the directory paths for a given file. + * + * @access protected + * @param array|string $path An path or array of path to search in + * @param string $file The file name to look for. + * @return mixed The full path and file name for the target file, or boolean false if the file is not found in any of the paths. + * @since 1.5 + */ + public static function find($paths, $file) + { + settype($paths, 'array'); //force to array + + // start looping through the path set + foreach ($paths as $path) + { + // get the path to the file + $fullname = $path.DS.$file; + + // is the path based on a stream? + if (strpos($path, '://') === false) + { + // not a stream, so do a realpath() to avoid directory + // traversal attempts on the local file system. + $path = realpath($path); // needed for substr() later + $fullname = realpath($fullname); + } + + // the substr() check added to make sure that the realpath() + // results in a directory registered so that + // non-registered directores are not accessible via directory + // traversal attempts. + if (file_exists($fullname) && substr($fullname, 0, strlen($path)) == $path) { + return $fullname; + } + } + + // could not find the file in the set of paths + return false; + } +} diff --git a/libraries/joomla/filter/filterinput.php b/libraries/joomla/filter/filterinput.php index 6dab23681d5f1..0c7bec5ad7d59 100644 --- a/libraries/joomla/filter/filterinput.php +++ b/libraries/joomla/filter/filterinput.php @@ -1,10 +1,10 @@ - * Original Contributors: Gianpaolo Racca, Ghislain Picard, Marco Wandschneider, - * Chris Tobin and Andrew Eddie. + * Original Contributors: Gianpaolo Racca, Ghislain Picard, Marco Wandschneider, Chris Tobin and Andrew Eddie. * - * @author Louis Landry - * @package Joomla.Framework - * @subpackage Filter - * @since 1.5 + * @package Joomla.Framework + * @subpackage Filter + * @since 1.5 */ class JFilterInput extends JObject { - var $tagsArray; // default = empty array - var $attrArray; // default = empty array + public $tagsArray; // default = empty array + public $attrArray; // default = empty array - var $tagsMethod; // default = 0 - var $attrMethod; // default = 0 + public $tagsMethod; // default = 0 + public $attrMethod; // default = 0 - var $xssAuto; // default = 1 - - /** - * HTML tag black list. Any HTML in these elements will be removed. - * - * @var array - */ - var $tagBlacklist = array ( - 'applet', 'body', 'bgsound', 'base', 'basefont', 'embed', - 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', - 'layer', 'link', 'meta', 'name', 'object', 'script', 'style', - 'title', 'xml' - ); - - /** - * Attribute black list. These attributes will be removed from HTML - * elements. Also will strip ALL event handlers. - * - * @var array - */ - var $attrBlacklist = array ( - 'action', 'background', 'codebase', 'dynsrc', 'lowsrc' - ); + public $xssAuto; // default = 1 + public $tagBlacklist = array ('applet', 'body', 'bgsound', 'base', 'basefont', 'embed', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'object', 'script', 'style', 'title', 'xml'); + public $attrBlacklist = array ('action', 'background', 'codebase', 'dynsrc', 'lowsrc'); // also will strip ALL event handlers /** * Constructor for inputFilter class. Only first parameter is required. * - * @access protected - * @param array $tagsArray list of user-defined tags - * @param array $attrArray list of user-defined attributes - * @param int $tagsMethod WhiteList method = 0, BlackList method = 1 - * @param int $attrMethod WhiteList method = 0, BlackList method = 1 - * @param int $xssAuto Only auto clean essentials = 0, Allow clean - * blacklisted tags/attr = 1 - * @since 1.5 + * @access protected + * @param array $tagsArray list of user-defined tags + * @param array $attrArray list of user-defined attributes + * @param int $tagsMethod WhiteList method = 0, BlackList method = 1 + * @param int $attrMethod WhiteList method = 0, BlackList method = 1 + * @param int $xssAuto Only auto clean essentials = 0, Allow clean blacklisted tags/attr = 1 + * @since 1.5 */ - function __construct( - $tagsArray = array(), $attrArray = array(), $tagsMethod = 0, - $attrMethod = 0, $xssAuto = 1 - ) { + protected function __construct($tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) + { // Make sure user defined arrays are in lowercase $tagsArray = array_map('strtolower', (array) $tagsArray); $attrArray = array_map('strtolower', (array) $attrArray); // Assign member variables - $this->tagsArray = $tagsArray; - $this->attrArray = $attrArray; - $this->tagsMethod = $tagsMethod; - $this->attrMethod = $attrMethod; - $this->xssAuto = $xssAuto; + $this->tagsArray = $tagsArray; + $this->attrArray = $attrArray; + $this->tagsMethod = $tagsMethod; + $this->attrMethod = $attrMethod; + $this->xssAuto = $xssAuto; } /** - * Returns a reference to an input filter object, only creating it if it - * doesn't already exist. + * Returns a reference to an input filter object, only creating it if it doesn't already exist. * * This method must be invoked as: - *
        $filter = & JFilterInput::getInstance();
      + *
        $filter = & JFilterInput::getInstance();
      * * @static - * @param array $tagsArray list of user-defined tags - * @param array $attrArray list of user-defined attributes - * @param int $tagsMethod WhiteList method = 0, BlackList method = 1 - * @param int $attrMethod WhiteList method = 0, BlackList method = 1 - * @param int $xssAuto Only auto clean essentials = 0, Allow clean - * blacklisted tags/attr = 1 - * @return object The JFilterInput object. - * @since 1.5 + * @param array $tagsArray list of user-defined tags + * @param array $attrArray list of user-defined attributes + * @param int $tagsMethod WhiteList method = 0, BlackList method = 1 + * @param int $attrMethod WhiteList method = 0, BlackList method = 1 + * @param int $xssAuto Only auto clean essentials = 0, Allow clean blacklisted tags/attr = 1 + * @return object The JFilterInput object. + * @since 1.5 */ - function & getInstance( - $tagsArray = array(), $attrArray = array(), $tagsMethod = 0, - $attrMethod = 0, $xssAuto = 1 - ) { + public static function &getInstance($tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) + { static $instances; - $sig = md5(serialize( - array($tagsArray, $attrArray, $tagsMethod, $attrMethod, $xssAuto) - )); + $sig = md5(serialize(array($tagsArray,$attrArray,$tagsMethod,$attrMethod,$xssAuto))); if (!isset ($instances)) { $instances = array(); } - if (empty($instances[$sig])) { - $instances[$sig] = new JFilterInput( - $tagsArray, $attrArray, $tagsMethod, $attrMethod, $xssAuto - ); + if (empty ($instances[$sig])) { + $instances[$sig] = new JFilterInput($tagsArray, $attrArray, $tagsMethod, $attrMethod, $xssAuto); } return $instances[$sig]; @@ -131,15 +98,14 @@ function & getInstance( * Method to be called by another php script. Processes for XSS and * specified bad code. * - * @access public - * @param mixed $source Input string/array-of-string to be 'cleaned' - * @param string $type Return type for the variable (INT, FLOAT, - * BOOLEAN, WORD, ALNUM, CMD, BASE64, STRING, ARRAY, PATH, NONE) - * @return mixed 'Cleaned' version of input parameter - * @since 1.5 + * @access public + * @param mixed $source Input string/array-of-string to be 'cleaned' + * @param string $type Return type for the variable (INT, FLOAT, BOOLEAN, WORD, ALNUM, CMD, BASE64, STRING, ARRAY, PATH, NONE) + * @return mixed 'Cleaned' version of input parameter + * @since 1.5 * @static */ - function clean($source, $type='string') + public function clean($source, $type='string') { // Handle the type constraint switch (strtoupper($type)) @@ -182,7 +148,7 @@ function clean($source, $type='string') case 'STRING' : // Check for static usage and assign $filter the proper variable - if(isset($this) && is_a( $this, 'JFilterInput' )) { + if(isset($this) && $this INSTANCEOF JFilterInput) { $filter =& $this; } else { $filter =& JFilterInput::getInstance(); @@ -206,7 +172,7 @@ function clean($source, $type='string') default : // Check for static usage and assign $filter the proper variable - if(is_object($this) && get_class($this) == 'JFilterInput') { + if(is_object($this) && $this INSTANCEOF JFilterInput) { $filter =& $this; } else { $filter =& JFilterInput::getInstance(); @@ -240,33 +206,26 @@ function clean($source, $type='string') * Function to determine if contents of an attribute is safe * * @static - * @param array $attrSubSet A two element array for attributes name, - * value. - * @return boolean True if bad code is detected. - * @since 1.5 + * @param array $attrSubSet A 2 element array for attributes name,value + * @return boolean True if bad code is detected + * @since 1.5 */ - function checkAttribute($attrSubSet) + public static function checkAttribute($attrSubSet) { $attrSubSet[0] = strtolower($attrSubSet[0]); $attrSubSet[1] = strtolower($attrSubSet[1]); - return (((strpos($attrSubSet[1], 'expression') !== false) - && ($attrSubSet[0]) == 'style') - || (strpos($attrSubSet[1], 'javascript:') !== false) - || (strpos($attrSubSet[1], 'behaviour:') !== false) - || (strpos($attrSubSet[1], 'vbscript:') !== false) - || (strpos($attrSubSet[1], 'mocha:') !== false) - || (strpos($attrSubSet[1], 'livescript:') !== false)); + return (((strpos($attrSubSet[1], 'expression') !== false) && ($attrSubSet[0]) == 'style') || (strpos($attrSubSet[1], 'javascript:') !== false) || (strpos($attrSubSet[1], 'behaviour:') !== false) || (strpos($attrSubSet[1], 'vbscript:') !== false) || (strpos($attrSubSet[1], 'mocha:') !== false) || (strpos($attrSubSet[1], 'livescript:') !== false)); } /** * Internal method to iteratively remove all unwanted tags and attributes * - * @access protected - * @param string $source Input string to be 'cleaned' - * @return string 'Cleaned' version of input parameter - * @since 1.5 + * @access protected + * @param string $source Input string to be 'cleaned' + * @return string 'Cleaned' version of input parameter + * @since 1.5 */ - function _remove($source) + protected function _remove($source) { $loopCounter = 0; @@ -282,70 +241,68 @@ function _remove($source) /** * Internal method to strip a string of certain tags * - * @access protected - * @param string $source Input string to be 'cleaned' - * @return string 'Cleaned' version of input parameter - * @since 1.5 + * @access protected + * @param string $source Input string to be 'cleaned' + * @return string 'Cleaned' version of input parameter + * @since 1.5 */ - function _cleanTags($source) + protected function _cleanTags($source) { /* * In the beginning we don't really have a tag, so everything is * postTag */ - $preTag = null; - $postTag = $source; + $preTag = null; + $postTag = $source; $currentSpace = false; - // moffats: setting to null due to issues in migration - // system - undefined variable errors - $attr = ''; + $attr = ''; // moffats: setting to null due to issues in migration system - undefined variable errors // Is there a tag? If so it will certainly start with a '<' - $tagOpen_start = strpos($source, '<'); + $tagOpen_start = strpos($source, '<'); while ($tagOpen_start !== false) { // Get some information about the tag we are processing - $preTag .= substr($postTag, 0, $tagOpen_start); - $postTag = substr($postTag, $tagOpen_start); - $fromTagOpen = substr($postTag, 1); - $tagOpen_end = strpos($fromTagOpen, '>'); + $preTag .= substr($postTag, 0, $tagOpen_start); + $postTag = substr($postTag, $tagOpen_start); + $fromTagOpen = substr($postTag, 1); + $tagOpen_end = strpos($fromTagOpen, '>'); // Let's catch any non-terminated tags and skip over them if ($tagOpen_end === false) { - $postTag = substr($postTag, $tagOpen_start +1); - $tagOpen_start = strpos($postTag, '<'); + $postTag = substr($postTag, $tagOpen_start +1); + $tagOpen_start = strpos($postTag, '<'); continue; } // Do we have a nested tag? $tagOpen_nested = strpos($fromTagOpen, '<'); - $tagOpen_nested_end = strpos(substr($postTag, $tagOpen_end), '>'); + $tagOpen_nested_end = strpos(substr($postTag, $tagOpen_end), '>'); if (($tagOpen_nested !== false) && ($tagOpen_nested < $tagOpen_end)) { - $preTag .= substr($postTag, 0, ($tagOpen_nested +1)); - $postTag = substr($postTag, ($tagOpen_nested +1)); - $tagOpen_start = strpos($postTag, '<'); + $preTag .= substr($postTag, 0, ($tagOpen_nested +1)); + $postTag = substr($postTag, ($tagOpen_nested +1)); + $tagOpen_start = strpos($postTag, '<'); continue; } // Lets get some information about our tag and setup attribute pairs - $tagOpen_nested = (strpos($fromTagOpen, '<') + $tagOpen_start +1); - $currentTag = substr($fromTagOpen, 0, $tagOpen_end); - $tagLength = strlen($currentTag); - $tagLeft = $currentTag; - $attrSet = array (); - $currentSpace = strpos($tagLeft, ' '); + $tagOpen_nested = (strpos($fromTagOpen, '<') + $tagOpen_start +1); + $currentTag = substr($fromTagOpen, 0, $tagOpen_end); + $tagLength = strlen($currentTag); + $tagLeft = $currentTag; + $attrSet = array (); + $currentSpace = strpos($tagLeft, ' '); // Are we an open tag or a close tag? if (substr($currentTag, 0, 1) == '/') { // Close Tag - $isCloseTag = true; - list($tagName) = explode(' ', $currentTag); - $tagName = substr($tagName, 1); + $isCloseTag = true; + list ($tagName) = explode(' ', $currentTag); + $tagName = substr($tagName, 1); } else { // Open Tag - $isCloseTag = false; - list($tagName) = explode(' ', $currentTag); + $isCloseTag = false; + list ($tagName) = explode(' ', $currentTag); } /* @@ -353,14 +310,9 @@ function _cleanTags($source) * OR no tagname * OR remove if xssauto is on and tag is blacklisted */ - if ((!preg_match("/^[a-z][a-z0-9]*$/i", $tagName)) - || (!$tagName) - || ((in_array(strtolower($tagName), $this->tagBlacklist)) - && ($this->xssAuto) - ) - ) { - $postTag = substr($postTag, ($tagLength +2)); - $tagOpen_start = strpos($postTag, '<'); + if ((!preg_match("/^[a-z][a-z0-9]*$/i", $tagName)) || (!$tagName) || ((in_array(strtolower($tagName), $this->tagBlacklist)) && ($this->xssAuto))) { + $postTag = substr($postTag, ($tagLength +2)); + $tagOpen_start = strpos($postTag, '<'); // Strip tag continue; } @@ -371,12 +323,11 @@ function _cleanTags($source) */ while ($currentSpace !== false) { - $attr = ''; - $fromSpace = substr($tagLeft, ($currentSpace +1)); - $nextSpace = strpos($fromSpace, ' '); - $openQuotes = strpos($fromSpace, '"'); - $closeQuotes = strpos(substr($fromSpace, ($openQuotes + 1)), '"') - + $openQuotes +1; + $attr = ''; + $fromSpace = substr($tagLeft, ($currentSpace +1)); + $nextSpace = strpos($fromSpace, ' '); + $openQuotes = strpos($fromSpace, '"'); + $closeQuotes = strpos(substr($fromSpace, ($openQuotes +1)), '"') + $openQuotes +1; // Do we have an attribute to process? [check for equal sign] if (strpos($fromSpace, '=') !== false) { @@ -385,10 +336,8 @@ function _cleanTags($source) * grab the substring from the closing quote, otherwise grab * till the next space */ - if (($openQuotes !== false) - && (strpos(substr($fromSpace, ($openQuotes + 1)), '"') !== false) - ) { - $attr = substr($fromSpace, 0, ($closeQuotes + 1)); + if (($openQuotes !== false) && (strpos(substr($fromSpace, ($openQuotes +1)), '"') !== false)) { + $attr = substr($fromSpace, 0, ($closeQuotes +1)); } else { $attr = substr($fromSpace, 0, $nextSpace); } @@ -411,17 +360,15 @@ function _cleanTags($source) $attrSet[] = $attr; // Move search point and continue iteration - $tagLeft = substr($fromSpace, strlen($attr)); - $currentSpace = strpos($tagLeft, ' '); + $tagLeft = substr($fromSpace, strlen($attr)); + $currentSpace = strpos($tagLeft, ' '); } // Is our tag in the user input array? $tagFound = in_array(strtolower($tagName), $this->tagsArray); // If the tag is allowed lets append it to the output string - if ((!$tagFound && $this->tagsMethod) - || ($tagFound && !$this->tagsMethod) - ) { + if ((!$tagFound && $this->tagsMethod) || ($tagFound && !$this->tagsMethod)) { // Reconstruct tag with allowed attributes if (!$isCloseTag) { @@ -446,8 +393,8 @@ function _cleanTags($source) } // Find next tag's start and continue iteration - $postTag = substr($postTag, ($tagLength +2)); - $tagOpen_start = strpos($postTag, '<'); + $postTag = substr($postTag, ($tagLength +2)); + $tagOpen_start = strpos($postTag, '<'); } // Append any code after the end of tags and return @@ -460,12 +407,12 @@ function _cleanTags($source) /** * Internal method to strip a tag of certain attributes * - * @access protected - * @param array $attrSet Array of attribute pairs to filter - * @return array Filtered array of attribute pairs - * @since 1.5 + * @access protected + * @param array $attrSet Array of attribute pairs to filter + * @return array Filtered array of attribute pairs + * @since 1.5 */ - function _cleanAttributes($attrSet) + protected function _cleanAttributes($attrSet) { // Initialize variables $newSet = array(); @@ -486,12 +433,7 @@ function _cleanAttributes($attrSet) * Remove all "non-regular" attribute names * AND blacklisted attributes */ - if ((!preg_match('/[a-z]*$/i', $attrSubSet[0])) - || (($this->xssAuto) - && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) - || (substr($attrSubSet[0], 0, 2) == 'on')) - ) - ) { + if ((!preg_match('/[a-z]*$/i', $attrSubSet[0])) || (($this->xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) || (substr($attrSubSet[0], 0, 2) == 'on')))) { continue; } @@ -503,13 +445,8 @@ function _cleanAttributes($attrSet) $attrSubSet[1] = preg_replace('/[\n\r]/', '', $attrSubSet[1]); // strip double quotes $attrSubSet[1] = str_replace('"', '', $attrSubSet[1]); - /* - * Convert single quotes from either side to - * doubles (Single quotes shouldn't be used to pad attr value) - */ - if ((substr($attrSubSet[1], 0, 1) == "'") - && (substr($attrSubSet[1], (strlen($attrSubSet[1]) - 1), 1) == "'") - ) { + // convert single quotes from either side to doubles (Single quotes shouldn't be used to pad attr value) + if ((substr($attrSubSet[1], 0, 1) == "'") && (substr($attrSubSet[1], (strlen($attrSubSet[1]) - 1), 1) == "'")) { $attrSubSet[1] = substr($attrSubSet[1], 1, (strlen($attrSubSet[1]) - 2)); } // strip slashes @@ -525,9 +462,8 @@ function _cleanAttributes($attrSet) $attrFound = in_array(strtolower($attrSubSet[0]), $this->attrArray); // If the tag is allowed lets keep it - if ((!$attrFound && $this->attrMethod) - || ($attrFound && !$this->attrMethod) - ) { + if ((!$attrFound && $this->attrMethod) || ($attrFound && !$this->attrMethod)) { + // Does the attribute have a value? if ($attrSubSet[1]) { $newSet[] = $attrSubSet[0].'="'.$attrSubSet[1].'"'; @@ -548,12 +484,12 @@ function _cleanAttributes($attrSet) /** * Try to convert to plaintext * - * @access protected - * @param string $source - * @return string Plaintext string - * @since 1.5 + * @access protected + * @param string $source + * @return string Plaintext string + * @since 1.5 */ - function _decode($source) + protected function _decode($source) { // entity decode $trans_tbl = get_html_translation_table(HTML_ENTITIES); @@ -567,5 +503,4 @@ function _decode($source) $source = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $source); // hex notation return $source; } - } diff --git a/libraries/joomla/filter/filteroutput.php b/libraries/joomla/filter/filteroutput.php index 73dc0b943fb74..40bb7c4c82439 100644 --- a/libraries/joomla/filter/filteroutput.php +++ b/libraries/joomla/filter/filteroutput.php @@ -1,149 +1,148 @@ - - * @package Joomla.Framework - * @subpackage Filter - * @since 1.5 - */ -class JFilterOutput -{ - /** - * Makes an object safe to display in forms - * - * Object parameters that are non-string, array, object or start with underscore - * will be converted - * - * @static - * @param object An object to be parsed - * @param int The optional quote style for the htmlspecialchars function - * @param string|array An optional single field name or array of field names not - * to be parsed (eg, for a textarea) - * @since 1.5 - */ - function objectHTMLSafe( &$mixed, $quote_style=ENT_QUOTES, $exclude_keys='' ) - { - if (is_object( $mixed )) - { - foreach (get_object_vars( $mixed ) as $k => $v) - { - if (is_array( $v ) || is_object( $v ) || $v == NULL || substr( $k, 1, 1 ) == '_' ) { - continue; - } - - if (is_string( $exclude_keys ) && $k == $exclude_keys) { - continue; - } else if (is_array( $exclude_keys ) && in_array( $k, $exclude_keys )) { - continue; - } - - $mixed->$k = htmlspecialchars( $v, $quote_style, 'UTF-8' ); - } - } - } - - /** - * This method processes a string and replaces all instances of & with & in links only - * - * @static - * @param string $input String to process - * @return string Processed string - * @since 1.5 - */ - function linkXHTMLSafe($input) - { - $regex = 'href="([^"]*(&(amp;){0})[^"]*)*?"'; - return preg_replace_callback( "#$regex#i", array('JFilterOutput', '_ampReplaceCallback'), $input ); - } - - /** - * This method processes a string and replaces all accented UTF-8 characters by unaccented - * ASCII-7 "equivalents", whitespaces are replaced by hyphens and the string is lowercased. - * - * @static - * @param string $input String to process - * @return string Processed string - * @since 1.5 - */ - function stringURLSafe($string) - { - //remove any '-' from the string they will be used as concatonater - $str = str_replace('-', ' ', $string); - - $lang =& JFactory::getLanguage(); - $str = $lang->transliterate($str); - - // remove any duplicate whitespace, and ensure all characters are alphanumeric - $str = preg_replace(array('/\s+/','/[^A-Za-z0-9\-]/'), array('-',''), $str); - - // lowercase and trim - $str = trim(strtolower($str)); - return $str; - } - - /** - * Replaces & with & for xhtml compliance - * - * @todo There must be a better way??? - * - * @static - * @since 1.5 - */ - function ampReplace( $text ) - { - $text = str_replace( '&&', '*--*', $text ); - $text = str_replace( '&#', '*-*', $text ); - $text = str_replace( '&', '&', $text ); - $text = preg_replace( '|&(?![\w]+;)|', '&', $text ); - $text = str_replace( '*-*', '&#', $text ); - $text = str_replace( '*--*', '&&', $text ); - - return $text; - } - - /** - * Callback method for replacing & with & in a string - * - * @static - * @param string $m String to process - * @return string Replaced string - * @since 1.5 - */ - function _ampReplaceCallback( $m ) - { - $rx = '&(?!amp;)'; - return preg_replace( '#'.$rx.'#', '&', $m[0] ); - } - - /** - * Cleans text of all formating and scripting code - */ - function cleanText ( &$text ) - { - $text = preg_replace( "']*>.*?'si", '', $text ); - $text = preg_replace( '/]*>([^<]+)<\/a>/is', '\2 (\1)', $text ); - $text = preg_replace( '//', '', $text ); - $text = preg_replace( '/{.+?}/', '', $text ); - $text = preg_replace( '/ /', ' ', $text ); - $text = preg_replace( '/&/', ' ', $text ); - $text = preg_replace( '/"/', ' ', $text ); - $text = strip_tags( $text ); - $text = htmlspecialchars( $text ); - return $text; - } -} + $v) + { + if (is_array( $v ) || is_object( $v ) || $v == NULL || substr( $k, 1, 1 ) == '_' ) { + continue; + } + + if (is_string( $exclude_keys ) && $k == $exclude_keys) { + continue; + } else if (is_array( $exclude_keys ) && in_array( $k, $exclude_keys )) { + continue; + } + + $mixed->$k = htmlspecialchars( $v, $quote_style, 'UTF-8' ); + } + } + } + + /** + * This method processes a string and replaces all instances of & with & in links only + * + * @static + * @param string $input String to process + * @return string Processed string + * @since 1.5 + */ + public static function linkXHTMLSafe($input) + { + $regex = 'href="([^"]*(&(amp;){0})[^"]*)*?"'; + return preg_replace_callback( "#$regex#i", array('JFilterOutput', '_ampReplaceCallback'), $input ); + } + + /** + * This method processes a string and replaces all accented UTF-8 characters by unaccented + * ASCII-7 "equivalents", whitespaces are replaced by hyphens and the string is lowercased. + * + * @static + * @param string $input String to process + * @return string Processed string + * @since 1.5 + */ + public static function stringURLSafe($string) + { + //remove any '-' from the string they will be used as concatonater + $str = str_replace('-', ' ', $string); + + $lang =& JFactory::getLanguage(); + $str = $lang->transliterate($str); + + // remove any duplicate whitespace, and ensure all characters are alphanumeric + $str = preg_replace(array('/\s+/','/[^A-Za-z0-9\-]/'), array('-',''), $str); + + // lowercase and trim + $str = trim(strtolower($str)); + return $str; + } + + /** + * Replaces & with & for xhtml compliance + * + * @todo There must be a better way??? + * + * @static + * @since 1.5 + */ + public static function ampReplace( $text ) + { + $text = str_replace( '&&', '*--*', $text ); + $text = str_replace( '&#', '*-*', $text ); + $text = str_replace( '&', '&', $text ); + $text = preg_replace( '|&(?![\w]+;)|', '&', $text ); + $text = str_replace( '*-*', '&#', $text ); + $text = str_replace( '*--*', '&&', $text ); + + return $text; + } + + /** + * Callback method for replacing & with & in a string + * + * @static + * @param string $m String to process + * @return string Replaced string + * @since 1.5 + */ + protected static function _ampReplaceCallback( $m ) + { + $rx = '&(?!amp;)'; + return preg_replace( '#'.$rx.'#', '&', $m[0] ); + } + + /** + * Cleans text of all formating and scripting code + */ + public static function cleanText ( &$text ) + { + $text = preg_replace( "']*>.*?'si", '', $text ); + $text = preg_replace( '/]*>([^<]+)<\/a>/is', '\2 (\1)', $text ); + $text = preg_replace( '//', '', $text ); + $text = preg_replace( '/{.+?}/', '', $text ); + $text = preg_replace( '/ /', ' ', $text ); + $text = preg_replace( '/&/', ' ', $text ); + $text = preg_replace( '/"/', ' ', $text ); + $text = strip_tags( $text ); + $text = htmlspecialchars( $text ); + return $text; + } +} diff --git a/libraries/joomla/filter/index.html b/libraries/joomla/filter/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/filter/index.html +++ b/libraries/joomla/filter/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/html/editor.php b/libraries/joomla/html/editor.php index 3be48565b77a8..d48d05805bc48 100644 --- a/libraries/joomla/html/editor.php +++ b/libraries/joomla/html/editor.php @@ -1,314 +1,312 @@ - - * @author Johan Janssens - * @package Joomla.Framework - * @subpackage HTML - * @since 1.5 - */ -class JEditor extends JObservable -{ - /** - * Editor Plugin object - * - * @var object - */ - var $_editor = null; - - /** - * Editor Plugin name - * - * @var string - */ - var $_name = null; - - /** - * constructor - * - * @access protected - * @param string The editor name - */ - function __construct($editor = 'none') - { - $this->_name = $editor; - } - - /** - * Returns a reference to a global Editor object, only creating it - * if it doesn't already exist. - * - * This method must be invoked as: - *
        $editor = &JEditor::getInstance([$editor);
      - * - * @access public - * @param string $editor The editor to use. - * @return JEditor The Editor object. - */ - function &getInstance($editor = 'none') - { - static $instances; - - if (!isset ($instances)) { - $instances = array (); - } - - $signature = serialize($editor); - - if (empty ($instances[$signature])) { - $instances[$signature] = new JEditor($editor); - } - - return $instances[$signature]; - } - - /** - * Initialize the editor - */ - function initialise() - { - //check if editor is already loaded - if(is_null(($this->_editor))) { - return; - } - - $args['event'] = 'onInit'; - - $return = ''; - $results[] = $this->_editor->update($args); - foreach ($results as $result) { - if (trim($result)) { - //$return .= $result; - $return = $result; - } - } - - $document =& JFactory::getDocument(); - $document->addCustomTag($return); - } - - /** - * Present a text area - * - * @param string The control name - * @param string The contents of the text area - * @param string The width of the text area (px or %) - * @param string The height of the text area (px or %) - * @param int The number of columns for the textarea - * @param int The number of rows for the textarea - * @param boolean True and the editor buttons will be displayed - * @param array Associative array of editor parameters - */ - function display($name, $html, $width, $height, $col, $row, $buttons = true, $params = array()) - { - $this->_loadEditor($params); - - //check if editor is already loaded - if(is_null(($this->_editor))) { - return; - } - - // Backwards compatibility. Width and height should be passed without a semicolon from now on. - // If editor plugins need a unit like "px" for CSS styling, they need to take care of that - $width = str_replace( ';', '', $width ); - $height = str_replace( ';', '', $height ); - - // Initialize variables - $return = null; - - $args['name'] = $name; - $args['content'] = $html; - $args['width'] = $width; - $args['height'] = $height; - $args['col'] = $col; - $args['row'] = $row; - $args['buttons'] = $buttons; - $args['event'] = 'onDisplay'; - - $results[] = $this->_editor->update($args); - - foreach ($results as $result) - { - if (trim($result)) { - $return .= $result; - } - } - return $return; - } - - /** - * Save the editor content - * - * @param string The name of the editor control - */ - function save( $editor ) - { - $this->_loadEditor(); - - //check if editor is already loaded - if(is_null(($this->_editor))) { - return; - } - - $args[] = $editor; - $args['event'] = 'onSave'; - - $return = ''; - $results[] = $this->_editor->update($args); - foreach ($results as $result) { - if (trim($result)) { - $return .= $result; - } - } - return $return; - } - - /** - * Get the editor contents - * - * @param string The name of the editor control - */ - function getContent( $editor ) - { - $this->_loadEditor(); - - $args['name'] = $editor; - $args['event'] = 'onGetContent'; - - $return = ''; - $results[] = $this->_editor->update($args); - foreach ($results as $result) { - if (trim($result)) { - $return .= $result; - } - } - return $return; - } - - /** - * Set the editor contents - * - * @param string The name of the editor control - * @param string The contents of the text area - */ - function setContent( $editor, $html ) - { - $this->_loadEditor(); - - $args['name'] = $editor; - $args['html'] = $html; - $args['event'] = 'onSetContent'; - - $return = ''; - $results[] = $this->_editor->update($args); - foreach ($results as $result) { - if (trim($result)) { - $return .= $result; - } - } - return $return; - } - - /** - * Get the editor buttons - * - * @param mixed $buttons Can be boolean or array, if boolean defines if the buttons are displayed, if array defines a list of buttons not to show. - * @access public - * @since 1.5 - */ - function getButtons($editor, $buttons = true) - { - $result = array(); - - if(is_bool($buttons) && !$buttons) { - return $result; - } - - // Get plugins - $plugins = JPluginHelper::getPlugin('editors-xtd'); - - foreach($plugins as $plugin) - { - if(is_array($buttons) && in_array($plugin->name, $buttons)) { - continue; - } - - $isLoaded = JPluginHelper::importPlugin('editors-xtd', $plugin->name, false); - - $className = 'plgButton'.$plugin->name; - if(class_exists($className)) { - $plugin = new $className($this, (array)$plugin); - } - - // Try to authenticate - $result[] = $plugin->onDisplay($editor); - } - - return $result; - } - - /** - * Load the editor - * - * @access private - * @param array Associative array of editor config paramaters - * @since 1.5 - */ - function _loadEditor($config = array()) - { - //check if editor is already loaded - if(!is_null(($this->_editor))) { - return; - } - - jimport('joomla.filesystem.file'); - - // Build the path to the needed editor plugin - $name = JFilterInput::clean($this->_name, 'cmd'); - $path = JPATH_SITE.DS.'plugins'.DS.'editors'.DS.$name.'.php'; - - if ( ! JFile::exists($path) ) - { - $message = JText::_('Cannot load the editor'); - JError::raiseWarning( 500, $message ); - return false; - } - - // Require plugin file - require_once $path; - - // Get the plugin - $plugin =& JPluginHelper::getPlugin('editors', $this->_name); - $params = new JParameter($plugin->params); - $params->loadArray($config); - $plugin->params = $params; - - // Build editor plugin classname - $name = 'plgEditor'.$this->_name; - if($this->_editor = new $name ($this, (array)$plugin)) - { - // load plugin parameters - $this->initialise(); - JPluginHelper::importPlugin('editors-xtd'); - } - } -} \ No newline at end of file +_name = $editor; + } + + /** + * Returns a reference to a global Editor object, only creating it + * if it doesn't already exist. + * + * This method must be invoked as: + *
        $editor = &JEditor::getInstance([$editor);
      + * + * @access public + * @param string $editor The editor to use. + * @return JEditor The Editor object. + */ + public static function &getInstance($editor = 'none') + { + static $instances; + + if (!isset ($instances)) { + $instances = array (); + } + + $signature = serialize($editor); + + if (empty ($instances[$signature])) { + $instances[$signature] = new JEditor($editor); + } + + return $instances[$signature]; + } + + /** + * Initialize the editor + */ + public function initialise() + { + //check if editor is already loaded + if(is_null(($this->_editor))) { + return; + } + + $args['event'] = 'onInit'; + + $return = ''; + $results[] = $this->_editor->update($args); + foreach ($results as $result) { + if (trim($result)) { + //$return .= $result; + $return = $result; + } + } + + $document =& JFactory::getDocument(); + $document->addCustomTag($return); + } + + /** + * Present a text area + * + * @param string The control name + * @param string The contents of the text area + * @param string The width of the text area (px or %) + * @param string The height of the text area (px or %) + * @param int The number of columns for the textarea + * @param int The number of rows for the textarea + * @param boolean True and the editor buttons will be displayed + * @param array Associative array of editor parameters + */ + public function display($name, $html, $width, $height, $col, $row, $buttons = true, $params = array()) + { + $this->_loadEditor($params); + + //check if editor is already loaded + if(is_null(($this->_editor))) { + return; + } + + // Backwards compatibility. Width and height should be passed without a semicolon from now on. + // If editor plugins need a unit like "px" for CSS styling, they need to take care of that + $width = str_replace( ';', '', $width ); + $height = str_replace( ';', '', $height ); + + // Initialize variables + $return = null; + + $args['name'] = $name; + $args['content'] = $html; + $args['width'] = $width; + $args['height'] = $height; + $args['col'] = $col; + $args['row'] = $row; + $args['buttons'] = $buttons; + $args['event'] = 'onDisplay'; + + $results[] = $this->_editor->update($args); + + foreach ($results as $result) + { + if (trim($result)) { + $return .= $result; + } + } + return $return; + } + + /** + * Save the editor content + * + * @param string The name of the editor control + */ + public function save( $editor ) + { + $this->_loadEditor(); + + //check if editor is already loaded + if(is_null(($this->_editor))) { + return; + } + + $args[] = $editor; + $args['event'] = 'onSave'; + + $return = ''; + $results[] = $this->_editor->update($args); + foreach ($results as $result) { + if (trim($result)) { + $return .= $result; + } + } + return $return; + } + + /** + * Get the editor contents + * + * @param string The name of the editor control + */ + public function getContent( $editor ) + { + $this->_loadEditor(); + + $args['name'] = $editor; + $args['event'] = 'onGetContent'; + + $return = ''; + $results[] = $this->_editor->update($args); + foreach ($results as $result) { + if (trim($result)) { + $return .= $result; + } + } + return $return; + } + + /** + * Set the editor contents + * + * @param string The name of the editor control + * @param string The contents of the text area + */ + public function setContent( $editor, $html ) + { + $this->_loadEditor(); + + $args['name'] = $editor; + $args['html'] = $html; + $args['event'] = 'onSetContent'; + + $return = ''; + $results[] = $this->_editor->update($args); + foreach ($results as $result) { + if (trim($result)) { + $return .= $result; + } + } + return $return; + } + + /** + * Get the editor buttons + * + * @param mixed $buttons Can be boolean or array, if boolean defines if the buttons are displayed, if array defines a list of buttons not to show. + * @access public + * @since 1.5 + */ + public function getButtons($editor, $buttons = true) + { + $result = array(); + + if(is_bool($buttons) && !$buttons) { + return $result; + } + + // Get plugins + $plugins = JPluginHelper::getPlugin('editors-xtd'); + + foreach($plugins as $plugin) + { + if(is_array($buttons) && in_array($plugin->name, $buttons)) { + continue; + } + + $isLoaded = JPluginHelper::importPlugin('editors-xtd', $plugin->name, false); + + $className = 'plgButton'.$plugin->name; + if(class_exists($className)) { + $plugin = new $className($this, (array)$plugin); + } + + // Try to authenticate + $result[] = $plugin->onDisplay($editor); + } + + return $result; + } + + /** + * Load the editor + * + * @access private + * @param array Associative array of editor config paramaters + * @since 1.5 + */ + protected function _loadEditor($config = array()) + { + //check if editor is already loaded + if(!is_null(($this->_editor))) { + return; + } + + jimport('joomla.filesystem.file'); + + // Build the path to the needed editor plugin + $name = JFilterInput::clean($this->_name, 'cmd'); + $path = JPATH_SITE.DS.'plugins'.DS.'editors'.DS.$name.'.php'; + + if ( ! JFile::exists($path) ) + { + $message = JText::_('Cannot load the editor'); + JError::raiseWarning( 500, $message ); + return false; + } + + // Require plugin file + require_once $path; + + // Get the plugin + $plugin =& JPluginHelper::getPlugin('editors', $this->_name); + $params = new JParameter($plugin->params); + $params->loadArray($config); + $plugin->params = $params; + + // Build editor plugin classname + $name = 'plgEditor'.$this->_name; + if($this->_editor = new $name ($this, (array)$plugin)) + { + // load plugin parameters + $this->initialise(); + JPluginHelper::importPlugin('editors-xtd'); + } + } +} diff --git a/libraries/joomla/html/form.php b/libraries/joomla/html/form.php new file mode 100644 index 0000000000000..8727c2ffded86 --- /dev/null +++ b/libraries/joomla/html/form.php @@ -0,0 +1,693 @@ + + * @package Joomla.Framework + * @subpackage Form + * @since 1.6 + */ +class JForm extends JRegistry +{ + /** + * The raw key-value string + * + * @access private + * @var string + * @since 1.6 + */ + protected $_raw = null; + + /** + * The xml elements + * + * @access private + * @var object + * @since 1.6 + */ + protected $_xml = null; + + /** + * Additional Attributes to the group of XML Data + * + * @access private + * @var array + * @since 1.6 + */ + protected $_xmlAttributes = null; + + /** + * loaded elements + * + * @access private + * @var array + * @since 1.6 + */ + protected $_elements = array(); + + /** + * directories, where element types can be stored + * + * @access private + * @var array + * @since 1.6 + */ + protected $_elementPath = array(); + + /** + * XML tag-name for the elements + * + * @access private + * @var array + * @since 1.6 + */ + protected $_elementTagName = ''; + + /** + * The HTML elements to render + * + * @access private + * @var object + * @since 1.6 + */ + protected $_html = array(); + + protected $_hiddenElements = array(); + + /** + * The conditional informations for the params elements + * + * @access private + * @var object + * @since 1.5 + */ + protected $_cond = array(); + + /** + * Constructor + * + * @access protected + * @param string The raw parms text + * @param string Path to the xml setup file or XML data + * @param string Tagname used in the XML file + * @since 1.5 + */ + public function __construct($data, $xmldata = '', $xmlelement = 'element', $addDefault = false) + { + parent::__construct('_default'); + + // Set base path + $this->_elementPath[] = dirname( __FILE__ ).DS.'parameter'.DS.'element'; + + $this->_elementTagName = $xmlelement; + + if (trim( $data )) { + $this->loadINI($data); + } + + if(strpos($xmldata, '<')) { + $this->loadXML($xmldata, $addDefault); + } elseif ($xmldata != '') { + $this->loadSetupFile($xmldata, $addDefault); + } + + $this->_raw = $data; + } + + /** + * Function to overload the class with another rendering engine + * + * @access public + * @param string The raw params text + * @param string Path to the XML setup file or XML data + * @param string Tagname used in the XML file + * @param string Name of the class file to overload the JForm class with + * @since 1.6 + */ + public static function getInstance($data, $xmldata = '', $xmlelement = 'element', $engine = null) + { + if($engine != null) + { + $engine = 'JForm'.ucfirst(strtolower($engine)); + return new $engine($data, $xmldata, $xmlelement); + } + return new JForm(); + } + + /** + * Set a value + * + * @access public + * @param string The name of the param + * @param string The value of the parameter + * @return string The set value + * @since 1.5 + */ + public function set($key, $value = '', $group = '_default') + { + return $this->setValue($group.'.'.$key, (string) $value); + } + + /** + * Get a value + * + * @access public + * @param string The name of the param + * @param mixed The default value if not found + * @return string + * @since 1.5 + */ + public function get($key, $default = '', $group = '_default') + { + $value = $this->getValue($group.'.'.$key); + $result = (empty($value) && ($value !== 0) && ($value !== '0')) ? $default : $value; + return $result; + } + + /** + * Sets a default value if not alreay assigned + * + * @access public + * @param string The name of the param + * @param string The value of the parameter + * @param string The parameter group to modify + * @return string The set value + * @since 1.5 + */ + public function def($key, $default = '', $group = '_default') { + $value = $this->get($key, (string) $default, $group); + return $this->set($key, $value); + } + + /** + * Sets the XML object from custom xml files + * + * @access public + * @param object An XML object + * @since 1.5 + */ + public function setXML( &$xml ) + { + if (is_object( $xml )) + { + if (!$group = $xml->attributes( 'group' )) { + $group = '_default'; + } + $this->_xmlAttributes[$group] = $xml->attributes(); + if(isset($this->_xml[$group])) { + foreach($xml->children() as $child) { + $this->_xml[$group]->_children[] = $child; + } + } else { + $this->_xml[$group] = $xml; + } + if ($dir = $xml->attributes( 'addpath' )) { + $this->addElementPath( JPATH_ROOT . str_replace('/', DS, $dir) ); + } + } + } + + /** + * Bind data to the parameter + * + * @param mixed $data Array or Object + * @param string Name of the XML group + * @return boolean True if the data was successfully bound + * @access public + * @since 1.5 + */ + public function bind($data, $group = '_default') + { + if ( is_array($data) ) { + return $this->loadArray($data, $group); + } elseif ( is_object($data) ) { + return $this->loadObject($data, $group); + } else { + return $this->loadINI($data, $group); + } + } + + /** + * Function to render the HTML for the parameter set/form set + * + * @access public + * @param string The name of the control, or the default text area if a setup file is not found + * @param string Name of the Group to render + * @param boolean Render as data view when false, render as form when set to true + * @return string HTML + * @since 1.6 + */ + public function render($name = 'elements', $group = '_default', $form = true) + { + $this->_html = array(); + $this->_html[] = ''; + + if ($description = $this->_xml[$group]->attributes('description')) { + // add the params description to the display + $desc = JText::_($description); + $this->_html[] = ''; + } + + $this->_render($this->_xml[$group]->children(), $group, $name, '', '', $form); + + if (count($this->_xml[$group]->children()) < 1) { + $this->_html[] = ""; + } + + $this->_html[] = '
      '.$desc.'
      ".JText::_('There are no Parameters for this item')."
      '; + return implode("\n", $this->_html).implode("\n", $this->_hiddenElements); + } + + /** + * Render all parameters to an array + * + * @access public + * @param string The name of the control, or the default text area if a setup file is not found + * @return array Array of all parameters, each as array Any array of the label, the form element and the tooltip + * @since 1.5 + */ + public function renderToArray($name = 'element', $group = '_default') + { + if (!isset($this->_xml[$group])) { + return false; + } + $results = array(); + foreach ($this->_xml[$group]->children() as $element) { + $result = $this->getElement($element, $name); + $results[$result[5]] = $result; + } + return $results; + } + + /** + * Return number of params to render + * + * @access public + * @return mixed Boolean falst if no params exist or integer number of params that exist + * @since 1.5 + */ + public function getNumElements($group = '_default') + { + if (!isset($this->_xml[$group]) || !count($this->_xml[$group]->children())) { + return false; + } else { + return count($this->_xml[$group]->children()); + } + } + + /** + * Get the number of params in each group + * + * @access public + * @return array Array of all group names as key and param count as value + * @since 1.5 + */ + public function getGroups() + { + if (!is_array($this->_xml)) { + return false; + } + $results = array(); + foreach ($this->_xml as $name => $group) { + $results[$name] = $this->getNumElements($name); + } + return $results; + } + + /** + * Get additional Attributes for a Group + * + * @access public + * @param string Name of the group + * @return array + * @since 1.6 + */ + public function getGroupAttributes($group = '') + { + if(isset($this->_xmlAttributes[$group])) + { + return $this->_xmlAttributes[$group]; + } + return $this->_xmlAttributes; + } + + /** + * Render all parameters + * Notice: This function does not support the conditional parameters introduced in 1.6. + * This functionality is implemented in the JParameter::render() function directly. + * + * @access public + * @param string The name of the control, or the default text area if a setup file is not found + * @return array Aarray of all parameters, each as array Any array of the label, the form element and the tooltip + * @since 1.5 + */ + public function getElements($name = 'elements', $group = '_default') + { + if (!isset($this->_xml[$group])) { + return false; + } + $results = array(); + foreach ($this->_xml[$group]->children() as $element) { + $results[] = $this->getElement($element, $name); + } + return $results; + } + + /** + * Render a parameter type + * + * @param object A param tag node + * @param string The control name + * @return array Any array of the label, the form element and the tooltip + * @since 1.5 + */ + public function getElement(&$node, $control_name = 'element', $group = '_default', $form = true) + { + //get the type of the parameter + $type = $node->attributes('type'); + + //remove any occurance of a mos_ prefix + $type = str_replace('mos_', '', $type); + + $element =& $this->loadElement($type); + + // error happened + if ($element === false) + { + $result = array(); + $result[0] = $node->attributes('name'); + $result[1] = JText::_('Element not defined for type').' = '.$type; + $result[5] = $result[0]; + return $result; + } + + //get value + $value = $this->get($node->attributes('name'), $node->attributes('default'), $group); + if($form) { + return $element->render($node, $value, $control_name); + } else { + return $element->renderElement($node, $value, $control_name); + } + } + + /** + * Loads an xml setup file and parses it + * + * @access public + * @param string path to xml setup file + * @return object + * @since 1.5 + */ + public function loadXML($xml, $addDefault = false) + { + $elementTagName = $this->_elementTagName.'s'; + $result = false; + + $xml = & JFactory::getXMLParser('Simple'); + + if ($xml->loadString($xml)) + { + if ($elements = & $xml->document->$elementTagName) { + foreach ($elements as $element) + { + if ($addDefault) + { + foreach($element->_children as &$child) + { + if($child->attributes('type') == 'radio' || $child->attributes('type') == 'list') { + $child->addAttribute('default', ''); + $child->addAttribute('type', 'list'); + $subchild = &$child->addChild('option', array('value' => '')); + $subchild->setData('Use Global'); + } + } + } + $this->setXML( $element ); + $result = true; + } + } + } + else + { + $result = true; + } + + return $result; + } + + /** + * Loads an xml setup file and parses it + * + * @access public + * @param string path to xml setup file + * @return object + * @since 1.5 + */ + public function loadSetupFile($path, $addDefault = false) + { + static $file; + + $result = false; + + if(!is_array($file)) + { + $file = array(); + } + if ($path && !in_array($path, $file)) + { + $file[] = $path; + $xml = & JFactory::getXMLParser('Simple'); + + if ($xml->loadFile($path)) + { + $elementtagname = $this->_elementTagName.'s'; + if ($elements = & $xml->document->$elementtagname) { + foreach ($elements as $element) + { + if ($addDefault) + { + foreach($element->_children as &$child) + { + if($child->attributes('type') == 'radio' || $child->attributes('type') == 'list') { + $child->addAttribute('default', ''); + $child->addAttribute('type', 'list'); + $subchild = &$child->addChild('option', array('value' => '')); + $subchild->setData('Use Global'); + } + } + } + $this->setXML( $element ); + $result = true; + } + } + } + } + else + { + $result = true; + } + + return $result; + } + + /** + * Loads all xml setup files from a directory and parses it + * + * @access public + * @param string directory to xml setup file + * @return object + * @since 1.6 + */ + public function loadSetupDirectory($path, $filter = '.xml', $addDefault = false) + { + $result = false; + + jimport('joomla.filesystem.folder'); + if(!JFolder::exists($path)) { + return $result; + } + $files = JFolder::files($path, $filter, false, true); + if (count($files)) + { + foreach($files as $file) + { + $result = $this->loadSetupFile($file, $addDefault); + } + } + else + { + $result = true; + } + + return $result; + } + + /** + * Loads a element type + * + * @access public + * @param string elementType + * @return object + * @since 1.5 + */ + public function &loadElement( $type, $new = false ) + { + $false = false; + $signature = md5( $type ); + + if( (isset( $this->_elements[$signature] ) && !($this->_elements[$signature] INSTANCEOF __PHP_Incomplete_Class)) && $new === false ) { + return $this->_elements[$signature]; + } + + $elementClass = 'JElement'.$type; + if( !class_exists( $elementClass ) ) + { + if( isset( $this->_elementPath ) ) { + $dirs = $this->_elementPath; + } else { + $dirs = array(); + } + + $file = JFilterInput::clean(str_replace('_', DS, $type).'.php', 'path'); + + jimport('joomla.filesystem.path'); + if ($elementFile = JPath::find($dirs, $file)) { + include_once $elementFile; + } else { + return $false; + } + } + + if( !class_exists( $elementClass ) ) { + return $false; + } + + $this->_elements[$signature] = new $elementClass($this); + + return $this->_elements[$signature]; + } + + /** + * Add a directory where JParameter should search for element types + * + * You may either pass a string or an array of directories. + * + * JParameter will be searching for a element type in the same + * order you added them. If the parameter type cannot be found in + * the custom folders, it will look in + * JParameter/types. + * + * @access public + * @param string|array directory or directories to search. + * @since 1.5 + */ + public function addElementPath( $path ) + { + // just force path to array + settype( $path, 'array' ); + + // loop through the path directories + foreach ( $path as $dir ) + { + // no surrounding spaces allowed! + $dir = trim( $dir ); + + // add trailing separators as needed + if ( substr( $dir, -1 ) != DIRECTORY_SEPARATOR ) { + // directory + $dir .= DIRECTORY_SEPARATOR; + } + + // add to the top of the search dirs + array_unshift( $this->_elementPath, $dir ); + } + + + } + + +/** public function getConditionalScript() { + if(count($this->_cond) < 1) { + return false; + } + $script = ''; + foreach($this->_cond as $group => $conditionals) + { + foreach($conditionals as $name => $values + $script .= '$(\''.$group.$name.'\').addEvent(\'onChange\', function() {\n'; + foreach($values as $value => + $(\' + + +$this->_cond[$name][$param->attribute('name')][$cond_group->attribute('value')] + +$name.$cond.$cond_value.'-cond' + return implode("\n", $script); + } +**/ + + protected function _render($params, $group, $name = 'params', $cond = '', $cond_value = '', $form = true) + { + if($cond != '' && $cond_value != '') { + $id_prefix = $name.$cond.$cond_value.'-cond'; + } else { + $id_prefix = ''; + } + + foreach ($params as $param) { + if($param->name() == 'conditionalParametersGroup') { + $cond_groups = $param->children(); + foreach($cond_groups as $cond_group) { + $this->_cond[$name][$param->attribute('name')][$cond_group->attribute('value')] = 0; + $this->_render($cond_group->children(), $param->attribute('name'), $cond_group->attribute('value')); + } + } else { + $result = $this->getElement($param, $name, '_default', $form); + if($param->attributes('type') == 'hidden') + { + $this->_hiddenElements[] = $result[1]; + + } else { + if($id_prefix != '') { + $id = ' id="'.$id_prefix.$this->_cond[$name][$cond][$cond_value].'"'; + $this->_cond[$name][$cond][$cond_value]++; + } else { + $id = ''; + } + $this->_html[] = ''; + + if ($result[0]) { + $this->_html[] = ''.$result[0].''; + $this->_html[] = ''.$result[1].''; + } else { + $this->_html[] = ''.$result[1].''; + } + + $this->_html[] = ''; + } + } + } + } +} diff --git a/libraries/joomla/html/html.php b/libraries/joomla/html/html.php index ea4ebd532eace..d3bc932870f32 100644 --- a/libraries/joomla/html/html.php +++ b/libraries/joomla/html/html.php @@ -1,328 +1,326 @@ - element - * - * @access public - * @param string The relative URL to use for the href attribute - * @param string The target attribute to use - * @param array An associative array of attributes to add - * @since 1.5 - */ - function link($url, $text, $attribs = null) - { - if (is_array( $attribs )) { - $attribs = JArrayHelper::toString( $attribs ); - } - - return ''.$text.''; - } - - /** - * Write a element - * - * @access public - * @param string The relative or absoluete URL to use for the src attribute - * @param string The target attribute to use - * @param array An associative array of attributes to add - * @since 1.5 - */ - function image($url, $alt, $attribs = null) - { - if (is_array($attribs)) { - $attribs = JArrayHelper::toString( $attribs ); - } - - if(strpos($url, 'http') !== 0) { - $url = JURI::root(true).'/'.$url; - }; - - return ''.$alt.''; - } - - /** - * Write a element - * - * @access public - * @param string The relative URL to use for the src attribute - * @param string The target attribute to use - * @param array An associative array of attributes to add - * @param string The message to display if the iframe tag is not supported - * @since 1.5 - */ - function iframe( $url, $name, $attribs = null, $noFrames = '' ) - { - if (is_array( $attribs )) { - $attribs = JArrayHelper::toString( $attribs ); - } - - return ''; - } - - /** - * Write a element - * - * @access public - * @param string The name of the script file - * * @param string The relative or absolute path of the script file - * @param boolean If true, the mootools library will be loaded - * @since 1.5 - */ - function script($filename, $path = 'media/system/js/', $mootools = true) - { - // Include mootools framework - if($mootools) { - JHTML::_('behavior.mootools'); - } - - if(strpos($path, 'http') !== 0) { - $path = JURI::root(true).'/'.$path; - }; - - $document = &JFactory::getDocument(); - $document->addScript( $path.$filename ); - return; - } - - /** - * Write a element - * - * @access public - * @param string The relative URL to use for the href attribute - * @since 1.5 - */ - function stylesheet($filename, $path = 'media/system/css/', $attribs = array()) - { - if(strpos($path, 'http') !== 0) { - $path = JURI::root(true).'/'.$path; - }; - - $document = &JFactory::getDocument(); - $document->addStylesheet( $path.$filename, 'text/css', null, $attribs ); - return; - } - - /** - * Returns formated date according to current local and adds time offset - * - * @access public - * @param string date in an US English date format - * @param string format optional format for strftime - * @returns string formated date - * @see strftime - * @since 1.5 - */ - function date($date, $format = null, $offset = NULL) - { - if ( ! $format ) { - $format = JText::_('DATE_FORMAT_LC1'); - } - - - - if(is_null($offset)) - { - $config =& JFactory::getConfig(); - $offset = $config->getValue('config.offset'); - } - $instance =& JFactory::getDate($date); - $instance->setOffset($offset); - - return $instance->toFormat($format); - } - - /** - * Creates a tooltip with an image as button - * - * @access public - * @param string $tooltip The tip string - * @param string $title The title of the tooltip - * @param string $image The image for the tip, if no text is provided - * @param string $text The text for the tip - * @param string $href An URL that will be used to create the link - * @param boolean depreciated - * @return string - * @since 1.5 - */ - function tooltip($tooltip, $title='', $image='tooltip.png', $text='', $href='', $link=1) - { - $tooltip = addslashes(htmlspecialchars($tooltip)); - $title = addslashes(htmlspecialchars($title)); - - if ( !$text ) { - $image = JURI::root(true).'/includes/js/ThemeOffice/'. $image; - $text = ''. JText::_( 'Tooltip' ) .''; - } else { - $text = JText::_( $text, true ); - } - - if($title) { - $title = $title.'::'; - } - - $style = 'style="text-decoration: none; color: #333;"'; - - if ( $href ) { - $href = JRoute::_( $href ); - $style = ''; - $tip = ''. $text .''; - } else { - $tip = ''. $text .''; - } - - return $tip; - } - - /** - * Displays a calendar control field - * - * @param string The date value - * @param string The name of the text field - * @param string The id of the text field - * @param string The date format - * @param array Additional html attributes - */ - function calendar($value, $name, $id, $format = '%Y-%m-%d', $attribs = null) - { - JHTML::_('behavior.calendar'); //load the calendar behavior - - if (is_array($attribs)) { - $attribs = JArrayHelper::toString( $attribs ); - } - $document =& JFactory::getDocument(); - $document->addScriptDeclaration('window.addEvent(\'domready\', function() {Calendar.setup({ - inputField : "'.$id.'", // id of the input field - ifFormat : "'.$format.'", // format of the input field - button : "'.$id.'_img", // trigger for the calendar (button ID) - align : "Tl", // alignment (defaults to "Bl") - singleClick : true - });});'); - - return ''. - 'calendar'; - } - - /** - * Add a directory where JHTML should search for helpers. You may - * either pass a string or an array of directories. - * - * @access public - * @param string A path to search. - * @return array An array with directory elements - * @since 1.5 - */ - function addIncludePath( $path='' ) - { - static $paths; - - if (!isset($paths)) { - $paths = array( JPATH_LIBRARIES.DS.'joomla'.DS.'html'.DS.'html' ); - } - - // force path to array - settype($path, 'array'); - - // loop through the path directories - foreach ($path as $dir) - { - if (!empty($dir) && !in_array($dir, $paths)) { - array_unshift($paths, JPath::clean( $dir )); - } - } - - return $paths; - } -} + element + * + * @access public + * @param string The relative URL to use for the href attribute + * @param string The target attribute to use + * @param array An associative array of attributes to add + * @since 1.5 + */ + public static function link($url, $text, $attribs = null) + { + if (is_array( $attribs )) { + $attribs = JArrayHelper::toString( $attribs ); + } + + return ''.$text.''; + } + + /** + * Write a element + * + * @access public + * @param string The relative or absoluete URL to use for the src attribute + * @param string The target attribute to use + * @param array An associative array of attributes to add + * @since 1.5 + */ + public static function image($url, $alt, $attribs = null) + { + if (is_array($attribs)) { + $attribs = JArrayHelper::toString( $attribs ); + } + + if(strpos($url, 'http') !== 0) { + $url = JURI::root(true).'/'.$url; + }; + + return ''.$alt.''; + } + + /** + * Write a element + * + * @access public + * @param string The relative URL to use for the src attribute + * @param string The target attribute to use + * @param array An associative array of attributes to add + * @param string The message to display if the iframe tag is not supported + * @since 1.5 + */ + public static function iframe( $url, $name, $attribs = null, $noFrames = '' ) + { + if (is_array( $attribs )) { + $attribs = JArrayHelper::toString( $attribs ); + } + + return ''; + } + + /** + * Write a element + * + * @access public + * @param string The name of the script file + * * @param string The relative or absolute path of the script file + * @param boolean If true, the mootools library will be loaded + * @since 1.5 + */ + public static function script($filename, $path = 'media/system/js/', $mootools = true) + { + // Include mootools framework + if($mootools) { + JHTML::_('behavior.mootools'); + } + + if(strpos($path, 'http') !== 0) { + $path = JURI::root(true).'/'.$path; + }; + + $document = &JFactory::getDocument(); + $document->addScript( $path.$filename ); + return; + } + + /** + * Write a element + * + * @access public + * @param string The relative URL to use for the href attribute + * @since 1.5 + */ + public static function stylesheet($filename, $path = 'media/system/css/', $attribs = array()) + { + if(strpos($path, 'http') !== 0) { + $path = JURI::root(true).'/'.$path; + }; + + $document = &JFactory::getDocument(); + $document->addStylesheet( $path.$filename, 'text/css', null, $attribs ); + return; + } + + /** + * Returns formated date according to current local and adds time offset + * + * @access public + * @param string date in an US English date format + * @param string format optional format for strftime + * @returns string formated date + * @see strftime + * @since 1.5 + */ + public static function date($date, $format = null, $offset = NULL) + { + if ( ! $format ) { + $format = JText::_('DATE_FORMAT_LC1'); + } + + + + if(is_null($offset)) + { + $config =& JFactory::getConfig(); + $offset = $config->getValue('config.offset'); + } + $instance =& JFactory::getDate($date); + $instance->setOffset($offset); + + return $instance->toFormat($format); + } + + /** + * Creates a tooltip with an image as button + * + * @access public + * @param string $tooltip The tip string + * @param string $title The title of the tooltip + * @param string $image The image for the tip, if no text is provided + * @param string $text The text for the tip + * @param string $href An URL that will be used to create the link + * @param boolean depreciated + * @return string + * @since 1.5 + */ + public static function tooltip($tooltip, $title='', $image='tooltip.png', $text='', $href='', $link=1) + { + $tooltip = addslashes(htmlspecialchars($tooltip)); + $title = addslashes(htmlspecialchars($title)); + + if ( !$text ) { + $image = JURI::root(true).'/includes/js/ThemeOffice/'. $image; + $text = ''. JText::_( 'Tooltip' ) .''; + } else { + $text = JText::_( $text, true ); + } + + if($title) { + $title = $title.'::'; + } + + $style = 'style="text-decoration: none; color: #333;"'; + + if ( $href ) { + $href = JRoute::_( $href ); + $style = ''; + $tip = ''. $text .''; + } else { + $tip = ''. $text .''; + } + + return $tip; + } + + /** + * Displays a calendar control field + * + * @param string The date value + * @param string The name of the text field + * @param string The id of the text field + * @param string The date format + * @param array Additional html attributes + */ + public static function calendar($value, $name, $id, $format = '%Y-%m-%d', $attribs = null) + { + JHTML::_('behavior.calendar'); //load the calendar behavior + + if (is_array($attribs)) { + $attribs = JArrayHelper::toString( $attribs ); + } + $document =& JFactory::getDocument(); + $document->addScriptDeclaration('window.addEvent(\'domready\', function() {Calendar.setup({ + inputField : "'.$id.'", // id of the input field + ifFormat : "'.$format.'", // format of the input field + button : "'.$id.'_img", // trigger for the calendar (button ID) + align : "Tl", // alignment (defaults to "Bl") + singleClick : true + });});'); + + return ''. + 'calendar'; + } + + /** + * Add a directory where JHTML should search for helpers. You may + * either pass a string or an array of directories. + * + * @access public + * @param string A path to search. + * @return array An array with directory elements + * @since 1.5 + */ + public static function addIncludePath( $path='' ) + { + // force path to array + settype($path, 'array'); + + // loop through the path directories + foreach ($path as $dir) + { + if (!empty($dir) && !in_array($dir, JHTML::$includePaths)) { + array_unshift(JHTML::$includePaths, JPath::clean( $dir )); + } + } + + return JHTML::$includePaths; + } +} diff --git a/libraries/joomla/html/html/behavior.php b/libraries/joomla/html/html/behavior.php index 382c0f4cfcd80..0d6dae1c70f39 100644 --- a/libraries/joomla/html/html/behavior.php +++ b/libraries/joomla/html/html/behavior.php @@ -20,7 +20,7 @@ * @subpackage HTML * @version 1.5 */ -class JHTMLBehavior +abstract class JHTMLBehavior { /** * Method to load the mootools framework into the document head @@ -32,7 +32,7 @@ class JHTMLBehavior * @return void * @since 1.5 */ - function mootools($debug = null) + public static function mootools($debug = null) { static $loaded; @@ -59,23 +59,23 @@ function mootools($debug = null) return; } - function caption() { + public static function caption() { JHTML::script('caption.js'); } - function formvalidation() { + public static function formvalidation() { JHTML::script('validate.js' ); } - function switcher() { + public static function switcher() { JHTML::script('switcher.js' ); } - function combobox() { + public static function combobox() { JHTML::script('combobox.js' ); } - function tooltip($selector='.hasTip', $params = array()) + public static function tooltip($selector='.hasTip', $params = array()) { static $tips; @@ -98,6 +98,7 @@ function tooltip($selector='.hasTip', $params = array()) $opt['hideDelay'] = (isset($params['hideDelay'])) ? (int)$params['hideDelay'] : null; $opt['className'] = (isset($params['className'])) ? $params['className'] : null; $opt['fixed'] = (isset($params['fixed']) && ($params['fixed'])) ? '\\true' : '\\false'; + $opt['initialize'] = (isset($params['initialize'])) ? '\\'.$params['initialize'] : null; $opt['onShow'] = (isset($params['onShow'])) ? '\\'.$params['onShow'] : null; $opt['onHide'] = (isset($params['onHide'])) ? '\\'.$params['onHide'] : null; @@ -113,7 +114,54 @@ function tooltip($selector='.hasTip', $params = array()) return; } - function modal($selector='a.modal', $params = array()) + /** + * Load Weblink snapshot javascript + */ + public static function imagetooltip($width=120, $height=90, $selector='.hasSnapshot', $params = array()) + { + static $snapshots; + + if (!isset($snapshots)) { + $snapshots = array(); + } + + $sig = md5(serialize(array($selector,$params))); + if (isset($snapshots[$sig]) && ($snapshots[$sig])) { + return; + } + + $params['initialize'] = " + function() + { + $$('" . $selector . "').each( + function (el){ + if (el.id){ + el.\$tmp.myImg = el.id; + el.removeAttribute('id'); + } + el.addEvent('mouseenter', function(event){ + this.start(el); + if (el.\$tmp.myImg){ + this.img = new Element('img', { + src: el.\$tmp.myImg, + width: $width, + height: $height, + }); + this.img.inject(new Element('div', {'class': this.options.className + '-img'}).inject(this.wrapper)); + } + }.bind(this)); + }, + this); + }"; + + JHTMLBehavior::tooltip($selector, $params); + + // Set static array + $snapshots[$sig] = true; + return; + } + + public static function modal($selector='a.modal', $params = array()) { static $modals; static $included; @@ -171,7 +219,7 @@ function modal($selector='a.modal', $params = array()) return; } - function uploader($id='file-upload', $params = array()) + public static function uploader($id='file-upload', $params = array()) { JHTML::script('swf.js' ); JHTML::script('uploader.js' ); @@ -225,7 +273,7 @@ function uploader($id='file-upload', $params = array()) return; } - function tree($id, $params = array(), $root = array()) + public static function tree($id, $params = array(), $root = array()) { static $trees; @@ -279,7 +327,7 @@ function tree($id, $params = array(), $root = array()) return; } - function calendar() + public static function calendar() { $document =& JFactory::getDocument(); JHTML::stylesheet('calendar-jos.css', 'media/system/css/', array(' title' => JText::_( 'green' ) ,' media' => 'all' )); @@ -295,7 +343,7 @@ function calendar() /** * Keep session alive, for example, while editing or creating an article. */ - function keepalive() + public static function keepalive() { // Include mootools framework JHTMLBehavior::mootools(); @@ -326,7 +374,7 @@ function keepalive() * @return string JavaScript object notation representation of the array * @since 1.5 */ - function _getJSObject($array=array()) + protected static function _getJSObject($array=array()) { // Initialize variables $object = '{'; @@ -359,7 +407,7 @@ function _getJSObject($array=array()) * @return string JavaScript that translates the object * @since 1.5 */ - function _calendartranslation() + protected static function _calendartranslation() { static $jsscript = 0; @@ -382,7 +430,7 @@ function _calendartranslation() "- or Shift-click to decrease it\n" + "- or click and drag for faster selection."; - Calendar._TT["PREV_YEAR"] = "'.JText::_('Prev. year (hold for menu)').'";Calendar._TT["PREV_MONTH"] = "'.JText::_('Prev. month (hold for menu)').'"; Calendar._TT["GO_TODAY"] = "'.JText::_('Go Today').'";Calendar._TT["NEXT_MONTH"] = "'.JText::_('Next month (hold for menu)').'";Calendar._TT["NEXT_YEAR"] = "'.JText::_('Next year (hold for menu)').'";Calendar._TT["SEL_DATE"] = "'.JText::_('Select date').'";Calendar._TT["DRAG_TO_MOVE"] = "'.JText::_('Drag to move').'";Calendar._TT["PART_TODAY"] = "'.JText::_('(Today)').'";Calendar._TT["DAY_FIRST"] = "'.JText::_('Display %s first').'";Calendar._TT["WEEKEND"] = "0,6";Calendar._TT["CLOSE"] = "'.JText::_('Close').'";Calendar._TT["TODAY"] = "'.JText::_('Today').'";Calendar._TT["TIME_PART"] = "'.JText::_('(Shift-)Click or drag to change value').'";Calendar._TT["DEF_DATE_FORMAT"] = "'.JText::_('%Y-%m-%d').'"; Calendar._TT["TT_DATE_FORMAT"] = "'.JText::_('%a, %b %e').'";Calendar._TT["WK"] = "wk";Calendar._TT["TIME"] = "'.JText::_('Time:').'";'; + Calendar._TT["PREV_YEAR"] = "'.JText::_('Prev. year (hold for menu)').'";Calendar._TT["PREV_MONTH"] = "'.JText::_('Prev. month (hold for menu)').'"; Calendar._TT["GO_TODAY"] = "'.JText::_('Go Today').'";Calendar._TT["NEXT_MONTH"] = "'.JText::_('Next month (hold for menu)').'";Calendar._TT["NEXT_YEAR"] = "'.JText::_('Next year (hold for menu)').'";Calendar._TT["SEL_DATE"] = "'.JText::_('Select date').'";Calendar._TT["DRAG_TO_MOVE"] = "'.JText::_('Drag to move').'";Calendar._TT["PART_TODAY"] = "'.JText::_('(Today)').'";Calendar._TT["DAY_FIRST"] = "'.JText::_('Display %s first').'";Calendar._TT["WEEKEND"] = "0,6";Calendar._TT["CLOSE"] = "'.JText::_('Close').'";Calendar._TT["TODAY"] = "'.JText::_('Today').'";Calendar._TT["TIME_PART"] = "'.JText::_('(Shift-)Click or drag to change value').'";Calendar._TT["DEF_DATE_FORMAT"] = "'.JText::_('%Y-%m-%d').'"; Calendar._TT["TT_DATE_FORMAT"] = "'.JText::_('%a, %b %e').'";Calendar._TT["WK"] = "'.JText::_('wk').'";Calendar._TT["TIME"] = "'.JText::_('Time:').'";'; $jsscript = 1; return $return; } else { diff --git a/libraries/joomla/html/html/content.php b/libraries/joomla/html/html/content.php index 8b2542c20f739..c0f90ef091f1f 100644 --- a/libraries/joomla/html/html/content.php +++ b/libraries/joomla/html/html/content.php @@ -1,50 +1,50 @@ -text = $text; - JPluginHelper::importPlugin('content'); - $dispatcher = &JDispatcher::getInstance(); - $results = $dispatcher->trigger( - 'onPrepareContent', array (&$article, &$params, 0) - ); - - return $article->text; - } - -} +text = $text; + JPluginHelper::importPlugin('content'); + $dispatcher = &JDispatcher::getInstance(); + $results = $dispatcher->trigger( + 'onPrepareContent', array (&$article, &$params, 0) + ); + + return $article->text; + } + +} diff --git a/libraries/joomla/html/html/email.php b/libraries/joomla/html/html/email.php index 56f944a92d295..afde62588d1fd 100644 --- a/libraries/joomla/html/html/email.php +++ b/libraries/joomla/html/html/email.php @@ -1,103 +1,103 @@ -"; - $replacement .= "\n "; - $replacement .= '\n '; - - // XHTML compliance `No Javascript` text handling - $replacement .= ""; - $replacement .= JText::_('CLOAKING'); - $replacement .= "\n "; - - return $replacement; - } - - function _convertEncoding( $text ) - { - // replace vowels with character encoding - $text = str_replace( 'a', 'a', $text ); - $text = str_replace( 'e', 'e', $text ); - $text = str_replace( 'i', 'i', $text ); - $text = str_replace( 'o', 'o', $text ); - $text = str_replace( 'u', 'u', $text ); - - return $text; - } -} - +"; + $replacement .= "\n "; + $replacement .= '\n '; + + // XHTML compliance `No Javascript` text handling + $replacement .= ""; + $replacement .= JText::_('CLOAKING'); + $replacement .= "\n "; + + return $replacement; + } + + protected static function _convertEncoding( $text ) + { + // replace vowels with character encoding + $text = str_replace( 'a', 'a', $text ); + $text = str_replace( 'e', 'e', $text ); + $text = str_replace( 'i', 'i', $text ); + $text = str_replace( 'o', 'o', $text ); + $text = str_replace( 'u', 'u', $text ); + + return $text; + } +} + diff --git a/libraries/joomla/html/html/form.php b/libraries/joomla/html/html/form.php index ff0939dd8b41e..d9901e1f55b05 100644 --- a/libraries/joomla/html/html/form.php +++ b/libraries/joomla/html/html/form.php @@ -1,38 +1,38 @@ -'; - } -} \ No newline at end of file +'; + } +} diff --git a/libraries/joomla/html/html/grid.php b/libraries/joomla/html/html/grid.php index 6e58d4332c3e9..b3ab780bf5d58 100644 --- a/libraries/joomla/html/html/grid.php +++ b/libraries/joomla/html/html/grid.php @@ -1,173 +1,176 @@ -'; - $html .= JText::_( $title ); - if ($order == $selected ) { - $html .= JHTML::_('image.administrator', $images[$index], '/images/', NULL, NULL); - } - $html .= ''; - return $html; - } - - /** - * @param int The row index - * @param int The record id - * @param boolean - * @param string The name of the form element - * - * @return string - */ - function id( $rowNum, $recId, $checkedOut=false, $name='cid' ) - { - if ( $checkedOut ) { - return ''; - } else { - return ''; - } - } - - function access( &$row, $i, $archived = NULL ) - { - if ( !$row->access ) { - $color_access = 'style="color: green;"'; - $task_access = 'accessregistered'; - } else if ( $row->access == 1 ) { - $color_access = 'style="color: red;"'; - $task_access = 'accessspecial'; - } else { - $color_access = 'style="color: black;"'; - $task_access = 'accesspublic'; - } - - if ($archived == -1) - { - $href = JText::_( $row->groupname ); - } - else - { - $href = ' - - '. JText::_( $row->groupname ) .'' - ; - } - - return $href; - } - - function checkedOut( &$row, $i, $identifier = 'id' ) - { - $user =& JFactory::getUser(); - $userid = $user->get('id'); - - $result = false; - if(is_a($row, 'JTable')) { - $result = $row->isCheckedOut($userid); - } else { - $result = JTable::isCheckedOut($userid, $row->checked_out); - } - - $checked = ''; - if ( $result ) { - $checked = JHTMLGrid::_checkedOut( $row ); - } else { - $checked = JHTML::_('grid.id', $i, $row->$identifier ); - } - - return $checked; - } - - function published( &$row, $i, $imgY = 'tick.png', $imgX = 'publish_x.png', $prefix='' ) - { - $img = $row->published ? $imgY : $imgX; - $task = $row->published ? 'unpublish' : 'publish'; - $alt = $row->published ? JText::_( 'Published' ) : JText::_( 'Unpublished' ); - $action = $row->published ? JText::_( 'Unpublish Item' ) : JText::_( 'Publish item' ); - - $href = ' - - '. $alt .'' - ; - - return $href; - } - - function state( $filter_state='*', $published='Published', $unpublished='Unpublished', $archived=NULL, $trashed=NULL ) - { - $state[] = JHTML::_('select.option', '', '- '. JText::_( 'Select State' ) .' -' ); - //Jinx : Why is this used ? - //$state[] = JHTML::_('select.option', '*', JText::_( 'Any' ) ); - $state[] = JHTML::_('select.option', 'P', JText::_( $published ) ); - $state[] = JHTML::_('select.option', 'U', JText::_( $unpublished ) ); - - if ($archived) { - $state[] = JHTML::_('select.option', 'A', JText::_( $archived ) ); - } - - if ($trashed) { - $state[] = JHTML::_('select.option', 'T', JText::_( $trashed ) ); - } - - return JHTML::_('select.genericlist', $state, 'filter_state', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_state ); - } - - function order( $rows, $image='filesave.png', $task="saveorder" ) - { - $image = JHTML::_('image.administrator', $image, '/images/', NULL, NULL, JText::_( 'Save Order' ) ); - $href = ''.$image.''; - return $href; - } - - - function _checkedOut( &$row, $overlib = 1 ) - { - $hover = ''; - if ( $overlib ) - { - $text = addslashes(htmlspecialchars($row->editor)); - - $date = JHTML::_('date', $row->checked_out_time, '%A, %d %B %Y' ); - $time = JHTML::_('date', $row->checked_out_time, '%H:%M' ); - - $hover = ''; - } - $checked = $hover .''; - - return $checked; - } -} +'; + $html .= JText::_( $title ); + if ($order == $selected ) { + $html .= JHTML::_('image.administrator', $images[$index], '/images/', NULL, NULL); + } + $html .= ''; + return $html; + } + + /** + * @param int The row index + * @param int The record id + * @param boolean + * @param string The name of the form element + * + * @return string + */ + public static function id( $rowNum, $recId, $checkedOut=false, $name='cid' ) + { + if ( $checkedOut ) { + return ''; + } else { + return ''; + } + } + + public static function access( &$row, $i, $archived = NULL ) + { + if ( !$row->access ) { + $color_access = 'style="color: green;"'; + $task_access = 'accessregistered'; + } else if ( $row->access == 1 ) { + $color_access = 'style="color: red;"'; + $task_access = 'accessspecial'; + } else { + $color_access = 'style="color: black;"'; + $task_access = 'accesspublic'; + } + + if ($archived == -1) + { + $href = JText::_( $row->groupname ); + } + else + { + $href = ' + + '. JText::_( $row->groupname ) .'' + ; + } + + return $href; + } + + public static function checkedOut( &$row, $i, $identifier = 'id' ) + { + $user =& JFactory::getUser(); + $userid = $user->get('id'); + + $result = false; + if($row INSTANCEOF JTable) { + $result = $row->isCheckedOut($userid); + } else { + $result = JTable::isCheckedOut($userid, $row->checked_out); + } + + $checked = ''; + if ( $result ) { + $checked = JHTMLGrid::_checkedOut( $row ); + } else { + if ($identifier == 'id') + $checked = JHTML::_('grid.id', $i, $row->$identifier ); + else + $checked = JHTML::_('grid.id', $i, $row->$identifier, $result, $identifier ); + } + + return $checked; + } + + public static function published( &$row, $i, $imgY = 'tick.png', $imgX = 'publish_x.png', $prefix='' ) + { + $img = $row->published ? $imgY : $imgX; + $task = $row->published ? 'unpublish' : 'publish'; + $alt = $row->published ? JText::_( 'Published' ) : JText::_( 'Unpublished' ); + $action = $row->published ? JText::_( 'Unpublish Item' ) : JText::_( 'Publish item' ); + + $href = ' + + '. $alt .'' + ; + + return $href; + } + + public static function state( $filter_state='*', $published='Published', $unpublished='Unpublished', $archived=NULL, $trashed=NULL ) + { + $state[] = JHTML::_('select.option', '', '- '. JText::_( 'Select State' ) .' -' ); + //Jinx : Why is this used ? + //$state[] = JHTML::_('select.option', '*', JText::_( 'Any' ) ); + $state[] = JHTML::_('select.option', 'P', JText::_( $published ) ); + $state[] = JHTML::_('select.option', 'U', JText::_( $unpublished ) ); + + if ($archived) { + $state[] = JHTML::_('select.option', 'A', JText::_( $archived ) ); + } + + if ($trashed) { + $state[] = JHTML::_('select.option', 'T', JText::_( $trashed ) ); + } + + return JHTML::_('select.genericlist', $state, 'filter_state', 'class="inputbox" size="1" onchange="submitform( );"', 'value', 'text', $filter_state ); + } + + public static function order( $rows, $image='filesave.png', $task="saveorder" ) + { + $image = JHTML::_('image.administrator', $image, '/images/', NULL, NULL, JText::_( 'Save Order' ) ); + $href = ''.$image.''; + return $href; + } + + + protected static function _checkedOut( &$row, $overlib = 1 ) + { + $hover = ''; + if ( $overlib ) + { + $text = addslashes(htmlspecialchars($row->editor)); + + $date = JHTML::_('date', $row->checked_out_time, '%A, %d %B %Y' ); + $time = JHTML::_('date', $row->checked_out_time, '%H:%M' ); + + $hover = ''; + } + $checked = $hover .''; + + return $checked; + } +} diff --git a/libraries/joomla/html/html/image.php b/libraries/joomla/html/html/image.php index c4ce43145e9bb..3d3c5d8900804 100644 --- a/libraries/joomla/html/html/image.php +++ b/libraries/joomla/html/html/image.php @@ -1,153 +1,153 @@ -getTemplate(); - - if ( $altFile ) - { - // $param allows for an alternative file to be used - $src = $altFolder . $altFile; - } - else if ( $altFile == -1 ) - { - // Comes from an image list param field with 'Do not use' selected - return ''; - } else { - $path = JPATH_SITE .'/templates/'. $cur_template .'/images/'. $file; - if (!isset( $paths[$path] )) - { - if ( file_exists( JPATH_SITE .'/templates/'. $cur_template .'/images/'. $file ) ) { - $paths[$path] = 'templates/'. $cur_template .'/images/'. $file; - } else { - // outputs only path to image - $paths[$path] = $folder . $file; - } - } - $src = $paths[$path]; - } - - if (substr($src, 0, 1 ) == "/") { - $src = substr_replace($src, '', 0, 1); - } - - // Prepend the base path - $src = JURI::base(true).'/'.$src; - - // outputs actual html tag - if ($asTag) { - return ''. html_entity_decode( $alt ) .''; - } - - return $src; - } - - /** - * Checks to see if an image exists in the current templates image directory - * if it does it loads this image. Otherwise the default image is loaded. - * Also can be used in conjunction with the menulist param to create the chosen image - * load the default or use no image - * - * @param string The file name, eg foobar.png - * @param string The path to the image - * @param int empty: use $file and $folder, -1: show no image, not-empty: use $altFile and $altFolder - * @param string Another path. Only used for the contact us form based on the value of the imagelist parm - * @param string Alt text - * @param array An associative array of attributes to add - * @param boolean True (default) to display full tag, false to return just the path - */ - function administrator( $file, $directory='/images/', $param=NULL, $param_directory='/images/', $alt = NULL, $attribs = null, $type = 1 ) - { - global $mainframe; - - if (is_array( $attribs )) { - $attribs = JArrayHelper::toString( $attribs ); - } - - $cur_template = $mainframe->getTemplate(); - - // strip html - $alt = html_entity_decode( $alt ); - - if ( $param ) { - $image = $param_directory . $param; - } else if ( $param == -1 ) { - $image = ''; - } else { - if ( file_exists( JPATH_ADMINISTRATOR .'/templates/'. $cur_template .'/images/'. $file ) ) { - $image = 'templates/'. $cur_template .'/images/'. $file; - } else { - // compability with previous versions - if ( substr($directory, 0, 14 )== "/administrator" ) { - $image = substr($directory,15) . $file; - } else { - $image = $directory . $file; - } - } - } - - if (substr($image, 0, 1 ) == "/") { - $image = substr_replace($image, '', 0, 1); - } - - // Prepend the base path - $image = JURI::base(true).'/'.$image; - - // outputs actual html tag - if ( $type ) { - $image = ''. $alt .''; - } - - return $image; - } -} \ No newline at end of file +getTemplate(); + + if ( $altFile ) + { + // $param allows for an alternative file to be used + $src = $altFolder . $altFile; + } + else if ( $altFile == -1 ) + { + // Comes from an image list param field with 'Do not use' selected + return ''; + } else { + $path = JPATH_SITE .'/templates/'. $cur_template .'/images/'. $file; + if (!isset( $paths[$path] )) + { + if ( file_exists( JPATH_SITE .'/templates/'. $cur_template .'/images/'. $file ) ) { + $paths[$path] = 'templates/'. $cur_template .'/images/'. $file; + } else { + // outputs only path to image + $paths[$path] = $folder . $file; + } + } + $src = $paths[$path]; + } + + if (substr($src, 0, 1 ) == "/") { + $src = substr_replace($src, '', 0, 1); + } + + // Prepend the base path + $src = JURI::base(true).'/'.$src; + + // outputs actual html tag + if ($asTag) { + return ''. html_entity_decode( $alt ) .''; + } + + return $src; + } + + /** + * Checks to see if an image exists in the current templates image directory + * if it does it loads this image. Otherwise the default image is loaded. + * Also can be used in conjunction with the menulist param to create the chosen image + * load the default or use no image + * + * @param string The file name, eg foobar.png + * @param string The path to the image + * @param int empty: use $file and $folder, -1: show no image, not-empty: use $altFile and $altFolder + * @param string Another path. Only used for the contact us form based on the value of the imagelist parm + * @param string Alt text + * @param array An associative array of attributes to add + * @param boolean True (default) to display full tag, false to return just the path + */ + public static function administrator( $file, $directory='/images/', $param=NULL, $param_directory='/images/', $alt = NULL, $attribs = null, $type = 1 ) + { + $appl = JFactory::getApplication(); + + if (is_array( $attribs )) { + $attribs = JArrayHelper::toString( $attribs ); + } + + $cur_template = $appl->getTemplate(); + + // strip html + $alt = html_entity_decode( $alt ); + + if ( $param ) { + $image = $param_directory . $param; + } else if ( $param == -1 ) { + $image = ''; + } else { + if ( file_exists( JPATH_ADMINISTRATOR .'/templates/'. $cur_template .'/images/'. $file ) ) { + $image = 'templates/'. $cur_template .'/images/'. $file; + } else { + // compability with previous versions + if ( substr($directory, 0, 14 )== "/administrator" ) { + $image = substr($directory,15) . $file; + } else { + $image = $directory . $file; + } + } + } + + if (substr($image, 0, 1 ) == "/") { + $image = substr_replace($image, '', 0, 1); + } + + // Prepend the base path + $image = JURI::base(true).'/'.$image; + + // outputs actual html tag + if ( $type ) { + $image = ''. $alt .''; + } + + return $image; + } +} diff --git a/libraries/joomla/html/html/index.html b/libraries/joomla/html/html/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/html/html/index.html +++ b/libraries/joomla/html/html/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/html/html/list.php b/libraries/joomla/html/html/list.php index 5064416931f72..a28284f5a5b34 100644 --- a/libraries/joomla/html/html/list.php +++ b/libraries/joomla/html/html/list.php @@ -1,231 +1,256 @@ -setQuery( $query ); - $groups = $db->loadObjectList(); - $access = JHTML::_('select.genericlist', $groups, 'access', 'class="inputbox" size="3"', 'value', 'text', intval( $row->access ), '', 1 ); - - return $access; - } - - /** - * Build the select list to choose an image - */ - function images( $name, $active = NULL, $javascript = NULL, $directory = NULL ) - { - if ( !$directory ) { - $directory = '/images/stories/'; - } - - if ( !$javascript ) { - $javascript = "onchange=\"javascript:if (document.forms.adminForm." . $name . ".options[selectedIndex].value!='') {document.imagelib.src='..$directory' + document.forms.adminForm." . $name . ".options[selectedIndex].value} else {document.imagelib.src='../images/blank.png'}\""; - } - - jimport( 'joomla.filesystem.folder' ); - $imageFiles = JFolder::files( JPATH_SITE.DS.$directory ); - $images = array( JHTML::_('select.option', '', '- '. JText::_( 'Select Image' ) .' -' ) ); - foreach ( $imageFiles as $file ) { - if ( eregi( "bmp|gif|jpg|png", $file ) ) { - $images[] = JHTML::_('select.option', $file ); - } - } - $images = JHTML::_('select.genericlist', $images, $name, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active ); - - return $images; - } - - /** - * Description - * - * @param string SQL with ordering As value and 'name field' AS text - * @param integer The length of the truncated headline - * @since 1.5 - */ - function genericordering( $sql, $chop = '30' ) - { - $db =& JFactory::getDBO(); - $order = array(); - $db->setQuery( $sql ); - if (!($orders = $db->loadObjectList())) { - if ($db->getErrorNum()) { - echo $db->stderr(); - return false; - } else { - $order[] = JHTML::_('select.option', 1, JText::_( 'first' ) ); - return $order; - } - } - $order[] = JHTML::_('select.option', 0, '0 '. JText::_( 'first' ) ); - for ($i=0, $n=count( $orders ); $i < $n; $i++) { - - if (JString::strlen($orders[$i]->text) > $chop) { - $text = JString::substr($orders[$i]->text,0,$chop)."..."; - } else { - $text = $orders[$i]->text; - } - - $order[] = JHTML::_('select.option', $orders[$i]->value, $orders[$i]->value.' ('.$text.')' ); - } - $order[] = JHTML::_('select.option', $orders[$i-1]->value+1, ($orders[$i-1]->value+1).' '. JText::_( 'last' ) ); - - return $order; - } - - /** - * Build the select list for Ordering of a specified Table - */ - function specificordering( &$row, $id, $query, $neworder = 0 ) - { - $db =& JFactory::getDBO(); - - if ( $id ) { - $order = JHTML::_('list.genericordering', $query ); - $ordering = JHTML::_('select.genericlist', $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ) ); - } else { - if ( $neworder ) { - $text = JText::_( 'descNewItemsFirst' ); - } else { - $text = JText::_( 'descNewItemsLast' ); - } - $ordering = ''. $text; - } - return $ordering; - } - - /** - * Select list of active users - */ - function users( $name, $active, $nouser = 0, $javascript = NULL, $order = 'name', $reg = 1 ) - { - $db =& JFactory::getDBO(); - - $and = ''; - if ( $reg ) { - // does not include registered users in the list - $and = ' AND gid > 18'; - } - - $query = 'SELECT id AS value, name AS text' - . ' FROM #__users' - . ' WHERE block = 0' - . $and - . ' ORDER BY '. $order - ; - $db->setQuery( $query ); - if ( $nouser ) { - $users[] = JHTML::_('select.option', '0', '- '. JText::_( 'No User' ) .' -' ); - $users = array_merge( $users, $db->loadObjectList() ); - } else { - $users = $db->loadObjectList(); - } - - $users = JHTML::_('select.genericlist', $users, $name, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active ); - - return $users; - } - - /** - * Select list of positions - generally used for location of images - */ - function positions( $name, $active = NULL, $javascript = NULL, $none = 1, $center = 1, $left = 1, $right = 1, $id = false ) - { - if ( $none ) { - $pos[] = JHTML::_('select.option', '', JText::_( 'None' ) ); - } - if ( $center ) { - $pos[] = JHTML::_('select.option', 'center', JText::_( 'Center' ) ); - } - if ( $left ) { - $pos[] = JHTML::_('select.option', 'left', JText::_( 'Left' ) ); - } - if ( $right ) { - $pos[] = JHTML::_('select.option', 'right', JText::_( 'Right' ) ); - } - - $positions = JHTML::_('select.genericlist', $pos, $name, 'class="inputbox" size="1"'. $javascript, 'value', 'text', $active, $id ); - - return $positions; - } - - /** - * Select list of active categories for components - */ - function category( $name, $section, $active = NULL, $javascript = NULL, $order = 'ordering', $size = 1, $sel_cat = 1 ) - { - $db =& JFactory::getDBO(); - - $query = 'SELECT id AS value, title AS text' - . ' FROM #__categories' - . ' WHERE section = '.$db->Quote($section) - . ' AND published = 1' - . ' ORDER BY '. $order - ; - $db->setQuery( $query ); - if ( $sel_cat ) { - $categories[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select a Category' ) .' -' ); - $categories = array_merge( $categories, $db->loadObjectList() ); - } else { - $categories = $db->loadObjectList(); - } - - $category = JHTML::_('select.genericlist', $categories, $name, 'class="inputbox" size="'. $size .'" '. $javascript, 'value', 'text', $active ); - return $category; - } - - /** - * Select list of active sections - */ - function section( $name, $active = NULL, $javascript = NULL, $order = 'ordering' ) - { - $db =& JFactory::getDBO(); - - $categories[] = JHTML::_('select.option', '-1', '- '. JText::_( 'Select Section' ) .' -' ); - $categories[] = JHTML::_('select.option', '0', JText::_( 'Uncategorized' ) ); - $query = 'SELECT id AS value, title AS text' - . ' FROM #__sections' - . ' WHERE published = 1' - . ' ORDER BY ' . $order - ; - $db->setQuery( $query ); - $sections = array_merge( $categories, $db->loadObjectList() ); - - $category = JHTML::_('select.genericlist', $sections, $name, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active ); - - return $category; - } -} \ No newline at end of file += 0' + . ' ORDER BY value' + ; + $db->setQuery( $query ); + try { + $groups = $db->loadObjectList(); + } catch(JException $e) { + $groups = array(); + } + $access = JHTML::_('select.genericlist', $groups, 'access', 'class="inputbox" size="3"', 'value', 'text', intval( $row->access ), '', 1 ); + + return $access; + } + + /** + * Build the select list to choose an image + */ + public static function images( $name, $active = NULL, $javascript = NULL, $directory = NULL, $extensions = "bmp|gif|jpg|png" ) + { + if ( !$directory ) { + $directory = '/images/stories/'; + } + + if ( !$javascript ) { + $javascript = "onchange=\"javascript:if (document.forms.adminForm." . $name . ".options[selectedIndex].value!='') {document.imagelib.src='..$directory' + document.forms.adminForm." . $name . ".options[selectedIndex].value} else {document.imagelib.src='../images/blank.png'}\""; + } + + jimport( 'joomla.filesystem.folder' ); + $imageFiles = JFolder::files( JPATH_SITE.DS.$directory ); + $images = array( JHTML::_('select.option', '', '- '. JText::_( 'Select Image' ) .' -' ) ); + foreach ( $imageFiles as $file ) { + if ( eregi( $extensions, $file ) ) { + $images[] = JHTML::_('select.option', $file ); + } + } + $images = JHTML::_('select.genericlist', $images, $name, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active ); + + return $images; + } + + /** + * Description + * + * @param string SQL with ordering As value and 'name field' AS text + * @param integer The length of the truncated headline + * @since 1.5 + */ + public static function genericordering( $sql, $chop = '30' ) + { + $db =& JFactory::getDBO(); + $order = array(); + $db->setQuery( $sql ); + try { + $order = $db->loadObjectList(); + } catch(JException $e) { + return false; + } + + if(empty($orders)) { + $order[] = JHTML::_('select.option', 1, JText::_( 'first' ) ); + return $order; + } + + $order[] = JHTML::_('select.option', 0, '0 '. JText::_( 'first' ) ); + for ($i=0, $n=count( $orders ); $i < $n; $i++) { + + if (JString::strlen($orders[$i]->text) > $chop) { + $text = JString::substr($orders[$i]->text,0,$chop)."..."; + } else { + $text = $orders[$i]->text; + } + + $order[] = JHTML::_('select.option', $orders[$i]->value, $orders[$i]->value.' ('.$text.')' ); + } + $order[] = JHTML::_('select.option', $orders[$i-1]->value+1, ($orders[$i-1]->value+1).' '. JText::_( 'last' ) ); + + return $order; + } + + /** + * Build the select list for Ordering of a specified Table + */ + public static function specificordering( &$row, $id, $query, $neworder = 0 ) + { + if ( $id ) { + $order = JHTML::_('list.genericordering', $query ); + $ordering = JHTML::_('select.genericlist', $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ) ); + } else { + if ( $neworder ) { + $text = JText::_( 'descNewItemsFirst' ); + } else { + $text = JText::_( 'descNewItemsLast' ); + } + $ordering = ''. $text; + } + return $ordering; + } + + /** + * Select list of active users + */ + public static function users( $name, $active, $nouser = 0, $javascript = NULL, $order = 'name', $reg = 1 ) + { + $db =& JFactory::getDBO(); + + $and = ''; + if ( $reg ) { + // does not include registered users in the list + $and = ' AND gid > 18'; + } + + $query = 'SELECT id AS value, name AS text' + . ' FROM #__users' + . ' WHERE block = 0' + . $and + . ' ORDER BY '. $order + ; + $db->setQuery( $query ); + if ( $nouser ) { + $users[] = JHTML::_('select.option', '0', '- '. JText::_( 'No User' ) .' -' ); + try { + $users = array_merge( $users, $db->loadObjectList() ); + } catch(JException $e) { + //ignore the error here + } + } else { + $users = $db->loadObjectList(); + } + + $users = JHTML::_('select.genericlist', $users, $name, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active ); + + return $users; + } + + /** + * Select list of positions - generally used for location of images + */ + public static function positions( $name, $active = NULL, $javascript = NULL, $none = 1, $center = 1, $left = 1, $right = 1, $id = false ) + { + if ( $none ) { + $pos[] = JHTML::_('select.option', '', JText::_( 'None' ) ); + } + if ( $center ) { + $pos[] = JHTML::_('select.option', 'center', JText::_( 'Center' ) ); + } + if ( $left ) { + $pos[] = JHTML::_('select.option', 'left', JText::_( 'Left' ) ); + } + if ( $right ) { + $pos[] = JHTML::_('select.option', 'right', JText::_( 'Right' ) ); + } + + $positions = JHTML::_('select.genericlist', $pos, $name, 'class="inputbox" size="1"'. $javascript, 'value', 'text', $active, $id ); + + return $positions; + } + + /** + * Select list of active categories for components + */ + public static function category( $name, $section, $active = NULL, $javascript = NULL, $order = 'ordering', $size = 1, $sel_cat = 1 ) + { + $db =& JFactory::getDBO(); + + $query = 'SELECT id AS value, title AS text' + . ' FROM #__categories' + . ' WHERE section = '.$db->Quote($section) + . ' AND published = 1' + . ' ORDER BY '. $order + ; + $db->setQuery( $query ); + if ( $sel_cat ) { + $categories[] = JHTML::_('select.option', '0', '- '. JText::_( 'Select a Category' ) .' -' ); + try { + $categories = array_merge( $categories, $db->loadObjectList() ); + } catch (JException $e) { + //Ignore error + } + } else { + try { + $categories = $db->loadObjectList(); + } catch (JException $e) { + $categories = array(); + } + } + + $category = JHTML::_('select.genericlist', $categories, $name, 'class="inputbox" size="'. $size .'" '. $javascript, 'value', 'text', $active ); + return $category; + } + + /** + * Select list of active sections + */ + public static function section( $name, $active = NULL, $javascript = NULL, $order = 'ordering', $uncategorized = true ) + { + $db =& JFactory::getDBO(); + + $categories[] = JHTML::_('select.option', '-1', '- '. JText::_( 'Select Section' ) .' -' ); + + if ($uncategorized) { + $categories[] = JHTML::_('select.option', '0', JText::_( 'Uncategorized' ) ); + } + + $query = 'SELECT id AS value, title AS text' + . ' FROM #__sections' + . ' WHERE published = 1' + . ' ORDER BY ' . $order + ; + $db->setQuery( $query ); + try { + $sections = array_merge( $categories, $db->loadObjectList() ); + } catch(JException $e) { + //ignore error + } + + $category = JHTML::_('select.genericlist', $sections, $name, 'class="inputbox" size="1" '. $javascript, 'value', 'text', $active ); + + return $category; + } +} diff --git a/libraries/joomla/html/html/menu.php b/libraries/joomla/html/html/menu.php index a7e364fc9e76b..e7018150861c0 100644 --- a/libraries/joomla/html/html/menu.php +++ b/libraries/joomla/html/html/menu.php @@ -1,154 +1,157 @@ -Quote($row->menutype) - . ' AND parent = '.(int) $row->parent - . ' AND published != -2' - . ' ORDER BY ordering'; - $order = JHTML::_('list.genericordering', $query ); - $ordering = JHTML::_('select.genericlist', $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ) ); - } - else - { - $ordering = ''. JText::_( 'DESCNEWITEMSLAST' ); - } - return $ordering; - } - - /** - * Build the multiple select list for Menu Links/Pages - */ - function linkoptions( $all=false, $unassigned=false ) - { - $db =& JFactory::getDBO(); - - // get a list of the menu items - $query = 'SELECT m.id, m.parent, m.name, m.menutype' - . ' FROM #__menu AS m' - . ' WHERE m.published = 1' - . ' ORDER BY m.menutype, m.parent, m.ordering' - ; - $db->setQuery( $query ); - $mitems = $db->loadObjectList(); - $mitems_temp = $mitems; - - // establish the hierarchy of the menu - $children = array(); - // first pass - collect children - foreach ( $mitems as $v ) - { - $id = $v->id; - $pt = $v->parent; - $list = @$children[$pt] ? $children[$pt] : array(); - array_push( $list, $v ); - $children[$pt] = $list; - } - // second pass - get an indent list of the items - $list = JHTMLMenu::TreeRecurse( intval( $mitems[0]->parent ), '', array(), $children, 9999, 0, 0 ); - - // Code that adds menu name to Display of Page(s) - $mitems_spacer = $mitems_temp[0]->menutype; - - $mitems = array(); - if ($all | $unassigned) { - $mitems[] = JHTML::_('select.option', '', JText::_( 'Menus' ) ); - - if ( $all ) { - $mitems[] = JHTML::_('select.option', 0, JText::_( 'All' ) ); - } - if ( $unassigned ) { - $mitems[] = JHTML::_('select.option', -1, JText::_( 'Unassigned' ) ); - } - - $mitems[] = JHTML::_('select.option', '' ); - } - - $lastMenuType = null; - $tmpMenuType = null; - foreach ($list as $list_a) - { - if ($list_a->menutype != $lastMenuType) - { - if ($tmpMenuType) { - $mitems[] = JHTML::_('select.option', '' ); - } - $mitems[] = JHTML::_('select.option', '', $list_a->menutype ); - $lastMenuType = $list_a->menutype; - $tmpMenuType = $list_a->menutype; - } - - $mitems[] = JHTML::_('select.option', $list_a->id, $list_a->treename ); - } - if ($lastMenuType !== null) { - $mitems[] = JHTML::_('select.option', '' ); - } - - return $mitems; - } - - function treerecurse( $id, $indent, $list, &$children, $maxlevel=9999, $level=0, $type=1 ) - { - if (@$children[$id] && $level <= $maxlevel) - { - foreach ($children[$id] as $v) - { - $id = $v->id; - - if ( $type ) { - $pre = '|_ '; - $spacer = '.      '; - } else { - $pre = '- '; - $spacer = '  '; - } - - if ( $v->parent == 0 ) { - $txt = $v->name; - } else { - $txt = $pre . $v->name; - } - $pt = $v->parent; - $list[$id] = $v; - $list[$id]->treename = "$indent$txt"; - $list[$id]->children = count( @$children[$id] ); - $list = JHTMLMenu::TreeRecurse( $id, $indent . $spacer, $list, $children, $maxlevel, $level+1, $type ); - } - } - return $list; - } -} \ No newline at end of file +Quote($row->menutype) + . ' AND parent = '.(int) $row->parent + . ' AND published != -2' + . ' ORDER BY ordering'; + $order = JHTML::_('list.genericordering', $query ); + $ordering = JHTML::_('select.genericlist', $order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval( $row->ordering ) ); + } + else + { + $ordering = ''. JText::_( 'DESCNEWITEMSLAST' ); + } + return $ordering; + } + + /** + * Build the multiple select list for Menu Links/Pages + */ + public static function linkoptions( $all=false, $unassigned=false ) + { + $db =& JFactory::getDBO(); + + // get a list of the menu items + $query = 'SELECT m.id, m.parent, m.name, m.menutype' + . ' FROM #__menu AS m' + . ' WHERE m.published = 1' + . ' ORDER BY m.menutype, m.parent, m.ordering' + ; + $db->setQuery( $query ); + try { + $mitems = $db->loadObjectList(); + } catch(JException $e) { + $mitems = array(); + } + $mitems_temp = $mitems; + + // establish the hierarchy of the menu + $children = array(); + // first pass - collect children + foreach ( $mitems as $v ) + { + $id = $v->id; + $pt = $v->parent; + $list = @$children[$pt] ? $children[$pt] : array(); + array_push( $list, $v ); + $children[$pt] = $list; + } + // second pass - get an indent list of the items + $list = JHTMLMenu::TreeRecurse( intval( $mitems[0]->parent ), '', array(), $children, 9999, 0, 0 ); + + // Code that adds menu name to Display of Page(s) + $mitems_spacer = $mitems_temp[0]->menutype; + + $mitems = array(); + if ($all | $unassigned) { + $mitems[] = JHTML::_('select.option', '', JText::_( 'Menus' ) ); + + if ( $all ) { + $mitems[] = JHTML::_('select.option', 0, JText::_( 'All' ) ); + } + if ( $unassigned ) { + $mitems[] = JHTML::_('select.option', -1, JText::_( 'Unassigned' ) ); + } + + $mitems[] = JHTML::_('select.option', '' ); + } + + $lastMenuType = null; + $tmpMenuType = null; + foreach ($list as $list_a) + { + if ($list_a->menutype != $lastMenuType) + { + if ($tmpMenuType) { + $mitems[] = JHTML::_('select.option', '' ); + } + $mitems[] = JHTML::_('select.option', '', $list_a->menutype ); + $lastMenuType = $list_a->menutype; + $tmpMenuType = $list_a->menutype; + } + + $mitems[] = JHTML::_('select.option', $list_a->id, $list_a->treename ); + } + if ($lastMenuType !== null) { + $mitems[] = JHTML::_('select.option', '' ); + } + + return $mitems; + } + + public static function treerecurse( $id, $indent, $list, &$children, $maxlevel=9999, $level=0, $type=1 ) + { + if (@$children[$id] && $level <= $maxlevel) + { + foreach ($children[$id] as $v) + { + $id = $v->id; + + if ( $type ) { + $pre = '|_ '; + $spacer = '.      '; + } else { + $pre = '- '; + $spacer = '  '; + } + + if ( $v->parent == 0 ) { + $txt = $v->name; + } else { + $txt = $pre . $v->name; + } + $pt = $v->parent; + $list[$id] = $v; + $list[$id]->treename = "$indent$txt"; + $list[$id]->children = count( @$children[$id] ); + $list = JHTMLMenu::TreeRecurse( $id, $indent . $spacer, $list, $children, $maxlevel, $level+1, $type ); + } + } + return $list; + } +} diff --git a/libraries/joomla/html/html/select.php b/libraries/joomla/html/html/select.php index 174ca22e1a56d..4b0098ebfe7d3 100644 --- a/libraries/joomla/html/html/select.php +++ b/libraries/joomla/html/html/select.php @@ -20,7 +20,7 @@ * @subpackage HTML * @since 1.5 */ -class JHTMLSelect +abstract class JHTMLSelect { /** * @param string The value of the option @@ -29,7 +29,7 @@ class JHTMLSelect * @param string The returned object property name for the text * @return object */ - function option( $value, $text='', $value_name='value', $text_name='text', $disable=false ) + public static function option( $value, $text='', $value_name='value', $text_name='text', $disable=false ) { $obj = new stdClass; $obj->$value_name = $value; @@ -44,7 +44,7 @@ function option( $value, $text='', $value_name='value', $text_name='text', $disa * @param string The returned object property name for the text * @return object */ - function optgroup( $text, $value_name = 'value', $text_name = 'text' ) + public static function optgroup( $text, $value_name = 'value', $text_name = 'text' ) { $obj = new stdClass; $obj->$value_name = ''; @@ -61,7 +61,7 @@ function optgroup( $text, $value_name = 'value', $text_name = 'text' ) * @param mixed The key that is selected (accepts an array or a string) * @returns string HTML for the select list */ - function options( $arr, $key = 'value', $text = 'text', $selected = null, $translate = false ) + public static function options( $arr, $key = 'value', $text = 'text', $selected = null, $translate = false ) { $html = ''; @@ -118,7 +118,7 @@ function options( $arr, $key = 'value', $text = 'text', $selected = null, $trans } } } else { - $extra .= ( $k == $selected ? ' selected="selected"' : '' ); + $extra .= ( (string)$k == (string)$selected ? ' selected="selected"' : '' ); } //if flag translate text @@ -148,7 +148,7 @@ function options( $arr, $key = 'value', $text = 'text', $selected = null, $trans * @param mixed The key that is selected (accepts an array or a string) * @returns string HTML for the select list */ - function genericlist( $arr, $name, $attribs = null, $key = 'value', $text = 'text', $selected = NULL, $idtag = false, $translate = false ) + public static function genericlist( $arr, $name, $attribs = null, $key = 'value', $text = 'text', $selected = NULL, $idtag = false, $translate = false ) { if ( is_array( $arr ) ) { reset( $arr ); @@ -186,7 +186,7 @@ function genericlist( $arr, $name, $attribs = null, $key = 'value', $text = 'tex * @param string The printf format to be applied to the number * @returns string HTML for the select list */ - function integerlist( $start, $end, $inc, $name, $attribs = null, $selected = null, $format = "" ) + public static function integerlist( $start, $end, $inc, $name, $attribs = null, $selected = null, $format = "" ) { $start = intval( $start ); $end = intval( $end ); @@ -213,7 +213,7 @@ function integerlist( $start, $end, $inc, $name, $attribs = null, $selected = nu * @param string The name of the object variable for the option text * @returns string HTML for the select list */ - function radiolist( $arr, $name, $attribs = null, $key = 'value', $text = 'text', $selected = null, $idtag = false, $translate = false ) + public static function radiolist( $arr, $name, $attribs = null, $key = 'value', $text = 'text', $selected = null, $idtag = false, $translate = false ) { reset( $arr ); $html = ''; @@ -247,7 +247,7 @@ function radiolist( $arr, $name, $attribs = null, $key = 'value', $text = 'text' } } } else { - $extra .= ($k == $selected ? " checked=\"checked\"" : ''); + $extra .= ((string)$k == (string)$selected ? " checked=\"checked\"" : ''); } $html .= "\n\t"; $html .= "\n\t"; @@ -264,7 +264,7 @@ function radiolist( $arr, $name, $attribs = null, $key = 'value', $text = 'text' * @param mixed The key that is selected * @returns string HTML for the radio list */ - function booleanlist( $name, $attribs = null, $selected = null, $yes='yes', $no='no', $id=false ) + public static function booleanlist( $name, $attribs = null, $selected = null, $yes='yes', $no='no', $id=false ) { $arr = array( JHTML::_('select.option', '0', JText::_( $no ) ), diff --git a/libraries/joomla/html/index.html b/libraries/joomla/html/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/html/index.html +++ b/libraries/joomla/html/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/html/pagination.php b/libraries/joomla/html/pagination.php index de91e45025b04..78701a3c12336 100644 --- a/libraries/joomla/html/pagination.php +++ b/libraries/joomla/html/pagination.php @@ -19,7 +19,6 @@ * Pagination Class. Provides a common interface for content pagination for the * Joomla! Framework * - * @author Louis Landry * @package Joomla.Framework * @subpackage HTML * @since 1.5 @@ -32,7 +31,7 @@ class JPagination extends JObject * @access public * @var int */ - var $limitstart = null; + public $limitstart = null; /** * Number of rows to display per page @@ -40,7 +39,7 @@ class JPagination extends JObject * @access public * @var int */ - var $limit = null; + public $limit = null; /** * Total number of rows @@ -48,7 +47,7 @@ class JPagination extends JObject * @access public * @var int */ - var $total = null; + public $total = null; /** * View all flag @@ -56,7 +55,12 @@ class JPagination extends JObject * @access protected * @var boolean */ - var $_viewall = false; + protected $_viewall = false; + + protected $pages_total = 0; + protected $pages_current = 0; + protected $pages_start = 0; + protected $pages_stop = 0; /** * Constructor @@ -65,7 +69,7 @@ class JPagination extends JObject * @param int The offset of the item to start at * @param int The number of items to display per page */ - function __construct($total, $limitstart, $limit) + public function __construct($total, $limitstart, $limit) { // Value/Type checking $this->total = (int) $total; @@ -89,17 +93,17 @@ function __construct($total, $limitstart, $limit) // Set the total pages and current page values if($this->limit > 0) { - $this->set( 'pages.total', ceil($this->total / $this->limit)); - $this->set( 'pages.current', ceil(($this->limitstart + 1) / $this->limit)); + $this->set( 'pages_total', ceil($this->total / $this->limit)); + $this->set( 'pages_current', ceil(($this->limitstart + 1) / $this->limit)); } // Set the pagination iteration loop values $displayedPages = 10; - $this->set( 'pages.start', (floor(($this->get('pages.current') -1) / $displayedPages)) * $displayedPages +1); - if ($this->get('pages.start') + $displayedPages -1 < $this->get('pages.total')) { - $this->set( 'pages.stop', $this->get('pages.start') + $displayedPages -1); + $this->set( 'pages_start', (floor(($this->get('pages_current') -1) / $displayedPages)) * $displayedPages +1); + if ($this->get('pages_start') + $displayedPages -1 < $this->get('pages_total')) { + $this->set( 'pages_stop', $this->get('pages_start') + $displayedPages -1); } else { - $this->set( 'pages.stop', $this->get('pages.total')); + $this->set( 'pages_stop', $this->get('pages_total')); } // If we are viewing all records set the view all flag to true @@ -116,7 +120,7 @@ function __construct($total, $limitstart, $limit) * @return int Rationalised offset for a row with a given index * @since 1.5 */ - function getRowOffset($index) + public function getRowOffset($index) { return $index +1 + $this->limitstart; } @@ -128,7 +132,7 @@ function getRowOffset($index) * @return object Pagination data object * @since 1.5 */ - function getData() + public function getData() { static $data; if (!is_object($data)) { @@ -144,12 +148,12 @@ function getData() * @return string Pagination pages counter string * @since 1.5 */ - function getPagesCounter() + public function getPagesCounter() { // Initialize variables $html = null; - if ($this->get('pages.total') > 1) { - $html .= JText::_('Page')." ".$this->get('pages.current')." ".JText::_('of')." ".$this->get('pages.total'); + if ($this->get('pages_total') > 1) { + $html .= JText::_('Page')." ".$this->get('pages_current')." ".JText::_('of')." ".$this->get('pages_total'); } return $html; } @@ -161,7 +165,7 @@ function getPagesCounter() * @return string Pagination result set counter string * @since 1.5 */ - function getResultsCounter() + public function getResultsCounter() { // Initialize variables $html = null; @@ -192,9 +196,9 @@ function getResultsCounter() * @return string Pagination page list string * @since 1.0 */ - function getPagesLinks() + public function getPagesLinks() { - global $mainframe; + $appl = JFactory::getApplication(); $lang =& JFactory::getLanguage(); @@ -206,10 +210,10 @@ function getPagesLinks() $itemOverride = false; $listOverride = false; - $chromePath = JPATH_THEMES.DS.$mainframe->getTemplate().DS.'html'.DS.'pagination.php'; + $chromePath = JPATH_THEMES.DS.$appl->getTemplate().DS.'html'.DS.'pagination.php'; if (file_exists($chromePath)) { - require_once ($chromePath); + require_once $chromePath; if (function_exists('pagination_item_active') && function_exists('pagination_item_inactive')) { $itemOverride = true; } @@ -284,9 +288,9 @@ function getPagesLinks() * @return string Pagination footer * @since 1.0 */ - function getListFooter() + public function getListFooter() { - global $mainframe; + $appl = JFactory::getApplication(); $list = array(); $list['limit'] = $this->limit; @@ -296,10 +300,10 @@ function getListFooter() $list['pagescounter'] = $this->getPagesCounter(); $list['pageslinks'] = $this->getPagesLinks(); - $chromePath = JPATH_THEMES.DS.$mainframe->getTemplate().DS.'html'.DS.'pagination.php'; + $chromePath = JPATH_THEMES.DS.$appl->getTemplate().DS.'html'.DS.'pagination.php'; if (file_exists( $chromePath )) { - require_once( $chromePath ); + require_once $chromePath; if (function_exists( 'pagination_list_footer' )) { return pagination_list_footer( $list ); } @@ -314,9 +318,9 @@ function getListFooter() * @return string The html for the limit # input box * @since 1.0 */ - function getLimitBox() + public function getLimitBox() { - global $mainframe; + $appl = JFactory::getApplication(); // Initialize variables $limits = array (); @@ -332,7 +336,7 @@ function getLimitBox() $selected = $this->_viewall ? 0 : $this->limit; // Build the select list - if ($mainframe->isAdmin()) { + if ($appl->isAdmin()) { $html = JHTML::_('select.genericlist', $limits, 'limit', 'class="inputbox" size="1" onchange="submitform();"', 'value', 'text', $selected); } else { $html = JHTML::_('select.genericlist', $limits, 'limit', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected); @@ -351,7 +355,7 @@ function getLimitBox() * @return string Either the icon to move an item up or a space * @since 1.0 */ - function orderUpIcon($i, $condition = true, $task = 'orderup', $alt = 'Move Up', $enabled = true) + public function orderUpIcon($i, $condition = true, $task = 'orderup', $alt = 'Move Up', $enabled = true) { $alt = JText::_($alt); @@ -382,7 +386,7 @@ function orderUpIcon($i, $condition = true, $task = 'orderup', $alt = 'Move Up', * @return string Either the icon to move an item down or a space * @since 1.0 */ - function orderDownIcon($i, $n, $condition = true, $task = 'orderdown', $alt = 'Move Down', $enabled = true) + public function orderDownIcon($i, $n, $condition = true, $task = 'orderdown', $alt = 'Move Down', $enabled = true) { $alt = JText::_($alt); @@ -401,21 +405,14 @@ function orderDownIcon($i, $n, $condition = true, $task = 'orderdown', $alt = 'M return $html; } - function _list_footer($list) + protected function _list_footer($list) { // Initialize variables - $lang =& JFactory::getLanguage(); $html = "
      \n"; - if ($lang->isRTL()) { - $html .= "\n
      ".$list['pagescounter']."
      "; - $html .= $list['pageslinks']; - $html .= "\n
      ".JText::_('Display Num').$list['limitfield']."
      "; - } else { - $html .= "\n
      ".JText::_('Display Num').$list['limitfield']."
      "; - $html .= $list['pageslinks']; - $html .= "\n
      ".$list['pagescounter']."
      "; - } + $html .= "\n
      ".JText::_('Display Num').$list['limitfield']."
      "; + $html .= $list['pageslinks']; + $html .= "\n
      ".$list['pagescounter']."
      "; $html .= "\n"; $html .= "\n
      "; @@ -423,45 +420,31 @@ function _list_footer($list) return $html; } - function _list_render($list) + protected function _list_render($list) { // Initialize variables - $lang =& JFactory::getLanguage(); $html = null; // Reverse output rendering for right-to-left display - if($lang->isRTL()) - { - $html .= $list['previous']['data']; - $html .= $list['start']['data']; - $list['pages'] = array_reverse( $list['pages'] ); - foreach( $list['pages'] as $page ) { - $html .= $page['data']; - } - $html .= $list['end']['data']; - $html .= $list['next']['data']; - } - else - { - $html .= '<< '; - $html .= $list['start']['data']; - $html .= ' < '; - $html .= $list['previous']['data']; - foreach( $list['pages'] as $page ) { - $html .= ' '.$page['data']; - } - $html .= ' '. $list['next']['data']; - $html .= ' >'; - $html .= ' '. $list['end']['data']; - $html .= ' >>'; - } + $html .= '<< '; + $html .= $list['start']['data']; + $html .= ' < '; + $html .= $list['previous']['data']; + foreach( $list['pages'] as $page ) { + $html .= ' '.$page['data']; + } + $html .= ' '. $list['next']['data']; + $html .= ' >'; + $html .= ' '. $list['end']['data']; + $html .= ' >>'; + return $html; } - function _item_active(&$item) + protected function _item_active(&$item) { - global $mainframe; - if ($mainframe->isAdmin()) + $appl = JFactory::getApplication(); + if ($appl->isAdmin()) { if($item->base>0) return "text."\" onclick=\"javascript: document.adminForm.limitstart.value=".$item->base."; submitform();return false;\">".$item->text.""; @@ -472,10 +455,10 @@ function _item_active(&$item) } } - function _item_inactive(&$item) + protected function _item_inactive(&$item) { - global $mainframe; - if ($mainframe->isAdmin()) { + $appl = JFactory::getApplication(); + if ($appl->isAdmin()) { return "".$item->text.""; } else { return "".$item->text.""; @@ -489,7 +472,7 @@ function _item_inactive(&$item) * @return object Pagination data object * @since 1.5 */ - function _buildDataObject() + protected function _buildDataObject() { // Initialize variables $data = new stdClass(); @@ -504,9 +487,9 @@ function _buildDataObject() $data->start = new JPaginationObject(JText::_('Start')); $data->previous = new JPaginationObject(JText::_('Prev')); - if ($this->get('pages.current') > 1) + if ($this->get('pages_current') > 1) { - $page = ($this->get('pages.current') -2) * $this->limit; + $page = ($this->get('pages_current') -2) * $this->limit; $page = $page == 0 ? '' : $page; //set the empty for removal from route @@ -520,10 +503,10 @@ function _buildDataObject() $data->next = new JPaginationObject(JText::_('Next')); $data->end = new JPaginationObject(JText::_('End')); - if ($this->get('pages.current') < $this->get('pages.total')) + if ($this->get('pages_current') < $this->get('pages_total')) { - $next = $this->get('pages.current') * $this->limit; - $end = ($this->get('pages.total') -1) * $this->limit; + $next = $this->get('pages_current') * $this->limit; + $end = ($this->get('pages_total') -1) * $this->limit; $data->next->base = $next; $data->next->link = JRoute::_("&limitstart=".$next); @@ -532,15 +515,15 @@ function _buildDataObject() } $data->pages = array(); - $stop = $this->get('pages.stop'); - for ($i = $this->get('pages.start'); $i <= $stop; $i ++) + $stop = $this->get('pages_stop'); + for ($i = $this->get('pages_start'); $i <= $stop; $i ++) { $offset = ($i -1) * $this->limit; $offset = $offset == 0 ? '' : $offset; //set the empty for removal from route $data->pages[$i] = new JPaginationObject($i); - if ($i != $this->get('pages.current') || $this->_viewall) + if ($i != $this->get('pages_current') || $this->_viewall) { $data->pages[$i]->base = $offset; $data->pages[$i]->link = JRoute::_("&limitstart=".$offset); @@ -553,21 +536,20 @@ function _buildDataObject() /** * Pagination object representing a particular item in the pagination lists * - * @author Louis Landry * @package Joomla.Framework * @subpackage HTML * @since 1.5 */ class JPaginationObject extends JObject { - var $text; - var $base; - var $link; + public $text; + public $base; + public $link; - function __construct($text, $base=null, $link=null) + public function __construct($text, $base=null, $link=null) { $this->text = $text; $this->base = $base; $this->link = $link; } -} \ No newline at end of file +} diff --git a/libraries/joomla/html/pane.php b/libraries/joomla/html/pane.php index 2ccbcb2bfac1b..79cc9df468054 100644 --- a/libraries/joomla/html/pane.php +++ b/libraries/joomla/html/pane.php @@ -1,309 +1,291 @@ - - * @package Joomla.Framework - * @subpackage HTML - * @since 1.5 - */ -class JPane extends JObject -{ - - var $useCookies = false; - - /** - * Constructor - * - * @param array $params Associative array of values - */ - function __construct( $params = array() ) - { - } - - /** - * Returns a reference to a JPanel object - * - * @param string $behavior The behavior to use - * @param boolean $useCookies Use cookies to remember the state of the panel - * @param array $params Associative array of values - * @return object - */ - function &getInstance( $behavior = 'Tabs', $params = array()) - { - $classname = 'JPane'.$behavior; - $instance = new $classname($params); - - return $instance; - } - - /** - * Creates a pane and creates the javascript object for it - * - * @abstract - * @param string The pane identifier - */ - function startPane( $id ) - { - return; - } - - /** - * Ends the pane - * - * @abstract - */ - function endPane() - { - return; - } - - /** - * Creates a panel with title text and starts that panel - * - * @abstract - * @param string $text The panel name and/or title - * @param string $id The panel identifer - */ - function startPanel( $text, $id ) - { - return; - } - - /** - * Ends a panel - * - * @abstract - */ - function endPanel() - { - return; - } - - /** - * Load the javascript behavior and attach it to the document - * - * @abstract - */ - function _loadBehavior() - { - return; - } -} - -/** - * JPanelTabs class to to draw parameter panes - * - * @author Johan Janssens - * @package Joomla.Framework - * @subpackage HTML - * @since 1.5 - */ -class JPaneTabs extends JPane -{ - /** - * Constructor - * - * @param array $params Associative array of values - */ - function __construct( $params = array() ) - { - static $loaded = false; - - parent::__construct($params); - - if (!$loaded) { - $this->_loadBehavior($params); - $loaded = true; - } - } - - /** - * Creates a pane and creates the javascript object for it - * - * @param string The pane identifier - */ - function startPane( $id ) - { - return '
      '; - } - - /** - * Ends the pane - */ - function endPane() - { - return "
      "; - } - - /** - * Creates a tab panel with title text and starts that panel - * - * @param string $text The name of the tab - * @param string $id The tab identifier - */ - function startPanel( $text, $id ) - { - return '
      '.$text.'
      '; - } - - /** - * Ends a tab page - */ - function endPanel() - { - return "
      "; - } - - /** - * Load the javascript behavior and attach it to the document - * - * @param array $params Associative array of values - */ - function _loadBehavior($params = array()) - { - // Include mootools framework - JHTML::_('behavior.mootools'); - - $document =& JFactory::getDocument(); - - $options = '{'; - $opt['onActive'] = (isset($params['onActive'])) ? $params['onActive'] : null ; - $opt['onBackground'] = (isset($params['onBackground'])) ? $params['onBackground'] : null ; - $opt['display'] = (isset($params['startOffset'])) ? (int)$params['startOffset'] : null ; - foreach ($opt as $k => $v) - { - if ($v) { - $options .= $k.': '.$v.','; - } - } - if (substr($options, -1) == ',') { - $options = substr($options, 0, -1); - } - $options .= '}'; - - $js = ' window.addEvent(\'domready\', function(){ $$(\'dl.tabs\').each(function(tabs){ new JTabs(tabs, '.$options.'); }); });'; - - $document->addScriptDeclaration( $js ); - $document->addScript( JURI::root(true). '/media/system/js/tabs.js' ); - } -} - -/** - * JPanelSliders class to to draw parameter panes - * - * @author Johan Janssens - * @package Joomla.Framework - * @subpackage HTML - * @since 1.5 - */ -class JPaneSliders extends JPane -{ - /** - * Constructor - * - * @param int useCookies, if set to 1 cookie will hold last used tab between page refreshes - */ - function __construct( $params = array() ) - { - static $loaded = false; - - parent::__construct($params); - - if(!$loaded) { - $this->_loadBehavior($params); - $loaded = true; - } - } - - /** - * Creates a pane and creates the javascript object for it - * - * @param string The pane identifier - */ - function startPane( $id ) - { - return '
      '; - } - - /** - * Ends the pane - */ - function endPane() { - return '
      '; - } - - /** - * Creates a tab panel with title text and starts that panel - * - * @param string $text - The name of the tab - * @param string $id - The tab identifier - */ - function startPanel( $text, $id ) - { - return '
      ' - .'

      '.$text.'

      ' - .'
      '; - } - - /** - * Ends a tab page - */ - function endPanel() - { - return '
      '; - } - - /** - * Load the javascript behavior and attach it to the document - * - * @param array $params Associative array of values - */ - function _loadBehavior($params = array()) - { - // Include mootools framework - JHTML::_('behavior.mootools'); - - $document =& JFactory::getDocument(); - - $options = '{'; - $opt['onActive'] = 'function(toggler, i) { toggler.addClass(\'jpane-toggler-down\'); toggler.removeClass(\'jpane-toggler\'); }'; - $opt['onBackground'] = 'function(toggler, i) { toggler.addClass(\'jpane-toggler\'); toggler.removeClass(\'jpane-toggler-down\'); }'; - $opt['duration'] = (isset($params['duration'])) ? (int)$params['duration'] : 300; - $opt['display'] = (isset($params['startOffset']) && ($params['startTransition'])) ? (int)$params['startOffset'] : null ; - $opt['show'] = (isset($params['startOffset']) && (!$params['startTransition'])) ? (int)$params['startOffset'] : null ; - $opt['opacity'] = (isset($params['opacityTransition']) && ($params['opacityTransition'])) ? 'true' : 'false' ; - $opt['alwaysHide'] = (isset($params['allowAllClose']) && ($params['allowAllClose'])) ? 'true' : null ; - foreach ($opt as $k => $v) - { - if ($v) { - $options .= $k.': '.$v.','; - } - } - if (substr($options, -1) == ',') { - $options = substr($options, 0, -1); - } - $options .= '}'; - - $js = ' window.addEvent(\'domready\', function(){ new Accordion($$(\'.panel h3.jpane-toggler\'), $$(\'.panel div.jpane-slider\'), '.$options.'); });'; - - $document->addScriptDeclaration( $js ); - } -} \ No newline at end of file +defined('JPATH_BASE') or die(); + +/** + * JPane abstract class + * + * @abstract + * @package Joomla.Framework + * @subpackage HTML + * @since 1.5 + */ +abstract class JPane extends JObject +{ + + public $useCookies = false; + + /** + * Constructor + * + * @param array $params Associative array of values + */ + protected function __construct( $params = array() ) + { + } + + /** + * Returns a reference to a JPanel object + * + * @param string $behavior The behavior to use + * @param boolean $useCookies Use cookies to remember the state of the panel + * @param array $params Associative array of values + * @return object + */ + public static function &getInstance( $behavior = 'Tabs', $params = array()) + { + $classname = 'JPane'.$behavior; + $instance = new $classname($params); + + return $instance; + } + + /** + * Creates a pane and creates the javascript object for it + * + * @abstract + * @param string The pane identifier + */ + abstract public function startPane( $id ); + + /** + * Ends the pane + * + * @abstract + */ + abstract public function endPane(); + + /** + * Creates a panel with title text and starts that panel + * + * @abstract + * @param string $text The panel name and/or title + * @param string $id The panel identifer + */ + abstract public function startPanel( $text, $id ); + + /** + * Ends a panel + * + * @abstract + */ + abstract public function endPanel(); + + /** + * Load the javascript behavior and attach it to the document + * + * @abstract + */ + abstract protected function _loadBehavior(); +} + +/** + * JPanelTabs class to to draw parameter panes + * + * @package Joomla.Framework + * @subpackage HTML + * @since 1.5 + */ +class JPaneTabs extends JPane +{ + /** + * Constructor + * + * @param array $params Associative array of values + */ + protected function __construct( $params = array() ) + { + static $loaded = false; + + parent::__construct($params); + + if (!$loaded) { + $this->_loadBehavior($params); + $loaded = true; + } + } + + /** + * Creates a pane and creates the javascript object for it + * + * @param string The pane identifier + */ + public function startPane( $id ) + { + return '
      '; + } + + /** + * Ends the pane + */ + public function endPane() + { + return "
      "; + } + + /** + * Creates a tab panel with title text and starts that panel + * + * @param string $text The name of the tab + * @param string $id The tab identifier + */ + public function startPanel( $text, $id ) + { + return '
      '.$text.'
      '; + } + + /** + * Ends a tab page + */ + public function endPanel() + { + return "
      "; + } + + /** + * Load the javascript behavior and attach it to the document + * + * @param array $params Associative array of values + */ + protected function _loadBehavior($params = array()) + { + // Include mootools framework + JHTML::_('behavior.mootools'); + + $document =& JFactory::getDocument(); + + $options = '{'; + $opt['onActive'] = (isset($params['onActive'])) ? $params['onActive'] : null ; + $opt['onBackground'] = (isset($params['onBackground'])) ? $params['onBackground'] : null ; + $opt['display'] = (isset($params['startOffset'])) ? (int)$params['startOffset'] : null ; + foreach ($opt as $k => $v) + { + if ($v) { + $options .= $k.': '.$v.','; + } + } + if (substr($options, -1) == ',') { + $options = substr($options, 0, -1); + } + $options .= '}'; + + $js = ' window.addEvent(\'domready\', function(){ $$(\'dl.tabs\').each(function(tabs){ new JTabs(tabs, '.$options.'); }); });'; + + $document->addScriptDeclaration( $js ); + $document->addScript( JURI::root(true). '/media/system/js/tabs.js' ); + } +} + +/** + * JPanelSliders class to to draw parameter panes + * + * @package Joomla.Framework + * @subpackage HTML + * @since 1.5 + */ +class JPaneSliders extends JPane +{ + /** + * Constructor + * + * @param int useCookies, if set to 1 cookie will hold last used tab between page refreshes + */ + protected function __construct( $params = array() ) + { + static $loaded = false; + + parent::__construct($params); + + if(!$loaded) { + $this->_loadBehavior($params); + $loaded = true; + } + } + + /** + * Creates a pane and creates the javascript object for it + * + * @param string The pane identifier + */ + public function startPane( $id ) + { + return '
      '; + } + + /** + * Ends the pane + */ + public function endPane() { + return '
      '; + } + + /** + * Creates a tab panel with title text and starts that panel + * + * @param string $text - The name of the tab + * @param string $id - The tab identifier + */ + public function startPanel( $text, $id ) + { + return '
      ' + .'

      '.$text.'

      ' + .'
      '; + } + + /** + * Ends a tab page + */ + public function endPanel() + { + return '
      '; + } + + /** + * Load the javascript behavior and attach it to the document + * + * @param array $params Associative array of values + */ + protected function _loadBehavior($params = array()) + { + // Include mootools framework + JHTML::_('behavior.mootools'); + + $document =& JFactory::getDocument(); + + $options = '{'; + $opt['onActive'] = 'function(toggler, i) { toggler.addClass(\'jpane-toggler-down\'); toggler.removeClass(\'jpane-toggler\'); }'; + $opt['onBackground'] = 'function(toggler, i) { toggler.addClass(\'jpane-toggler\'); toggler.removeClass(\'jpane-toggler-down\'); }'; + $opt['duration'] = (isset($params['duration'])) ? (int)$params['duration'] : 300; + $opt['display'] = (isset($params['startOffset']) && ($params['startTransition'])) ? (int)$params['startOffset'] : null ; + $opt['show'] = (isset($params['startOffset']) && (!$params['startTransition'])) ? (int)$params['startOffset'] : null ; + $opt['opacity'] = (isset($params['opacityTransition']) && ($params['opacityTransition'])) ? 'true' : 'false' ; + $opt['alwaysHide'] = (isset($params['allowAllClose']) && ($params['allowAllClose'])) ? 'true' : null ; + foreach ($opt as $k => $v) + { + if ($v) { + $options .= $k.': '.$v.','; + } + } + if (substr($options, -1) == ',') { + $options = substr($options, 0, -1); + } + $options .= '}'; + + $js = ' window.addEvent(\'domready\', function(){ new Accordion($$(\'.panel h3.jpane-toggler\'), $$(\'.panel div.jpane-slider\'), '.$options.'); });'; + + $document->addScriptDeclaration( $js ); + } +} diff --git a/libraries/joomla/html/parameter.php b/libraries/joomla/html/parameter.php index 63fb18a574399..488a71185113a 100644 --- a/libraries/joomla/html/parameter.php +++ b/libraries/joomla/html/parameter.php @@ -1,455 +1,110 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ -class JParameter extends JRegistry -{ - /** - * The raw params string - * - * @access private - * @var string - * @since 1.5 - */ - var $_raw = null; - - /** - * The xml params element - * - * @access private - * @var object - * @since 1.5 - */ - var $_xml = null; - - /** - * loaded elements - * - * @access private - * @var array - * @since 1.5 - */ - var $_elements = array(); - - /** - * directories, where element types can be stored - * - * @access private - * @var array - * @since 1.5 - */ - var $_elementPath = array(); - - /** - * Constructor - * - * @access protected - * @param string The raw parms text - * @param string Path to the xml setup file - * @since 1.5 - */ - function __construct($data, $path = '') - { - parent::__construct('_default'); - - // Set base path - $this->_elementPath[] = dirname( __FILE__ ).DS.'parameter'.DS.'element'; - - if (trim( $data )) { - $this->loadINI($data); - } - - if ($path) { - $this->loadSetupFile($path); - } - - $this->_raw = $data; - } - - /** - * Set a value - * - * @access public - * @param string The name of the param - * @param string The value of the parameter - * @return string The set value - * @since 1.5 - */ - function set($key, $value = '', $group = '_default') - { - return $this->setValue($group.'.'.$key, (string) $value); - } - - /** - * Get a value - * - * @access public - * @param string The name of the param - * @param mixed The default value if not found - * @return string - * @since 1.5 - */ - function get($key, $default = '', $group = '_default') - { - $value = $this->getValue($group.'.'.$key); - $result = (empty($value) && ($value !== 0) && ($value !== '0')) ? $default : $value; - return $result; - } - - /** - * Sets a default value if not alreay assigned - * - * @access public - * @param string The name of the param - * @param string The value of the parameter - * @param string The parameter group to modify - * @return string The set value - * @since 1.5 - */ - function def($key, $default = '', $group = '_default') { - $value = $this->get($key, (string) $default, $group); - return $this->set($key, $value); - } - - /** - * Sets the XML object from custom xml files - * - * @access public - * @param object An XML object - * @since 1.5 - */ - function setXML( &$xml ) - { - if (is_object( $xml )) - { - if ($group = $xml->attributes( 'group' )) { - $this->_xml[$group] = $xml; - } else { - $this->_xml['_default'] = $xml; - } - if ($dir = $xml->attributes( 'addpath' )) { - $this->addElementPath( JPATH_ROOT . str_replace('/', DS, $dir) ); - } - } - } - - /** - * Bind data to the parameter - * - * @param mixed $data Array or Object - * @return boolean True if the data was successfully bound - * @access public - * @since 1.5 - */ - function bind($data, $group = '_default') - { - if ( is_array($data) ) { - return $this->loadArray($data, $group); - } elseif ( is_object($data) ) { - return $this->loadObject($data, $group); - } else { - return $this->loadINI($data, $group); - } - } - - /** - * Render - * - * @access public - * @param string The name of the control, or the default text area if a setup file is not found - * @return string HTML - * @since 1.5 - */ - function render($name = 'params', $group = '_default') - { - if (!isset($this->_xml[$group])) { - return false; - } - - $params = $this->getParams($name, $group); - $html = array (); - $html[] = ''; - - if ($description = $this->_xml[$group]->attributes('description')) { - // add the params description to the display - $desc = JText::_($description); - $html[] = ''; - } - - foreach ($params as $param) - { - $html[] = ''; - - if ($param[0]) { - $html[] = ''; - $html[] = ''; - } else { - $html[] = ''; - } - - $html[] = ''; - } - - if (count($params) < 1) { - $html[] = ""; - } - - $html[] = '
      '.$desc.'
      '.$param[0].''.$param[1].''.$param[1].'
      ".JText::_('There are no Parameters for this item')."
      '; - - return implode("\n", $html); - } - - /** - * Render all parameters to an array - * - * @access public - * @param string The name of the control, or the default text area if a setup file is not found - * @return array Array of all parameters, each as array Any array of the label, the form element and the tooltip - * @since 1.5 - */ - function renderToArray($name = 'params', $group = '_default') - { - if (!isset($this->_xml[$group])) { - return false; - } - $results = array(); - foreach ($this->_xml[$group]->children() as $param) { - $result = $this->getParam($param, $name); - $results[$result[5]] = $result; - } - return $results; - } - - /** - * Return number of params to render - * - * @access public - * @return mixed Boolean falst if no params exist or integer number of params that exist - * @since 1.5 - */ - function getNumParams($group = '_default') - { - if (!isset($this->_xml[$group]) || !count($this->_xml[$group]->children())) { - return false; - } else { - return count($this->_xml[$group]->children()); - } - } - - /** - * Get the number of params in each group - * - * @access public - * @return array Array of all group names as key and param count as value - * @since 1.5 - */ - function getGroups() - { - if (!is_array($this->_xml)) { - return false; - } - $results = array(); - foreach ($this->_xml as $name => $group) { - $results[$name] = $this->getNumParams($name); - } - return $results; - } - - /** - * Render all parameters - * - * @access public - * @param string The name of the control, or the default text area if a setup file is not found - * @return array Aarray of all parameters, each as array Any array of the label, the form element and the tooltip - * @since 1.5 - */ - function getParams($name = 'params', $group = '_default') - { - if (!isset($this->_xml[$group])) { - return false; - } - $results = array(); - foreach ($this->_xml[$group]->children() as $param) { - $results[] = $this->getParam($param, $name); - } - return $results; - } - - /** - * Render a parameter type - * - * @param object A param tag node - * @param string The control name - * @return array Any array of the label, the form element and the tooltip - * @since 1.5 - */ - function getParam(&$node, $control_name = 'params', $group = '_default') - { - //get the type of the parameter - $type = $node->attributes('type'); - - //remove any occurance of a mos_ prefix - $type = str_replace('mos_', '', $type); - - $element =& $this->loadElement($type); - - // error happened - if ($element === false) - { - $result = array(); - $result[0] = $node->attributes('name'); - $result[1] = JText::_('Element not defined for type').' = '.$type; - $result[5] = $result[0]; - return $result; - } - - //get value - $value = $this->get($node->attributes('name'), $node->attributes('default'), $group); - - return $element->render($node, $value, $control_name); - } - - /** - * Loads an xml setup file and parses it - * - * @access public - * @param string path to xml setup file - * @return object - * @since 1.5 - */ - function loadSetupFile($path) - { - $result = false; - - if ($path) - { - $xml = & JFactory::getXMLParser('Simple'); - - if ($xml->loadFile($path)) - { - if ($params = & $xml->document->params) { - foreach ($params as $param) - { - $this->setXML( $param ); - $result = true; - } - } - } - } - else - { - $result = true; - } - - return $result; - } - - /** - * Loads a element type - * - * @access public - * @param string elementType - * @return object - * @since 1.5 - */ - function &loadElement( $type, $new = false ) - { - $false = false; - $signature = md5( $type ); - - if( (isset( $this->_elements[$signature] ) && !is_a($this->_elements[$signature], '__PHP_Incomplete_Class')) && $new === false ) { - return $this->_elements[$signature]; - } - - $elementClass = 'JElement'.$type; - if( !class_exists( $elementClass ) ) - { - if( isset( $this->_elementPath ) ) { - $dirs = $this->_elementPath; - } else { - $dirs = array(); - } - - $file = JFilterInput::clean(str_replace('_', DS, $type).'.php', 'path'); - - jimport('joomla.filesystem.path'); - if ($elementFile = JPath::find($dirs, $file)) { - include_once $elementFile; - } else { - return $false; - } - } - - if( !class_exists( $elementClass ) ) { - return $false; - } - - $this->_elements[$signature] = new $elementClass($this); - - return $this->_elements[$signature]; - } - - /** - * Add a directory where JParameter should search for element types - * - * You may either pass a string or an array of directories. - * - * JParameter will be searching for a element type in the same - * order you added them. If the parameter type cannot be found in - * the custom folders, it will look in - * JParameter/types. - * - * @access public - * @param string|array directory or directories to search. - * @since 1.5 - */ - function addElementPath( $path ) - { - // just force path to array - settype( $path, 'array' ); - - // loop through the path directories - foreach ( $path as $dir ) - { - // no surrounding spaces allowed! - $dir = trim( $dir ); - - // add trailing separators as needed - if ( substr( $dir, -1 ) != DIRECTORY_SEPARATOR ) { - // directory - $dir .= DIRECTORY_SEPARATOR; - } - - // add to the top of the search dirs - array_unshift( $this->_elementPath, $dir ); - } - - - } -} \ No newline at end of file + - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ -class JElement extends JObject -{ - /** - * element name - * - * This has to be set in the final - * renderer classes. - * - * @access protected - * @var string - */ - var $_name = null; - - /** - * reference to the object that instantiated the element - * - * @access protected - * @var object - */ - var $_parent = null; - - /** - * Constructor - * - * @access protected - */ - function __construct($parent = null) { - $this->_parent = $parent; - } - - /** - * get the element name - * - * @access public - * @return string type of the parameter - */ - function getName() { - return $this->_name; - } - - function render(&$xmlElement, $value, $control_name = 'params') - { - $name = $xmlElement->attributes('name'); - $label = $xmlElement->attributes('label'); - $descr = $xmlElement->attributes('description'); - //make sure we have a valid label - $label = $label ? $label : $name; - $result[0] = $this->fetchTooltip($label, $descr, $xmlElement, $control_name, $name); - $result[1] = $this->fetchElement($name, $value, $xmlElement, $control_name); - $result[2] = $descr; - $result[3] = $label; - $result[4] = $value; - $result[5] = $name; - - return $result; - } - - function fetchTooltip($label, $description, &$xmlElement, $control_name='', $name='') - { - $output = ''; - - return $output; - } - - function fetchElement($name, $value, &$xmlElement, $control_name) { - return; - } -} \ No newline at end of file + +/** + * Parameter base class + * + * The JElement is the base class for all JElement types + * + * @abstract + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ +abstract class JElement extends JObject +{ + /** + * element name + * + * This has to be set in the final + * renderer classes. + * + * @access protected + * @var string + */ + protected $_name = null; + + /** + * reference to the object that instantiated the element + * + * @access protected + * @var object + */ + protected $_parent = null; + + /** + * Constructor + * + * @access protected + */ + public function __construct($parent = null) { + $this->_parent = $parent; + } + + /** + * get the element name + * + * @access public + * @return string type of the parameter + */ + public function getName() { + return $this->_name; + } + + public function render(&$xmlElement, $value, $control_name = 'params') + { + $name = $xmlElement->attributes('name'); + $label = $xmlElement->attributes('label'); + $descr = $xmlElement->attributes('description'); + //make sure we have a valid label + $label = $label ? $label : $name; + $result[0] = $this->fetchTooltip($label, $descr, $xmlElement, $control_name, $name); + $result[1] = $this->fetchElement($name, $value, $xmlElement, $control_name); + $result[2] = $descr; + $result[3] = $label; + $result[4] = $value; + $result[5] = $name; + + return $result; + } + + public function fetchTooltip($label, $description, &$xmlElement, $control_name='', $name='') + { + $output = ''; + + return $output; + } + + abstract public function fetchElement($name, $value, &$xmlElement, $control_name); +} diff --git a/libraries/joomla/html/parameter/element/calendar.php b/libraries/joomla/html/parameter/element/calendar.php index b6ab2c96f5c09..2a83ab3bf9f54 100644 --- a/libraries/joomla/html/parameter/element/calendar.php +++ b/libraries/joomla/html/parameter/element/calendar.php @@ -18,7 +18,6 @@ /** * Renders a calendar element * - * @author Louis Landry * @package Joomla.Framework * @subpackage Parameter * @since 1.5 @@ -30,9 +29,9 @@ class JElementCalendar extends JElement * @access protected * @var string */ - var $_name = 'Calendar'; + protected $_name = 'Calendar'; - function fetchElement($name, $value, &$node, $control_name) + public function fetchElement($name, $value, &$node, $control_name) { JHTML::_('behavior.calendar'); //load the calendar behavior diff --git a/libraries/joomla/html/parameter/element/category.php b/libraries/joomla/html/parameter/element/category.php index 88ab4cedb004c..ce18720edf27c 100644 --- a/libraries/joomla/html/parameter/element/category.php +++ b/libraries/joomla/html/parameter/element/category.php @@ -1,76 +1,79 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementCategory extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Category'; - - function fetchElement($name, $value, &$node, $control_name) - { - $db = &JFactory::getDBO(); - - $section = $node->attributes('section'); - $class = $node->attributes('class'); - if (!$class) { - $class = "inputbox"; - } - - if (!isset ($section)) { - // alias for section - $section = $node->attributes('scope'); - if (!isset ($section)) { - $section = 'content'; - } - } - - if ($section == 'content') { - // This might get a conflict with the dynamic translation - TODO: search for better solution - $query = 'SELECT c.id, CONCAT_WS( "/",s.title, c.title ) AS title' . - ' FROM #__categories AS c' . - ' LEFT JOIN #__sections AS s ON s.id=c.section' . - ' WHERE c.published = 1' . - ' AND s.scope = '.$db->Quote($section). - ' ORDER BY s.title, c.title'; - } else { - $query = 'SELECT c.id, c.title' . - ' FROM #__categories AS c' . - ' WHERE c.published = 1' . - ' AND c.section = '.$db->Quote($section). - ' ORDER BY c.title'; - } - $db->setQuery($query); - $options = $db->loadObjectList(); - array_unshift($options, JHTML::_('select.option', '0', '- '.JText::_('Select Category').' -', 'id', 'title')); - - return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="'.$class.'"', 'id', 'title', $value, $control_name.$name ); - } -} \ No newline at end of file +attributes('section'); + $class = $node->attributes('class'); + if (!$class) { + $class = "inputbox"; + } + + if (!isset ($section)) { + // alias for section + $section = $node->attributes('scope'); + if (!isset ($section)) { + $section = 'content'; + } + } + + if ($section == 'content') { + // This might get a conflict with the dynamic translation - TODO: search for better solution + $query = 'SELECT c.id, CONCAT_WS( "/",s.title, c.title ) AS title' . + ' FROM #__categories AS c' . + ' LEFT JOIN #__sections AS s ON s.id=c.section' . + ' WHERE c.published = 1' . + ' AND s.scope = '.$db->Quote($section). + ' ORDER BY s.title, c.title'; + } else { + $query = 'SELECT c.id, c.title' . + ' FROM #__categories AS c' . + ' WHERE c.published = 1' . + ' AND c.section = '.$db->Quote($section). + ' ORDER BY c.title'; + } + $db->setQuery($query); + try { + $options = $db->loadObjectList(); + } catch(JException $e) { + $options = array(); + } + array_unshift($options, JHTML::_('select.option', '0', '- '.JText::_('Select Category').' -', 'id', 'title')); + + return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="'.$class.'"', 'id', 'title', $value, $control_name.$name ); + } +} diff --git a/libraries/joomla/html/parameter/element/editors.php b/libraries/joomla/html/parameter/element/editors.php index 00c006a8f0144..d1f3fd207c9b4 100644 --- a/libraries/joomla/html/parameter/element/editors.php +++ b/libraries/joomla/html/parameter/element/editors.php @@ -1,61 +1,64 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementEditors extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Editors'; - - function fetchElement($name, $value, &$node, $control_name) - { - $db = & JFactory::getDBO(); - $user = & JFactory::getUser(); - - //TODO: change to acl_check method - if(!($user->get('gid') >= 19) ) { - return JText::_('No Access'); - } - - // compile list of the editors - $query = 'SELECT element AS value, name AS text' - . ' FROM #__plugins' - . ' WHERE folder = "editors"' - . ' AND published = 1' - . ' ORDER BY ordering, name' - ; - $db->setQuery( $query ); - $editors = $db->loadObjectList(); - - array_unshift( $editors, JHTML::_('select.option', '', '- '. JText::_( 'Select Editor' ) .' -' ) ); - - return JHTML::_('select.genericlist', $editors, ''. $control_name .'['. $name .']', 'class="inputbox"', 'value', 'text', $value, $control_name.$name ); - } -} \ No newline at end of file + +/** + * Renders a editors element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementEditors extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Editors'; + + public function fetchElement($name, $value, &$node, $control_name) + { + $db = & JFactory::getDBO(); + $user = & JFactory::getUser(); + + //TODO: change to acl_check method + if(!($user->get('gid') >= 19) ) { + return JText::_('No Access'); + } + + // compile list of the editors + $query = 'SELECT element AS value, name AS text' + . ' FROM #__plugins' + . ' WHERE folder = "editors"' + . ' AND published = 1' + . ' ORDER BY ordering, name' + ; + $db->setQuery( $query ); + try { + $editors = $db->loadObjectList(); + } catch(JException $e) { + $editors = array(); + } + + array_unshift( $editors, JHTML::_('select.option', '', '- '. JText::_( 'Select Editor' ) .' -' ) ); + + return JHTML::_('select.genericlist', $editors, ''. $control_name .'['. $name .']', 'class="inputbox"', 'value', 'text', $value, $control_name.$name ); + } +} diff --git a/libraries/joomla/html/parameter/element/filelist.php b/libraries/joomla/html/parameter/element/filelist.php index e8f6e84ffce42..846f0378a87a0 100644 --- a/libraries/joomla/html/parameter/element/filelist.php +++ b/libraries/joomla/html/parameter/element/filelist.php @@ -1,82 +1,81 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementFilelist extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Filelist'; - - function fetchElement($name, $value, &$node, $control_name) - { - jimport( 'joomla.filesystem.folder' ); - jimport( 'joomla.filesystem.file' ); - - // path to images directory - $path = JPATH_ROOT.DS.$node->attributes('directory'); - $filter = $node->attributes('filter'); - $exclude = $node->attributes('exclude'); - $stripExt = $node->attributes('stripext'); - $files = JFolder::files($path, $filter); - - $options = array (); - - if (!$node->attributes('hide_none')) - { - $options[] = JHTML::_('select.option', '-1', '- '.JText::_('Do not use').' -'); - } - - if (!$node->attributes('hide_default')) - { - $options[] = JHTML::_('select.option', '', '- '.JText::_('Use default').' -'); - } + +/** + * Renders a filelist element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementFilelist extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Filelist'; + + public function fetchElement($name, $value, &$node, $control_name) + { + jimport( 'joomla.filesystem.folder' ); + jimport( 'joomla.filesystem.file' ); + + // path to images directory + $path = JPATH_ROOT.DS.$node->attributes('directory'); + $filter = $node->attributes('filter'); + $exclude = $node->attributes('exclude'); + $stripExt = $node->attributes('stripext'); + $files = JFolder::files($path, $filter); + + $options = array (); + + if (!$node->attributes('hide_none')) + { + $options[] = JHTML::_('select.option', '-1', '- '.JText::_('Do not use').' -'); + } + + if (!$node->attributes('hide_default')) + { + $options[] = JHTML::_('select.option', '', '- '.JText::_('Use default').' -'); + } if ( is_array($files) ) - { - foreach ($files as $file) - { - if ($exclude) - { - if (preg_match( chr( 1 ) . $exclude . chr( 1 ), $file )) - { - continue; - } - } - if ($stripExt) - { - $file = JFile::stripExt( $file ); - } - $options[] = JHTML::_('select.option', $file, $file); + { + foreach ($files as $file) + { + if ($exclude) + { + if (preg_match( chr( 1 ) . $exclude . chr( 1 ), $file )) + { + continue; + } + } + if ($stripExt) + { + $file = JFile::stripExt( $file ); + } + $options[] = JHTML::_('select.option', $file, $file); } - } - - return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, "param$name"); - } -} \ No newline at end of file + } + + return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, "param$name"); + } +} diff --git a/libraries/joomla/html/parameter/element/folderlist.php b/libraries/joomla/html/parameter/element/folderlist.php index e8f0bee0c61b6..ee17ffa863e31 100644 --- a/libraries/joomla/html/parameter/element/folderlist.php +++ b/libraries/joomla/html/parameter/element/folderlist.php @@ -1,69 +1,68 @@ -attributes('directory'); - $filter = $node->attributes('filter'); - $exclude = $node->attributes('exclude'); - $folders = JFolder::folders($path, $filter); - - $options = array (); - foreach ($folders as $folder) - { - if ($exclude) - { - if (preg_match( chr( 1 ) . $exclude . chr( 1 ), $folder )) { - continue; - } - } - $options[] = JHTML::_('select.option', $folder, $folder); - } - - if (!$node->attributes('hide_none')) { - array_unshift($options, JHTML::_('select.option', '-1', '- '.JText::_('Do not use').' -')); - } - - if (!$node->attributes('hide_default')) { - array_unshift($options, JHTML::_('select.option', '', '- '.JText::_('Use default').' -')); - } - - return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, "param$name"); - } -} \ No newline at end of file + +/** + * Renders a filelist element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementFolderlist extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Folderlist'; + + public function fetchElement($name, $value, &$node, $control_name) + { + jimport( 'joomla.filesystem.folder' ); + + // path to images directory + $path = JPATH_ROOT.DS.$node->attributes('directory'); + $filter = $node->attributes('filter'); + $exclude = $node->attributes('exclude'); + $folders = JFolder::folders($path, $filter); + + $options = array (); + foreach ($folders as $folder) + { + if ($exclude) + { + if (preg_match( chr( 1 ) . $exclude . chr( 1 ), $folder )) { + continue; + } + } + $options[] = JHTML::_('select.option', $folder, $folder); + } + + if (!$node->attributes('hide_none')) { + array_unshift($options, JHTML::_('select.option', '-1', '- '.JText::_('Do not use').' -')); + } + + if (!$node->attributes('hide_default')) { + array_unshift($options, JHTML::_('select.option', '', '- '.JText::_('Use default').' -')); + } + + return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, "param$name"); + } +} diff --git a/libraries/joomla/html/parameter/element/helpsites.php b/libraries/joomla/html/parameter/element/helpsites.php index f2017384a5e36..ddde19cb1ce70 100644 --- a/libraries/joomla/html/parameter/element/helpsites.php +++ b/libraries/joomla/html/parameter/element/helpsites.php @@ -1,46 +1,45 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementHelpsites extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Helpsites'; - - function fetchElement($name, $value, &$node, $control_name) - { - jimport('joomla.language.help'); - - $helpsites = JHelp::createSiteList(JPATH_ADMINISTRATOR.DS.'help'.DS.'helpsites-15.xml', $value); - array_unshift($helpsites, JHTML::_('select.option', '', JText::_('local'))); - - return JHTML::_('select.genericlist', $helpsites, ''.$control_name.'['.$name.']', ' class="inputbox"', 'value', 'text', $value, $control_name.$name ); - } -} \ No newline at end of file + +/** + * Renders a helpsites element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementHelpsites extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Helpsites'; + + public function fetchElement($name, $value, &$node, $control_name) + { + jimport('joomla.language.help'); + + $helpsites = JHelp::createSiteList(JPATH_ADMINISTRATOR.DS.'help'.DS.'helpsites-15.xml', $value); + array_unshift($helpsites, JHTML::_('select.option', '', JText::_('local'))); + + return JHTML::_('select.genericlist', $helpsites, ''.$control_name.'['.$name.']', ' class="inputbox"', 'value', 'text', $value, $control_name.$name ); + } +} diff --git a/libraries/joomla/html/parameter/element/hidden.php b/libraries/joomla/html/parameter/element/hidden.php index de6ae7f875276..e1c5c6ac8cbe9 100644 --- a/libraries/joomla/html/parameter/element/hidden.php +++ b/libraries/joomla/html/parameter/element/hidden.php @@ -1,47 +1,46 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementHidden extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Hidden'; - - function fetchElement($name, $value, &$node, $control_name) - { - $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="text_area"' ); - - return ''; - } - - function fetchTooltip($label, $description, &$xmlElement, $control_name='', $name='') { - return false; - } -} \ No newline at end of file + +/** + * Renders a hidden element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementHidden extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Hidden'; + + public function fetchElement($name, $value, &$node, $control_name) + { + $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="text_area"' ); + + return ''; + } + + public function fetchTooltip($label, $description, &$xmlElement, $control_name='', $name='') { + return false; + } +} diff --git a/libraries/joomla/html/parameter/element/imagelist.php b/libraries/joomla/html/parameter/element/imagelist.php index df35a2ffea80c..928eeca9ecdf1 100644 --- a/libraries/joomla/html/parameter/element/imagelist.php +++ b/libraries/joomla/html/parameter/element/imagelist.php @@ -1,46 +1,45 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementImageList extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'ImageList'; - - function fetchElement($name, $value, &$node, $control_name) - { - $filter = '\.png$|\.gif$|\.jpg$|\.bmp$|\.ico$'; - $node->addAttribute('filter', $filter); - - $parameter =& $this->_parent->loadElement('filelist'); - - return $parameter->fetchElement($name, $value, $node, $control_name); - } -} \ No newline at end of file + +/** + * Renders a imagelist element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementImageList extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'ImageList'; + + public function fetchElement($name, $value, &$node, $control_name) + { + $filter = '\.png$|\.gif$|\.jpg$|\.bmp$|\.ico$'; + $node->addAttribute('filter', $filter); + + $parameter =& $this->_parent->loadElement('filelist'); + + return $parameter->fetchElement($name, $value, $node, $control_name); + } +} diff --git a/libraries/joomla/html/parameter/element/index.html b/libraries/joomla/html/parameter/element/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/html/parameter/element/index.html +++ b/libraries/joomla/html/parameter/element/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/html/parameter/element/languages.php b/libraries/joomla/html/parameter/element/languages.php index 3eca2c38a4275..582c22ee547d6 100644 --- a/libraries/joomla/html/parameter/element/languages.php +++ b/libraries/joomla/html/parameter/element/languages.php @@ -1,57 +1,56 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementLanguages extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Languages'; - - function fetchElement($name, $value, &$node, $control_name) - { - $user = & JFactory::getUser(); - - /* - * @TODO: change to acl_check method - */ - if(!($user->get('gid') >= 23) && $node->attributes('client') == 'administrator') { - return JText::_('No Access'); - } - - - $client = $node->attributes('client'); - - jimport('joomla.language.helper'); - $languages = JLanguageHelper::createLanguageList($value, constant('JPATH_'.strtoupper($client)), true); - array_unshift($languages, JHTML::_('select.option', '', '- '.JText::_('Select Language').' -')); - - return JHTML::_('select.genericlist', $languages, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, $control_name.$name ); - } -} \ No newline at end of file + +/** + * Renders a languages element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementLanguages extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Languages'; + + public function fetchElement($name, $value, &$node, $control_name) + { + $user = & JFactory::getUser(); + + /* + * @TODO: change to acl_check method + */ + if(!($user->get('gid') >= 23) && $node->attributes('client') == 'administrator') { + return JText::_('No Access'); + } + + + $client = $node->attributes('client'); + + jimport('joomla.language.helper'); + $languages = JLanguageHelper::createLanguageList($value, constant('JPATH_'.strtoupper($client)), true); + array_unshift($languages, JHTML::_('select.option', '', '- '.JText::_('Select Language').' -')); + + return JHTML::_('select.genericlist', $languages, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, $control_name.$name ); + } +} diff --git a/libraries/joomla/html/parameter/element/list.php b/libraries/joomla/html/parameter/element/list.php index e60e935fbdada..d8eb11a4b1688 100644 --- a/libraries/joomla/html/parameter/element/list.php +++ b/libraries/joomla/html/parameter/element/list.php @@ -1,51 +1,50 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementList extends JElement -{ - /** - * Element type - * - * @access protected - * @var string - */ - var $_name = 'List'; - - function fetchElement($name, $value, &$node, $control_name) - { - $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="inputbox"' ); - - $options = array (); - foreach ($node->children() as $option) - { - $val = $option->attributes('value'); - $text = $option->data(); - $options[] = JHTML::_('select.option', $val, JText::_($text)); - } - - return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', $class, 'value', 'text', $value, $control_name.$name); - } -} \ No newline at end of file + +/** + * Renders a list element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementList extends JElement +{ + /** + * Element type + * + * @access protected + * @var string + */ + protected $_name = 'List'; + + public function fetchElement($name, $value, &$node, $control_name) + { + $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="inputbox"' ); + + $options = array (); + foreach ($node->children() as $option) + { + $val = $option->attributes('value'); + $text = $option->data(); + $options[] = JHTML::_('select.option', $val, JText::_($text)); + } + + return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', $class, 'value', 'text', $value, $control_name.$name); + } +} diff --git a/libraries/joomla/html/parameter/element/menu.php b/libraries/joomla/html/parameter/element/menu.php index 62f57432d5d5a..01168eb63d62f 100644 --- a/libraries/joomla/html/parameter/element/menu.php +++ b/libraries/joomla/html/parameter/element/menu.php @@ -1,51 +1,49 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementMenu extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Menu'; - - function fetchElement($name, $value, &$node, $control_name) - { - $db =& JFactory::getDBO(); - - require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_menus'.DS.'helpers'.DS.'helper.php' ); - $menuTypes = MenusHelper::getMenuTypes(); - - foreach ($menuTypes as $menutype) { - $options[] = JHTML::_('select.option', $menutype, $menutype); - } - array_unshift($options, JHTML::_('select.option', '', '- '.JText::_('Select Menu').' -')); - - return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, $control_name.$name); - } -} \ No newline at end of file + +/** + * Renders a menu element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementMenu extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Menu'; + + public function fetchElement($name, $value, &$node, $control_name) + { + + require_once JPATH_ADMINISTRATOR.DS.'components'.DS.'com_menus'.DS.'helpers'.DS.'helper.php'; + $menuTypes = MenusHelper::getMenuTypes(); + + foreach ($menuTypes as $menutype) { + $options[] = JHTML::_('select.option', $menutype, $menutype); + } + array_unshift($options, JHTML::_('select.option', '', '- '.JText::_('Select Menu').' -')); + + return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, $control_name.$name); + } +} diff --git a/libraries/joomla/html/parameter/element/menuitem.php b/libraries/joomla/html/parameter/element/menuitem.php index aff16da709971..9cfee812daf41 100644 --- a/libraries/joomla/html/parameter/element/menuitem.php +++ b/libraries/joomla/html/parameter/element/menuitem.php @@ -1,123 +1,130 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementMenuItem extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'MenuItem'; - - function fetchElement($name, $value, &$node, $control_name) - { - $db =& JFactory::getDBO(); - - $menuType = $this->_parent->get('menu_type'); - if (!empty($menuType)) { - $where = ' WHERE menutype = '.$db->Quote($menuType); - } else { - $where = ' WHERE 1'; - } - - // load the list of menu types - // TODO: move query to model - $query = 'SELECT menutype, title' . - ' FROM #__menu_types' . - ' ORDER BY title'; - $db->setQuery( $query ); - $menuTypes = $db->loadObjectList(); - - if ($state = $node->attributes('state')) { - $where .= ' AND published = '.(int) $state; - } - - // load the list of menu items - // TODO: move query to model - $query = 'SELECT id, parent, name, menutype, type' . - ' FROM #__menu' . - $where . - ' ORDER BY menutype, parent, ordering' - ; - - $db->setQuery($query); - $menuItems = $db->loadObjectList(); - - // establish the hierarchy of the menu - // TODO: use node model - $children = array(); - - if ($menuItems) - { - // first pass - collect children - foreach ($menuItems as $v) - { - $pt = $v->parent; - $list = @$children[$pt] ? $children[$pt] : array(); - array_push( $list, $v ); - $children[$pt] = $list; - } - } - - // second pass - get an indent list of the items - $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0 ); - - // assemble into menutype groups - $n = count( $list ); - $groupedList = array(); - foreach ($list as $k => $v) { - $groupedList[$v->menutype][] = &$list[$k]; - } - - // assemble menu items to the array - $options = array(); - $options[] = JHTML::_('select.option', '', '- '.JText::_('Select Item').' -'); - - foreach ($menuTypes as $type) - { - if ($menuType == '') - { - $options[] = JHTML::_('select.option', '0', ' ', 'value', 'text', true); - $options[] = JHTML::_('select.option', $type->menutype, $type->title . ' - ' . JText::_( 'Top' ), 'value', 'text', true ); - } - if (isset( $groupedList[$type->menutype] )) - { - $n = count( $groupedList[$type->menutype] ); - for ($i = 0; $i < $n; $i++) - { - $item = &$groupedList[$type->menutype][$i]; - $disable = strpos($node->attributes('disable'), $item->type) !== false ? true : false; - $options[] = JHTML::_('select.option', $item->id, '   ' .$item->treename, 'value', 'text', $disable ); - - } - } - } - - return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, $control_name.$name); - } -} \ No newline at end of file +_parent->get('menu_type'); + if (!empty($menuType)) { + $where = ' WHERE menutype = '.$db->Quote($menuType); + } else { + $where = ' WHERE 1'; + } + + // load the list of menu types + // TODO: move query to model + $query = 'SELECT menutype, title' . + ' FROM #__menu_types' . + ' ORDER BY title'; + $db->setQuery( $query ); + try { + $menuTypes = $db->loadObjectList(); + } catch(JException $e) { + $menuTypes = array(); + } + + if ($state = $node->attributes('state')) { + $where .= ' AND published = '.(int) $state; + } + + // load the list of menu items + // TODO: move query to model + $query = 'SELECT id, parent, name, menutype, type' . + ' FROM #__menu' . + $where . + ' ORDER BY menutype, parent, ordering' + ; + + $db->setQuery($query); + try { + $menuItems = $db->loadObjectList(); + } catch(JException $e) { + $menuItems = array(); + } + + // establish the hierarchy of the menu + // TODO: use node model + $children = array(); + + if ($menuItems) + { + // first pass - collect children + foreach ($menuItems as $v) + { + $pt = $v->parent; + $list = @$children[$pt] ? $children[$pt] : array(); + array_push( $list, $v ); + $children[$pt] = $list; + } + } + + // second pass - get an indent list of the items + $list = JHTML::_('menu.treerecurse', 0, '', array(), $children, 9999, 0, 0 ); + + // assemble into menutype groups + $n = count( $list ); + $groupedList = array(); + foreach ($list as $k => $v) { + $groupedList[$v->menutype][] = &$list[$k]; + } + + // assemble menu items to the array + $options = array(); + $options[] = JHTML::_('select.option', '', '- '.JText::_('Select Item').' -'); + + foreach ($menuTypes as $type) + { + if ($menuType == '') + { + $options[] = JHTML::_('select.option', '0', ' ', 'value', 'text', true); + $options[] = JHTML::_('select.option', $type->menutype, $type->title . ' - ' . JText::_( 'Top' ), 'value', 'text', true ); + } + if (isset( $groupedList[$type->menutype] )) + { + $n = count( $groupedList[$type->menutype] ); + for ($i = 0; $i < $n; $i++) + { + $item = &$groupedList[$type->menutype][$i]; + $disable = strpos($node->attributes('disable'), $item->type) !== false ? true : false; + $options[] = JHTML::_('select.option', $item->id, '   ' .$item->treename, 'value', 'text', $disable ); + + } + } + } + + return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', 'text', $value, $control_name.$name); + } +} diff --git a/libraries/joomla/html/parameter/element/password.php b/libraries/joomla/html/parameter/element/password.php index b8c1ad697dc55..383e45ab42c95 100644 --- a/libraries/joomla/html/parameter/element/password.php +++ b/libraries/joomla/html/parameter/element/password.php @@ -1,44 +1,43 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementPassword extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Password'; - - function fetchElement($name, $value, &$node, $control_name) - { - $size = ( $node->attributes('size') ? 'size="'.$node->attributes('size').'"' : '' ); - $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="text_area"' ); - - return ''; - } -} \ No newline at end of file + +/** + * Renders a password element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementPassword extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Password'; + + public function fetchElement($name, $value, &$node, $control_name) + { + $size = ( $node->attributes('size') ? 'size="'.$node->attributes('size').'"' : '' ); + $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="text_area"' ); + + return ''; + } +} diff --git a/libraries/joomla/html/parameter/element/radio.php b/libraries/joomla/html/parameter/element/radio.php index 68624faa4f7e9..7bf1e5aa62691 100644 --- a/libraries/joomla/html/parameter/element/radio.php +++ b/libraries/joomla/html/parameter/element/radio.php @@ -1,49 +1,48 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementRadio extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Radio'; - - function fetchElement($name, $value, &$node, $control_name) - { - $options = array (); - foreach ($node->children() as $option) - { - $val = $option->attributes('value'); - $text = $option->data(); - $options[] = JHTML::_('select.option', $val, JText::_($text)); - } - - return JHTML::_('select.radiolist', $options, ''.$control_name.'['.$name.']', '', 'value', 'text', $value, $control_name.$name ); - } -} \ No newline at end of file + +/** + * Renders a radio element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementRadio extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Radio'; + + public function fetchElement($name, $value, &$node, $control_name) + { + $options = array (); + foreach ($node->children() as $option) + { + $val = $option->attributes('value'); + $text = $option->data(); + $options[] = JHTML::_('select.option', $val, JText::_($text)); + } + + return JHTML::_('select.radiolist', $options, ''.$control_name.'['.$name.']', '', 'value', 'text', $value, $control_name.$name ); + } +} diff --git a/libraries/joomla/html/parameter/element/section.php b/libraries/joomla/html/parameter/element/section.php index 74ef5c7489365..8cc9229567071 100644 --- a/libraries/joomla/html/parameter/element/section.php +++ b/libraries/joomla/html/parameter/element/section.php @@ -1,48 +1,51 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementSection extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Section'; - - function fetchElement($name, $value, &$node, $control_name) - { - $db =& JFactory::getDBO(); - - $query = 'SELECT id, title FROM #__sections WHERE published = 1 AND scope = "content" ORDER BY title'; - $db->setQuery($query); - $options = $db->loadObjectList(); - array_unshift($options, JHTML::_('select.option', '0', '- '.JText::_('Select Section').' -', 'id', 'title')); - - return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'id', 'title', $value, $control_name.$name); - } -} \ No newline at end of file + +/** + * Renders a section element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementSection extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Section'; + + public function fetchElement($name, $value, &$node, $control_name) + { + $db =& JFactory::getDBO(); + + $query = 'SELECT id, title FROM #__sections WHERE published = 1 AND scope = "content" ORDER BY title'; + $db->setQuery($query); + try { + $options = $db->loadObjectList(); + } catch(JException $e) { + $options = array(); + } + array_unshift($options, JHTML::_('select.option', '0', '- '.JText::_('Select Section').' -', 'id', 'title')); + + return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', 'id', 'title', $value, $control_name.$name); + } +} diff --git a/libraries/joomla/html/parameter/element/spacer.php b/libraries/joomla/html/parameter/element/spacer.php index db93e5f146fbb..dfdb83b88c2d6 100644 --- a/libraries/joomla/html/parameter/element/spacer.php +++ b/libraries/joomla/html/parameter/element/spacer.php @@ -1,49 +1,48 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementSpacer extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Spacer'; - - function fetchTooltip($label, $description, &$node, $control_name, $name) { - return ' '; - } - - function fetchElement($name, $value, &$node, $control_name) - { - if ($value) { - return $value; - } else { - return '
      '; - } - } -} \ No newline at end of file + +/** + * Renders a spacer element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementSpacer extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Spacer'; + + public function fetchTooltip($label, $description, &$node, $control_name, $name) { + return ' '; + } + + public function fetchElement($name, $value, &$node, $control_name) + { + if ($value) { + return $value; + } else { + return '
      '; + } + } +} diff --git a/libraries/joomla/html/parameter/element/sql.php b/libraries/joomla/html/parameter/element/sql.php index 8838d9ca7e93c..63b2bcf1f1542 100644 --- a/libraries/joomla/html/parameter/element/sql.php +++ b/libraries/joomla/html/parameter/element/sql.php @@ -11,14 +11,13 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ - + // Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die(); /** * Renders a SQL element * - * @author Sam Moffatt * @package Joomla.Framework * @subpackage Parameter * @since 1.5 @@ -32,12 +31,19 @@ class JElementSQL extends JElement * @access protected * @var string */ - var $_name = 'SQL'; + protected $_name = 'SQL'; - function fetchElement($name, $value, &$node, $control_name) + public function fetchElement($name, $value, &$node, $control_name) { $db = & JFactory::getDBO(); $db->setQuery($node->attributes('query')); - return JHTML::_('select.genericlist', $db->loadObjectList(), ''.$control_name.'['.$name.']', 'class="inputbox"', 'value', $name, $value, $control_name.$name); + $key = ($node->attributes('key_field') ? $node->attributes('key_field') : 'value'); + $val = ($node->attributes('value_field') ? $node->attributes('value_field') : $name); + try { + $options = $db->loadObjectlist(); + } catch(JException $e) { + $options = array(); + } + return JHTML::_('select.genericlist', $options, ''.$control_name.'['.$name.']', 'class="inputbox"', $key, $val, $value, $control_name.$name); } -} \ No newline at end of file +} diff --git a/libraries/joomla/html/parameter/element/text.php b/libraries/joomla/html/parameter/element/text.php index 04faee85462eb..c0e32c0a6d2ef 100644 --- a/libraries/joomla/html/parameter/element/text.php +++ b/libraries/joomla/html/parameter/element/text.php @@ -18,7 +18,6 @@ /** * Renders a text element * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Parameter * @since 1.5 @@ -32,19 +31,19 @@ class JElementText extends JElement * @access protected * @var string */ - var $_name = 'Text'; + protected $_name = 'Text'; - function fetchElement($name, $value, &$node, $control_name) + public function fetchElement($name, $value, &$node, $control_name) { $size = ( $node->attributes('size') ? 'size="'.$node->attributes('size').'"' : '' ); $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="text_area"' ); - /* - * Required to avoid a cycle of encoding & - * html_entity_decode was used in place of htmlspecialchars_decode because - * htmlspecialchars_decode is not compatible with PHP 4 - */ - $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES); + /* + * Required to avoid a cycle of encoding & + * html_entity_decode was used in place of htmlspecialchars_decode because + * htmlspecialchars_decode is not compatible with PHP 4 + */ + $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES); return ''; } -} \ No newline at end of file +} diff --git a/libraries/joomla/html/parameter/element/textarea.php b/libraries/joomla/html/parameter/element/textarea.php index 9463748f8a7dd..64ec00187f27f 100644 --- a/libraries/joomla/html/parameter/element/textarea.php +++ b/libraries/joomla/html/parameter/element/textarea.php @@ -1,47 +1,46 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementTextarea extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Textarea'; - - function fetchElement($name, $value, &$node, $control_name) - { - $rows = $node->attributes('rows'); - $cols = $node->attributes('cols'); - $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="text_area"' ); - // convert
      tags so they are not visible when editing - $value = str_replace('
      ', "\n", $value); - - return ''; - } -} \ No newline at end of file + +/** + * Renders a textarea element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementTextarea extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Textarea'; + + public function fetchElement($name, $value, &$node, $control_name) + { + $rows = $node->attributes('rows'); + $cols = $node->attributes('cols'); + $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="text_area"' ); + // convert
      tags so they are not visible when editing + $value = str_replace('
      ', "\n", $value); + + return ''; + } +} diff --git a/libraries/joomla/html/parameter/element/timezones.php b/libraries/joomla/html/parameter/element/timezones.php index 49690b8102a44..6c361d7cfd7e1 100644 --- a/libraries/joomla/html/parameter/element/timezones.php +++ b/libraries/joomla/html/parameter/element/timezones.php @@ -1,88 +1,88 @@ - - * @package Joomla.Framework - * @subpackage Parameter - * @since 1.5 - */ - -class JElementTimezones extends JElement -{ - /** - * Element name - * - * @access protected - * @var string - */ - var $_name = 'Timezones'; - - function fetchElement($name, $value, &$node, $control_name) - { - if(!strlen($value)) { - $conf =& JFactory::getConfig(); - $value = $conf->getValue('config.offset'); - } - - // LOCALE SETTINGS - $timezones = array ( - JHTML::_('select.option', -12, JText::_('(UTC -12:00) International Date Line West')), - JHTML::_('select.option', -11, JText::_('(UTC -11:00) Midway Island, Samoa')), - JHTML::_('select.option', -10, JText::_('(UTC -10:00) Hawaii')), - JHTML::_('select.option', -9.5, JText::_('(UTC -09:30) Taiohae, Marquesas Islands')), - JHTML::_('select.option', -9, JText::_('(UTC -09:00) Alaska')), - JHTML::_('select.option', -8, JText::_('(UTC -08:00) Pacific Time (US & Canada)')), - JHTML::_('select.option', -7, JText::_('(UTC -07:00) Mountain Time (US & Canada)')), - JHTML::_('select.option', -6, JText::_('(UTC -06:00) Central Time (US & Canada), Mexico City')), - JHTML::_('select.option', -5, JText::_('(UTC -05:00) Eastern Time (US & Canada), Bogota, Lima')), - JHTML::_('select.option', -4, JText::_('(UTC -04:00) Atlantic Time (Canada), Caracas, La Paz')), - JHTML::_('select.option', -3.5, JText::_('(UTC -03:30) St. John\'s, Newfoundland, Labrador')), - JHTML::_('select.option', -3, JText::_('(UTC -03:00) Brazil, Buenos Aires, Georgetown')), - JHTML::_('select.option', -2, JText::_('(UTC -02:00) Mid-Atlantic')), - JHTML::_('select.option', -1, JText::_('(UTC -01:00) Azores, Cape Verde Islands')), - JHTML::_('select.option', 0, JText::_('(UTC 00:00) Western Europe Time, London, Lisbon, Casablanca')), - JHTML::_('select.option', 1, JText::_('(UTC +01:00) Amsterdam, Berlin, Brussels, Copenhagen, Madrid, Paris')), - JHTML::_('select.option', 2, JText::_('(UTC +02:00) Istanbul, Jerusalem, Kaliningrad, South Africa')), - JHTML::_('select.option', 3, JText::_('(UTC +03:00) Baghdad, Riyadh, Moscow, St. Petersburg')), - JHTML::_('select.option', 3.5, JText::_('(UTC +03:30) Tehran')), - JHTML::_('select.option', 4, JText::_('(UTC +04:00) Abu Dhabi, Muscat, Baku, Tbilisi')), - JHTML::_('select.option', 4.5, JText::_('(UTC +04:30) Kabul')), - JHTML::_('select.option', 5, JText::_('(UTC +05:00) Ekaterinburg, Islamabad, Karachi, Tashkent')), - JHTML::_('select.option', 5.5, JText::_('(UTC +05:30) Bombay, Calcutta, Madras, New Delhi')), - JHTML::_('select.option', 5.75, JText::_('(UTC +05:45) Kathmandu')), - JHTML::_('select.option', 6, JText::_('(UTC +06:00) Almaty, Dhaka, Colombo')), - JHTML::_('select.option', 6.30, JText::_('(UTC +06:30) Yagoon')), - JHTML::_('select.option', 7, JText::_('(UTC +07:00) Bangkok, Hanoi, Jakarta')), - JHTML::_('select.option', 8, JText::_('(UTC +08:00) Beijing, Perth, Singapore, Hong Kong')), - JHTML::_('select.option', 8.75, JText::_('(UTC +08:00) Western Australia')), - JHTML::_('select.option', 9, JText::_('(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk')), - JHTML::_('select.option', 9.5, JText::_('(UTC +09:30) Adelaide, Darwin, Yakutsk')), - JHTML::_('select.option', 10, JText::_('(UTC +10:00) Eastern Australia, Guam, Vladivostok')), - JHTML::_('select.option', 10.5, JText::_('(UTC +10:30) Lord Howe Island (Australia)')), - JHTML::_('select.option', 11, JText::_('(UTC +11:00) Magadan, Solomon Islands, New Caledonia')), - JHTML::_('select.option', 11.30, JText::_('(UTC +11:30) Norfolk Island')), - JHTML::_('select.option', 12, JText::_('(UTC +12:00) Auckland, Wellington, Fiji, Kamchatka')), - JHTML::_('select.option', 12.75, JText::_('(UTC +12:45) Chatham Island')), - JHTML::_('select.option', 13, JText::_('(UTC +13:00) Tonga')), - JHTML::_('select.option', 14, JText::_('(UTC +14:00) Kiribati')),); - - return JHTML::_('select.genericlist', $timezones, ''.$control_name.'['.$name.']', ' class="inputbox"', 'value', 'text', $value, $control_name.$name ); - } -} +getValue('config.offset'); + } + + // LOCALE SETTINGS + $timezones = array ( + JHTML::_('select.option', -12, JText::_('(UTC -12:00) International Date Line West')), + JHTML::_('select.option', -11, JText::_('(UTC -11:00) Midway Island, Samoa')), + JHTML::_('select.option', -10, JText::_('(UTC -10:00) Hawaii')), + JHTML::_('select.option', -9.5, JText::_('(UTC -09:30) Taiohae, Marquesas Islands')), + JHTML::_('select.option', -9, JText::_('(UTC -09:00) Alaska')), + JHTML::_('select.option', -8, JText::_('(UTC -08:00) Pacific Time (US & Canada)')), + JHTML::_('select.option', -7, JText::_('(UTC -07:00) Mountain Time (US & Canada)')), + JHTML::_('select.option', -6, JText::_('(UTC -06:00) Central Time (US & Canada), Mexico City')), + JHTML::_('select.option', -5, JText::_('(UTC -05:00) Eastern Time (US & Canada), Bogota, Lima')), + JHTML::_('select.option', -4, JText::_('(UTC -04:00) Atlantic Time (Canada), Caracas, La Paz')), + JHTML::_('select.option', -4.5, JText::_('(UTC -04:30) Venezuela')), + JHTML::_('select.option', -3.5, JText::_('(UTC -03:30) St. John\'s, Newfoundland, Labrador')), + JHTML::_('select.option', -3, JText::_('(UTC -03:00) Brazil, Buenos Aires, Georgetown')), + JHTML::_('select.option', -2, JText::_('(UTC -02:00) Mid-Atlantic')), + JHTML::_('select.option', -1, JText::_('(UTC -01:00) Azores, Cape Verde Islands')), + JHTML::_('select.option', 0, JText::_('(UTC 00:00) Western Europe Time, London, Lisbon, Casablanca')), + JHTML::_('select.option', 1, JText::_('(UTC +01:00) Amsterdam, Berlin, Brussels, Copenhagen, Madrid, Paris')), + JHTML::_('select.option', 2, JText::_('(UTC +02:00) Istanbul, Jerusalem, Kaliningrad, South Africa')), + JHTML::_('select.option', 3, JText::_('(UTC +03:00) Baghdad, Riyadh, Moscow, St. Petersburg')), + JHTML::_('select.option', 3.5, JText::_('(UTC +03:30) Tehran')), + JHTML::_('select.option', 4, JText::_('(UTC +04:00) Abu Dhabi, Muscat, Baku, Tbilisi')), + JHTML::_('select.option', 4.5, JText::_('(UTC +04:30) Kabul')), + JHTML::_('select.option', 5, JText::_('(UTC +05:00) Ekaterinburg, Islamabad, Karachi, Tashkent')), + JHTML::_('select.option', 5.5, JText::_('(UTC +05:30) Bombay, Calcutta, Madras, New Delhi')), + JHTML::_('select.option', 5.75, JText::_('(UTC +05:45) Kathmandu')), + JHTML::_('select.option', 6, JText::_('(UTC +06:00) Almaty, Dhaka, Colombo')), + JHTML::_('select.option', 6.30, JText::_('(UTC +06:30) Yagoon')), + JHTML::_('select.option', 7, JText::_('(UTC +07:00) Bangkok, Hanoi, Jakarta')), + JHTML::_('select.option', 8, JText::_('(UTC +08:00) Beijing, Perth, Singapore, Hong Kong')), + JHTML::_('select.option', 8.75, JText::_('(UTC +08:00) Western Australia')), + JHTML::_('select.option', 9, JText::_('(UTC +09:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk')), + JHTML::_('select.option', 9.5, JText::_('(UTC +09:30) Adelaide, Darwin, Yakutsk')), + JHTML::_('select.option', 10, JText::_('(UTC +10:00) Eastern Australia, Guam, Vladivostok')), + JHTML::_('select.option', 10.5, JText::_('(UTC +10:30) Lord Howe Island (Australia)')), + JHTML::_('select.option', 11, JText::_('(UTC +11:00) Magadan, Solomon Islands, New Caledonia')), + JHTML::_('select.option', 11.30, JText::_('(UTC +11:30) Norfolk Island')), + JHTML::_('select.option', 12, JText::_('(UTC +12:00) Auckland, Wellington, Fiji, Kamchatka')), + JHTML::_('select.option', 12.75, JText::_('(UTC +12:45) Chatham Island')), + JHTML::_('select.option', 13, JText::_('(UTC +13:00) Tonga')), + JHTML::_('select.option', 14, JText::_('(UTC +14:00) Kiribati')),); + + return JHTML::_('select.genericlist', $timezones, ''.$control_name.'['.$name.']', ' class="inputbox"', 'value', 'text', $value, $control_name.$name ); + } +} diff --git a/libraries/joomla/html/parameter/element/usergroup.php b/libraries/joomla/html/parameter/element/usergroup.php index ad43af04ad8ee..a63fddeffe57e 100644 --- a/libraries/joomla/html/parameter/element/usergroup.php +++ b/libraries/joomla/html/parameter/element/usergroup.php @@ -1,61 +1,61 @@ -get_group_children_tree( null, 'USERS', false ); - $ctrl = $control_name .'['. $name .']'; - - $attribs = ' '; - if ($v = $node->attributes('size')) { - $attribs .= 'size="'.$v.'"'; - } - if ($v = $node->attributes('class')) { - $attribs .= 'class="'.$v.'"'; - } else { - $attribs .= 'class="inputbox"'; - } - if ($m = $node->attributes('multiple')) - { - $attribs .= 'multiple="multiple"'; - $ctrl .= '[]'; - //$value = implode( '|', ) - } - //array_unshift( $editors, JHTML::_('select.option', '', '- '. JText::_( 'Select Editor' ) .' -' ) ); - - return JHTML::_('select.genericlist', $gtree, $ctrl, $attribs, 'value', 'text', $value, $control_name.$name ); - } -} \ No newline at end of file + +/** + * Renders a editors element + * + * @package Joomla.Framework + * @subpackage Parameter + * @since 1.5 + */ + +class JElementUserGroup extends JElement +{ + /** + * Element name + * + * @access protected + * @var string + */ + protected $_name = 'Editors'; + + public function fetchElement($name, $value, &$node, $control_name) + { + $acl =& JFactory::getACL(); + $gtree = $acl->get_group_children_tree( null, 'USERS', false ); + $ctrl = $control_name .'['. $name .']'; + + $attribs = ' '; + if ($v = $node->attributes('size')) { + $attribs .= 'size="'.$v.'"'; + } + if ($v = $node->attributes('class')) { + $attribs .= 'class="'.$v.'"'; + } else { + $attribs .= 'class="inputbox"'; + } + if ($m = $node->attributes('multiple')) + { + $attribs .= 'multiple="multiple"'; + $ctrl .= '[]'; + //$value = implode( '|', ) + } + //array_unshift( $editors, JHTML::_('select.option', '', '- '. JText::_( 'Select Editor' ) .' -' ) ); + + return JHTML::_('select.genericlist', $gtree, $ctrl, $attribs, 'value', 'text', $value, $control_name.$name ); + } +} diff --git a/libraries/joomla/html/parameter/index.html b/libraries/joomla/html/parameter/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/html/parameter/index.html +++ b/libraries/joomla/html/parameter/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/html/toolbar.php b/libraries/joomla/html/toolbar.php index 7e468123b94e7..ee4aeef8e08a4 100644 --- a/libraries/joomla/html/toolbar.php +++ b/libraries/joomla/html/toolbar.php @@ -1,261 +1,284 @@ - - * @package Joomla.Framework - * @subpackage HTML - * @since 1.5 - */ -class JToolBar extends JObject -{ - /** - * Toolbar name - * - * @access private - * @var string - */ - var $_name = array (); - - /** - * Toolbar array - * - * @access private - * @var array - */ - var $_bar = array (); - - /** - * Loaded buttons - * - * @access private - * @var array - */ - var $_buttons = array (); - - /** - * Directories, where button types can be stored - * - * @access private - * @var array - */ - var $_buttonPath = array (); - - /** - * Constructor - * - * @access protected - * @param string The toolbar name - * @var string The type of setup file - */ - function __construct($name = 'toolbar') - { - $this->_name = $name; - - // Set base path to find buttons - $this->_buttonPath[] = dirname(__FILE__).DS.'toolbar'.DS.'button'; - - } - - /** - * Returns a reference to a global JToolBar object, only creating it if it - * doesn't already exist. - * - * This method must be invoked as: - *
        $toolbar = & JToolBar::getInstance( $name );
      - * - * @access public - * @param string $name The name of the toolbar. - * @return JToolBar The JToolBar object. - */ - function & getInstance($name = 'toolbar') - { - static $instances; - - if (!isset ($instances)) { - $instances = array (); - } - - if (empty ($instances[$name])) { - $instances[$name] = new JToolBar($name); - } - - return $instances[$name]; - } - - /** - * Set a value - * - * @access public - * @param string The name of the param - * @param string The value of the parameter - * @return string The set value - */ - function appendButton() - { - // Push button onto the end of the toolbar array - $btn = func_get_args(); - array_push($this->_bar, $btn); - return true; - } - - /** - * Get a value - * - * @access public - * @param string The name of the param - * @param mixed The default value if not found - * @return string - */ - function prependButton() - { - // Insert button into the front of the toolbar array - $btn = func_get_args(); - array_unshift($this->_bar, $btn); - return true; - } - - /** - * Render - * - * @access public - * @param string The name of the control, or the default text area if a setup file is not found - * @return string HTML - */ - function render() - { - $html = array (); - - // Start toolbar div - $html[] = '
      '; - $html[] = ''; - - // Render each button in the toolbar - foreach ($this->_bar as $button) { - $html[] = $this->renderButton($button); - } - - // End toolbar div - $html[] = '
      '; - $html[] = '
      '; - - return implode("\n", $html); - } - - /** - * Render a parameter type - * - * @param object A param tag node - * @param string The control name - * @return array Any array of the label, the form element and the tooltip - */ - function renderButton( &$node ) - { - // Get the button type - $type = $node[0]; - - $button = & $this->loadButtonType($type); - - /** - * Error Occurred - */ - if ($button === false) { - return JText::_('Button not defined for type').' = '.$type; - } - return $button->render($node); - } - - /** - * Loads a button type - * - * @access public - * @param string buttonType - * @return object - * @since 1.5 - */ - function & loadButtonType($type, $new = false) - { - $false = false; - - $signature = md5($type); - if (isset ($this->_buttons[$signature]) && $new === false) { - return $this->_buttons[$signature]; - } - - if (!class_exists('JButton')) - { - JError::raiseWarning( 'SOME_ERROR_CODE', 'Could not load button base class.' ); - return $false; - } - - $buttonClass = 'JButton'.$type; - if (!class_exists($buttonClass)) - { - if (isset ($this->_buttonPath)) { - $dirs = $this->_buttonPath; - } else { - $dirs = array (); - } - - $file = JFilterInput::clean(str_replace('_', DS, strtolower($type)).'.php', 'path'); - - jimport('joomla.filesystem.path'); - if ($buttonFile = JPath::find($dirs, $file)) { - include_once $buttonFile; - } else { - JError::raiseWarning('SOME_ERROR_CODE', "Could not load module $buttonClass ($buttonFile)."); - return $false; - } - } - - if (!class_exists($buttonClass)) - { - //return JError::raiseError( 'SOME_ERROR_CODE', "Module file $buttonFile does not contain class $buttonClass." ); - return $false; - } - $this->_buttons[$signature] = new $buttonClass($this); - - return $this->_buttons[$signature]; - } - - /** - * Add a directory where JToolBar should search for button types - * - * You may either pass a string or an array of directories. - * - * {@link JParameter} will be searching for an element type in the same order you - * added them. If the parameter type cannot be found in the custom folders, - * it will look in JParameter/types. - * - * @access public - * @param string|array directory or directories to search. - * @since 1.5 - */ - function addButtonPath($path) - { - if (is_array($path)) { - $this->_buttonPath = array_merge($this->_buttonPath, $path); - } else { - array_push($this->_buttonPath, $path); - } - } -} \ No newline at end of file +_name = $name; + + // Set base path to find buttons + $this->_buttonPath[] = dirname(__FILE__).DS.'toolbar'.DS.'button'; + + } + + /** + * Returns a reference to a global JToolBar object, only creating it if it + * doesn't already exist. + * + * This method must be invoked as: + *
        $toolbar = & JToolBar::getInstance( $name );
      + * + * @access public + * @param string $name The name of the toolbar. + * @return JToolBar The JToolBar object. + */ + public static function & getInstance($name = 'toolbar') + { + static $instances; + + if (!isset ($instances)) { + $instances = array (); + } + + if (empty ($instances[$name])) { + $instances[$name] = new JToolBar($name); + } + + return $instances[$name]; + } + + /** + * Set a value + * + * @access public + * @param string The name of the param + * @param string The value of the parameter + * @return string The set value + */ + public function appendButton() + { + // Push button onto the end of the toolbar array + $btn = func_get_args(); + array_push($this->_bar, $btn); + return true; + } + + /** + * Get the list of toolbar links + * + * @return array + * @access public + * @since 1.6 + */ + public function getItems() + { + return $this->_bar; + } + + /** + * Get the name of the toolbar + * + * @return string + * @access public + * @since 1.6 + */ + public function getName() + { + return $this->_name; + } + + /** + * Get a value + * + * @access public + * @param string The name of the param + * @param mixed The default value if not found + * @return string + */ + public function prependButton() + { + // Insert button into the front of the toolbar array + $btn = func_get_args(); + array_unshift($this->_bar, $btn); + return true; + } + + /** + * Render + * + * @access public + * @param string The name of the control, or the default text area if a setup file is not found + * @return string HTML + */ + public function render() + { + $html = array (); + + // Start toolbar div + $html[] = '
      '; + $html[] = ''; + + // Render each button in the toolbar + foreach ($this->_bar as $button) { + $html[] = $this->renderButton($button); + } + + // End toolbar div + $html[] = '
      '; + $html[] = '
      '; + + return implode("\n", $html); + } + + /** + * Render a parameter type + * + * @param object A param tag node + * @param string The control name + * @return array Any array of the label, the form element and the tooltip + */ + public function renderButton( &$node ) + { + // Get the button type + $type = $node[0]; + + $button = & $this->loadButtonType($type); + + /** + * Error Occurred + */ + if ($button === false) { + return JText::_('Button not defined for type').' = '.$type; + } + return $button->render($node); + } + + /** + * Loads a button type + * + * @access public + * @param string buttonType + * @return object + * @since 1.5 + */ + public function &loadButtonType($type, $new = false) + { + $false = false; + + $signature = md5($type); + if (isset ($this->_buttons[$signature]) && $new === false) { + return $this->_buttons[$signature]; + } + + if (!class_exists('JButton')) + { + JError::raiseWarning( 'SOME_ERROR_CODE', 'Could not load button base class.' ); + return $false; + } + + $buttonClass = 'JButton'.$type; + if (!class_exists($buttonClass)) + { + if (isset ($this->_buttonPath)) { + $dirs = $this->_buttonPath; + } else { + $dirs = array (); + } + + $file = JFilterInput::clean(str_replace('_', DS, strtolower($type)).'.php', 'path'); + + jimport('joomla.filesystem.path'); + if ($buttonFile = JPath::find($dirs, $file)) { + include_once $buttonFile; + } else { + JError::raiseWarning('SOME_ERROR_CODE', "Could not load module $buttonClass ($buttonFile)."); + return $false; + } + } + + if (!class_exists($buttonClass)) + { + //return JError::raiseError( 'SOME_ERROR_CODE', "Module file $buttonFile does not contain class $buttonClass." ); + return $false; + } + $this->_buttons[$signature] = new $buttonClass($this); + + return $this->_buttons[$signature]; + } + + /** + * Add a directory where JToolBar should search for button types + * + * You may either pass a string or an array of directories. + * + * {@link JParameter} will be searching for an element type in the same order you + * added them. If the parameter type cannot be found in the custom folders, + * it will look in JParameter/types. + * + * @access public + * @param string|array directory or directories to search. + * @since 1.5 + */ + public function addButtonPath($path) + { + if (is_array($path)) { + $this->_buttonPath = array_merge($this->_buttonPath, $path); + } else { + array_push($this->_buttonPath, $path); + } + } +} diff --git a/libraries/joomla/html/toolbar/button.php b/libraries/joomla/html/toolbar/button.php index bc2790e89936f..9d5f5ce1a8c9d 100644 --- a/libraries/joomla/html/toolbar/button.php +++ b/libraries/joomla/html/toolbar/button.php @@ -1,133 +1,129 @@ -_parent = $parent; - } - - /** - * get the element name - * - * @access public - * @return string type of the parameter - */ - function getName() - { - return $this->_name; - } - - function render( &$definition ) - { - /* - * Initialize some variables - */ - $html = null; - $id = call_user_func_array(array(&$this, 'fetchId'), $definition); - $action = call_user_func_array(array(&$this, 'fetchButton'), $definition); - - // Build id attribute - if ($id) { - $id = "id=\"$id\""; - } - - // Build the HTML Button - $html .= "\n"; - $html .= $action; - $html .= "\n"; - - return $html; - } - - /** - * Method to get the CSS class name for an icon identifier - * - * Can be redefined in the final class - * - * @access public - * @param string $identifier Icon identification string - * @return string CSS class name - * @since 1.5 - */ - function fetchIconClass($identifier) - { - return "icon-32-$identifier"; - } - - /** - * Get the button id - * - * Can be redefined in the final button class - * - * @access public - * @since 1.5 - */ - function fetchId() - { - return; - } - - /** - * Get the button - * - * Defined in the final button class - * - * @abstract - * @access public - * @since 1.5 - */ - function fetchButton() - { - return; - } -} \ No newline at end of file + +/** + * Button base class + * + * The JButton is the base class for all JButton types + * + * @abstract + * @package Joomla.Framework + * @subpackage HTML + * @since 1.5 + */ +abstract class JButton extends JObject +{ + /** + * element name + * + * This has to be set in the final renderer classes. + * + * @access protected + * @var string + */ + protected $_name = null; + + /** + * reference to the object that instantiated the element + * + * @access protected + * @var object + */ + protected $_parent = null; + + /** + * Constructor + * + * @access protected + */ + public function __construct($parent = null) + { + $this->_parent = $parent; + } + + /** + * get the element name + * + * @access public + * @return string type of the parameter + */ + public function getName() + { + return $this->_name; + } + + public function render( &$definition ) + { + /* + * Initialize some variables + */ + $html = null; + $id = call_user_func_array(array(&$this, 'fetchId'), $definition); + $action = call_user_func_array(array(&$this, 'fetchButton'), $definition); + + // Build id attribute + if ($id) { + $id = "id=\"$id\""; + } + + // Build the HTML Button + $html .= "\n"; + $html .= $action; + $html .= "\n"; + + return $html; + } + + /** + * Method to get the CSS class name for an icon identifier + * + * Can be redefined in the final class + * + * @access public + * @param string $identifier Icon identification string + * @return string CSS class name + * @since 1.5 + */ + public function fetchIconClass($identifier) + { + return "icon-32-$identifier"; + } + + /** + * Get the button id + * + * Can be redefined in the final button class + * + * @access public + * @since 1.5 + */ + public function fetchId() + { + return; + } + + /** + * Get the button + * + * Defined in the final button class + * + * @abstract + * @access public + * @since 1.5 + */ + abstract public function fetchButton(); +} diff --git a/libraries/joomla/html/toolbar/button/confirm.php b/libraries/joomla/html/toolbar/button/confirm.php index 8af70e5265ae1..2ec9c9043103d 100644 --- a/libraries/joomla/html/toolbar/button/confirm.php +++ b/libraries/joomla/html/toolbar/button/confirm.php @@ -18,7 +18,6 @@ /** * Renders a standard button with a confirm dialog * - * @author Louis Landry * @package Joomla.Framework * @subpackage HTML * @since 1.5 @@ -31,9 +30,9 @@ class JButtonConfirm extends JButton * @access protected * @var string */ - var $_name = 'Confirm'; + protected $_name = 'Confirm'; - function fetchButton( $type='Confirm', $msg='', $name = '', $text = '', $task = '', $list = true, $hideMenu = false ) + public function fetchButton( $type='Confirm', $msg='', $name = '', $text = '', $task = '', $list = true, $hideMenu = false ) { $text = JText::_($text); $msg = JText::_($msg, true); @@ -56,9 +55,9 @@ function fetchButton( $type='Confirm', $msg='', $name = '', $text = '', $task = * @return string Button CSS Id * @since 1.5 */ - function fetchId( $type='Confirm', $name = '', $text = '', $task = '', $list = true, $hideMenu = false ) + public function fetchId( $type='Confirm', $name = '', $text = '', $task = '', $list = true, $hideMenu = false ) { - return $this->_parent->_name.'-'.$name; + return $this->_parent->getName().'-'.$name; } /** @@ -69,7 +68,7 @@ function fetchId( $type='Confirm', $name = '', $text = '', $task = '', $list = t * @return string JavaScript command string * @since 1.5 */ - function _getCommand($msg, $name, $task, $list, $hide) + protected function _getCommand($msg, $name, $task, $list, $hide) { $todo = JString::strtolower(JText::_( $name )); $message = JText::sprintf( 'Please make a selection from the list to', $todo ); @@ -91,4 +90,4 @@ function _getCommand($msg, $name, $task, $list, $hide) return $cmd; } -} \ No newline at end of file +} diff --git a/libraries/joomla/html/toolbar/button/custom.php b/libraries/joomla/html/toolbar/button/custom.php index 80585a38ed1a4..8575a5f3a9ba1 100644 --- a/libraries/joomla/html/toolbar/button/custom.php +++ b/libraries/joomla/html/toolbar/button/custom.php @@ -1,52 +1,51 @@ - - * @package Joomla.Framework - * @subpackage HTML - * @since 1.5 - */ -class JButtonCustom extends JButton -{ - /** - * Button type - * - * @access protected - * @var string - */ - var $_name = 'Custom'; - - function fetchButton( $type='Custom', $html = '', $id = 'custom' ) - { - return $html; - } - - /** - * Get the button CSS Id - * - * @access public - * @return string Button CSS Id - * @since 1.5 - */ - function fetchId( $type='Custom', $html = '', $id = 'custom' ) - { - return $this->_parent->_name.'-'.$id; - } -} \ No newline at end of file + +/** + * Renders a custom button + * + * @package Joomla.Framework + * @subpackage HTML + * @since 1.5 + */ +class JButtonCustom extends JButton +{ + /** + * Button type + * + * @access protected + * @var string + */ + protected $_name = 'Custom'; + + public function fetchButton( $type='Custom', $html = '', $id = 'custom' ) + { + return $html; + } + + /** + * Get the button CSS Id + * + * @access public + * @return string Button CSS Id + * @since 1.5 + */ + public function fetchId( $type='Custom', $html = '', $id = 'custom' ) + { + return $this->_parent->getName().'-'.$id; + } +} diff --git a/libraries/joomla/html/toolbar/button/help.php b/libraries/joomla/html/toolbar/button/help.php index ed3a76a2d73ef..bdbef2ea7a9a0 100644 --- a/libraries/joomla/html/toolbar/button/help.php +++ b/libraries/joomla/html/toolbar/button/help.php @@ -1,84 +1,83 @@ - - * @package Joomla.Framework - * @subpackage HTML - * @since 1.5 - */ -class JButtonHelp extends JButton -{ - /** - * Button type - * - * @access protected - * @var string - */ - var $_name = 'Help'; - - function fetchButton( $type='Help', $ref = '', $com = false ) - { - $text = JText::_('Help'); - $class = $this->fetchIconClass('help'); - $doTask = $this->_getCommand($ref, $com); - - $html = "\n"; - $html .= "\n"; - $html .= "\n"; - $html .= "$text\n"; - $html .= "\n"; - - return $html; - } - - /** - * Get the button id - * - * Redefined from JButton class - * - * @access public - * @param string $name Button name - * @return string Button CSS Id - * @since 1.5 - */ - function fetchId($name) - { - return $this->_parent->_name.'-'."help"; - } - - /** - * Get the JavaScript command for the button - * - * @access private - * @param object $definition Button definition - * @return string JavaScript command string - * @since 1.5 - */ - function _getCommand($ref, $com) - { - // Get Help URL - jimport('joomla.language.help'); - $url = JHelp::createURL($ref, $com); - - $cmd = "popupWindow('$url', '".JText::_('Help', true)."', 640, 480, 1)"; - - return $cmd; - } -} \ No newline at end of file + +/** + * Renders a help popup window button + * + * @package Joomla.Framework + * @subpackage HTML + * @since 1.5 + */ +class JButtonHelp extends JButton +{ + /** + * Button type + * + * @access protected + * @var string + */ + protected $_name = 'Help'; + + public function fetchButton( $type='Help', $ref = '', $com = false ) + { + $text = JText::_('Help'); + $class = $this->fetchIconClass('help'); + $doTask = $this->_getCommand($ref, $com); + + $html = "\n"; + $html .= "\n"; + $html .= "\n"; + $html .= "$text\n"; + $html .= "\n"; + + return $html; + } + + /** + * Get the button id + * + * Redefined from JButton class + * + * @access public + * @param string $name Button name + * @return string Button CSS Id + * @since 1.5 + */ + public function fetchId($name) + { + return $this->_parent->getName().'-'."help"; + } + + /** + * Get the JavaScript command for the button + * + * @access private + * @param object $definition Button definition + * @return string JavaScript command string + * @since 1.5 + */ + protected function _getCommand($ref, $com) + { + // Get Help URL + jimport('joomla.language.help'); + $url = JHelp::createURL($ref, $com); + + $cmd = "popupWindow('$url', '".JText::_('Help', true)."', 640, 480, 1)"; + + return $cmd; + } +} diff --git a/libraries/joomla/html/toolbar/button/index.html b/libraries/joomla/html/toolbar/button/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/html/toolbar/button/index.html +++ b/libraries/joomla/html/toolbar/button/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/html/toolbar/button/link.php b/libraries/joomla/html/toolbar/button/link.php index d26caa95c8d07..cb30bab70dd7a 100644 --- a/libraries/joomla/html/toolbar/button/link.php +++ b/libraries/joomla/html/toolbar/button/link.php @@ -1,74 +1,73 @@ - - * @package Joomla.Framework - * @subpackage HTML - * @since 1.5 - */ -class JButtonLink extends JButton -{ - /** - * Button type - * - * @access protected - * @var string - */ - var $_name = 'Link'; - - function fetchButton( $type='Link', $name = 'back', $text = '', $url = null ) - { - $text = JText::_($text); - $class = $this->fetchIconClass($name); - $doTask = $this->_getCommand($url); - - $html = "\n"; - $html .= "\n"; - $html .= "\n"; - $html .= "$text\n"; - $html .= "\n"; - - return $html; - } - - /** - * Get the button CSS Id - * - * @access public - * @return string Button CSS Id - * @since 1.5 - */ - function fetchId($name) - { - return $this->_parent->_name.'-'.$name; - } - - /** - * Get the JavaScript command for the button - * - * @access private - * @param object $definition Button definition - * @return string JavaScript command string - * @since 1.5 - */ - function _getCommand($url) { - return $url; - } -} \ No newline at end of file +fetchIconClass($name); + $doTask = $this->_getCommand($url); + + $html = "\n"; + $html .= "\n"; + $html .= "\n"; + $html .= "$text\n"; + $html .= "\n"; + + return $html; + } + + /** + * Get the button CSS Id + * + * @access public + * @return string Button CSS Id + * @since 1.5 + */ + public function fetchId($name) + { + return $this->_parent->getName().'-'.$name; + } + + /** + * Get the JavaScript command for the button + * + * @access private + * @param object $definition Button definition + * @return string JavaScript command string + * @since 1.5 + */ + protected function _getCommand($url) { + return $url; + } +} diff --git a/libraries/joomla/html/toolbar/button/popup.php b/libraries/joomla/html/toolbar/button/popup.php index 51b3417996b24..9bc9b7b79deb1 100644 --- a/libraries/joomla/html/toolbar/button/popup.php +++ b/libraries/joomla/html/toolbar/button/popup.php @@ -1,84 +1,83 @@ - - * @package Joomla.Framework - * @subpackage HTML - * @since 1.5 - */ -class JButtonPopup extends JButton -{ - /** - * Button type - * - * @access protected - * @var string - */ - var $_name = 'Popup'; - - function fetchButton( $type='Popup', $name = '', $text = '', $url = '', $width=640, $height=480, $top=0, $left=0 ) - { - JHTML::_('behavior.modal'); - - $text = JText::_($text); - $class = $this->fetchIconClass($name); - $doTask = $this->_getCommand($name, $url, $width, $height, $top, $left); - - $html = "\n"; - $html .= "\n"; - $html .= "\n"; - $html .= "$text\n"; - $html .= "\n"; - - return $html; - } - - /** - * Get the button id - * - * Redefined from JButton class - * - * @access public - * @param string $name Button name - * @return string Button CSS Id - * @since 1.5 - */ - function fetchId($name) - { - return $this->_parent->_name.'-'."popup-$name"; - } - - /** - * Get the JavaScript command for the button - * - * @access private - * @param object $definition Button definition - * @return string JavaScript command string - * @since 1.5 - */ - function _getCommand($name, $url, $width, $height, $top, $left) - { - if (substr($url, 0, 4) !== 'http') { - $url = JURI::base().$url; - } - - return $url; - } + +/** + * Renders a popup window button + * + * @package Joomla.Framework + * @subpackage HTML + * @since 1.5 + */ +class JButtonPopup extends JButton +{ + /** + * Button type + * + * @access protected + * @var string + */ + protected $_name = 'Popup'; + + public function fetchButton( $type='Popup', $name = '', $text = '', $url = '', $width=640, $height=480, $top=0, $left=0 ) + { + JHTML::_('behavior.modal'); + + $text = JText::_($text); + $class = $this->fetchIconClass($name); + $doTask = $this->_getCommand($name, $url, $width, $height, $top, $left); + + $html = "\n"; + $html .= "\n"; + $html .= "\n"; + $html .= "$text\n"; + $html .= "\n"; + + return $html; + } + + /** + * Get the button id + * + * Redefined from JButton class + * + * @access public + * @param string $name Button name + * @return string Button CSS Id + * @since 1.5 + */ + public function fetchId($name) + { + return $this->_parent->getName().'-'."popup-$name"; + } + + /** + * Get the JavaScript command for the button + * + * @access private + * @param object $definition Button definition + * @return string JavaScript command string + * @since 1.5 + */ + protected function _getCommand($name, $url, $width, $height, $top, $left) + { + if (substr($url, 0, 4) !== 'http') { + $url = JURI::base().$url; + } + + return $url; + } } diff --git a/libraries/joomla/html/toolbar/button/separator.php b/libraries/joomla/html/toolbar/button/separator.php index ac80806d8c46d..219eec9cb761b 100644 --- a/libraries/joomla/html/toolbar/button/separator.php +++ b/libraries/joomla/html/toolbar/button/separator.php @@ -1,52 +1,51 @@ - - * @package Joomla.Framework - * @subpackage HTML - * @since 1.5 - */ -class JButtonSeparator extends JButton -{ - /** - * Button type - * - * @access protected - * @var string - */ - var $_name = 'Separator'; - - function render( &$definition ) - { - /* - * Initialize variables - */ - $html = null; - $class = null; - $style = null; - - // Separator class name - $class = (empty($definition[1])) ? 'spacer' : $definition[1]; - // Custom width - $style = (empty($definition[2])) ? null : ' style="width:' . intval($definition[2]) . 'px;"'; - - return '\n\n"; - } -} \ No newline at end of file + +/** + * Renders a button separator + * + * @package Joomla.Framework + * @subpackage HTML + * @since 1.5 + */ +class JButtonSeparator extends JButton +{ + /** + * Button type + * + * @access protected + * @var string + */ + protected $_name = 'Separator'; + + public function render( &$definition ) + { + /* + * Initialize variables + */ + $html = null; + $class = null; + $style = null; + + // Separator class name + $class = (empty($definition[1])) ? 'spacer' : $definition[1]; + // Custom width + $style = (empty($definition[2])) ? null : ' style="width:' . intval($definition[2]) . 'px;"'; + + return '\n\n"; + } +} diff --git a/libraries/joomla/html/toolbar/button/standard.php b/libraries/joomla/html/toolbar/button/standard.php index 5d9cdbe81ac20..7d542010ec4ff 100644 --- a/libraries/joomla/html/toolbar/button/standard.php +++ b/libraries/joomla/html/toolbar/button/standard.php @@ -18,7 +18,6 @@ /** * Renders a standard button * - * @author Louis Landry * @package Joomla.Framework * @subpackage HTML * @since 1.5 @@ -31,9 +30,9 @@ class JButtonStandard extends JButton * @access protected * @var string */ - var $_name = 'Standard'; + protected $_name = 'Standard'; - function fetchButton( $type='Standard', $name = '', $text = '', $task = '', $list = true, $hideMenu = false ) + public function fetchButton( $type='Standard', $name = '', $text = '', $task = '', $list = true, $hideMenu = false ) { $i18n_text = JText::_($text); $class = $this->fetchIconClass($name); @@ -55,9 +54,9 @@ function fetchButton( $type='Standard', $name = '', $text = '', $task = '', $lis * @return string Button CSS Id * @since 1.5 */ - function fetchId( $type='Standard', $name = '', $text = '', $task = '', $list = true, $hideMenu = false ) + public function fetchId( $type='Standard', $name = '', $text = '', $task = '', $list = true, $hideMenu = false ) { - return $this->_parent->_name.'-'.$name; + return $this->_parent->getName().'-'.$name; } /** @@ -71,7 +70,7 @@ function fetchId( $type='Standard', $name = '', $text = '', $task = '', $list = * @return string JavaScript command string * @since 1.5 */ - function _getCommand($name, $task, $list, $hide) + protected function _getCommand($name, $task, $list, $hide) { $todo = JString::strtolower(JText::_( $name )); $message = JText::sprintf( 'Please make a selection from the list to', $todo ); @@ -87,4 +86,4 @@ function _getCommand($name, $task, $list, $hide) return $cmd; } -} \ No newline at end of file +} diff --git a/libraries/joomla/html/toolbar/index.html b/libraries/joomla/html/toolbar/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/html/toolbar/index.html +++ b/libraries/joomla/html/toolbar/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/import.php b/libraries/joomla/import.php index b1c32a564cae0..e7190be0314f9 100644 --- a/libraries/joomla/import.php +++ b/libraries/joomla/import.php @@ -1,58 +1,60 @@ -getShortVersion()); -} - -//Error -JLoader::import( 'joomla.error.error' ); -JLoader::import( 'joomla.error.exception' ); - -//Utilities -JLoader::import( 'joomla.utilities.arrayhelper' ); - -//Filters -JLoader::import( 'joomla.filter.filterinput' ); -JLoader::import( 'joomla.filter.filteroutput' ); - -//Register class that don't follow one file per class naming conventions -JLoader::register('JText' , dirname(__FILE__).DS.'methods.php'); -JLoader::register('JRoute', dirname(__FILE__).DS.'methods.php'); +getShortVersion()); +} + +//Error +JLoader::import( 'joomla.error.error' ); +JLoader::import( 'joomla.error.exception' ); + +//Utilities +JLoader::import( 'joomla.utilities.arrayhelper' ); + +//Filters +JLoader::import( 'joomla.filter.filterinput' ); +JLoader::import( 'joomla.filter.filteroutput' ); + +//Register class that don't follow one file per class naming conventions +JLoader::register('JText' , dirname(__FILE__).DS.'methods.php'); +JLoader::register('JRoute', dirname(__FILE__).DS.'methods.php'); diff --git a/libraries/joomla/index.html b/libraries/joomla/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/index.html +++ b/libraries/joomla/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/installer/adapters/component.php b/libraries/joomla/installer/adapters/component.php index ebec6426f0af2..b9c8838a889a3 100644 --- a/libraries/joomla/installer/adapters/component.php +++ b/libraries/joomla/installer/adapters/component.php @@ -1,113 +1,113 @@ -parent =& $parent; - } - - /** - * Custom install method for components - * - * @access public - * @return boolean True on success - * @since 1.5 - */ - function install() - { - // Get a database connector object - $db =& $this->parent->getDBO(); - - // Get the extension manifest object - $manifest =& $this->parent->getManifest(); - $this->manifest =& $manifest->document; - - /** - * --------------------------------------------------------------------------------------------- - * Manifest Document Setup Section - * --------------------------------------------------------------------------------------------- - */ - - // Set the extensions name - $name =& $this->manifest->getElementByPath('name'); - $name = JFilterInput::clean($name->data(), 'cmd'); - $this->set('name', $name); - - // Get the component description - $description = & $this->manifest->getElementByPath('description'); - if (is_a($description, 'JSimpleXMLElement')) { - $this->parent->set('message', $description->data()); - } else { - $this->parent->set('message', '' ); - } - - // Get some important manifest elements - $this->adminElement =& $this->manifest->getElementByPath('administration'); - $this->installElement =& $this->manifest->getElementByPath('install'); - $this->uninstallElement =& $this->manifest->getElementByPath('uninstall'); - - // Set the installation target paths - $this->parent->setPath('extension_site', JPath::clean(JPATH_SITE.DS."components".DS.strtolower("com_".str_replace(" ", "", $this->get('name'))))); - $this->parent->setPath('extension_administrator', JPath::clean(JPATH_ADMINISTRATOR.DS."components".DS.strtolower("com_".str_replace(" ", "", $this->get('name'))))); - - /** - * --------------------------------------------------------------------------------------------- - * Basic Checks Section - * --------------------------------------------------------------------------------------------- - */ - - // Make sure that we have an admin element - if ( ! is_a($this->adminElement, 'JSimpleXMLElement') ) - { - JError::raiseWarning(1, JText::_('Component').' '.JText::_('Install').': '.JText::_('The XML file did not contain an administration element')); - return false; - } - - /** - * --------------------------------------------------------------------------------------------- - * Filesystem Processing Section - * --------------------------------------------------------------------------------------------- - */ - - /* - * If the component site or admin directory already exists, then we will assume that the component is already - * installed or another component is using that directory. - */ +parent =& $parent; + } + + /** + * Custom install method for components + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + public function install() + { + // Get a database connector object + $db =& $this->parent->getDBO(); + + // Get the extension manifest object + $manifest =& $this->parent->getManifest(); + $this->manifest =& $manifest->document; + + /** + * --------------------------------------------------------------------------------------------- + * Manifest Document Setup Section + * --------------------------------------------------------------------------------------------- + */ + + // Set the extensions name + $name =& $this->manifest->getElementByPath('name'); + $name = JFilterInput::clean($name->data(), 'cmd'); + $this->set('name', $name); + + // Get the component description + $description = & $this->manifest->getElementByPath('description'); + if ($description INSTANCEOF JSimpleXMLElement) { + $this->parent->set('message', $description->data()); + } else { + $this->parent->set('message', '' ); + } + + // Get some important manifest elements + $this->adminElement =& $this->manifest->getElementByPath('administration'); + $this->installElement =& $this->manifest->getElementByPath('install'); + $this->uninstallElement =& $this->manifest->getElementByPath('uninstall'); + + // Set the installation target paths + $this->parent->setPath('extension_site', JPath::clean(JPATH_SITE.DS."components".DS.strtolower("com_".str_replace(" ", "", $this->get('name'))))); + $this->parent->setPath('extension_administrator', JPath::clean(JPATH_ADMINISTRATOR.DS."components".DS.strtolower("com_".str_replace(" ", "", $this->get('name'))))); + + /** + * --------------------------------------------------------------------------------------------- + * Basic Checks Section + * --------------------------------------------------------------------------------------------- + */ + + // Make sure that we have an admin element + if (!$this->adminElement INSTANCEOF JSimpleXMLElement ) + { + JError::raiseWarning(1, JText::_('Component').' '.JText::_('Install').': '.JText::_('The XML file did not contain an administration element')); + return false; + } + + /** + * --------------------------------------------------------------------------------------------- + * Filesystem Processing Section + * --------------------------------------------------------------------------------------------- + */ + + /* + * If the component site or admin directory already exists, then we will assume that the component is already + * installed or another component is using that directory. + */ $exists = false; if ( file_exists($this->parent->getPath('extension_site')) && !$this->parent->getOverwrite()) { $exists = true; - JError::raiseWarning(1, JText::_('Component').' '.JText::_('Install').': '.JText::_('Another component is already using directory').': "'.$this->parent->getPath('extension_site').'"'); + JError::raiseWarning(1, JText::_('Component').' '.JText::_('Install').': '.JText::_('Another component is already using directory').': "'.$this->parent->getPath('extension_site').'"'); } if ( file_exists($this->parent->getPath('extension_administrator')) && !$this->parent->getOverwrite()) { $exists = true; @@ -115,598 +115,633 @@ function install() } if ( $exists ) { - return false; - } - - // If the component directory does not exist, lets create it - $created = false; - if (!file_exists($this->parent->getPath('extension_site'))) { - if (!$created = JFolder::create($this->parent->getPath('extension_site'))) { - JError::raiseWarning(1, JText::_('Component').' '.JText::_('Install').': '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_site').'"'); - return false; - } - } - - /* - * Since we created the component directory and will want to remove it if we have to roll back - * the installation, lets add it to the installation step stack - */ - if ($created) { - $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_site'))); - } - - // If the component admin directory does not exist, lets create it - $created = false; - if (!file_exists($this->parent->getPath('extension_administrator'))) { - if (!$created = JFolder::create($this->parent->getPath('extension_administrator'))) { - JError::raiseWarning(1, JText::_('Component').' '.JText::_('Install').': '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_administrator').'"'); - // Install failed, rollback any changes - $this->parent->abort(); - return false; - } - } - - /* - * Since we created the component admin directory and we will want to remove it if we have to roll - * back the installation, lets add it to the installation step stack - */ - if ($created) { - $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_administrator'))); - } - - // Find files to copy - foreach ($this->manifest->children() as $child) - { - if (is_a($child, 'JSimpleXMLElement') && $child->name() == 'files') { - if ($this->parent->parseFiles($child) === false) { - // Install failed, rollback any changes - $this->parent->abort(); - return false; - } - } - } - - foreach ($this->adminElement->children() as $child) - { - if (is_a($child, 'JSimpleXMLElement') && $child->name() == 'files') { - if ($this->parent->parseFiles($child, 1) === false) { - // Install failed, rollback any changes - $this->parent->abort(); - return false; - } - } - } - - // Parse optional tags - $this->parent->parseMedia($this->manifest->getElementByPath('media')); - $this->parent->parseLanguages($this->manifest->getElementByPath('languages')); - $this->parent->parseLanguages($this->manifest->getElementByPath('administration/languages'), 1); - - // Parse deprecated tags - $this->parent->parseFiles($this->manifest->getElementByPath('images')); - $this->parent->parseFiles($this->manifest->getElementByPath('administration/images'), 1); - - // If there is an install file, lets copy it. - $installScriptElement =& $this->manifest->getElementByPath('installfile'); - if (is_a($installScriptElement, 'JSimpleXMLElement')) { - // Make sure it hasn't already been copied (this would be an error in the xml install file) - if (!file_exists($this->parent->getPath('extension_administrator').DS.$installScriptElement->data())) - { - $path['src'] = $this->parent->getPath('source').DS.$installScriptElement->data(); - $path['dest'] = $this->parent->getPath('extension_administrator').DS.$installScriptElement->data(); - if (!$this->parent->copyFiles(array ($path))) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Could not copy PHP install file.')); - return false; - } - } - $this->set('install.script', $installScriptElement->data()); - } - - // If there is an uninstall file, lets copy it. - $uninstallScriptElement =& $this->manifest->getElementByPath('uninstallfile'); - if (is_a($uninstallScriptElement, 'JSimpleXMLElement')) { - // Make sure it hasn't already been copied (this would be an error in the xml install file) - if (!file_exists($this->parent->getPath('extension_administrator').DS.$uninstallScriptElement->data())) - { - $path['src'] = $this->parent->getPath('source').DS.$uninstallScriptElement->data(); - $path['dest'] = $this->parent->getPath('extension_administrator').DS.$uninstallScriptElement->data(); - if (!$this->parent->copyFiles(array ($path))) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Could not copy PHP uninstall file.')); - return false; - } - } - } - - /** - * --------------------------------------------------------------------------------------------- - * Database Processing Section - * --------------------------------------------------------------------------------------------- - */ - - /* - * Let's run the install queries for the component - * If backward compatibility is required - run queries in xml file - * If Joomla 1.5 compatible, with discreet sql files - execute appropriate - * file for utf-8 support or non-utf-8 support - */ - $result = $this->parent->parseQueries($this->manifest->getElementByPath('install/queries')); - if ($result === false) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('SQL Error')." ".$db->stderr(true)); - return false; - } elseif ($result === 0) { - // no backward compatibility queries found - try for Joomla 1.5 type queries - // second argument is the utf compatible version attribute - $utfresult = $this->parent->parseSQLFiles($this->manifest->getElementByPath('install/sql')); - if ($utfresult === false) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('SQLERRORORFILE')." ".$db->stderr(true)); - return false; - } - } - - // Time to build the admin menus - $this->_buildAdminMenus(); - - /** - * --------------------------------------------------------------------------------------------- - * Custom Installation Script Section - * --------------------------------------------------------------------------------------------- - */ - - /* - * If we have an install script, lets include it, execute the custom - * install method, and append the return value from the custom install - * method to the installation message. - */ - if ($this->get('install.script')) { - if (is_file($this->parent->getPath('extension_administrator').DS.$this->get('install.script'))) { - ob_start(); - ob_implicit_flush(false); - require_once ($this->parent->getPath('extension_administrator').DS.$this->get('install.script')); - if (function_exists('com_install')) { - if (com_install() === false) { - $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Custom install routine failure')); - return false; - } - } - $msg = ob_get_contents(); - ob_end_clean(); - if ($msg != '') { - $this->parent->set('extension.message', $msg); - } - } - } - - /** - * --------------------------------------------------------------------------------------------- - * Finalization and Cleanup Section - * --------------------------------------------------------------------------------------------- - */ - - // Lastly, we will copy the manifest file to its appropriate place. - if (!$this->parent->copyManifest()) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Could not copy setup file')); - return false; - } - return true; - } - - /** - * Custom uninstall method for components - * - * @access public - * @param int $cid The id of the component to uninstall - * @param int $clientId The id of the client (unused) - * @return mixed Return value for uninstall method in component uninstall file - * @since 1.0 - */ - function uninstall($id, $clientId) - { - // Initialize variables - $db =& $this->parent->getDBO(); - $row = null; - $retval = true; - - // First order of business will be to load the component object table from the database. - // This should give us the necessary information to proceed. - $row = & JTable::getInstance('component'); - if ( !$row->load((int) $id) ) { - JError::raiseWarning(100, JText::_('ERRORUNKOWNEXTENSION')); - return false; - } - - // Is the component we are trying to uninstall a core one? - // Because that is not a good idea... - if ($row->iscore) { - JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::sprintf('WARNCORECOMPONENT', $row->name)."
      ".JText::_('WARNCORECOMPONENT2')); - return false; - } - - // Get the admin and site paths for the component - $this->parent->setPath('extension_administrator', JPath::clean(JPATH_ADMINISTRATOR.DS.'components'.DS.$row->option)); - $this->parent->setPath('extension_site', JPath::clean(JPATH_SITE.DS.'components'.DS.$row->option)); - - /** - * --------------------------------------------------------------------------------------------- - * Manifest Document Setup Section - * --------------------------------------------------------------------------------------------- - */ - - // Find and load the XML install file for the component - $this->parent->setPath('source', $this->parent->getPath('extension_administrator')); - - // Get the package manifest objecct - $manifest =& $this->parent->getManifest(); - if (!is_a($manifest, 'JSimpleXML')) { - // Make sure we delete the folders if no manifest exists - JFolder::delete($this->parent->getPath('extension_administrator')); - JFolder::delete($this->parent->getPath('extension_site')); - - // Remove the menu - $this->_removeAdminMenus($row); - - // Raise a warning - JError::raiseWarning(100, JText::_('ERRORREMOVEMANUALLY')); - - // Return - return false; - } - - // Get the root node of the manifest document - $this->manifest =& $manifest->document; - - /** - * --------------------------------------------------------------------------------------------- - * Custom Uninstallation Script Section - * --------------------------------------------------------------------------------------------- - */ - - // Now lets load the uninstall file if there is one and execute the uninstall function if it exists. - $uninstallfileElement =& $this->manifest->getElementByPath('uninstallfile'); - if (is_a($uninstallfileElement, 'JSimpleXMLElement')) { - // Element exists, does the file exist? - if (is_file($this->parent->getPath('extension_administrator').DS.$uninstallfileElement->data())) { - ob_start(); - ob_implicit_flush(false); - require_once ($this->parent->getPath('extension_administrator').DS.$uninstallfileElement->data()); - if (function_exists('com_uninstall')) { - if (com_uninstall() === false) { - JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('Custom Uninstall script unsuccessful')); - $retval = false; - } - } - $msg = ob_get_contents(); - ob_end_clean(); - if ($msg != '') { - $this->parent->set('extension.message', $msg); - } - } - } - - /** - * --------------------------------------------------------------------------------------------- - * Database Processing Section - * --------------------------------------------------------------------------------------------- - */ - - /* - * Let's run the uninstall queries for the component - * If backward compatibility is required - run queries in xml file - * If Joomla 1.5 compatible, with discreet sql files - execute appropriate - * file for utf-8 support or non-utf support - */ - $result = $this->parent->parseQueries($this->manifest->getElementByPath('uninstall/queries')); - if ($result === false) { - // Install failed, rollback changes - JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('SQL Error')." ".$db->stderr(true)); - $retval = false; - } elseif ($result === 0) { - // no backward compatibility queries found - try for Joomla 1.5 type queries - // second argument is the utf compatible version attribute - $utfresult = $this->parent->parseSQLFiles($this->manifest->getElementByPath('uninstall/sql')); - if ($utfresult === false) { - // Install failed, rollback changes - JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('SQLERRORORFILE')." ".$db->stderr(true)); - $retval = false; - } - } - - $this->_removeAdminMenus($row); - - /** - * --------------------------------------------------------------------------------------------- - * Filesystem Processing Section - * --------------------------------------------------------------------------------------------- - */ - - // Let's remove language files and media in the JROOT/images/ folder that are - // associated with the component we are uninstalling - $this->parent->removeFiles($this->manifest->getElementByPath('media')); - $this->parent->removeFiles($this->manifest->getElementByPath('languages')); - $this->parent->removeFiles($this->manifest->getElementByPath('administration/languages'), 1); - - // Now we need to delete the installation directories. This is the final step in uninstalling the component. - if (trim($row->option)) { - // Delete the component site directory - if (is_dir($this->parent->getPath('extension_site'))) { - if (!JFolder::delete($this->parent->getPath('extension_site'))) { - JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('Unable to remove the component site directory')); - $retval = false; - } - } - - // Delete the component admin directory - if (is_dir($this->parent->getPath('extension_administrator'))) { - if (!JFolder::delete($this->parent->getPath('extension_administrator'))) { - JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('Unable to remove the component admin directory')); - $retval = false; - } - } - return $retval; - } else { - // No component option defined... cannot delete what we don't know about - JError::raiseWarning(100, 'Component Uninstall: Option field empty, cannot remove files'); - return false; - } - } - - /** - * Method to build menu database entries for a component - * - * @access private - * @return boolean True if successful - * @since 1.5 - */ - function _buildAdminMenus() - { - // Get database connector object - $db =& $this->parent->getDBO(); - - // Initialize variables - $option = strtolower("com_".str_replace(" ", "", $this->get('name'))); - - // If a component exists with this option in the table than we don't need to add menus - $query = 'SELECT id' . - ' FROM #__components' . - ' WHERE `option` = '.$db->Quote($option); - - $db->setQuery($query); - $exists = $db->loadResult(); - - // Check if menu items exist - if ($exists) { - - // Don't do anything if overwrite has not been enabled - if ( ! $this->parent->getOverwrite() ) { - return true; - } - - // Remove existing menu items if overwrite has been enabled - if ( $option ) { - - $sql = 'DELETE FROM #__components WHERE `option` = '.$db->Quote($option); - - $db->setQuery($sql); - if (!$db->query()) { - JError::raiseWarning(100, JText::_('Component').' '.JText::_('Install').': '.$db->stderr(true)); - } - } - } - - // Ok, now its time to handle the menus. Start with the component root menu, then handle submenus. - $menuElement = & $this->adminElement->getElementByPath('menu'); - if (is_a($menuElement, 'JSimpleXMLElement')) { - - $db_name = $menuElement->data(); - $db_link = "option=".$option; - $db_menuid = 0; - $db_parent = 0; - $db_admin_menu_link = "option=".$option; - $db_admin_menu_alt = $menuElement->data(); - $db_option = $option; - $db_ordering = 0; - $db_admin_menu_img = ($menuElement->attributes('img')) ? $menuElement->attributes('img') : 'js/ThemeOffice/component.png'; - $db_iscore = 0; - $db_params = $this->parent->getParams(); - $db_enabled = 1; - - $query = 'INSERT INTO #__components' . - ' VALUES( "", '.$db->Quote($db_name).', '.$db->Quote($db_link).', '.(int) $db_menuid.',' . - ' '.(int) $db_parent.', '.$db->Quote($db_admin_menu_link).', '.$db->Quote($db_admin_menu_alt).',' . - ' '.$db->Quote($db_option).', '.(int) $db_ordering.', '.$db->Quote($db_admin_menu_img).',' . - ' '.(int) $db_iscore.', '.$db->Quote($db_params).', '.(int) $db_enabled.' )'; - $db->setQuery($query); - if (!$db->query()) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.$db->stderr(true)); - return false; - } - $menuid = $db->insertid(); - - /* - * Since we have created a menu item, we add it to the installation step stack - * so that if we have to rollback the changes we can undo it. - */ - $this->parent->pushStep(array ('type' => 'menu', 'id' => $menuid)); - } else { - - /* - * No menu element was specified so lets first see if we have an admin menu entry for this component - * if we do.. then we obviously don't want to create one -- we'll just attach sub menus to that one. - */ - $query = 'SELECT id' . - ' FROM #__components' . - ' WHERE `option` = '.$db->Quote($option) . - ' AND parent = 0'; - $db->setQuery($query); - $menuid = $db->loadResult(); - - if (!$menuid) { - // No menu entry, lets just enter a component entry to the table. - $db_name = $this->get('name'); - $db_link = ""; - $db_menuid = 0; - $db_parent = 0; - $db_admin_menu_link = ""; - $db_admin_menu_alt = $this->get('name'); - $db_option = $option; - $db_ordering = 0; - $db_admin_menu_img = ""; - $db_iscore = 0; - $db_params = $this->parent->getParams(); - $db_enabled = 1; - - $query = 'INSERT INTO #__components' . - ' VALUES( "", '.$db->Quote($db_name).', '.$db->Quote($db_link).', '.(int) $db_menuid.',' . - ' '.(int) $db_parent.', '.$db->Quote($db_admin_menu_link).', '.$db->Quote($db_admin_menu_alt).',' . - ' '.$db->Quote($db_option).', '.(int) $db_ordering.', '.$db->Quote($db_admin_menu_img).',' . - ' '.(int) $db_iscore.', '.$db->Quote($db_params).', '.(int) $db_enabled.' )'; - $db->setQuery($query); - if (!$db->query()) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.$db->stderr(true)); - return false; - } - $menuid = $db->insertid(); - - /* - * Since we have created a menu item, we add it to the installation step stack - * so that if we have to rollback the changes we can undo it. - */ - $this->parent->pushStep(array ('type' => 'menu', 'id' => $menuid)); - } - } - - /* - * Process SubMenus - */ - - // Initialize submenu ordering value - $ordering = 0; - $submenu = $this->adminElement->getElementByPath('submenu'); - if (!is_a($submenu, 'JSimpleXMLElement') || !count($submenu->children())) { - return true; - } - foreach ($submenu->children() as $child) - { - if (is_a($child, 'JSimpleXMLElement') && $child->name() == 'menu') { - - $com =& JTable::getInstance('component'); - $com->name = $child->data(); - $com->link = ''; - $com->menuid = 0; - $com->parent = $menuid; - $com->iscore = 0; - $com->admin_menu_alt = $child->data(); - $com->option = $option; - $com->ordering = $ordering ++; - - // Set the sub menu link - if ($child->attributes("link")) { - $com->admin_menu_link = str_replace('&', '&', $child->attributes("link")); - } else { - $request = array(); - if ($child->attributes('act')) { - $request[] = 'act='.$child->attributes('act'); - } - if ($child->attributes('task')) { - $request[] = 'task='.$child->attributes('task'); - } - if ($child->attributes('controller')) { - $request[] = 'controller='.$child->attributes('controller'); - } - if ($child->attributes('view')) { - $request[] = 'view='.$child->attributes('view'); - } - if ($child->attributes('layout')) { - $request[] = 'layout='.$child->attributes('layout'); - } - if ($child->attributes('sub')) { - $request[] = 'sub='.$child->attributes('sub'); - } - $qstring = (count($request)) ? '&'.implode('&',$request) : ''; - $com->admin_menu_link = "option=".$option.$qstring; - } - - // Set the sub menu image - if ($child->attributes("img")) { - $com->admin_menu_img = $child->attributes("img"); - } else { - $com->admin_menu_img = "js/ThemeOffice/component.png"; - } - - // Store the submenu - if (!$com->store()) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('SQL Error')." ".$db->stderr(true)); - return false; - } - - /* - * Since we have created a menu item, we add it to the installation step stack - * so that if we have to rollback the changes we can undo it. - */ - $this->parent->pushStep(array ('type' => 'menu', 'id' => $com->id)); - } - } - } - - /** - * Method to remove admin menu references to a component - * - * @access private - * @param object $component Component table object - * @return boolean True if successful - * @since 1.5 - */ - function _removeAdminMenus(&$row) - { - // Get database connector object - $db =& $this->parent->getDBO(); - $retval = true; - - // Delete the submenu items - $sql = 'DELETE ' . - ' FROM #__components ' . - 'WHERE parent = '.(int)$row->id; - - $db->setQuery($sql); - if (!$db->query()) { - JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.$db->stderr(true)); - $retval = false; - } - - // Next, we will delete the component object - if (!$row->delete($row->id)) { - JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('Unable to delete the component from the database')); - $retval = false; - } - return $retval; - } - - /** - * Custom rollback method - * - Roll back the component menu item - * - * @access public - * @param array $arg Installation step to rollback - * @return boolean True on success - * @since 1.5 - */ - function _rollback_menu($arg) - { - // Get database connector object - $db =& $this->parent->getDBO; - - // Remove the entry from the #__components table - $query = 'DELETE ' . - ' FROM `#__components` ' . - ' WHERE id='.(int)$arg['id']; - $db->setQuery($query); - return ($db->query() !== false); - } -} \ No newline at end of file + return false; + } + + // If the component directory does not exist, lets create it + $created = false; + if (!file_exists($this->parent->getPath('extension_site'))) { + if (!$created = JFolder::create($this->parent->getPath('extension_site'))) { + JError::raiseWarning(1, JText::_('Component').' '.JText::_('Install').': '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_site').'"'); + return false; + } + } + + /* + * Since we created the component directory and will want to remove it if we have to roll back + * the installation, lets add it to the installation step stack + */ + if ($created) { + $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_site'))); + } + + // If the component admin directory does not exist, lets create it + $created = false; + if (!file_exists($this->parent->getPath('extension_administrator'))) { + if (!$created = JFolder::create($this->parent->getPath('extension_administrator'))) { + JError::raiseWarning(1, JText::_('Component').' '.JText::_('Install').': '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_administrator').'"'); + // Install failed, rollback any changes + $this->parent->abort(); + return false; + } + } + + /* + * Since we created the component admin directory and we will want to remove it if we have to roll + * back the installation, lets add it to the installation step stack + */ + if ($created) { + $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_administrator'))); + } + + // Find files to copy + foreach ($this->manifest->children() as $child) + { + if ($child INSTANCEOF JSimpleXMLElement && $child->name() == 'files') { + if ($this->parent->parseFiles($child) === false) { + // Install failed, rollback any changes + $this->parent->abort(); + return false; + } + } + } + + foreach ($this->adminElement->children() as $child) + { + if ($child INSTANCEOF JSimpleXMLElement && $child->name() == 'files') { + if ($this->parent->parseFiles($child, 1) === false) { + // Install failed, rollback any changes + $this->parent->abort(); + return false; + } + } + } + + // Parse optional tags + $this->parent->parseMedia($this->manifest->getElementByPath('media')); + $this->parent->parseLanguages($this->manifest->getElementByPath('languages')); + $this->parent->parseLanguages($this->manifest->getElementByPath('administration/languages'), 1); + + // Parse deprecated tags + $this->parent->parseFiles($this->manifest->getElementByPath('images')); + $this->parent->parseFiles($this->manifest->getElementByPath('administration/images'), 1); + + // If there is an install file, lets copy it. + $installScriptElement =& $this->manifest->getElementByPath('installfile'); + if ($installScriptElement INSTANCEOF JSimpleXMLElement) { + // Make sure it hasn't already been copied (this would be an error in the xml install file) + if (!file_exists($this->parent->getPath('extension_administrator').DS.$installScriptElement->data())) + { + $path['src'] = $this->parent->getPath('source').DS.$installScriptElement->data(); + $path['dest'] = $this->parent->getPath('extension_administrator').DS.$installScriptElement->data(); + if (!$this->parent->copyFiles(array ($path))) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Could not copy PHP install file.')); + return false; + } + } + $this->set('install.script', $installScriptElement->data()); + } + + // If there is an uninstall file, lets copy it. + $uninstallScriptElement =& $this->manifest->getElementByPath('uninstallfile'); + if ($uninstallScriptElement INSTANCEOF JSimpleXMLElement) { + // Make sure it hasn't already been copied (this would be an error in the xml install file) + if (!file_exists($this->parent->getPath('extension_administrator').DS.$uninstallScriptElement->data())) + { + $path['src'] = $this->parent->getPath('source').DS.$uninstallScriptElement->data(); + $path['dest'] = $this->parent->getPath('extension_administrator').DS.$uninstallScriptElement->data(); + if (!$this->parent->copyFiles(array ($path))) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Could not copy PHP uninstall file.')); + return false; + } + } + } + + /** + * --------------------------------------------------------------------------------------------- + * Database Processing Section + * --------------------------------------------------------------------------------------------- + */ + + /* + * Let's run the install queries for the component + * If backward compatibility is required - run queries in xml file + * If Joomla 1.5 compatible, with discreet sql files - execute appropriate + * file for utf-8 support or non-utf-8 support + */ + $result = $this->parent->parseQueries($this->manifest->getElementByPath('install/queries')); + if ($result === false) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('SQL Error')." ".$db->stderr(true)); + return false; + } elseif ($result === 0) { + // no backward compatibility queries found - try for Joomla 1.5 type queries + // second argument is the utf compatible version attribute + $utfresult = $this->parent->parseSQLFiles($this->manifest->getElementByPath('install/sql')); + if ($utfresult === false) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('SQLERRORORFILE')." ".$db->stderr(true)); + return false; + } + } + + // Time to build the admin menus + $this->_buildAdminMenus(); + + /** + * --------------------------------------------------------------------------------------------- + * Custom Installation Script Section + * --------------------------------------------------------------------------------------------- + */ + + /* + * If we have an install script, lets include it, execute the custom + * install method, and append the return value from the custom install + * method to the installation message. + */ + if ($this->get('install.script')) { + if (is_file($this->parent->getPath('extension_administrator').DS.$this->get('install.script'))) { + ob_start(); + ob_implicit_flush(false); + require_once $this->parent->getPath('extension_administrator').DS.$this->get('install.script'); + if (function_exists('com_install')) { + if (com_install() === false) { + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Custom install routine failure')); + return false; + } + } + $msg = ob_get_contents(); + ob_end_clean(); + if ($msg != '') { + $this->parent->set('extension.message', $msg); + } + } + } + + /** + * --------------------------------------------------------------------------------------------- + * Finalization and Cleanup Section + * --------------------------------------------------------------------------------------------- + */ + + // Lastly, we will copy the manifest file to its appropriate place. + if (!$this->parent->copyManifest()) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('Could not copy setup file')); + return false; + } + return true; + } + + /** + * Custom uninstall method for components + * + * @access public + * @param int $cid The id of the component to uninstall + * @param int $clientId The id of the client (unused) + * @return mixed Return value for uninstall method in component uninstall file + * @since 1.0 + */ + public function uninstall($id, $clientId) + { + // Initialize variables + $db =& $this->parent->getDBO(); + $row = null; + $retval = true; + + // First order of business will be to load the component object table from the database. + // This should give us the necessary information to proceed. + $row = & JTable::getInstance('component'); + if ( !$row->load((int) $id) ) { + JError::raiseWarning(100, JText::_('ERRORUNKOWNEXTENSION')); + return false; + } + + // Is the component we are trying to uninstall a core one? + // Because that is not a good idea... + if ($row->iscore) { + JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::sprintf('WARNCORECOMPONENT', $row->name)."
      ".JText::_('WARNCORECOMPONENT2')); + return false; + } + + // Get the admin and site paths for the component + $this->parent->setPath('extension_administrator', JPath::clean(JPATH_ADMINISTRATOR.DS.'components'.DS.$row->option)); + $this->parent->setPath('extension_site', JPath::clean(JPATH_SITE.DS.'components'.DS.$row->option)); + + /** + * --------------------------------------------------------------------------------------------- + * Manifest Document Setup Section + * --------------------------------------------------------------------------------------------- + */ + + // Find and load the XML install file for the component + $this->parent->setPath('source', $this->parent->getPath('extension_administrator')); + + // Get the package manifest objecct + $manifest =& $this->parent->getManifest(); + if (!$manifest INSTANCEOF JSimpleXML) { + // Make sure we delete the folders if no manifest exists + JFolder::delete($this->parent->getPath('extension_administrator')); + JFolder::delete($this->parent->getPath('extension_site')); + + // Remove the menu + $this->_removeAdminMenus($row); + + // Raise a warning + JError::raiseWarning(100, JText::_('ERRORREMOVEMANUALLY')); + + // Return + return false; + } + + // Get the root node of the manifest document + $this->manifest =& $manifest->document; + + /** + * --------------------------------------------------------------------------------------------- + * Custom Uninstallation Script Section + * --------------------------------------------------------------------------------------------- + */ + + // Now lets load the uninstall file if there is one and execute the uninstall function if it exists. + $uninstallfileElement =& $this->manifest->getElementByPath('uninstallfile'); + if ($uninstallfileElement INSTANCEOF JSimpleXMLElement) { + // Element exists, does the file exist? + if (is_file($this->parent->getPath('extension_administrator').DS.$uninstallfileElement->data())) { + ob_start(); + ob_implicit_flush(false); + require_once $this->parent->getPath('extension_administrator').DS.$uninstallfileElement->data(); + if (function_exists('com_uninstall')) { + if (com_uninstall() === false) { + JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('Custom Uninstall script unsuccessful')); + $retval = false; + } + } + $msg = ob_get_contents(); + ob_end_clean(); + if ($msg != '') { + $this->parent->set('extension.message', $msg); + } + } + } + + /** + * --------------------------------------------------------------------------------------------- + * Database Processing Section + * --------------------------------------------------------------------------------------------- + */ + + /* + * Let's run the uninstall queries for the component + * If backward compatibility is required - run queries in xml file + * If Joomla 1.5 compatible, with discreet sql files - execute appropriate + * file for utf-8 support or non-utf support + */ + $result = $this->parent->parseQueries($this->manifest->getElementByPath('uninstall/queries')); + if ($result === false) { + // Install failed, rollback changes + JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('SQL Error')." ".$db->stderr(true)); + $retval = false; + } elseif ($result === 0) { + // no backward compatibility queries found - try for Joomla 1.5 type queries + // second argument is the utf compatible version attribute + $utfresult = $this->parent->parseSQLFiles($this->manifest->getElementByPath('uninstall/sql')); + if ($utfresult === false) { + // Install failed, rollback changes + JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('SQLERRORORFILE')." ".$db->stderr(true)); + $retval = false; + } + } + + $this->_removeAdminMenus($row); + + /** + * --------------------------------------------------------------------------------------------- + * Filesystem Processing Section + * --------------------------------------------------------------------------------------------- + */ + + // Let's remove language files and media in the JROOT/images/ folder that are + // associated with the component we are uninstalling + $this->parent->removeFiles($this->manifest->getElementByPath('media')); + $this->parent->removeFiles($this->manifest->getElementByPath('languages')); + $this->parent->removeFiles($this->manifest->getElementByPath('administration/languages'), 1); + + // Now we need to delete the installation directories. This is the final step in uninstalling the component. + if (trim($row->option)) { + // Delete the component site directory + if (is_dir($this->parent->getPath('extension_site'))) { + if (!JFolder::delete($this->parent->getPath('extension_site'))) { + JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('Unable to remove the component site directory')); + $retval = false; + } + } + + // Delete the component admin directory + if (is_dir($this->parent->getPath('extension_administrator'))) { + if (!JFolder::delete($this->parent->getPath('extension_administrator'))) { + JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('Unable to remove the component admin directory')); + $retval = false; + } + } + return $retval; + } else { + // No component option defined... cannot delete what we don't know about + JError::raiseWarning(100, 'Component Uninstall: Option field empty, cannot remove files'); + return false; + } + } + + /** + * Method to build menu database entries for a component + * + * @access private + * @return boolean True if successful + * @since 1.5 + */ + protected function _buildAdminMenus() + { + // Get database connector object + $db =& $this->parent->getDBO(); + + // Initialize variables + $option = strtolower("com_".str_replace(" ", "", $this->get('name'))); + + // If a component exists with this option in the table than we don't need to add menus + // Grab the params for later + $query = 'SELECT id, params, enabled' . + ' FROM #__components' . + ' WHERE `option` = '.$db->Quote($option) . + ' ORDER BY `parent` ASC'; + + $db->setQuery($query); + try { + $componentrow = $db->loadAssoc(); + } catch(JException $e) { + $componentrow = null; + } + $exists = 0; + $oldparams = ''; + + // Check if menu items exist + if ($componentrow) { + // set the value of exists to be the value of the old id + $exists = $componentrow['id']; + // and set the old params + $oldparams = $componentrow['params']; + // and old enabled + $oldenabled = $componentrow['enabled']; + + // Don't do anything if overwrite has not been enabled + if ( ! $this->parent->getOverwrite() ) { + return true; + } + + // Remove existing menu items if overwrite has been enabled + if ( $option ) { + + $sql = 'DELETE FROM #__components WHERE `option` = '.$db->Quote($option); + + $db->setQuery($sql); + try { + $db->query(); + } catch(JException $e) { + JError::raiseWarning(100, JText::_('Component').' '.JText::_('Install').': '.$db->stderr(true)); + } + } + } + + // Ok, now its time to handle the menus. Start with the component root menu, then handle submenus. + $menuElement = & $this->adminElement->getElementByPath('menu'); + if ($menuElement INSTANCEOF JSimpleXMLElement) { + + $db_name = $menuElement->data(); + $db_link = "option=".$option; + $db_menuid = 0; + $db_parent = 0; + $db_admin_menu_link = "option=".$option; + $db_admin_menu_alt = $menuElement->data(); + $db_option = $option; + $db_ordering = 0; + $db_admin_menu_img = ($menuElement->attributes('img')) ? $menuElement->attributes('img') : 'js/ThemeOffice/component.png'; + $db_iscore = 0; + // use the old params if a previous entry exists + $db_params = $exists ? $oldparams : $this->parent->getParams(); + // use the old enabled field if a previous entry exists + $db_enabled = $exists ? $oldenabled : 1; + + // This works because exists will be zero (autoincr) + // or the old component id + $query = 'INSERT INTO #__components' . + ' VALUES( '.$exists .', '.$db->Quote($db_name).', '.$db->Quote($db_link).', '.(int) $db_menuid.',' . + ' '.(int) $db_parent.', '.$db->Quote($db_admin_menu_link).', '.$db->Quote($db_admin_menu_alt).',' . + ' '.$db->Quote($db_option).', '.(int) $db_ordering.', '.$db->Quote($db_admin_menu_img).',' . + ' '.(int) $db_iscore.', '.$db->Quote($db_params).', '.(int) $db_enabled.' )'; + $db->setQuery($query); + try { + $db->query(); + } catch(JException $e) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.$db->stderr(true)); + return false; + } + // save ourselves a call if we don't need it + $menuid = $exists ? $exists : $db->insertid(); // if there was an existing value, reuse + + /* + * Since we have created a menu item, we add it to the installation step stack + * so that if we have to rollback the changes we can undo it. + */ + $this->parent->pushStep(array ('type' => 'menu', 'id' => $menuid)); + } else { + + /* + * No menu element was specified so lets first see if we have an admin menu entry for this component + * if we do.. then we obviously don't want to create one -- we'll just attach sub menus to that one. + */ + $query = 'SELECT id' . + ' FROM #__components' . + ' WHERE `option` = '.$db->Quote($option) . + ' AND parent = 0'; + $db->setQuery($query); + try { + $menuid = $db->loadResult(); + } catch(JException $e) { + $menuid = null; + } + + if (!$menuid) { + // No menu entry, lets just enter a component entry to the table. + $db_name = $this->get('name'); + $db_link = ""; + $db_menuid = 0; + $db_parent = 0; + $db_admin_menu_link = ""; + $db_admin_menu_alt = $this->get('name'); + $db_option = $option; + $db_ordering = 0; + $db_admin_menu_img = ""; + $db_iscore = 0; + $db_params = $this->parent->getParams(); + $db_enabled = 1; + + $query = 'INSERT INTO #__components' . + ' VALUES( "", '.$db->Quote($db_name).', '.$db->Quote($db_link).', '.(int) $db_menuid.',' . + ' '.(int) $db_parent.', '.$db->Quote($db_admin_menu_link).', '.$db->Quote($db_admin_menu_alt).',' . + ' '.$db->Quote($db_option).', '.(int) $db_ordering.', '.$db->Quote($db_admin_menu_img).',' . + ' '.(int) $db_iscore.', '.$db->Quote($db_params).', '.(int) $db_enabled.' )'; + $db->setQuery($query); + try { + $db->query(); + } catch (JException $e) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.$db->stderr(true)); + return false; + } + $menuid = $db->insertid(); + + /* + * Since we have created a menu item, we add it to the installation step stack + * so that if we have to rollback the changes we can undo it. + */ + $this->parent->pushStep(array ('type' => 'menu', 'id' => $menuid)); + } + } + + /* + * Process SubMenus + */ + + // Initialize submenu ordering value + $ordering = 0; + $submenu = $this->adminElement->getElementByPath('submenu'); + if (!($submenu INSTANCEOF JSimpleXMLElement) || !count($submenu->children())) { + return true; + } + foreach ($submenu->children() as $child) + { + if ($child INSTANCEOF JSimpleXMLElement && $child->name() == 'menu') { + + $com =& JTable::getInstance('component'); + $com->name = $child->data(); + $com->link = ''; + $com->menuid = 0; + $com->parent = $menuid; + $com->iscore = 0; + $com->admin_menu_alt = $child->data(); + $com->option = $option; + $com->ordering = $ordering ++; + + // Set the sub menu link + if ($child->attributes("link")) { + $com->admin_menu_link = str_replace('&', '&', $child->attributes("link")); + } else { + $request = array(); + if ($child->attributes('act')) { + $request[] = 'act='.$child->attributes('act'); + } + if ($child->attributes('task')) { + $request[] = 'task='.$child->attributes('task'); + } + if ($child->attributes('controller')) { + $request[] = 'controller='.$child->attributes('controller'); + } + if ($child->attributes('view')) { + $request[] = 'view='.$child->attributes('view'); + } + if ($child->attributes('layout')) { + $request[] = 'layout='.$child->attributes('layout'); + } + if ($child->attributes('sub')) { + $request[] = 'sub='.$child->attributes('sub'); + } + $qstring = (count($request)) ? '&'.implode('&',$request) : ''; + $com->admin_menu_link = "option=".$option.$qstring; + } + + // Set the sub menu image + if ($child->attributes("img")) { + $com->admin_menu_img = $child->attributes("img"); + } else { + $com->admin_menu_img = "js/ThemeOffice/component.png"; + } + + // Store the submenu + if (!$com->store()) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Component').' '.JText::_('Install').': '.JText::_('SQL Error')." ".$db->stderr(true)); + return false; + } + + /* + * Since we have created a menu item, we add it to the installation step stack + * so that if we have to rollback the changes we can undo it. + */ + $this->parent->pushStep(array ('type' => 'menu', 'id' => $com->id)); + } + } + } + + /** + * Method to remove admin menu references to a component + * + * @access private + * @param object $component Component table object + * @return boolean True if successful + * @since 1.5 + */ + protected function _removeAdminMenus(&$row) + { + // Get database connector object + $db =& $this->parent->getDBO(); + $retval = true; + + // Delete the submenu items + $sql = 'DELETE ' . + ' FROM #__components ' . + 'WHERE parent = '.(int)$row->id; + + $db->setQuery($sql); + try { + $db->query(); + } catch(JException $e) { + JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.$db->stderr(true)); + $retval = false; + } + + // Next, we will delete the component object + if (!$row->delete($row->id)) { + JError::raiseWarning(100, JText::_('Component').' '.JText::_('Uninstall').': '.JText::_('Unable to delete the component from the database')); + $retval = false; + } + return $retval; + } + + /** + * Custom rollback method + * - Roll back the component menu item + * + * @access public + * @param array $arg Installation step to rollback + * @return boolean True on success + * @since 1.5 + */ + protected function _rollback_menu($arg) + { + // Get database connector object + $db =& $this->parent->getDBO; + + // Remove the entry from the #__components table + $query = 'DELETE ' . + ' FROM `#__components` ' . + ' WHERE id='.(int)$arg['id']; + $db->setQuery($query); + try { + return $db->query(); + } catch(JException $e) { + return false; + } + } +} diff --git a/libraries/joomla/installer/adapters/index.html b/libraries/joomla/installer/adapters/index.html index fa6d84e8055f5..42682b4746225 100755 --- a/libraries/joomla/installer/adapters/index.html +++ b/libraries/joomla/installer/adapters/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/installer/adapters/language.php b/libraries/joomla/installer/adapters/language.php index b5eab17cc32a1..d5b3962d51a9d 100644 --- a/libraries/joomla/installer/adapters/language.php +++ b/libraries/joomla/installer/adapters/language.php @@ -1,191 +1,222 @@ - - * @package Joomla.Framework - * @subpackage Installer - * @since 1.5 - */ -class JInstallerLanguage extends JObject -{ - /** - * Core language pack flag - * @access private - * @var boolean - */ - var $_core = false; - - /** - * Constructor - * - * @access protected - * @param object $parent Parent object [JInstaller instance] - * @return void - * @since 1.5 - */ - function __construct(&$parent) - { - $this->parent =& $parent; - } - - /** - * Custom install method - * - * @access public - * @return boolean True on success - * @since 1.5 - */ - function install() - { - // Get database connector object - $db =& $this->parent->getDBO(); - $manifest =& $this->parent->getManifest(); - $this->manifest =& $manifest->document; - $root =& $manifest->document; - - // Get the client application target - if ($cname = $root->attributes('client')) { - // Attempt to map the client to a base path - jimport('joomla.application.helper'); - $client =& JApplicationHelper::getClientInfo($cname, true); - if ($client === false) { - $this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('Unknown client type').' ['.$cname.']'); - return false; - } - $basePath = $client->path; - $clientId = $client->id; - } else { - // No client attribute was found so we assume the site as the client - $cname = 'site'; - $basePath = JPATH_SITE; - $clientId = 0; - } - - // Get the language name - // Set the extensions name - $name =& $this->manifest->getElementByPath('name'); - $name = JFilterInput::clean($name->data(), 'cmd'); - $this->set('name', $name); - - // Get the Language tag [ISO tag, eg. en-GB] - $tag =& $root->getElementByPath('tag'); - - // Check if we found the tag - if we didn't, we may be trying to install from an older language package - if ( ! $tag ) - { - $this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('NO LANGUAGE TAG?')); - return false; - } - - $this->set('tag', $tag->data()); - $folder = $tag->data(); - - // Set the language installation path - $this->parent->setPath('extension_site', $basePath.DS."language".DS.$this->get('tag')); - - // Do we have a meta file in the file list? In other words... is this a core language pack? - $element =& $root->getElementByPath('files'); - if (is_a($element, 'JSimpleXMLElement') && count($element->children())) { - $files = $element->children(); - foreach ($files as $file) { - if ($file->attributes('file') == 'meta') { - $this->_core = true; - break; - } - } - } - - // Either we are installing a core pack or a core pack must exist for the language we are installing. - if (!$this->_core) { - if (!JFile::exists($this->parent->getPath('extension_site').DS.$this->get('tag').'.xml')) { - $this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('No core pack exists for the language').' :'.$this->get('tag')); - return false; - } - } - - // If the language directory does not exist, lets create it - $created = false; - if (!file_exists($this->parent->getPath('extension_site'))) { - if (!$created = JFolder::create($this->parent->getPath('extension_site'))) { - $this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('Failed to create directory').' "'.$this->parent->getPath('extension_site').'"'); - return false; - } - } - - /* - * If we created the language directory and will want to remove it if we - * have to roll back the installation, lets add it to the installation - * step stack - */ - if ($created) { - $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_site'))); - } - - // Copy all the necessary files - if ($this->parent->parseFiles($element) === false) { - // Install failed, rollback changes - $this->parent->abort(); - return false; - } - - // Copy all the necessary font files to the common pdf_fonts directory - $this->parent->setPath('extension_site', $basePath.DS."language".DS.'pdf_fonts'); - $overwrite = $this->parent->setOverwrite(true); - if ($this->parent->parseFiles($root->getElementByPath('fonts')) === false) { - // Install failed, rollback changes - $this->parent->abort(); - return false; - } - $this->parent->setOverwrite($overwrite); - - // Get the language description - $description = & $root->getElementByPath('description'); - if (is_a($description, 'JSimpleXMLElement')) { - $this->parent->set('message', $description->data()); - } else { - $this->parent->set('message', '' ); - } - return true; - } - - /** - * Custom uninstall method - * - * @access public - * @param string $tag The tag of the language to uninstall - * @param int $clientId The id of the client (unused) - * @return mixed Return value for uninstall method in component uninstall file - * @since 1.5 - */ - function uninstall($tag, $clientId) - { - $path = trim($tag); - if (!JFolder::exists($path)) { - JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Language path is empty, cannot uninstall files')); - return false; - } - - if (!JFolder::delete($path)) { - JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Unable to remove language directory')); - return false; - } - return true; - } -} \ No newline at end of file +parent =& $parent; + } + + /** + * Custom install method + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + public function install() + { + $manifest =& $this->parent->getManifest(); + $this->manifest =& $manifest->document; + $root =& $manifest->document; + + // Get the client application target + if ($root->attributes('client') == 'both') + { + $siteElement =& $root->getElementByPath('site'); + $element =& $siteElement->getElementByPath('files'); + if (!$this->_install('site', JPATH_SITE, 0, $element)) { + return false; + } + + $adminElement =& $root->getElementByPath('administration'); + $element =& $adminElement->getElementByPath('files'); + if (!$this->_install('administrator', JPATH_ADMINISTRATOR, 1, $element)) { + return false; + } + + return true; + } + elseif ($cname = $root->attributes('client')) + { + // Attempt to map the client to a base path + jimport('joomla.application.helper'); + $client =& JApplicationHelper::getClientInfo($cname, true); + if ($client === null) { + $this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('Unknown client type').' ['.$cname.']'); + return false; + } + $basePath = $client->path; + $clientId = $client->id; + $element =& $root->getElementByPath('files'); + + return $this->_install($cname, $basePath, $clientId, $element); + } + else + { + // No client attribute was found so we assume the site as the client + $cname = 'site'; + $basePath = JPATH_SITE; + $clientId = 0; + $element =& $root->getElementByPath('files'); + + return $this->_install($cname, $basePath, $clientId, $element); + } + } + + /** + * + */ + protected function _install($cname, $basePath, $clientId, &$element) + { + $manifest =& $this->parent->getManifest(); + $this->manifest =& $manifest->document; + $root =& $manifest->document; + + // Get the language name + // Set the extensions name + $name =& $this->manifest->getElementByPath('name'); + $name = JFilterInput::clean($name->data(), 'cmd'); + $this->set('name', $name); + + // Get the Language tag [ISO tag, eg. en-GB] + $tag =& $root->getElementByPath('tag'); + + // Check if we found the tag - if we didn't, we may be trying to install from an older language package + if ( ! $tag ) + { + $this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('NO LANGUAGE TAG?')); + return false; + } + + $this->set('tag', $tag->data()); + $folder = $tag->data(); + + // Set the language installation path + $this->parent->setPath('extension_site', $basePath.DS."language".DS.$this->get('tag')); + + // Do we have a meta file in the file list? In other words... is this a core language pack? + if ($element INSTANCEOF JSimpleXMLElement && count($element->children())) { + $files = $element->children(); + foreach ($files as $file) { + if ($file->attributes('file') == 'meta') { + $this->_core = true; + break; + } + } + } + + // Either we are installing a core pack or a core pack must exist for the language we are installing. + if (!$this->_core) { + if (!JFile::exists($this->parent->getPath('extension_site').DS.$this->get('tag').'.xml')) { + $this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('No core pack exists for the language').' :'.$this->get('tag')); + return false; + } + } + + // If the language directory does not exist, lets create it + $created = false; + if (!file_exists($this->parent->getPath('extension_site'))) { + if (!$created = JFolder::create($this->parent->getPath('extension_site'))) { + $this->parent->abort(JText::_('Language').' '.JText::_('Install').': '.JText::_('Failed to create directory').' "'.$this->parent->getPath('extension_site').'"'); + return false; + } + } + + /* + * If we created the language directory and will want to remove it if we + * have to roll back the installation, lets add it to the installation + * step stack + */ + if ($created) { + $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_site'))); + } + + // Copy all the necessary files + if ($this->parent->parseFiles($element) === false) { + // Install failed, rollback changes + $this->parent->abort(); + return false; + } + + // Copy all the necessary font files to the common pdf_fonts directory + $this->parent->setPath('extension_site', $basePath.DS."language".DS.'pdf_fonts'); + $overwrite = $this->parent->setOverwrite(true); + if ($this->parent->parseFiles($root->getElementByPath('fonts')) === false) { + // Install failed, rollback changes + $this->parent->abort(); + return false; + } + $this->parent->setOverwrite($overwrite); + + // Get the language description + $description = & $root->getElementByPath('description'); + if ($description INSTANCEOF JSimpleXMLElement) { + $this->parent->set('message', $description->data()); + } else { + $this->parent->set('message', '' ); + } + return true; + } + + /** + * Custom uninstall method + * + * @access public + * @param string $tag The tag of the language to uninstall + * @param int $clientId The id of the client (unused) + * @return mixed Return value for uninstall method in component uninstall file + * @since 1.5 + */ + public function uninstall($tag, $clientId) + { + $path = trim($tag); + if (!JFolder::exists($path)) { + JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Language path is empty, cannot uninstall files')); + return false; + } + + if (!JFolder::delete($path)) { + JError::raiseWarning(100, JText::_('Language').' '.JText::_('Uninstall').': '.JText::_('Unable to remove language directory')); + return false; + } + return true; + } +} diff --git a/libraries/joomla/installer/adapters/module.php b/libraries/joomla/installer/adapters/module.php index 0b6ec4069688c..576a710ccab1e 100644 --- a/libraries/joomla/installer/adapters/module.php +++ b/libraries/joomla/installer/adapters/module.php @@ -1,397 +1,412 @@ -parent =& $parent; - } - - /** - * Custom install method - * - * @access public - * @return boolean True on success - * @since 1.5 - */ - function install() - { - // Get a database connector object - $db =& $this->parent->getDBO(); - - // Get the extension manifest object - $manifest =& $this->parent->getManifest(); - $this->manifest =& $manifest->document; - - /** - * --------------------------------------------------------------------------------------------- - * Manifest Document Setup Section - * --------------------------------------------------------------------------------------------- - */ - - // Set the extensions name - $name =& $this->manifest->getElementByPath('name'); - $name = JFilterInput::clean($name->data(), 'string'); - $this->set('name', $name); - - // Get the component description - $description = & $this->manifest->getElementByPath('description'); - if (is_a($description, 'JSimpleXMLElement')) { - $this->parent->set('message', $description->data()); - } else { - $this->parent->set('message', '' ); - } - - /** - * --------------------------------------------------------------------------------------------- - * Target Application Section - * --------------------------------------------------------------------------------------------- - */ - - // Get the target application - if ($cname = $this->manifest->attributes('client')) { - // Attempt to map the client to a base path - jimport('joomla.application.helper'); - $client =& JApplicationHelper::getClientInfo($cname, true); - if ($client === false) { - $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('Unknown client type').' ['.$client->name.']'); - return false; - } - $basePath = $client->path; - $clientId = $client->id; - } else { - // No client attribute was found so we assume the site as the client - $cname = 'site'; - $basePath = JPATH_SITE; - $clientId = 0; - } - - // Set the installation path - $element =& $this->manifest->getElementByPath('files'); - if (is_a($element, 'JSimpleXMLElement') && count($element->children())) { - $files =& $element->children(); - foreach ($files as $file) { - if ($file->attributes('module')) { - $mname = $file->attributes('module'); - break; - } - } - } - if (!empty ($mname)) { - $this->parent->setPath('extension_root', $basePath.DS.'modules'.DS.$mname); - } else { - $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('No module file specified')); - return false; - } - - /** - * --------------------------------------------------------------------------------------------- - * Filesystem Processing Section - * --------------------------------------------------------------------------------------------- - */ - - /* - * If the module directory already exists, then we will assume that the - * module is already installed or another module is using that - * directory. - */ - if (file_exists($this->parent->getPath('extension_root'))&&!$this->parent->getOverwrite()) { - $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('Another module is already using directory').': "'.$this->parent->getPath('extension_root').'"'); - return false; - } - - // If the module directory does not exist, lets create it - $created = false; - if (!file_exists($this->parent->getPath('extension_root'))) { - if (!$created = JFolder::create($this->parent->getPath('extension_root'))) { - $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_root').'"'); - return false; - } - } - - /* - * Since we created the module directory and will want to remove it if - * we have to roll back the installation, lets add it to the - * installation step stack - */ - if ($created) { - $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_root'))); - } - - // Copy all necessary files - if ($this->parent->parseFiles($element, -1) === false) { - // Install failed, roll back changes - $this->parent->abort(); - return false; - } - - // Parse optional tags - $this->parent->parseMedia($this->manifest->getElementByPath('media'), $clientId); - $this->parent->parseLanguages($this->manifest->getElementByPath('languages'), $clientId); - - // Parse deprecated tags - $this->parent->parseFiles($this->manifest->getElementByPath('images'), -1); - - /** - * --------------------------------------------------------------------------------------------- - * Database Processing Section - * --------------------------------------------------------------------------------------------- - */ - - // Check to see if a module by the same name is already installed - // Shouldn't this be stopped by the above section? - // Commented out pending removal - // TODO: Remove this at a later point - // see http://groups.google.com/group/joomla-devel/browse_thread/thread/7ef4cd7f80c98e41 -/* $query = 'SELECT `id`' . - ' FROM `#__modules` ' . - ' WHERE module = '.$db->Quote($mname) . - ' AND client_id = '.(int)$clientId; - $db->setQuery($query); - if (!$db->Query()) { - // Install failed, roll back changes - $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.$db->stderr(true)); - return false; - } - $id = $db->loadResult(); - - // Was there a module already installed with the same name? - if ($id) { - - if ( ! $this->parent->getOverwrite()) - { - // Install failed, roll back changes - $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('Module').' "'.$mname.'" '.JText::_('already exists!')); - return false; - } - - - } else { -*/ - - $row = & JTable::getInstance('module'); - $row->title = $this->get('name'); - $row->ordering = $row->getNextOrder( "position='left'" ); - $row->position = 'left'; - $row->showtitle = 1; - $row->iscore = 0; - $row->access = $clientId == 1 ? 2 : 0; - $row->client_id = $clientId; - $row->module = $mname; - $row->params = $this->parent->getParams(); - - if (!$row->store()) { - // Install failed, roll back changes - $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.$db->stderr(true)); - return false; - } - - // Since we have created a module item, we add it to the installation step stack - // so that if we have to rollback the changes we can undo it. - $this->parent->pushStep(array ('type' => 'module', 'id' => $row->id)); - - // Clean up possible garbage first - $query = 'DELETE FROM #__modules_menu WHERE moduleid = '.(int) $row->id; - $db->setQuery( $query ); - if (!$db->query()) { - // Install failed, roll back changes - $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.$db->stderr(true)); - return false; - } - - // Time to create a menu entry for the module - $query = 'INSERT INTO `#__modules_menu` ' . - ' VALUES ('.(int) $row->id.', 0 )'; - $db->setQuery($query); - if (!$db->query()) { - // Install failed, roll back changes - $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.$db->stderr(true)); - return false; - } - - /* - * Since we have created a menu item, we add it to the installation step stack - * so that if we have to rollback the changes we can undo it. - */ - $this->parent->pushStep(array ('type' => 'menu', 'id' => $db->insertid())); -// } // TODO: Remove this re: database check removal - - /** - * --------------------------------------------------------------------------------------------- - * Finalization and Cleanup Section - * --------------------------------------------------------------------------------------------- - */ - - // Lastly, we will copy the manifest file to its appropriate place. - if (!$this->parent->copyManifest(-1)) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('Could not copy setup file')); - return false; - } - return true; - } - - /** - * Custom uninstall method - * - * @access public - * @param int $id The id of the module to uninstall - * @param int $clientId The id of the client (unused) - * @return boolean True on success - * @since 1.5 - */ - function uninstall( $id, $clientId ) - { - // Initialize variables - $row = null; - $retval = true; - $db =& $this->parent->getDBO(); - - // First order of business will be to load the module object table from the database. - // This should give us the necessary information to proceed. - $row = & JTable::getInstance('module'); - if ( !$row->load((int) $id) ) { - JError::raiseWarning(100, JText::_('ERRORUNKOWNEXTENSION')); - return false; - } - - // Is the module we are trying to uninstall a core one? - // Because that is not a good idea... - if ($row->iscore) { - JError::raiseWarning(100, JText::_('Module').' '.JText::_('Uninstall').': '.JText::sprintf('WARNCOREMODULE', $row->name)."
      ".JText::_('WARNCOREMODULE2')); - return false; - } - - // Get the extension root path - jimport('joomla.application.helper'); - $client =& JApplicationHelper::getClientInfo($row->client_id); - if ($client === false) { - $this->parent->abort(JText::_('Module').' '.JText::_('Uninstall').': '.JText::_('Unknown client type').' ['.$row->client_id.']'); - return false; - } - $this->parent->setPath('extension_root', $client->path.DS.'modules'.DS.$row->module); - - // Get the package manifest objecct - $this->parent->setPath('source', $this->parent->getPath('extension_root')); - $manifest =& $this->parent->getManifest(); - if (!is_a($manifest, 'JSimpleXML')) { - // Make sure we delete the folders - JFolder::delete($this->parent->getPath('extension_root')); - JError::raiseWarning(100, 'Module Uninstall: Package manifest file invalid or not found'); - return false; - } - - // Remove other files - $root =& $manifest->document; - $this->parent->removeFiles($root->getElementByPath('media')); - $this->parent->removeFiles($root->getElementByPath('languages')); - $this->parent->removeFiles($root->getElementByPath('administration/languages'), 1); - - // Lets delete all the module copies for the type we are uninstalling - $query = 'SELECT `id`' . - ' FROM `#__modules`' . - ' WHERE module = '.$db->Quote($row->module) . - ' AND client_id = '.(int)$row->client_id; - $db->setQuery($query); - $modules = $db->loadResultArray(); - - // Do we have any module copies? - if (count($modules)) { - JArrayHelper::toInteger($modules); - $modID = implode(',', $modules); - $query = 'DELETE' . - ' FROM #__modules_menu' . - ' WHERE moduleid IN ('.$modID.')'; - $db->setQuery($query); - if (!$db->query()) { - JError::raiseWarning(100, JText::_('Module').' '.JText::_('Uninstall').': '.$db->stderr(true)); - $retval = false; - } - } - - // Now we will no longer need the module object, so lets delete it and free up memory - $row->delete($row->id); - unset ($row); - - // Remove the installation folder - if (!JFolder::delete($this->parent->getPath('extension_root'))) { - // JFolder should raise an error - $retval = false; - } - return $retval; - } - - /** - * Custom rollback method - * - Roll back the menu item - * - * @access public - * @param array $arg Installation step to rollback - * @return boolean True on success - * @since 1.5 - */ - function _rollback_menu($arg) - { - // Get database connector object - $db =& $this->parent->getDBO(); - - // Remove the entry from the #__modules_menu table - $query = 'DELETE' . - ' FROM `#__modules_menu`' . - ' WHERE moduleid='.(int)$arg['id']; - $db->setQuery($query); - return ($db->query() !== false); - } - - /** - * Custom rollback method - * - Roll back the module item - * - * @access public - * @param array $arg Installation step to rollback - * @return boolean True on success - * @since 1.5 - */ - function _rollback_module($arg) - { - // Get database connector object - $db =& $this->parent->getDBO(); - - // Remove the entry from the #__modules table - $query = 'DELETE' . - ' FROM `#__modules`' . - ' WHERE id='.(int)$arg['id']; - $db->setQuery($query); - return ($db->query() !== false); - } -} +parent =& $parent; + } + + /** + * Custom install method + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + public function install() + { + // Get a database connector object + $db =& $this->parent->getDBO(); + + // Get the extension manifest object + $manifest =& $this->parent->getManifest(); + $this->manifest =& $manifest->document; + + /** + * --------------------------------------------------------------------------------------------- + * Manifest Document Setup Section + * --------------------------------------------------------------------------------------------- + */ + + // Set the extensions name + $name =& $this->manifest->getElementByPath('name'); + $name = JFilterInput::clean($name->data(), 'string'); + $this->set('name', $name); + + // Get the component description + $description = & $this->manifest->getElementByPath('description'); + if ($description INSTANCEOF JSimpleXMLElement) { + $this->parent->set('message', $description->data()); + } else { + $this->parent->set('message', '' ); + } + + /** + * --------------------------------------------------------------------------------------------- + * Target Application Section + * --------------------------------------------------------------------------------------------- + */ + + // Get the target application + if ($cname = $this->manifest->attributes('client')) { + // Attempt to map the client to a base path + jimport('joomla.application.helper'); + $client =& JApplicationHelper::getClientInfo($cname, true); + if ($client === false) { + $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('Unknown client type').' ['.$client->name.']'); + return false; + } + $basePath = $client->path; + $clientId = $client->id; + } else { + // No client attribute was found so we assume the site as the client + $cname = 'site'; + $basePath = JPATH_SITE; + $clientId = 0; + } + + // Set the installation path + $element =& $this->manifest->getElementByPath('files'); + if ($element INSTANCEOF JSimpleXMLElement && count($element->children())) { + $files =& $element->children(); + foreach ($files as $file) { + if ($file->attributes('module')) { + $mname = $file->attributes('module'); + break; + } + } + } + if (!empty ($mname)) { + $this->parent->setPath('extension_root', $basePath.DS.'modules'.DS.$mname); + } else { + $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('No module file specified')); + return false; + } + + /** + * --------------------------------------------------------------------------------------------- + * Filesystem Processing Section + * --------------------------------------------------------------------------------------------- + */ + + /* + * If the module directory already exists, then we will assume that the + * module is already installed or another module is using that + * directory. + */ + if (file_exists($this->parent->getPath('extension_root'))&&!$this->parent->getOverwrite()) { + $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('Another module is already using directory').': "'.$this->parent->getPath('extension_root').'"'); + return false; + } + + // If the module directory does not exist, lets create it + $created = false; + if (!file_exists($this->parent->getPath('extension_root'))) { + if (!$created = JFolder::create($this->parent->getPath('extension_root'))) { + $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_root').'"'); + return false; + } + } + + /* + * Since we created the module directory and will want to remove it if + * we have to roll back the installation, lets add it to the + * installation step stack + */ + if ($created) { + $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_root'))); + } + + // Copy all necessary files + if ($this->parent->parseFiles($element, -1) === false) { + // Install failed, roll back changes + $this->parent->abort(); + return false; + } + + // Parse optional tags + $this->parent->parseMedia($this->manifest->getElementByPath('media'), $clientId); + $this->parent->parseLanguages($this->manifest->getElementByPath('languages'), $clientId); + + // Parse deprecated tags + $this->parent->parseFiles($this->manifest->getElementByPath('images'), -1); + + /** + * --------------------------------------------------------------------------------------------- + * Database Processing Section + * --------------------------------------------------------------------------------------------- + */ + + // Check to see if a module by the same name is already installed + $query = 'SELECT `id`' . + ' FROM `#__modules` ' . + ' WHERE module = '.$db->Quote($mname) . + ' AND client_id = '.(int)$clientId; + $db->setQuery($query); + try { + $db->Query(); + } catch(JException $e) { + // Install failed, roll back changes + $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.$db->stderr(true)); + return false; + } + $id = $db->loadResult(); + + // Was there a module already installed with the same name? + // If there was then we wouldn't be here because it would have + // been stopped by the above. Otherwise the files weren't there + // (e.g. migration) or its an upgrade (files overwritten) + // So all we need to do is create an entry when we can't find one + if (!$id) { + $row = & JTable::getInstance('module'); + $row->title = $this->get('name'); + $row->ordering = $row->getNextOrder( "position='left'" ); + $row->position = 'left'; + $row->showtitle = 1; + $row->iscore = 0; + $row->access = $clientId == 1 ? 2 : 0; + $row->client_id = $clientId; + $row->module = $mname; + $row->params = $this->parent->getParams(); + + if (!$row->store()) { + // Install failed, roll back changes + $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.$row->getError()); + return false; + } + + // Since we have created a module item, we add it to the installation step stack + // so that if we have to rollback the changes we can undo it. + $this->parent->pushStep(array ('type' => 'module', 'id' => $row->id)); + + // Clean up possible garbage first + $query = 'DELETE FROM #__modules_menu WHERE moduleid = '.(int) $row->id; + $db->setQuery( $query ); + try { + $db->query(); + } catch(JException $e) { + // Install failed, roll back changes + $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.$db->stderr(true)); + return false; + } + + // Time to create a menu entry for the module + $query = 'INSERT INTO `#__modules_menu` ' . + ' VALUES ('.(int) $row->id.', 0 )'; + $db->setQuery($query); + try { + $db->query(); + } catch(JException $e) { + // Install failed, roll back changes + $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.$db->stderr(true)); + return false; + } + + /* + * Since we have created a menu item, we add it to the installation step stack + * so that if we have to rollback the changes we can undo it. + */ + $this->parent->pushStep(array ('type' => 'menu', 'id' => $db->insertid())); + } + + /** + * --------------------------------------------------------------------------------------------- + * Finalization and Cleanup Section + * --------------------------------------------------------------------------------------------- + */ + + // Lastly, we will copy the manifest file to its appropriate place. + if (!$this->parent->copyManifest(-1)) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Module').' '.JText::_('Install').': '.JText::_('Could not copy setup file')); + return false; + } + return true; + } + + /** + * Custom uninstall method + * + * @access public + * @param int $id The id of the module to uninstall + * @param int $clientId The id of the client (unused) + * @return boolean True on success + * @since 1.5 + */ + public function uninstall( $id, $clientId ) + { + // Initialize variables + $row = null; + $retval = true; + $db =& $this->parent->getDBO(); + + // First order of business will be to load the module object table from the database. + // This should give us the necessary information to proceed. + $row = & JTable::getInstance('module'); + if ( !$row->load((int) $id) ) { + JError::raiseWarning(100, JText::_('ERRORUNKOWNEXTENSION')); + return false; + } + + // Is the module we are trying to uninstall a core one? + // Because that is not a good idea... + if ($row->iscore) { + JError::raiseWarning(100, JText::_('Module').' '.JText::_('Uninstall').': '.JText::sprintf('WARNCOREMODULE', $row->name)."
      ".JText::_('WARNCOREMODULE2')); + return false; + } + + // Get the extension root path + jimport('joomla.application.helper'); + $client =& JApplicationHelper::getClientInfo($row->client_id); + if ($client === false) { + $this->parent->abort(JText::_('Module').' '.JText::_('Uninstall').': '.JText::_('Unknown client type').' ['.$row->client_id.']'); + return false; + } + $this->parent->setPath('extension_root', $client->path.DS.'modules'.DS.$row->module); + + // Get the package manifest objecct + $this->parent->setPath('source', $this->parent->getPath('extension_root')); + $manifest =& $this->parent->getManifest(); + if (!$manifest INSTANCEOF JSimpleXML) { + // Make sure we delete the folders + JFolder::delete($this->parent->getPath('extension_root')); + JError::raiseWarning(100, 'Module Uninstall: Package manifest file invalid or not found'); + return false; + } + + // Remove other files + $root =& $manifest->document; + $this->parent->removeFiles($root->getElementByPath('media')); + $this->parent->removeFiles($root->getElementByPath('languages')); + $this->parent->removeFiles($root->getElementByPath('administration/languages'), 1); + + // Lets delete all the module copies for the type we are uninstalling + $query = 'SELECT `id`' . + ' FROM `#__modules`' . + ' WHERE module = '.$db->Quote($row->module) . + ' AND client_id = '.(int)$row->client_id; + $db->setQuery($query); + try { + $modules = $db->loadResultArray(); + } catch(JException $e) { + $modules = array(); + } + + // Do we have any module copies? + if (count($modules)) { + JArrayHelper::toInteger($modules); + $modID = implode(',', $modules); + $query = 'DELETE' . + ' FROM #__modules_menu' . + ' WHERE moduleid IN ('.$modID.')'; + $db->setQuery($query); + try { + $db->query(); + } catch(JException $e) { + JError::raiseWarning(100, JText::_('Module').' '.JText::_('Uninstall').': '.$db->stderr(true)); + $retval = false; + } + } + + // Now we will no longer need the module object, so lets delete it and free up memory + $row->delete($row->id); + $query = 'DELETE FROM `#__modules` WHERE module = '.$db->Quote($row->module) . ' AND client_id = ' . $row->client_id; + $db->setQuery($query); + try { + $db->Query(); // clean up any other ones that might exist as well + } catch(JException $e) { + //Ignore the error... + } + unset ($row); + + // Remove the installation folder + if (!JFolder::delete($this->parent->getPath('extension_root'))) { + // JFolder should raise an error + $retval = false; + } + return $retval; + } + + /** + * Custom rollback method + * - Roll back the menu item + * + * @access public + * @param array $arg Installation step to rollback + * @return boolean True on success + * @since 1.5 + */ + protected function _rollback_menu($arg) + { + // Get database connector object + $db =& $this->parent->getDBO(); + + // Remove the entry from the #__modules_menu table + $query = 'DELETE' . + ' FROM `#__modules_menu`' . + ' WHERE moduleid='.(int)$arg['id']; + $db->setQuery($query); + try { + return $db->query(); + } catch(JException $e) { + return false; + } + } + + /** + * Custom rollback method + * - Roll back the module item + * + * @access public + * @param array $arg Installation step to rollback + * @return boolean True on success + * @since 1.5 + */ + protected function _rollback_module($arg) + { + // Get database connector object + $db =& $this->parent->getDBO(); + + // Remove the entry from the #__modules table + $query = 'DELETE' . + ' FROM `#__modules`' . + ' WHERE id='.(int)$arg['id']; + $db->setQuery($query); + try { + return $db->query(); + } catch(JException $e) { + return false; + } + } +} diff --git a/libraries/joomla/installer/adapters/plugin.php b/libraries/joomla/installer/adapters/plugin.php index 1ab0d56ab1dea..9a92169e867de 100644 --- a/libraries/joomla/installer/adapters/plugin.php +++ b/libraries/joomla/installer/adapters/plugin.php @@ -1,316 +1,322 @@ -parent =& $parent; - } - - /** - * Custom install method - * - * @access public - * @return boolean True on success - * @since 1.5 - */ - function install() - { - // Get a database connector object - $db =& $this->parent->getDBO(); - - // Get the extension manifest object - $manifest =& $this->parent->getManifest(); - $this->manifest =& $manifest->document; - - /** - * --------------------------------------------------------------------------------------------- - * Manifest Document Setup Section - * --------------------------------------------------------------------------------------------- - */ - - // Set the extensions name - $name =& $this->manifest->getElementByPath('name'); - $name = JFilterInput::clean($name->data(), 'string'); - $this->set('name', $name); - - // Get the component description - $description = & $this->manifest->getElementByPath('description'); - if (is_a($description, 'JSimpleXMLElement')) { - $this->parent->set('message', $description->data()); - } else { - $this->parent->set('message', '' ); - } - - /* - * Backward Compatability - * @todo Deprecate in future version - */ - $type = $this->manifest->attributes('type'); - - // Set the installation path - $element =& $this->manifest->getElementByPath('files'); - if (is_a($element, 'JSimpleXMLElement') && count($element->children())) { - $files =& $element->children(); - foreach ($files as $file) { - if ($file->attributes($type)) { - $pname = $file->attributes($type); - break; - } - } - } - $group = $this->manifest->attributes('group'); - if (!empty ($pname) && !empty($group)) { - $this->parent->setPath('extension_root', JPATH_ROOT.DS.'plugins'.DS.$group); - } else { - $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('No plugin file specified')); - return false; - } - - /** - * --------------------------------------------------------------------------------------------- - * Filesystem Processing Section - * --------------------------------------------------------------------------------------------- - */ - - // If the plugin directory does not exist, lets create it - $created = false; - if (!file_exists($this->parent->getPath('extension_root'))) { - if (!$created = JFolder::create($this->parent->getPath('extension_root'))) { - $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_root').'"'); - return false; - } - } - - /* - * If we created the plugin directory and will want to remove it if we - * have to roll back the installation, lets add it to the installation - * step stack - */ - if ($created) { - $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_root'))); - } - - // Copy all necessary files - if ($this->parent->parseFiles($element, -1) === false) { - // Install failed, roll back changes - $this->parent->abort(); - return false; - } - - // Parse optional tags -- media and language files for plugins go in admin app - $this->parent->parseMedia($this->manifest->getElementByPath('media'), 1); - $this->parent->parseLanguages($this->manifest->getElementByPath('languages'), 1); - - /** - * --------------------------------------------------------------------------------------------- - * Database Processing Section - * --------------------------------------------------------------------------------------------- - */ - - // Check to see if a plugin by the same name is already installed - $query = 'SELECT `id`' . - ' FROM `#__plugins`' . - ' WHERE folder = '.$db->Quote($group) . - ' AND element = '.$db->Quote($pname); - $db->setQuery($query); - if (!$db->Query()) { - // Install failed, roll back changes - $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.$db->stderr(true)); - return false; - } - $id = $db->loadResult(); - - // Was there a module already installed with the same name? - if ($id) { - - if (!$this->parent->getOverwrite()) - { - // Install failed, roll back changes - $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Plugin').' "'.$pname.'" '.JText::_('already exists!')); - return false; - } - - } else { - $row =& JTable::getInstance('plugin'); - $row->name = $this->get('name'); - $row->ordering = 0; - $row->folder = $group; - $row->iscore = 0; - $row->access = 0; - $row->client_id = 0; - $row->element = $pname; - $row->params = $this->parent->getParams(); - - // Editor plugins are published by default - if ($group == 'editors') { - $row->published = 1; - } - - if (!$row->store()) { - // Install failed, roll back changes - $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.$db->stderr(true)); - return false; - } - - // Since we have created a plugin item, we add it to the installation step stack - // so that if we have to rollback the changes we can undo it. - $this->parent->pushStep(array ('type' => 'plugin', 'id' => $row->id)); - } - - /** - * --------------------------------------------------------------------------------------------- - * Finalization and Cleanup Section - * --------------------------------------------------------------------------------------------- - */ - - // Lastly, we will copy the manifest file to its appropriate place. - if (!$this->parent->copyManifest(-1)) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Could not copy setup file')); - return false; - } - return true; - } - - /** - * Custom uninstall method - * - * @access public - * @param int $cid The id of the plugin to uninstall - * @param int $clientId The id of the client (unused) - * @return boolean True on success - * @since 1.5 - */ - function uninstall($id, $clientId ) - { - // Initialize variables - $row = null; - $retval = true; - $db =& $this->parent->getDBO(); - - // First order of business will be to load the module object table from the database. - // This should give us the necessary information to proceed. - $row = & JTable::getInstance('plugin'); - if ( !$row->load((int) $id) ) { - JError::raiseWarning(100, JText::_('ERRORUNKOWNEXTENSION')); - return false; - } - - // Is the plugin we are trying to uninstall a core one? - // Because that is not a good idea... - if ($row->iscore) { - JError::raiseWarning(100, JText::_('Plugin').' '.JText::_('Uninstall').': '.JText::sprintf('WARNCOREPLUGIN', $row->name)."
      ".JText::_('WARNCOREPLUGIN2')); - return false; - } - - // Get the plugin folder so we can properly build the plugin path - if (trim($row->folder) == '') { - JError::raiseWarning(100, JText::_('Plugin').' '.JText::_('Uninstall').': '.JText::_('Folder field empty, cannot remove files')); - return false; - } - - // Set the plugin root path - $this->parent->setPath('extension_root', JPATH_ROOT.DS.'plugins'.DS.$row->folder); - - // Because plugins don't have their own folders we cannot use the standard method of finding an installation manifest - $manifestFile = JPATH_ROOT.DS.'plugins'.DS.$row->folder.DS.$row->element.'.xml'; - if (file_exists($manifestFile)) - { - $xml =& JFactory::getXMLParser('Simple'); - - // If we cannot load the xml file return null - if (!$xml->loadFile($manifestFile)) { - JError::raiseWarning(100, JText::_('Plugin').' '.JText::_('Uninstall').': '.JText::_('Could not load manifest file')); - return false; - } - - /* - * Check for a valid XML root tag. - * @todo: Remove backwards compatability in a future version - * Should be 'install', but for backward compatability we will accept 'mosinstall'. - */ - $root =& $xml->document; - if ($root->name() != 'install' && $root->name() != 'mosinstall') { - JError::raiseWarning(100, JText::_('Plugin').' '.JText::_('Uninstall').': '.JText::_('Invalid manifest file')); - return false; - } - - // Remove the plugin files - $this->parent->removeFiles($root->getElementByPath('images'), -1); - $this->parent->removeFiles($root->getElementByPath('files'), -1); - JFile::delete($manifestFile); - - // Remove all media and languages as well - $this->parent->removeFiles($root->getElementByPath('media')); - $this->parent->removeFiles($root->getElementByPath('languages'), 1); - } else { - JError::raiseWarning(100, 'Plugin Uninstall: Manifest File invalid or not found'); - return false; - } - - // Now we will no longer need the plugin object, so lets delete it - $row->delete($row->id); - unset ($row); - - // If the folder is empty, let's delete it - $files = JFolder::files($this->parent->getPath('extension_root')); - if (!count($files)) { - JFolder::delete($this->parent->getPath('extension_root')); - } - - return $retval; - } - - /** - * Custom rollback method - * - Roll back the plugin item - * - * @access public - * @param array $arg Installation step to rollback - * @return boolean True on success - * @since 1.5 - */ - function _rollback_plugin($arg) - { - // Get database connector object - $db =& $this->parent->getDBO(); - - // Remove the entry from the #__plugins table - $query = 'DELETE' . - ' FROM `#__plugins`' . - ' WHERE id='.(int)$arg['id']; - $db->setQuery($query); - return ($db->query() !== false); - } -} \ No newline at end of file +parent =& $parent; + } + + /** + * Custom install method + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + public function install() + { + // Get a database connector object + $db =& $this->parent->getDBO(); + + // Get the extension manifest object + $manifest =& $this->parent->getManifest(); + $this->manifest =& $manifest->document; + + /** + * --------------------------------------------------------------------------------------------- + * Manifest Document Setup Section + * --------------------------------------------------------------------------------------------- + */ + + // Set the extensions name + $name =& $this->manifest->getElementByPath('name'); + $name = JFilterInput::clean($name->data(), 'string'); + $this->set('name', $name); + + // Get the component description + $description = & $this->manifest->getElementByPath('description'); + if ($description INSTANCEOF JSimpleXMLElement) { + $this->parent->set('message', $description->data()); + } else { + $this->parent->set('message', '' ); + } + + /* + * Backward Compatability + * @todo Deprecate in future version + */ + $type = $this->manifest->attributes('type'); + + // Set the installation path + $element =& $this->manifest->getElementByPath('files'); + if ($element INSTANCEOF JSimpleXMLElement && count($element->children())) { + $files =& $element->children(); + foreach ($files as $file) { + if ($file->attributes($type)) { + $pname = $file->attributes($type); + break; + } + } + } + $group = $this->manifest->attributes('group'); + if (!empty ($pname) && !empty($group)) { + $this->parent->setPath('extension_root', JPATH_ROOT.DS.'plugins'.DS.$group); + } else { + $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('No plugin file specified')); + return false; + } + + /** + * --------------------------------------------------------------------------------------------- + * Filesystem Processing Section + * --------------------------------------------------------------------------------------------- + */ + + // If the plugin directory does not exist, lets create it + $created = false; + if (!file_exists($this->parent->getPath('extension_root'))) { + if (!$created = JFolder::create($this->parent->getPath('extension_root'))) { + $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Failed to create directory').': "'.$this->parent->getPath('extension_root').'"'); + return false; + } + } + + /* + * If we created the plugin directory and will want to remove it if we + * have to roll back the installation, lets add it to the installation + * step stack + */ + if ($created) { + $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_root'))); + } + + // Copy all necessary files + if ($this->parent->parseFiles($element, -1) === false) { + // Install failed, roll back changes + $this->parent->abort(); + return false; + } + + // Parse optional tags -- media and language files for plugins go in admin app + $this->parent->parseMedia($this->manifest->getElementByPath('media'), 1); + $this->parent->parseLanguages($this->manifest->getElementByPath('languages'), 1); + + /** + * --------------------------------------------------------------------------------------------- + * Database Processing Section + * --------------------------------------------------------------------------------------------- + */ + + // Check to see if a plugin by the same name is already installed + $query = 'SELECT `id`' . + ' FROM `#__plugins`' . + ' WHERE folder = '.$db->Quote($group) . + ' AND element = '.$db->Quote($pname); + $db->setQuery($query); + try { + $db->Query(); + } catch(JException $e) { + // Install failed, roll back changes + $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.$db->stderr(true)); + return false; + } + $id = $db->loadResult(); + + // Was there a module already installed with the same name? + if ($id) { + + if (!$this->parent->getOverwrite()) + { + // Install failed, roll back changes + $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Plugin').' "'.$pname.'" '.JText::_('already exists!')); + return false; + } + + } else { + $row =& JTable::getInstance('plugin'); + $row->name = $this->get('name'); + $row->ordering = 0; + $row->folder = $group; + $row->iscore = 0; + $row->access = 0; + $row->client_id = 0; + $row->element = $pname; + $row->params = $this->parent->getParams(); + + // Editor plugins are published by default + if ($group == 'editors') { + $row->published = 1; + } + + if (!$row->store()) { + // Install failed, roll back changes + $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.$db->stderr(true)); + return false; + } + + // Since we have created a plugin item, we add it to the installation step stack + // so that if we have to rollback the changes we can undo it. + $this->parent->pushStep(array ('type' => 'plugin', 'id' => $row->id)); + } + + /** + * --------------------------------------------------------------------------------------------- + * Finalization and Cleanup Section + * --------------------------------------------------------------------------------------------- + */ + + // Lastly, we will copy the manifest file to its appropriate place. + if (!$this->parent->copyManifest(-1)) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Plugin').' '.JText::_('Install').': '.JText::_('Could not copy setup file')); + return false; + } + return true; + } + + /** + * Custom uninstall method + * + * @access public + * @param int $cid The id of the plugin to uninstall + * @param int $clientId The id of the client (unused) + * @return boolean True on success + * @since 1.5 + */ + public function uninstall($id, $clientId ) + { + // Initialize variables + $row = null; + $retval = true; + $db =& $this->parent->getDBO(); + + // First order of business will be to load the module object table from the database. + // This should give us the necessary information to proceed. + $row = & JTable::getInstance('plugin'); + if ( !$row->load((int) $id) ) { + JError::raiseWarning(100, JText::_('ERRORUNKOWNEXTENSION')); + return false; + } + + // Is the plugin we are trying to uninstall a core one? + // Because that is not a good idea... + if ($row->iscore) { + JError::raiseWarning(100, JText::_('Plugin').' '.JText::_('Uninstall').': '.JText::sprintf('WARNCOREPLUGIN', $row->name)."
      ".JText::_('WARNCOREPLUGIN2')); + return false; + } + + // Get the plugin folder so we can properly build the plugin path + if (trim($row->folder) == '') { + JError::raiseWarning(100, JText::_('Plugin').' '.JText::_('Uninstall').': '.JText::_('Folder field empty, cannot remove files')); + return false; + } + + // Set the plugin root path + $this->parent->setPath('extension_root', JPATH_ROOT.DS.'plugins'.DS.$row->folder); + + // Because plugins don't have their own folders we cannot use the standard method of finding an installation manifest + $manifestFile = JPATH_ROOT.DS.'plugins'.DS.$row->folder.DS.$row->element.'.xml'; + if (file_exists($manifestFile)) + { + $xml =& JFactory::getXMLParser('Simple'); + + // If we cannot load the xml file return null + if (!$xml->loadFile($manifestFile)) { + JError::raiseWarning(100, JText::_('Plugin').' '.JText::_('Uninstall').': '.JText::_('Could not load manifest file')); + return false; + } + + /* + * Check for a valid XML root tag. + * @todo: Remove backwards compatability in a future version + * Should be 'install', but for backward compatability we will accept 'mosinstall'. + */ + $root =& $xml->document; + if ($root->name() != 'install' && $root->name() != 'mosinstall') { + JError::raiseWarning(100, JText::_('Plugin').' '.JText::_('Uninstall').': '.JText::_('Invalid manifest file')); + return false; + } + + // Remove the plugin files + $this->parent->removeFiles($root->getElementByPath('images'), -1); + $this->parent->removeFiles($root->getElementByPath('files'), -1); + JFile::delete($manifestFile); + + // Remove all media and languages as well + $this->parent->removeFiles($root->getElementByPath('media')); + $this->parent->removeFiles($root->getElementByPath('languages'), 1); + } else { + JError::raiseWarning(100, 'Plugin Uninstall: Manifest File invalid or not found'); + return false; + } + + // Now we will no longer need the plugin object, so lets delete it + $row->delete($row->id); + unset ($row); + + // If the folder is empty, let's delete it + $files = JFolder::files($this->parent->getPath('extension_root')); + if (!count($files)) { + JFolder::delete($this->parent->getPath('extension_root')); + } + + return $retval; + } + + /** + * Custom rollback method + * - Roll back the plugin item + * + * @access public + * @param array $arg Installation step to rollback + * @return boolean True on success + * @since 1.5 + */ + protected function _rollback_plugin($arg) + { + // Get database connector object + $db =& $this->parent->getDBO(); + + // Remove the entry from the #__plugins table + $query = 'DELETE' . + ' FROM `#__plugins`' . + ' WHERE id='.(int)$arg['id']; + $db->setQuery($query); + try { + return $db->query(); + } catch(JException $e) { + return false; + } + } +} diff --git a/libraries/joomla/installer/adapters/template.php b/libraries/joomla/installer/adapters/template.php index 13851093c5763..9a13657ea00e7 100644 --- a/libraries/joomla/installer/adapters/template.php +++ b/libraries/joomla/installer/adapters/template.php @@ -1,195 +1,193 @@ -parent =& $parent; - } - - /** - * Custom install method - * - * @access public - * @return boolean True on success - * @since 1.5 - */ - function install() - { - // Get database connector object - $db =& $this->parent->getDBO(); - $manifest =& $this->parent->getManifest(); - $root =& $manifest->document; - - // Get the client application target - if ($cname = $root->attributes('client')) { - // Attempt to map the client to a base path - jimport('joomla.application.helper'); - $client =& JApplicationHelper::getClientInfo($cname, true); - if ($client === false) { - $this->parent->abort(JText::_('Template').' '.JText::_('Install').': '.JText::_('Unknown client type').' ['.$cname.']'); - return false; - } - $basePath = $client->path; - $clientId = $client->id; - } else { - // No client attribute was found so we assume the site as the client - $cname = 'site'; - $basePath = JPATH_SITE; - $clientId = 0; - } - - // Set the extensions name - $name =& $root->getElementByPath('name'); - $name = JFilterInput::clean($name->data(), 'cmd'); - $this->set('name', $name); - - // Set the template root path - $this->parent->setPath('extension_root', $basePath.DS.'templates'.DS.strtolower(str_replace(" ", "_", $this->get('name')))); - - /* - * If the template directory already exists, then we will assume that the template is already - * installed or another template is using that directory. - */ - if (file_exists($this->parent->getPath('extension_root')) && !$this->parent->getOverwrite()) { - JError::raiseWarning(100, JText::_('Template').' '.JText::_('Install').': '.JText::_('Another template is already using directory').': "'.$this->parent->getPath('extension_root').'"'); - return false; - } - - // If the template directory does not exist, lets create it - $created = false; - if (!file_exists($this->parent->getPath('extension_root'))) { - if (!$created = JFolder::create($this->parent->getPath('extension_root'))) { - $this->parent->abort(JText::_('Template').' '.JText::_('Install').': '.JText::_('Failed to create directory').' "'.$this->parent->getPath('extension_root').'"'); - return false; - } - } - - // If we created the template directory and will want to remove it if we have to roll back - // the installation, lets add it to the installation step stack - if ($created) { - $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_root'))); - } - - // Copy all the necessary files - if ($this->parent->parseFiles($root->getElementByPath('files'), -1) === false) { - // Install failed, rollback changes - $this->parent->abort(); - return false; - } - if ($this->parent->parseFiles($root->getElementByPath('images'), -1) === false) { - // Install failed, rollback changes - $this->parent->abort(); - return false; - } - if ($this->parent->parseFiles($root->getElementByPath('css'), -1) === false) { - // Install failed, rollback changes - $this->parent->abort(); - return false; - } - - // Parse optional tags - $this->parent->parseFiles($root->getElementByPath('media'), $clientId); - $this->parent->parseLanguages($root->getElementByPath('languages')); - $this->parent->parseLanguages($root->getElementByPath('administration/languages'), 1); - - // Get the template description - $description = & $root->getElementByPath('description'); - if (is_a($description, 'JSimpleXMLElement')) { - $this->parent->set('message', $description->data()); - } else { - $this->parent->set('message', '' ); - } - - // Lastly, we will copy the manifest file to its appropriate place. - if (!$this->parent->copyManifest(-1)) { - // Install failed, rollback changes - $this->parent->abort(JText::_('Template').' '.JText::_('Install').': '.JText::_('Could not copy setup file')); - return false; - } - return true; - } - - /** - * Custom uninstall method - * - * @access public - * @param int $path The template name - * @param int $clientId The id of the client - * @return boolean True on success - * @since 1.5 - */ - function uninstall( $name, $clientId ) - { - // Initialize variables - $retval = true; - - // For a template the id will be the template name which represents the subfolder of the templates folder that the template resides in. - if (!$name) { - JError::raiseWarning(100, JText::_('Template').' '.JText::_('Uninstall').': '.JText::_('Template id is empty, cannot uninstall files')); - return false; - } - - // Get the template root path - $client =& JApplicationHelper::getClientInfo( $clientId ); - if (!$client) { - JError::raiseWarning(100, JText::_('Template').' '.JText::_('Uninstall').': '.JText::_('Invalid application')); - return false; - } - $this->parent->setPath('extension_root', $client->path.DS.'templates'.DS.$name); - $this->parent->setPath('source', $this->parent->getPath('extension_root')); - - $manifest =& $this->parent->getManifest(); - if (!is_a($manifest, 'JSimpleXML')) { - // Make sure we delete the folders - JFolder::delete($this->parent->getPath('extension_root')); - JError::raiseWarning(100, JTEXT::_('Template').' '.JTEXT::_('Uninstall').': '.JTEXT::_('Package manifest file invalid or not found')); - return false; - } - $root =& $manifest->document; - - // Remove files - $this->parent->removeFiles($root->getElementByPath('media'), $clientId); - $this->parent->removeFiles($root->getElementByPath('languages')); - $this->parent->removeFiles($root->getElementByPath('administration/languages'), 1); - - // Delete the template directory - if (JFolder::exists($this->parent->getPath('extension_root'))) { - $retval = JFolder::delete($this->parent->getPath('extension_root')); - } else { - JError::raiseWarning(100, JText::_('Template').' '.JText::_('Uninstall').': '.JText::_('Directory does not exist, cannot remove files')); - $retval = false; - } - return $retval; - } -} \ No newline at end of file +parent =& $parent; + } + + /** + * Custom install method + * + * @access public + * @return boolean True on success + * @since 1.5 + */ + public function install() + { + $manifest =& $this->parent->getManifest(); + $root =& $manifest->document; + + // Get the client application target + if ($cname = $root->attributes('client')) { + // Attempt to map the client to a base path + jimport('joomla.application.helper'); + $client =& JApplicationHelper::getClientInfo($cname, true); + if ($client === false) { + $this->parent->abort(JText::_('Template').' '.JText::_('Install').': '.JText::_('Unknown client type').' ['.$cname.']'); + return false; + } + $basePath = $client->path; + $clientId = $client->id; + } else { + // No client attribute was found so we assume the site as the client + $cname = 'site'; + $basePath = JPATH_SITE; + $clientId = 0; + } + + // Set the extensions name + $name =& $root->getElementByPath('name'); + $name = JFilterInput::clean($name->data(), 'cmd'); + $this->set('name', $name); + + // Set the template root path + $this->parent->setPath('extension_root', $basePath.DS.'templates'.DS.strtolower(str_replace(" ", "_", $this->get('name')))); + + /* + * If the template directory already exists, then we will assume that the template is already + * installed or another template is using that directory. + */ + if (file_exists($this->parent->getPath('extension_root')) && !$this->parent->getOverwrite()) { + JError::raiseWarning(100, JText::_('Template').' '.JText::_('Install').': '.JText::_('Another template is already using directory').': "'.$this->parent->getPath('extension_root').'"'); + return false; + } + + // If the template directory does not exist, lets create it + $created = false; + if (!file_exists($this->parent->getPath('extension_root'))) { + if (!$created = JFolder::create($this->parent->getPath('extension_root'))) { + $this->parent->abort(JText::_('Template').' '.JText::_('Install').': '.JText::_('Failed to create directory').' "'.$this->parent->getPath('extension_root').'"'); + return false; + } + } + + // If we created the template directory and will want to remove it if we have to roll back + // the installation, lets add it to the installation step stack + if ($created) { + $this->parent->pushStep(array ('type' => 'folder', 'path' => $this->parent->getPath('extension_root'))); + } + + // Copy all the necessary files + if ($this->parent->parseFiles($root->getElementByPath('files'), -1) === false) { + // Install failed, rollback changes + $this->parent->abort(); + return false; + } + if ($this->parent->parseFiles($root->getElementByPath('images'), -1) === false) { + // Install failed, rollback changes + $this->parent->abort(); + return false; + } + if ($this->parent->parseFiles($root->getElementByPath('css'), -1) === false) { + // Install failed, rollback changes + $this->parent->abort(); + return false; + } + + // Parse optional tags + $this->parent->parseFiles($root->getElementByPath('media'), $clientId); + $this->parent->parseLanguages($root->getElementByPath('languages')); + $this->parent->parseLanguages($root->getElementByPath('administration/languages'), 1); + + // Get the template description + $description = & $root->getElementByPath('description'); + if ($description INSTANCEOF JSimpleXMLElement) { + $this->parent->set('message', $description->data()); + } else { + $this->parent->set('message', '' ); + } + + // Lastly, we will copy the manifest file to its appropriate place. + if (!$this->parent->copyManifest(-1)) { + // Install failed, rollback changes + $this->parent->abort(JText::_('Template').' '.JText::_('Install').': '.JText::_('Could not copy setup file')); + return false; + } + return true; + } + + /** + * Custom uninstall method + * + * @access public + * @param int $path The template name + * @param int $clientId The id of the client + * @return boolean True on success + * @since 1.5 + */ + public function uninstall( $name, $clientId ) + { + // Initialize variables + $retval = true; + + // For a template the id will be the template name which represents the subfolder of the templates folder that the template resides in. + if (!$name) { + JError::raiseWarning(100, JText::_('Template').' '.JText::_('Uninstall').': '.JText::_('Template id is empty, cannot uninstall files')); + return false; + } + + // Get the template root path + $client =& JApplicationHelper::getClientInfo( $clientId ); + if (!$client) { + JError::raiseWarning(100, JText::_('Template').' '.JText::_('Uninstall').': '.JText::_('Invalid application')); + return false; + } + $this->parent->setPath('extension_root', $client->path.DS.'templates'.DS.$name); + $this->parent->setPath('source', $this->parent->getPath('extension_root')); + + $manifest =& $this->parent->getManifest(); + if (!$manifest INSTANCEOF JSimpleXML) { + // Make sure we delete the folders + JFolder::delete($this->parent->getPath('extension_root')); + JError::raiseWarning(100, JTEXT::_('Template').' '.JTEXT::_('Uninstall').': '.JTEXT::_('Package manifest file invalid or not found')); + return false; + } + $root =& $manifest->document; + + // Remove files + $this->parent->removeFiles($root->getElementByPath('media'), $clientId); + $this->parent->removeFiles($root->getElementByPath('languages')); + $this->parent->removeFiles($root->getElementByPath('administration/languages'), 1); + + // Delete the template directory + if (JFolder::exists($this->parent->getPath('extension_root'))) { + $retval = JFolder::delete($this->parent->getPath('extension_root')); + } else { + JError::raiseWarning(100, JText::_('Template').' '.JText::_('Uninstall').': '.JText::_('Directory does not exist, cannot remove files')); + $retval = false; + } + return $retval; + } +} diff --git a/libraries/joomla/installer/helper.php b/libraries/joomla/installer/helper.php index e3b41b808b944..4b634ffe4f10e 100644 --- a/libraries/joomla/installer/helper.php +++ b/libraries/joomla/installer/helper.php @@ -1,278 +1,277 @@ - - * @package Joomla.Framework - * @subpackage Installer - * @since 1.5 - */ -class JInstallerHelper -{ - /** - * Downloads a package - * - * @static - * @param string URL of file to download - * @param string Download target filename [optional] - * @return mixed Path to downloaded package or boolean false on failure - * @since 1.5 - */ - function downloadPackage($url, $target = false) - { - $config =& JFactory::getConfig(); - - // Capture PHP errors - $php_errormsg = 'Error Unknown'; - ini_set('track_errors', true); - - // Set user agent - ini_set('user_agent', "Joomla! 1.5 Installer"); - - // Open the remote server socket for reading +getValue('config.tmp_path').DS.JInstallerHelper::getFilenameFromURL($url); - } else { - $target = $config->getValue('config.tmp_path').DS.basename($target); - } - - // Initialize contents buffer - $contents = null; - - while (!feof($inputHandle)) - { - $contents .= fread($inputHandle, 4096); - if ($contents == false) { - JError::raiseWarning(44, 'Failed reading network resource: '.$php_errormsg); - return false; - } - } - - // Write buffer to file - JFile::write($target, $contents); - - // Close file pointer resource - fclose($inputHandle); - - // Return the name of the downloaded package - return basename($target); - } - - /** - * Unpacks a file and verifies it as a Joomla element package - * Supports .gz .tar .tar.gz and .zip - * - * @static - * @param string $p_filename The uploaded package filename or install directory - * @return boolean True on success, False on error - * @since 1.5 - */ - function unpack($p_filename) - { - // Path to the archive - $archivename = $p_filename; - - // Temporary folder to extract the archive into - $tmpdir = uniqid('install_'); - - // Clean the paths to use for archive extraction - $extractdir = JPath::clean(dirname($p_filename).DS.$tmpdir); - $archivename = JPath::clean($archivename); - - // do the unpacking of the archive - $result = JArchive::extract( $archivename, $extractdir); - - if ( $result === false ) { - return false; - } - - - /* - * Lets set the extraction directory and package file in the result array so we can - * cleanup everything properly later on. - */ - $retval['extractdir'] = $extractdir; - $retval['packagefile'] = $archivename; - - /* - * Try to find the correct install directory. In case the package is inside a - * subdirectory detect this and set the install directory to the correct path. - * - * List all the items in the installation directory. If there is only one, and - * it is a folder, then we will set that folder to be the installation folder. - */ - $dirList = array_merge(JFolder::files($extractdir, ''), JFolder::folders($extractdir, '')); - - if (count($dirList) == 1) - { - if (JFolder::exists($extractdir.DS.$dirList[0])) - { - $extractdir = JPath::clean($extractdir.DS.$dirList[0]); - } - } - - /* - * We have found the install directory so lets set it and then move on - * to detecting the extension type. - */ - $retval['dir'] = $extractdir; - - /* - * Get the extension type and return the directory/type array on success or - * false on fail. - */ - if ($retval['type'] = JInstallerHelper::detectType($extractdir)) - { - return $retval; - } else - { - return false; - } - } - - /** - * Method to detect the extension type from a package directory - * - * @static - * @param string $p_dir Path to package directory - * @return mixed Extension type string or boolean false on fail - * @since 1.5 - */ - function detectType($p_dir) - { - // Search the install dir for an xml file - $files = JFolder::files($p_dir, '\.xml$', 1, true); - - if (count($files) > 0) - { - - foreach ($files as $file) - { - $xmlDoc = & JFactory::getXMLParser(); - $xmlDoc->resolveErrors(true); - - if (!$xmlDoc->loadXML($file, false, true)) - { - // Free up memory from DOMIT parser - unset ($xmlDoc); - continue; - } - $root = & $xmlDoc->documentElement; - if (!is_object($root) || ($root->getTagName() != "install" && $root->getTagName() != 'mosinstall')) - { - unset($xmlDoc); - continue; - } - - $type = $root->getAttribute('type'); - // Free up memory from DOMIT parser - unset ($xmlDoc); - return $type; - } - - JError::raiseWarning(1, JText::_('ERRORNOTFINDJOOMLAXMLSETUPFILE')); - // Free up memory from DOMIT parser - unset ($xmlDoc); - return false; - } else - { - JError::raiseWarning(1, JText::_('ERRORNOTFINDXMLSETUPFILE')); - return false; - } - } - - /** - * Gets a file name out of a url - * - * @static - * @param string $url URL to get name from - * @return mixed String filename or boolean false if failed - * @since 1.5 - */ - function getFilenameFromURL($url) - { - if (is_string($url)) { - $parts = explode('/', $url); - return $parts[count($parts) - 1]; - } - return false; - } - - /** - * Clean up temporary uploaded package and unpacked extension - * - * @static - * @param string $p_file Path to the uploaded package file - * @param string $resultdir Path to the unpacked extension - * @return boolean True on success - * @since 1.5 - */ - function cleanupInstall($package, $resultdir) - { - $config =& JFactory::getConfig(); - - // Does the unpacked extension directory exist? - if (is_dir($resultdir)) { - JFolder::delete($resultdir); - } - - // Is the package file a valid file? - if (is_file($package)) { - JFile::delete($package); - } elseif (is_file(JPath::clean($config->getValue('config.tmp_path').DS.$package))) { - // It might also be just a base filename - JFile::delete(JPath::clean($config->getValue('config.tmp_path').DS.$package)); - } - } - - /** - * Splits contents of a sql file into array of discreet queries - * queries need to be delimited with end of statement marker ';' - * @param string - * @return array - */ - function splitSql($sql) - { + $error = strstr($php_errormsg,'failed to open stream:'); + if (!$inputHandle) { + JError::raiseWarning(42, JText::_('SERVER_CONNECT_FAILED').', '.$error); + return false; + } + + $meta_data = stream_get_meta_data($inputHandle); + foreach ($meta_data['wrapper_data'] as $wrapper_data) + { + if (substr($wrapper_data, 0, strlen("Content-Disposition")) == "Content-Disposition") { + $contentfilename = explode ("\"", $wrapper_data); + $target = $contentfilename[1]; + } + } + + // Set the target path if not given + if (!$target) { + $target = $config->getValue('config.tmp_path').DS.JInstallerHelper::getFilenameFromURL($url); + } else { + $target = $config->getValue('config.tmp_path').DS.basename($target); + } + + // Initialize contents buffer + $contents = null; + + while (!feof($inputHandle)) + { + $contents .= fread($inputHandle, 4096); + if ($contents == false) { + JError::raiseWarning(44, 'Failed reading network resource: '.$php_errormsg); + return false; + } + } + + // Write buffer to file + JFile::write($target, $contents); + + // Close file pointer resource + fclose($inputHandle); + + // Return the name of the downloaded package + return basename($target); + } + + /** + * Unpacks a file and verifies it as a Joomla element package + * Supports .gz .tar .tar.gz and .zip + * + * @static + * @param string $p_filename The uploaded package filename or install directory + * @return boolean True on success, False on error + * @since 1.5 + */ + public static function unpack($p_filename) + { + // Path to the archive + $archivename = $p_filename; + + // Temporary folder to extract the archive into + $tmpdir = uniqid('install_'); + + // Clean the paths to use for archive extraction + $extractdir = JPath::clean(dirname($p_filename).DS.$tmpdir); + $archivename = JPath::clean($archivename); + + // do the unpacking of the archive + $result = JArchive::extract( $archivename, $extractdir); + + if ( $result === false ) { + return false; + } + + + /* + * Lets set the extraction directory and package file in the result array so we can + * cleanup everything properly later on. + */ + $retval['extractdir'] = $extractdir; + $retval['packagefile'] = $archivename; + + /* + * Try to find the correct install directory. In case the package is inside a + * subdirectory detect this and set the install directory to the correct path. + * + * List all the items in the installation directory. If there is only one, and + * it is a folder, then we will set that folder to be the installation folder. + */ + $dirList = array_merge(JFolder::files($extractdir, ''), JFolder::folders($extractdir, '')); + + if (count($dirList) == 1) + { + if (JFolder::exists($extractdir.DS.$dirList[0])) + { + $extractdir = JPath::clean($extractdir.DS.$dirList[0]); + } + } + + /* + * We have found the install directory so lets set it and then move on + * to detecting the extension type. + */ + $retval['dir'] = $extractdir; + + /* + * Get the extension type and return the directory/type array on success or + * false on fail. + */ + if ($retval['type'] = JInstallerHelper::detectType($extractdir)) + { + return $retval; + } else + { + return false; + } + } + + /** + * Method to detect the extension type from a package directory + * + * @static + * @param string $p_dir Path to package directory + * @return mixed Extension type string or boolean false on fail + * @since 1.5 + */ + public static function detectType($p_dir) + { + // Search the install dir for an xml file + $files = JFolder::files($p_dir, '\.xml$', 1, true); + + if (count($files) > 0) + { + + foreach ($files as $file) + { + $xmlDoc = & JFactory::getXMLParser(); + $xmlDoc->resolveErrors(true); + + if (!$xmlDoc->loadXML($file, false, true)) + { + // Free up memory from DOMIT parser + unset ($xmlDoc); + continue; + } + $root = & $xmlDoc->documentElement; + if (!is_object($root) || ($root->getTagName() != "install" && $root->getTagName() != 'mosinstall')) + { + unset($xmlDoc); + continue; + } + + $type = $root->getAttribute('type'); + // Free up memory from DOMIT parser + unset ($xmlDoc); + return $type; + } + + JError::raiseWarning(1, JText::_('ERRORNOTFINDJOOMLAXMLSETUPFILE')); + // Free up memory from DOMIT parser + unset ($xmlDoc); + return false; + } else + { + JError::raiseWarning(1, JText::_('ERRORNOTFINDXMLSETUPFILE')); + return false; + } + } + + /** + * Gets a file name out of a url + * + * @static + * @param string $url URL to get name from + * @return mixed String filename or boolean false if failed + * @since 1.5 + */ + public static function getFilenameFromURL($url) + { + if (is_string($url)) { + $parts = explode('/', $url); + return $parts[count($parts) - 1]; + } + return false; + } + + /** + * Clean up temporary uploaded package and unpacked extension + * + * @static + * @param string $p_file Path to the uploaded package file + * @param string $resultdir Path to the unpacked extension + * @return boolean True on success + * @since 1.5 + */ + public static function cleanupInstall($package, $resultdir) + { + $config =& JFactory::getConfig(); + + // Does the unpacked extension directory exist? + if (is_dir($resultdir)) { + JFolder::delete($resultdir); + } + + // Is the package file a valid file? + if (is_file($package)) { + JFile::delete($package); + } elseif (is_file(JPath::clean($config->getValue('config.tmp_path').DS.$package))) { + // It might also be just a base filename + JFile::delete(JPath::clean($config->getValue('config.tmp_path').DS.$package)); + } + } + + /** + * Splits contents of a sql file into array of discreet queries + * queries need to be delimited with end of statement marker ';' + * @param string + * @return array + */ + public static function splitSql($sql) + { $db =& JFactory::getDBO(); return $db->splitSql($sql); - } + } } diff --git a/libraries/joomla/installer/index.html b/libraries/joomla/installer/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/installer/index.html +++ b/libraries/joomla/installer/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/installer/installer.php b/libraries/joomla/installer/installer.php index 17893186fb468..2dbd8cd280e97 100644 --- a/libraries/joomla/installer/installer.php +++ b/libraries/joomla/installer/installer.php @@ -1,1174 +1,1174 @@ - - * @package Joomla.Framework - * @subpackage Installer - * @since 1.5 - */ -class JInstaller extends JObject -{ - /** - * Array of paths needed by the installer - * @var array - */ - var $_paths = array(); - - /** - * The installation manifest XML object - * @var object - */ - var $_manifest = null; - - /** - * True if existing files can be overwritten - * @var boolean - */ - var $_overwrite = false; - - /** - * A database connector object - * @var object - */ - var $_db = null; - - /** - * Associative array of package installer handlers - * @var array - */ - var $_adapters = array(); - - /** - * Stack of installation steps - * - Used for installation rollback - * @var array - */ - var $_stepStack = array(); - - /** - * The output from the install/uninstall scripts - * @var string - */ - var $message = null; - - /** - * Constructor - * - * @access protected - */ - function __construct() - { - $this->_db =& JFactory::getDBO(); - } - - /** - * Returns a reference to the global Installer object, only creating it - * if it doesn't already exist. - * - * @static - * @return object An installer object - * @since 1.5 - */ - function &getInstance() - { - static $instance; - - if (!isset ($instance)) { - $instance = new JInstaller(); - } - return $instance; - } - - /** - * Get the allow overwrite switch - * - * @access public - * @return boolean Allow overwrite switch - * @since 1.5 - */ - function getOverwrite() - { - return $this->_overwrite; - } - - /** - * Set the allow overwrite switch - * - * @access public - * @param boolean $state Overwrite switch state - * @return boolean Previous value - * @since 1.5 - */ - function setOverwrite($state=false) - { - $tmp = $this->_overwrite; - if ($state) { - $this->_overwrite = true; - } else { - $this->_overwrite = false; - } - return $tmp; - } - - /** - * Get the database connector object - * - * @access public - * @return object Database connector object - * @since 1.5 - */ - function &getDBO() - { - return $this->_db; - } - - /** - * Get the installation manifest object - * - * @access public - * @return object Manifest object - * @since 1.5 - */ - function &getManifest() - { - if (!is_object($this->_manifest)) { - $this->_findManifest(); - } - return $this->_manifest; - } - - /** - * Get an installer path by name - * - * @access public - * @param string $name Path name - * @param string $default Default value - * @return string Path - * @since 1.5 - */ - function getPath($name, $default=null) - { - return (!empty($this->_paths[$name])) ? $this->_paths[$name] : $default; - } - - /** - * Sets an installer path by name - * - * @access public - * @param string $name Path name - * @param string $value Path - * @return void - * @since 1.5 - */ - function setPath($name, $value) - { - $this->_paths[$name] = $value; - } - - /** - * Pushes a step onto the installer stack for rolling back steps - * - * @access public - * @param array $step Installer step - * @return void - * @since 1.5 - */ - function pushStep($step) - { - $this->_stepStack[] = $step; - } - - /** - * Set an installer adapter by name - * - * @access public - * @param string $name Adapter name - * @param object $adapter Installer adapter object - * @return boolean True if successful - * @since 1.5 - */ - function setAdapter($name, $adapter = null) - { - if (!is_object($adapter)) - { - // Try to load the adapter object - require_once(dirname(__FILE__).DS.'adapters'.DS.strtolower($name).'.php'); - $class = 'JInstaller'.ucfirst($name); - if (!class_exists($class)) { - return false; - } - $adapter = new $class($this); - $adapter->parent =& $this; - } - $this->_adapters[$name] =& $adapter; - return true; - } - - /** - * Installation abort method - * - * @access public - * @param string $msg Abort message from the installer - * @param string $type Package type if defined - * @return boolean True if successful - * @since 1.5 - */ - function abort($msg=null, $type=null) - { - // Initialize variables - $retval = true; - $step = array_pop($this->_stepStack); - - // Raise abort warning - if ($msg) { - JError::raiseWarning(100, $msg); - } - - while ($step != null) - { - switch ($step['type']) - { - case 'file' : - // remove the file - $stepval = JFile::delete($step['path']); - break; - - case 'folder' : - // remove the folder - $stepval = JFolder::delete($step['path']); - break; - - case 'query' : - // placeholder in case this is necessary in the future - break; - - default : - if ($type && is_object($this->_adapters[$type])) { - // Build the name of the custom rollback method for the type - $method = '_rollback_'.$step['type']; - // Custom rollback method handler - if (method_exists($this->_adapters[$type], $method)) { - $stepval = $this->_adapters[$type]->$method($step); - } - } - break; - } - - // Only set the return value if it is false - if ($stepval === false) { - $retval = false; - } - - // Get the next step and continue - $step = array_pop($this->_stepStack); - } - - return $retval; - } - - /** - * Package installation method - * - * @access public - * @param string $path Path to package source folder - * @return boolean True if successful - * @since 1.5 - */ - function install($path=null) - { - if ($path && JFolder::exists($path)) { - $this->setPath('source', $path); - } else { - $this->abort(JText::_('Install path does not exist')); - return false; - } - - if (!$this->setupInstall()) { - $this->abort(JText::_('Unable to detect manifest file')); - return false; - } - - /* - * LEGACY CHECK - */ - $root =& $this->_manifest->document; - $version = $root->attributes('version'); - $rootName = $root->name(); - $config = &JFactory::getConfig(); - if ((version_compare($version, '1.5', '<') || $rootName == 'mosinstall') && !$config->getValue('config.legacy')) { - $this->abort(JText::_('MUSTENABLELEGACY')); - return false; - } - - $type = $root->attributes('type'); - - // Needed for legacy reasons ... to be deprecated in next minor release - if ($type == 'mambot') { - $type = 'plugin'; - } - - if (is_object($this->_adapters[$type])) { - return $this->_adapters[$type]->install(); - } - return false; - } - - /** - * Package update method - * - * @access public - * @param string $path Path to package source folder - * @return boolean True if successful - * @since 1.5 - */ - function update($path=null) - { - if ($path && JFolder::exists($path)) { - $this->setPath('source', $path); - } else { - $this->abort(JText::_('Update path does not exist')); - } - - if (!$this->setupInstall()) { - return $this->abort(JText::_('Unable to detect manifest file')); - } - - /* - * LEGACY CHECK - */ - $root =& $this->_manifest->document; - $version = $root->attributes('version'); - $rootName = $root->name(); - $config = &JFactory::getConfig(); - if ((version_compare($version, '1.5', '<') || $rootName == 'mosinstall') && !$config->getValue('config.legacy')) { - return $this->abort(JText::_('MUSTENABLELEGACY')); - } - - $type = $root->attributes('type'); - - // Needed for legacy reasons ... to be deprecated in next minor release - if ($type == 'mambot') { - $type = 'plugin'; - } - - if (is_object($this->_adapters[$type])) { - return $this->_adapters[$type]->update(); +_db =& JFactory::getDBO(); + } + + /** + * Returns a reference to the global Installer object, only creating it + * if it doesn't already exist. + * + * @static + * @return object An installer object + * @since 1.5 + */ + public static function &getInstance() + { + static $instance; + + if (!isset ($instance)) { + $instance = new JInstaller(); } - return false; - } - - /** - * Package uninstallation method - * - * @access public - * @param string $type Package type - * @param mixed $identifier Package identifier for adapter - * @param int $cid Application ID - * @return boolean True if successful - * @since 1.5 - */ - function uninstall($type, $identifier, $cid=0) - { - if (!isset($this->_adapters[$type]) || !is_object($this->_adapters[$type])) { - if (!$this->setAdapter($type)) { - return false; - } - } - if (is_object($this->_adapters[$type])) { - return $this->_adapters[$type]->uninstall($identifier, $cid); + return $instance; + } + + /** + * Get the allow overwrite switch + * + * @access public + * @return boolean Allow overwrite switch + * @since 1.5 + */ + public function getOverwrite() + { + return $this->_overwrite; + } + + /** + * Set the allow overwrite switch + * + * @access public + * @param boolean $state Overwrite switch state + * @return boolean Previous value + * @since 1.5 + */ + public function setOverwrite($state=false) + { + $tmp = $this->_overwrite; + if ($state) { + $this->_overwrite = true; + } else { + $this->_overwrite = false; } - return false; - } - - /** - * Prepare for installation: this method sets the installation directory, finds - * and checks the installation file and verifies the installation type - * - * @access public - * @return boolean True on success - * @since 1.0 - */ - function setupInstall() - { - // We need to find the installation manifest file - if (!$this->_findManifest()) { - return false; - } - - // Load the adapter(s) for the install manifest - $root =& $this->_manifest->document; - $type = $root->attributes('type'); - - // Needed for legacy reasons ... to be deprecated in next minor release - if ($type == 'mambot') { - $type = 'plugin'; - } - - // Lazy load the adapter - if (!isset($this->_adapters[$type]) || !is_object($this->_adapters[$type])) { - if (!$this->setAdapter($type)) { - return false; - } - } - - return true; - } - - /** - * Backward compatible Method to parse through a queries element of the - * installation manifest file and take appropriate action. - * - * @access public - * @param object $element The xml node to process - * @return mixed Number of queries processed or False on error - * @since 1.5 - */ - function parseQueries($element) - { - // Get the database connector object - $db = & $this->_db; - - if (!is_a($element, 'JSimpleXMLElement') || !count($element->children())) { - // Either the tag does not exist or has no children therefore we return zero files processed. - return 0; - } - - // Get the array of query nodes to process - $queries = $element->children(); - if (count($queries) == 0) { - // No queries to process - return 0; - } - - // Process each query in the $queries array (children of $tagName). - foreach ($queries as $query) - { - $db->setQuery($query->data()); - if (!$db->query()) { - JError::raiseWarning(1, 'JInstaller::install: '.JText::_('SQL Error')." ".$db->stderr(true)); - return false; - } - } - return (int) count($queries); - } - - /** - * Method to extract the name of a discreet installation sql file from the installation manifest file. - * - * @access public - * @param object $element The xml node to process - * @param string $version The database connector to use - * @return mixed Number of queries processed or False on error - * @since 1.5 - */ - function parseSQLFiles($element) - { - // Initialize variables - $queries = array(); - $db = & $this->_db; - $dbDriver = strtolower($db->get('name')); - if ($dbDriver == 'mysqli') { - $dbDriver = 'mysql'; - } - $dbCharset = ($db->hasUTF()) ? 'utf8' : ''; - - if (!is_a($element, 'JSimpleXMLElement')) { - // The tag does not exist. - return 0; - } - - // Get the array of file nodes to process - $files = $element->children(); - if (count($files) == 0) { - // No files to process - return 0; - } - - // Get the name of the sql file to process - $sqlfile = ''; - foreach ($files as $file) - { - $fCharset = (strtolower($file->attributes('charset')) == 'utf8') ? 'utf8' : ''; - $fDriver = strtolower($file->attributes('driver')); - if ($fDriver == 'mysqli') { - $fDriver = 'mysql'; - } - - if( $fCharset == $dbCharset && $fDriver == $dbDriver) { - $sqlfile = $file->data(); - // Check that sql files exists before reading. Otherwise raise error for rollback - if ( !file_exists( $this->getPath('extension_administrator').DS.$sqlfile ) ) { - return false; - } - $buffer = file_get_contents($this->getPath('extension_administrator').DS.$sqlfile); - - // Graceful exit and rollback if read not successful - if ( $buffer === false ) { - return false; - } - - // Create an array of queries from the sql file - jimport('joomla.installer.helper'); - $queries = JInstallerHelper::splitSql($buffer); - - if (count($queries) == 0) { - // No queries to process - return 0; - } - - // Process each query in the $queries array (split out of sql file). - foreach ($queries as $query) - { - $query = trim($query); - if ($query != '' && $query{0} != '#') { - $db->setQuery($query); - if (!$db->query()) { - JError::raiseWarning(1, 'JInstaller::install: '.JText::_('SQL Error')." ".$db->stderr(true)); - return false; - } - } - } - } - } - - return (int) count($queries); - } - - /** - * Method to parse through a files element of the installation manifest and take appropriate - * action. - * - * @access public - * @param object $element The xml node to process - * @param int $cid Application ID of application to install to - * @return boolean True on success - * @since 1.5 - */ - function parseFiles($element, $cid=0) - { - // Initialize variables - $copyfiles = array (); - - // Get the client info - jimport('joomla.application.helper'); - $client =& JApplicationHelper::getClientInfo($cid); - - if (!is_a($element, 'JSimpleXMLElement') || !count($element->children())) { - // Either the tag does not exist or has no children therefore we return zero files processed. - return 0; - } - - // Get the array of file nodes to process - $files = $element->children(); - if (count($files) == 0) { - // No files to process - return 0; - } - - /* - * Here we set the folder we are going to remove the files from. - */ - if ($client) { - $pathname = 'extension_'.$client->name; - $destination = $this->getPath($pathname); - } else { - $pathname = 'extension_root'; - $destination = $this->getPath($pathname); - } - - /* - * Here we set the folder we are going to copy the files from. - * - * Does the element have a folder attribute? - * - * If so this indicates that the files are in a subdirectory of the source - * folder and we should append the folder attribute to the source path when - * copying files. - */ - if ($folder = $element->attributes('folder')) { - $source = $this->getPath('source').DS.$folder; - } else { - $source = $this->getPath('source'); - } - - // Process each file in the $files array (children of $tagName). - foreach ($files as $file) - { - $path['src'] = $source.DS.$file->data(); - $path['dest'] = $destination.DS.$file->data(); - - // Is this path a file or folder? - $path['type'] = ( $file->name() == 'folder') ? 'folder' : 'file'; - - /* - * Before we can add a file to the copyfiles array we need to ensure - * that the folder we are copying our file to exits and if it doesn't, - * we need to create it. - */ - if (basename($path['dest']) != $path['dest']) { - $newdir = dirname($path['dest']); - - if (!JFolder::create($newdir)) { - JError::raiseWarning(1, 'JInstaller::install: '.JText::_('Failed to create directory').' "'.$newdir.'"'); - return false; - } - } - - // Add the file to the copyfiles array - $copyfiles[] = $path; - } - - return $this->copyFiles($copyfiles); - } - - /** - * Method to parse through a languages element of the installation manifest and take appropriate - * action. - * - * @access public - * @param object $element The xml node to process - * @param int $cid Application ID of application to install to - * @return boolean True on success - * @since 1.5 - */ - function parseLanguages($element, $cid=0) - { - // Initialize variables - $copyfiles = array (); - - // Get the client info - jimport('joomla.application.helper'); - $client =& JApplicationHelper::getClientInfo($cid); - - if (!is_a($element, 'JSimpleXMLElement') || !count($element->children())) { - // Either the tag does not exist or has no children therefore we return zero files processed. - return 0; - } - - // Get the array of file nodes to process - $files = $element->children(); - if (count($files) == 0) { - // No files to process - return 0; - } - - /* - * Here we set the folder we are going to copy the files to. - * - * 'languages' Files are copied to JPATH_BASE/language/ folder - */ - $destination = $client->path.DS.'language'; - - /* - * Here we set the folder we are going to copy the files from. - * - * Does the element have a folder attribute? - * - * If so this indicates that the files are in a subdirectory of the source - * folder and we should append the folder attribute to the source path when - * copying files. - */ - if ($folder = $element->attributes('folder')) { - $source = $this->getPath('source').DS.$folder; - } else { - $source = $this->getPath('source'); - } - - // Process each file in the $files array (children of $tagName). - foreach ($files as $file) - { - /* - * Language files go in a subfolder based on the language code, ie. - * - * en-US.mycomponent.ini - * - * would go in the en-US subdirectory of the language folder. - * - * We will only install language files where a core language pack - * already exists. - */ - if ($file->attributes('tag') != '') { - $path['src'] = $source.DS.$file->data(); - $path['dest'] = $destination.DS.$file->attributes('tag').DS.basename($file->data()); - - // If the language folder is not present, then the core pack hasn't been installed... ignore - if (!JFolder::exists(dirname($path['dest']))) { - $appl = &JFactory::getApplication(); - $name = JText::_($appl->getName()); - $warning = JText::sprintf('INSTALLER LANG NOT INSTALLED', $file->data(), $name, $file->attributes('tag') ); - JError::raiseNotice(200, 'JInstaller::install: '.$warning); - continue; - } - } else { - $path['src'] = $source.DS.$file->data(); - $path['dest'] = $destination.DS.$file->data(); - } - - /* - * Before we can add a file to the copyfiles array we need to ensure - * that the folder we are copying our file to exits and if it doesn't, - * we need to create it. - */ - if (basename($path['dest']) != $path['dest']) { - $newdir = dirname($path['dest']); - - if (!JFolder::create($newdir)) { - JError::raiseWarning(1, 'JInstaller::install: '.JText::_('Failed to create directory').' "'.$newdir.'"'); - return false; - } - } - - // Add the file to the copyfiles array - $copyfiles[] = $path; - } - - return $this->copyFiles($copyfiles); - } - - /** - * Method to parse through a media element of the installation manifest and take appropriate - * action. - * - * @access public - * @param object $element The xml node to process - * @param int $cid Application ID of application to install to - * @return boolean True on success - * @since 1.5 - */ - function parseMedia($element, $cid=0) - { - // Initialize variables - $copyfiles = array (); - - // Get the client info - jimport('joomla.application.helper'); - $client =& JApplicationHelper::getClientInfo($cid); - - if (!is_a($element, 'JSimpleXMLElement') || !count($element->children())) { - // Either the tag does not exist or has no children therefore we return zero files processed. - return 0; - } - - // Get the array of file nodes to process - $files = $element->children(); - if (count($files) == 0) { - // No files to process - return 0; - } - - /* - * Here we set the folder we are going to copy the files to. - * Default 'media' Files are copied to the JPATH_BASE/images folder - */ - $folder = ($element->attributes('destination')) ? DS.$element->attributes('destination') : null; - $destination = JPath::clean(JPATH_ROOT.DS.'media'.$folder); - - /* - * Here we set the folder we are going to copy the files from. - * - * Does the element have a folder attribute? - * - * If so this indicates that the files are in a subdirectory of the source - * folder and we should append the folder attribute to the source path when - * copying files. - */ - if ($folder = $element->attributes('folder')) { - $source = $this->getPath('source').DS.$folder; - } else { - $source = $this->getPath('source'); - } - - // Process each file in the $files array (children of $tagName). - foreach ($files as $file) - { - $path['src'] = $source.DS.$file->data(); - $path['dest'] = $destination.DS.$file->data(); - - /* - * Before we can add a file to the copyfiles array we need to ensure - * that the folder we are copying our file to exits and if it doesn't, - * we need to create it. - */ - if (basename($path['dest']) != $path['dest']) { - $newdir = dirname($path['dest']); - - if (!JFolder::create($newdir)) { - JError::raiseWarning(1, 'JInstaller::install: '.JText::_('Failed to create directory').' "'.$newdir.'"'); - return false; - } - } - - // Add the file to the copyfiles array - $copyfiles[] = $path; - } - - return $this->copyFiles($copyfiles); - } - - /** - * Method to parse the parameters of an extension, build the INI - * string for it's default parameters, and return the INI string. - * - * @access public - * @return string INI string of parameter values - * @since 1.5 - */ - function getParams() - { - // Get the manifest document root element - $root = & $this->_manifest->document; - - // Get the element of the tag names - $element =& $root->getElementByPath('params'); - if (!is_a($element, 'JSimpleXMLElement') || !count($element->children())) { - // Either the tag does not exist or has no children therefore we return zero files processed. - return null; - } - - // Get the array of parameter nodes to process - $params = $element->children(); - if (count($params) == 0) { - // No params to process - return null; - } - - // Process each parameter in the $params array. - $ini = null; - foreach ($params as $param) { - if (!$name = $param->attributes('name')) { - continue; - } - - if (!$value = $param->attributes('default')) { - continue; - } - - $ini .= $name."=".$value."\n"; - } - return $ini; - } - - /** - * Copy files from source directory to the target directory - * - * @access public - * @param array $files array with filenames - * @param boolean $overwrite True if existing files can be replaced - * @return boolean True on success - * @since 1.5 - */ - function copyFiles($files, $overwrite=null) - { - /* - * To allow for manual override on the overwriting flag, we check to see if - * the $overwrite flag was set and is a boolean value. If not, use the object - * allowOverwrite flag. - */ - if (is_null($overwrite) || !is_bool($overwrite)) { - $overwrite = $this->_overwrite; - } - - /* - * $files must be an array of filenames. Verify that it is an array with - * at least one file to copy. - */ - if (is_array($files) && count($files) > 0) - { - foreach ($files as $file) - { - // Get the source and destination paths - $filesource = JPath::clean($file['src']); - $filedest = JPath::clean($file['dest']); - $filetype = array_key_exists('type', $file) ? $file['type'] : 'file'; - - if (!file_exists($filesource)) { - /* - * The source file does not exist. Nothing to copy so set an error - * and return false. - */ - JError::raiseWarning(1, 'JInstaller::install: '.JText::sprintf('File does not exist', $filesource)); - return false; - } elseif (file_exists($filedest) && !$overwrite) { - - /* - * It's okay if the manifest already exists - */ - if ($this->getPath( 'manifest' ) == $filesource) { - continue; - } - - /* - * The destination file already exists and the overwrite flag is false. - * Set an error and return false. - */ - JError::raiseWarning(1, 'JInstaller::install: '.JText::sprintf('WARNSAME', $filedest)); - return false; - } else { - - // Copy the folder or file to the new location. - if ( $filetype == 'folder') { - - if (!(JFolder::copy($filesource, $filedest, null, $overwrite))) { - JError::raiseWarning(1, 'JInstaller::install: '.JText::sprintf('Failed to copy folder to', $filesource, $filedest)); - return false; - } - - $step = array ('type' => 'folder', 'path' => $filedest); - } else { - - if (!(JFile::copy($filesource, $filedest))) { - JError::raiseWarning(1, 'JInstaller::install: '.JText::sprintf('Failed to copy file to', $filesource, $filedest)); - return false; - } - - $step = array ('type' => 'file', 'path' => $filedest); - } - - /* - * Since we copied a file/folder, we want to add it to the installation step stack so that - * in case we have to roll back the installation we can remove the files copied. - */ - $this->_stepStack[] = $step; - } - } - } else { - - /* - * The $files variable was either not an array or an empty array - */ - return false; - } - return count($files); - } - - /** - * Method to parse through a files element of the installation manifest and remove - * the files that were installed - * - * @access public - * @param object $element The xml node to process - * @param int $cid Application ID of application to remove from - * @return boolean True on success - * @since 1.5 - */ - function removeFiles($element, $cid=0) - { - // Initialize variables - $removefiles = array (); - $retval = true; - - // Get the client info - jimport('joomla.application.helper'); - $client =& JApplicationHelper::getClientInfo($cid); - - if (!is_a($element, 'JSimpleXMLElement') || !count($element->children())) { - // Either the tag does not exist or has no children therefore we return zero files processed. - return true; - } - - // Get the array of file nodes to process - $files = $element->children(); - if (count($files) == 0) { - // No files to process - return true; - } - - /* - * Here we set the folder we are going to remove the files from. There are a few - * special cases that need to be considered for certain reserved tags. - */ - switch ($element->name()) - { - case 'media': - if ($element->attributes('destination')) { - $folder = $element->attributes('destination'); - } else { - $folder = ''; - } - $source = $client->path.DS.'media'.DS.$folder; - break; - - case 'languages': - $source = $client->path.DS.'language'; - break; - - default: - if ($client) { - $pathname = 'extension_'.$client->name; - $source = $this->getPath($pathname); - } else { - $pathname = 'extension_root'; - $source = $this->getPath($pathname); - } - break; - } - - // Process each file in the $files array (children of $tagName). - foreach ($files as $file) - { - /* - * If the file is a language, we must handle it differently. Language files - * go in a subdirectory based on the language code, ie. - * - * en_US.mycomponent.ini - * - * would go in the en_US subdirectory of the languages directory. - */ - if ($file->name() == 'language' && $file->attributes('tag') != '') { - $path = $source.DS.$file->attributes('tag').DS.basename($file->data()); - - // If the language folder is not present, then the core pack hasn't been installed... ignore - if (!JFolder::exists(dirname($path))) { - continue; - } - } else { - $path = $source.DS.$file->data(); - } - - /* - * Actually delete the files/folders - */ - if (is_dir($path)) { - $val = JFolder::delete($path); - } else { - $val = JFile::delete($path); - } - - if ($val === false) { - $retval = false; - } - } - - return $retval; - } - - /** - * Copies the installation manifest file to the extension folder in the given client - * - * @access public - * @param int $cid Where to copy the installfile [optional: defaults to 1 (admin)] - * @return boolean True on success, False on error - * @since 1.5 - */ - function copyManifest($cid=1) - { - // Get the client info - jimport('joomla.application.helper'); - $client =& JApplicationHelper::getClientInfo($cid); - - $path['src'] = $this->getPath('manifest'); - - if ($client) { - $pathname = 'extension_'.$client->name; - $path['dest'] = $this->getPath($pathname).DS.basename($this->getPath('manifest')); - } else { - $pathname = 'extension_root'; - $path['dest'] = $this->getPath($pathname).DS.basename($this->getPath('manifest')); - } - return $this->copyFiles(array ($path), true); - } - - /** - * Tries to find the package manifest file - * - * @access private - * @return boolean True on success, False on error - * @since 1.0 - */ - function _findManifest() - { - // Get an array of all the xml files from teh installation directory - $xmlfiles = JFolder::files($this->getPath('source'), '.xml$', 1, true); - // If at least one xml file exists - if (!empty($xmlfiles)) { - foreach ($xmlfiles as $file) - { - // Is it a valid joomla installation manifest file? - $manifest = $this->_isManifest($file); - if (!is_null($manifest)) { - - // If the root method attribute is set to upgrade, allow file overwrite - $root =& $manifest->document; - if ($root->attributes('method') == 'upgrade') { - $this->_overwrite = true; - } - - // Set the manifest object and path - $this->_manifest =& $manifest; - $this->setPath('manifest', $file); - - // Set the installation source path to that of the manifest file - $this->setPath('source', dirname($file)); - return true; - } - } - - // None of the xml files found were valid install files - JError::raiseWarning(1, 'JInstaller::install: '.JText::_('ERRORNOTFINDJOOMLAXMLSETUPFILE')); - return false; - } else { - // No xml files were found in the install folder - JError::raiseWarning(1, 'JInstaller::install: '.JText::_('ERRORXMLSETUP')); - return false; - } - } - - /** - * Is the xml file a valid Joomla installation manifest file - * - * @access private - * @param string $file An xmlfile path to check - * @return mixed A JSimpleXML document, or null if the file failed to parse - * @since 1.5 - */ - function &_isManifest($file) - { - // Initialize variables - $null = null; - $xml =& JFactory::getXMLParser('Simple'); - - // If we cannot load the xml file return null - if (!$xml->loadFile($file)) { - // Free up xml parser memory and return null - unset ($xml); - return $null; - } - - /* - * Check for a valid XML root tag. - * @todo: Remove backwards compatability in a future version - * Should be 'install', but for backward compatability we will accept 'mosinstall'. - */ - $root =& $xml->document; - if (!is_object($root) || ($root->name() != 'install' && $root->name() != 'mosinstall')) { - // Free up xml parser memory and return null - unset ($xml); - return $null; - } - - // Valid manifest file return the object - return $xml; - } -} \ No newline at end of file + return $tmp; + } + + /** + * Get the database connector object + * + * @access public + * @return object Database connector object + * @since 1.5 + */ + public function &getDBO() + { + return $this->_db; + } + + /** + * Get the installation manifest object + * + * @access public + * @return object Manifest object + * @since 1.5 + */ + public function &getManifest() + { + if (!is_object($this->_manifest)) { + $this->_findManifest(); + } + return $this->_manifest; + } + + /** + * Get an installer path by name + * + * @access public + * @param string $name Path name + * @param string $default Default value + * @return string Path + * @since 1.5 + */ + public function getPath($name, $default=null) + { + return (!empty($this->_paths[$name])) ? $this->_paths[$name] : $default; + } + + /** + * Sets an installer path by name + * + * @access public + * @param string $name Path name + * @param string $value Path + * @return void + * @since 1.5 + */ + public function setPath($name, $value) + { + $this->_paths[$name] = $value; + } + + /** + * Pushes a step onto the installer stack for rolling back steps + * + * @access public + * @param array $step Installer step + * @return void + * @since 1.5 + */ + public function pushStep($step) + { + $this->_stepStack[] = $step; + } + + /** + * Set an installer adapter by name + * + * @access public + * @param string $name Adapter name + * @param object $adapter Installer adapter object + * @return boolean True if successful + * @since 1.5 + */ + public function setAdapter($name, $adapter = null) + { + if (!is_object($adapter)) + { + // Try to load the adapter object + if(file_exists(dirname(__FILE__) . DS . 'adapters' . DS . strtolower($name).'.php')) { + require_once dirname(__FILE__).DS.'adapters'.DS.strtolower($name).'.php'; + } + $class = 'JInstaller'.ucfirst($name); + if(!class_exists($class, true)) { + return false; + } + $adapter = new $class($this); + $adapter->parent =& $this; + } + $this->_adapters[$name] =& $adapter; + return true; + } + + /** + * Installation abort method + * + * @access public + * @param string $msg Abort message from the installer + * @param string $type Package type if defined + * @return boolean True if successful + * @since 1.5 + */ + public function abort($msg=null, $type=null) + { + // Initialize variables + $retval = true; + $step = array_pop($this->_stepStack); + + // Raise abort warning + if ($msg) { + JError::raiseWarning(100, $msg); + } + + while ($step != null) + { + switch ($step['type']) + { + case 'file' : + // remove the file + $stepval = JFile::delete($step['path']); + break; + + case 'folder' : + // remove the folder + $stepval = JFolder::delete($step['path']); + break; + + case 'query' : + // placeholder in case this is necessary in the future + break; + + default : + if ($type && is_object($this->_adapters[$type])) { + // Build the name of the custom rollback method for the type + $method = '_rollback_'.$step['type']; + // Custom rollback method handler + if (method_exists($this->_adapters[$type], $method)) { + $stepval = $this->_adapters[$type]->$method($step); + } + } + break; + } + + // Only set the return value if it is false + if ($stepval === false) { + $retval = false; + } + + // Get the next step and continue + $step = array_pop($this->_stepStack); + } + + return $retval; + } + + /** + * Package installation method + * + * @access public + * @param string $path Path to package source folder + * @return boolean True if successful + * @since 1.5 + */ + public function install($path=null) + { + if ($path && JFolder::exists($path)) { + $this->setPath('source', $path); + } else { + $this->abort(JText::_('Install path does not exist')); + return false; + } + + if (!$this->setupInstall()) { + $this->abort(JText::_('Unable to detect manifest file')); + return false; + } + + /* + * LEGACY CHECK + */ + $root =& $this->_manifest->document; + $version = $root->attributes('version'); + $rootName = $root->name(); + $config = &JFactory::getConfig(); + if ((version_compare($version, '1.5', '<') || $rootName == 'mosinstall' || $type == 'mambot')) { + $this->abort(JText::_('NOTCOMPATIBLE')); + return false; + } + + if ((version_compare($version, '1.6', '<')) && !$config->getValue('config.legacy')) { + $this->abort(JText::_('MUSTENABLELEGACY')); + return false; + } + + $type = $root->attributes('type'); + + if (is_object($this->_adapters[$type])) { + return $this->_adapters[$type]->install(); + } + return false; + } + + /** + * Package update method + * + * @access public + * @param string $path Path to package source folder + * @return boolean True if successful + * @since 1.5 + */ + public function update($path=null) + { + if ($path && JFolder::exists($path)) { + $this->setPath('source', $path); + } else { + $this->abort(JText::_('Update path does not exist')); + } + + if (!$this->setupInstall()) { + return $this->abort(JText::_('Unable to detect manifest file')); + } + + /* + * LEGACY CHECK + */ + $root =& $this->_manifest->document; + $version = $root->attributes('version'); + $rootName = $root->name(); + $config = &JFactory::getConfig(); + if ((version_compare($version, '1.5', '<') || $rootName == 'mosinstall' || $type == 'mambot')) { + $this->abort(JText::_('NOTCOMPATIBLE')); + return false; + } + + if ((version_compare($version, '1.6', '<')) && !$config->getValue('config.legacy')) { + $this->abort(JText::_('MUSTENABLELEGACY')); + return false; + } + + $type = $root->attributes('type'); + + if (is_object($this->_adapters[$type])) { + return $this->_adapters[$type]->update(); + } + return false; + } + + /** + * Package uninstallation method + * + * @access public + * @param string $type Package type + * @param mixed $identifier Package identifier for adapter + * @param int $cid Application ID + * @return boolean True if successful + * @since 1.5 + */ + public function uninstall($type, $identifier, $cid=0) + { + if (!isset($this->_adapters[$type]) || !is_object($this->_adapters[$type])) { + if (!$this->setAdapter($type)) { + return false; + } + } + if (is_object($this->_adapters[$type])) { + return $this->_adapters[$type]->uninstall($identifier, $cid); + } + return false; + } + + /** + * Prepare for installation: this method sets the installation directory, finds + * and checks the installation file and verifies the installation type + * + * @access public + * @return boolean True on success + * @since 1.0 + */ + public function setupInstall() + { + // We need to find the installation manifest file + if (!$this->_findManifest()) { + return false; + } + + // Load the adapter(s) for the install manifest + $root =& $this->_manifest->document; + $type = $root->attributes('type'); + + // Lazy load the adapter + if (!isset($this->_adapters[$type]) || !is_object($this->_adapters[$type])) { + if (!$this->setAdapter($type)) { + return false; + } + } + + return true; + } + + /** + * Backward compatible Method to parse through a queries element of the + * installation manifest file and take appropriate action. + * + * @access public + * @param object $element The xml node to process + * @return mixed Number of queries processed or False on error + * @since 1.5 + */ + public function parseQueries($element) + { + // Get the database connector object + $db = & $this->_db; + + if (!($element INSTANCEOF JSimpleXMLElement) || !count($element->children())) { + // Either the tag does not exist or has no children therefore we return zero files processed. + return 0; + } + + // Get the array of query nodes to process + $queries = $element->children(); + if (count($queries) == 0) { + // No queries to process + return 0; + } + + // Process each query in the $queries array (children of $tagName). + foreach ($queries as $query) + { + $db->setQuery($query->data()); + try { + $db->query(); + } catch(JException $e) { + JError::raiseWarning(1, 'JInstaller::install: '.JText::_('SQL Error')." ".$db->stderr(true)); + return false; + } + } + return (int) count($queries); + } + + /** + * Method to extract the name of a discreet installation sql file from the installation manifest file. + * + * @access public + * @param object $element The xml node to process + * @param string $version The database connector to use + * @return mixed Number of queries processed or False on error + * @since 1.5 + */ + public function parseSQLFiles($element) + { + // Initialize variables + $queries = array(); + $db = & $this->_db; + $dbDriver = strtolower($db->get('name')); + if ($dbDriver == 'mysqli') { + $dbDriver = 'mysql'; + } + $dbCharset = ($db->hasUTF()) ? 'utf8' : ''; + + if (!$element INSTANCEOF JSimpleXMLElement) { + // The tag does not exist. + return 0; + } + + // Get the array of file nodes to process + $files = $element->children(); + if (count($files) == 0) { + // No files to process + return 0; + } + + // Get the name of the sql file to process + $sqlfile = ''; + foreach ($files as $file) + { + $fCharset = (strtolower($file->attributes('charset')) == 'utf8') ? 'utf8' : ''; + $fDriver = strtolower($file->attributes('driver')); + if ($fDriver == 'mysqli') { + $fDriver = 'mysql'; + } + + if( $fCharset == $dbCharset && $fDriver == $dbDriver) { + $sqlfile = $file->data(); + // Check that sql files exists before reading. Otherwise raise error for rollback + if ( !file_exists( $this->getPath('extension_administrator').DS.$sqlfile ) ) { + return false; + } + $buffer = file_get_contents($this->getPath('extension_administrator').DS.$sqlfile); + + // Graceful exit and rollback if read not successful + if ( $buffer === false ) { + return false; + } + + // Create an array of queries from the sql file + jimport('joomla.installer.helper'); + $queries = JInstallerHelper::splitSql($buffer); + + if (count($queries) == 0) { + // No queries to process + return 0; + } + + // Process each query in the $queries array (split out of sql file). + foreach ($queries as $query) + { + $query = trim($query); + if ($query != '' && $query{0} != '#') { + $db->setQuery($query); + try { + $db->query(); + } catch(JException $e) { + JError::raiseWarning(1, 'JInstaller::install: '.JText::_('SQL Error')." ".$db->stderr(true)); + return false; + } + } + } + } + } + + return (int) count($queries); + } + + /** + * Method to parse through a files element of the installation manifest and take appropriate + * action. + * + * @access public + * @param object $element The xml node to process + * @param int $cid Application ID of application to install to + * @return boolean True on success + * @since 1.5 + */ + public function parseFiles($element, $cid=0) + { + // Initialize variables + $copyfiles = array (); + + // Get the client info + jimport('joomla.application.helper'); + $client =& JApplicationHelper::getClientInfo($cid); + + if (!($element INSTANCEOF JSimpleXMLElement) || !count($element->children())) { + // Either the tag does not exist or has no children therefore we return zero files processed. + return 0; + } + + // Get the array of file nodes to process + $files = $element->children(); + if (count($files) == 0) { + // No files to process + return 0; + } + + /* + * Here we set the folder we are going to remove the files from. + */ + if ($client) { + $pathname = 'extension_'.$client->name; + $destination = $this->getPath($pathname); + } else { + $pathname = 'extension_root'; + $destination = $this->getPath($pathname); + } + + /* + * Here we set the folder we are going to copy the files from. + * + * Does the element have a folder attribute? + * + * If so this indicates that the files are in a subdirectory of the source + * folder and we should append the folder attribute to the source path when + * copying files. + */ + if ($folder = $element->attributes('folder')) { + $source = $this->getPath('source').DS.$folder; + } else { + $source = $this->getPath('source'); + } + + // Process each file in the $files array (children of $tagName). + foreach ($files as $file) + { + $path['src'] = $source.DS.$file->data(); + $path['dest'] = $destination.DS.$file->data(); + + // Is this path a file or folder? + $path['type'] = ( $file->name() == 'folder') ? 'folder' : 'file'; + + /* + * Before we can add a file to the copyfiles array we need to ensure + * that the folder we are copying our file to exits and if it doesn't, + * we need to create it. + */ + if (basename($path['dest']) != $path['dest']) { + $newdir = dirname($path['dest']); + + if (!JFolder::create($newdir)) { + JError::raiseWarning(1, 'JInstaller::install: '.JText::_('Failed to create directory').' "'.$newdir.'"'); + return false; + } + } + + // Add the file to the copyfiles array + $copyfiles[] = $path; + } + + return $this->copyFiles($copyfiles); + } + + /** + * Method to parse through a languages element of the installation manifest and take appropriate + * action. + * + * @access public + * @param object $element The xml node to process + * @param int $cid Application ID of application to install to + * @return boolean True on success + * @since 1.5 + */ + public function parseLanguages($element, $cid=0) + { + // Initialize variables + $copyfiles = array (); + + // Get the client info + jimport('joomla.application.helper'); + $client =& JApplicationHelper::getClientInfo($cid); + + if (!($element INSTANCEOF JSimpleXMLElement) || !count($element->children())) { + // Either the tag does not exist or has no children therefore we return zero files processed. + return 0; + } + + // Get the array of file nodes to process + $files = $element->children(); + if (count($files) == 0) { + // No files to process + return 0; + } + + /* + * Here we set the folder we are going to copy the files to. + * + * 'languages' Files are copied to JPATH_BASE/language/ folder + */ + $destination = $client->path.DS.'language'; + + /* + * Here we set the folder we are going to copy the files from. + * + * Does the element have a folder attribute? + * + * If so this indicates that the files are in a subdirectory of the source + * folder and we should append the folder attribute to the source path when + * copying files. + */ + if ($folder = $element->attributes('folder')) { + $source = $this->getPath('source').DS.$folder; + } else { + $source = $this->getPath('source'); + } + + // Process each file in the $files array (children of $tagName). + foreach ($files as $file) + { + /* + * Language files go in a subfolder based on the language code, ie. + * + * en-US.mycomponent.ini + * + * would go in the en-US subdirectory of the language folder. + * + * We will only install language files where a core language pack + * already exists. + */ + if ($file->attributes('tag') != '') { + $path['src'] = $source.DS.$file->data(); + $path['dest'] = $destination.DS.$file->attributes('tag').DS.basename($file->data()); + + // If the language folder is not present, then the core pack hasn't been installed... ignore + if (!JFolder::exists(dirname($path['dest']))) { + continue; + } + } else { + $path['src'] = $source.DS.$file->data(); + $path['dest'] = $destination.DS.$file->data(); + } + + /* + * Before we can add a file to the copyfiles array we need to ensure + * that the folder we are copying our file to exits and if it doesn't, + * we need to create it. + */ + if (basename($path['dest']) != $path['dest']) { + $newdir = dirname($path['dest']); + + if (!JFolder::create($newdir)) { + JError::raiseWarning(1, 'JInstaller::install: '.JText::_('Failed to create directory').' "'.$newdir.'"'); + return false; + } + } + + // Add the file to the copyfiles array + $copyfiles[] = $path; + } + + return $this->copyFiles($copyfiles); + } + + /** + * Method to parse through a media element of the installation manifest and take appropriate + * action. + * + * @access public + * @param object $element The xml node to process + * @param int $cid Application ID of application to install to + * @return boolean True on success + * @since 1.5 + */ + public function parseMedia($element, $cid=0) + { + // Initialize variables + $copyfiles = array (); + + // Get the client info + jimport('joomla.application.helper'); + $client =& JApplicationHelper::getClientInfo($cid); + + if (!($element INSTANCEOF JSimpleXMLElement) || !count($element->children())) { + // Either the tag does not exist or has no children therefore we return zero files processed. + return 0; + } + + // Get the array of file nodes to process + $files = $element->children(); + if (count($files) == 0) { + // No files to process + return 0; + } + + /* + * Here we set the folder we are going to copy the files to. + * Default 'media' Files are copied to the JPATH_BASE/images folder + */ + $folder = ($element->attributes('destination')) ? DS.$element->attributes('destination') : null; + $destination = JPath::clean(JPATH_ROOT.DS.'media'.$folder); + + /* + * Here we set the folder we are going to copy the files from. + * + * Does the element have a folder attribute? + * + * If so this indicates that the files are in a subdirectory of the source + * folder and we should append the folder attribute to the source path when + * copying files. + */ + if ($folder = $element->attributes('folder')) { + $source = $this->getPath('source').DS.$folder; + } else { + $source = $this->getPath('source'); + } + + // Process each file in the $files array (children of $tagName). + foreach ($files as $file) + { + $path['src'] = $source.DS.$file->data(); + $path['dest'] = $destination.DS.$file->data(); + + // Is this path a file or folder? + $path['type'] = ( $file->name() == 'folder') ? 'folder' : 'file'; + + /* + * Before we can add a file to the copyfiles array we need to ensure + * that the folder we are copying our file to exits and if it doesn't, + * we need to create it. + */ + if (basename($path['dest']) != $path['dest']) { + $newdir = dirname($path['dest']); + + if (!JFolder::create($newdir)) { + JError::raiseWarning(1, 'JInstaller::install: '.JText::_('Failed to create directory').' "'.$newdir.'"'); + return false; + } + } + + // Add the file to the copyfiles array + $copyfiles[] = $path; + } + + return $this->copyFiles($copyfiles); + } + + /** + * Method to parse the parameters of an extension, build the INI + * string for it's default parameters, and return the INI string. + * + * @access public + * @return string INI string of parameter values + * @since 1.5 + */ + public function getParams() + { + // Get the manifest document root element + $root = & $this->_manifest->document; + + // Get the element of the tag names + $element =& $root->getElementByPath('params'); + if (!($element INSTANCEOF JSimpleXMLElement) || !count($element->children())) { + // Either the tag does not exist or has no children therefore we return zero files processed. + return null; + } + + // Get the array of parameter nodes to process + $params = $element->children(); + if (count($params) == 0) { + // No params to process + return null; + } + + // Process each parameter in the $params array. + $ini = null; + foreach ($params as $param) { + if (!$name = $param->attributes('name')) { + continue; + } + + if (!$value = $param->attributes('default')) { + continue; + } + + $ini .= $name."=".$value."\n"; + } + return $ini; + } + + /** + * Copy files from source directory to the target directory + * + * @access public + * @param array $files array with filenames + * @param boolean $overwrite True if existing files can be replaced + * @return boolean True on success + * @since 1.5 + */ + public function copyFiles($files, $overwrite=null) + { + /* + * To allow for manual override on the overwriting flag, we check to see if + * the $overwrite flag was set and is a boolean value. If not, use the object + * allowOverwrite flag. + */ + if (is_null($overwrite) || !is_bool($overwrite)) { + $overwrite = $this->_overwrite; + } + + /* + * $files must be an array of filenames. Verify that it is an array with + * at least one file to copy. + */ + if (is_array($files) && count($files) > 0) + { + foreach ($files as $file) + { + // Get the source and destination paths + $filesource = JPath::clean($file['src']); + $filedest = JPath::clean($file['dest']); + $filetype = array_key_exists('type', $file) ? $file['type'] : 'file'; + + if (!file_exists($filesource)) { + /* + * The source file does not exist. Nothing to copy so set an error + * and return false. + */ + JError::raiseWarning(1, 'JInstaller::install: '.JText::sprintf('File does not exist', $filesource)); + return false; + } elseif (file_exists($filedest) && !$overwrite) { + + /* + * It's okay if the manifest already exists + */ + if ($this->getPath( 'manifest' ) == $filesource) { + continue; + } + + /* + * The destination file already exists and the overwrite flag is false. + * Set an error and return false. + */ + JError::raiseWarning(1, 'JInstaller::install: '.JText::sprintf('WARNSAME', $filedest)); + return false; + } else { + + // Copy the folder or file to the new location. + if ( $filetype == 'folder') { + + if (!(JFolder::copy($filesource, $filedest, null, $overwrite))) { + JError::raiseWarning(1, 'JInstaller::install: '.JText::sprintf('Failed to copy folder to', $filesource, $filedest)); + return false; + } + + $step = array ('type' => 'folder', 'path' => $filedest); + } else { + + if (!(JFile::copy($filesource, $filedest))) { + JError::raiseWarning(1, 'JInstaller::install: '.JText::sprintf('Failed to copy file to', $filesource, $filedest)); + return false; + } + + $step = array ('type' => 'file', 'path' => $filedest); + } + + /* + * Since we copied a file/folder, we want to add it to the installation step stack so that + * in case we have to roll back the installation we can remove the files copied. + */ + $this->_stepStack[] = $step; + } + } + } else { + + /* + * The $files variable was either not an array or an empty array + */ + return false; + } + return count($files); + } + + /** + * Method to parse through a files element of the installation manifest and remove + * the files that were installed + * + * @access public + * @param object $element The xml node to process + * @param int $cid Application ID of application to remove from + * @return boolean True on success + * @since 1.5 + */ + public function removeFiles($element, $cid=0) + { + // Initialize variables + $removefiles = array (); + $retval = true; + + // Get the client info + jimport('joomla.application.helper'); + $client =& JApplicationHelper::getClientInfo($cid); + + if (!($element INSTANCEOF JSimpleXMLElement) || !count($element->children())) { + // Either the tag does not exist or has no children therefore we return zero files processed. + return true; + } + + // Get the array of file nodes to process + $files = $element->children(); + if (count($files) == 0) { + // No files to process + return true; + } + + /* + * Here we set the folder we are going to remove the files from. There are a few + * special cases that need to be considered for certain reserved tags. + */ + switch ($element->name()) + { + case 'media': + if ($element->attributes('destination')) { + $folder = $element->attributes('destination'); + } else { + $folder = ''; + } + $source = $client->path.DS.'media'.DS.$folder; + break; + + case 'languages': + $source = $client->path.DS.'language'; + break; + + default: + if ($client) { + $pathname = 'extension_'.$client->name; + $source = $this->getPath($pathname); + } else { + $pathname = 'extension_root'; + $source = $this->getPath($pathname); + } + break; + } + + // Process each file in the $files array (children of $tagName). + foreach ($files as $file) + { + /* + * If the file is a language, we must handle it differently. Language files + * go in a subdirectory based on the language code, ie. + * + * en_US.mycomponent.ini + * + * would go in the en_US subdirectory of the languages directory. + */ + if ($file->name() == 'language' && $file->attributes('tag') != '') { + $path = $source.DS.$file->attributes('tag').DS.basename($file->data()); + + // If the language folder is not present, then the core pack hasn't been installed... ignore + if (!JFolder::exists(dirname($path))) { + continue; + } + } else { + $path = $source.DS.$file->data(); + } + + /* + * Actually delete the files/folders + */ + if (is_dir($path)) { + $val = JFolder::delete($path); + } else { + $val = JFile::delete($path); + } + + if ($val === false) { + $retval = false; + } + } + + return $retval; + } + + /** + * Copies the installation manifest file to the extension folder in the given client + * + * @access public + * @param int $cid Where to copy the installfile [optional: defaults to 1 (admin)] + * @return boolean True on success, False on error + * @since 1.5 + */ + public function copyManifest($cid=1) + { + // Get the client info + jimport('joomla.application.helper'); + $client =& JApplicationHelper::getClientInfo($cid); + + $path['src'] = $this->getPath('manifest'); + + if ($client) { + $pathname = 'extension_'.$client->name; + $path['dest'] = $this->getPath($pathname).DS.basename($this->getPath('manifest')); + } else { + $pathname = 'extension_root'; + $path['dest'] = $this->getPath($pathname).DS.basename($this->getPath('manifest')); + } + return $this->copyFiles(array ($path), true); + } + + /** + * Tries to find the package manifest file + * + * @access private + * @return boolean True on success, False on error + * @since 1.0 + */ + protected function _findManifest() + { + // Get an array of all the xml files from teh installation directory + $xmlfiles = JFolder::files($this->getPath('source'), '.xml$', 1, true); + // If at least one xml file exists + if (!empty($xmlfiles)) { + foreach ($xmlfiles as $file) + { + // Is it a valid joomla installation manifest file? + $manifest = $this->_isManifest($file); + if (!is_null($manifest)) { + + // If the root method attribute is set to upgrade, allow file overwrite + $root =& $manifest->document; + if ($root->attributes('method') == 'upgrade') { + $this->_overwrite = true; + } + + // Set the manifest object and path + $this->_manifest =& $manifest; + $this->setPath('manifest', $file); + + // Set the installation source path to that of the manifest file + $this->setPath('source', dirname($file)); + return true; + } + } + + // None of the xml files found were valid install files + JError::raiseWarning(1, 'JInstaller::install: '.JText::_('ERRORNOTFINDJOOMLAXMLSETUPFILE')); + return false; + } else { + // No xml files were found in the install folder + JError::raiseWarning(1, 'JInstaller::install: '.JText::_('ERRORXMLSETUP')); + return false; + } + } + + /** + * Is the xml file a valid Joomla installation manifest file + * + * @access private + * @param string $file An xmlfile path to check + * @return mixed A JSimpleXML document, or null if the file failed to parse + * @since 1.5 + */ + protected function &_isManifest($file) + { + // Initialize variables + $null = null; + $xml =& JFactory::getXMLParser('Simple'); + + // If we cannot load the xml file return null + if (!$xml->loadFile($file)) { + // Free up xml parser memory and return null + unset ($xml); + return $null; + } + + /* + * Check for a valid XML root tag. + * @todo: Remove backwards compatability in a future version + * Should be 'install', but for backward compatability we will accept 'mosinstall'. + */ + $root =& $xml->document; + if (!is_object($root) || ($root->name() != 'install' && $root->name() != 'mosinstall')) { + // Free up xml parser memory and return null + unset ($xml); + return $null; + } + + // Valid manifest file return the object + return $xml; + } +} diff --git a/libraries/joomla/language/help.php b/libraries/joomla/language/help.php index f02d45407a6de..be9555a317113 100644 --- a/libraries/joomla/language/help.php +++ b/libraries/joomla/language/help.php @@ -1,145 +1,146 @@ -getParam( 'helpsite' ); - $globalHelpUrl = $mainframe->getCfg('helpurl'); - $lang =& JFactory::getLanguage(); - - if ($useComponent) - { - if (!eregi( '\.html$', $ref )) { - $ref = $ref . '.html'; - } - - $url = 'components/' . $option. '/help'; - $tag = $lang->getTag(); - - // Check if the file exists within a different language! - if( $lang->getTag() != 'en-GB' ) { - $localeURL = JPATH_BASE.DS.$url.DS.$tag.DS.$ref; - jimport( 'joomla.filesystem.file' ); - if( !JFile::exists( $localeURL ) ) { - $tag = 'en-GB'; - } - } - return $url.'/'.$tag.'/'.$ref; - } - - - if ( $userHelpUrl ) - { - // Online help site as defined in GC - $version = new JVersion(); - $ref .= $version->getHelpVersion(); - $url = $userHelpUrl . '/index2.php?option=com_content&task=findkey&tmpl=component&keyref=' . urlencode( $ref ); - } - else if ( $globalHelpUrl ) - { - // Online help site as defined in GC - $version = new JVersion(); - $ref .= $version->getHelpVersion(); - $url = $globalHelpUrl . '/index2.php?option=com_content&task=findkey&tmpl=component;1&keyref=' . urlencode( $ref ); - } - else - { - // Included html help files - $helpURL = 'help/' .$lang->getTag() .'/'; - - if (!eregi( '\.html$', $ref )) { - $ref = $ref . '.html'; - } - - // Check if the file exists within a different language! - if( $lang->getTag() != 'en-GB' ) { - $localeURL = JPATH_BASE . $helpURL .$ref; - jimport( 'joomla.filesystem.file' ); - if( !JFile::exists( $localeURL ) ) { - $helpURL = 'help/en-GB/'; - } - } - $url = $helpURL . $ref; - } - - return $url; - } - - /** - * Builds a list of the help sites which can be used in a select option - * - * @param string Path to an xml file - * @param string Language tag to select (if exists) - * @param array An array of arrays ( text, value, selected ) - */ - function createSiteList($pathToXml, $selected = null) - { - $list = array (); - $xml =& JFactory::getXMLParser('Simple'); - $data = null; - if( !empty( $pathToXml ) ) { - $data = file_get_contents($pathToXml); - } - - if(empty($data)) - { - $option['text'] = 'English (GB) help.joomla.org'; - $option['value'] = 'http://help.joomla.org'; - $list[] = $option; - } - else - { - if($xml->loadString($data)) - { - // Are there any languages?? - $elmSites = & $xml->document->sites[0]; - - if (is_object($elmSites)) { - - $option = array (); - $sites = $elmSites->children(); - foreach ($sites as $site) - { - $text = $site->data(); - $url = $site->attributes('url'); - $option['text'] = $text; - $option['value'] = $url; - $list[] = $option; - } - } - } - } - - return $list; - } -} +getParam( 'helpsite' ); + $globalHelpUrl = $appl->getCfg('helpurl'); + $lang = JFactory::getLanguage(); + + if ($useComponent) + { + if (!eregi( '\.html$', $ref )) { + $ref = $ref . '.html'; + } + + $url = 'components/' . $component. '/help'; + $tag = $lang->getTag(); + + // Check if the file exists within a different language! + if( $lang->getTag() != 'en-GB' ) { + $localeURL = JPATH_BASE.DS.$url.DS.$tag.DS.$ref; + jimport( 'joomla.filesystem.file' ); + if( !JFile::exists( $localeURL ) ) { + $tag = 'en-GB'; + } + } + return $url.'/'.$tag.'/'.$ref; + } + + + if ( $userHelpUrl ) + { + // Online help site as defined in GC + $version = new JVersion(); + $ref .= $version->getHelpVersion(); + $url = $userHelpUrl . '/index2.php?option=com_content&task=findkey&tmpl=component&keyref=' . urlencode( $ref ); + } + else if ( $globalHelpUrl ) + { + // Online help site as defined in GC + $version = new JVersion(); + $ref .= $version->getHelpVersion(); + $url = $globalHelpUrl . '/index2.php?option=com_content&task=findkey&tmpl=component;1&keyref=' . urlencode( $ref ); + } + else + { + // Included html help files + $helpURL = 'help/' .$lang->getTag() .'/'; + + if (!eregi( '\.html$', $ref )) { + $ref = $ref . '.html'; + } + + // Check if the file exists within a different language! + if( $lang->getTag() != 'en-GB' ) { + $localeURL = JPATH_BASE . $helpURL .$ref; + jimport( 'joomla.filesystem.file' ); + if( !JFile::exists( $localeURL ) ) { + $helpURL = 'help/en-GB/'; + } + } + $url = $helpURL . $ref; + } + + return $url; + } + + /** + * Builds a list of the help sites which can be used in a select option + * + * @param string Path to an xml file + * @param string Language tag to select (if exists) + * @param array An array of arrays ( text, value, selected ) + */ + public static function createSiteList($pathToXml, $selected = null) + { + $list = array (); + $xml = JFactory::getXMLParser('Simple'); + $data = null; + if( !empty( $pathToXml ) ) { + $data = file_get_contents($pathToXml); + } + + if(empty($data)) + { + $option['text'] = 'English (GB) help.joomla.org'; + $option['value'] = 'http://help.joomla.org'; + $list[] = $option; + } + else + { + if($xml->loadString($data)) + { + // Are there any languages?? + $elmSites = & $xml->document->sites[0]; + + if (is_object($elmSites)) { + + $option = array (); + $sites = $elmSites->children(); + foreach ($sites as $site) + { + $text = $site->data(); + $url = $site->attributes('url'); + $option['text'] = $text; + $option['value'] = $url; + $list[] = $option; + } + } + } + } + + return $list; + } +} diff --git a/libraries/joomla/language/helper.php b/libraries/joomla/language/helper.php index fd258685125c8..465c318858c3b 100644 --- a/libraries/joomla/language/helper.php +++ b/libraries/joomla/language/helper.php @@ -1,95 +1,95 @@ - $metadata) - { - $option = array (); - - $option['text'] = $metadata['name']; - $option['value'] = $lang; - if ($lang == $actualLanguage) { - $option['selected'] = 'selected="selected"'; - } - $list[] = $option; - } - - return $list; - } - - /** - * Tries to detect the language - * + * @since 1.5 + */ + public function createLanguageList($actualLanguage, $basePath = JPATH_BASE, $caching = false) + { + $list = array (); + + // cache activation + $langs = JLanguage::getKnownLanguages($basePath); + + foreach ($langs as $lang => $metadata) + { + $option = array (); + + $option['text'] = $metadata['name']; + $option['value'] = $lang; + if ($lang == $actualLanguage) { + $option['selected'] = 'selected="selected"'; + } + $list[] = $option; + } + + return $list; + } + + /** + * Tries to detect the language + * * @access public * @return string locale - * @since 1.5 - */ - function detectLanguage() - { - if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) - { - $systemLangs = JLanguage::getKnownLanguages(); - $browserLangs = explode( ',', $_SERVER['HTTP_ACCEPT_LANGUAGE'] ); - - foreach ($browserLangs as $browserLang) - { - // slice out the part before ; on first step, the part before - on second, place into array - $browserLang = substr( $browserLang, 0, strcspn( $browserLang, ';' ) ); - $primary_browserLang = substr( $browserLang, 0, 2 ); - - foreach($systemLangs as $systemLang => $metadata) - { - if (strtolower($browserLang) == strtolower(substr($metadata['tag'], 0, strlen($browserLang)))) { - return $systemLang; - } elseif ($primary_browserLang == substr($metadata['tag'], 0, 2)) { - $primaryDetectedLang = $systemLang; - } - } - - if (isset($primaryDetectedLang)) { - return $primaryDetectedLang; - } - } - } - - return 'en-GB'; + * @since 1.5 + */ + public function detectLanguage() + { + if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) + { + $systemLangs = JLanguage::getKnownLanguages(); + $browserLangs = explode( ',', $_SERVER['HTTP_ACCEPT_LANGUAGE'] ); + + foreach ($browserLangs as $browserLang) + { + // slice out the part before ; on first step, the part before - on second, place into array + $browserLang = substr( $browserLang, 0, strcspn( $browserLang, ';' ) ); + $primary_browserLang = substr( $browserLang, 0, 2 ); + + foreach($systemLangs as $systemLang => $metadata) + { + if (strtolower($browserLang) == strtolower(substr($metadata['tag'], 0, strlen($browserLang)))) { + return $systemLang; + } elseif ($primary_browserLang == substr($metadata['tag'], 0, 2)) { + $primaryDetectedLang = $systemLang; + } + } + + if (isset($primaryDetectedLang)) { + return $primaryDetectedLang; + } + } + } + + return 'en-GB'; } - + } diff --git a/libraries/joomla/language/index.html b/libraries/joomla/language/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/language/index.html +++ b/libraries/joomla/language/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/language/language.php b/libraries/joomla/language/language.php index 889a99e8249bc..c0e04192ace4e 100644 --- a/libraries/joomla/language/language.php +++ b/libraries/joomla/language/language.php @@ -1,773 +1,747 @@ -_strings = array (); - - if ( $lang == null ) { - $lang = $this->_default; + protected $_used = array(); + + /** + * Constructor activating the default information of the language. + */ + protected function __construct($lang = null) + { + $this->_strings = array(); + if ($lang == null) { + $lang = $this->_default; } + $this->setLanguage($lang); + $this->load(); + } - $this->setLanguage($lang); - - $this->load(); - } - - /** - * Returns a reference to a language object - * - * This method must be invoked as: - *
        $browser = &JLanguage::getInstance([$lang);
      - * - * @access public - * @param string $lang The language to use. + /** + * Returns a reference to a language object. + * + * This method must be invoked as: + *
        $browser = &JLanguage::getInstance([$lang);
      + * + * @param string The language to use. * @return JLanguage The Language object. - * @since 1.5 - */ - function & getInstance($lang) - { - $instance = new JLanguage($lang); - $reference = & $instance; - return $reference; - } - - /** - * Translate function, mimics the php gettext (alias _) function - * - * @access public - * @param string $string The string to translate - * @param boolean $jsSafe Make the result javascript safe - * @return string The translation of the string - * @since 1.5 - */ - function _($string, $jsSafe = false) - { - //$key = str_replace( ' ', '_', strtoupper( trim( $string ) ) );echo '
      '.$key; - $key = strtoupper($string); - $key = substr($key, 0, 1) == '_' ? substr($key, 1) : $key; - - if (isset ($this->_strings[$key])) - { - $string = $this->_debug ? "•".$this->_strings[$key]."•" : $this->_strings[$key]; + * @since 1.5 + */ + public static function &getInstance($lang) + { + $instance = new JLanguage($lang); + $reference = &$instance; + return $reference; + } + + /** + * Translate function, mimics the php gettext (alias _) function. + * + * @param string The string to translate. + * @param boolean Make the result javascript safe. + * @return string The translation of the string. + * @since 1.5 + */ + public function _($string, $jsSafe = false) + { + //$key = str_replace(' ', '_', strtoupper(trim($string)));echo '
      '.$key; + $key = strtoupper($string); + $key = substr($key, 0, 1) == '_' ? substr($key, 1) : $key; + + if (isset ($this->_strings[$key])) + { + $string = $this->_strings[$key]; // Store debug information - if ( $this->_debug ) + if ($this->_debug) { + $string = '•' . $string . '•'; $caller = $this->_getCallerInfo(); - if ( ! array_key_exists($key, $this->_used ) ) { + if (! array_key_exists($key, $this->_used)) { $this->_used[$key] = array(); } $this->_used[$key][] = $caller; } - - } - else - { - if (defined($string)) - { - $string = $this->_debug ? '!!'.constant($string).'!!' : constant($string); + + } else { + if (defined($string)) + { + $string = constant($string); // Store debug information - if ( $this->_debug ) + if ($this->_debug) { + $string = '!!' . $string . '!!'; $caller = $this->_getCallerInfo(); - if ( ! array_key_exists($key, $this->_used ) ) { + if (! array_key_exists($key, $this->_used)) { $this->_used[$key] = array(); } $this->_used[$key][] = $caller; - } - } - else - { - if ($this->_debug) + } + } else { + if ($this->_debug) { - $string = '??'.$string.'??'; - $caller = $this->_getCallerInfo(); + $caller['string'] = $string; - if ( ! array_key_exists($key, $this->_orphans ) ) { + if (! array_key_exists($key, $this->_orphans)) { $this->_orphans[$key] = array(); } - - $this->_orphans[$key][] = $caller; - } - } - } - - if ($jsSafe) { - $string = addslashes($string); - } - - return $string; - } - - /** - * Transliterate function - * - * This method processes a string and replaces all accented UTF-8 characters by unaccented - * ASCII-7 "equivalents" - * - * @access public - * @param string $string The string to transliterate - * @return string The transliteration of the string - * @since 1.5 - */ - function transliterate($string) - { - $string = htmlentities(utf8_decode($string)); - $string = preg_replace( - array('/ß/','/&(..)lig;/', '/&([aouAOU])uml;/','/&(.)[^;]*;/'), - array('ss',"$1","$1".'e',"$1"), - $string); - - return $string; - } - - /** - * Check if a language exists - * - * This is a simple, quick check for the directory that should contain language files for the given user. - * - * @access public - * @param string $lang Language to check - * @param string $basePath Optional path to check - * @return boolean True if the language exists + + $this->_orphans[$key][] = $caller; + + $string = '??'.$string.'??'; + } + } + } + + if ($jsSafe) { + $string = addslashes($string); + } + + return $string; + } + + /** + * Transliterate function. + * + * This method processes a string and replaces all accented UTF-8 characters + * by unaccented ASCII-7 "equivalents". + * + * @param string The string to transliterate. + * @return string The transliteration of the string. + * @since 1.5 + */ + public function transliterate($string) + { + $string = htmlentities(utf8_decode($string)); + $string = preg_replace( + array('/ß/','/&(..)lig;/', '/&([aouAOU])uml;/','/&(.)[^;]*;/'), + array('ss',"$1","$1".'e',"$1"), + $string + ); + return $string; + } + + /** + * Check if a language exists. + * + * This is a simple, quick check for the directory that should contain + * language files for the given user. + * + * @param string Language to check. + * @param string Optional path to check. + * @return boolean True if the language exists. * @since 1.5 */ - function exists($lang, $basePath = JPATH_BASE) + public static function exists($lang, $basePath = JPATH_BASE) { - static $paths = array(); + static $paths = array(); // Return false if no language was specified - if ( ! $lang ) { + if (! $lang) { return false; } - $path = $basePath.DS.'language'.DS.$lang; + $path = $basePath . DS . 'language' . DS . $lang; // Return previous check results if it exists - if ( isset($paths[$path]) ) - { + if (isset($paths[$path])) { return $paths[$path]; } // Check if the language exists jimport('joomla.filesystem.folder'); - $paths[$path] = JFolder::exists($path); + $paths[$path] = JFolder::exists($path); return $paths[$path]; } - - /** - * Loads a single language file and appends the results to the existing strings - * - * @access public - * @param string $extension The extension for which a language file should be loaded - * @param string $basePath The basepath to use - * @param string $lang The language to load, default null for the current language - * @param boolean $reload Flag that will force a language to be reloaded if set to true + + /** + * Loads a single language file and appends the results to the existing + * strings. + * + * @param string The extension for which a language file should be + * loaded. + * @param string The basepath to use. + * @param string The language to load, default null for the current + * language. + * @param boolean Flag that will force a language to be reloaded if set to + * true. * @return boolean True, if the file has successfully loaded. - * @since 1.5 - */ - function load( $extension = 'joomla', $basePath = JPATH_BASE, $lang = null, $reload = false ) - { - if ( ! $lang ) { + * @since 1.5 + */ + function load( + $extension = 'joomla', $basePath = JPATH_BASE, $lang = null, $reload = false + ) { + if (! $lang) { $lang = $this->_lang; } - $path = JLanguage::getLanguagePath( $basePath, $lang); - - $filename = ( $extension == 'joomla' ) ? $lang : $lang . '.' . $extension ; - $filename = $path.DS.$filename.'.ini'; - - $result = false; - if (isset( $this->_paths[$extension][$filename] ) && ! $reload ) + $path = JLanguage::getLanguagePath($basePath, $lang); + + $internal = $extension == 'joomla' || $extension == ''; + $filename = $internal ? $lang : $lang . '.' . $extension; + $filename = $path . DS . $filename . '.ini'; + + $result = false; + if (isset($this->_paths[$extension][$filename]) && ! $reload) { - // Strings for this file have already been loaded - $result = true; - } - else - { - // Load the language file - $result = $this->_load( $filename, $extension ); + // Strings for this file have already been loaded + $result = true; + } else { + // Load the language file + $result = $this->_load($filename, $extension); // Check if there was a problem with loading the file - if ( $result === false ) + if ($result === false) { // No strings, which probably means that the language file does not exist - $path = JLanguage::getLanguagePath( $basePath, $this->_default); - $filename = ( $extension == 'joomla' ) ? $this->_default : $this->_default . '.' . $extension ; - $filename = $path.DS.$filename.'.ini'; + $path = JLanguage::getLanguagePath($basePath, $this->_default); + $filename = $internal ? $this->_default : $this->_default . '.' . $extension; + $filename = $path . DS . $filename . '.ini'; - $result = $this->_load( $filename, $extension ); + $result = $this->_load($filename, $extension, false); } - - } - - return $result; - - } - - /** - * Loads a language file + } + return $result; + } + + /** + * Loads a language file. * - * This method will not note the successful loading of a file - use load() instead - * - * @access private - * @param string The name of the file - * @param string The name of the extension - * @return boolean True if new strings have been added to the language + * This method will not note the successful loading of a file - use load() + * instead. + * + * @param string The name of the file. + * @param string The name of the extension. + * @return boolean True if new strings have been added to the language. * @see JLanguage::load() - * @since 1.5 - */ - function _load( $filename, $extension = 'unknown' ) + * @since 1.5 + */ + function _load($filename, $extension = 'unknown', $overwrite = true) { $result = false; - - if ($content = @file_get_contents( $filename )) - { - $registry = new JRegistry(); - $registry->loadINI($content); - $newStrings = $registry->toArray( ); - - if ( is_array( $newStrings) ) + + if ($content = @file_get_contents($filename)) + { + $registry = new JRegistry(); + $registry->loadINI($content); + $newStrings = $registry->toArray(); + + if (is_array($newStrings)) { - $this->_strings = array_merge( $this->_strings, $newStrings); + $this->_strings = $overwrite ? array_merge($this->_strings, $newStrings) + : array_merge($newStrings, $this->_strings); $result = true; - } - } + } + } // Record the result of loading the extension's file. - if ( ! isset($this->_paths[$extension])) { + if (! isset($this->_paths[$extension])) { $this->_paths[$extension] = array(); } - $this->_paths[$extension][$filename] = $result; - - return $result; - } - - /** - * Get a matadata language property - * - * @access public - * @param string $property The name of the property - * @param mixed $default The default value - * @return mixed The value of the property - * @since 1.5 - */ - function get($property, $default = null) - { - if (isset ($this->_metadata[$property])) { - return $this->_metadata[$property]; - } - return $default; - } - - /** - * Determine who called JLanguage or JText - * - * @access private - * @return array Caller information + $this->_paths[$extension][$filename] = $result; + + return $result; + } + + /** + * Get a metadata language property. + * + * @param string The name of the property. + * @param mixed The default value. + * @return mixed The value of the property. + * @since 1.5 + */ + function get($property, $default = null) + { + if (isset ($this->_metadata[$property])) { + return $this->_metadata[$property]; + } + return $default; + } + + /** + * Determine who called JLanguage or JText. + * + * @return array Caller information. * @since 1.5 */ function _getCallerInfo() { - // Try to determine the source if none was provided - if ( ! function_exists('debug_backtrace') || extension_loaded('Zend Optimizer') ) { + // Try to determine the source if none was provided + if (!function_exists('debug_backtrace')) { return null; } - $backtrace = debug_backtrace(); - $info = array(); + $backtrace = debug_backtrace(); + $info = array(); // Search through the backtrace to our caller $continue = true; - while ( $continue && next($backtrace) ) + while ($continue && next($backtrace)) { - $step = current($backtrace); - $class = @ $step['class']; + $step = current($backtrace); + $class = @$step['class']; // We're looking for something outside of language.php - if ( $class != 'JLanguage' && $class != 'JText') { - $info['function'] = @ $step['function']; - $info['class'] = $class; - $info['step'] = prev($backtrace); + if ($class != 'JLanguage' && $class != 'JText') { + $info['function'] = @$step['function']; + $info['class'] = $class; + $info['step'] = prev($backtrace); // Determine the file and name of the file - $info['file'] = @ $step['file']; - $info['line'] = @ $step['line']; + $info['file'] = @$step['file']; + $info['line'] = @$step['line']; $continue = false; } } return $info; - } - - /** - * Getter for Name - * - * @access public - * @return string Official name element of the language - * @since 1.5 - */ - function getName() { - return $this->_metadata['name']; } /** - * Get a list of language files that have been loaded + * Getter for Name. + * + * @return string Official name element of the language. + * @since 1.5 + */ + public function getName() { + return $this->_metadata['name']; + } + + /** + * Get a list of language files that have been loaded. * - * @access public - * @param string $extension An option extension name + * @param string An option extension name. * @return array * @since 1.5 */ - function getPaths($extension = null) + public function getPaths($extension = null) { - if ( isset($extension) ) + if (isset($extension)) { - if ( isset($this->_paths[$extension]) ) + if (isset($this->_paths[$extension])) + { return $this->_paths[$extension]; - + } return null; } - else - { - return $this->_paths; + return $this->_paths; + } + + /** + * Getter for PDF Font Name. + * + * @return string Name of pdf font to be used. + * @since 1.5 + */ + public function getPdfFontName() { + return $this->_metadata['pdffontname']; + } + + /** + * Getter for Windows locale code page. + * + * @return string Windows locale encoding. + * @since 1.5 + */ + public function getWinCP() { + return $this->_metadata['wincodepage']; + } + + /** + * Getter for backward compatible language name. + * + * @return string Backward compatible name. + * @since 1.5 + */ + public function getBackwardLang() { + return $this->_metadata['backwardlang']; + } + + /** + * Get for the language tag (as defined in RFC 3066). + * + * @return string The language tag. + * @since 1.5 + */ + public function getTag() { + return $this->_metadata['tag']; + } + + /** + * Get locale property. + * + * @return string The locale property. + * @since 1.5 + */ + public function getLocale() + { + if (!isset($this->_metadata['locale'])) { + return ''; } - } - - /** - * Getter for PDF Font Name - * - * @access public - * @return string name of pdf font to be used - * @since 1.5 - */ - function getPdfFontName() { - return $this->_metadata['pdffontname']; - } - - /** - * Getter for Windows locale code page - * - * @access public - * @return string windows locale encoding - * @since 1.5 - */ - function getWinCP() { - return $this->_metadata['wincodepage']; - } - - /** - * Getter for backward compatible language name - * - * @access public - * @return string backward compatible name - * @since 1.5 - */ - function getBackwardLang() { - return $this->_metadata['backwardlang']; - } - - /** - * Get for the language tag (as defined in RFC 3066) - * - * @access public - * @return string The language tag - * @since 1.5 - */ - function getTag() { - return $this->_metadata['tag']; - } - - /** - * Get locale property - * - * @access public - * @return string The locale property - * @since 1.5 - */ - function getLocale() - { - $locales = explode(',', $this->_metadata['locale']); - - for($i = 0; $i < count($locales); $i++ ) { - $locale = $locales[$i]; - $locale = trim($locale); - $locales[$i] = $locale; - } - - //return implode(',', $locales); - return $locales; - } - - /** - * Get the RTL property - * - * @access public - * @return boolean True is it an RTL language - * @since 1.5 - */ - function isRTL() { - return $this->_metadata['rtl']; - } - - /** - * Set the Debug property - * - * @access public - * @return boolean Previous value - * @since 1.5 - */ - function setDebug($debug) { - $previous = $this->_debug; + $locales = explode(',', $this->_metadata['locale']); + + array_walk($locales, 'trim'); + + //return implode(',', $locales); + return $locales; + } + + /** + * Get the RTL property. + * + * @return boolean True is it an RTL language. + * @since 1.5 + */ + public function isRTL() { + return $this->_metadata['rtl']; + } + + /** + * Set the Debug property. + * + * @param boolean The debug value. + * @return boolean Previous value. + * @since 1.5 + */ + public function setDebug($debug) { + $previous = $this->_debug; $this->_debug = $debug; - return $previous; - } - - /** - * Get the Debug property - * - * @access public - * @return boolean True is in debug mode - * @since 1.5 - */ - function getDebug() { - return $this->_debug; + return $previous; } /** - * Get the default language code + * Get the Debug property. + * + * @return boolean True is in debug mode. + * @since 1.5 + */ + public function getDebug() { + return $this->_debug; + } + + /** + * Get the default language code. * - * @access public - * @return string Language code + * @return string Language code. * @since 1.5 */ - function getDefault() { + public function getDefault() { return $this->_default; } /** - * Set the default language code + * Set the default language code. * - * @access public - * @return string Previous value + * @return string Previous value. * @since 1.5 */ - function setDefault($lang) { - $previous = $this->_default; + public function setDefault($lang) { + $previous = $this->_default; $this->_default = $lang; return $previous; - } - - /** - * Get the list of orphaned strings if being tracked - * - * @access public - * @return boolean True is in debug mode - * @since 1.5 - */ - function getOrphans() { - return $this->_orphans; } /** - * Get the list of used strings + * Get the list of orphaned strings if being tracked. + * + * @return array List of orphaned strings. + * @since 1.5 + */ + public function getOrphans() { + return $this->_orphans; + } + + /** + * Get the list of used strings. * - * Used strings are those strings requested and found either as a string or a constant + * Used strings are those strings requested and found either as a string or + * a constant. * - * @access public - * @return array Used strings + * @return array Used strings. * @since 1.5 */ - function getUsed() { + public function getUsed() { return $this->_used; - } - - /** - * Determines is a key exists - * - * @access public - * @param key $key The key to check - * @return boolean True, if the key exists - * @since 1.5 - */ - function hasKey($key) { - return isset ($this->_strings[strtoupper($key)]); - } - - /** - * Returns a associative array holding the metadata - * - * @access public - * @param string The name of the language - * @return mixed If $lang exists return key/value pair with the language metadata, - * otherwise return NULL - * @since 1.5 - */ - - function getMetadata($lang) - { - $path = JLanguage::getLanguagePath(JPATH_BASE, $lang); - $file = $lang.'.xml'; - - $result = null; - if(is_file($path.DS.$file)) { - $result = JLanguage::_parseXMLLanguageFile($path.DS.$file); - } - - return $result; - } - - /** - * Returns a list of known languages for an area - * - * @access public - * @param string $basePath The basepath to use - * @return array key/value pair with the language file and real name - * @since 1.5 - */ - function getKnownLanguages($basePath = JPATH_BASE) - { - $dir = JLanguage::getLanguagePath($basePath); - $knownLanguages = JLanguage::_parseLanguageFiles($dir); - - return $knownLanguages; - } - - /** - * Get the path to a language - * - * @access public - * @param string $basePath The basepath to use - * @param string $language The language tag - * @return string language related path or null - * @since 1.5 - */ - function getLanguagePath($basePath = JPATH_BASE, $language = null ) - { - $dir = $basePath.DS.'language'; - if (!empty($language)) { - $dir .= DS.$language; - } - return $dir; - } - - /** - * Set the language attributes to the given language - * - * Once called, the language still needs to be loaded using JLanguage::load() - * - * @access public - * @param string $lang Language code - * @return string Previous value + } + + /** + * Determines if a key exists. + * + * @param key The key to check. + * @return boolean True if the key exists. + * @since 1.5 + */ + public function hasKey($key) { + return isset ($this->_strings[strtoupper($key)]); + } + + /** + * Returns a associative array holding the metadata. + * + * @param string The name of the language. + * @return mixed If the language exists return key/value pair with the + * language metadata, otherwise return NULL. + * @since 1.5 + */ + + public static function getMetadata($lang) + { + $path = JLanguage::getLanguagePath(JPATH_BASE, $lang); + $file = $lang . '.xml'; + + $result = null; + if (is_file($path . DS . $file)) { + $result = JLanguage::_parseXMLLanguageFile($path . DS . $file); + } + return $result; + } + + /** + * Returns a list of known languages for an area. + * + * @param string The basepath to use. + * @return array Key/value pairs with the language file and real name. + * @since 1.5 + */ + public static function getKnownLanguages($basePath = JPATH_BASE) + { + $dir = JLanguage::getLanguagePath($basePath); + $knownLanguages = JLanguage::_parseLanguageFiles($dir); + return $knownLanguages; + } + + /** + * Get the language identifier. + * + * @return string Language code. + * @since 1.6 + */ + public function getLanguageIdentifier() + { + return $this->_lang; + } + + /** + * Get the path to a language. + * + * @param string The basepath to use. + * @param string The language tag. + * @return string Language related path or null. + * @since 1.5 + */ + public static function getLanguagePath($basePath = JPATH_BASE, $language = null) + { + $dir = $basePath . DS . 'language'; + if (!empty($language)) { + $dir .= DS . $language; + } + return $dir; + } + + /** + * Set the language attributes to the given language. + * + * Once called, the language still needs to be loaded using + * JLanguage::load(). + * + * @param string Language code. + * @return string|boolean Previous value if successful. False on failure. * @since 1.5 */ - function setLanguage($lang) - { - $previous = $this->_lang; - $this->_lang = $lang; - $this->_metadata = $this->getMetadata($this->_lang); + public function setLanguage($lang) + { + $previous = $this->_lang; + if (($metaData = $this->getMetadata($lang)) === null) { + return false; + } + $this->_metadata = $metaData; + $this->_lang = $lang; //set locale based on the language tag //TODO : add function to display locale setting in configuration $locale = setlocale(LC_TIME, $this->getLocale()); return $previous; - } - - /** - * Searches for language directories within a certain base dir - * - * @access public - * @param string $dir directory of files - * @return array Array holding the found languages as filename => real name pairs - * @since 1.5 - */ - function _parseLanguageFiles($dir = null) - { - jimport('joomla.filesystem.folder'); - - $languages = array (); - - $subdirs = JFolder::folders($dir); - foreach ($subdirs as $path) { - $langs = JLanguage::_parseXMLLanguageFiles($dir.DS.$path); - $languages = array_merge($languages, $langs); - } - - return $languages; - } - - /** - * Parses XML files for language information - * - * @access public - * @param string $dir Directory of files - * @return array Array holding the found languages as filename => metadata array - * @since 1.5 - */ - function _parseXMLLanguageFiles($dir = null) - { - if ($dir == null) { - return null; - } - - $languages = array (); - jimport('joomla.filesystem.folder'); - $files = JFolder::files($dir, '^([-_A-Za-z]*)\.xml$'); - foreach ($files as $file) { - if ($content = file_get_contents($dir.DS.$file)) { - if ($metadata = JLanguage::_parseXMLLanguageFile($dir.DS.$file)) { - $lang = str_replace('.xml', '', $file); - $languages[$lang] = $metadata; - } - } - } - return $languages; - } - - /** - * Parse XML file for language information - * - * @access public - * @param string $path Path to the xml files - * @return array Array holding the found metadata as a key => value pair - * @since 1.5 - */ - function _parseXMLLanguageFile($path) - { - $xml = & JFactory::getXMLParser('Simple'); - - // Load the file - if (!$xml || !$xml->loadFile($path)) { - return null; - } - - // Check that it's am metadata file - if (!$xml->document || $xml->document->name() != 'metafile') { - return null; - } - - $metadata = array (); - - //if ($xml->document->attributes('type') == 'language') { - - foreach ($xml->document->metadata[0]->children() as $child) { - $metadata[$child->name()] = $child->data(); - } - //} - return $metadata; - } -} - + } + + /** + * Searches for language directories within a certain base dir. + * + * @param string Directory of files. + * @return array Array holding the found languages as filename => real + * name pairs. + * @since 1.5 + */ + protected function _parseLanguageFiles($dir = null) + { + jimport('joomla.filesystem.folder'); + + $languages = array(); + + $subdirs = JFolder::folders($dir); + foreach ($subdirs as $path) { + $langs = JLanguage::_parseXMLLanguageFiles($dir . DS . $path); + $languages = array_merge($languages, $langs); + } + + return $languages; + } + + /** + * Parses XML files for language information. + * + * @param string Directory of files. + * @return array Array holding the found languages as filename => + * metadata array. + * @since 1.5 + */ + protected static function _parseXMLLanguageFiles($dir = null) + { + if ($dir == null) { + return null; + } + + $languages = array(); + jimport('joomla.filesystem.folder'); + $files = JFolder::files($dir, '^([-_A-Za-z]*)\.xml$'); + foreach ($files as $file) { + if ($content = file_get_contents($dir . DS . $file)) { + if ($metadata = JLanguage::_parseXMLLanguageFile($dir . DS . $file)) { + $lang = str_replace('.xml', '', $file); + $languages[$lang] = $metadata; + } + } + } + return $languages; + } + + /** + * Parse XML file for language information. + * + * @param string Path to the xml files. + * @return array Array holding the found metadata as a key => value pair. + * @since 1.5 + */ + protected static function _parseXMLLanguageFile($path) + { + $xml = &JFactory::getXMLParser('Simple'); + + // Load the file + if (!$xml || !$xml->loadFile($path)) { + return null; + } + + // Check that it's am metadata file + if (!$xml->document || $xml->document->name() != 'metafile') { + return null; + } + + $metadata = array(); + + //if ($xml->document->attributes('type') == 'language') { + + foreach ($xml->document->metadata[0]->children() as $child) { + $metadata[$child->name()] = $child->data(); + } + //} + return $metadata; + } + +} diff --git a/libraries/joomla/mail/helper.php b/libraries/joomla/mail/helper.php index 6643ca683bc89..611f3f5cf71fc 100644 --- a/libraries/joomla/mail/helper.php +++ b/libraries/joomla/mail/helper.php @@ -1,168 +1,167 @@ - - * @package Joomla.Framework - * @subpackage Mail - * @since 1.5 - */ -class JMailHelper -{ - /** - * Cleans single line inputs. - * - * @static - * @param string $value String to be cleaned. - * @return string Cleaned string. - */ - function cleanLine( $value ) { - return trim( preg_replace( '/(%0A|%0D|\n+|\r+)/i', '', $value ) ); - } - - /** - * Cleans multi-line inputs. - * - * @static - * @param string $value Multi-line string to be cleaned. - * @return string Cleaned multi-line string. - */ - function cleanText( $value ) { - return trim( preg_replace( '/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i', '', $value ) ); - } - - /** - * Cleans any injected headers from the E-Mail body. - * - * @static - * @param string $body E-Mail body string. - * @return string Cleaned E-Mail body string. - * @since 1.5 - */ - function cleanBody($body) { - // Strip all E-Mail headers from a string - return preg_replace("/((From:|To:|Cc:|Bcc:|Subject:|Content-type:) ([\S]+))/", "", $body); - } - - /** - * Cleans any injected headers from the subject string. - * - * @static - * @param string $subject E-Mail subject string. - * @return string Cleaned E-Mail subject string. - * @since 1.5 - */ - function cleanSubject($subject) { - return preg_replace("/((From:|To:|Cc:|Bcc:|Content-type:) ([\S]+))/", "", $subject); - } - - /** - * Verifies that an e-mail address does not have any extra headers injected into it. - * - * @static - * @param string $address E-Mail address. - * @return string|false E-Mail address string or boolean false if injected headers are present. - * @since 1.5 - */ - function cleanAddress($address) - { - if (preg_match("[\s;,]", $address)) { - return false; - } - return $address; - } - - /** - * Verifies that the string is in a proper e-mail address format. - * - * @static - * @param string $email String to be verified. - * @return boolean True if string has the correct format; false otherwise. - * @since 1.5 - */ - function isEmailAddress($email) - { - - // Split the email into a local and domain - $atIndex = strrpos($email, "@"); - $domain = substr($email, $atIndex+1); - $local = substr($email, 0, $atIndex); - - // Check Length of domain - $domainLen = strlen($domain); - if ($domainLen < 1 || $domainLen > 255) { - return false; - } - - // Check the local address - // We're a bit more conservative about what constitutes a "legal" address, that is, A-Za-z0-9!#$%&\'*+/=?^_`{|}~- - $allowed = 'A-Za-z0-9!#&*+=?_-'; - $regex = "/^[$allowed][\.$allowed]{0,63}$/"; - if ( ! preg_match($regex, $local) ) { - return false; - } - - // No problem if the domain looks like an IP address, ish - $regex = '/^[0-9\.]+$/'; - if ( preg_match($regex, $domain)) { - return true; - } - - // Check Lengths - $localLen = strlen($local); - if ($localLen < 1 || $localLen > 64) { - return false; - } - - // Check the domain - $domain_array = explode(".", $domain); - $regex = '/^[A-Za-z0-9-]{0,63}$/'; - foreach ($domain_array as $domain ) { - - // Must be something - if ( ! $domain ) { - return false; - } - - // Check for invalid characters - if ( ! preg_match($regex, $domain) ) { - return false; - } - - // Check for a dash at the beginning of the domain - if ( strpos($domain, '-' ) === 0 ) { - return false; - } - - // Check for a dash at the end of the domain - $length = strlen($domain) -1; - if ( strpos($domain, '-', $length ) === $length ) { - return false; - } - - } - - return true; - } - -} + 255) { + return false; + } + + // Check the local address + // We're a bit more conservative about what constitutes a "legal" address, that is, A-Za-z0-9!#$%&\'*+/=?^_`{|}~- + $allowed = 'A-Za-z0-9!#&*+=?_-'; + $regex = "/^[$allowed][\.$allowed]{0,63}$/"; + if ( ! preg_match($regex, $local) ) { + return false; + } + + // No problem if the domain looks like an IP address, ish + $regex = '/^[0-9\.]+$/'; + if ( preg_match($regex, $domain)) { + return true; + } + + // Check Lengths + $localLen = strlen($local); + if ($localLen < 1 || $localLen > 64) { + return false; + } + + // Check the domain + $domain_array = explode(".", $domain); + $regex = '/^[A-Za-z0-9-]{0,63}$/'; + foreach ($domain_array as $domain ) { + + // Must be something + if ( ! $domain ) { + return false; + } + + // Check for invalid characters + if ( ! preg_match($regex, $domain) ) { + return false; + } + + // Check for a dash at the beginning of the domain + if ( strpos($domain, '-' ) === 0 ) { + return false; + } + + // Check for a dash at the end of the domain + $length = strlen($domain) -1; + if ( strpos($domain, '-', $length ) === $length ) { + return false; + } + + } + + return true; + } + +} diff --git a/libraries/joomla/mail/index.html b/libraries/joomla/mail/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/mail/index.html +++ b/libraries/joomla/mail/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/mail/mail.php b/libraries/joomla/mail/mail.php index 183a4c8685a61..2c3279c96aeb9 100644 --- a/libraries/joomla/mail/mail.php +++ b/libraries/joomla/mail/mail.php @@ -1,320 +1,319 @@ - - * @package Joomla.Framework - * @subpackage Mail - * @since 1.5 - */ -class JMail extends PHPMailer -{ - - /** - * Constructor - * - */ - function JMail() - { - // phpmailer has an issue using the relative path for it's language files - $this->SetLanguage('joomla', JPATH_LIBRARIES.DS.'phpmailer'.DS.'language'.DS); - } - - /** - * Returns a reference to a global e-mail object, only creating it - * if it doesn't already exist. - * - * This method must be invoked as: - *
        $mail =& JMail::getInstance();
      - * - * NOTE: If you need an instance to use that does not have the global configuration - * values, use an id string that is not 'Joomla'. - * - * @static - * @access public - * @param string $id The id string for the JMail instance [optional] - * @return object The global JMail object - * @since 1.5 - */ - function & getInstance($id = 'Joomla') - { - static $instances; - - if (!isset ($instances)) { - $instances = array (); - } - - if (empty ($instances[$id])) { - $instances[$id] = new JMail(); - } - - return $instances[$id]; - } - - /** - * @return mixed True if successful, a JError object otherwise - */ - function &Send() - { - if ( ( $this->Mailer == 'mail' ) && ! function_exists('mail') ) - { - return JError::raiseNotice( 500, JText::_('MAIL_FUNCTION_DISABLED') ); - } - - @ $result = parent::Send(); - - if ($result == false) - { - // TODO: Set an appropriate error number - $result =& JError::raiseNotice( 500, JText::_($this->ErrorInfo) ); - } - return $result; - } - - /** - * Set the E-Mail sender - * - * @access public - * @param array $from E-Mail address and Name of sender - *
      -	 * 			array( [0] => E-Mail Address [1] => Name )
      -	 * 		
      - * @return void - * @since 1.5 - */ - function setSender($from) - { - // If $from is an array we assume it has an address and a name - if (is_array($from)) - { - $this->From = JMailHelper::cleanLine( $from[0] ); - $this->FromName = JMailHelper::cleanLine( $from[1] ); - // If it is a string we assume it is just the address - } elseif (is_string($from)) { - $this->From = JMailHelper::cleanLine( $from ); - // If it is neither, we throw a warning - } else { - JError::raiseWarning( 0, "JMail:: Invalid E-Mail Sender: $from", "JMail::setSender($from)"); - } - } - - /** - * Set the E-Mail subject - * - * @access public - * @param string $subject Subject of the e-mail - * @return void - * @since 1.5 - */ - function setSubject($subject) { - $this->Subject = JMailHelper::cleanLine( $subject ); - } - - /** - * Set the E-Mail body - * - * @access public - * @param string $content Body of the e-mail - * @return void - * @since 1.5 - */ - function setBody($content) - { - /* - * Filter the Body - * TODO: Check for XSS - */ - $this->Body = JMailHelper::cleanText( $content ); - } - - /** - * Add recipients to the email - * - * @access public - * @param mixed $recipient Either a string or array of strings [e-mail address(es)] - * @return void - * @since 1.5 - */ - function addRecipient($recipient) - { - // If the recipient is an aray, add each recipient... otherwise just add the one - if (is_array($recipient)) - { - foreach ($recipient as $to) { - $to = JMailHelper::cleanLine( $to ); - $this->AddAddress($to); - } - } else { - $recipient = JMailHelper::cleanLine( $recipient ); - $this->AddAddress($recipient); - } - } - - /** - * Add carbon copy recipients to the email - * - * @access public - * @param mixed $cc Either a string or array of strings [e-mail address(es)] - * @return void - * @since 1.5 - */ - function addCC($cc) - { - //If the carbon copy recipient is an aray, add each recipient... otherwise just add the one - if (isset ($cc)) - { - if (is_array($cc)) { - foreach ($cc as $to) { - $to = JMailHelper::cleanLine( $to ); - parent::AddCC($to); - } - } else { - $cc = JMailHelper::cleanLine( $cc ); - parent::AddCC($cc); - } - } - } - - /** - * Add blind carbon copy recipients to the email - * - * @access public - * @param mixed $cc Either a string or array of strings [e-mail address(es)] - * @return void - * @since 1.5 - */ - function addBCC($bcc) - { - // If the blind carbon copy recipient is an aray, add each recipient... otherwise just add the one - if (isset ($bcc)) - { - if (is_array($bcc)) { - foreach ($bcc as $to) { - $to = JMailHelper::cleanLine( $to ); - parent::AddBCC($to); - } - } else { - $bcc = JMailHelper::cleanLine( $bcc ); - parent::AddBCC($bcc); - } - } - } - - /** - * Add file attachments to the email - * - * @access public - * @param mixed $attachment Either a string or array of strings [filenames] - * @return void - * @since 1.5 - */ - function addAttachment($attachment) - { - // If the file attachments is an aray, add each file... otherwise just add the one - if (isset ($attachment)) - { - if (is_array($attachment)) { - foreach ($attachment as $file) { - parent::AddAttachment($file); - } - } else { - parent::AddAttachment($attachment); - } - } - } - - /** - * Add Reply to e-mail address(es) to the e-mail - * - * @access public - * @param array $reply Either an array or multi-array of form - *
      -	 * 			array( [0] => E-Mail Address [1] => Name )
      -	 * 		
      - * @return void - * @since 1.5 - */ - function addReplyTo($replyto) - { - // Take care of reply email addresses - if (is_array($replyto[0])) - { - foreach ($replyto as $to) { - $to0 = JMailHelper::cleanLine( $to[0] ); - $to1 = JMailHelper::cleanLine( $to[1] ); - parent::AddReplyTo($to0, $to1); - } - } else { - $replyto0 = JMailHelper::cleanLine( $replyto[0] ); - $replyto1 = JMailHelper::cleanLine( $replyto[1] ); - parent::AddReplyTo($replyto0, $replyto1); - } - } - - /** - * Use sendmail for sending the e-mail - * - * @access public - * @param string $sendmail Path to sendmail [optional] - * @return boolean True on success - * @since 1.5 - */ - function useSendmail($sendmail = null) - { - $this->Sendmail = $sendmail; - - if (!empty ($this->Sendmail)) { - $this->IsSendmail(); - return true; - } else { - $this->IsMail(); - return false; - } - } - - /** - * Use SMTP for sending the e-mail - * - * @access public - * @param string $auth SMTP Authentication [optional] - * @param string $host SMTP Host [optional] - * @param string $user SMTP Username [optional] - * @param string $pass SMTP Password [optional] - * @return boolean True on success - * @since 1.5 - */ - function useSMTP($auth = null, $host = null, $user = null, $pass = null) - { - $this->SMTPAuth = $auth; - $this->Host = $host; - $this->Username = $user; - $this->Password = $pass; - - if ($this->SMTPAuth !== null && $this->Host !== null && $this->Username !== null && $this->Password !== null) { - $this->IsSMTP(); - return true; - } else { - $this->IsMail(); - return false; - } - } -} +SetLanguage('joomla', JPATH_LIBRARIES.DS.'phpmailer'.DS.'language'.DS); + } + + /** + * Returns a reference to a global e-mail object, only creating it + * if it doesn't already exist. + * + * This method must be invoked as: + *
        $mail =& JMail::getInstance();
      + * + * NOTE: If you need an instance to use that does not have the global configuration + * values, use an id string that is not 'Joomla'. + * + * @static + * @access public + * @param string $id The id string for the JMail instance [optional] + * @return object The global JMail object + * @since 1.5 + */ + public static function & getInstance($id = 'Joomla') + { + static $instances; + + if (!isset ($instances)) { + $instances = array (); + } + + if (empty ($instances[$id])) { + $instances[$id] = new JMail(); + } + + return $instances[$id]; + } + + /** + * @return mixed True if successful, a JError object otherwise + */ + public function &Send() + { + if ( ( $this->Mailer == 'mail' ) && ! function_exists('mail') ) + { + return JError::raiseNotice( 500, JText::_('MAIL_FUNCTION_DISABLED') ); + } + + @ $result = parent::Send(); + + if ($result == false) + { + // TODO: Set an appropriate error number + $result =& JError::raiseNotice( 500, JText::_($this->ErrorInfo) ); + } + return $result; + } + + /** + * Set the E-Mail sender + * + * @access public + * @param array $from E-Mail address and Name of sender + *
      +	 * 			array( [0] => E-Mail Address [1] => Name )
      +	 * 		
      + * @return void + * @since 1.5 + */ + public function setSender($from) + { + // If $from is an array we assume it has an address and a name + if (is_array($from)) + { + $this->From = JMailHelper::cleanLine( $from[0] ); + $this->FromName = JMailHelper::cleanLine( $from[1] ); + // If it is a string we assume it is just the address + } elseif (is_string($from)) { + $this->From = JMailHelper::cleanLine( $from ); + // If it is neither, we throw a warning + } else { + JError::raiseWarning( 0, "JMail:: Invalid E-Mail Sender: $from", "JMail::setSender($from)"); + } + } + + /** + * Set the E-Mail subject + * + * @access public + * @param string $subject Subject of the e-mail + * @return void + * @since 1.5 + */ + public function setSubject($subject) { + $this->Subject = JMailHelper::cleanLine( $subject ); + } + + /** + * Set the E-Mail body + * + * @access public + * @param string $content Body of the e-mail + * @return void + * @since 1.5 + */ + public function setBody($content) + { + /* + * Filter the Body + * TODO: Check for XSS + */ + $this->Body = JMailHelper::cleanText( $content ); + } + + /** + * Add recipients to the email + * + * @access public + * @param mixed $recipient Either a string or array of strings [e-mail address(es)] + * @return void + * @since 1.5 + */ + public function addRecipient($recipient) + { + // If the recipient is an aray, add each recipient... otherwise just add the one + if (is_array($recipient)) + { + foreach ($recipient as $to) { + $to = JMailHelper::cleanLine( $to ); + $this->AddAddress($to); + } + } else { + $recipient = JMailHelper::cleanLine( $recipient ); + $this->AddAddress($recipient); + } + } + + /** + * Add carbon copy recipients to the email + * + * @access public + * @param mixed $cc Either a string or array of strings [e-mail address(es)] + * @return void + * @since 1.5 + */ + public function addCC($cc) + { + //If the carbon copy recipient is an aray, add each recipient... otherwise just add the one + if (isset ($cc)) + { + if (is_array($cc)) { + foreach ($cc as $to) { + $to = JMailHelper::cleanLine( $to ); + parent::AddCC($to); + } + } else { + $cc = JMailHelper::cleanLine( $cc ); + parent::AddCC($cc); + } + } + } + + /** + * Add blind carbon copy recipients to the email + * + * @access public + * @param mixed $cc Either a string or array of strings [e-mail address(es)] + * @return void + * @since 1.5 + */ + public function addBCC($bcc) + { + // If the blind carbon copy recipient is an aray, add each recipient... otherwise just add the one + if (isset ($bcc)) + { + if (is_array($bcc)) { + foreach ($bcc as $to) { + $to = JMailHelper::cleanLine( $to ); + parent::AddBCC($to); + } + } else { + $bcc = JMailHelper::cleanLine( $bcc ); + parent::AddBCC($bcc); + } + } + } + + /** + * Add file attachments to the email + * + * @access public + * @param mixed $attachment Either a string or array of strings [filenames] + * @return void + * @since 1.5 + */ + public function addAttachment($attachment) + { + // If the file attachments is an aray, add each file... otherwise just add the one + if (isset ($attachment)) + { + if (is_array($attachment)) { + foreach ($attachment as $file) { + parent::AddAttachment($file); + } + } else { + parent::AddAttachment($attachment); + } + } + } + + /** + * Add Reply to e-mail address(es) to the e-mail + * + * @access public + * @param array $reply Either an array or multi-array of form + *
      +	 * 			array( [0] => E-Mail Address [1] => Name )
      +	 * 		
      + * @return void + * @since 1.5 + */ + public function addReplyTo($replyto) + { + // Take care of reply email addresses + if (is_array($replyto[0])) + { + foreach ($replyto as $to) { + $to0 = JMailHelper::cleanLine( $to[0] ); + $to1 = JMailHelper::cleanLine( $to[1] ); + parent::AddReplyTo($to0, $to1); + } + } else { + $replyto0 = JMailHelper::cleanLine( $replyto[0] ); + $replyto1 = JMailHelper::cleanLine( $replyto[1] ); + parent::AddReplyTo($replyto0, $replyto1); + } + } + + /** + * Use sendmail for sending the e-mail + * + * @access public + * @param string $sendmail Path to sendmail [optional] + * @return boolean True on success + * @since 1.5 + */ + public function useSendmail($sendmail = null) + { + $this->Sendmail = $sendmail; + + if (!empty ($this->Sendmail)) { + $this->IsSendmail(); + return true; + } else { + $this->IsMail(); + return false; + } + } + + /** + * Use SMTP for sending the e-mail + * + * @access public + * @param string $auth SMTP Authentication [optional] + * @param string $host SMTP Host [optional] + * @param string $user SMTP Username [optional] + * @param string $pass SMTP Password [optional] + * @return boolean True on success + * @since 1.5 + */ + public function useSMTP($auth = null, $host = null, $user = null, $pass = null) + { + $this->SMTPAuth = $auth; + $this->Host = $host; + $this->Username = $user; + $this->Password = $pass; + + if ($this->SMTPAuth !== null && $this->Host !== null && $this->Username !== null && $this->Password !== null) { + $this->IsSMTP(); + return true; + } else { + $this->IsMail(); + return false; + } + } +} diff --git a/libraries/joomla/methods.php b/libraries/joomla/methods.php index 215dbc2c482d7..c0958bdfd3e38 100644 --- a/libraries/joomla/methods.php +++ b/libraries/joomla/methods.php @@ -1,163 +1,162 @@ - - * @package Joomla.Framework - * @since 1.5 - */ -class JRoute -{ - /** - * Translates an internal Joomla URL to a humanly readible URL. - * - * @access public - * @param string $url Absolute or Relative URI to Joomla resource - * @param boolean $xhtml Replace & by & for xml compilance - * @param int $ssl Secure state for the resolved URI - * 1: Make URI secure using global secure site URI - * 0: Leave URI in the same secure state as it was passed to the function - * -1: Make URI unsecure using the global unsecure site URI - * @return The translated humanly readible URL - */ - function _($url, $xhtml = true, $ssl = null) - { - // Get the router - $app = &JFactory::getApplication(); - $router = &$app->getRouter(); - - // Make sure that we have our router - if (! $router) { - return null; - } - - if ( (strpos($url, '&') !== 0 ) && (strpos($url, 'index.php') !== 0) ) { - return $url; - } - - // Build route - $uri = &$router->build($url); - $url = $uri->toString(array('path', 'query', 'fragment')); - - // Replace spaces - $url = preg_replace('/\s/', '%20', $url); - - /* - * Get the secure/unsecure URLs. - - * If the first 5 characters of the BASE are 'https', then we are on an ssl connection over - * https and need to set our secure URL to the current request URL, if not, and the scheme is - * 'http', then we need to do a quick string manipulation to switch schemes. - */ - $ssl = (int) $ssl; - if ( $ssl ) - { - $uri =& JURI::getInstance(); - - // Get additional parts - static $prefix; - if ( ! $prefix ) { - $prefix = $uri->toString( array('host', 'port')); - //$prefix .= JURI::base(true); - } - - // Determine which scheme we want - $scheme = ( $ssl === 1 ) ? 'https' : 'http'; - - // Make sure our url path begins with a slash - if ( ! preg_match('#^/#', $url) ) { - $url = '/' . $url; - } - - // Build the URL - $url = $scheme . '://' . $prefix . $url; - } - - if($xhtml) { - $url = str_replace( '&', '&', $url ); - } - - return $url; - } -} - -/** - * Text handling class - * - * @static - * @package Joomla.Framework - * @subpackage Language - * @since 1.5 - */ -class JText -{ - /** - * Translates a string into the current language - * - * @access public - * @param string $string The string to translate - * @param boolean $jsSafe Make the result javascript safe - * @since 1.5 - * - */ - function _($string, $jsSafe = false) - { - $lang =& JFactory::getLanguage(); - return $lang->_($string, $jsSafe); - } - - /** - * Passes a string thru an sprintf - * - * @access public - * @param format The format string - * @param mixed Mixed number of arguments for the sprintf function - * @since 1.5 - */ - function sprintf($string) - { - $lang =& JFactory::getLanguage(); - $args = func_get_args(); - if (count($args) > 0) { - $args[0] = $lang->_($args[0]); - return call_user_func_array('sprintf', $args); - } - return ''; - } - - /** - * Passes a string thru an printf - * - * @access public - * @param format The format string - * @param mixed Mixed number of arguments for the sprintf function - * @since 1.5 - */ - function printf($string) - { - $lang =& JFactory::getLanguage(); - $args = func_get_args(); - if (count($args) > 0) { - $args[0] = $lang->_($args[0]); - return call_user_func_array('printf', $args); - } - return ''; - } - -} +getRouter(); + + // Make sure that we have our router + if (! $router) { + return null; + } + + if ( (strpos($url, '&') !== 0 ) && (strpos($url, 'index.php') !== 0) ) { + return $url; + } + + // Build route + $uri = &$router->build($url); + $url = $uri->toString(array('path', 'query', 'fragment')); + + // Replace spaces + $url = preg_replace('/\s/', '%20', $url); + + /* + * Get the secure/unsecure URLs. + + * If the first 5 characters of the BASE are 'https', then we are on an ssl connection over + * https and need to set our secure URL to the current request URL, if not, and the scheme is + * 'http', then we need to do a quick string manipulation to switch schemes. + */ + $ssl = (int) $ssl; + if ( $ssl ) + { + $uri = JURI::getInstance(); + + // Get additional parts + static $prefix; + if ( ! $prefix ) { + $prefix = $uri->toString( array('host', 'port')); + //$prefix .= JURI::base(true); + } + + // Determine which scheme we want + $scheme = ( $ssl === 1 ) ? 'https' : 'http'; + + // Make sure our url path begins with a slash + if ( ! preg_match('#^/#', $url) ) { + $url = '/' . $url; + } + + // Build the URL + $url = $scheme . '://' . $prefix . $url; + } + + if($xhtml) { + $url = str_replace( '&', '&', $url ); + } + + return $url; + } +} + +/** + * Text handling class + * + * @static + * @package Joomla.Framework + * @subpackage Language + * @since 1.5 + */ +abstract class JText +{ + /** + * Translates a string into the current language + * + * @access public + * @param string $string The string to translate + * @param boolean $jsSafe Make the result javascript safe + * @since 1.5 + * + */ + public static function _($string, $jsSafe = false) + { + $lang = JFactory::getLanguage(); + return $lang->_($string, $jsSafe); + } + + /** + * Passes a string thru an sprintf + * + * @access public + * @param format The format string + * @param mixed Mixed number of arguments for the sprintf function + * @since 1.5 + */ + public static function sprintf($string) + { + $lang = JFactory::getLanguage(); + $args = func_get_args(); + if(!empty($args)) { + $args[0] = $lang->_($args[0]); + return call_user_func_array('sprintf', $args); + } + return ''; + } + + /** + * Passes a string thru an printf + * + * @access public + * @param format The format string + * @param mixed Mixed number of arguments for the sprintf function + * @since 1.5 + */ + public static function printf($string) + { + $lang =&JFactory::getLanguage(); + $args = func_get_args(); + if (!empty($args)) { + $args[0] = $lang->_($args[0]); + return call_user_func_array('printf', $args); + } + return ''; + } + +} diff --git a/libraries/joomla/plugin/helper.php b/libraries/joomla/plugin/helper.php index fcccd0e86bf41..3b51ffee0dba5 100644 --- a/libraries/joomla/plugin/helper.php +++ b/libraries/joomla/plugin/helper.php @@ -1,206 +1,207 @@ - -* @package Joomla.Framework -* @subpackage Plugin -* @since 1.5 -*/ -class JPluginHelper -{ - /** - * Get the plugin data of a specific type if no specific plugin is specified - * otherwise only the specific plugin data is returned - * - * @access public - * @param string $type The plugin type, relates to the sub-directory in the plugins directory - * @param string $plugin The plugin name - * @return mixed An array of plugin data objects, or a plugin data object - */ - function &getPlugin($type, $plugin = null) - { - $result = array(); - - $plugins = JPluginHelper::_load(); - - $total = count($plugins); - for($i = 0; $i < $total; $i++) - { - if(is_null($plugin)) - { - if($plugins[$i]->type == $type) { - $result[] = $plugins[$i]; - } - } - else - { - if($plugins[$i]->type == $type && $plugins[$i]->name == $plugin) { - $result = $plugins[$i]; - break; - } - } - - } - - return $result; - } - - /** - * Checks if a plugin is enabled - * - * @access public - * @param string $type The plugin type, relates to the sub-directory in the plugins directory - * @param string $plugin The plugin name - * @return boolean - */ - function isEnabled( $type, $plugin = null ) - { - $result = &JPluginHelper::getPlugin( $type, $plugin); - return (!empty($result)); - } - - /** - * Loads all the plugin files for a particular type if no specific plugin is specified - * otherwise only the specific pugin is loaded. - * - * @access public - * @param string $type The plugin type, relates to the sub-directory in the plugins directory - * @param string $plugin The plugin name - * @return boolean True if success - */ - function importPlugin($type, $plugin = null, $autocreate = true, $dispatcher = null) - { - $result = false; - - $plugins = JPluginHelper::_load(); - - $total = count($plugins); - for($i = 0; $i < $total; $i++) { - if($plugins[$i]->type == $type && ($plugins[$i]->name == $plugin || $plugin === null)) { - JPluginHelper::_import( $plugins[$i], $autocreate, $dispatcher ); - $result = true; - } - } - - return $result; - } - - /** - * Loads the plugin file - * - * @access private - * @return boolean True if success - */ - function _import( &$plugin, $autocreate = true, $dispatcher = null ) - { - static $paths; - - if (!$paths) { - $paths = array(); - } - - $result = false; - $plugin->type = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->type); - $plugin->name = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->name); - - $path = JPATH_PLUGINS.DS.$plugin->type.DS.$plugin->name.'.php'; - - if (!isset( $paths[$path] )) - { - if (file_exists( $path )) - { - //needed for backwards compatibility - global $_MAMBOTS, $mainframe; - - jimport('joomla.plugin.plugin'); - require_once( $path ); - $paths[$path] = true; - - if($autocreate) - { - // Makes sure we have an event dispatcher - if(!is_object($dispatcher)) { - $dispatcher = & JDispatcher::getInstance(); - } - - $className = 'plg'.$plugin->type.$plugin->name; - if(class_exists($className)) - { - // load plugin parameters - $plugin =& JPluginHelper::getPlugin($plugin->type, $plugin->name); - - // create the plugin - $instance = new $className($dispatcher, (array)($plugin)); - } - } - } - else - { - $paths[$path] = false; - } - } - } - - /** - * Loads the published plugins - * - * @access private - */ - function _load() - { - static $plugins; - - if (isset($plugins)) { - return $plugins; - } - - $db =& JFactory::getDBO(); - $user =& JFactory::getUser(); - - if (isset($user)) - { - $aid = $user->get('aid', 0); - - $query = 'SELECT folder AS type, element AS name, params' - . ' FROM #__plugins' - . ' WHERE published >= 1' - . ' AND access <= ' . (int) $aid - . ' ORDER BY ordering'; - } - else - { - $query = 'SELECT folder AS type, element AS name, params' - . ' FROM #__plugins' - . ' WHERE published >= 1' - . ' ORDER BY ordering'; - } - - $db->setQuery( $query ); - - if (!($plugins = $db->loadObjectList())) { - JError::raiseWarning( 'SOME_ERROR_CODE', "Error loading Plugins: " . $db->getErrorMsg()); - return false; - } - - return $plugins; - } - -} +type == $type) { + $result[] = $plugins[$i]; + } + } + else + { + if($plugins[$i]->type == $type && $plugins[$i]->name == $plugin) { + $result = $plugins[$i]; + break; + } + } + + } + + return $result; + } + + /** + * Checks if a plugin is enabled + * + * @access public + * @param string $type The plugin type, relates to the sub-directory in the plugins directory + * @param string $plugin The plugin name + * @return boolean + */ + public static function isEnabled( $type, $plugin = null ) + { + $result = &JPluginHelper::getPlugin( $type, $plugin); + return (!empty($result)); + } + + /** + * Loads all the plugin files for a particular type if no specific plugin is specified + * otherwise only the specific pugin is loaded. + * + * @access public + * @param string $type The plugin type, relates to the sub-directory in the plugins directory + * @param string $plugin The plugin name + * @return boolean True if success + */ + public static function importPlugin($type, $plugin = null, $autocreate = true, $dispatcher = null) + { + $result = false; + + $plugins = JPluginHelper::_load(); + + $total = count($plugins); + for($i = 0; $i < $total; $i++) { + if($plugins[$i]->type == $type && ($plugins[$i]->name == $plugin || $plugin === null)) { + JPluginHelper::_import( $plugins[$i], $autocreate, $dispatcher ); + $result = true; + } + } + + return $result; + } + + /** + * Loads the plugin file + * + * @access private + * @return boolean True if success + */ + protected static function _import( &$plugin, $autocreate = true, $dispatcher = null ) + { + static $paths; + + if (!$paths) { + $paths = array(); + } + + $result = false; + $plugin->type = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->type); + $plugin->name = preg_replace('/[^A-Z0-9_\.-]/i', '', $plugin->name); + + $path = JPATH_PLUGINS.DS.$plugin->type.DS.$plugin->name.'.php'; + + if (!isset( $paths[$path] )) + { + if (file_exists( $path )) + { + //needed for backwards compatibility + // @todo if legacy ... + $mainframe = JFactory::getApplication(); + + jimport('joomla.plugin.plugin'); + require_once $path; + $paths[$path] = true; + + if($autocreate) + { + // Makes sure we have an event dispatcher + if(!is_object($dispatcher)) { + $dispatcher = & JDispatcher::getInstance(); + } + + $className = 'plg'.$plugin->type.$plugin->name; + if(class_exists($className)) + { + // load plugin parameters + $plugin =& JPluginHelper::getPlugin($plugin->type, $plugin->name); + + // create the plugin + $instance = new $className($dispatcher, (array)($plugin)); + } + } + } + else + { + $paths[$path] = false; + } + } + } + + /** + * Loads the published plugins + * + * @access private + */ + protected static function _load() + { + static $plugins; + + if (isset($plugins)) { + return $plugins; + } + + $db =& JFactory::getDBO(); + $user =& JFactory::getUser(); + + if (isset($user)) + { + $aid = $user->get('aid', 0); + + $query = 'SELECT folder AS type, element AS name, params' + . ' FROM #__plugins' + . ' WHERE published >= 1' + . ' AND access <= ' . (int) $aid + . ' ORDER BY ordering'; + } + else + { + $query = 'SELECT folder AS type, element AS name, params' + . ' FROM #__plugins' + . ' WHERE published >= 1' + . ' ORDER BY ordering'; + } + + $db->setQuery( $query ); + + try { + $plugins = $db->loadObjectList(); + } catch (JException $e) { + throw new JException('Error loading plugins', 0, E_WARNING, $e); + } + + return $plugins; + } + +} diff --git a/libraries/joomla/plugin/index.html b/libraries/joomla/plugin/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/plugin/index.html +++ b/libraries/joomla/plugin/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/plugin/plugin.php b/libraries/joomla/plugin/plugin.php index 63c5a133c76df..a3f6531883f08 100644 --- a/libraries/joomla/plugin/plugin.php +++ b/libraries/joomla/plugin/plugin.php @@ -1,119 +1,114 @@ - - * @package Joomla.Framework - * @subpackage Plugin - * @since 1.5 - */ -class JPlugin extends JEvent -{ - /** - * A JParameter object holding the parameters for the plugin - * - * @var A JParameter object - * @access public - * @since 1.5 - */ - var $params = null; - - /** - * The name of the plugin - * - * @var sring - * @access protected - */ - var $_name = null; - - /** - * The plugin type - * - * @var string - * @access protected - */ - var $_type = null; - - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An optional associative array of configuration settings. - * Recognized key values include 'name', 'group', 'params' - * (this list is not meant to be comprehensive). - * @since 1.5 - */ - function JPlugin(& $subject, $config = array()) { - parent::__construct($subject); - } - - /** - * Constructor - */ - function __construct(& $subject, $config = array()) - { - //Set the parameters - if ( isset( $config['params'] ) ) { - - if(is_a($config['params'], 'JParameter')) { - $this->params = $config['params']; - } else { - $this->params = new JParameter($config['params']); - } - } - - if ( isset( $config['name'] ) ) { - $this->_name = $config['name']; - } - - if ( isset( $config['type'] ) ) { - $this->_type = $config['type']; - } - - parent::__construct($subject); - } - - /** - * Loads the plugin language file - * - * @access public - * @param string $extension The extension for which a language file should be loaded - * @param string $basePath The basepath to use - * @return boolean True, if the file has successfully loaded. - * @since 1.5 - */ - function loadLanguage($extension = '', $basePath = JPATH_BASE) - { - if(empty($extension)) { - $extension = 'plg_'.$this->_type.'_'.$this->_name; - } - - $lang =& JFactory::getLanguage(); - return $lang->load( strtolower($extension), $basePath); - } - - -} +params = $config['params']; + } else { + $this->params = new JParameter($config['params']); + } + } + + if ( isset( $config['name'] ) ) { + $this->_name = $config['name']; + } + + if ( isset( $config['type'] ) ) { + $this->_type = $config['type']; + } + + parent::__construct($subject); + } + + public function __get($var) { + if(isset($this->$var)) { + return $this->$var; + } + return null; + } + + /** + * Loads the plugin language file + * + * @access public + * @param string $extension The extension for which a language file should be loaded + * @param string $basePath The basepath to use + * @return boolean True, if the file has successfully loaded. + * @since 1.5 + */ + public function loadLanguage($extension = '', $basePath = JPATH_BASE) + { + if(empty($extension)) { + $extension = 'plg_'.$this->_type.'_'.$this->_name; + } + + $lang =& JFactory::getLanguage(); + return $lang->load( strtolower($extension), $basePath); + } + + +} diff --git a/libraries/joomla/registry/format.php b/libraries/joomla/registry/format.php index 1e2acf1cf5e4e..61fbbaaa3e993 100644 --- a/libraries/joomla/registry/format.php +++ b/libraries/joomla/registry/format.php @@ -19,12 +19,11 @@ * Abstract Format for JRegistry * * @abstract - * @author Samuel Moffatt * @package Joomla.Framework * @subpackage Registry * @since 1.5 */ -class JRegistryFormat extends JObject +abstract class JRegistryFormat extends JObject { /** * Returns a reference to a Format object, only creating it @@ -35,7 +34,7 @@ class JRegistryFormat extends JObject * @return object Registry format handler * @since 1.5 */ - function &getInstance($format) + public static function &getInstance($format) { static $instances; @@ -49,11 +48,11 @@ function &getInstance($format) $class = 'JRegistryFormat'.$format; if(!class_exists($class)) { - $path = dirname(__FILE__).DS.'format'.DS.$format.'.php'; + $path = dirname(__FILE__).DS.'format'.DS.$format.'.php'; if (file_exists($path)) { - require_once($path); + require_once $path; } else { - JError::raiseError(500,JText::_('Unable to load format class')); + throw new JException(JText::_('Unable to load format class'), 500, E_ERROR, $format); } } @@ -71,9 +70,7 @@ function &getInstance($format) * @return object Data Object * @since 1.5 */ - function stringToObject( $data, $namespace='' ) { - return true; - } + abstract public function stringToObject( $data, $process_sections=false ); /** * Converts an object into a formatted string @@ -84,7 +81,5 @@ function stringToObject( $data, $namespace='' ) { * @return string Formatted string * @since 1.5 */ - function objectToString( &$object ) { - - } -} \ No newline at end of file + abstract public function objectToString( &$object, $params ); +} diff --git a/libraries/joomla/registry/format/index.html b/libraries/joomla/registry/format/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/registry/format/index.html +++ b/libraries/joomla/registry/format/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/registry/format/ini.php b/libraries/joomla/registry/format/ini.php index 9977c153e0673..8705ff29e3e42 100644 --- a/libraries/joomla/registry/format/ini.php +++ b/libraries/joomla/registry/format/ini.php @@ -18,7 +18,6 @@ /** * INI format handler for JRegistry * - * @author Samuel Moffatt * @package Joomla.Framework * @subpackage Registry * @since 1.5 @@ -36,7 +35,7 @@ class JRegistryFormatINI extends JRegistryFormat * @param array $param Parameters used by the formatter * @return string INI Formatted String */ - function objectToString( &$object, $params ) + public function objectToString( &$object, $params ) { // Initialize variables @@ -94,7 +93,7 @@ function objectToString( &$object, $params ) * @param boolean add an associative index for each section [in brackets] * @return object Data Object */ - function &stringToObject( $data, $process_sections = false ) + public function stringToObject( $data, $process_sections = false ) { static $inistocache; diff --git a/libraries/joomla/registry/format/php.php b/libraries/joomla/registry/format/php.php index 7fad830c78df9..e930d9d95b4fa 100644 --- a/libraries/joomla/registry/format/php.php +++ b/libraries/joomla/registry/format/php.php @@ -18,7 +18,6 @@ /** * PHP class format handler for JRegistry * - * @author Louis Landry * @package Joomla.Framework * @subpackage Registry * @since 1.5 @@ -35,7 +34,7 @@ class JRegistryFormatPHP extends JRegistryFormat { * @return string Config class formatted string * @since 1.5 */ - function objectToString( &$object, $params ) { + public function objectToString( &$object, $params ) { // Build the object variables string $vars = ''; @@ -62,11 +61,11 @@ function objectToString( &$object, $params ) { * @return boolean True * @since 1.5 */ - function stringToObject() { + public function stringToObject( $data, $process_sections = false) { return true; } - function _getArrayString($a) + protected function _getArrayString($a) { $s = 'array('; $i = 0; @@ -84,4 +83,4 @@ function _getArrayString($a) $s .= ')'; return $s; } -} \ No newline at end of file +} diff --git a/libraries/joomla/registry/format/xml.php b/libraries/joomla/registry/format/xml.php index f2b85f81e5891..3c6f05d7f6fa4 100644 --- a/libraries/joomla/registry/format/xml.php +++ b/libraries/joomla/registry/format/xml.php @@ -11,14 +11,13 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ - + // Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die(); /** * XML Format for JRegistry * - * @author Samuel Moffatt * @package Joomla.Framework * @subpackage Registry * @since 1.5 @@ -32,7 +31,7 @@ class JRegistryFormatXML extends JRegistryFormat { * @param string XML Formatted String * @return object Data Object */ - function stringToObject( $data, $namespace='' ) { + public function stringToObject( $data, $process_sections = false) { return true; } @@ -46,7 +45,7 @@ function stringToObject( $data, $namespace='' ) { * @param array $param Parameters used by the formatter * @return string XML Formatted String */ - function objectToString( &$object, $params ) + public function objectToString( &$object, $params ) { $depth = 1; $retval = "\n\n"; @@ -73,7 +72,7 @@ function objectToString( &$object, $params ) * @param int $depth The depth in the XML tree of the $object node * @return string XML string */ - function _buildXMLstringLevel($object, $depth) + protected function _buildXMLstringLevel($object, $depth) { // Initialize variables $retval = ''; @@ -95,4 +94,4 @@ function _buildXMLstringLevel($object, $depth) } return $retval; } -} \ No newline at end of file +} diff --git a/libraries/joomla/registry/index.html b/libraries/joomla/registry/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/registry/index.html +++ b/libraries/joomla/registry/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/registry/registry.php b/libraries/joomla/registry/registry.php index da985445dc73a..59b6ed50a44ca 100644 --- a/libraries/joomla/registry/registry.php +++ b/libraries/joomla/registry/registry.php @@ -1,509 +1,512 @@ - - * @package Joomla.Framework - * @subpackage Registry - * @since 1.5 - */ -class JRegistry extends JObject -{ - /** - * Default NameSpace - * @var string - */ - var $_defaultNameSpace = null; - - /** - * Registry Object - * - actually an array of namespace objects - * @var array - */ - var $_registry = array (); - - /** - * Constructor - * - * @access protected - * @param string $namespace Default registry namespace - * @return void - * @since 1.5 - */ - function __construct($namespace = 'default') - { - $this->_defaultNameSpace = $namespace; - $this->makeNameSpace($namespace); - } - - /** - * Returns a reference to a global JRegistry object, only creating it - * if it doesn't already exist. - * - * This method must be invoked as: - *
      $registry =& JRegistry::getInstance($id[, $namespace]);
      - * - * @static - * @param string $id An ID for the registry instance - * @param string $namespace The default namespace for the registry object [optional] - * @return object The JRegistry object. - * @since 1.5 - */ - function &getInstance($id, $namespace = 'default') - { - static $instances; - - if (!isset ($instances)) { - $instances = array (); - } - - if (empty ($instances[$id])) { - $instances[$id] = new JRegistry($namespace); - } - - return $instances[$id]; - } - - /** - * Create a namespace - * - * @access public - * @param string $namespace Name of the namespace to create - * @return boolean True on success - * @since 1.5 - */ - function makeNameSpace($namespace) - { - $this->_registry[$namespace] = array('data' => new stdClass()); - return true; - } - - /** - * Get the list of namespaces - * - * @access public - * @return array List of namespaces - * @since 1.5 - */ - function getNameSpaces() - { - return array_keys($this->_registry); - } - - /** - * Get a registry value - * - * @access public - * @param string $regpath Registry path (e.g. joomla.content.showauthor) - * @param mixed $default Optional default value - * @return mixed Value of entry or null - * @since 1.5 - */ - function getValue($regpath, $default=null) - { - $result = $default; - - // Explode the registry path into an array - if ($nodes = explode('.', $regpath)) - { - // Get the namespace - //$namespace = array_shift($nodes); - if (count($nodes)<2) { - $namespace = $this->_defaultNameSpace; - $nodes[1] = $nodes[0]; - } else { - $namespace = $nodes[0]; - } - - if (isset($this->_registry[$namespace])) { - $ns = & $this->_registry[$namespace]['data']; - $pathNodes = count($nodes) - 1; - - //for ($i = 0; $i < $pathNodes; $i ++) { - for ($i = 1; $i < $pathNodes; $i ++) { - if((isset($ns->$nodes[$i]))) $ns =& $ns->$nodes[$i]; - } - - if(isset($ns->$nodes[$i])) { - $result = $ns->$nodes[$i]; - } - } - } - return $result; - } - - /** - * Set a registry value - * - * @access public - * @param string $regpath Registry Path (e.g. joomla.content.showauthor) - * @param mixed $value Value of entry - * @return mixed Value of old value or boolean false if operation failed - * @since 1.5 - */ - function setValue($regpath, $value) - { - // Explode the registry path into an array - $nodes = explode('.', $regpath); - - // Get the namespace - if (count($nodes)<2) { - $namespace = $this->_defaultNameSpace; - } else { - $namespace = array_shift($nodes); - } - - if (!isset($this->_registry[$namespace])) { - $this->makeNameSpace($namespace); - } - - $ns = & $this->_registry[$namespace]['data']; - - $pathNodes = count($nodes) - 1; - - if ($pathNodes < 0) { - $pathNodes = 0; - } - - for ($i = 0; $i < $pathNodes; $i ++) - { - // If any node along the registry path does not exist, create it - if (!isset($ns->$nodes[$i])) { - $ns->$nodes[$i] = new stdClass(); - } - $ns =& $ns->$nodes[$i]; - } - - // Get the old value if exists so we can return it - $ns->$nodes[$i] =& $value; - - return $ns->$nodes[$i]; - } - - /** - * Load a associative array of values into the default namespace - * - * @access public - * @param array $array Associative array of value to load - * @param string $namepsace The name of the namespace - * @return boolean True on success - * @since 1.5 - */ - function loadArray($array, $namespace = null) - { - // If namespace is not set, get the default namespace - if ($namespace == null) { - $namespace = $this->_defaultNameSpace; - } - - if (!isset($this->_registry[$namespace])) { - // If namespace does not exist, make it and load the data - $this->makeNameSpace($namespace); - } - - // Load the variables into the registry's default namespace. - foreach ($array as $k => $v) - { - $this->_registry[$namespace]['data']->$k = $v; - } - - return true; - } - - /** - * Load the public variables of the object into the default namespace. - * - * @access public - * @param object $object The object holding the public vars to load - * @param string $namespace Namespace to load the INI string into [optional] - * @return boolean True on success - * @since 1.5 - */ - function loadObject(&$object, $namespace = null) - { - // If namespace is not set, get the default namespace - if ($namespace == null) { - $namespace = $this->_defaultNameSpace; - } - - if (!isset($this->_registry[$namespace])) { - // If namespace does not exist, make it and load the data - $this->makeNameSpace($namespace); - } - - /* - * We want to leave groups that are already in the namespace and add the - * groups loaded into the namespace. This overwrites any existing group - * with the same name - */ - if (is_object( $object )) - { - foreach (get_object_vars($object) as $k => $v) { - if (substr($k, 0,1) != '_' || $k == '_name') { - $this->_registry[$namespace]['data']->$k = $v; - } - } - } - - return true; - } - - /** - * Load the contents of a file into the registry - * - * @access public - * @param string $file Path to file to load - * @param string $format Format of the file [optional: defaults to INI] - * @param string $namespace Namespace to load the INI string into [optional] - * @return boolean True on success - * @since 1.5 - */ - function loadFile($file, $format = 'INI', $namespace = null) - { - // Load a file into the given namespace [or default namespace if not given] - $handler =& JRegistryFormat::getInstance($format); - - // If namespace is not set, get the default namespace - if ($namespace == null) { - $namespace = $this->_defaultNameSpace; - } - - // Get the contents of the file - jimport('joomla.filesystem.file'); - $data = JFile::read($file); - - if (!isset($this->_registry[$namespace])) - { - // If namespace does not exist, make it and load the data - $this->makeNameSpace($namespace); - $this->_registry[$namespace]['data'] = $handler->stringToObject($data); - } - else - { - // Get the data in object format - $ns = $handler->stringToObject($data); - - /* - * We want to leave groups that are already in the namespace and add the - * groups loaded into the namespace. This overwrites any existing group - * with the same name - */ - foreach (get_object_vars($ns) as $k => $v) { - $this->_registry[$namespace]['data']->$k = $v; - } - } - - return true; - } - - /** - * Load an XML string into the registry into the given namespace [or default if a namespace is not given] - * - * @access public - * @param string $data XML formatted string to load into the registry - * @param string $namespace Namespace to load the XML string into [optional] - * @return boolean True on success - * @since 1.5 - */ - function loadXML($data, $namespace = null) - { - // Load a string into the given namespace [or default namespace if not given] - $handler =& JRegistryFormat::getInstance('XML'); - - // If namespace is not set, get the default namespace - if ($namespace == null) { - $namespace = $this->_defaultNameSpace; - } - - if (!isset($this->_registry[$namespace])) { - // If namespace does not exist, make it and load the data - $this->makeNameSpace($namespace); - $this->_registry[$namespace]['data'] =& $handler->stringToObject($data); - } else { - // Get the data in object format - $ns =& $handler->stringToObject($data); - - /* - * We want to leave groups that are already in the namespace and add the - * groups loaded into the namespace. This overwrites any existing group - * with the same name - */ - foreach (get_object_vars($ns) as $k => $v) { - $this->_registry[$namespace]['data']->$k = $v; - } - } - - return true; - } - - /** - * Load an INI string into the registry into the given namespace [or default if a namespace is not given] - * - * @access public - * @param string $data INI formatted string to load into the registry - * @param string $namespace Namespace to load the INI string into [optional] - * @return boolean True on success - * @since 1.5 - */ - function loadINI($data, $namespace = null) - { - // Load a string into the given namespace [or default namespace if not given] - $handler =& JRegistryFormat::getInstance('INI'); - - // If namespace is not set, get the default namespace - if ($namespace == null) { - $namespace = $this->_defaultNameSpace; - } - - if (!isset($this->_registry[$namespace])) { - // If namespace does not exist, make it and load the data - $this->makeNameSpace($namespace); - $this->_registry[$namespace]['data'] =& $handler->stringToObject($data); - } else { - // Get the data in object format - $ns = $handler->stringToObject($data); - - /* - * We want to leave groups that are already in the namespace and add the - * groups loaded into the namespace. This overwrites any existing group - * with the same name - */ - foreach (get_object_vars($ns) as $k => $v) { - $this->_registry[$namespace]['data']->$k = $v; - } - } - - return true; - } - - /** - * Merge a JRegistry object into this one - * - * @access public - * @param object $source Source JRegistry object ot merge - * @return boolean True on success - * @since 1.5 - */ - function merge(&$source) - { - if (is_a($source, 'JRegistry')) - { - $sns = $source->getNameSpaces(); - foreach ($sns as $ns) - { - if (!isset($this->_registry[$ns])) - { - // If namespace does not exist, make it and load the data - $this->makeNameSpace($ns); - } - - // Load the variables into the registry's default namespace. - foreach ($source->toArray($ns) as $k => $v) - { - if ($v != null) { - $this->_registry[$ns]['data']->$k = $v; - } - } - } - return true; - } - return false; - } - - /** - * Get a namespace in a given string format - * - * @access public - * @param string $format Format to return the string in - * @param string $namespace Namespace to return [optional: null returns the default namespace] - * @param mixed $params Parameters used by the formatter, see formatters for more info - * @return string Namespace in string format - * @since 1.5 - */ - function toString($format = 'INI', $namespace = null, $params = null) - { - // Return a namespace in a given format - $handler =& JRegistryFormat::getInstance($format); - - // If namespace is not set, get the default namespace - if ($namespace == null) { - $namespace = $this->_defaultNameSpace; - } - - // Get the namespace - $ns = & $this->_registry[$namespace]['data']; - - return $handler->objectToString($ns, $params); - } - - /** - * Transforms a namespace to an array - * - * @access public - * @param string $namespace Namespace to return [optional: null returns the default namespace] - * @return array An associative array holding the namespace data - * @since 1.5 - */ - function toArray($namespace = null) - { - // If namespace is not set, get the default namespace - if ($namespace == null) { - $namespace = $this->_defaultNameSpace; - } - - // Get the namespace - $ns = & $this->_registry[$namespace]['data']; - - $array = array(); - foreach (get_object_vars( $ns ) as $k => $v) { - $array[$k] = $v; - } - - return $array; - } - - /** - * Transforms a namespace to an object - * - * @access public - * @param string $namespace Namespace to return [optional: null returns the default namespace] - * @return object An an object holding the namespace data - * @since 1.5 - */ - function toObject($namespace = null) - { - // If namespace is not set, get the default namespace - if ($namespace == null) { - $namespace = $this->_defaultNameSpace; - } - - // Get the namespace - $ns = & $this->_registry[$namespace]['data']; - - return $ns; - } - - function __clone() - { - $this->_registry = unserialize(serialize($this->_registry)); - } -} \ No newline at end of file +_defaultNameSpace = $namespace; + $this->makeNameSpace($namespace); + } + + /** + * Returns a reference to a global JRegistry object, only creating it + * if it doesn't already exist. + * + * This method must be invoked as: + *
      $registry =& JRegistry::getInstance($id[, $namespace]);
      + * + * @static + * @param string $id An ID for the registry instance + * @param string $namespace The default namespace for the registry object [optional] + * @return object The JRegistry object. + * @since 1.5 + */ + public static function &getInstance($id, $namespace = 'default') + { + static $instances; + + if (!isset ($instances)) { + $instances = array (); + } + + if (empty ($instances[$id])) { + $instances[$id] = new JRegistry($namespace); + } + + return $instances[$id]; + } + + /** + * Create a namespace + * + * @access public + * @param string $namespace Name of the namespace to create + * @return boolean True on success + * @since 1.5 + */ + public function makeNameSpace($namespace) + { + $this->_registry[$namespace] = array('data' => new stdClass()); + return true; + } + + /** + * Get the list of namespaces + * + * @access public + * @return array List of namespaces + * @since 1.5 + */ + public function getNameSpaces() + { + return array_keys($this->_registry); + } + + /** + * Get a registry value + * + * @access public + * @param string $regpath Registry path (e.g. joomla.content.showauthor) + * @param mixed $default Optional default value + * @return mixed Value of entry or null + * @since 1.5 + */ + public function getValue($regpath, $default=null) + { + $result = $default; + + // Explode the registry path into an array + if ($nodes = explode('.', $regpath)) + { + // Get the namespace + //$namespace = array_shift($nodes); + $count = count($nodes); + if ($count < 2) { + $namespace = $this->_defaultNameSpace; + $nodes[1] = $nodes[0]; + } else { + $namespace = $nodes[0]; + } + + if (isset($this->_registry[$namespace])) { + $ns = & $this->_registry[$namespace]['data']; + $pathNodes = $count - 1; + + //for ($i = 0; $i < $pathNodes; $i ++) { + for ($i = 1; $i < $pathNodes; $i ++) { + if((isset($ns->$nodes[$i]))) $ns =& $ns->$nodes[$i]; + } + + if(isset($ns->$nodes[$i])) { + $result = $ns->$nodes[$i]; + } + } + } + return $result; + } + + /** + * Set a registry value + * + * @access public + * @param string $regpath Registry Path (e.g. joomla.content.showauthor) + * @param mixed $value Value of entry + * @return mixed Value of old value or boolean false if operation failed + * @since 1.5 + */ + public function setValue($regpath, $value) + { + // Explode the registry path into an array + $nodes = explode('.', $regpath); + + // Get the namespace + $count = count($nodes); + + if ($count < 2) { + $namespace = $this->_defaultNameSpace; + } else { + $namespace = array_shift($nodes); + $count--; + } + + if (!isset($this->_registry[$namespace])) { + $this->makeNameSpace($namespace); + } + + $ns = & $this->_registry[$namespace]['data']; + + $pathNodes = $count - 1; + + if ($pathNodes < 0) { + $pathNodes = 0; + } + + for ($i = 0; $i < $pathNodes; $i ++) + { + // If any node along the registry path does not exist, create it + if (!isset($ns->$nodes[$i])) { + $ns->$nodes[$i] = new stdClass(); + } + $ns =& $ns->$nodes[$i]; + } + + // Get the old value if exists so we can return it + $ns->$nodes[$i] =& $value; + + return $ns->$nodes[$i]; + } + + /** + * Load a associative array of values into the default namespace + * + * @access public + * @param array $array Associative array of value to load + * @param string $namepsace The name of the namespace + * @return boolean True on success + * @since 1.5 + */ + public function loadArray($array, $namespace = null) + { + // If namespace is not set, get the default namespace + if ($namespace == null) { + $namespace = $this->_defaultNameSpace; + } + + if (!isset($this->_registry[$namespace])) { + // If namespace does not exist, make it and load the data + $this->makeNameSpace($namespace); + } + + // Load the variables into the registry's default namespace. + foreach ($array as $k => $v) + { + $this->_registry[$namespace]['data']->$k = $v; + } + + return true; + } + + /** + * Load the public variables of the object into the default namespace. + * + * @access public + * @param object $object The object holding the public vars to load + * @param string $namespace Namespace to load the INI string into [optional] + * @return boolean True on success + * @since 1.5 + */ + public function loadObject(&$object, $namespace = null) + { + // If namespace is not set, get the default namespace + if ($namespace == null) { + $namespace = $this->_defaultNameSpace; + } + + if (!isset($this->_registry[$namespace])) { + // If namespace does not exist, make it and load the data + $this->makeNameSpace($namespace); + } + + /* + * We want to leave groups that are already in the namespace and add the + * groups loaded into the namespace. This overwrites any existing group + * with the same name + */ + if (is_object( $object )) + { + foreach (get_object_vars($object) as $k => $v) { + if (substr($k, 0,1) != '_' || $k == '_name') { + $this->_registry[$namespace]['data']->$k = $v; + } + } + } + + return true; + } + + /** + * Load the contents of a file into the registry + * + * @access public + * @param string $file Path to file to load + * @param string $format Format of the file [optional: defaults to INI] + * @param string $namespace Namespace to load the INI string into [optional] + * @return boolean True on success + * @since 1.5 + */ + public function loadFile($file, $format = 'INI', $namespace = null) + { + // Load a file into the given namespace [or default namespace if not given] + $handler =& JRegistryFormat::getInstance($format); + + // If namespace is not set, get the default namespace + if ($namespace == null) { + $namespace = $this->_defaultNameSpace; + } + + // Get the contents of the file + jimport('joomla.filesystem.file'); + $data = JFile::read($file); + + if (!isset($this->_registry[$namespace])) + { + // If namespace does not exist, make it and load the data + $this->makeNameSpace($namespace); + $this->_registry[$namespace]['data'] = $handler->stringToObject($data); + } + else + { + // Get the data in object format + $ns = $handler->stringToObject($data); + + /* + * We want to leave groups that are already in the namespace and add the + * groups loaded into the namespace. This overwrites any existing group + * with the same name + */ + foreach (get_object_vars($ns) as $k => $v) { + $this->_registry[$namespace]['data']->$k = $v; + } + } + + return true; + } + + /** + * Load an XML string into the registry into the given namespace [or default if a namespace is not given] + * + * @access public + * @param string $data XML formatted string to load into the registry + * @param string $namespace Namespace to load the XML string into [optional] + * @return boolean True on success + * @since 1.5 + */ + public function loadXML($data, $namespace = null) + { + // Load a string into the given namespace [or default namespace if not given] + $handler =& JRegistryFormat::getInstance('XML'); + + // If namespace is not set, get the default namespace + if ($namespace == null) { + $namespace = $this->_defaultNameSpace; + } + + if (!isset($this->_registry[$namespace])) { + // If namespace does not exist, make it and load the data + $this->makeNameSpace($namespace); + $this->_registry[$namespace]['data'] =& $handler->stringToObject($data); + } else { + // Get the data in object format + $ns =& $handler->stringToObject($data); + + /* + * We want to leave groups that are already in the namespace and add the + * groups loaded into the namespace. This overwrites any existing group + * with the same name + */ + foreach (get_object_vars($ns) as $k => $v) { + $this->_registry[$namespace]['data']->$k = $v; + } + } + + return true; + } + + /** + * Load an INI string into the registry into the given namespace [or default if a namespace is not given] + * + * @access public + * @param string $data INI formatted string to load into the registry + * @param string $namespace Namespace to load the INI string into [optional] + * @return boolean True on success + * @since 1.5 + */ + public function loadINI($data, $namespace = null) + { + // Load a string into the given namespace [or default namespace if not given] + $handler =& JRegistryFormat::getInstance('INI'); + + // If namespace is not set, get the default namespace + if ($namespace == null) { + $namespace = $this->_defaultNameSpace; + } + + if (!isset($this->_registry[$namespace])) { + // If namespace does not exist, make it and load the data + $this->makeNameSpace($namespace); + $this->_registry[$namespace]['data'] =& $handler->stringToObject($data); + } else { + // Get the data in object format + $ns = $handler->stringToObject($data); + + /* + * We want to leave groups that are already in the namespace and add the + * groups loaded into the namespace. This overwrites any existing group + * with the same name + */ + foreach (get_object_vars($ns) as $k => $v) { + $this->_registry[$namespace]['data']->$k = $v; + } + } + + return true; + } + + /** + * Merge a JRegistry object into this one + * + * @access public + * @param object $source Source JRegistry object ot merge + * @return boolean True on success + * @since 1.5 + */ + public function merge(&$source) + { + if ($source INSTANCEOF JRegistry) + { + $sns = $source->getNameSpaces(); + foreach ($sns as $ns) + { + if (!isset($this->_registry[$ns])) + { + // If namespace does not exist, make it and load the data + $this->makeNameSpace($ns); + } + + // Load the variables into the registry's default namespace. + foreach ($source->toArray($ns) as $k => $v) + { + if ($v != null) { + $this->_registry[$ns]['data']->$k = $v; + } + } + } + return true; + } + return false; + } + + /** + * Get a namespace in a given string format + * + * @access public + * @param string $format Format to return the string in + * @param string $namespace Namespace to return [optional: null returns the default namespace] + * @param mixed $params Parameters used by the formatter, see formatters for more info + * @return string Namespace in string format + * @since 1.5 + */ + public function toString($format = 'INI', $namespace = null, $params = null) + { + // Return a namespace in a given format + $handler =& JRegistryFormat::getInstance($format); + + // If namespace is not set, get the default namespace + if ($namespace == null) { + $namespace = $this->_defaultNameSpace; + } + + // Get the namespace + $ns = & $this->_registry[$namespace]['data']; + + return $handler->objectToString($ns, $params); + } + + /** + * Transforms a namespace to an array + * + * @access public + * @param string $namespace Namespace to return [optional: null returns the default namespace] + * @return array An associative array holding the namespace data + * @since 1.5 + */ + public function toArray($namespace = null) + { + // If namespace is not set, get the default namespace + if ($namespace == null) { + $namespace = $this->_defaultNameSpace; + } + + // Get the namespace + $ns = & $this->_registry[$namespace]['data']; + + $array = array(); + foreach (get_object_vars( $ns ) as $k => $v) { + $array[$k] = $v; + } + + return $array; + } + + /** + * Transforms a namespace to an object + * + * @access public + * @param string $namespace Namespace to return [optional: null returns the default namespace] + * @return object An an object holding the namespace data + * @since 1.5 + */ + public function toObject($namespace = null) + { + // If namespace is not set, get the default namespace + if ($namespace == null) { + $namespace = $this->_defaultNameSpace; + } + + // Get the namespace + $ns = & $this->_registry[$namespace]['data']; + + return $ns; + } + + public function __clone() + { + $this->_registry = unserialize(serialize($this->_registry)); + } +} diff --git a/libraries/joomla/session/index.html b/libraries/joomla/session/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/session/index.html +++ b/libraries/joomla/session/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/session/session.php b/libraries/joomla/session/session.php index 1ef411fa03a61..8502963c82cbe 100644 --- a/libraries/joomla/session/session.php +++ b/libraries/joomla/session/session.php @@ -1,731 +1,728 @@ - -* @package Joomla.Framework -* @subpackage Session -* @since 1.5 -*/ -class JSession extends JObject -{ - /** - * internal state - * - * @access protected - * @var string $_state one of 'active'|'expired'|'destroyed|'error' - * @see getState() - */ - var $_state = 'active'; - - /** - * Maximum age of unused session - * - * @access protected - * @var string $_expire minutes - */ - var $_expire = 15; - - /** - * The session store object - * - * @access protected - * @var object A JSessionStorage object - */ - var $_store = null; - - /** - * security policy - * - * Default values: - * - fix_browser - * - fix_adress - * - * @access protected - * @var array $_security list of checks that will be done. - */ - var $_security = array( 'fix_browser' ); - - /** - * Constructor - * - * @access protected - * @param string $storage - * @param array $options optional parameters - */ - function __construct( $store = 'none', $options = array() ) - { - // Register faked "destructor" in PHP4, this needs to happen before creating the session store - if (version_compare(PHP_VERSION, '5') == -1) { - register_shutdown_function((array(&$this, '__destruct'))); - } - - //set default sessios save handler - ini_set('session.save_handler', 'files'); - - //disable transparent sid support - ini_set('session.use_trans_sid', '0'); - - //create handler - $this->_store =& JSessionStorage::getInstance($store, $options); - - //set options - $this->_setOptions( $options ); - - //load the session - $this->_start(); - - //initialise the session - $this->_setCounter(); - $this->_setTimers(); - - $this->_state = 'active'; - - // perform security checks - $this->_validate(); - } - - /** - * Session object destructor - * - * @access private - * @since 1.5 - */ - function __destruct() { - $this->close(); - } - - /** - * Returns a reference to the global Session object, only creating it - * if it doesn't already exist. - * - * This method must be invoked as: - *
        $session = &JSession::getInstance();
      - * - * @access public - * @return JSession The Session object. - * @since 1.5 - */ - function & getInstance($handler, $options) - { - static $instance; - - if (!is_object($instance)) { - $instance = new JSession($handler, $options); - } - - return $instance; - } - - /** - * Get current state of session - * - * @access public - * @return string The session state - */ - function getState() { - return $this->_state; - } - - /** - * Get expiration time in minutes - * - * @access public - * @return integer The session expiration time in minutes - */ - function getExpire() { - return $this->_expire; - } - - /** - * Get a session token, if a token isn't set yet one will be generated. - * - * Tokens are used to secure forms from spamming attacks. Once a token - * has been generated the system will check the post request to see if - * it is present, if not it will invalidate the session. - * - * @param boolean $forceNew If true, force a new token to be created - * @access public - * @return string The session token - */ - function getToken($forceNew = false) - { - $token = $this->get( 'session.token' ); - - //create a token - if( $token === null || $forceNew ) { - $token = $this->_createToken( 12 ); - $this->set( 'session.token', $token ); - } - - return $token; - } - - /** - * Method to determine if a token exists in the session. If not the - * session will be set to expired - * - * @param string Hashed token to be verified - * @param boolean If true, expires the session - * @since 1.5 - * @static - */ - function hasToken($tCheck, $forceExpire = true) - { - // check if a token exists in the session - $tStored = $this->get( 'session.token' ); - - //check token - if(($tStored !== $tCheck)) - { - if($forceExpire) { - $this->_state = 'expired'; - } - return false; - } - - return true; - } - - - /** - * Get session name - * - * @access public - * @return string The session name - */ - function getName() - { - if( $this->_state === 'destroyed' ) { - // @TODO : raise error - return null; - } - return session_name(); - } - - /** - * Get session id - * - * @access public - * @return string The session name - */ - function getId() - { - if( $this->_state === 'destroyed' ) { - // @TODO : raise error - return null; - } - return session_id(); - } - - /** - * Get the session handlers - * - * @access public - * @return array An array of available session handlers - */ - function getStores() - { - jimport('joomla.filesystem.folder'); - $handlers = JFolder::files(dirname(__FILE__).DS.'storage', '.php$'); - - $names = array(); - foreach($handlers as $handler) - { - $name = substr($handler, 0, strrpos($handler, '.')); - $class = 'JSessionStorage'.ucfirst($name); - - //Load the class only if needed - if(!class_exists($class)) { - require_once(dirname(__FILE__).DS.'storage'.DS.$name.'.php'); - } - - if(call_user_func_array( array( trim($class), 'test' ), null)) { - $names[] = $name; - } - } - - return $names; - } - - /** - * Check whether this session is currently created - * - * @access public - * @return boolean $result true on success - */ - function isNew() - { - $counter = $this->get( 'session.counter' ); - if( $counter === 1 ) { - return true; - } - return false; - } - - /** - * Get data from the session store - * - * @static - * @access public - * @param string $name Name of a variable - * @param mixed $default Default value of a variable if not set - * @param string $namespace Namespace to use, default to 'default' - * @return mixed Value of a variable - */ - function &get($name, $default = null, $namespace = 'default') - { - $namespace = '__'.$namespace; //add prefix to namespace to avoid collisions - - if($this->_state !== 'active' && $this->_state !== 'expired') { - // @TODO :: generated error here - $error = null; - return $error; - } - - if (isset($_SESSION[$namespace][$name])) { - return $_SESSION[$namespace][$name]; - } - return $default; - } - - /** - * Set data into the session store - * - * @access public - * @param string $name Name of a variable - * @param mixed $value Value of a variable - * @param string $namespace Namespace to use, default to 'default' - * @return mixed Old value of a variable - */ - function set($name, $value, $namespace = 'default') - { - $namespace = '__'.$namespace; //add prefix to namespace to avoid collisions - - if($this->_state !== 'active') { - // @TODO :: generated error here - return null; - } - - $old = isset($_SESSION[$namespace][$name]) ? $_SESSION[$namespace][$name] : null; - - if (null === $value) { - unset($_SESSION[$namespace][$name]); - } else { - $_SESSION[$namespace][$name] = $value; - } - - return $old; - } - - /** - * Check wheter data exists in the session store - * - * @access public - * @param string $name Name of variable - * @param string $namespace Namespace to use, default to 'default' - * @return boolean $result true if the variable exists - */ - function has( $name, $namespace = 'default' ) - { - $namespace = '__'.$namespace; //add prefix to namespace to avoid collisions - - if( $this->_state !== 'active' ) { - // @TODO :: generated error here - return null; - } - - return isset( $_SESSION[$namespace][$name] ); - } - - /** - * Unset data from the session store - * - * @access public - * @param string $name Name of variable - * @param string $namespace Namespace to use, default to 'default' - * @return mixed $value the value from session or NULL if not set - */ - function clear( $name, $namespace = 'default' ) - { - $namespace = '__'.$namespace; //add prefix to namespace to avoid collisions - - if( $this->_state !== 'active' ) { - // @TODO :: generated error here - return null; - } - - $value = null; - if( isset( $_SESSION[$namespace][$name] ) ) { - $value = $_SESSION[$namespace][$name]; - unset( $_SESSION[$namespace][$name] ); - } - - return $value; - } - - /** - * Start a session - * - * Creates a session (or resumes the current one based on the state of the session) - * - * @access private - * @return boolean $result true on success - */ - function _start() - { - // start session if not startet - if( $this->_state == 'restart' ) { - session_id( $this->_createId() ); - } - - session_cache_limiter('none'); - session_start(); - - // Send modified header for IE 6.0 Security Policy - header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'); - - return true; - } - - - /** - * Frees all session variables and destroys all data registered to a session - * - * This method resets the $_SESSION variable and destroys all of the data associated - * with the current session in its storage (file or DB). It forces new session to be - * started after this method is called. It does not unset the session cookie. - * - * @static - * @access public - * @return void - * @see session_unset() - * @see session_destroy() - */ - function destroy() - { - // session was already destroyed - if( $this->_state === 'destroyed' ) { - return true; - } - - // In order to kill the session altogether, like to log the user out, the session id - // must also be unset. If a cookie is used to propagate the session id (default behavior), - // then the session cookie must be deleted. - if (isset($_COOKIE[session_name()])) { - setcookie(session_name(), '', time()-42000, '/'); - } - - session_unset(); - session_destroy(); - - $this->_state = 'destroyed'; - return true; - } - - /** - * restart an expired or locked session - * - * @access public - * @return boolean $result true on success - * @see destroy - */ - function restart() - { - $this->destroy(); - if( $this->_state !== 'destroyed' ) { - // @TODO :: generated error here - return false; - } - - // Re-register the session handler after a session has been destroyed, to avoid PHP bug - $this->_store->register(); - - $this->_state = 'restart'; - //regenerate session id - $id = $this->_createId( strlen( $this->getId() ) ); - session_id($id); - $this->_start(); - $this->_state = 'active'; - - $this->_validate(); - $this->_setCounter(); - - return true; - } - - /** - * Create a new session and copy variables from the old one - * - * @abstract - * @access public - * @return boolean $result true on success - */ - function fork() - { - if( $this->_state !== 'active' ) { - // @TODO :: generated error here - return false; - } - - // save values - $values = $_SESSION; - - // keep session config - $trans = ini_get( 'session.use_trans_sid' ); - if( $trans ) { - ini_set( 'session.use_trans_sid', 0 ); - } - $cookie = session_get_cookie_params(); - - // create new session id - $id = $this->_createId( strlen( $this->getId() ) ); - - // kill session - session_destroy(); - - // re-register the session store after a session has been destroyed, to avoid PHP bug - $this->_store->register(); - - // restore config - ini_set( 'session.use_trans_sid', $trans ); - session_set_cookie_params( $cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'] ); - - // restart session with new id - session_id( $id ); - session_start(); - - return true; - } - - /** - * Writes session data and ends session - * - * Session data is usually stored after your script terminated without the need - * to call JSession::close(),but as session data is locked to prevent concurrent - * writes only one script may operate on a session at any time. When using - * framesets together with sessions you will experience the frames loading one - * by one due to this locking. You can reduce the time needed to load all the - * frames by ending the session as soon as all changes to session variables are - * done. - * - * @access public - * @see session_write_close() - */ - function close() { - session_write_close(); - } - - /** - * Create a session id - * - * @static - * @access private - * @return string Session ID - */ - function _createId( ) - { - $id = 0; - while (strlen($id) < 32) { - $id .= mt_rand(0, mt_getrandmax()); - } - - $id = md5( uniqid($id, true)); - return $id; - } - - /** - * Create a token-string - * - * @access protected - * @param int $length lenght of string - * @return string $id generated token - */ - function _createToken( $length = 32 ) - { - static $chars = '0123456789abcdef'; - $max = strlen( $chars ) - 1; - $token = ''; - $name = session_name(); - for( $i = 0; $i < $length; ++$i ) { - $token .= $chars[ (rand( 0, $max )) ]; - } - - return md5($token.$name); - } - - /** - * Set counter of session usage - * - * @access protected - * @return boolean $result true on success - */ - function _setCounter() - { - $counter = $this->get( 'session.counter', 0 ); - ++$counter; - - $this->set( 'session.counter', $counter ); - return true; - } - - /** - * Set the session timers - * - * @access protected - * @return boolean $result true on success - */ - function _setTimers() - { - if( !$this->has( 'session.timer.start' ) ) - { - $start = time(); - - $this->set( 'session.timer.start' , $start ); - $this->set( 'session.timer.last' , $start ); - $this->set( 'session.timer.now' , $start ); - } - - $this->set( 'session.timer.last', $this->get( 'session.timer.now' ) ); - $this->set( 'session.timer.now', time() ); - - return true; - } - - /** - * set additional session options - * - * @access protected - * @param array $options list of parameter - * @return boolean $result true on success - */ - function _setOptions( &$options ) - { - // set name - if( isset( $options['name'] ) ) { - session_name( md5($options['name']) ); - } - - // set id - if( isset( $options['id'] ) ) { - session_id( $options['id'] ); - } - - // set expire time - if( isset( $options['expire'] ) ) { - $this->_expire = $options['expire']; - } - - // get security options - if( isset( $options['security'] ) ) { - $this->_security = explode( ',', $options['security'] ); - } - - //sync the session maxlifetime - ini_set('session.gc_maxlifetime', $this->_expire); - - return true; - } - - /** - * Do some checks for security reason - * - * - timeout check (expire) - * - ip-fixiation - * - browser-fixiation - * - * If one check failed, session data has to be cleaned. - * - * @access protected - * @param boolean $restart reactivate session - * @return boolean $result true on success - * @see http://shiflett.org/articles/the-truth-about-sessions - */ - function _validate( $restart = false ) - { - // allow to restart a session - if( $restart ) - { - $this->_state = 'active'; - - $this->set( 'session.client.address' , null ); - $this->set( 'session.client.forwarded' , null ); - $this->set( 'session.client.browser' , null ); - $this->set( 'session.token' , null ); - } - - // check if session has expired - if( $this->_expire ) - { - $curTime = $this->get( 'session.timer.now' , 0 ); - $maxTime = $this->get( 'session.timer.last', 0 ) + $this->_expire; - - // empty session variables - if( $maxTime < $curTime ) { - $this->_state = 'expired'; - return false; - } - } - - // record proxy forwarded for in the session in case we need it later - if( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { - $this->set( 'session.client.forwarded', $_SERVER['HTTP_X_FORWARDED_FOR']); - } - - // check for client adress - if( in_array( 'fix_adress', $this->_security ) && isset( $_SERVER['REMOTE_ADDR'] ) ) - { - $ip = $this->get( 'session.client.address' ); - - if( $ip === null ) { - $this->set( 'session.client.address', $_SERVER['REMOTE_ADDR'] ); - } - else if( $_SERVER['REMOTE_ADDR'] !== $ip ) - { - $this->_state = 'error'; - return false; - } - } - - // check for clients browser - if( in_array( 'fix_browser', $this->_security ) && isset( $_SERVER['HTTP_USER_AGENT'] ) ) - { - $browser = $this->get( 'session.client.browser' ); - - if( $browser === null ) { - $this->set( 'session.client.browser', $_SERVER['HTTP_USER_AGENT']); - } - else if( $_SERVER['HTTP_USER_AGENT'] !== $browser ) - { -// $this->_state = 'error'; -// return false; - } - } - - return true; - } -} +_store =& JSessionStorage::getInstance($store, $options); + + //set options + $this->_setOptions( $options ); + + //load the session + $this->_start(); + + //initialise the session + $this->_setCounter(); + $this->_setTimers(); + + $this->_state = 'active'; + + // perform security checks + $this->_validate(); + } + + /** + * Session object destructor + * + * @access private + * @since 1.5 + */ + public function __destruct() { + $this->close(); + } + + /** + * Returns a reference to the global Session object, only creating it + * if it doesn't already exist. + * + * This method must be invoked as: + *
        $session = &JSession::getInstance();
      + * + * @access public + * @return JSession The Session object. + * @since 1.5 + */ + public static function &getInstance($handler, $options) + { + static $instance; + + if (!is_object($instance)) { + $instance = new JSession($handler, $options); + } + + return $instance; + } + + /** + * Get current state of session + * + * @access public + * @return string The session state + */ + public function getState() { + return $this->_state; + } + + /** + * Get expiration time in minutes + * + * @access public + * @return integer The session expiration time in minutes + */ + public function getExpire() { + return $this->_expire; + } + + /** + * Get a session token, if a token isn't set yet one will be generated. + * + * Tokens are used to secure forms from spamming attacks. Once a token + * has been generated the system will check the post request to see if + * it is present, if not it will invalidate the session. + * + * @param boolean $forceNew If true, force a new token to be created + * @access public + * @return string The session token + */ + public function getToken($forceNew = false) + { + $token = $this->get( 'session.token' ); + + //create a token + if( $token === null || $forceNew ) { + $token = $this->_createToken( 12 ); + $this->set( 'session.token', $token ); + } + + return $token; + } + + /** + * Method to determine if a token exists in the session. If not the + * session will be set to expired + * + * @param string Hashed token to be verified + * @param boolean If true, expires the session + * @since 1.5 + * @static + */ + public function hasToken($tCheck, $forceExpire = true) + { + // check if a token exists in the session + $tStored = $this->get( 'session.token' ); + + //check token + if(($tStored !== $tCheck)) + { + if($forceExpire) { + $this->_state = 'expired'; + } + return false; + } + + return true; + } + + + /** + * Get session name + * + * @access public + * @return string The session name + */ + public function getName() + { + if( $this->_state === 'destroyed' ) { + // @TODO : raise error + return null; + } + return session_name(); + } + + /** + * Get session id + * + * @access public + * @return string The session name + */ + public function getId() + { + if( $this->_state === 'destroyed' ) { + // @TODO : raise error + return null; + } + return session_id(); + } + + /** + * Get the session handlers + * + * @access public + * @return array An array of available session handlers + */ + public function getStores() + { + jimport('joomla.filesystem.folder'); + $handlers = JFolder::files(dirname(__FILE__).DS.'storage', '.php$'); + + $names = array(); + foreach($handlers as $handler) + { + $name = substr($handler, 0, strrpos($handler, '.')); + $class = 'JSessionStorage'.ucfirst($name); + + //Load the class only if needed + if(!class_exists($class)) { + require_once dirname(__FILE__).DS.'storage'.DS.$name.'.php'; + } + + if(call_user_func_array( array( trim($class), 'test' ), null)) { + $names[] = $name; + } + } + + return $names; + } + + /** + * Check whether this session is currently created + * + * @access public + * @return boolean $result true on success + */ + public function isNew() + { + $counter = $this->get( 'session.counter' ); + if( $counter === 1 ) { + return true; + } + return false; + } + + /** + * Get data from the session store + * + * @static + * @access public + * @param string $name Name of a variable + * @param mixed $default Default value of a variable if not set + * @param string $namespace Namespace to use, default to 'default' + * @return mixed Value of a variable + */ + public function &get($name, $default = null, $namespace = 'default') + { + $namespace = '__'.$namespace; //add prefix to namespace to avoid collisions + + if($this->_state !== 'active' && $this->_state !== 'expired') { + // @TODO :: generated error here + $error = null; + return $error; + } + + if (isset($_SESSION[$namespace][$name])) { + return $_SESSION[$namespace][$name]; + } + return $default; + } + + /** + * Set data into the session store + * + * @access public + * @param string $name Name of a variable + * @param mixed $value Value of a variable + * @param string $namespace Namespace to use, default to 'default' + * @return mixed Old value of a variable + */ + public function set($name, $value, $namespace = 'default') + { + $namespace = '__'.$namespace; //add prefix to namespace to avoid collisions + + if($this->_state !== 'active') { + // @TODO :: generated error here + return null; + } + + $old = isset($_SESSION[$namespace][$name]) ? $_SESSION[$namespace][$name] : null; + + if (null === $value) { + unset($_SESSION[$namespace][$name]); + } else { + $_SESSION[$namespace][$name] = $value; + } + + return $old; + } + + /** + * Check wheter data exists in the session store + * + * @access public + * @param string $name Name of variable + * @param string $namespace Namespace to use, default to 'default' + * @return boolean $result true if the variable exists + */ + public function has( $name, $namespace = 'default' ) + { + $namespace = '__'.$namespace; //add prefix to namespace to avoid collisions + + if( $this->_state !== 'active' ) { + // @TODO :: generated error here + return null; + } + + return isset( $_SESSION[$namespace][$name] ); + } + + /** + * Unset data from the session store + * + * @access public + * @param string $name Name of variable + * @param string $namespace Namespace to use, default to 'default' + * @return mixed $value the value from session or NULL if not set + */ + public function clear( $name, $namespace = 'default' ) + { + $namespace = '__'.$namespace; //add prefix to namespace to avoid collisions + + if( $this->_state !== 'active' ) { + // @TODO :: generated error here + return null; + } + + $value = null; + if( isset( $_SESSION[$namespace][$name] ) ) { + $value = $_SESSION[$namespace][$name]; + unset( $_SESSION[$namespace][$name] ); + } + + return $value; + } + + /** + * Start a session + * + * Creates a session (or resumes the current one based on the state of the session) + * + * @access private + * @return boolean $result true on success + */ + public function _start() + { + // start session if not startet + if( $this->_state == 'restart' ) { + session_id( $this->_createId() ); + } + + session_cache_limiter('none'); + session_start(); + + // Send modified header for IE 6.0 Security Policy + header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'); + + return true; + } + + + /** + * Frees all session variables and destroys all data registered to a session + * + * This method resets the $_SESSION variable and destroys all of the data associated + * with the current session in its storage (file or DB). It forces new session to be + * started after this method is called. It does not unset the session cookie. + * + * @static + * @access public + * @return void + * @see session_unset() + * @see session_destroy() + */ + public function destroy() + { + // session was already destroyed + if( $this->_state === 'destroyed' ) { + return true; + } + + // In order to kill the session altogether, like to log the user out, the session id + // must also be unset. If a cookie is used to propagate the session id (default behavior), + // then the session cookie must be deleted. + if (isset($_COOKIE[session_name()])) { + setcookie(session_name(), '', time()-42000, '/'); + } + + session_unset(); + session_destroy(); + + $this->_state = 'destroyed'; + return true; + } + + /** + * restart an expired or locked session + * + * @access public + * @return boolean $result true on success + * @see destroy + */ + public function restart() + { + $this->destroy(); + if( $this->_state !== 'destroyed' ) { + // @TODO :: generated error here + return false; + } + + // Re-register the session handler after a session has been destroyed, to avoid PHP bug + $this->_store->register(); + + $this->_state = 'restart'; + //regenerate session id + $id = $this->_createId( strlen( $this->getId() ) ); + session_id($id); + $this->_start(); + $this->_state = 'active'; + + $this->_validate(); + $this->_setCounter(); + + return true; + } + + /** + * Create a new session and copy variables from the old one + * + * @abstract + * @access public + * @return boolean $result true on success + */ + public function fork() + { + if( $this->_state !== 'active' ) { + // @TODO :: generated error here + return false; + } + + // save values + $values = $_SESSION; + + // keep session config + $trans = ini_get( 'session.use_trans_sid' ); + if( $trans ) { + ini_set( 'session.use_trans_sid', 0 ); + } + $cookie = session_get_cookie_params(); + + // create new session id + $id = $this->_createId( strlen( $this->getId() ) ); + + // kill session + session_destroy(); + + // re-register the session store after a session has been destroyed, to avoid PHP bug + $this->_store->register(); + + // restore config + ini_set( 'session.use_trans_sid', $trans ); + session_set_cookie_params( $cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'] ); + + // restart session with new id + session_id( $id ); + session_start(); + + return true; + } + + /** + * Writes session data and ends session + * + * Session data is usually stored after your script terminated without the need + * to call JSession::close(),but as session data is locked to prevent concurrent + * writes only one script may operate on a session at any time. When using + * framesets together with sessions you will experience the frames loading one + * by one due to this locking. You can reduce the time needed to load all the + * frames by ending the session as soon as all changes to session variables are + * done. + * + * @access public + * @see session_write_close() + */ + public function close() { + session_write_close(); + } + + /** + * Create a session id + * + * @static + * @access private + * @return string Session ID + */ + private function _createId( ) + { + $id = 0; + while (strlen($id) < 32) { + $id .= mt_rand(0, mt_getrandmax()); + } + + $id = md5( uniqid($id, true)); + return $id; + } + + /** + * Create a token-string + * + * @access protected + * @param int $length lenght of string + * @return string $id generated token + */ + private function _createToken( $length = 32 ) + { + static $chars = '0123456789abcdef'; + $max = strlen( $chars ) - 1; + $token = ''; + $name = session_name(); + for( $i = 0; $i < $length; ++$i ) { + $token .= $chars[ (rand( 0, $max )) ]; + } + + return md5($token.$name); + } + + /** + * Set counter of session usage + * + * @access protected + * @return boolean $result true on success + */ + private function _setCounter() + { + $counter = $this->get( 'session.counter', 0 ); + ++$counter; + + $this->set( 'session.counter', $counter ); + return true; + } + + /** + * Set the session timers + * + * @access protected + * @return boolean $result true on success + */ + private function _setTimers() + { + if( !$this->has( 'session.timer.start' ) ) + { + $start = time(); + + $this->set( 'session.timer.start' , $start ); + $this->set( 'session.timer.last' , $start ); + $this->set( 'session.timer.now' , $start ); + } + + $this->set( 'session.timer.last', $this->get( 'session.timer.now' ) ); + $this->set( 'session.timer.now', time() ); + + return true; + } + + /** + * set additional session options + * + * @access protected + * @param array $options list of parameter + * @return boolean $result true on success + */ + private function _setOptions( &$options ) + { + // set name + if( isset( $options['name'] ) ) { + session_name( md5($options['name']) ); + } + + // set id + if( isset( $options['id'] ) ) { + session_id( $options['id'] ); + } + + // set expire time + if( isset( $options['expire'] ) ) { + $this->_expire = $options['expire']; + } + + // get security options + if( isset( $options['security'] ) ) { + $this->_security = explode( ',', $options['security'] ); + } + + //sync the session maxlifetime + ini_set('session.gc_maxlifetime', $this->_expire); + + return true; + } + + /** + * Do some checks for security reason + * + * - timeout check (expire) + * - ip-fixiation + * - browser-fixiation + * + * If one check failed, session data has to be cleaned. + * + * @access protected + * @param boolean $restart reactivate session + * @return boolean $result true on success + * @see http://shiflett.org/articles/the-truth-about-sessions + */ + private function _validate( $restart = false ) + { + // allow to restart a session + if( $restart ) + { + $this->_state = 'active'; + + $this->set( 'session.client.address' , null ); + $this->set( 'session.client.forwarded' , null ); + $this->set( 'session.client.browser' , null ); + $this->set( 'session.token' , null ); + } + + // check if session has expired + if( $this->_expire ) + { + $curTime = $this->get( 'session.timer.now' , 0 ); + $maxTime = $this->get( 'session.timer.last', 0 ) + $this->_expire; + + // empty session variables + if( $maxTime < $curTime ) { + $this->_state = 'expired'; + return false; + } + } + + // record proxy forwarded for in the session in case we need it later + if( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { + $this->set( 'session.client.forwarded', $_SERVER['HTTP_X_FORWARDED_FOR']); + } + + // check for client adress + if( in_array( 'fix_adress', $this->_security ) && isset( $_SERVER['REMOTE_ADDR'] ) ) + { + $ip = $this->get( 'session.client.address' ); + + if( $ip === null ) { + $this->set( 'session.client.address', $_SERVER['REMOTE_ADDR'] ); + } + else if( $_SERVER['REMOTE_ADDR'] !== $ip ) + { + $this->_state = 'error'; + return false; + } + } + + // check for clients browser + if( in_array( 'fix_browser', $this->_security ) && isset( $_SERVER['HTTP_USER_AGENT'] ) ) + { + $browser = $this->get( 'session.client.browser' ); + + if( $browser === null ) { + $this->set( 'session.client.browser', $_SERVER['HTTP_USER_AGENT']); + } + else if( $_SERVER['HTTP_USER_AGENT'] !== $browser ) + { +// $this->_state = 'error'; +// return false; + } + } + + return true; + } +} diff --git a/libraries/joomla/session/storage.php b/libraries/joomla/session/storage.php index 7e8d7ad3c4cb5..5edcc08a0d870 100644 --- a/libraries/joomla/session/storage.php +++ b/libraries/joomla/session/storage.php @@ -1,191 +1,169 @@ - -* @package Joomla.Framework -* @subpackage Session -* @since 1.5 -* @see http://www.php.net/manual/en/function.session-set-save-handler.php -*/ -class JSessionStorage extends JObject -{ - /** - * Constructor - * - * @access protected - * @param array $options optional parameters - */ - function __construct( $options = array() ) - { - $this->register($options); - } - - /** - * Returns a reference to a session storage handler object, only creating it - * if it doesn't already exist. - * - * @access public - * @param name $name The session store to instantiate - * @return database A JSessionStorage object - * @since 1.5 - */ - function &getInstance($name = 'none', $options = array()) - { - static $instances; - - if (!isset ($instances)) { - $instances = array (); - } - - $name = strtolower(JFilterInput::clean($name, 'word')); - if (empty ($instances[$name])) - { - $class = 'JSessionStorage'.ucfirst($name); - if(!class_exists($class)) - { - $path = dirname(__FILE__).DS.'storage'.DS.$name.'.php'; - if (file_exists($path)) { - require_once($path); - } else { - // No call to JError::raiseError here, as it tries to close the non-existing session - jexit('Unable to load session storage class: '.$name); - } - } - - $instances[$name] = new $class($options); - } - - return $instances[$name]; - } - - /** - * Register the functions of this class with PHP's session handler - * - * @access public - * @param array $options optional parameters - */ - function register( $options = array() ) - { - // use this object as the session handler - session_set_save_handler( - array($this, 'open'), - array($this, 'close'), - array($this, 'read'), - array($this, 'write'), - array($this, 'destroy'), - array($this, 'gc') - ); - } - - /** - * Open the SessionHandler backend. - * - * @abstract - * @access public - * @param string $save_path The path to the session object. - * @param string $session_name The name of the session. - * @return boolean True on success, false otherwise. - */ - function open($save_path, $session_name) - { - return true; - } - - /** - * Close the SessionHandler backend. - * - * @abstract - * @access public - * @return boolean True on success, false otherwise. - */ - function close() - { - return true; - } - - /** - * Read the data for a particular session identifier from the - * SessionHandler backend. - * - * @abstract - * @access public - * @param string $id The session identifier. - * @return string The session data. - */ - function read($id) - { - return; - } - - /** - * Write session data to the SessionHandler backend. - * - * @abstract - * @access public - * @param string $id The session identifier. - * @param string $session_data The session data. - * @return boolean True on success, false otherwise. - */ - function write($id, $session_data) - { - return true; - } - - /** - * Destroy the data for a particular session identifier in the - * SessionHandler backend. - * - * @abstract - * @access public - * @param string $id The session identifier. - * @return boolean True on success, false otherwise. - */ - function destroy($id) - { - return true; - } - - /** - * Garbage collect stale sessions from the SessionHandler backend. - * - * @abstract - * @access public - * @param integer $maxlifetime The maximum age of a session. - * @return boolean True on success, false otherwise. - */ - function gc($maxlifetime) - { - return true; - } - - /** - * Test to see if the SessionHandler is available. - * - * @abstract - * @static - * @access public - * @return boolean True on success, false otherwise. - */ - function test() - { - return true; - } -} +register($options); + } + + /** + * Returns a reference to a session storage handler object, only creating it + * if it doesn't already exist. + * + * @access public + * @param name $name The session store to instantiate + * @return database A JSessionStorage object + * @since 1.5 + */ + public static function &getInstance($name = 'none', $options = array()) + { + static $instances; + + if (!isset ($instances)) { + $instances = array(); + } + + $name = strtolower(JFilterInput::clean($name, 'word')); + if (empty ($instances[$name])) + { + $class = 'JSessionStorage'.ucfirst($name); + if(!class_exists($class)) + { + $path = dirname(__FILE__).DS.'storage'.DS.$name.'.php'; + if (file_exists($path)) { + require_once $path; + } else { + // No call to JError::raiseError here, as it tries to close the non-existing session + jexit('Unable to load session storage class: '.$name); + } + } + + $instances[$name] = new $class($options); + } + + return $instances[$name]; + } + + /** + * Register the functions of this class with PHP's session handler + * + * @access public + * @param array $options optional parameters + */ + public function register( $options = array() ) + { + // use this object as the session handler + session_set_save_handler( + array($this, 'open'), + array($this, 'close'), + array($this, 'read'), + array($this, 'write'), + array($this, 'destroy'), + array($this, 'gc') + ); + } + + /** + * Open the SessionHandler backend. + * + * @abstract + * @access public + * @param string $save_path The path to the session object. + * @param string $session_name The name of the session. + * @return boolean True on success, false otherwise. + */ + abstract public function open($save_path, $session_name); + + /** + * Close the SessionHandler backend. + * + * @abstract + * @access public + * @return boolean True on success, false otherwise. + */ + abstract public function close(); + + /** + * Read the data for a particular session identifier from the + * SessionHandler backend. + * + * @abstract + * @access public + * @param string $id The session identifier. + * @return string The session data. + */ + abstract public function read($id); + + /** + * Write session data to the SessionHandler backend. + * + * @abstract + * @access public + * @param string $id The session identifier. + * @param string $session_data The session data. + * @return boolean True on success, false otherwise. + */ + abstract public function write($id, $session_data); + + /** + * Destroy the data for a particular session identifier in the + * SessionHandler backend. + * + * @abstract + * @access public + * @param string $id The session identifier. + * @return boolean True on success, false otherwise. + */ + abstract public function destroy($id); + + /** + * Garbage collect stale sessions from the SessionHandler backend. + * + * @abstract + * @access public + * @param integer $maxlifetime The maximum age of a session. + * @return boolean True on success, false otherwise. + */ + abstract public function gc($maxlifetime); + + /** + * Test to see if the SessionHandler is available. + * + * @abstract + * @static + * @access public + * @return boolean True on success, false otherwise. + */ + abstract public static function test(); +} diff --git a/libraries/joomla/session/storage/apc.php b/libraries/joomla/session/storage/apc.php index ef824fe89cd0b..60c8fdd2a0051 100644 --- a/libraries/joomla/session/storage/apc.php +++ b/libraries/joomla/session/storage/apc.php @@ -1,132 +1,130 @@ - -* @package Joomla.Framework -* @subpackage Session -* @since 1.5 -* @see http://www.php.net/manual/en/function.session-set-save-handler.php -*/ -class JSessionStorageApc extends JSessionStorage -{ - /** - * Constructor - * - * @access protected - * @param array $options optional parameters - */ - function __construct( $options = array() ) - { - if (!$this->test()) { - return JError::raiseError(404, "The apc extension is not available"); - } - - parent::__construct($options); - } - - /** - * Open the SessionHandler backend. - * - * @access public - * @param string $save_path The path to the session object. - * @param string $session_name The name of the session. - * @return boolean True on success, false otherwise. - */ - function open($save_path, $session_name) - { - return true; - } - - /** - * Close the SessionHandler backend. - * - * @access public - * @return boolean True on success, false otherwise. - */ - function close() - { - return true; - } - - /** - * Read the data for a particular session identifier from the - * SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @return string The session data. - */ - function read($id) - { - $sess_id = 'sess_'.$id; - return (string) apc_fetch($sess_id); - } - - /** - * Write session data to the SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @param string $session_data The session data. - * @return boolean True on success, false otherwise. - */ - function write($id, $session_data) - { - $sess_id = 'sess_'.$id; - return apc_store($sess_id, $session_data, ini_get("session.gc_maxlifetime")); - } - - /** - * Destroy the data for a particular session identifier in the - * SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @return boolean True on success, false otherwise. - */ - function destroy($id) - { - $sess_id = 'sess_'.$id; - return apc_delete($sess_id); - } - - /** - * Garbage collect stale sessions from the SessionHandler backend. - * - * @access public - * @param integer $maxlifetime The maximum age of a session. - * @return boolean True on success, false otherwise. - */ - function gc($maxlifetime) - { - return true; - } - - /** - * Test to see if the SessionHandler is available. - * - * @static - * @access public - * @return boolean True on success, false otherwise. - */ - function test() { - return extension_loaded('apc'); - } -} + -* @package Joomla.Framework -* @subpackage Session -* @since 1.5 -* @see http://www.php.net/manual/en/function.session-set-save-handler.php -*/ -class JSessionStorageDatabase extends JSessionStorage -{ - var $_data = null; - - /** - * Open the SessionHandler backend. - * - * @access public - * @param string $save_path The path to the session object. - * @param string $session_name The name of the session. - * @return boolean True on success, false otherwise. - */ - function open($save_path, $session_name) - { - return true; - } - - /** - * Close the SessionHandler backend. - * - * @access public - * @return boolean True on success, false otherwise. - */ - function close() - { - return true; - } - - /** - * Read the data for a particular session identifier from the - * SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @return string The session data. - */ - function read($id) - { - $db =& JFactory::getDBO(); - if(!$db->connected()) { - return false; - } - - $session = & JTable::getInstance('session'); - $session->load($id); - return (string)$session->data; - } - - /** - * Write session data to the SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @param string $session_data The session data. - * @return boolean True on success, false otherwise. - */ - function write($id, $session_data) - { - $db =& JFactory::getDBO(); - if(!$db->connected()) { - return false; - } - - $session = & JTable::getInstance('session'); - $session->load($id); - $session->data = $session_data; - $session->store(); - - return true; - } - - /** - * Destroy the data for a particular session identifier in the - * SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @return boolean True on success, false otherwise. - */ - function destroy($id) - { - $db =& JFactory::getDBO(); - if(!$db->connected()) { - return false; - } - - $session = & JTable::getInstance('session'); - $session->delete($id); - return true; - } - - /** - * Garbage collect stale sessions from the SessionHandler backend. - * - * @access public - * @param integer $maxlifetime The maximum age of a session. - * @return boolean True on success, false otherwise. - */ - function gc($maxlifetime) - { - $db =& JFactory::getDBO(); - if(!$db->connected()) { - return false; - } - - $session = & JTable::getInstance('session'); - $session->purge($maxlifetime); - return true; - } + +/** +* Database session storage handler for PHP +* +* @package Joomla.Framework +* @subpackage Session +* @since 1.5 +* @see http://www.php.net/manual/en/function.session-set-save-handler.php +*/ +class JSessionStorageDatabase extends JSessionStorage +{ + protected $_data = null; + + /** + * Open the SessionHandler backend. + * + * @access public + * @param string $save_path The path to the session object. + * @param string $session_name The name of the session. + * @return boolean True on success, false otherwise. + */ + public function open($save_path, $session_name) + { + return true; + } + + /** + * Close the SessionHandler backend. + * + * @access public + * @return boolean True on success, false otherwise. + */ + public function close() + { + return true; + } + + /** + * Read the data for a particular session identifier from the + * SessionHandler backend. + * + * @access public + * @param string $id The session identifier. + * @return string The session data. + */ + public function read($id) + { + $db =& JFactory::getDBO(); + if(!$db->connected()) { + return false; + } + + $session = & JTable::getInstance('session'); + $session->load($id); + return (string)$session->data; + } + + /** + * Write session data to the SessionHandler backend. + * + * @access public + * @param string $id The session identifier. + * @param string $session_data The session data. + * @return boolean True on success, false otherwise. + */ + public function write($id, $session_data) + { + $db =& JFactory::getDBO(); + if(!$db->connected()) { + return false; + } + + $session = & JTable::getInstance('session'); + $session->load($id); + $session->data = $session_data; + $session->store(); + + return true; + } + + /** + * Destroy the data for a particular session identifier in the + * SessionHandler backend. + * + * @access public + * @param string $id The session identifier. + * @return boolean True on success, false otherwise. + */ + public function destroy($id) + { + $db =& JFactory::getDBO(); + if(!$db->connected()) { + return false; + } + + $session = & JTable::getInstance('session'); + $session->delete($id); + return true; + } + + /** + * Garbage collect stale sessions from the SessionHandler backend. + * + * @access public + * @param integer $maxlifetime The maximum age of a session. + * @return boolean True on success, false otherwise. + */ + public function gc($maxlifetime) + { + $db =& JFactory::getDBO(); + if(!$db->connected()) { + return false; + } + + $session = & JTable::getInstance('session'); + $session->purge($maxlifetime); + return true; + } + + public static function test() { + return true; + } } diff --git a/libraries/joomla/session/storage/eaccelerator.php b/libraries/joomla/session/storage/eaccelerator.php index 91ee891c75d0c..124b040a8f272 100644 --- a/libraries/joomla/session/storage/eaccelerator.php +++ b/libraries/joomla/session/storage/eaccelerator.php @@ -1,133 +1,131 @@ - -* @package Joomla.Framework -* @subpackage Session -* @since 1.5 -* @see http://www.php.net/manual/en/function.session-set-save-handler.php -*/ -class JSessionStorageEaccelerator extends JSessionStorage -{ - /** - * Constructor - * - * @access protected - * @param array $options optional parameters - */ - function __construct( $options = array() ) - { - if (!$this->test()) { - return JError::raiseError(404, "The eaccelerator extension is not available"); - } - - parent::__construct($options); - } - - /** - * Open the SessionHandler backend. - * - * @access public - * @param string $save_path The path to the session object. - * @param string $session_name The name of the session. - * @return boolean True on success, false otherwise. - */ - function open($save_path, $session_name) - { - return true; - } - - /** - * Close the SessionHandler backend. - * - * @access public - * @return boolean True on success, false otherwise. - */ - function close() - { - return true; - } - - /** - * Read the data for a particular session identifier from the - * SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @return string The session data. - */ - function read($id) - { - $sess_id = 'sess_'.$id; - return (string) eaccelerator_get($sess_id); - } - - /** - * Write session data to the SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @param string $session_data The session data. - * @return boolean True on success, false otherwise. - */ - function write($id, $session_data) - { - $sess_id = 'sess_'.$id; - return eaccelerator_put($sess_id, $session_data, ini_get("session.gc_maxlifetime")); - } - - /** - * Destroy the data for a particular session identifier in the - * SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @return boolean True on success, false otherwise. - */ - function destroy($id) - { - $sess_id = 'sess_'.$id; - return eaccelerator_rm($sess_id); - } - - /** - * Garbage collect stale sessions from the SessionHandler backend. - * - * @access public - * @param integer $maxlifetime The maximum age of a session. - * @return boolean True on success, false otherwise. - */ - function gc($maxlifetime) - { - eaccelerator_gc(); - return true; - } - - /** - * Test to see if the SessionHandler is available. - * - * @static - * @access public - * @return boolean True on success, false otherwise. - */ - function test() { - return (extension_loaded('eaccelerator') && function_exists('eaccelerator_get')); - } -} + \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/session/storage/memcache.php b/libraries/joomla/session/storage/memcache.php index 7c853b2d92b76..688ab3d3f9927 100644 --- a/libraries/joomla/session/storage/memcache.php +++ b/libraries/joomla/session/storage/memcache.php @@ -20,8 +20,6 @@ * * -- Inspired in both design and implementation by the Horde memcache handler -- * - * @author Louis Landry - * @author Mitch Pirtle * @package Joomla.Framework * @subpackage Session * @since 1.5 @@ -34,21 +32,21 @@ class JSessionStorageMemcache extends JSessionStorage * * @var resource */ - var $_db; + protected $_db; /** * Use compression? * * @var int */ - var $_compress = null; + protected $_compress = null; /** * Use persistent connections * * @var boolean */ - var $_persistent = false; + protected $_persistent = false; /** * Constructor @@ -56,11 +54,11 @@ class JSessionStorageMemcache extends JSessionStorage * @access protected * @param array $options optional parameters */ - function __construct( $options = array() ) + protected function __construct( $options = array() ) { - if (!$this->test()) { - return JError::raiseError(404, "The memcache extension isn't available"); - } + if (!self::test()) { + throw new JException("The Memcache extension isn't available", 500, E_ERROR); + } parent::__construct($options); @@ -87,11 +85,11 @@ function __construct( $options = array() ) * Open the SessionHandler backend. * * @access public - * @param string $save_path The path to the session object. + * @param string $save_path The path to the session object. * @param string $session_name The name of the session. * @return boolean True on success, false otherwise. */ - function open($save_path, $session_name) + public function open($save_path, $session_name) { $this->_db = new Memcache; for ($i=0, $n=count($this->_servers); $i < $n; $i++) @@ -108,7 +106,7 @@ function open($save_path, $session_name) * @access public * @return boolean True on success, false otherwise. */ - function close() + public function close() { return $this->_db->close(); } @@ -121,7 +119,7 @@ function close() * @param string $id The session identifier. * @return string The session data. */ - function read($id) + public function read($id) { $sess_id = 'sess_'.$id; $this->_setExpire($sess_id); @@ -132,11 +130,11 @@ function read($id) * Write session data to the SessionHandler backend. * * @access public - * @param string $id The session identifier. + * @param string $id The session identifier. * @param string $session_data The session data. * @return boolean True on success, false otherwise. */ - function write($id, $session_data) + public function write($id, $session_data) { $sess_id = 'sess_'.$id; if ($this->_db->get($sess_id.'_expire')) { @@ -153,14 +151,14 @@ function write($id, $session_data) } /** - * Destroy the data for a particular session identifier in the - * SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @return boolean True on success, false otherwise. - */ - function destroy($id) + * Destroy the data for a particular session identifier in the + * SessionHandler backend. + * + * @access public + * @param string $id The session identifier. + * @return boolean True on success, false otherwise. + */ + public function destroy($id) { $sess_id = 'sess_'.$id; $this->_db->delete($sess_id.'_expire'); @@ -176,7 +174,7 @@ function destroy($id) * @param integer $maxlifetime The maximum age of a session. * @return boolean True on success, false otherwise. */ - function gc($maxlifetime) + public function gc($maxlifetime) { return true; } @@ -188,7 +186,7 @@ function gc($maxlifetime) * @access public * @return boolean True on success, false otherwise. */ - function test() + public static function test() { return (extension_loaded('memcache') && class_exists('Memcache')); } @@ -201,7 +199,7 @@ function test() * @param string $key Cache key to expire. * @param integer $lifetime Lifetime of the data in seconds. */ - function _setExpire($key) + protected function _setExpire($key) { $lifetime = ini_get("session.gc_maxlifetime"); $expire = $this->_db->get($key.'_expire'); diff --git a/libraries/joomla/session/storage/none.php b/libraries/joomla/session/storage/none.php index 54367e079fffb..f9b69fe4615a0 100644 --- a/libraries/joomla/session/storage/none.php +++ b/libraries/joomla/session/storage/none.php @@ -1,39 +1,125 @@ - -* @package Joomla.Framework -* @subpackage Session -* @since 1.5 -* @see http://www.php.net/manual/en/function.session-set-save-handler.php -*/ -class JSessionStorageNone extends JSessionStorage -{ - /** - * Register the functions of this class with PHP's session handler - * - * @access public - * @param array $options optional parameters - */ - function register() - { - //let php handle the session storage - } + +/** +* File session handler for PHP +* +* @package Joomla.Framework +* @subpackage Session +* @since 1.5 +* @see http://www.php.net/manual/en/function.session-set-save-handler.php +*/ +class JSessionStorageNone extends JSessionStorage +{ + /** + * Register the functions of this class with PHP's session handler + * + * @access public + * @param array $options optional parameters + */ + public function register() + { + //let php handle the session storage + } + + /** + * Open the SessionHandler backend. + * + * @abstract + * @access public + * @param string $save_path The path to the session object. + * @param string $session_name The name of the session. + * @return boolean True on success, false otherwise. + */ + public function open($save_path, $session_name) + { + } + + /** + * Close the SessionHandler backend. + * + * @abstract + * @access public + * @return boolean True on success, false otherwise. + */ + public function close() + { + } + + /** + * Read the data for a particular session identifier from the + * SessionHandler backend. + * + * @abstract + * @access public + * @param string $id The session identifier. + * @return string The session data. + */ + public function read($id) + { + } + + /** + * Write session data to the SessionHandler backend. + * + * @abstract + * @access public + * @param string $id The session identifier. + * @param string $session_data The session data. + * @return boolean True on success, false otherwise. + */ + public function write($id, $session_data) + { + } + + /** + * Destroy the data for a particular session identifier in the + * SessionHandler backend. + * + * @abstract + * @access public + * @param string $id The session identifier. + * @return boolean True on success, false otherwise. + */ + public function destroy($id) + { + } + + /** + * Garbage collect stale sessions from the SessionHandler backend. + * + * @abstract + * @access public + * @param integer $maxlifetime The maximum age of a session. + * @return boolean True on success, false otherwise. + */ + public function gc($maxlifetime) + { + } + + /** + * Test to see if the SessionHandler is available. + * + * @abstract + * @static + * @access public + * @return boolean True on success, false otherwise. + */ + public static function test() + { + } } diff --git a/libraries/joomla/session/storage/xcache.php b/libraries/joomla/session/storage/xcache.php index 9ab4b5cba2a59..d365cd11518c7 100644 --- a/libraries/joomla/session/storage/xcache.php +++ b/libraries/joomla/session/storage/xcache.php @@ -18,7 +18,6 @@ /** * XCache session storage handler * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Cache * @since 1.5 @@ -31,11 +30,11 @@ class JSessionStorageXcache extends JSessionStorage * @access protected * @param array $options optional parameters */ - function __construct( $options = array() ) + protected function __construct( $options = array() ) { - if (!$this->test()) { - return JError::raiseError(404, "The xcache extension isn't available"); - } + if (!self::test()) { + throw new JException("The xcache extension isn't available", 500, E_ERROR); + } parent::__construct($options); } @@ -44,11 +43,11 @@ function __construct( $options = array() ) * Open the SessionHandler backend. * * @access public - * @param string $save_path The path to the session object. + * @param string $save_path The path to the session object. * @param string $session_name The name of the session. * @return boolean True on success, false otherwise. */ - function open($save_path, $session_name) + public function open($save_path, $session_name) { return true; } @@ -59,7 +58,7 @@ function open($save_path, $session_name) * @access public * @return boolean True on success, false otherwise. */ - function close() + public function close() { return true; } @@ -72,7 +71,7 @@ function close() * @param string $id The session identifier. * @return string The session data. */ - function read($id) + public function read($id) { $sess_id = 'sess_'.$id; @@ -88,25 +87,25 @@ function read($id) * Write session data to the SessionHandler backend. * * @access public - * @param string $id The session identifier. + * @param string $id The session identifier. * @param string $session_data The session data. * @return boolean True on success, false otherwise. */ - function write($id, $session_data) + public function write($id, $session_data) { $sess_id = 'sess_'.$id; return xcache_set($sess_id, $session_data, ini_get("session.gc_maxlifetime") ); } /** - * Destroy the data for a particular session identifier in the - * SessionHandler backend. - * - * @access public - * @param string $id The session identifier. - * @return boolean True on success, false otherwise. - */ - function destroy($id) + * Destroy the data for a particular session identifier in the + * SessionHandler backend. + * + * @access public + * @param string $id The session identifier. + * @return boolean True on success, false otherwise. + */ + public function destroy($id) { $sess_id = 'sess_'.$id; @@ -124,7 +123,7 @@ function destroy($id) * @param integer $maxlifetime The maximum age of a session. * @return boolean True on success, false otherwise. */ - function gc($maxlifetime) + public function gc($maxlifetime) { return true; } @@ -136,7 +135,7 @@ function gc($maxlifetime) * @access public * @return boolean True on success, false otherwise. */ - function test() { + public static function test() { return (extension_loaded('xcache')); } } diff --git a/libraries/joomla/template/index.html b/libraries/joomla/template/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/libraries/joomla/template/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libraries/joomla/template/module/function/index.html b/libraries/joomla/template/module/function/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/libraries/joomla/template/module/function/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libraries/joomla/template/module/index.html b/libraries/joomla/template/module/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/libraries/joomla/template/module/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libraries/joomla/template/module/modifier/index.html b/libraries/joomla/template/module/modifier/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/libraries/joomla/template/module/modifier/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libraries/joomla/template/tmpl/index.html b/libraries/joomla/template/tmpl/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/libraries/joomla/template/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libraries/joomla/user/authentication.php b/libraries/joomla/user/authentication.php index aa9f03cbe38e0..91ef876ad6b89 100644 --- a/libraries/joomla/user/authentication.php +++ b/libraries/joomla/user/authentication.php @@ -1,274 +1,274 @@ - $auth = &JAuthentication::getInstance(); - * - * @static - * @access public - * @return object The global JAuthentication object - * @since 1.5 - */ - function & getInstance() - { - static $instances; - - if (!isset ($instances)) { - $instances = array (); - } - - if (empty ($instances[0])) { - $instances[0] = new JAuthentication(); - } - - return $instances[0]; - } - - /** - * Finds out if a set of login credentials are valid by asking all obvserving - * objects to run their respective authentication routines. - * - * @access public - * @param array Array holding the user credentials - * @return mixed Integer userid for valid user if credentials are valid or - * boolean false if they are not - * @since 1.5 - */ - function authenticate($credentials, $options) - { - // Initialize variables - $auth = false; - - // Get plugins - $plugins = JPluginHelper::getPlugin('authentication'); - - // Create authencication response - $response = new JAuthenticationResponse(); - - /* - * Loop through the plugins and check of the creditials can be used to authenticate - * the user - * - * Any errors raised in the plugin should be returned via the JAuthenticationResponse - * and handled appropriately. - */ - foreach ($plugins as $plugin) - { - $className = 'plg'.$plugin->type.$plugin->name; - if (class_exists( $className )) { - $plugin = new $className($this, (array)$plugin); - } - - // Try to authenticate - $plugin->onAuthenticate($credentials, $options, $response); - - // If authentication is successfull break out of the loop - if($response->status === JAUTHENTICATE_STATUS_SUCCESS) - { - if (empty( $response->type )) { - $response->type = isset( $plugin->_name ) ? $plugin->_name : $plugin->name; - } - if (empty( $response->username )) { - $response->username = $credentials['username']; - } - - if (empty( $response->fullname )) { - $response->fullname = $credentials['username']; - } - - if (empty( $response->password )) { - $response->password = $credentials['password']; - } - - break; - } - } - return $response; - } -} - -/** - * Authorization response class, provides an object for storing user and error details - * - * @package Joomla.Framework - * @subpackage User - * @since 1.5 - */ -class JAuthenticationResponse extends JObject -{ - /** - * Response status (see status codes) - * - * @var type string - * @access public - */ - var $status = JAUTHENTICATE_STATUS_FAILURE; - - /** - * The type of authentication that was successful - * - * @var type string - * @access public - */ - var $type = ''; - - /** - * The error message - * - * @var error_message string - * @access public - */ - var $error_message = ''; - - /** - * Any UTF-8 string that the End User wants to use as a username. - * - * @var fullname string - * @access public - */ - var $username = ''; - - /** - * Any UTF-8 string that the End User wants to use as a password. - * - * @var password string - * @access public - */ - var $password = ''; - - /** - * The email address of the End User as specified in section 3.4.1 of [RFC2822] - * - * @var email string - * @access public - */ - var $email = ''; - - /** - * UTF-8 string free text representation of the End User's full name. - * - * @var fullname string - * @access public - */ - var $fullname = ''; - - /** - * The End User's date of birth as YYYY-MM-DD. Any values whose representation uses - * fewer than the specified number of digits should be zero-padded. The length of this - * value MUST always be 10. If the End User user does not want to reveal any particular - * component of this value, it MUST be set to zero. - * - * For instance, if a End User wants to specify that his date of birth is in 1980, but - * not the month or day, the value returned SHALL be "1980-00-00". - * - * @var fullname string - * @access public - */ - var $birthdate = ''; - - /** - * The End User's gender, "M" for male, "F" for female. - * - * @var fullname string - * @access public - */ - var $gender = ''; - - /** - * UTF-8 string free text that SHOULD conform to the End User's country's postal system. - * - * @var fullname string - * @access public - */ - var $postcode = ''; - - /** - * The End User's country of residence as specified by ISO3166. - * - * @var fullname string - * @access public - */ - var $country = ''; - - /** - * End User's preferred language as specified by ISO639. - * - * @var fullname string - * @access public - */ - var $language = ''; - - /** - * ASCII string from TimeZone database - * - * @var fullname string - * @access public - */ - var $timezone = ''; - - /** - * Constructor - * - * @param string $name The type of the response - * @since 1.5 - */ - function __construct() { } -} \ No newline at end of file + +/** + * This is the status code returned when the authentication is success. + */ +define('JAUTHENTICATE_STATUS_SUCCESS', 1); + +/** + * Status to indicate cancellation of authentication. + */ +define('JAUTHENTICATE_STATUS_CANCEL', 2); + +/** + * This is the status code returned when the authentication failed + */ +define('JAUTHENTICATE_STATUS_FAILURE', 4); + +/** + * Authenthication class, provides an interface for the Joomla authentication system + * + * @package Joomla.Framework + * @subpackage User + * @since 1.5 + */ +class JAuthentication extends JObservable +{ + /** + * Constructor + * + * @access protected + */ + protected function __construct() + { + $isLoaded = JPluginHelper::importPlugin('authentication'); + + if (!$isLoaded) { + throw new JException( JText::_('JAuthentication::__construct: Could not load authentication libraries.'), 0, E_WARNING); + } + } + + /** + * Returns a reference to a global authentication object, only creating it + * if it doesn't already exist. + * + * This method must be invoked as: + *
        $auth = &JAuthentication::getInstance();
      + * + * @static + * @access public + * @return object The global JAuthentication object + * @since 1.5 + */ + public static function & getInstance() + { + static $instances; + + if (!isset ($instances)) { + $instances = array (); + } + + if (empty ($instances[0])) { + $instances[0] = new JAuthentication(); + } + + return $instances[0]; + } + + /** + * Finds out if a set of login credentials are valid by asking all obvserving + * objects to run their respective authentication routines. + * + * @access public + * @param array Array holding the user credentials + * @return mixed Integer userid for valid user if credentials are valid or + * boolean false if they are not + * @since 1.5 + */ + public function authenticate($credentials, $options) + { + // Initialize variables + $auth = false; + + // Get plugins + $plugins = JPluginHelper::getPlugin('authentication'); + + // Create authencication response + $response = new JAuthenticationResponse(); + + /* + * Loop through the plugins and check of the creditials can be used to authenticate + * the user + * + * Any errors raised in the plugin should be returned via the JAuthenticationResponse + * and handled appropriately. + */ + foreach ($plugins as $plugin) + { + $className = 'plg'.$plugin->type.$plugin->name; + if (class_exists( $className )) { + $plugin = new $className($this, (array)$plugin); + } + + // Try to authenticate + $plugin->onAuthenticate($credentials, $options, $response); + + // If authentication is successfull break out of the loop + if($response->status === JAUTHENTICATE_STATUS_SUCCESS) + { + if (empty( $response->type )) { + $response->type = isset( $plugin->_name ) ? $plugin->_name : $plugin->name; + } + if (empty( $response->username )) { + $response->username = $credentials['username']; + } + + if (empty( $response->fullname )) { + $response->fullname = $credentials['username']; + } + + if (empty( $response->password )) { + $response->password = $credentials['password']; + } + + break; + } + } + return $response; + } +} + +/** + * Authorization response class, provides an object for storing user and error details + * + * @package Joomla.Framework + * @subpackage User + * @since 1.5 + */ +class JAuthenticationResponse extends JObject +{ + /** + * Response status (see status codes) + * + * @var type string + * @access public + */ + public $status = JAUTHENTICATE_STATUS_FAILURE; + + /** + * The type of authentication that was successful + * + * @var type string + * @access public + */ + public $type = ''; + + /** + * The error message + * + * @var error_message string + * @access public + */ + public $error_message = ''; + + /** + * Any UTF-8 string that the End User wants to use as a username. + * + * @var fullname string + * @access public + */ + public $username = ''; + + /** + * Any UTF-8 string that the End User wants to use as a password. + * + * @var password string + * @access public + */ + public $password = ''; + + /** + * The email address of the End User as specified in section 3.4.1 of [RFC2822] + * + * @var email string + * @access public + */ + public $email = ''; + + /** + * UTF-8 string free text representation of the End User's full name. + * + * @var fullname string + * @access public + */ + public $fullname = ''; + + /** + * The End User's date of birth as YYYY-MM-DD. Any values whose representation uses + * fewer than the specified number of digits should be zero-padded. The length of this + * value MUST always be 10. If the End User user does not want to reveal any particular + * component of this value, it MUST be set to zero. + * + * For instance, if a End User wants to specify that his date of birth is in 1980, but + * not the month or day, the value returned SHALL be "1980-00-00". + * + * @var fullname string + * @access public + */ + public $birthdate = ''; + + /** + * The End User's gender, "M" for male, "F" for female. + * + * @var fullname string + * @access public + */ + public $gender = ''; + + /** + * UTF-8 string free text that SHOULD conform to the End User's country's postal system. + * + * @var fullname string + * @access public + */ + public $postcode = ''; + + /** + * The End User's country of residence as specified by ISO3166. + * + * @var fullname string + * @access public + */ + public $country = ''; + + /** + * End User's preferred language as specified by ISO639. + * + * @var fullname string + * @access public + */ + public $language = ''; + + /** + * ASCII string from TimeZone database + * + * @var fullname string + * @access public + */ + public $timezone = ''; + + /** + * Constructor + * + * @param string $name The type of the response + * @since 1.5 + */ + public function __construct() { } +} diff --git a/libraries/joomla/user/authorization.php b/libraries/joomla/user/authorization.php index 990c4e0baac27..4a1788c3fba26 100644 --- a/libraries/joomla/user/authorization.php +++ b/libraries/joomla/user/authorization.php @@ -31,7 +31,7 @@ class JAuthorization extends gacl_api * Access control list * @var array */ - var $acl = null; + var $acl = null; /** * Internal counter @@ -270,7 +270,7 @@ function acl_check( $aco_section_value, $aco_value, $aro_section_value, $aro_val return parent::acl_check( $aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value, $axo_value, $root_aro_group, $root_axo_group ); } - $this->debug_text( "\n
      ACO=$aco_section_value:$aco_value, ARO=$aro_section_value:$aro_value, AXO=$axo_section_value|$axo_value" ); + $this->debug_text( "\n
      ACO=$aco_section_value:$aco_value, ARO=$aro_section_value:$aro_value, AXO=$axo_section_value|$axo_value" ); $acl_result = 0; for ($i=0; $i < $this->acl_count; $i++) @@ -328,8 +328,13 @@ function _getGroup( $type, $value ) . ' INNER JOIN #__core_acl_groups_'.$type.'_map AS gm ON gm.group_id = g.id' . ' INNER JOIN #__core_acl_'.$type.' AS ao ON ao.id = gm.'.$type.'_id' . ' WHERE ao.value='.$db->Quote($value) + . ' ORDER BY g.id' ); - $obj = $db->loadObject( ); + try { + $obj = $db->loadObject(); + } catch( JException $e) { + $obj = null; + } return $obj; } @@ -341,31 +346,35 @@ function _getBelow( $table, $fields, $groupby=null, $root_id=null, $root_name=nu $root->lft = 0; $root->rgt = 0; - if ($root_id) { - } else if ($root_name) { - $query = "SELECT lft, rgt FROM $table WHERE name = ".$db->Quote($root_name); + try { + if ($root_id) { + } else if ($root_name) { + $query = "SELECT lft, rgt FROM $table WHERE name = ".$db->Quote($root_name); + $db->setQuery( $query ); + $root = $db->loadObject(); + } + + $where = ''; + if ($root->lft+$root->rgt <> 0) { + if ($inclusive) { + $where = ' WHERE g1.lft BETWEEN '.(int) $root->lft.' AND '.(int) $root->rgt; + } else { + $where = ' WHERE g1.lft > '.(int) $root->lft.' AND g1.lft <'.(int) $root->rgt; + } + } + + $query = 'SELECT '. $fields + . ' FROM '. $table .' AS g1' + . ' INNER JOIN '. $table .' AS g2 ON g1.lft BETWEEN g2.lft AND g2.rgt' + . $where + . ($groupby ? ' GROUP BY ' . $groupby : '') + . ' ORDER BY g1.lft'; $db->setQuery( $query ); - $root = $db->loadObject(); - } - $where = ''; - if ($root->lft+$root->rgt <> 0) { - if ($inclusive) { - $where = ' WHERE g1.lft BETWEEN '.(int) $root->lft.' AND '.(int) $root->rgt; - } else { - $where = ' WHERE g1.lft > '.(int) $root->lft.' AND g1.lft <'.(int) $root->rgt; - } + return $db->loadObjectList(); + } catch (JException $e) { + return array(); } - - $query = 'SELECT '. $fields - . ' FROM '. $table .' AS g1' - . ' INNER JOIN '. $table .' AS g2 ON g1.lft BETWEEN g2.lft AND g2.rgt' - . $where - . ($groupby ? ' GROUP BY ' . $groupby : '') - . ' ORDER BY g1.lft'; - $db->setQuery( $query ); - - return $db->loadObjectList(); } /** @@ -377,7 +386,6 @@ function _getBelow( $table, $fields, $groupby=null, $root_id=null, $root_name=nu */ function get_group_children_tree( $root_id=null, $root_name=null, $inclusive=true, $html=true ) { - $db =& JFactory::getDBO(); $tree = $this->_getBelow( '#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', @@ -462,8 +470,11 @@ function is_group_child_of( $grp_src, $grp_tgt, $group_type='ARO' ) } $db->setQuery($query); - - return $db->loadResult(); + try { + return $db->loadResult(); + } catch(JException $e) { + return null; + } } /*======================================================================*\ @@ -473,7 +484,7 @@ function is_group_child_of( $grp_src, $grp_tgt, $group_type='ARO' ) function get_group_parents($group_id, $group_type = 'ARO', $recurse = 'NO_RECURSE') { $this->debug_text("get_group_parents(): Group_ID: $group_id Group Type: $group_type Recurse: $recurse"); - + $db = JFactory::getDBO(); switch (strtolower(trim($group_type))) { case 'axo': $group_type = 'axo'; @@ -516,19 +527,50 @@ function get_group_parents($group_id, $group_type = 'ARO', $recurse = 'NO_RECURS $this->db->setQuery( $query ); - return $this->db->loadResultArray(); + try { + return $this->db->loadResultArray(); + } catch (JException $e) { + return array(); + } } - /** - * Deprecated, use JAuthorisation::addACL() instead. + * Get the access levels that the users is permitted to action * - * @since 1.0 - * @deprecated As of version 1.5 - * @see JAuthorisation::addACL() + * @param string The name of the ACL section (usually the component, eg, com_content) + * @param string The action (usually 'view' when used in a list context) + * @return string Comma separated list of access level ID's + * @since 1.6 */ - function _mos_add_acl( $aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value=NULL, $axo_value=NULL, $return_value=NULL ) { - $this->addACL($aco_section_value, $aco_value, $aro_section_value, $aro_value, $axo_section_value, $axo_value, $return_value); + function getUserAccessLevels( $section, $action = 'view' ) + { + $db = &JFactory::getDBO(); + $user = &JFactory::getUser(); + if ($id = $user->get('aid')) { + $query = 'SELECT GROUP_CONCAT( DISTINCT axog.value SEPARATOR \',\' )' . + ' FROM #__core_acl_aco_map AS am' . + ' INNER JOIN #__core_acl_acl AS acl ON acl.id = am.acl_id' . + ' INNER JOIN #__core_acl_aro_groups_map AS agm ON agm.acl_id = am.acl_id' . + ' LEFT JOIN #__core_acl_axo_groups_map AS axogm ON axogm.acl_id = am.acl_id' . + ' INNER JOIN #__core_acl_axo_groups AS axog ON axog.id = axogm.group_id' . + ' INNER JOIN #__core_acl_groups_aro_map AS garom ON garom.group_id = agm.group_id' . + ' INNER JOIN #__core_acl_aro AS aro ON aro.id = garom.aro_id' . + ' WHERE am.section_value = '.$db->Quote( $section ) . + ' AND am.value = '.$db->Quote( $action ) . + ' AND acl.enabled = 1' . + ' AND acl.allow = 1' . + ' AND aro.value = '.(int) $user->id; + $db->setQuery( $query ); + try { + $result = $db->loadResult(); + } catch(JException $e) { + $result = 0; + } + } + else { + // Save some performance for anon users + $result = 0; + } + return $result; } - -} \ No newline at end of file +} diff --git a/libraries/joomla/user/helper.php b/libraries/joomla/user/helper.php index 0a5f8cf04f427..452247189e777 100644 --- a/libraries/joomla/user/helper.php +++ b/libraries/joomla/user/helper.php @@ -1,338 +1,349 @@ - - * @package Joomla.Framework - * @subpackage User - * @since 1.5 - */ -class JUserHelper -{ - /** - * Method to activate a user - * - * @param string $activation Activation string - * @return boolean True on success - * @since 1.5 - */ - function activateUser($activation) - { - //Initialize some variables - $db = & JFactory::getDBO(); - - // Lets get the id of the user we want to activate - $query = 'SELECT id' - . ' FROM #__users' - . ' WHERE activation = '.$db->Quote($activation) - . ' AND block = 1' - . ' AND lastvisitDate = '.$db->Quote('0000-00-00 00:00:00'); - ; - $db->setQuery( $query ); - $id = intval( $db->loadResult() ); - - // Is it a valid user to activate? - if ($id) - { - $user =& JUser::getInstance( (int) $id ); - - $user->set('block', '0'); - $user->set('activation', ''); - - // Time to take care of business.... store the user. - if (!$user->save()) - { - JError::raiseWarning( "SOME_ERROR_CODE", $user->getError() ); - return false; - } - } - else - { - JError::raiseWarning( "SOME_ERROR_CODE", JText::_('UNABLE TO FIND A USER WITH GIVEN ACTIVATION STRING') ); - return false; - } - - return true; - } - - /** - * Returns userid if a user exists - * - * @param string The username to search on - * @return int The user id or 0 if not found - */ - function getUserId($username) - { - // Initialize some variables - $db = & JFactory::getDBO(); - - $query = 'SELECT id FROM #__users WHERE username = ' . $db->Quote( $username ); - $db->setQuery($query, 0, 1); - return $db->loadResult(); - } - - /** - * Formats a password using the current encryption. - * - * @access public - * @param string $plaintext The plaintext password to encrypt. - * @param string $salt The salt to use to encrypt the password. [] - * If not present, a new salt will be - * generated. - * @param string $encryption The kind of pasword encryption to use. - * Defaults to md5-hex. - * @param boolean $show_encrypt Some password systems prepend the kind of - * encryption to the crypted password ({SHA}, - * etc). Defaults to false. - * - * @return string The encrypted password. - */ - function getCryptedPassword($plaintext, $salt = '', $encryption = 'md5-hex', $show_encrypt = false) - { - // Get the salt to use. - $salt = JUserHelper::getSalt($encryption, $salt, $plaintext); - - // Encrypt the password. - switch ($encryption) - { - case 'plain' : - return $plaintext; - - case 'sha' : - $encrypted = base64_encode(mhash(MHASH_SHA1, $plaintext)); - return ($show_encrypt) ? '{SHA}'.$encrypted : $encrypted; - - case 'crypt' : - case 'crypt-des' : - case 'crypt-md5' : - case 'crypt-blowfish' : - return ($show_encrypt ? '{crypt}' : '').crypt($plaintext, $salt); - - case 'md5-base64' : - $encrypted = base64_encode(mhash(MHASH_MD5, $plaintext)); - return ($show_encrypt) ? '{MD5}'.$encrypted : $encrypted; - - case 'ssha' : - $encrypted = base64_encode(mhash(MHASH_SHA1, $plaintext.$salt).$salt); - return ($show_encrypt) ? '{SSHA}'.$encrypted : $encrypted; - - case 'smd5' : - $encrypted = base64_encode(mhash(MHASH_MD5, $plaintext.$salt).$salt); - return ($show_encrypt) ? '{SMD5}'.$encrypted : $encrypted; - - case 'aprmd5' : - $length = strlen($plaintext); - $context = $plaintext.'$apr1$'.$salt; - $binary = JUserHelper::_bin(md5($plaintext.$salt.$plaintext)); - - for ($i = $length; $i > 0; $i -= 16) { - $context .= substr($binary, 0, ($i > 16 ? 16 : $i)); - } - for ($i = $length; $i > 0; $i >>= 1) { - $context .= ($i & 1) ? chr(0) : $plaintext[0]; - } - - $binary = JUserHelper::_bin(md5($context)); - - for ($i = 0; $i < 1000; $i ++) { - $new = ($i & 1) ? $plaintext : substr($binary, 0, 16); - if ($i % 3) { - $new .= $salt; - } - if ($i % 7) { - $new .= $plaintext; - } - $new .= ($i & 1) ? substr($binary, 0, 16) : $plaintext; - $binary = JUserHelper::_bin(md5($new)); - } - - $p = array (); - for ($i = 0; $i < 5; $i ++) { - $k = $i +6; - $j = $i +12; - if ($j == 16) { - $j = 5; - } - $p[] = JUserHelper::_toAPRMD5((ord($binary[$i]) << 16) | (ord($binary[$k]) << 8) | (ord($binary[$j])), 5); - } - - return '$apr1$'.$salt.'$'.implode('', $p).JUserHelper::_toAPRMD5(ord($binary[11]), 3); - - case 'md5-hex' : - default : - $encrypted = ($salt) ? md5($plaintext.$salt) : md5($plaintext); - return ($show_encrypt) ? '{MD5}'.$encrypted : $encrypted; - } - } - - /** - * Returns a salt for the appropriate kind of password encryption. - * Optionally takes a seed and a plaintext password, to extract the seed - * of an existing password, or for encryption types that use the plaintext - * in the generation of the salt. - * - * @access public - * @param string $encryption The kind of pasword encryption to use. - * Defaults to md5-hex. - * @param string $seed The seed to get the salt from (probably a - * previously generated password). Defaults to - * generating a new seed. - * @param string $plaintext The plaintext password that we're generating - * a salt for. Defaults to none. - * - * @return string The generated or extracted salt. - */ - function getSalt($encryption = 'md5-hex', $seed = '', $plaintext = '') - { - // Encrypt the password. - switch ($encryption) - { - case 'crypt' : - case 'crypt-des' : - if ($seed) { - return substr(preg_replace('|^{crypt}|i', '', $seed), 0, 2); - } else { - return substr(md5(mt_rand()), 0, 2); - } - break; - - case 'crypt-md5' : - if ($seed) { - return substr(preg_replace('|^{crypt}|i', '', $seed), 0, 12); - } else { - return '$1$'.substr(md5(mt_rand()), 0, 8).'$'; - } - break; - - case 'crypt-blowfish' : - if ($seed) { - return substr(preg_replace('|^{crypt}|i', '', $seed), 0, 16); - } else { - return '$2$'.substr(md5(mt_rand()), 0, 12).'$'; - } - break; - - case 'ssha' : - if ($seed) { - return substr(preg_replace('|^{SSHA}|', '', $seed), -20); - } else { - return mhash_keygen_s2k(MHASH_SHA1, $plaintext, substr(pack('h*', md5(mt_rand())), 0, 8), 4); - } - break; - - case 'smd5' : - if ($seed) { - return substr(preg_replace('|^{SMD5}|', '', $seed), -16); - } else { - return mhash_keygen_s2k(MHASH_MD5, $plaintext, substr(pack('h*', md5(mt_rand())), 0, 8), 4); - } - break; - - case 'aprmd5' : - /* 64 characters that are valid for APRMD5 passwords. */ - $APRMD5 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; - - if ($seed) { - return substr(preg_replace('/^\$apr1\$(.{8}).*/', '\\1', $seed), 0, 8); - } else { - $salt = ''; - for ($i = 0; $i < 8; $i ++) { - $salt .= $APRMD5 { - rand(0, 63) - }; - } - return $salt; - } - break; - - default : - $salt = ''; - if ($seed) { - $salt = $seed; - } - return $salt; - break; - } - } - - /** - * Generate a random password - * - * @static - * @param int $length Length of the password to generate - * @return string Random Password - * @since 1.5 - */ - function genRandomPassword($length = 8) - { - $salt = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - $len = strlen($salt); - $makepass = ''; - mt_srand(10000000 * (double) microtime()); - - for ($i = 0; $i < $length; $i ++) { - $makepass .= $salt[mt_rand(0, $len -1)]; - } - - return $makepass; - } - - /** - * Converts to allowed 64 characters for APRMD5 passwords. - * - * @access private - * @param string $value - * @param integer $count - * @return string $value converted to the 64 MD5 characters. - * @since 1.5 - */ - function _toAPRMD5($value, $count) - { - /* 64 characters that are valid for APRMD5 passwords. */ - $APRMD5 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; - - $aprmd5 = ''; - $count = abs($count); - while (-- $count) { - $aprmd5 .= $APRMD5[$value & 0x3f]; - $value >>= 6; - } - return $aprmd5; - } - - /** - * Converts hexadecimal string to binary data. - * - * @access private - * @param string $hex Hex data. - * @return string Binary data. - * @since 1.5 - */ - function _bin($hex) - { - $bin = ''; - $length = strlen($hex); - for ($i = 0; $i < $length; $i += 2) { - $tmp = sscanf(substr($hex, $i, 2), '%x'); - $bin .= chr(array_shift($tmp)); - } - return $bin; - } -} \ No newline at end of file +Quote($activation) + . ' AND block = 1' + . ' AND lastvisitDate = '.$db->Quote('0000-00-00 00:00:00'); + ; + $db->setQuery( $query ); + try { + $id = intval( $db->loadResult() ); + } catch(JException $e) { + $id = 0; + } + + // Is it a valid user to activate? + if ($id) + { + $user =& JUser::getInstance( (int) $id ); + + $user->set('block', '0'); + $user->set('activation', ''); + + // Time to take care of business.... store the user. + if (!$user->save()) + { + JError::raiseWarning( "SOME_ERROR_CODE", $user->getError() ); + return false; + } + } + else + { + JError::raiseWarning( "SOME_ERROR_CODE", JText::_('UNABLE TO FIND A USER WITH GIVEN ACTIVATION STRING') ); + return false; + } + + return true; + } + + /** + * Returns userid if a user exists + * + * @param string The username to search on + * @return int The user id or 0 if not found + */ + public static function getUserId($username) + { + // Initialize some variables + $db = & JFactory::getDBO(); + + $query = 'SELECT id FROM #__users WHERE username = ' . $db->Quote( $username ); + $db->setQuery($query, 0, 1); + try { + return $db->loadResult(); + } catch (JException $e) { + return 0; + } + } + + /** + * Formats a password using the current encryption. + * + * @access public + * @param string $plaintext The plaintext password to encrypt. + * @param string $salt The salt to use to encrypt the password. [] + * If not present, a new salt will be + * generated. + * @param string $encryption The kind of pasword encryption to use. + * Defaults to md5-hex. + * @param boolean $show_encrypt Some password systems prepend the kind of + * encryption to the crypted password ({SHA}, + * etc). Defaults to false. + * + * @return string The encrypted password. + */ + public static function getCryptedPassword($plaintext, $salt = '', $encryption = 'md5-hex', $show_encrypt = false) + { + // Get the salt to use. + $salt = JUserHelper::getSalt($encryption, $salt, $plaintext); + + // Encrypt the password. + switch ($encryption) + { + case 'plain' : + return $plaintext; + + case 'sha' : + $encrypted = base64_encode(mhash(MHASH_SHA1, $plaintext)); + return ($show_encrypt) ? '{SHA}'.$encrypted : $encrypted; + + case 'crypt' : + case 'crypt-des' : + case 'crypt-md5' : + case 'crypt-blowfish' : + return ($show_encrypt ? '{crypt}' : '').crypt($plaintext, $salt); + + case 'md5-base64' : + $encrypted = base64_encode(mhash(MHASH_MD5, $plaintext)); + return ($show_encrypt) ? '{MD5}'.$encrypted : $encrypted; + + case 'ssha' : + $encrypted = base64_encode(mhash(MHASH_SHA1, $plaintext.$salt).$salt); + return ($show_encrypt) ? '{SSHA}'.$encrypted : $encrypted; + + case 'smd5' : + $encrypted = base64_encode(mhash(MHASH_MD5, $plaintext.$salt).$salt); + return ($show_encrypt) ? '{SMD5}'.$encrypted : $encrypted; + + case 'aprmd5' : + $length = strlen($plaintext); + $context = $plaintext.'$apr1$'.$salt; + $binary = JUserHelper::_bin(md5($plaintext.$salt.$plaintext)); + + for ($i = $length; $i > 0; $i -= 16) { + $context .= substr($binary, 0, ($i > 16 ? 16 : $i)); + } + for ($i = $length; $i > 0; $i >>= 1) { + $context .= ($i & 1) ? chr(0) : $plaintext[0]; + } + + $binary = JUserHelper::_bin(md5($context)); + + for ($i = 0; $i < 1000; $i ++) { + $new = ($i & 1) ? $plaintext : substr($binary, 0, 16); + if ($i % 3) { + $new .= $salt; + } + if ($i % 7) { + $new .= $plaintext; + } + $new .= ($i & 1) ? substr($binary, 0, 16) : $plaintext; + $binary = JUserHelper::_bin(md5($new)); + } + + $p = array (); + for ($i = 0; $i < 5; $i ++) { + $k = $i +6; + $j = $i +12; + if ($j == 16) { + $j = 5; + } + $p[] = JUserHelper::_toAPRMD5((ord($binary[$i]) << 16) | (ord($binary[$k]) << 8) | (ord($binary[$j])), 5); + } + + return '$apr1$'.$salt.'$'.implode('', $p).JUserHelper::_toAPRMD5(ord($binary[11]), 3); + + case 'md5-hex' : + default : + $encrypted = ($salt) ? md5($plaintext.$salt) : md5($plaintext); + return ($show_encrypt) ? '{MD5}'.$encrypted : $encrypted; + } + } + + /** + * Returns a salt for the appropriate kind of password encryption. + * Optionally takes a seed and a plaintext password, to extract the seed + * of an existing password, or for encryption types that use the plaintext + * in the generation of the salt. + * + * @access public + * @param string $encryption The kind of pasword encryption to use. + * Defaults to md5-hex. + * @param string $seed The seed to get the salt from (probably a + * previously generated password). Defaults to + * generating a new seed. + * @param string $plaintext The plaintext password that we're generating + * a salt for. Defaults to none. + * + * @return string The generated or extracted salt. + */ + public static function getSalt($encryption = 'md5-hex', $seed = '', $plaintext = '') + { + // Encrypt the password. + switch ($encryption) + { + case 'crypt' : + case 'crypt-des' : + if ($seed) { + return substr(preg_replace('|^{crypt}|i', '', $seed), 0, 2); + } else { + return substr(md5(mt_rand()), 0, 2); + } + break; + + case 'crypt-md5' : + if ($seed) { + return substr(preg_replace('|^{crypt}|i', '', $seed), 0, 12); + } else { + return '$1$'.substr(md5(mt_rand()), 0, 8).'$'; + } + break; + + case 'crypt-blowfish' : + if ($seed) { + return substr(preg_replace('|^{crypt}|i', '', $seed), 0, 16); + } else { + return '$2$'.substr(md5(mt_rand()), 0, 12).'$'; + } + break; + + case 'ssha' : + if ($seed) { + return substr(preg_replace('|^{SSHA}|', '', $seed), -20); + } else { + return mhash_keygen_s2k(MHASH_SHA1, $plaintext, substr(pack('h*', md5(mt_rand())), 0, 8), 4); + } + break; + + case 'smd5' : + if ($seed) { + return substr(preg_replace('|^{SMD5}|', '', $seed), -16); + } else { + return mhash_keygen_s2k(MHASH_MD5, $plaintext, substr(pack('h*', md5(mt_rand())), 0, 8), 4); + } + break; + + case 'aprmd5' : + /* 64 characters that are valid for APRMD5 passwords. */ + $APRMD5 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; + + if ($seed) { + return substr(preg_replace('/^\$apr1\$(.{8}).*/', '\\1', $seed), 0, 8); + } else { + $salt = ''; + for ($i = 0; $i < 8; $i ++) { + $salt .= $APRMD5 { + rand(0, 63) + }; + } + return $salt; + } + break; + + default : + $salt = ''; + if ($seed) { + $salt = $seed; + } + return $salt; + break; + } + } + + /** + * Generate a random password + * + * @static + * @param int $length Length of the password to generate + * @return string Random Password + * @since 1.5 + */ + public static function genRandomPassword($length = 8) + { + $salt = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + $len = strlen($salt); + $makepass = ''; + + $stat = @stat(__FILE__); + if(empty($stat) || !is_array($stat)) $stat = array(php_uname()); + + mt_srand(crc32(microtime() . implode('|', $stat))); + + for ($i = 0; $i < $length; $i ++) { + $makepass .= $salt[mt_rand(0, $len -1)]; + } + + return $makepass; + } + + /** + * Converts to allowed 64 characters for APRMD5 passwords. + * + * @access private + * @param string $value + * @param integer $count + * @return string $value converted to the 64 MD5 characters. + * @since 1.5 + */ + private static function _toAPRMD5($value, $count) + { + /* 64 characters that are valid for APRMD5 passwords. */ + $APRMD5 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; + + $aprmd5 = ''; + $count = abs($count); + while (-- $count) { + $aprmd5 .= $APRMD5[$value & 0x3f]; + $value >>= 6; + } + return $aprmd5; + } + + /** + * Converts hexadecimal string to binary data. + * + * @access private + * @param string $hex Hex data. + * @return string Binary data. + * @since 1.5 + */ + private static function _bin($hex) + { + $bin = ''; + $length = strlen($hex); + for ($i = 0; $i < $length; $i += 2) { + $tmp = sscanf(substr($hex, $i, 2), '%x'); + $bin .= chr(array_shift($tmp)); + } + return $bin; + } +} diff --git a/libraries/joomla/user/index.html b/libraries/joomla/user/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/user/index.html +++ b/libraries/joomla/user/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/user/user.php b/libraries/joomla/user/user.php index 98a3487db791b..9e1bc085f5a64 100644 --- a/libraries/joomla/user/user.php +++ b/libraries/joomla/user/user.php @@ -1,614 +1,640 @@ - - * @package Joomla.Framework - * @subpackage User - * @since 1.5 - */ -class JUser extends JObject -{ - /** - * Unique id - * @var int - */ - var $id = null; - - /** - * The users real name (or nickname) - * @var string - */ - var $name = null; - - /** - * The login name - * @var string - */ - var $username = null; - - /** - * The email - * @var string - */ - var $email = null; - - /** - * MD5 encrypted password - * @var string - */ - var $password = null; - - /** - * Clear password, only available when a new password is set for a user - * @var string - */ - var $password_clear = ''; - - /** - * Description - * @var string - */ - var $usertype = null; - - /** - * Description - * @var int - */ - var $block = null; - - /** - * Description - * @var int - */ - var $sendEmail = null; - - /** - * The group id number - * @var int - */ - var $gid = null; - - /** - * Description - * @var datetime - */ - var $registerDate = null; - - /** - * Description - * @var datetime - */ - var $lastvisitDate = null; - - /** - * Description - * @var string activation hash - */ - var $activation = null; - - /** - * Description - * @var string - */ - var $params = null; - - /** - * Description - * @var string integer - */ - var $aid = null; - - /** - * Description - * @var boolean - */ - var $guest = null; - - /** - * User parameters - * @var object - */ - var $_params = null; - - /** - * Error message - * @var string - */ - var $_errorMsg = null; - - - /** - * Constructor activating the default information of the language - * - * @access protected - */ - function __construct($identifier = 0) - { - // Create the user parameters object - $this->_params = new JParameter( '' ); - - // Load the user if it exists - if (!empty($identifier)) { - $this->load($identifier); - } - else - { - //initialise - $this->id = 0; - $this->gid = 0; - $this->sendEmail = 0; - $this->aid = 0; - $this->guest = 1; - } - } - - /** - * Returns a reference to the global User object, only creating it if it - * doesn't already exist. - * - * This method must be invoked as: - *
        $user =& JUser::getInstance($id);
      - * - * @access public - * @param int $id The user to load - Can be an integer or string - If string, it is converted to ID automatically. - * @return JUser The User object. - * @since 1.5 - */ - function &getInstance($id = 0) - { - static $instances; - - if (!isset ($instances)) { - $instances = array (); - } - - // Find the user id - if(!is_numeric($id)) - { - jimport('joomla.user.helper'); - if (!$id = JUserHelper::getUserId($id)) { - JError::raiseWarning( 'SOME_ERROR_CODE', 'JUser::_load: User '.$id.' does not exist' ); - return false; - } - } - - if (empty($instances[$id])) { - $user = new JUser($id); - $instances[$id] = $user; - } - - return $instances[$id]; - } - - /** - * Method to get a parameter value - * - * @access public - * @param string $key Parameter key - * @param mixed $default Parameter default value - * @return mixed The value or the default if it did not exist - * @since 1.5 - */ - function getParam( $key, $default = null ) - { - return $this->_params->get( $key, $default ); - } - - /** - * Method to set a parameter - * - * @access public - * @param string $key Parameter key - * @param mixed $value Parameter value - * @return mixed Set parameter value - * @since 1.5 - */ - function setParam( $key, $value ) - { - return $this->_params->set( $key, $value ); - } - - /** - * Method to set a default parameter if it does not exist - * - * @access public - * @param string $key Parameter key - * @param mixed $value Parameter value - * @return mixed Set parameter value - * @since 1.5 - */ - function defParam( $key, $value ) - { - return $this->_params->def( $key, $value ); - } - - /** - * Method to check JUser object authorization against an access control - * object and optionally an access extension object - * - * @access public - * @param string $acoSection The ACO section value - * @param string $aco The ACO value - * @param string $axoSection The AXO section value [optional] - * @param string $axo The AXO value [optional] - * @return boolean True if authorized - * @since 1.5 - */ - function authorize( $acoSection, $aco, $axoSection = null, $axo = null ) - { - // the native calls (Check Mode 1) work on the user id, not the user type - $acl = & JFactory::getACL(); - $value = $acl->getCheckMode() == 1 ? $this->id : $this->usertype; - - return $acl->acl_check( $acoSection, $aco, 'users', $value, $axoSection, $axo ); - } - - /** - * Pass through method to the table for setting the last visit date - * - * @access public - * @param int $timestamp The timestamp, defaults to 'now' - * @return boolean True on success - * @since 1.5 - */ - function setLastVisit($timestamp=null) - { - // Create the user table object - $table =& $this->getTable(); - $table->load($this->id); - - return $table->setLastVisit($timestamp); - } - - /** - * Method to get the user parameters - * - * This function tries to load an xml file based on the users usertype. The filename of the xml - * file is the same as the usertype. The functionals has a static variable to store the parameters - * setup file base path. You can call this function statically to set the base path if needed. - * - * @access public - * @param boolean If true, loads the parameters setup file. Default is false. - * @param path Set the parameters setup file base path to be used to load the user parameters. - * @return object The user parameters object - * @since 1.5 - */ - function &getParameters($loadsetupfile = false, $path = null) - { - static $parampath; - - // Set a custom parampath if defined - if( isset($path) ) { - $parampath = $path; - } - - // Set the default parampath if not set already - if( !isset($parampath) ) { - $parampath = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_users'.DS.'models'; - } - - if($loadsetupfile) - { - $type = str_replace(' ', '_', strtolower($this->usertype)); - - $file = $parampath.DS.$type.'.xml'; - if(!file_exists($file)) { - $file = $parampath.DS.'user.xml'; - } - - $this->_params->loadSetupFile($file); - } - return $this->_params; - } - - /** - * Method to get the user parameters - * - * @access public - * @param object The user parameters object - * @since 1.5 - */ - function setParameters($params ) - { - $this->_params = $params; - } - - /** - * Method to get the user table object - * - * This function uses a static variable to store the table name of the user table to - * it instantiates. You can call this function statically to set the table name if - * needed. - * - * @access public - * @param string The user table name to be used - * @param string The user table prefix to be used - * @return object The user table object - * @since 1.5 - */ - function &getTable( $type = null, $prefix = 'JTable' ) - { - static $tabletype; - - //Set the default tabletype; - if(!isset($tabletype)) { - $tabletype['name'] = 'user'; - $tabletype['prefix'] = 'JTable'; - } - - //Set a custom table type is defined - if(isset($type)) { - $tabletype['name'] = $type; - $tabletype['prefix'] = $prefix; - } - - // Create the user table object - $table =& JTable::getInstance( $tabletype['name'], $tabletype['prefix'] ); - return $table; - } - - /** - * Method to bind an associative array of data to a user object - * - * @access public - * @param array $array The associative array to bind to the object - * @return boolean True on success - * @since 1.5 - */ - function bind(& $array) - { - jimport('joomla.user.helper'); - - // Lets check to see if the user is new or not - if (empty($this->id)) - { - // Check the password and create the crypted password - if (empty($array['password'])) { - $array['password'] = JUserHelper::genRandomPassword(); - $array['password2'] = $array['password']; - } - - if ($array['password'] != $array['password2']) { - $this->setError( JText::_( 'PASSWORD DO NOT MATCH.' ) ); - return false; - } - - $this->password_clear = JArrayHelper::getValue( $array, 'password', '', 'string' ); - - $salt = JUserHelper::genRandomPassword(32); - $crypt = JUserHelper::getCryptedPassword($array['password'], $salt); - $array['password'] = $crypt.':'.$salt; - - // Set the registration timestamp - - $now =& JFactory::getDate(); - $this->set( 'registerDate', $now->toMySQL() ); - - // Check that username is not greater than 25 characters - $username = $this->get( 'username' ); - if ( strlen($username) > 150 ) - { - $username = substr( $username, 0, 150 ); - $this->set( 'username', $username ); - } - - // Check that password is not greater than 50 characters - $password = $this->get( 'password' ); - if ( strlen($password) > 100 ) - { - $password = substr( $password, 0, 100 ); - $this->set( 'password', $password ); - } - } - else - { - // Updating an existing user - if (!empty($array['password'])) - { - if ( $array['password'] != $array['password2'] ) { - $this->setError( JText::_( 'PASSWORD DO NOT MATCH.' ) ); - return false; - } - - $this->password_clear = JArrayHelper::getValue( $array, 'password', '', 'string' ); - - $salt = JUserHelper::genRandomPassword(32); - $crypt = JUserHelper::getCryptedPassword($array['password'], $salt); - $array['password'] = $crypt.':'.$salt; - } - else - { - $array['password'] = $this->password; - } - } - - // TODO: this will be deprecated as of the ACL implementation - $db =& JFactory::getDBO(); - - $gid = array_key_exists('gid', $array ) ? $array['gid'] : $this->get('gid'); - - $query = 'SELECT name' - . ' FROM #__core_acl_aro_groups' - . ' WHERE id = ' . (int) $gid - ; - $db->setQuery( $query ); - $this->set( 'usertype', $db->loadResult()); - - if ( array_key_exists('params', $array) ) - { - $params = ''; - $this->_params->bind($array['params']); - if ( is_array($array['params']) ) { - $params = $this->_params->toString(); - } else { - $params = $array['params']; - } - - $this->params = $params; - } - - // Bind the array - if (!$this->setProperties($array)) { - $this->setError("Unable to bind array to user object"); - return false; - } - - // Make sure its an integer - $this->id = (int) $this->id; - - return true; - } - - /** - * Method to save the JUser object to the database - * - * @access public - * @param boolean $updateOnly Save the object only if not a new user - * @return boolean True on success - * @since 1.5 - */ - function save( $updateOnly = false ) - { - // Create the user table object - $table =& $this->getTable(); - $this->params = $this->_params->toString(); - $table->bind($this->getProperties()); - - // Check and store the object. - if (!$table->check()) { - $this->setError($table->getError()); - return false; - } - - // If user is made a Super Admin group and user is NOT a Super Admin - $my =& JFactory::getUser(); - if ( $this->get('gid') == 25 && $my->get('gid') != 25 ) - { - // disallow creation of Super Admin by non Super Admin users - $this->setError(JText::_( 'WARNSUPERADMINCREATE' )); - return false; - } - - // If user is made an Admin group and user is NOT a Super Admin - if ($this->get('gid') == 24 && !($my->get('gid') == 25 || ($this->get('id') == $my->id && $my->get('gid') == 24))) - { - // disallow creation of Admin by non Super Admin users - $this->setError(JText::_( 'WARNSUPERADMINCREATE' )); - return false; - } - - //are we creating a new user - $isnew = !$this->id; - - // If we aren't allowed to create new users return - if ($isnew && $updateOnly) { - return true; - } - - // Get the old user - $old = new JUser($this->id); - - // Fire the onBeforeStoreUser event. - JPluginHelper::importPlugin( 'user' ); - $dispatcher =& JDispatcher::getInstance(); - $dispatcher->trigger( 'onBeforeStoreUser', array( $old->getProperties(), $isnew ) ); - - //Store the user data in the database - if (!$result = $table->store()) { - $this->setError($table->getError()); - } - - // Set the id for the JUser object in case we created a new user. - if (empty($this->id)) { - $this->id = $table->get( 'id' ); - } - - // Fire the onAftereStoreUser event - $dispatcher->trigger( 'onAfterStoreUser', array( $this->getProperties(), $isnew, $result, $this->getError() ) ); - - return $result; - } - - /** - * Method to delete the JUser object from the database - * - * @access public - * @param boolean $updateOnly Save the object only if not a new user - * @return boolean True on success - * @since 1.5 - */ - function delete( ) - { - JPluginHelper::importPlugin( 'user' ); - - //trigger the onBeforeDeleteUser event - $dispatcher =& JDispatcher::getInstance(); - $dispatcher->trigger( 'onBeforeDeleteUser', array( $this->getProperties() ) ); - - // Create the user table object - $table =& $this->getTable(); - - $result = false; - if (!$result = $table->delete($this->id)) { - $this->setError($table->getError()); - } - - //trigger the onAfterDeleteUser event - $dispatcher->trigger( 'onAfterDeleteUser', array( $this->getProperties(), $result, $this->getError()) ); - return $result; - - } - - /** - * Method to load a JUser object by user id number - * - * @access public - * @param mixed $identifier The user id of the user to load - * @param string $path Path to a parameters xml file - * @return boolean True on success - * @since 1.5 - */ - function load($id) - { - // Create the user table object - $table =& $this->getTable(); - - // Load the JUserModel object based on the user id or throw a warning. - if(!$table->load($id)) { - JError::raiseWarning( 'SOME_ERROR_CODE', 'JUser::_load: Unable to load user with id: '.$id ); - return false; - } - - /* - * Set the user parameters using the default xml file. We might want to - * extend this in the future to allow for the ability to have custom - * user parameters, but for right now we'll leave it how it is. - */ - $this->_params->loadINI($table->params); - - // Assuming all is well at this point lets bind the data - $this->setProperties($table->getProperties()); - - return true; - } -} +_params = new JParameter( '' ); + + // Load the user if it exists + if (!empty($identifier)) { + $this->load($identifier); + } + else + { + //initialise + $this->id = 0; + $this->gid = 0; + $this->sendEmail = 0; + $this->aid = 0; + $this->guest = 1; + } + } + + /** + * Returns a reference to the global User object, only creating it if it + * doesn't already exist. + * + * This method must be invoked as: + *
        $user =& JUser::getInstance($id);
      + * + * @access public + * @param int $id The user to load - Can be an integer or string - If string, it is converted to ID automatically. + * @return JUser The User object. + * @since 1.5 + */ + public static function &getInstance($id = 0) + { + static $instances; + + if (!isset ($instances)) { + $instances = array (); + } + + // Find the user id + if(!is_numeric($id)) + { + jimport('joomla.user.helper'); + if (!$id = JUserHelper::getUserId($id)) { + throw new JException('JUser::_load: User does not exist', 0, E_WARNING, $id); + } + } + + if (empty($instances[$id])) { + $user = new JUser($id); + $instances[$id] = $user; + } + + return $instances[$id]; + } + + /** + * Method to get a parameter value + * + * @access public + * @param string $key Parameter key + * @param mixed $default Parameter default value + * @return mixed The value or the default if it did not exist + * @since 1.5 + */ + public function getParam( $key, $default = null ) + { + return $this->_params->get( $key, $default ); + } + + /** + * Method to set a parameter + * + * @access public + * @param string $key Parameter key + * @param mixed $value Parameter value + * @return mixed Set parameter value + * @since 1.5 + */ + public function setParam( $key, $value ) + { + return $this->_params->set( $key, $value ); + } + + /** + * Method to set a default parameter if it does not exist + * + * @access public + * @param string $key Parameter key + * @param mixed $value Parameter value + * @return mixed Set parameter value + * @since 1.5 + */ + public function defParam( $key, $value ) + { + return $this->_params->def( $key, $value ); + } + + /** + * Method to check JUser object authorization against an access control + * object and optionally an access extension object + * + * @access public + * @param string $acoSection The ACO section value + * @param string $aco The ACO value + * @param string $axoSection The AXO section value [optional] + * @param string $axo The AXO value [optional] + * @return boolean True if authorized + * @since 1.5 + */ + public function authorize( $acoSection, $aco, $axoSection = null, $axo = null ) + { + // the native calls (Check Mode 1) work on the user id, not the user type + $acl = & JFactory::getACL(); + $value = $acl->getCheckMode() == 1 ? $this->id : $this->usertype; + + return $acl->acl_check( $acoSection, $aco, 'users', $value, $axoSection, $axo ); + } + + /** + * NOTE: Temporary method to test new access control checks + * + * @access public + * @param string $acoSection The ACO section value + * @param string $aco The ACO value + * @param string $axoSection The AXO section value [optional] + * @param string $axo The AXO value [optional] + * @return boolean True if authorized + * @since 1.5 + */ + public function authorize2( $acoSection, $aco, $axoSection = null, $axo = null ) + { + // the native calls (Check Mode 1) work on the user id, not the user type + $acl = & JFactory::getACL(); + $old = $acl->setCheckMode( 1 ); + $value = $this->id; + + $result = $acl->acl_check( $acoSection, $aco, 'users', $value, $axoSection, $axo ); + $acl->setCheckMode( $old ); + return $result; + } + + /** + * Pass through method to the table for setting the last visit date + * + * @access public + * @param int $timestamp The timestamp, defaults to 'now' + * @return boolean True on success + * @since 1.5 + */ + public function setLastVisit($timestamp=null) + { + // Create the user table object + $table =& $this->getTable(); + $table->load($this->id); + + return $table->setLastVisit($timestamp); + } + + /** + * Method to get the user parameters + * + * This function tries to load an xml file based on the users usertype. The filename of the xml + * file is the same as the usertype. The functionals has a static variable to store the parameters + * setup file base path. You can call this function statically to set the base path if needed. + * + * @access public + * @param boolean If true, loads the parameters setup file. Default is false. + * @param path Set the parameters setup file base path to be used to load the user parameters. + * @return object The user parameters object + * @since 1.5 + */ + public function &getParameters($loadsetupfile = false, $path = null) + { + static $parampath; + + // Set a custom parampath if defined + if( isset($path) ) { + $parampath = $path; + } + + // Set the default parampath if not set already + if( !isset($parampath) ) { + $parampath = JPATH_ADMINISTRATOR.DS.'components'.DS.'com_users'.DS.'params'; + } + + if($loadsetupfile) + { + $type = str_replace(' ', '_', strtolower($this->usertype)); + + $file = $parampath.DS.$type.'.xml'; + if(!file_exists($file)) { + $file = $parampath.DS.'user.xml'; + } + + $this->_params->loadSetupFile($file); + $this->_params->loadSetupDirectory($parampath, $type.'_(.*)\.xml'); + $this->_params->loadSetupDirectory($parampath, 'general_(.*)\.xml'); + } + return $this->_params; + } + + /** + * Method to get the user parameters + * + * @access public + * @param object The user parameters object + * @since 1.5 + */ + public function setParameters($params ) + { + $this->_params = $params; + } + + /** + * Method to get the user table object + * + * This function uses a static variable to store the table name of the user table to + * it instantiates. You can call this function statically to set the table name if + * needed. + * + * @access public + * @param string The user table name to be used + * @param string The user table prefix to be used + * @return object The user table object + * @since 1.5 + */ + public function &getTable( $type = null, $prefix = 'JTable' ) + { + static $tabletype; + + //Set the default tabletype; + if(!isset($tabletype)) { + $tabletype['name'] = 'user'; + $tabletype['prefix'] = 'JTable'; + } + + //Set a custom table type is defined + if(isset($type)) { + $tabletype['name'] = $type; + $tabletype['prefix'] = $prefix; + } + + // Create the user table object + $table =& JTable::getInstance( $tabletype['name'], $tabletype['prefix'] ); + return $table; + } + + /** + * Method to bind an associative array of data to a user object + * + * @access public + * @param array $array The associative array to bind to the object + * @return boolean True on success + * @since 1.5 + */ + public function bind(& $array) + { + jimport('joomla.user.helper'); + + // Lets check to see if the user is new or not + if (empty($this->id)) + { + // Check the password and create the crypted password + if (empty($array['password'])) { + $array['password'] = JUserHelper::genRandomPassword(); + $array['password2'] = $array['password']; + } + + if ($array['password'] != $array['password2']) { + $this->setError( JText::_( 'PASSWORD DO NOT MATCH.' ) ); + return false; + } + + $this->password_clear = JArrayHelper::getValue( $array, 'password', '', 'string' ); + + $salt = JUserHelper::genRandomPassword(32); + $crypt = JUserHelper::getCryptedPassword($array['password'], $salt); + $array['password'] = $crypt.':'.$salt; + + // Set the registration timestamp + + $now =& JFactory::getDate(); + $this->set( 'registerDate', $now->toMySQL() ); + + // Check that username is not greater than 25 characters + $username = $this->get( 'username' ); + if ( strlen($username) > 150 ) + { + $username = substr( $username, 0, 150 ); + $this->set( 'username', $username ); + } + + // Check that password is not greater than 50 characters + $password = $this->get( 'password' ); + if ( strlen($password) > 100 ) + { + $password = substr( $password, 0, 100 ); + $this->set( 'password', $password ); + } + } + else + { + // Updating an existing user + if (!empty($array['password'])) + { + if ( $array['password'] != $array['password2'] ) { + $this->setError( JText::_( 'PASSWORD DO NOT MATCH.' ) ); + return false; + } + + $this->password_clear = JArrayHelper::getValue( $array, 'password', '', 'string' ); + + $salt = JUserHelper::genRandomPassword(32); + $crypt = JUserHelper::getCryptedPassword($array['password'], $salt); + $array['password'] = $crypt.':'.$salt; + } + else + { + $array['password'] = $this->password; + } + } + + // TODO: this will be deprecated as of the ACL implementation + $db =& JFactory::getDBO(); + + $gid = array_key_exists('gid', $array ) ? $array['gid'] : $this->get('gid'); + + $query = 'SELECT name' + . ' FROM #__core_acl_aro_groups' + . ' WHERE id = ' . (int) $gid + ; + $db->setQuery( $query ); + try { + $this->set( 'usertype', $db->loadResult()); + } catch (JException $e) { + $this->set( 'usertype', null); + } + + if ( array_key_exists('params', $array) ) + { + $params = ''; + $this->_params->bind($array['params']); + if ( is_array($array['params']) ) { + $params = $this->_params->toString(); + } else { + $params = $array['params']; + } + + $this->params = $params; + } + + // Bind the array + if (!$this->setProperties($array)) { + $this->setError("Unable to bind array to user object"); + return false; + } + + // Make sure its an integer + $this->id = (int) $this->id; + + return true; + } + + /** + * Method to save the JUser object to the database + * + * @access public + * @param boolean $updateOnly Save the object only if not a new user + * @return boolean True on success + * @since 1.5 + */ + public function save( $updateOnly = false ) + { + // Create the user table object + $table =& $this->getTable(); + $this->params = $this->_params->toString(); + $table->bind($this->getProperties()); + + // Check and store the object. + if (!$table->check()) { + $this->setError($table->getError()); + return false; + } + + // If user is made a Super Admin group and user is NOT a Super Admin + $my =& JFactory::getUser(); + if ( $this->get('gid') == 25 && $my->get('gid') != 25 ) + { + // disallow creation of Super Admin by non Super Admin users + $this->setError(JText::_( 'WARNSUPERADMINCREATE' )); + return false; + } + + // If user is made an Admin group and user is NOT a Super Admin + if ($this->get('gid') == 24 && !($my->get('gid') == 25 || ($this->get('id') == $my->id && $my->get('gid') == 24))) + { + // disallow creation of Admin by non Super Admin users + $this->setError(JText::_( 'WARNSUPERADMINCREATE' )); + return false; + } + + //are we creating a new user + $isnew = !$this->id; + + // If we aren't allowed to create new users return + if ($isnew && $updateOnly) { + return true; + } + + // Get the old user + $old = new JUser($this->id); + + // Fire the onBeforeStoreUser event. + JPluginHelper::importPlugin( 'user' ); + $dispatcher =& JDispatcher::getInstance(); + $dispatcher->trigger( 'onBeforeStoreUser', array( $old->getProperties(), $isnew ) ); + + //Store the user data in the database + if (!$result = $table->store()) { + $this->setError($table->getError()); + } + + // Set the id for the JUser object in case we created a new user. + if (empty($this->id)) { + $this->id = $table->get( 'id' ); + } + + // Fire the onAftereStoreUser event + $dispatcher->trigger( 'onAfterStoreUser', array( $this->getProperties(), $isnew, $result, $this->getError() ) ); + + return $result; + } + + /** + * Method to delete the JUser object from the database + * + * @access public + * @param boolean $updateOnly Save the object only if not a new user + * @return boolean True on success + * @since 1.5 + */ + public function delete( ) + { + JPluginHelper::importPlugin( 'user' ); + + //trigger the onBeforeDeleteUser event + $dispatcher =& JDispatcher::getInstance(); + $dispatcher->trigger( 'onBeforeDeleteUser', array( $this->getProperties() ) ); + + // Create the user table object + $table =& $this->getTable(); + + $result = false; + if (!$result = $table->delete($this->id)) { + $this->setError($table->getError()); + } + + //trigger the onAfterDeleteUser event + $dispatcher->trigger( 'onAfterDeleteUser', array( $this->getProperties(), $result, $this->getError()) ); + return $result; + + } + + /** + * Method to load a JUser object by user id number + * + * @access public + * @param mixed $identifier The user id of the user to load + * @param string $path Path to a parameters xml file + * @return boolean True on success + * @since 1.5 + */ + public function load($id) + { + // Create the user table object + $table =& $this->getTable(); + + // Load the JUserModel object based on the user id or throw a warning. + if(!$table->load($id)) { + throw new JException('JUser::_load: User does not exist', 0, E_WARNING, $id); + } + + /* + * Set the user parameters using the default xml file. We might want to + * extend this in the future to allow for the ability to have custom + * user parameters, but for right now we'll leave it how it is. + */ + $this->_params->loadINI($table->params); + + // Assuming all is well at this point lets bind the data + $this->setProperties($table->getProperties()); + + return true; + } +} diff --git a/libraries/joomla/utilities/arrayhelper.php b/libraries/joomla/utilities/arrayhelper.php index cce872c715caa..99b22fb88e4a5 100644 --- a/libraries/joomla/utilities/arrayhelper.php +++ b/libraries/joomla/utilities/arrayhelper.php @@ -1,287 +1,286 @@ - - * @package Joomla.Framework - * @subpackage Utilities - * @since 1.5 - */ -class JArrayHelper -{ - /** - * Function to convert array to integer values - * - * @static - * @param array $array The source array to convert - * @param mixed $default A default value (int|array) to assign if $array is not an array - * @since 1.5 - */ - function toInteger(&$array, $default = null) - { - if (is_array($array)) { - foreach ($array as $i => $v) { - $array[$i] = (int) $v; - } - } else { - if ($default === null) { - $array = array(); - } elseif (is_array($default)) { - JArrayHelper::toInteger($default, null); - $array = $default; - } else { - $array = array( (int) $default ); - } - } - } - - /** - * Utility function to map an array to a stdClass object. - * - * @static - * @param array $array The array to map. - * @param string $calss Name of the class to create - * @return object The object mapped from the given array - * @since 1.5 - */ - function toObject(&$array, $class = 'stdClass') - { - $obj = null; - if (is_array($array)) - { - $obj = new $class(); - foreach ($array as $k => $v) - { - if (is_array($v)) { - $obj->$k = JArrayHelper::toObject($v, $class); - } else { - $obj->$k = $v; - } - } - } - return $obj; - } - - function toString( $array = null, $inner_glue = '=', $outer_glue = ' ', $keepOuterKey = false ) - { - $output = array(); - - if (is_array($array)) - { - foreach ($array as $key => $item) - { - if (is_array ($item)) - { - if ($keepOuterKey) { - $output[] = $key; - } - // This is value is an array, go and do it again! - $output[] = JArrayHelper::toString( $item, $inner_glue, $outer_glue, $keepOuterKey); - } - else { - $output[] = $key.$inner_glue.'"'.$item.'"'; - } - } - } - - return implode( $outer_glue, $output); - } - - /** - * Utility function to map an object to an array - * - * @static - * @param object The source object - * @param boolean True to recurve through multi-level objects - * @param string An optional regular expression to match on field names - * @return array The array mapped from the given object - * @since 1.5 - */ - function fromObject( $p_obj, $recurse = true, $regex = null ) - { - $result = null; - if (is_object( $p_obj )) - { - $result = array(); - foreach (get_object_vars($p_obj) as $k => $v) - { - if ($regex) - { - if (!preg_match( $regex, $k )) - { - continue; - } - } - if (is_object( $v )) - { - if ($recurse) - { - $result[$k] = JArrayHelper::fromObject( $v, $recurse, $regex ); - } - } - else - { - $result[$k] = $v; - } - } - } - return $result; - } - - /** - * Extracts a column from an array of arrays or objects - * - * @static - * @param array $array The source array - * @param string $index The index of the column or name of object property - * @return array Column of values from the source array - * @since 1.5 - */ - function getColumn(&$array, $index) - { - $result = array (); - - if (is_array($array)) - { - $n = count($array); - for ($i = 0; $i < $n; $i++) - { - $item = & $array[$i]; - if (is_array($item) && isset ($item[$index])) { - $result[] = $item[$index]; - } elseif (is_object($item) && isset ($item-> $index)) { - $result[] = $item-> $index; - } - // else ignore the entry - } - } - return $result; - } - - /** - * Utility function to return a value from a named array or a specified default - * - * @static - * @param array $array A named array - * @param string $name The key to search for - * @param mixed $default The default value to give if no key found - * @param string $type Return type for the variable (INT, FLOAT, STRING, WORD, BOOLEAN, ARRAY) - * @return mixed The value from the source array - * @since 1.5 - */ - function getValue(&$array, $name, $default=null, $type='') - { - // Initialize variables - $result = null; - - if (isset ($array[$name])) { - $result = $array[$name]; - } - - // Handle the default case - if (is_null($result)) { - $result = $default; - } - - // Handle the type constraint - switch (strtoupper($type)) - { - case 'INT' : - case 'INTEGER' : - // Only use the first integer value - @ preg_match('/-?[0-9]+/', $result, $matches); - $result = @ (int) $matches[0]; - break; - - case 'FLOAT' : - case 'DOUBLE' : - // Only use the first floating point value - @ preg_match('/-?[0-9]+(\.[0-9]+)?/', $result, $matches); - $result = @ (float) $matches[0]; - break; - - case 'BOOL' : - case 'BOOLEAN' : - $result = (bool) $result; - break; - - case 'ARRAY' : - if (!is_array($result)) { - $result = array ($result); - } - break; - - case 'STRING' : - $result = (string) $result; - break; - - case 'WORD' : - $result = (string) preg_replace( '#\W#', '', $result ); - break; - - case 'NONE' : - default : - // No casting necessary - break; - } - return $result; - } - - /** - * Utility function to sort an array of objects on a given field - * - * @static - * @param array $arr An array of objects - * @param string $k The key to sort on - * @param int $direction Direction to sort in [1 = Ascending] [-1 = Descending] - * @return array The sorted array of objects - * @since 1.5 - */ - function sortObjects( &$a, $k, $direction=1 ) - { - $GLOBALS['JAH_so'] = array( - 'key' => $k, - 'direction' => $direction - ); - usort( $a, array('JArrayHelper', '_sortObjects') ); - unset( $GLOBALS['JAH_so'] ); - - return $a; - } - - /** - * Private callback function for sorting an array of objects on a key - * - * @static - * @param array $a An array of objects - * @param array $b An array of objects - * @return int Comparison status - * @since 1.5 - * @see JArrayHelper::sortObjects() - */ - function _sortObjects( &$a, &$b ) - { - $params = $GLOBALS['JAH_so']; - if ( $a->$params['key'] > $b->$params['key'] ) { - return $params['direction']; - } - if ( $a->$params['key'] < $b->$params['key'] ) { - return -1 * $params['direction']; - } - return 0; - } -} \ No newline at end of file + $v) { + $array[$i] = (int) $v; + } + } else { + if ($default === null) { + $array = array(); + } elseif (is_array($default)) { + JArrayHelper::toInteger($default, null); + $array = $default; + } else { + $array = array( (int) $default ); + } + } + } + + /** + * Utility function to map an array to a stdClass object. + * + * @static + * @param array $array The array to map. + * @param string $calss Name of the class to create + * @return object The object mapped from the given array + * @since 1.5 + */ + public static function toObject(&$array, $class = 'stdClass') + { + $obj = null; + if (is_array($array)) + { + $obj = new $class(); + foreach ($array as $k => $v) + { + if (is_array($v)) { + $obj->$k = JArrayHelper::toObject($v, $class); + } else { + $obj->$k = $v; + } + } + } + return $obj; + } + + public static function toString( $array = null, $inner_glue = '=', $outer_glue = ' ', $keepOuterKey = false ) + { + $output = array(); + + if (is_array($array)) + { + foreach ($array as $key => $item) + { + if (is_array ($item)) + { + if ($keepOuterKey) { + $output[] = $key; + } + // This is value is an array, go and do it again! + $output[] = JArrayHelper::toString( $item, $inner_glue, $outer_glue, $keepOuterKey); + } + else { + $output[] = $key.$inner_glue.'"'.$item.'"'; + } + } + } + + return implode( $outer_glue, $output); + } + + /** + * Utility function to map an object to an array + * + * @static + * @param object The source object + * @param boolean True to recurve through multi-level objects + * @param string An optional regular expression to match on field names + * @return array The array mapped from the given object + * @since 1.5 + */ + public static function fromObject( $p_obj, $recurse = true, $regex = null ) + { + $result = null; + if (is_object( $p_obj )) + { + $result = array(); + foreach (get_object_vars($p_obj) as $k => $v) + { + if ($regex) + { + if (!preg_match( $regex, $k )) + { + continue; + } + } + if (is_object( $v )) + { + if ($recurse) + { + $result[$k] = JArrayHelper::fromObject( $v, $recurse, $regex ); + } + } + else + { + $result[$k] = $v; + } + } + } + return $result; + } + + /** + * Extracts a column from an array of arrays or objects + * + * @static + * @param array $array The source array + * @param string $index The index of the column or name of object property + * @return array Column of values from the source array + * @since 1.5 + */ + public static function getColumn(&$array, $index) + { + $result = array (); + + if (is_array($array)) + { + $n = count($array); + for ($i = 0; $i < $n; $i++) + { + $item = & $array[$i]; + if (is_array($item) && isset ($item[$index])) { + $result[] = $item[$index]; + } elseif (is_object($item) && isset ($item-> $index)) { + $result[] = $item-> $index; + } + // else ignore the entry + } + } + return $result; + } + + /** + * Utility function to return a value from a named array or a specified default + * + * @static + * @param array $array A named array + * @param string $name The key to search for + * @param mixed $default The default value to give if no key found + * @param string $type Return type for the variable (INT, FLOAT, STRING, WORD, BOOLEAN, ARRAY) + * @return mixed The value from the source array + * @since 1.5 + */ + public static function getValue(&$array, $name, $default=null, $type='') + { + // Initialize variables + $result = null; + + if (isset ($array[$name])) { + $result = $array[$name]; + } + + // Handle the default case + if (is_null($result)) { + $result = $default; + } + + // Handle the type constraint + switch (strtoupper($type)) + { + case 'INT' : + case 'INTEGER' : + // Only use the first integer value + @ preg_match('/-?[0-9]+/', $result, $matches); + $result = @ (int) $matches[0]; + break; + + case 'FLOAT' : + case 'DOUBLE' : + // Only use the first floating point value + @ preg_match('/-?[0-9]+(\.[0-9]+)?/', $result, $matches); + $result = @ (float) $matches[0]; + break; + + case 'BOOL' : + case 'BOOLEAN' : + $result = (bool) $result; + break; + + case 'ARRAY' : + if (!is_array($result)) { + $result = array ($result); + } + break; + + case 'STRING' : + $result = (string) $result; + break; + + case 'WORD' : + $result = (string) preg_replace( '#\W#', '', $result ); + break; + + case 'NONE' : + default : + // No casting necessary + break; + } + return $result; + } + + /** + * Utility function to sort an array of objects on a given field + * + * @static + * @param array $arr An array of objects + * @param string $k The key to sort on + * @param int $direction Direction to sort in [1 = Ascending] [-1 = Descending] + * @return array The sorted array of objects + * @since 1.5 + */ + public static function sortObjects( &$a, $k, $direction=1 ) + { + $GLOBALS['JAH_so'] = array( + 'key' => $k, + 'direction' => $direction + ); + usort( $a, array('JArrayHelper', '_sortObjects') ); + unset( $GLOBALS['JAH_so'] ); + + return $a; + } + + /** + * Private callback function for sorting an array of objects on a key + * + * @static + * @param array $a An array of objects + * @param array $b An array of objects + * @return int Comparison status + * @since 1.5 + * @see JArrayHelper::sortObjects() + */ + protected static function _sortObjects( &$a, &$b ) + { + $params = $GLOBALS['JAH_so']; + if ( $a->$params['key'] > $b->$params['key'] ) { + return $params['direction']; + } + if ( $a->$params['key'] < $b->$params['key'] ) { + return -1 * $params['direction']; + } + return 0; + } +} diff --git a/libraries/joomla/utilities/buffer.php b/libraries/joomla/utilities/buffer.php index 64d0a8321d6df..5233723bd8efe 100644 --- a/libraries/joomla/utilities/buffer.php +++ b/libraries/joomla/utilities/buffer.php @@ -18,7 +18,6 @@ * This class provides a generic buffer stream. It can be used to store/retrieve/manipulate * string buffers with the standard PHP filesystem I/O methods. * - * @author Louis Landry * @package Joomla.Framework * @subpackage Utilities * @since 1.5 @@ -29,21 +28,21 @@ class JBuffer * Stream position * @var int */ - var $position = 0; + public $position = 0; /** * Buffer name * @var string */ - var $name = null; + public $name = null; /** * Buffer hash * @var array */ - var $_buffers = array (); + protected $_buffers = array (); - function stream_open($path, $mode, $options, & $opened_path) + public function stream_open($path, $mode, $options, & $opened_path) { $url = parse_url($path); $this->name = $url["host"]; @@ -53,14 +52,14 @@ function stream_open($path, $mode, $options, & $opened_path) return true; } - function stream_read($count) + public function stream_read($count) { $ret = substr($this->_buffers[$this->name], $this->position, $count); $this->position += strlen($ret); return $ret; } - function stream_write($data) + public function stream_write($data) { $left = substr($this->_buffers[$this->name], 0, $this->position); $right = substr($this->_buffers[$this->name], $this->position + strlen($data)); @@ -69,15 +68,15 @@ function stream_write($data) return strlen($data); } - function stream_tell() { + public function stream_tell() { return $this->position; } - function stream_eof() { + public function stream_eof() { return $this->position >= strlen($this->_buffers[$this->name]); } - function stream_seek($offset, $whence) + public function stream_seek($offset, $whence) { switch ($whence) { @@ -114,4 +113,4 @@ function stream_seek($offset, $whence) } } // Register the stream -stream_wrapper_register("buffer", "JBuffer"); \ No newline at end of file +stream_wrapper_register("buffer", "JBuffer"); diff --git a/libraries/joomla/utilities/compat/compat.php b/libraries/joomla/utilities/compat/compat.php index a5cc98702c118..4015b03523711 100644 --- a/libraries/joomla/utilities/compat/compat.php +++ b/libraries/joomla/utilities/compat/compat.php @@ -1,27 +1,25 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/utilities/compat/php50x.php b/libraries/joomla/utilities/compat/php50x.php deleted file mode 100644 index 1eb5ff19122b3..0000000000000 --- a/libraries/joomla/utilities/compat/php50x.php +++ /dev/null @@ -1,102 +0,0 @@ - - * @version $Revision: 47 $ - * @internal resource_context is not supported - * @since PHP 5 - */ -if (!function_exists('file_put_contents')) { - function file_put_contents($filename, $content, $flags = null, $resource_context = null) - { - // If $content is an array, convert it to a string - if (is_array($content)) { - $content = implode('', $content); - } - - // If we don't have a string, throw an error - if (!is_scalar($content)) { - trigger_error('file_put_contents() The 2nd parameter should be either a string or an array', E_USER_WARNING); - return false; - } - - // Get the length of date to write - $length = strlen($content); - - // Check what mode we are using - $mode = ($flags & FILE_APPEND) ? - $mode = 'a' : - $mode = 'w'; - - // Check if we're using the include path - $use_inc_path = ($flags & FILE_USE_INCLUDE_PATH) ? - true : - false; - - // Open the file for writing - if (($fh = @fopen($filename, $mode, $use_inc_path)) === false) { - trigger_error('file_put_contents() failed to open stream: Permission denied', E_USER_WARNING); - return false; - } - - // Write to the file - $bytes = 0; - if (($bytes = @fwrite($fh, $content)) === false) { - $errormsg = sprintf('file_put_contents() Failed to write %d bytes to %s', - $length, - $filename); - trigger_error($errormsg, E_USER_WARNING); - return false; - } - - // Close the handle - @fclose($fh); - - // Check all the data was written - if ($bytes != $length) { - $errormsg = sprintf('file_put_contents() Only %d of %d bytes written, possibly out of free disk space.', - $bytes, - $length); - trigger_error($errormsg, E_USER_WARNING); - return false; - } - - // Return length - return $bytes; - } -} - -/** - * Ported PHP5 function to PHP4 for forward compatibility - */ -function clone($object) { - return unserialize(serialize($object)); -} \ No newline at end of file diff --git a/libraries/joomla/utilities/date.php b/libraries/joomla/utilities/date.php index e2d80330e2fd6..adac8f2fe94bb 100644 --- a/libraries/joomla/utilities/date.php +++ b/libraries/joomla/utilities/date.php @@ -1,304 +1,303 @@ - - * - * @package Joomla.Framework - * @subpackage Utilities - * @since 1.5 - */ -class JDate extends JObject -{ - /** - * Unix timestamp - * - * @var int|boolean - * @access protected - */ - var $_date = false; - - /** - * Time offset (in seconds) - * - * @var string - * @access protected - */ - var $_offset = 0; - - /** - * Creates a new instance of JDate representing a given date. - * - * Accepts RFC 822, ISO 8601 date formats as well as unix time stamps. - * If not specified, the current date and time is used. - * - * @param mixed $date optional the date this JDate will represent. - * @param int $tzOffset optional the timezone $date is from - */ - function __construct($date = 'now', $tzOffset = 0) - { - if ($date == 'now' || empty($date)) - { - $this->_date = strtotime(gmdate("M d Y H:i:s", time())); - return; - } - - $tzOffset *= 3600; - if (is_numeric($date)) - { - $this->_date = $date - $tzOffset; - return; - } - - if (preg_match('~(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s+)?(\\d{1,2})\\s+([a-zA-Z]{3})\\s+(\\d{4})\\s+(\\d{2}):(\\d{2}):(\\d{2})\\s+(.*)~i',$date,$matches)) - { - $months = Array( - 'jan' => 1, 'feb' => 2, 'mar' => 3, 'apr' => 4, - 'may' => 5, 'jun' => 6, 'jul' => 7, 'aug' => 8, - 'sep' => 9, 'oct' => 10, 'nov' => 11, 'dec' => 12 - ); - $matches[2] = strtolower($matches[2]); - if (! isset($months[$matches[2]])) { - return; - } - $this->_date = mktime( - $matches[4], $matches[5], $matches[6], - $months[$matches[2]], $matches[1], $matches[3] - ); - if ($this->_date === false) { - return; - } - - if ($matches[7][0] == '+') { - $tzOffset = 3600 * substr($matches[7], 1, 2) - + 60 * substr($matches[7], -2); - } elseif ($matches[7][0] == '-') { - $tzOffset = -3600 * substr($matches[7], 1, 2) - - 60 * substr($matches[7], -2); - } else { - if (strlen($matches[7]) == 1) { - $oneHour = 3600; - $ord = ord($matches[7]); - if ($ord < ord('M')) { - $tzOffset = (ord('A') - $ord - 1) * $oneHour; - } elseif ($ord >= ord('M') && $matches[7] != 'Z') { - $tzOffset = ($ord - ord('M')) * $oneHour; - } elseif ($matches[7] == 'Z') { - $tzOffset = 0; - } - } - switch ($matches[7]) { - case 'UT': - case 'GMT': $tzOffset = 0; - } - } - $this->_date -= $tzOffset; - return; - } - if (preg_match('~(\\d{4})-(\\d{2})-(\\d{2})[T\s](\\d{2}):(\\d{2}):(\\d{2})(.*)~', $date, $matches)) - { - $this->_date = mktime( - $matches[4], $matches[5], $matches[6], - $matches[2], $matches[3], $matches[1] - ); - if ($this->_date == false) { - return; - } - if (isset($matches[7][0])) { - if ($matches[7][0] == '+' || $matches[7][0] == '-') { - $tzOffset = 60 * ( - substr($matches[7], 0, 3) * 60 + substr($matches[7], -2) - ); - } elseif ($matches[7] == 'Z') { - $tzOffset = 0; - } - } - $this->_date -= $tzOffset; - return; - } - $this->_date = (strtotime($date) == -1) ? false : strtotime($date); - if ($this->_date) { - $this->_date -= $tzOffset; - } - } - - /** - * Set the date offset (in hours) - * - * @access public - * @param float The offset in hours - */ - function setOffset($offset) { - $this->_offset = 3600 * $offset; - } - - /** - * Get the date offset (in hours) - * - * @access public - * @return integer - */ - function getOffset() { - return ((float) $this->_offset) / 3600.0; - } - - /** - * Gets the date as an RFC 822 date. - * - * @return a date in RFC 822 format - * @link http://www.ietf.org/rfc/rfc2822.txt?number=2822 IETF RFC 2822 - * (replaces RFC 822) - */ - function toRFC822($local = false) - { - $date = ($local) ? $this->_date + $this->_offset : $this->_date; - $date = ($this->_date !== false) ? date('D, d M Y H:i:s O', $date) : null; - return $date; - } - - /** - * Gets the date as an ISO 8601 date. - * - * @return a date in ISO 8601 (RFC 3339) format - * @link http://www.ietf.org/rfc/rfc3339.txt?number=3339 IETF RFC 3339 - */ - function toISO8601($local = false) - { - $date = ($local) ? $this->_date + $this->_offset : $this->_date; - $offset = ($local) ? sprintf("%+03d", $this->getOffset()).':00' : 'Z'; - $date = ($this->_date !== false) ? date('Y-m-d\TH:i:s', $date).$offset : null; - return $date; - } - - /** - * Gets the date as in MySQL datetime format - * - * @return a date in MySQL datetime format - * @link http://dev.mysql.com/doc/refman/4.1/en/datetime.html MySQL DATETIME - * format - */ - function toMySQL($local = false) - { - $date = ($local) ? $this->_date + $this->_offset : $this->_date; - $date = ($this->_date !== false) ? date('Y-m-d H:i:s', $date) : null; - return $date; - } - - /** - * Gets the date as UNIX time stamp. - * - * @return a date as a unix time stamp - */ - function toUnix($local = false) - { - $date = null; - if ($this->_date !== false) { - $date = ($local) ? $this->_date + $this->_offset : $this->_date; - } - return $date; - } - - /** - * Gets the date in a specific format - * - * Returns a string formatted according to the given format. Month and weekday names and - * other language dependent strings respect the current locale - * - * @param string $format The date format specification string (see {@link PHP_MANUAL#strftime}) - * @return a date in a specific format - */ - function toFormat($format = '%Y-%m-%d %H:%M:%S') - { - $date = ($this->_date !== false) ? $this->_strftime($format, $this->_date + $this->_offset) : null; - - return $date; - } - - /** - * Translates needed strings in for JDate::toFormat (see {@link PHP_MANUAL#strftime}) - * - * @access protected - * @param string $format The date format specification string (see {@link PHP_MANUAL#strftime}) - * @param int $time Unix timestamp - * @return string a date in the specified format - */ - function _strftime($format, $time) - { - if(strpos($format, '%a') !== false) - $format = str_replace('%a', $this->_dayToString(date('w', $time), true), $format); - if(strpos($format, '%A') !== false) - $format = str_replace('%A', $this->_dayToString(date('w', $time)), $format); - if(strpos($format, '%b') !== false) - $format = str_replace('%b', $this->_monthToString(date('n', $time), true), $format); - if(strpos($format, '%B') !== false) - $format = str_replace('%B', $this->_monthToString(date('n', $time)), $format); - $date = strftime($format, $time); - return $date; - } - - /** - * Translates month number to string - * - * @access protected - * @param int $month The numeric month of the year - * @param bool $abbr Return the abreviated month string? - * @return string month string - */ - function _monthToString($month, $abbr = false) - { - switch ($month) - { - case 1: return $abbr ? JText::_('JANUARY_SHORT') : JText::_('JANUARY'); - case 2: return $abbr ? JText::_('FEBRUARY_SHORT') : JText::_('FEBRUARY'); - case 3: return $abbr ? JText::_('MARCH_SHORT') : JText::_('MARCH'); - case 4: return $abbr ? JText::_('APRIL_SHORT') : JText::_('APRIL'); - case 5: return $abbr ? JText::_('MAY_SHORT') : JText::_('MAY'); - case 6: return $abbr ? JText::_('JUNE_SHORT') : JText::_('JUNE'); - case 7: return $abbr ? JText::_('JULY_SHORT') : JText::_('JULY'); - case 8: return $abbr ? JText::_('AUGUST_SHORT') : JText::_('AUGUST'); - case 9: return $abbr ? JText::_('SEPTEMBER_SHORT') : JText::_('SEPTEMBER'); - case 10: return $abbr ? JText::_('OCTOBER_SHORT') : JText::_('OCTOBER'); - case 11: return $abbr ? JText::_('NOVEMBER_SHORT') : JText::_('NOVEMBER'); - case 12: return $abbr ? JText::_('DECEMBER_SHORT') : JText::_('DECEMBER'); - } - } - - /** - * Translates day of week number to string - * - * @access protected - * @param int $day The numeric day of the week - * @param bool $abbr Return the abreviated day string? - * @return string day string - */ - function _dayToString($day, $abbr = false) - { - switch ($day) - { - case 0: return $abbr ? JText::_('SUN') : JText::_('SUNDAY'); - case 1: return $abbr ? JText::_('MON') : JText::_('MONDAY'); - case 2: return $abbr ? JText::_('TUE') : JText::_('TUESDAY'); - case 3: return $abbr ? JText::_('WED') : JText::_('WEDNESDAY'); - case 4: return $abbr ? JText::_('THU') : JText::_('THURSDAY'); - case 5: return $abbr ? JText::_('FRI') : JText::_('FRIDAY'); - case 6: return $abbr ? JText::_('SAT') : JText::_('SATURDAY'); - } - } - -} +_date = strtotime(gmdate("M d Y H:i:s", time())); + return; + } + + $tzOffset *= 3600; + if (is_numeric($date)) + { + $this->_date = $date - $tzOffset; + return; + } + + if (preg_match('~(?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\\s+)?(\\d{1,2})\\s+([a-zA-Z]{3})\\s+(\\d{4})\\s+(\\d{2}):(\\d{2}):(\\d{2})\\s+(.*)~i',$date,$matches)) + { + $months = Array( + 'jan' => 1, 'feb' => 2, 'mar' => 3, 'apr' => 4, + 'may' => 5, 'jun' => 6, 'jul' => 7, 'aug' => 8, + 'sep' => 9, 'oct' => 10, 'nov' => 11, 'dec' => 12 + ); + $matches[2] = strtolower($matches[2]); + if (! isset($months[$matches[2]])) { + return; + } + $this->_date = mktime( + $matches[4], $matches[5], $matches[6], + $months[$matches[2]], $matches[1], $matches[3] + ); + if ($this->_date === false) { + return; + } + + if ($matches[7][0] == '+') { + $tzOffset = 3600 * substr($matches[7], 1, 2) + + 60 * substr($matches[7], -2); + } elseif ($matches[7][0] == '-') { + $tzOffset = -3600 * substr($matches[7], 1, 2) + - 60 * substr($matches[7], -2); + } else { + if (strlen($matches[7]) == 1) { + $oneHour = 3600; + $ord = ord($matches[7]); + if ($ord < ord('M')) { + $tzOffset = (ord('A') - $ord - 1) * $oneHour; + } elseif ($ord >= ord('M') && $matches[7] != 'Z') { + $tzOffset = ($ord - ord('M')) * $oneHour; + } elseif ($matches[7] == 'Z') { + $tzOffset = 0; + } + } + switch ($matches[7]) { + case 'UT': + case 'GMT': $tzOffset = 0; + } + } + $this->_date -= $tzOffset; + return; + } + if (preg_match('~(\\d{4})-(\\d{2})-(\\d{2})[T\s](\\d{2}):(\\d{2}):(\\d{2})(.*)~', $date, $matches)) + { + $this->_date = mktime( + $matches[4], $matches[5], $matches[6], + $matches[2], $matches[3], $matches[1] + ); + if ($this->_date == false) { + return; + } + if (isset($matches[7][0])) { + if ($matches[7][0] == '+' || $matches[7][0] == '-') { + $tzOffset = 60 * ( + substr($matches[7], 0, 3) * 60 + substr($matches[7], -2) + ); + } elseif ($matches[7] == 'Z') { + $tzOffset = 0; + } + } + $this->_date -= $tzOffset; + return; + } + $this->_date = (strtotime($date) == -1) ? false : strtotime($date); + if ($this->_date) { + $this->_date -= $tzOffset; + } + } + + /** + * Set the date offset (in hours) + * + * @access public + * @param float The offset in hours + */ + function setOffset($offset) { + $this->_offset = 3600 * $offset; + } + + /** + * Get the date offset (in hours) + * + * @access public + * @return integer + */ + function getOffset() { + return ((float) $this->_offset) / 3600.0; + } + + /** + * Gets the date as an RFC 822 date. + * + * @return a date in RFC 822 format + * @link http://www.ietf.org/rfc/rfc2822.txt?number=2822 IETF RFC 2822 + * (replaces RFC 822) + */ + function toRFC822($local = false) + { + $date = ($local) ? $this->_date + $this->_offset : $this->_date; + $date = ($this->_date !== false) ? date('D, d M Y H:i:s', $date).' +0000' : null; + return $date; + } + + /** + * Gets the date as an ISO 8601 date. + * + * @return a date in ISO 8601 (RFC 3339) format + * @link http://www.ietf.org/rfc/rfc3339.txt?number=3339 IETF RFC 3339 + */ + function toISO8601($local = false) + { + $date = ($local) ? $this->_date + $this->_offset : $this->_date; + $offset = $this->getOffset(); + $offset = ($local && $this->_offset) ? sprintf("%+03d:%02d", $offset, abs(($offset-intval($offset))*60) ) : 'Z'; + $date = ($this->_date !== false) ? date('Y-m-d\TH:i:s', $date).$offset : null; + return $date; + } + + /** + * Gets the date as in MySQL datetime format + * + * @return a date in MySQL datetime format + * @link http://dev.mysql.com/doc/refman/4.1/en/datetime.html MySQL DATETIME + * format + */ + function toMySQL($local = false) + { + $date = ($local) ? $this->_date + $this->_offset : $this->_date; + $date = ($this->_date !== false) ? date('Y-m-d H:i:s', $date) : null; + return $date; + } + + /** + * Gets the date as UNIX time stamp. + * + * @return a date as a unix time stamp + */ + function toUnix($local = false) + { + $date = null; + if ($this->_date !== false) { + $date = ($local) ? $this->_date + $this->_offset : $this->_date; + } + return $date; + } + + /** + * Gets the date in a specific format + * + * Returns a string formatted according to the given format. Month and weekday names and + * other language dependent strings respect the current locale + * + * @param string $format The date format specification string (see {@link PHP_MANUAL#strftime}) + * @return a date in a specific format + */ + function toFormat($format = '%Y-%m-%d %H:%M:%S') + { + $date = ($this->_date !== false) ? $this->_strftime($format, $this->_date + $this->_offset) : null; + + return $date; + } + + /** + * Translates needed strings in for JDate::toFormat (see {@link PHP_MANUAL#strftime}) + * + * @access protected + * @param string $format The date format specification string (see {@link PHP_MANUAL#strftime}) + * @param int $time Unix timestamp + * @return string a date in the specified format + */ + function _strftime($format, $time) + { + if(strpos($format, '%a') !== false) + $format = str_replace('%a', $this->_dayToString(date('w', $time), true), $format); + if(strpos($format, '%A') !== false) + $format = str_replace('%A', $this->_dayToString(date('w', $time)), $format); + if(strpos($format, '%b') !== false) + $format = str_replace('%b', $this->_monthToString(date('n', $time), true), $format); + if(strpos($format, '%B') !== false) + $format = str_replace('%B', $this->_monthToString(date('n', $time)), $format); + $date = strftime($format, $time); + return $date; + } + + /** + * Translates month number to string + * + * @access protected + * @param int $month The numeric month of the year + * @param bool $abbr Return the abreviated month string? + * @return string month string + */ + function _monthToString($month, $abbr = false) + { + switch ($month) + { + case 1: return $abbr ? JText::_('JANUARY_SHORT') : JText::_('JANUARY'); + case 2: return $abbr ? JText::_('FEBRUARY_SHORT') : JText::_('FEBRUARY'); + case 3: return $abbr ? JText::_('MARCH_SHORT') : JText::_('MARCH'); + case 4: return $abbr ? JText::_('APRIL_SHORT') : JText::_('APRIL'); + case 5: return $abbr ? JText::_('MAY_SHORT') : JText::_('MAY'); + case 6: return $abbr ? JText::_('JUNE_SHORT') : JText::_('JUNE'); + case 7: return $abbr ? JText::_('JULY_SHORT') : JText::_('JULY'); + case 8: return $abbr ? JText::_('AUGUST_SHORT') : JText::_('AUGUST'); + case 9: return $abbr ? JText::_('SEPTEMBER_SHORT') : JText::_('SEPTEMBER'); + case 10: return $abbr ? JText::_('OCTOBER_SHORT') : JText::_('OCTOBER'); + case 11: return $abbr ? JText::_('NOVEMBER_SHORT') : JText::_('NOVEMBER'); + case 12: return $abbr ? JText::_('DECEMBER_SHORT') : JText::_('DECEMBER'); + } + } + + /** + * Translates day of week number to string + * + * @access protected + * @param int $day The numeric day of the week + * @param bool $abbr Return the abreviated day string? + * @return string day string + */ + function _dayToString($day, $abbr = false) + { + switch ($day) + { + case 0: return $abbr ? JText::_('SUN') : JText::_('SUNDAY'); + case 1: return $abbr ? JText::_('MON') : JText::_('MONDAY'); + case 2: return $abbr ? JText::_('TUE') : JText::_('TUESDAY'); + case 3: return $abbr ? JText::_('WED') : JText::_('WEDNESDAY'); + case 4: return $abbr ? JText::_('THU') : JText::_('THURSDAY'); + case 5: return $abbr ? JText::_('FRI') : JText::_('FRIDAY'); + case 6: return $abbr ? JText::_('SAT') : JText::_('SATURDAY'); + } + } + +} diff --git a/libraries/joomla/utilities/index.html b/libraries/joomla/utilities/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/joomla/utilities/index.html +++ b/libraries/joomla/utilities/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/joomla/utilities/simplecrypt.php b/libraries/joomla/utilities/simplecrypt.php index cf704cfa1f4dc..6fdc14e154741 100644 --- a/libraries/joomla/utilities/simplecrypt.php +++ b/libraries/joomla/utilities/simplecrypt.php @@ -19,7 +19,6 @@ * JSimpleCrypt is a very simple encryption algorithm for encyrpting/decrypting strings * * @static - * @author Louis Landry * @package Joomla.Framework * @subpackage Utilities * @since 1.5 @@ -31,7 +30,7 @@ class JSimpleCrypt extends JObject * @access private * @var string */ - var $_key; + protected $_key; /** * Object Constructor takes an optional key to be used for encryption/decryption. If no key is given then the @@ -42,7 +41,7 @@ class JSimpleCrypt extends JObject * @return void * @since 1.5 */ - function __construct($key = null) + public function __construct($key = null) { if ($key) { $this->_key = (string) $key; @@ -52,14 +51,14 @@ function __construct($key = null) } } - function decrypt($s) + public function decrypt($s) { $ai = $this->_hexToIntArray($s); (string) $s1 = $this->_xorString($ai); return $s1; } - function encrypt($s) + public function encrypt($s) { $ai = $this->_xorCharString($s); $s1 = ""; @@ -68,7 +67,7 @@ function encrypt($s) return $s1; } - function _hexToInt($s, $i) + protected function _hexToInt($s, $i) { (int) $j = $i * 2; (string) $s1 = $s; @@ -135,7 +134,7 @@ function _hexToInt($s, $i) return $k; } - function _hexToIntArray($s) + protected function _hexToIntArray($s) { (string) $s1 = $s; (int) $i = strlen($s1); @@ -148,13 +147,13 @@ function _hexToIntArray($s) return $ai; } - function _charToInt($c) + protected function _charToInt($c) { $ac[0] = $c; return $ac; } - function _xorString($ai) + protected function _xorString($ai) { $s = $this->_key; // (int) $i = strlen($s); @@ -172,7 +171,7 @@ function _xorString($ai) return $s1; } - function _intToHex($i) + protected function _intToHex($i) { (int) $j = (int) $i / 16; if ((int) $j == 0) { @@ -186,7 +185,7 @@ function _intToHex($i) return $s; } - function _xorCharString($s) + protected function _xorCharString($s) { $ac = preg_split('//', $s, -1, PREG_SPLIT_NO_EMPTY); (string) $s1 = $this->_key; @@ -203,4 +202,4 @@ function _xorCharString($s) return $ai; } -} \ No newline at end of file +} diff --git a/libraries/joomla/utilities/simplexml.php b/libraries/joomla/utilities/simplexml.php index 7dd8cbd077556..dab055a8f79c3 100644 --- a/libraries/joomla/utilities/simplexml.php +++ b/libraries/joomla/utilities/simplexml.php @@ -86,28 +86,28 @@ class JSimpleXML extends JObject * * @var resource */ - var $_parser = null; + protected $_parser = null; /** * The XML document * * @var string */ - var $_xml = ''; + protected $_xml = ''; /** * Document element * * @var object */ - var $document = null; + public $document = null; /** * Current object depth * * @var array */ - var $_stack = array(); + protected $_stack = array(); /** @@ -115,7 +115,7 @@ class JSimpleXML extends JObject * * @access protected */ - function __construct($options = null) + public function __construct($options = null) { if(! function_exists('xml_parser_create')) { return false; //TODO throw warning @@ -150,7 +150,7 @@ function __construct($options = null) * @param string currently ignored * @return object JSimpleXMLElement */ - function loadString($string, $classname = null) { + public function loadString($string, $classname = null) { $this->_parse($string); return true; } @@ -166,7 +166,7 @@ function loadString($string, $classname = null) { * @param string currently ignored * @return boolean True if successful, false if file empty */ - function loadFile($path, $classname = null) + public function loadFile($path, $classname = null) { //Check to see of the path exists if ( !file_exists( $path ) ) { @@ -197,7 +197,7 @@ function loadFile($path, $classname = null) * @param string currently ignored * @return object JSimpleXMLElement */ - function importDOM($node, $classname = null) { + public function importDOM($node, $classname = null) { return false; } @@ -207,7 +207,7 @@ function importDOM($node, $classname = null) { * @access public * @return resource XML parser resource handle */ - function getParser() { + public function getParser() { return $this->_parser; } @@ -217,7 +217,7 @@ function getParser() { * @access public * @param resource XML parser resource handle */ - function setParser($parser) { + public function setParser($parser) { $this->_parser = $parser; } @@ -228,7 +228,7 @@ function setParser($parser) { * * @param $xml string data to parse */ - function _parse($data = '') + protected function _parse($data = '') { //Error handling if (!xml_parse($this->_parser, $data)) { @@ -251,7 +251,7 @@ function _parse($data = '') * @param int $line Line on which the error happened * @param int $col Column on which the error happened */ - function _handleError($code, $line, $col) + protected function _handleError($code, $line, $col) { JError::raiseWarning( 'SOME_ERROR_CODE' , 'XML Parsing Error at '.$line.':'.$col.'. Error '.$code.': '.xml_error_string($code)); } @@ -261,7 +261,7 @@ function _handleError($code, $line, $col) * * @return object */ - function _getStackLocation() + protected function _getStackLocation() { $return = ''; foreach($this->_stack as $stack) { @@ -279,10 +279,11 @@ function _getStackLocation() * @param string $name * @param array $attrs */ - function _startElement($parser, $name, $attrs = array()) + protected function _startElement($parser, $name, $attrs = array()) { //Check to see if tag is root-level - if (count($this->_stack) == 0) + $count = count($this->_stack); + if ($count == 0) { //If so, set the document as the current tag $classname = get_class( $this ) . 'Element'; @@ -298,7 +299,7 @@ function _startElement($parser, $name, $attrs = array()) $parent = $this->_getStackLocation(); //Add the child - eval('$this->'.$parent.'->addChild($name, $attrs, '.count($this->_stack).');'); + eval('$this->'.$parent.'->addChild($name, $attrs, '.$count.');'); //Update the stack eval('$this->_stack[] = $name.\'[\'.(count($this->'.$parent.'->'.$name.') - 1).\']\';'); @@ -312,7 +313,7 @@ function _startElement($parser, $name, $attrs = array()) * @param resource $parser * @param string $name */ - function _endElement($parser, $name) + protected function _endElement($parser, $name) { //Update stack by removing the end value from it as the parent array_pop($this->_stack); @@ -325,7 +326,7 @@ function _endElement($parser, $name) * @param resource $parser * @param string $data */ - function _characterData($parser, $data) + protected function _characterData($parser, $data) { //Get the reference to the current parent object $tag = $this->_getStackLocation(); @@ -350,47 +351,46 @@ function _characterData($parser, $data) * To loop through all of the direct children of a specific tag for this object, it * is probably easier to use the arrays of the specific tag names, as explained above. * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Utilities * @since 1.5 */ -class JSimpleXMLElement extends JObject +class JSimpleXMLElement extends JStdClass { /** * Array with the attributes of this XML element * * @var array */ - var $_attributes = array(); + protected $_attributes = array(); /** * The name of the element * * @var string */ - var $_name = ''; + protected $_name = ''; /** * The data the element contains * * @var string */ - var $_data = ''; + public $_data = ''; /** * Array of references to the objects of all direct children of this XML object * * @var array */ - var $_children = array(); + protected $_children = array(); /** * The level of this XML element * * @var int */ - var $_level = 0; + protected $_level = 0; /** * Constructor, sets up all the default values @@ -400,7 +400,7 @@ class JSimpleXMLElement extends JObject * @param int $parents * @return JSimpleXMLElement */ - function __construct($name, $attrs = array(), $level = 0) + public function __construct($name, $attrs = array(), $level = 0) { //Make the keys of the attr array lower case, and store the value $this->_attributes = array_change_key_case($attrs, CASE_LOWER); @@ -418,7 +418,7 @@ function __construct($name, $attrs = array(), $level = 0) * @access public * @return string */ - function name() { + public function name() { return $this->_name; } @@ -431,7 +431,7 @@ function name() { * @return mixed If an attribute is given will return the attribute if it exist. * If no attribute is given will return the complete attributes array */ - function attributes($attribute = null) + public function attributes($attribute = null) { if(!isset($attribute)) { return $this->_attributes; @@ -446,7 +446,7 @@ function attributes($attribute = null) * @access public * @return string */ - function data() { + public function data() { return $this->_data; } @@ -457,7 +457,7 @@ function data() { * @param string $data * @return string */ - function setData($data) { + public function setData($data) { $this->_data = $data; } @@ -467,7 +467,7 @@ function setData($data) { * @access public * @return array */ - function children() { + public function children() { return $this->_children; } @@ -477,7 +477,7 @@ function children() { * @access public * @return int */ - function level() { + public function level() { return $this->_level; } @@ -487,7 +487,7 @@ function level() { * @param string $name * @param array $attrs */ - function addAttribute($name, $value) + public function addAttribute($name, $value) { //add the attribute to the element, override if it already exists $this->_attributes[$name] = $value; @@ -498,7 +498,7 @@ function addAttribute($name, $value) * * @param string $name */ - function removeAttribute($name) + public function removeAttribute($name) { unset($this->_attributes[$name]); } @@ -511,7 +511,7 @@ function removeAttribute($name) * @param int $level * @return JSimpleXMLElement The added child object */ - function &addChild($name, $attrs = array(), $level = null) + public function &addChild($name, $attrs = array(), $level = null) { //If there is no array already set for the tag name being added, //create an empty array for it @@ -538,7 +538,7 @@ function &addChild($name, $attrs = array(), $level = null) return $child; } - function removeChild(&$child) + public function removeChild(&$child) { $name = $child->name(); for ($i=0,$n=count($this->_children);$i<$n;$i++) @@ -564,7 +564,7 @@ function removeChild(&$child) * @param string $path The / separated path to the element * @return object JSimpleXMLElement */ - function &getElementByPath($path) + public function &getElementByPath($path) { $tmp =& $this; $false = false; @@ -602,7 +602,7 @@ function &getElementByPath($path) * @param string $callback function name * @param array $args */ - function map($callback, $args=array()) + public function map($callback, $args=array()) { $callback($this, $args); // Map to all children @@ -619,7 +619,7 @@ function map($callback, $args=array()) * * @return string */ - function toString($whitespace=true) + public function toString($whitespace=true) { //Start a new line, indent by the number indicated in $this->level, add a <, and add the name of the tag if ($whitespace) { @@ -666,4 +666,4 @@ function toString($whitespace=true) //Return the final output return $out; } -} \ No newline at end of file +} diff --git a/libraries/joomla/utilities/string.php b/libraries/joomla/utilities/string.php index 1c91ea9fcb6e2..9b8af3888d2ee 100644 --- a/libraries/joomla/utilities/string.php +++ b/libraries/joomla/utilities/string.php @@ -1,446 +1,725 @@ - - * @package Joomla.Framework - * @subpackage Utilities - * @since 1.5 - */ -class JString -{ - /** - * UTF-8 aware alternative to strpos - * Find position of first occurrence of a string - * - * @static - * @access public - * @param $str - string String being examined - * @param $search - string String being searced for - * @param $offset - int Optional, specifies the position from which the search should be performed - * @return mixed Number of characters before the first match or FALSE on failure - * @see http://www.php.net/strpos - */ - function strpos($str, $search, $offset = FALSE) - { - if ( $offset === FALSE ) { - return utf8_strpos($str, $search); - } else { - return utf8_strpos($str, $search, $offset); - } - } - - /** - * UTF-8 aware alternative to strrpos - * Finds position of last occurrence of a string - * - * @static - * @access public - * @param $str - string String being examined - * @param $search - string String being searced for - * @return mixed Number of characters before the last match or FALSE on failure - * @see http://www.php.net/strrpos - */ - function strrpos($str, $search){ - return utf8_strrpos($str, $search); - } - - /** - * UTF-8 aware alternative to substr - * Return part of a string given character offset (and optionally length) - * - * @static - * @access public - * @param string - * @param integer number of UTF-8 characters offset (from left) - * @param integer (optional) length in UTF-8 characters from offset - * @return mixed string or FALSE if failure - * @see http://www.php.net/substr - */ - function substr($str, $offset, $length = FALSE) - { - if ( $length === FALSE ) { - return utf8_substr($str, $offset); - } else { - return utf8_substr($str, $offset, $length); - } - } - - /** - * UTF-8 aware alternative to strtlower - * Make a string lowercase - * Note: The concept of a characters "case" only exists is some alphabets - * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does - * not exist in the Chinese alphabet, for example. See Unicode Standard - * Annex #21: Case Mappings - * - * @access public - * @param string - * @return mixed either string in lowercase or FALSE is UTF-8 invalid - * @see http://www.php.net/strtolower - */ - function strtolower($str){ - return utf8_strtolower($str); - } - - /** - * UTF-8 aware alternative to strtoupper - * Make a string uppercase - * Note: The concept of a characters "case" only exists is some alphabets - * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does - * not exist in the Chinese alphabet, for example. See Unicode Standard - * Annex #21: Case Mappings - * - * @access public - * @param string - * @return mixed either string in uppercase or FALSE is UTF-8 invalid - * @see http://www.php.net/strtoupper - */ - function strtoupper($str){ - return utf8_strtoupper($str); - } - - /** - * UTF-8 aware alternative to strlen - * Returns the number of characters in the string (NOT THE NUMBER OF BYTES), - * - * @access public - * @param string UTF-8 string - * @return int number of UTF-8 characters in string - * @see http://www.php.net/strlen - */ - function strlen($str){ - return utf8_strlen($str); - } - - /** - * UTF-8 aware alternative to str_ireplace - * Case-insensitive version of str_replace - * - * @static - * @access public - * @param string string to search - * @param string existing string to replace - * @param string new string to replace with - * @param int optional count value to be passed by referene - * @see http://www.php.net/str_ireplace - */ - function str_ireplace($search, $replace, $str, $count = NULL) - { - jimport('phputf8.str_ireplace'); - if ( $count === FALSE ) { - return utf8_ireplace($search, $replace, $str); - } else { - return utf8_ireplace($search, $replace, $str, $count); - } - } - - /** - * UTF-8 aware alternative to str_split - * Convert a string to an array - * - * @static - * @access public - * @param string UTF-8 encoded - * @param int number to characters to split string by - * @return array - * @see http://www.php.net/str_split - */ - function str_split($str, $split_len = 1) - { - jimport('phputf8.str_split'); - return utf8_str_split($str, $split_len); - } - - /** - * UTF-8 aware alternative to strcasecmp - * A case insensivite string comparison - * - * @static - * @access public - * @param string string 1 to compare - * @param string string 2 to compare - * @return int < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. - * @see http://www.php.net/strcasecmp - */ - function strcasecmp($str1, $str2) - { - jimport('phputf8.strcasecmp'); - return utf8_strcasecmp($str1, $str2); - } - - /** - * UTF-8 aware alternative to strcspn - * Find length of initial segment not matching mask - * - * @static - * @access public - * @param string - * @param string the mask - * @param int Optional starting character position (in characters) - * @param int Optional length - * @return int the length of the initial segment of str1 which does not contain any of the characters in str2 - * @see http://www.php.net/strcspn - */ - function strcspn($str, $mask, $start = NULL, $length = NULL) - { - jimport('phputf8.strcspn'); - if ( $start === FALSE && $length === FALSE ) { - return utf8_strcspn($str, $mask); - } else if ( $length === FALSE ) { - return utf8_strcspn($str, $mask, $start); - } else { - return utf8_strcspn($str, $mask, $start, $length); - } - } - - /** - * UTF-8 aware alternative to stristr - * Returns all of haystack from the first occurrence of needle to the end. - * needle and haystack are examined in a case-insensitive manner - * Find first occurrence of a string using case insensitive comparison - * - * @static - * @access public - * @param string the haystack - * @param string the needle - * @return string the sub string - * @see http://www.php.net/stristr - */ - function stristr($str, $search) - { - jimport('phputf8.stristr'); - return utf8_stristr($str, $search); - } - - /** - * UTF-8 aware alternative to strrev - * Reverse a string - * - * @static - * @access public - * @param string String to be reversed - * @return string The string in reverse character order - * @see http://www.php.net/strrev - */ - function strrev($str) - { - jimport('phputf8.strrev'); - return utf8_strrev($str); - } - - /** - * UTF-8 aware alternative to strspn - * Find length of initial segment matching mask - * - * @static - * @access public - * @param string the haystack - * @param string the mask - * @param int start optional - * @param int length optional - * @see http://www.php.net/strspn - */ - function strspn($str, $mask, $start = NULL, $length = NULL) - { - jimport('phputf8.native.utf8_strspn'); - if ( $start === FALSE && $length === FALSE ) { - return utf8_strspn($str, $mask); - } else if ( $length === FALSE ) { - return utf8_strspn($str, $mask, $start); - } else { - return utf8_strspn($str, $mask, $start, $length); - } - } - - /** - * UTF-8 aware substr_replace - * Replace text within a portion of a string - * - * @static - * @access public - * @param string the haystack - * @param string the replacement string - * @param int start - * @param int length (optional) - * @see http://www.php.net/substr_replace - */ - function substr_replace($str, $repl, $start, $length = NULL ) - { - // loaded by library loader - if ( $length === FALSE ) { - return utf8_substr_replace($str, $repl, $start); - } else { - return utf8_substr_replace($str, $repl, $start, $length); - } - } - - /** - * UTF-8 aware replacement for ltrim() - * Strip whitespace (or other characters) from the beginning of a string - * Note: you only need to use this if you are supplying the charlist - * optional arg and it contains UTF-8 characters. Otherwise ltrim will - * work normally on a UTF-8 string - * - * @static - * @access public - * @param string the string to be trimmed - * @param string the optional charlist of additional characters to trim - * @return string the trimmed string - * @see http://www.php.net/ltrim - */ - function ltrim( $str, $charlist = FALSE ) - { - jimport('phputf8.trim'); - if ( $charlist === FALSE ) { - return utf8_ltrim( $str ); - } else { - return utf8_ltrim( $str, $charlist ); - } - } - - /** - * UTF-8 aware replacement for rtrim() - * Strip whitespace (or other characters) from the end of a string - * Note: you only need to use this if you are supplying the charlist - * optional arg and it contains UTF-8 characters. Otherwise rtrim will - * work normally on a UTF-8 string - * - * @static - * @access public - * @param string the string to be trimmed - * @param string the optional charlist of additional characters to trim - * @return string the trimmed string - * @see http://www.php.net/rtrim - */ - function rtrim( $str, $charlist = FALSE ) - { - jimport('phputf8.trim'); - if ( $charlist === FALSE ) { - return utf8_rltrim( $str ); - } else { - return utf8_rtrim( $str, $charlist ); - } - } - - /** - * UTF-8 aware replacement for trim() - * Strip whitespace (or other characters) from the beginning and end of a string - * Note: you only need to use this if you are supplying the charlist - * optional arg and it contains UTF-8 characters. Otherwise trim will - * work normally on a UTF-8 string - * - * @static - * @access public - * @param string the string to be trimmed - * @param string the optional charlist of additional characters to trim - * @return string the trimmed string - * @see http://www.php.net/trim - */ - function trim( $str, $charlist = FALSE ) - { - jimport('phputf8.trim'); - if ( $charlist === FALSE ) { - return utf8_trim( $str ); - } else { - return utf8_trim( $str, $charlist ); - } - } - - /** - * UTF-8 aware alternative to ucfirst - * Make a string's first character uppercase - * - * @static - * @access public - * @param string - * @return string with first character as upper case (if applicable) - * @see http://www.php.net/ucfirst - */ - function ucfirst($str) - { - jimport('phputf8.ucfirst'); - return utf8_ucfirst($str); - } - - /** - * UTF-8 aware alternative to ucwords - * Uppercase the first character of each word in a string - * - * @static - * @access public - * @param string - * @return string with first char of each word uppercase - * @see http://www.php.net/ucwords - */ - function ucwords($str) - { - jimport('phputf8.ucwords'); - return utf8_ucwords($str); - } - - /** - * Transcode a string. - * - * @static - * @param string $source The string to transcode. - * @param string $from_encoding The source encoding. - * @param string $to_encoding The target encoding. - * @return string Transcoded string - * @since 1.5 - */ - function transcode($source, $from_encoding, $to_encoding) { - - if (is_string($source)) { - /* - * "//TRANSLIT" is appendd to the $to_encoding to ensure that when iconv comes - * across a character that cannot be represented in the target charset, it can - * be approximated through one or several similarly looking characters. - */ - return iconv($from_encoding, $to_encoding.'//TRANSLIT', $source); - } - } -} \ No newline at end of file + +/** + * PHP mbstring and iconv local configuration + */ +// check if mbstring extension is loaded and attempt to load it if not present except for windows +if (extension_loaded('mbstring') || ((!strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && dl('mbstring.so')))) { + //Make sure to surpress the output in case ini_set is disabled + @ini_set('mbstring.internal_encoding', 'UTF-8'); + @ini_set('mbstring.http_input', 'UTF-8'); + @ini_set('mbstring.http_output', 'UTF-8'); +} + +// same for iconv +if (function_exists('iconv') || ((!strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && dl('iconv.so')))) { + // these are settings that can be set inside code + iconv_set_encoding("internal_encoding", "UTF-8"); + iconv_set_encoding("input_encoding", "UTF-8"); + iconv_set_encoding("output_encoding", "UTF-8"); +} + +/** + * String handling class for utf-8 data + * Wraps the phputf8 library + * All functions assume the validity of utf-8 strings. + * + * @static + * @package Joomla.Framework + * @subpackage Utilities + * @since 1.5 + */ +abstract class JString +{ + /** + * UTF-8 aware alternative to strpos + * Find position of first occurrence of a string + * + * @static + * @access public + * @param $str - string String being examined + * @param $search - string String being searced for + * @param $offset - int Optional, specifies the position from which the search should be performed + * @return mixed Number of characters before the first match or FALSE on failure + * @see http://www.php.net/strpos + */ + public static function strpos($str, $search, $offset = FALSE) + { + if(strlen($str) && strlen($search)) + { + if ( $offset === FALSE ) { + return mb_strpos($str, $search); + } else { + return mb_strpos($str, $search, $offset); + } + } else return FALSE; + } + + /** + * UTF-8 aware alternative to strrpos + * Finds position of last occurrence of a string + * + * @static + * @access public + * @param $str - string String being examined + * @param $search - string String being searced for + * @return mixed Number of characters before the last match or FALSE on failure + * @see http://www.php.net/strrpos + */ + public static function strrpos($str, $search) + { + if ( $offset === FALSE ) + { + # Emulate behaviour of strrpos rather than raising warning + if ( empty($str) ) { + return FALSE; + } + return mb_strrpos($str, $search); + } + else + { + if ( !is_int($offset) ) { + trigger_error('utf8_strrpos expects parameter 3 to be long',E_USER_WARNING); + return FALSE; + } + + $str = mb_substr($str, $offset); + + if ( FALSE !== ( $pos = mb_strrpos($str, $search) ) ) { + return $pos + $offset; + } + + return FALSE; + } + } + + /** + * UTF-8 aware alternative to substr + * Return part of a string given character offset (and optionally length) + * + * @static + * @access public + * @param string + * @param integer number of UTF-8 characters offset (from left) + * @param integer (optional) length in UTF-8 characters from offset + * @return mixed string or FALSE if failure + * @see http://www.php.net/substr + */ + public static function substr($str, $offset, $length = FALSE) + { + if ( $length === FALSE ) { + return mb_substr($str, $offset); + } else { + return mb_substr($str, $offset, $length); + } + } + + /** + * UTF-8 aware alternative to strtlower + * Make a string lowercase + * Note: The concept of a characters "case" only exists is some alphabets + * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does + * not exist in the Chinese alphabet, for example. See Unicode Standard + * Annex #21: Case Mappings + * + * @access public + * @param string + * @return mixed either string in lowercase or FALSE is UTF-8 invalid + * @see http://www.php.net/strtolower + */ + public static function strtolower($str){ + return mb_strtolower($str); + } + + /** + * UTF-8 aware alternative to strtoupper + * Make a string uppercase + * Note: The concept of a characters "case" only exists is some alphabets + * such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does + * not exist in the Chinese alphabet, for example. See Unicode Standard + * Annex #21: Case Mappings + * + * @access public + * @param string + * @return mixed either string in uppercase or FALSE is UTF-8 invalid + * @see http://www.php.net/strtoupper + */ + public static function strtoupper($str){ + return mb_strtoupper($str); + } + + /** + * UTF-8 aware alternative to strlen + * Returns the number of characters in the string (NOT THE NUMBER OF BYTES), + * + * @access public + * @param string UTF-8 string + * @return int number of UTF-8 characters in string + * @see http://www.php.net/strlen + */ + public static function strlen($str){ + return mb_strlen($str); + } + + /** + * UTF-8 aware alternative to str_ireplace + * Case-insensitive version of str_replace + * + * @static + * @access public + * @param string string to search + * @param string existing string to replace + * @param string new string to replace with + * @param int optional count value to be passed by referene + * @see http://www.php.net/str_ireplace + */ + public static function str_ireplace($search, $replace, $str, $count = NULL) + { + if ( !is_array($search) ) + { + $slen = strlen($search); + $lendif = strlen($replace) - $slen; + if ( $slen == 0 ) { + return $str; + } + + $search = JString::strtolower($search); + + $search = preg_quote($search, '/'); + $lstr = JString::strtolower($str); + $i = 0; + $matched = 0; + while ( preg_match('/(.*)'.$search.'/Us',$lstr, $matches) ) { + if ( $i === $count ) { + break; + } + $mlen = strlen($matches[0]); + $lstr = substr($lstr, $mlen); + $str = substr_replace($str, $replace, $matched+strlen($matches[1]), $slen); + $matched += $mlen + $lendif; + $i++; + } + return $str; + + } else { + + foreach ( array_keys($search) as $k ) + { + if ( is_array($replace) ) + { + if ( array_key_exists($k,$replace) ) { + $str = JString::str_ireplace($search[$k], $replace[$k], $str, $count); + } else { + $str = JString::str_ireplace($search[$k], '', $str, $count); + } + } else { + $str = JString::str_ireplace($search[$k], $replace, $str, $count); + } + } + return $str; + } + } + + /** + * UTF-8 aware alternative to str_split + * Convert a string to an array + * + * @static + * @access public + * @param string UTF-8 encoded + * @param int number to characters to split string by + * @return array + * @see http://www.php.net/str_split + */ + public static function str_split($str, $split_len = 1) + { + if ( !preg_match('/^[0-9]+$/',$split_len) || $split_len < 1 ) { + return FALSE; + } + + $len = JString::strlen($str); + if ( $len <= $split_len ) { + return array($str); + } + + preg_match_all('/.{'.$split_len.'}|[^\x00]{1,'.$split_len.'}$/us', $str, $ar); + return $ar[0]; + } + + /** + * UTF-8 aware alternative to strcasecmp + * A case insensivite string comparison + * + * @static + * @access public + * @param string string 1 to compare + * @param string string 2 to compare + * @return int < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. + * @see http://www.php.net/strcasecmp + */ + public static function strcasecmp($str1, $str2) + { + $strX = JString::strtolower($strX); + $strY = JString::strtolower($strY); + return strcmp($strX, $strY); + } + + /** + * UTF-8 aware alternative to strcspn + * Find length of initial segment not matching mask + * + * @static + * @access public + * @param string + * @param string the mask + * @param int Optional starting character position (in characters) + * @param int Optional length + * @return int the length of the initial segment of str1 which does not contain any of the characters in str2 + * @see http://www.php.net/strcspn + */ + public static function strcspn($str, $mask, $start = NULL, $length = NULL) + { + if ( empty($mask) || strlen($mask) == 0 ) { + return NULL; + } + + $mask = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$mask); + + if ( $start !== NULL || $length !== NULL ) { + $str = JString::substr($str, $start, $length); + } + + preg_match('/^[^'.$mask.']+/u',$str, $matches); + + if ( isset($matches[0]) ) { + return utf8_strlen($matches[0]); + } + + return 0; + } + + /** + * UTF-8 aware alternative to stristr + * Returns all of haystack from the first occurrence of needle to the end. + * needle and haystack are examined in a case-insensitive manner + * Find first occurrence of a string using case insensitive comparison + * + * @static + * @access public + * @param string the haystack + * @param string the needle + * @return string the sub string + * @see http://www.php.net/stristr + */ + public static function stristr($str, $search) + { + if ( strlen($search) == 0 ) { + return $str; + } + + $lstr = JString::strtolower($str); + $lsearch = JString::strtolower($search); + preg_match('|^(.*)'.preg_quote($lsearch).'|Us',$lstr, $matches); + + if ( count($matches) == 2 ) { + return substr($str, strlen($matches[1])); + } + + return FALSE; + } + + /** + * UTF-8 aware alternative to strrev + * Reverse a string + * + * @static + * @access public + * @param string String to be reversed + * @return string The string in reverse character order + * @see http://www.php.net/strrev + */ + public static function strrev($str) + { + preg_match_all('/./us', $str, $ar); + return join('',array_reverse($ar[0])); + } + + /** + * UTF-8 aware alternative to strspn + * Find length of initial segment matching mask + * + * @static + * @access public + * @param string the haystack + * @param string the mask + * @param int start optional + * @param int length optional + * @see http://www.php.net/strspn + */ + public static function strspn($str, $mask, $start = NULL, $length = NULL) + { + $mask = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$mask); + + if ( $start !== NULL || $length !== NULL ) { + $str = JString::substr($str, $start, $length); + } + + preg_match('/^['.$mask.']+/u',$str, $matches); + + if ( isset($matches[0]) ) { + return JString::strlen($matches[0]); + } + + return 0; + } + + /** + * UTF-8 aware substr_replace + * Replace text within a portion of a string + * + * @static + * @access public + * @param string the haystack + * @param string the replacement string + * @param int start + * @param int length (optional) + * @see http://www.php.net/substr_replace + */ + public static function substr_replace($str, $repl, $start, $length = NULL ) + { + preg_match_all('/./us', $str, $ar); + preg_match_all('/./us', $repl, $rar); + if( $length === NULL ) { + $length = JString::strlen($str); + } + array_splice( $ar[0], $start, $length, $rar[0] ); + return join('',$ar[0]); + } + + /** + * UTF-8 aware replacement for ltrim() + * Strip whitespace (or other characters) from the beginning of a string + * Note: you only need to use this if you are supplying the charlist + * optional arg and it contains UTF-8 characters. Otherwise ltrim will + * work normally on a UTF-8 string + * + * @static + * @access public + * @param string the string to be trimmed + * @param string the optional charlist of additional characters to trim + * @return string the trimmed string + * @see http://www.php.net/ltrim + */ + public static function ltrim( $str, $charlist = FALSE ) + { + if($charlist === FALSE) return ltrim($str); + + //quote charlist for use in a characterclass + $charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist); + + return preg_replace('/^['.$charlist.']+/u','',$str); + } + + /** + * UTF-8 aware replacement for rtrim() + * Strip whitespace (or other characters) from the end of a string + * Note: you only need to use this if you are supplying the charlist + * optional arg and it contains UTF-8 characters. Otherwise rtrim will + * work normally on a UTF-8 string + * + * @static + * @access public + * @param string the string to be trimmed + * @param string the optional charlist of additional characters to trim + * @return string the trimmed string + * @see http://www.php.net/rtrim + */ + public static function rtrim( $str, $charlist = FALSE ) + { + if($charlist === FALSE) { + return rtrim($str); + } + + //quote charlist for use in a characterclass + $charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist); + + return preg_replace('/['.$charlist.']+$/u','',$str); + } + + /** + * UTF-8 aware replacement for trim() + * Strip whitespace (or other characters) from the beginning and end of a string + * Note: you only need to use this if you are supplying the charlist + * optional arg and it contains UTF-8 characters. Otherwise trim will + * work normally on a UTF-8 string + * + * @static + * @access public + * @param string the string to be trimmed + * @param string the optional charlist of additional characters to trim + * @return string the trimmed string + * @see http://www.php.net/trim + */ + public static function trim( $str, $charlist = FALSE ) + { + if($charlist === FALSE) { + return trim($str); + } + + return JString::ltrim(utf8_rtrim($str, $charlist), $charlist); + } + + /** + * UTF-8 aware alternative to ucfirst + * Make a string's first character uppercase + * + * @static + * @access public + * @param string + * @return string with first character as upper case (if applicable) + * @see http://www.php.net/ucfirst + */ + public static function ucfirst($str) + { + switch ( JString::strlen($str) ) { + case 0: + return ''; + break; + case 1: + return JString::strtoupper($str); + break; + default: + preg_match('/^(.{1})(.*)$/us', $str, $matches); + return JString::strtoupper($matches[1]).$matches[2]; + break; + } + } + + /** + * UTF-8 aware alternative to ucwords + * Uppercase the first character of each word in a string + * + * @static + * @access public + * @param string + * @return string with first char of each word uppercase + * @see http://www.php.net/ucwords + */ + public static function ucwords($str) + { + // Note: [\x0c\x09\x0b\x0a\x0d\x20] matches; + // form feeds, horizontal tabs, vertical tabs, linefeeds and carriage returns + // This corresponds to the definition of a "word" defined at http://www.php.net/ucwords + $pattern = '/(^|([\x0c\x09\x0b\x0a\x0d\x20]+))([^\x0c\x09\x0b\x0a\x0d\x20]{1})[^\x0c\x09\x0b\x0a\x0d\x20]*/u'; + return preg_replace_callback($pattern, 'JString::ucwords_callback',$str); + } + + + /** + * Callback function for preg_replace_callback call in utf8_ucwords + * You don't need to call this yourself + * @param array of matches corresponding to a single word + * @return string with first char of the word in uppercase + * @see ucwords + * @see strtoupper + */ + public static function ucwords_callback($matches) + { + $leadingws = $matches[2]; + $ucfirst = JString::strtoupper($matches[3]); + $ucword = JString::substr_replace(ltrim($matches[0]),$ucfirst,0,1); + return $leadingws . $ucword; + } + + /** + * Transcode a string. + * + * @static + * @param string $source The string to transcode. + * @param string $from_encoding The source encoding. + * @param string $to_encoding The target encoding. + * @return string Transcoded string + * @since 1.5 + */ + public static function transcode($source, $from_encoding, $to_encoding) + { + if (is_string($source)) + { + /* + * "//TRANSLIT" is appendd to the $to_encoding to ensure that when iconv comes + * across a character that cannot be represented in the target charset, it can + * be approximated through one or several similarly looking characters. + */ + return iconv($from_encoding, $to_encoding.'//TRANSLIT', $source); + } + } + + /** + * Tests a string as to whether it's valid UTF-8 and supported by the + * Unicode standard + * Note: this function has been modified to simple return true or false + * @author + * @param string UTF-8 encoded string + * @return boolean true if valid + * @see http://hsivonen.iki.fi/php-utf8/ + * @see compliant + */ + public static function valid($str) + { + $mState = 0; // cached expected number of octets after the current octet + // until the beginning of the next UTF8 character sequence + $mUcs4 = 0; // cached Unicode character + $mBytes = 1; // cached expected number of octets in the current sequence + + $len = strlen($str); + + for($i = 0; $i < $len; $i++) + { + $in = ord($str{$i}); + + if ( $mState == 0) + { + // When mState is zero we expect either a US-ASCII character or a + // multi-octet sequence. + if (0 == (0x80 & ($in))) { + // US-ASCII, pass straight through. + $mBytes = 1; + } else if (0xC0 == (0xE0 & ($in))) { + // First octet of 2 octet sequence + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x1F) << 6; + $mState = 1; + $mBytes = 2; + } else if (0xE0 == (0xF0 & ($in))) { + // First octet of 3 octet sequence + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x0F) << 12; + $mState = 2; + $mBytes = 3; + } else if (0xF0 == (0xF8 & ($in))) { + // First octet of 4 octet sequence + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x07) << 18; + $mState = 3; + $mBytes = 4; + } else if (0xF8 == (0xFC & ($in))) { + /* First octet of 5 octet sequence. + * + * This is illegal because the encoded codepoint must be either + * (a) not the shortest form or + * (b) outside the Unicode range of 0-0x10FFFF. + * Rather than trying to resynchronize, we will carry on until the end + * of the sequence and let the later error handling code catch it. + */ + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 0x03) << 24; + $mState = 4; + $mBytes = 5; + } else if (0xFC == (0xFE & ($in))) { + // First octet of 6 octet sequence, see comments for 5 octet sequence. + $mUcs4 = ($in); + $mUcs4 = ($mUcs4 & 1) << 30; + $mState = 5; + $mBytes = 6; + + } else { + /* Current octet is neither in the US-ASCII range nor a legal first + * octet of a multi-octet sequence. + */ + return FALSE; + } + } + else + { + // When mState is non-zero, we expect a continuation of the multi-octet + // sequence + if (0x80 == (0xC0 & ($in))) + { + // Legal continuation. + $shift = ($mState - 1) * 6; + $tmp = $in; + $tmp = ($tmp & 0x0000003F) << $shift; + $mUcs4 |= $tmp; + + /** + * End of the multi-octet sequence. mUcs4 now contains the final + * Unicode codepoint to be output + */ + if (0 == --$mState) + { + /* + * Check for illegal sequences and codepoints. + */ + // From Unicode 3.1, non-shortest form is illegal + if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || + ((3 == $mBytes) && ($mUcs4 < 0x0800)) || + ((4 == $mBytes) && ($mUcs4 < 0x10000)) || + (4 < $mBytes) || + // From Unicode 3.2, surrogate characters are illegal + (($mUcs4 & 0xFFFFF800) == 0xD800) || + // Codepoints outside the Unicode range are illegal + ($mUcs4 > 0x10FFFF)) { + return FALSE; + } + + //initialize UTF8 cache + $mState = 0; + $mUcs4 = 0; + $mBytes = 1; + } + } + else + { + /** + *((0xC0 & (*in) != 0x80) && (mState != 0)) + * Incomplete multi-octet sequence. + */ + return FALSE; + } + } + } + return TRUE; + } + + /** + * Tests whether a string complies as UTF-8. This will be much + * faster than utf8_is_valid but will pass five and six octet + * UTF-8 sequences, which are not supported by Unicode and + * so cannot be displayed correctly in a browser. In other words + * it is not as strict as utf8_is_valid but it's faster. If you use + * is to validate user input, you place yourself at the risk that + * attackers will be able to inject 5 and 6 byte sequences (which + * may or may not be a significant risk, depending on what you are + * are doing) + * @see valid + * @see http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php#54805 + * @param string UTF-8 string to check + * @return boolean TRUE if string is valid UTF-8 + */ + public static function compliant($str) + { + if ( strlen($str) == 0 ) { + return TRUE; + } + // If even just the first character can be matched, when the /u + // modifier is used, then it's valid UTF-8. If the UTF-8 is somehow + // invalid, nothing at all will match, even if the string contains + // some valid sequences + return (preg_match('/^.{1}/us',$str,$ar) == 1); + } +} diff --git a/libraries/joomla/utilities/utility.php b/libraries/joomla/utilities/utility.php index 011ee15620b2c..efedf364852b5 100644 --- a/libraries/joomla/utilities/utility.php +++ b/libraries/joomla/utilities/utility.php @@ -1,183 +1,182 @@ - - * @package Joomla.Framework - * @subpackage Utilities - * @since 1.5 - */ -class JUtility -{ - /** - * Mail function (uses phpMailer) - * - * @param string $from From e-mail address - * @param string $fromname From name - * @param mixed $recipient Recipient e-mail address(es) - * @param string $subject E-mail subject - * @param string $body Message body - * @param boolean $mode false = plain text, true = HTML - * @param mixed $cc CC e-mail address(es) - * @param mixed $bcc BCC e-mail address(es) - * @param mixed $attachment Attachment file name(s) - * @param mixed $replyto Reply to email address(es) - * @param mixed $replytoname Reply to name(s) - * @return boolean True on success - */ - function sendMail($from, $fromname, $recipient, $subject, $body, $mode=0, $cc=null, $bcc=null, $attachment=null, $replyto=null, $replytoname=null ) - { - // Get a JMail instance - $mail =& JFactory::getMailer(); - - $mail->setSender(array($from, $fromname)); - $mail->setSubject($subject); - $mail->setBody($body); - - // Are we sending the email as HTML? - if ( $mode ) { - $mail->IsHTML(true); - } - - $mail->addRecipient($recipient); - $mail->addCC($cc); - $mail->addBCC($bcc); - $mail->addAttachment($attachment); - - // Take care of reply email addresses - if( is_array( $replyto ) ) { - $numReplyTo = count($replyto); - for ( $i=0; $i < $numReplyTo; $i++){ - $mail->addReplyTo( array($replyto[$i], $replytoname[$i]) ); - } - } elseif( isset( $replyto ) ) { - $mail->addReplyTo( array( $replyto, $replytoname ) ); - } - - return $mail->Send(); - } - - /** - * Sends mail to administrator for approval of a user submission - * - * @param string $adminName Name of administrator - * @param string $adminEmail Email address of administrator - * @param string $email [NOT USED TODO: Deprecate?] - * @param string $type Type of item to approve - * @param string $title Title of item to approve - * @param string $author Author of item to approve - * @return boolean True on success - */ - function sendAdminMail( $adminName, $adminEmail, $email, $type, $title, $author, $url = null ) - { - $subject = JText::_( 'User Submitted' ) ." '". $type ."'"; - - $message = sprintf ( JText::_( 'MAIL_MSG_ADMIN' ), $adminName, $type, $title, $author, $url, $url, 'administrator', $type); - $message .= JText::_( 'MAIL_MSG') ."\n"; - - // Get a JMail instance - $mail =& JFactory::getMailer(); - $mail->addRecipient($adminEmail); - $mail->setSubject($subject); - $mail->setBody($message); - - return $mail->Send(); - } - - /** - * Provides a secure hash based on a seed - * - * @param string Seed string - * @return string - */ - function getHash( $seed ) - { - $conf =& JFactory::getConfig(); - return md5( $conf->getValue('config.secret') . $seed ); - } - - /** - * Method to determine a hash for anti-spoofing variable names - * - * @return string Hashed var name - * @since 1.5 - * @static - */ - function getToken($forceNew = false) - { - $user = &JFactory::getUser(); - $session = &JFactory::getSession(); - $hash = JUtility::getHash( $user->get( 'id', 0 ).$session->getToken( $forceNew ) ); - return $hash; - } - - /** - * Method to extract key/value pairs out of a string with xml style attributes - * - * @param string $string String containing xml style attributes - * @return array Key/Value pairs for the attributes - * @since 1.5 - */ - function parseAttributes( $string ) - { - //Initialize variables - $attr = array(); - $retarray = array(); - - // Lets grab all the key/value pairs using a regular expression - preg_match_all( '/([\w:-]+)[\s]?=[\s]?"([^"]*)"/i', $string, $attr ); - - if (is_array($attr)) - { - $numPairs = count($attr[1]); - for($i = 0; $i < $numPairs; $i++ ) - { - $retarray[$attr[1][$i]] = $attr[2][$i]; - } - } - return $retarray; - } - - /** - * Method to determine if the host OS is Windows - * - * @return true if Windows OS - * @since 1.5 - * @static - */ - function isWinOS() { - return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; - } - - /** - * Method to dump the structure of a variable for debugging purposes - * - * @param mixed A variable - * @param boolean True to ensure all characters are htmlsafe - * @return string - * @since 1.5 - * @static - */ - function dump( &$var, $htmlSafe = true ) - { - $result = var_export( $var, true ); - return '
      '.( $htmlSafe ? htmlspecialchars( $result ) : $result).'
      '; - } -} \ No newline at end of file +setSender(array($from, $fromname)); + $mail->setSubject($subject); + $mail->setBody($body); + + // Are we sending the email as HTML? + if ( $mode ) { + $mail->IsHTML(true); + } + + $mail->addRecipient($recipient); + $mail->addCC($cc); + $mail->addBCC($bcc); + $mail->addAttachment($attachment); + + // Take care of reply email addresses + if( is_array( $replyto ) ) { + $numReplyTo = count($replyto); + for ( $i=0; $i < $numReplyTo; $i++){ + $mail->addReplyTo( array($replyto[$i], $replytoname[$i]) ); + } + } elseif( isset( $replyto ) ) { + $mail->addReplyTo( array( $replyto, $replytoname ) ); + } + + return $mail->Send(); + } + + /** + * Sends mail to administrator for approval of a user submission + * + * @param string $adminName Name of administrator + * @param string $adminEmail Email address of administrator + * @param string $email [NOT USED TODO: Deprecate?] + * @param string $type Type of item to approve + * @param string $title Title of item to approve + * @param string $author Author of item to approve + * @return boolean True on success + */ + public static function sendAdminMail( $adminName, $adminEmail, $email, $type, $title, $author, $url = null ) + { + $subject = JText::_( 'User Submitted' ) ." '". $type ."'"; + + $message = sprintf ( JText::_( 'MAIL_MSG_ADMIN' ), $adminName, $type, $title, $author, $url, $url, 'administrator', $type); + $message .= JText::_( 'MAIL_MSG') ."\n"; + + // Get a JMail instance + $mail =& JFactory::getMailer(); + $mail->addRecipient($adminEmail); + $mail->setSubject($subject); + $mail->setBody($message); + + return $mail->Send(); + } + + /** + * Provides a secure hash based on a seed + * + * @param string Seed string + * @return string + */ + public static function getHash( $seed ) + { + $conf =& JFactory::getConfig(); + return md5( $conf->getValue('config.secret') . $seed ); + } + + /** + * Method to determine a hash for anti-spoofing variable names + * + * @return string Hashed var name + * @since 1.5 + * @static + */ + public static function getToken($forceNew = false) + { + $user = &JFactory::getUser(); + $session = &JFactory::getSession(); + $hash = JUtility::getHash( $user->get( 'id', 0 ).$session->getToken( $forceNew ) ); + return $hash; + } + + /** + * Method to extract key/value pairs out of a string with xml style attributes + * + * @param string $string String containing xml style attributes + * @return array Key/Value pairs for the attributes + * @since 1.5 + */ + public static function parseAttributes( $string ) + { + //Initialize variables + $attr = array(); + $retarray = array(); + + // Lets grab all the key/value pairs using a regular expression + preg_match_all( '/([\w:-]+)[\s]?=[\s]?"([^"]*)"/i', $string, $attr ); + + if (is_array($attr)) + { + $numPairs = count($attr[1]); + for($i = 0; $i < $numPairs; $i++ ) + { + $retarray[$attr[1][$i]] = $attr[2][$i]; + } + } + return $retarray; + } + + /** + * Method to determine if the host OS is Windows + * + * @return true if Windows OS + * @since 1.5 + * @static + */ + public static function isWinOS() { + return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; + } + + /** + * Method to dump the structure of a variable for debugging purposes + * + * @param mixed A variable + * @param boolean True to ensure all characters are htmlsafe + * @return string + * @since 1.5 + * @static + */ + public static function dump( &$var, $htmlSafe = true ) + { + $result = var_export( $var, true ); + return '
      '.( $htmlSafe ? htmlspecialchars( $result ) : $result).'
      '; + } +} diff --git a/libraries/joomla/version.php b/libraries/joomla/version.php index 303cf58429790..0bde0ea4aef19 100644 --- a/libraries/joomla/version.php +++ b/libraries/joomla/version.php @@ -20,34 +20,34 @@ class JVersion { /** @var string Product */ - var $PRODUCT = 'Joomla!'; + public $PRODUCT = 'Joomla!'; /** @var int Main Release Level */ - var $RELEASE = '1.5'; + public $RELEASE = '1.6'; /** @var string Development Status */ - var $DEV_STATUS = 'Production/Stable'; + public $DEV_STATUS = 'Development/Alpha'; /** @var int Sub Release Level */ - var $DEV_LEVEL = '2'; + public $DEV_LEVEL = '0'; /** @var int build Number */ - var $BUILD = ''; + public $BUILD = ''; /** @var string Codename */ - var $CODENAME = 'Woi'; + public $CODENAME = 'Sparrow'; /** @var string Date */ - var $RELDATE = '22-March-2008'; + public $RELDATE = ''; /** @var string Time */ - var $RELTIME = '22:00'; + public $RELTIME = ''; /** @var string Timezone */ - var $RELTZ = 'GMT'; + public $RELTZ = ''; /** @var string Copyright Text */ - var $COPYRIGHT = 'Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.'; + public $COPYRIGHT = 'Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.'; /** @var string URL */ - var $URL = 'Joomla! is Free Software released under the GNU General Public License.'; + public $URL = 'Joomla! is Free Software released under the GNU General Public License.'; /** * * * @return string Long format version */ - function getLongVersion() + public function getLongVersion() { return $this->PRODUCT .' '. $this->RELEASE .'.'. $this->DEV_LEVEL .' ' . $this->DEV_STATUS @@ -60,7 +60,7 @@ function getLongVersion() * * @return string Short version format */ - function getShortVersion() { + public function getShortVersion() { return $this->RELEASE .'.'. $this->DEV_LEVEL; } @@ -69,7 +69,7 @@ function getShortVersion() { * * @return string Version suffix for help files */ - function getHelpVersion() + public function getHelpVersion() { if ($this->RELEASE > '1.0') { return '.' . str_replace( '.', '', $this->RELEASE ); @@ -84,7 +84,7 @@ function getHelpVersion() * @return boolean * @see http://www.php.net/version_compare */ - function isCompatible ( $minimum ) { + public function isCompatible ( $minimum ) { return (version_compare( JVERSION, $minimum, 'eq' ) == 1); } -} \ No newline at end of file +} diff --git a/libraries/loader.php b/libraries/loader.php index d7ec79f78adab..a7d9ad944b041 100644 --- a/libraries/loader.php +++ b/libraries/loader.php @@ -1,187 +1,154 @@ -?@[\\]^_`{|}~"); + "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"); if (Auth_OpenID_getMathLib() === null) { - define('Auth_OpenID_NO_MATH_SUPPORT', true); + define('Auth_OpenID_NO_MATH_SUPPORT', true); } /** @@ -110,305 +110,303 @@ */ class Auth_OpenID { - /** - * These namespaces are automatically fixed in query arguments by - * Auth_OpenID::fixArgs. - */ - function getOpenIDNamespaces() - { - return array('openid', - 'sreg'); - } - - /** - * Rename query arguments back to 'openid.' from 'openid_' - * - * @access private - * @param array $args An associative array of URL query arguments - */ - function fixArgs($args) - { - foreach (array_keys($args) as $key) { - $fixed = $key; - if (preg_match('/^openid/', $key)) { - foreach (Auth_OpenID::getOpenIDNamespaces() as $ns) { - if (preg_match('/'.$ns.'_/', $key)) { - $fixed = preg_replace('/'.$ns.'_/', $ns.'.', $fixed); - } - } - - if ($fixed != $key) { - $val = $args[$key]; - unset($args[$key]); - $args[$fixed] = $val; - } - } - } - - return $args; - } - - /** - * Create dir_name as a directory if it does not exist. If it - * exists, make sure that it is, in fact, a directory. Returns - * true if the operation succeeded; false if not. - * - * @access private - */ - function ensureDir($dir_name) - { - if (is_dir($dir_name) || @mkdir($dir_name)) { - return true; - } else { - if (Auth_OpenID::ensureDir(dirname($dir_name))) { - return is_dir($dir_name) || @mkdir($dir_name); - } else { - return false; - } - } - } - - /** - * Convenience function for getting array values. - * - * @access private - */ - function arrayGet($arr, $key, $fallback = null) - { - if (is_array($arr)) { - if (array_key_exists($key, $arr)) { - return $arr[$key]; - } else { - return $fallback; - } - } else { - trigger_error("Auth_OpenID::arrayGet expected " . - "array as first parameter", E_USER_WARNING); - return false; - } - } - - /** - * Implements the PHP 5 'http_build_query' functionality. - * - * @access private - * @param array $data Either an array key/value pairs or an array - * of arrays, each of which holding two values: a key and a value, - * sequentially. - * @return string $result The result of url-encoding the key/value - * pairs from $data into a URL query string - * (e.g. "username=bob&id=56"). - */ - function httpBuildQuery($data) - { - $pairs = array(); - foreach ($data as $key => $value) { - if (is_array($value)) { - $pairs[] = urlencode($value[0])."=".urlencode($value[1]); - } else { - $pairs[] = urlencode($key)."=".urlencode($value); - } - } - return implode("&", $pairs); - } - - /** - * "Appends" query arguments onto a URL. The URL may or may not - * already have arguments (following a question mark). - * - * @param string $url A URL, which may or may not already have - * arguments. - * @param array $args Either an array key/value pairs or an array of - * arrays, each of which holding two values: a key and a value, - * sequentially. If $args is an ordinary key/value array, the - * parameters will be added to the URL in sorted alphabetical order; - * if $args is an array of arrays, their order will be preserved. - * @return string $url The original URL with the new parameters added. - * - */ - function appendArgs($url, $args) - { - if (count($args) == 0) { - return $url; - } - - // Non-empty array; if it is an array of arrays, use - // multisort; otherwise use sort. - if (array_key_exists(0, $args) && - is_array($args[0])) { - // Do nothing here. - } else { - $keys = array_keys($args); - sort($keys); - $new_args = array(); - foreach ($keys as $key) { - $new_args[] = array($key, $args[$key]); - } - $args = $new_args; - } - - $sep = '?'; - if (strpos($url, '?') !== false) { - $sep = '&'; - } - - return $url . $sep . Auth_OpenID::httpBuildQuery($args); - } - - /** - * Turn a string into an ASCII string. - * - * Replace non-ascii characters with a %-encoded, UTF-8 - * encoding. This function will fail if the input is a string and - * there are non-7-bit-safe characters. It is assumed that the - * caller will have already translated the input into a Unicode - * character sequence, according to the encoding of the HTTP POST - * or GET. - * - * Do not escape anything that is already 7-bit safe, so we do the - * minimal transform on the identity URL - * - * @access private - */ - function quoteMinimal($s) - { - $res = array(); - for ($i = 0; $i < strlen($s); $i++) { - $c = $s[$i]; - if ($c >= "\x80") { - for ($j = 0; $j < count(utf8_encode($c)); $j++) { - array_push($res, sprintf("%02X", ord($c[$j]))); - } - } else { - array_push($res, $c); - } - } - - return implode('', $res); - } - - /** - * Implements python's urlunparse, which is not available in PHP. - * Given the specified components of a URL, this function rebuilds - * and returns the URL. - * - * @access private - * @param string $scheme The scheme (e.g. 'http'). Defaults to 'http'. - * @param string $host The host. Required. - * @param string $port The port. - * @param string $path The path. - * @param string $query The query. - * @param string $fragment The fragment. - * @return string $url The URL resulting from assembling the - * specified components. - */ - function urlunparse($scheme, $host, $port = null, $path = '/', - $query = '', $fragment = '') - { - - if (!$scheme) { - $scheme = 'http'; - } - - if (!$host) { - return false; - } - - if (!$path) { - $path = '/'; - } - - $result = $scheme . "://" . $host; - - if ($port) { - $result .= ":" . $port; - } - - $result .= $path; - - if ($query) { - $result .= "?" . $query; - } - - if ($fragment) { - $result .= "#" . $fragment; - } - - return $result; - } - - /** - * Given a URL, this "normalizes" it by adding a trailing slash - * and / or a leading http:// scheme where necessary. Returns - * null if the original URL is malformed and cannot be normalized. - * - * @access private - * @param string $url The URL to be normalized. - * @return mixed $new_url The URL after normalization, or null if - * $url was malformed. - */ - function normalizeUrl($url) - { - if ($url === null) { - return null; - } - - assert(is_string($url)); - - $old_url = $url; - $url = trim($url); - - if (strpos($url, "://") === false) { - $url = "http://" . $url; - } - - $parsed = @parse_url($url); - - if ($parsed === false) { - return null; - } - - $defaults = array( - 'scheme' => '', - 'host' => '', - 'path' => '', - 'query' => '', - 'fragment' => '', - 'port' => '' - ); - - $parsed = array_merge($defaults, $parsed); - - if (($parsed['scheme'] == '') || - ($parsed['host'] == '')) { - if ($parsed['path'] == '' && - $parsed['query'] == '' && - $parsed['fragment'] == '') { - return null; - } - - $url = 'http://' + $url; - $parsed = parse_url($url); - - $parsed = array_merge($defaults, $parsed); - } - - $tail = array_map(array('Auth_OpenID', 'quoteMinimal'), - array($parsed['path'], - $parsed['query'], - $parsed['fragment'])); - if ($tail[0] == '') { - $tail[0] = '/'; - } - - $url = Auth_OpenID::urlunparse($parsed['scheme'], $parsed['host'], - $parsed['port'], $tail[0], $tail[1], - $tail[2]); - - assert(is_string($url)); - - return $url; - } -} - -?> \ No newline at end of file + /** + * These namespaces are automatically fixed in query arguments by + * Auth_OpenID::fixArgs. + */ + function getOpenIDNamespaces() + { + return array('openid', + 'sreg'); + } + + /** + * Rename query arguments back to 'openid.' from 'openid_' + * + * @access private + * @param array $args An associative array of URL query arguments + */ + function fixArgs($args) + { + foreach (array_keys($args) as $key) { + $fixed = $key; + if (preg_match('/^openid/', $key)) { + foreach (Auth_OpenID::getOpenIDNamespaces() as $ns) { + if (preg_match('/'.$ns.'_/', $key)) { + $fixed = preg_replace('/'.$ns.'_/', $ns.'.', $fixed); + } + } + + if ($fixed != $key) { + $val = $args[$key]; + unset($args[$key]); + $args[$fixed] = $val; + } + } + } + + return $args; + } + + /** + * Create dir_name as a directory if it does not exist. If it + * exists, make sure that it is, in fact, a directory. Returns + * true if the operation succeeded; false if not. + * + * @access private + */ + function ensureDir($dir_name) + { + if (is_dir($dir_name) || @mkdir($dir_name)) { + return true; + } else { + if (Auth_OpenID::ensureDir(dirname($dir_name))) { + return is_dir($dir_name) || @mkdir($dir_name); + } else { + return false; + } + } + } + + /** + * Convenience function for getting array values. + * + * @access private + */ + function arrayGet($arr, $key, $fallback = null) + { + if (is_array($arr)) { + if (array_key_exists($key, $arr)) { + return $arr[$key]; + } else { + return $fallback; + } + } else { + trigger_error("Auth_OpenID::arrayGet expected " . + "array as first parameter", E_USER_WARNING); + return false; + } + } + + /** + * Implements the PHP 5 'http_build_query' functionality. + * + * @access private + * @param array $data Either an array key/value pairs or an array + * of arrays, each of which holding two values: a key and a value, + * sequentially. + * @return string $result The result of url-encoding the key/value + * pairs from $data into a URL query string + * (e.g. "username=bob&id=56"). + */ + function httpBuildQuery($data) + { + $pairs = array(); + foreach ($data as $key => $value) { + if (is_array($value)) { + $pairs[] = urlencode($value[0])."=".urlencode($value[1]); + } else { + $pairs[] = urlencode($key)."=".urlencode($value); + } + } + return implode("&", $pairs); + } + + /** + * "Appends" query arguments onto a URL. The URL may or may not + * already have arguments (following a question mark). + * + * @param string $url A URL, which may or may not already have + * arguments. + * @param array $args Either an array key/value pairs or an array of + * arrays, each of which holding two values: a key and a value, + * sequentially. If $args is an ordinary key/value array, the + * parameters will be added to the URL in sorted alphabetical order; + * if $args is an array of arrays, their order will be preserved. + * @return string $url The original URL with the new parameters added. + * + */ + function appendArgs($url, $args) + { + if (count($args) == 0) { + return $url; + } + + // Non-empty array; if it is an array of arrays, use + // multisort; otherwise use sort. + if (array_key_exists(0, $args) && + is_array($args[0])) { + // Do nothing here. + } else { + $keys = array_keys($args); + sort($keys); + $new_args = array(); + foreach ($keys as $key) { + $new_args[] = array($key, $args[$key]); + } + $args = $new_args; + } + + $sep = '?'; + if (strpos($url, '?') !== false) { + $sep = '&'; + } + + return $url . $sep . Auth_OpenID::httpBuildQuery($args); + } + + /** + * Turn a string into an ASCII string. + * + * Replace non-ascii characters with a %-encoded, UTF-8 + * encoding. This function will fail if the input is a string and + * there are non-7-bit-safe characters. It is assumed that the + * caller will have already translated the input into a Unicode + * character sequence, according to the encoding of the HTTP POST + * or GET. + * + * Do not escape anything that is already 7-bit safe, so we do the + * minimal transform on the identity URL + * + * @access private + */ + function quoteMinimal($s) + { + $res = array(); + for ($i = 0; $i < strlen($s); $i++) { + $c = $s[$i]; + if ($c >= "\x80") { + for ($j = 0; $j < count(utf8_encode($c)); $j++) { + array_push($res, sprintf("%02X", ord($c[$j]))); + } + } else { + array_push($res, $c); + } + } + + return implode('', $res); + } + + /** + * Implements python's urlunparse, which is not available in PHP. + * Given the specified components of a URL, this function rebuilds + * and returns the URL. + * + * @access private + * @param string $scheme The scheme (e.g. 'http'). Defaults to 'http'. + * @param string $host The host. Required. + * @param string $port The port. + * @param string $path The path. + * @param string $query The query. + * @param string $fragment The fragment. + * @return string $url The URL resulting from assembling the + * specified components. + */ + function urlunparse($scheme, $host, $port = null, $path = '/', + $query = '', $fragment = '') + { + + if (!$scheme) { + $scheme = 'http'; + } + + if (!$host) { + return false; + } + + if (!$path) { + $path = '/'; + } + + $result = $scheme . "://" . $host; + + if ($port) { + $result .= ":" . $port; + } + + $result .= $path; + + if ($query) { + $result .= "?" . $query; + } + + if ($fragment) { + $result .= "#" . $fragment; + } + + return $result; + } + + /** + * Given a URL, this "normalizes" it by adding a trailing slash + * and / or a leading http:// scheme where necessary. Returns + * null if the original URL is malformed and cannot be normalized. + * + * @access private + * @param string $url The URL to be normalized. + * @return mixed $new_url The URL after normalization, or null if + * $url was malformed. + */ + function normalizeUrl($url) + { + if ($url === null) { + return null; + } + + assert(is_string($url)); + + $old_url = $url; + $url = trim($url); + + if (strpos($url, "://") === false) { + $url = "http://" . $url; + } + + $parsed = @parse_url($url); + + if ($parsed === false) { + return null; + } + + $defaults = array( + 'scheme' => '', + 'host' => '', + 'path' => '', + 'query' => '', + 'fragment' => '', + 'port' => '' + ); + + $parsed = array_merge($defaults, $parsed); + + if (($parsed['scheme'] == '') || + ($parsed['host'] == '')) { + if ($parsed['path'] == '' && + $parsed['query'] == '' && + $parsed['fragment'] == '') { + return null; + } + + $url = 'http://' + $url; + $parsed = parse_url($url); + + $parsed = array_merge($defaults, $parsed); + } + + $tail = array_map(array('Auth_OpenID', 'quoteMinimal'), + array($parsed['path'], + $parsed['query'], + $parsed['fragment'])); + if ($tail[0] == '') { + $tail[0] = '/'; + } + + $url = Auth_OpenID::urlunparse($parsed['scheme'], $parsed['host'], + $parsed['port'], $tail[0], $tail[1], + $tail[2]); + + assert(is_string($url)); + + return $url; + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/Association.php b/libraries/openid/Auth/OpenID/Association.php index 63176d0f94603..c9d43569a4799 100644 --- a/libraries/openid/Auth/OpenID/Association.php +++ b/libraries/openid/Auth/OpenID/Association.php @@ -40,271 +40,269 @@ */ class Auth_OpenID_Association { - /** - * This is a HMAC-SHA1 specific value. - * - * @access private - */ - var $SIG_LENGTH = 20; + /** + * This is a HMAC-SHA1 specific value. + * + * @access private + */ + var $SIG_LENGTH = 20; - /** - * The ordering and name of keys as stored by serialize. - * - * @access private - */ - var $assoc_keys = array( - 'version', - 'handle', - 'secret', - 'issued', - 'lifetime', - 'assoc_type' - ); + /** + * The ordering and name of keys as stored by serialize. + * + * @access private + */ + var $assoc_keys = array( + 'version', + 'handle', + 'secret', + 'issued', + 'lifetime', + 'assoc_type' + ); - /** - * This is an alternate constructor (factory method) used by the - * OpenID consumer library to create associations. OpenID store - * implementations shouldn't use this constructor. - * - * @access private - * - * @param integer $expires_in This is the amount of time this - * association is good for, measured in seconds since the - * association was issued. - * - * @param string $handle This is the handle the server gave this - * association. - * - * @param string secret This is the shared secret the server - * generated for this association. - * - * @param assoc_type This is the type of association this - * instance represents. The only valid value of this field at - * this time is 'HMAC-SHA1', but new types may be defined in the - * future. - * - * @return association An {@link Auth_OpenID_Association} - * instance. - */ - function fromExpiresIn($expires_in, $handle, $secret, $assoc_type) - { - $issued = time(); - $lifetime = $expires_in; - return new Auth_OpenID_Association($handle, $secret, - $issued, $lifetime, $assoc_type); - } + /** + * This is an alternate constructor (factory method) used by the + * OpenID consumer library to create associations. OpenID store + * implementations shouldn't use this constructor. + * + * @access private + * + * @param integer $expires_in This is the amount of time this + * association is good for, measured in seconds since the + * association was issued. + * + * @param string $handle This is the handle the server gave this + * association. + * + * @param string secret This is the shared secret the server + * generated for this association. + * + * @param assoc_type This is the type of association this + * instance represents. The only valid value of this field at + * this time is 'HMAC-SHA1', but new types may be defined in the + * future. + * + * @return association An {@link Auth_OpenID_Association} + * instance. + */ + function fromExpiresIn($expires_in, $handle, $secret, $assoc_type) + { + $issued = time(); + $lifetime = $expires_in; + return new Auth_OpenID_Association($handle, $secret, + $issued, $lifetime, $assoc_type); + } - /** - * This is the standard constructor for creating an association. - * The library should create all of the necessary associations, so - * this constructor is not part of the external API. - * - * @access private - * - * @param string $handle This is the handle the server gave this - * association. - * - * @param string $secret This is the shared secret the server - * generated for this association. - * - * @param integer $issued This is the time this association was - * issued, in seconds since 00:00 GMT, January 1, 1970. (ie, a - * unix timestamp) - * - * @param integer $lifetime This is the amount of time this - * association is good for, measured in seconds since the - * association was issued. - * - * @param string $assoc_type This is the type of association this - * instance represents. The only valid value of this field at - * this time is 'HMAC-SHA1', but new types may be defined in the - * future. - */ - function Auth_OpenID_Association( - $handle, $secret, $issued, $lifetime, $assoc_type) - { - if ($assoc_type != 'HMAC-SHA1') { - $fmt = 'HMAC-SHA1 is the only supported association type (got %s)'; - trigger_error(sprintf($fmt, $assoc_type), E_USER_ERROR); - } + /** + * This is the standard constructor for creating an association. + * The library should create all of the necessary associations, so + * this constructor is not part of the external API. + * + * @access private + * + * @param string $handle This is the handle the server gave this + * association. + * + * @param string $secret This is the shared secret the server + * generated for this association. + * + * @param integer $issued This is the time this association was + * issued, in seconds since 00:00 GMT, January 1, 1970. (ie, a + * unix timestamp) + * + * @param integer $lifetime This is the amount of time this + * association is good for, measured in seconds since the + * association was issued. + * + * @param string $assoc_type This is the type of association this + * instance represents. The only valid value of this field at + * this time is 'HMAC-SHA1', but new types may be defined in the + * future. + */ + function Auth_OpenID_Association( + $handle, $secret, $issued, $lifetime, $assoc_type) + { + if ($assoc_type != 'HMAC-SHA1') { + $fmt = 'HMAC-SHA1 is the only supported association type (got %s)'; + trigger_error(sprintf($fmt, $assoc_type), E_USER_ERROR); + } - $this->handle = $handle; - $this->secret = $secret; - $this->issued = $issued; - $this->lifetime = $lifetime; - $this->assoc_type = $assoc_type; - } + $this->handle = $handle; + $this->secret = $secret; + $this->issued = $issued; + $this->lifetime = $lifetime; + $this->assoc_type = $assoc_type; + } - /** - * This returns the number of seconds this association is still - * valid for, or 0 if the association is no longer valid. - * - * @return integer $seconds The number of seconds this association - * is still valid for, or 0 if the association is no longer valid. - */ - function getExpiresIn($now = null) - { - if ($now == null) { - $now = time(); - } + /** + * This returns the number of seconds this association is still + * valid for, or 0 if the association is no longer valid. + * + * @return integer $seconds The number of seconds this association + * is still valid for, or 0 if the association is no longer valid. + */ + function getExpiresIn($now = null) + { + if ($now == null) { + $now = time(); + } - return max(0, $this->issued + $this->lifetime - $now); - } + return max(0, $this->issued + $this->lifetime - $now); + } - /** - * This checks to see if two {@link Auth_OpenID_Association} - * instances represent the same association. - * - * @return bool $result true if the two instances represent the - * same association, false otherwise. - */ - function equal($other) - { - return ((gettype($this) == gettype($other)) - && ($this->handle == $other->handle) - && ($this->secret == $other->secret) - && ($this->issued == $other->issued) - && ($this->lifetime == $other->lifetime) - && ($this->assoc_type == $other->assoc_type)); - } + /** + * This checks to see if two {@link Auth_OpenID_Association} + * instances represent the same association. + * + * @return bool $result true if the two instances represent the + * same association, false otherwise. + */ + function equal($other) + { + return ((gettype($this) == gettype($other)) + && ($this->handle == $other->handle) + && ($this->secret == $other->secret) + && ($this->issued == $other->issued) + && ($this->lifetime == $other->lifetime) + && ($this->assoc_type == $other->assoc_type)); + } - /** - * Convert an association to KV form. - * - * @return string $result String in KV form suitable for - * deserialization by deserialize. - */ - function serialize() - { - $data = array( - 'version' => '2', - 'handle' => $this->handle, - 'secret' => base64_encode($this->secret), - 'issued' => strval(intval($this->issued)), - 'lifetime' => strval(intval($this->lifetime)), - 'assoc_type' => $this->assoc_type - ); + /** + * Convert an association to KV form. + * + * @return string $result String in KV form suitable for + * deserialization by deserialize. + */ + function serialize() + { + $data = array( + 'version' => '2', + 'handle' => $this->handle, + 'secret' => base64_encode($this->secret), + 'issued' => strval(intval($this->issued)), + 'lifetime' => strval(intval($this->lifetime)), + 'assoc_type' => $this->assoc_type + ); - assert(array_keys($data) == $this->assoc_keys); + assert(array_keys($data) == $this->assoc_keys); - return Auth_OpenID_KVForm::fromArray($data, $strict = true); - } + return Auth_OpenID_KVForm::fromArray($data, $strict = true); + } - /** - * Parse an association as stored by serialize(). This is the - * inverse of serialize. - * - * @param string $assoc_s Association as serialized by serialize() - * @return Auth_OpenID_Association $result instance of this class - */ - function deserialize($class_name, $assoc_s) - { - $pairs = Auth_OpenID_KVForm::toArray($assoc_s, $strict = true); - $keys = array(); - $values = array(); - foreach ($pairs as $key => $value) { - if (is_array($value)) { - list($key, $value) = $value; - } - $keys[] = $key; - $values[] = $value; - } + /** + * Parse an association as stored by serialize(). This is the + * inverse of serialize. + * + * @param string $assoc_s Association as serialized by serialize() + * @return Auth_OpenID_Association $result instance of this class + */ + function deserialize($class_name, $assoc_s) + { + $pairs = Auth_OpenID_KVForm::toArray($assoc_s, $strict = true); + $keys = array(); + $values = array(); + foreach ($pairs as $key => $value) { + if (is_array($value)) { + list($key, $value) = $value; + } + $keys[] = $key; + $values[] = $value; + } - $class_vars = get_class_vars($class_name); - $class_assoc_keys = $class_vars['assoc_keys']; + $class_vars = get_class_vars($class_name); + $class_assoc_keys = $class_vars['assoc_keys']; - sort($keys); - sort($class_assoc_keys); + sort($keys); + sort($class_assoc_keys); - if ($keys != $class_assoc_keys) { - trigger_error('Unexpected key values: ' . strval($keys), - E_USER_WARNING); - return null; - } + if ($keys != $class_assoc_keys) { + trigger_error('Unexpected key values: ' . strval($keys), + E_USER_WARNING); + return null; + } - $version = $pairs['version']; - $handle = $pairs['handle']; - $secret = $pairs['secret']; - $issued = $pairs['issued']; - $lifetime = $pairs['lifetime']; - $assoc_type = $pairs['assoc_type']; + $version = $pairs['version']; + $handle = $pairs['handle']; + $secret = $pairs['secret']; + $issued = $pairs['issued']; + $lifetime = $pairs['lifetime']; + $assoc_type = $pairs['assoc_type']; - if ($version != '2') { - trigger_error('Unknown version: ' . $version, E_USER_WARNING); - return null; - } + if ($version != '2') { + trigger_error('Unknown version: ' . $version, E_USER_WARNING); + return null; + } - $issued = intval($issued); - $lifetime = intval($lifetime); - $secret = base64_decode($secret); + $issued = intval($issued); + $lifetime = intval($lifetime); + $secret = base64_decode($secret); - return new $class_name( - $handle, $secret, $issued, $lifetime, $assoc_type); - } + return new $class_name( + $handle, $secret, $issued, $lifetime, $assoc_type); + } - /** - * Generate a signature for a sequence of (key, value) pairs - * - * @access private - * @param array $pairs The pairs to sign, in order. This is an - * array of two-tuples. - * @return string $signature The binary signature of this sequence - * of pairs - */ - function sign($pairs) - { - $kv = Auth_OpenID_KVForm::fromArray($pairs); - return Auth_OpenID_HMACSHA1($this->secret, $kv); - } + /** + * Generate a signature for a sequence of (key, value) pairs + * + * @access private + * @param array $pairs The pairs to sign, in order. This is an + * array of two-tuples. + * @return string $signature The binary signature of this sequence + * of pairs + */ + function sign($pairs) + { + $kv = Auth_OpenID_KVForm::fromArray($pairs); + return Auth_OpenID_HMACSHA1($this->secret, $kv); + } - /** - * Generate a signature for some fields in a dictionary - * - * @access private - * @param array $fields The fields to sign, in order; this is an - * array of strings. - * @param array $data Dictionary of values to sign (an array of - * string => string pairs). - * @return string $signature The signature, base64 encoded - */ - function signDict($fields, $data, $prefix = 'openid.') - { - $pairs = array(); - foreach ($fields as $field) { - $pairs[] = array($field, $data[$prefix . $field]); - } + /** + * Generate a signature for some fields in a dictionary + * + * @access private + * @param array $fields The fields to sign, in order; this is an + * array of strings. + * @param array $data Dictionary of values to sign (an array of + * string => string pairs). + * @return string $signature The signature, base64 encoded + */ + function signDict($fields, $data, $prefix = 'openid.') + { + $pairs = array(); + foreach ($fields as $field) { + $pairs[] = array($field, $data[$prefix . $field]); + } - return base64_encode($this->sign($pairs)); - } + return base64_encode($this->sign($pairs)); + } - /** - * Add a signature to an array of fields - * - * @access private - */ - function addSignature($fields, &$data, $prefix = 'openid.') - { - $sig = $this->signDict($fields, $data, $prefix); - $signed = implode(",", $fields); - $data[$prefix . 'sig'] = $sig; - $data[$prefix . 'signed'] = $signed; - } + /** + * Add a signature to an array of fields + * + * @access private + */ + function addSignature($fields, &$data, $prefix = 'openid.') + { + $sig = $this->signDict($fields, $data, $prefix); + $signed = implode(",", $fields); + $data[$prefix . 'sig'] = $sig; + $data[$prefix . 'signed'] = $signed; + } - /** - * Confirm that the signature of these fields matches the - * signature contained in the data - * - * @access private - */ - function checkSignature($data, $prefix = 'openid.') - { - $signed = $data[$prefix . 'signed']; - $fields = explode(",", $signed); - $expected_sig = $this->signDict($fields, $data, $prefix); - $request_sig = $data[$prefix . 'sig']; + /** + * Confirm that the signature of these fields matches the + * signature contained in the data + * + * @access private + */ + function checkSignature($data, $prefix = 'openid.') + { + $signed = $data[$prefix . 'signed']; + $fields = explode(",", $signed); + $expected_sig = $this->signDict($fields, $data, $prefix); + $request_sig = $data[$prefix . 'sig']; - return ($request_sig == $expected_sig); - } -} - -?> \ No newline at end of file + return ($request_sig == $expected_sig); + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/BigMath.php b/libraries/openid/Auth/OpenID/BigMath.php index 3b37361950b15..ed9effaf8c605 100644 --- a/libraries/openid/Auth/OpenID/BigMath.php +++ b/libraries/openid/Auth/OpenID/BigMath.php @@ -28,151 +28,151 @@ * @package OpenID */ class Auth_OpenID_MathLibrary { - /** - * Given a long integer, returns the number converted to a binary - * string. This function accepts long integer values of arbitrary - * magnitude and uses the local large-number math library when - * available. - * - * @param integer $long The long number (can be a normal PHP - * integer or a number created by one of the available long number - * libraries) - * @return string $binary The binary version of $long - */ - function longToBinary($long) - { - $cmp = $this->cmp($long, 0); - if ($cmp < 0) { - $msg = __FUNCTION__ . " takes only positive integers."; - trigger_error($msg, E_USER_ERROR); - return null; - } - - if ($cmp == 0) { - return "\x00"; - } - - $bytes = array(); - - while ($this->cmp($long, 0) > 0) { - array_unshift($bytes, $this->mod($long, 256)); - $long = $this->div($long, pow(2, 8)); - } - - if ($bytes && ($bytes[0] > 127)) { - array_unshift($bytes, 0); - } - - $string = ''; - foreach ($bytes as $byte) { - $string .= pack('C', $byte); - } - - return $string; - } - - /** - * Given a binary string, returns the binary string converted to a - * long number. - * - * @param string $binary The binary version of a long number, - * probably as a result of calling longToBinary - * @return integer $long The long number equivalent of the binary - * string $str - */ - function binaryToLong($str) - { - if ($str === null) { - return null; - } - - // Use array_merge to return a zero-indexed array instead of a - // one-indexed array. - $bytes = array_merge(unpack('C*', $str)); - - $n = $this->init(0); - - if ($bytes && ($bytes[0] > 127)) { - trigger_error("bytesToNum works only for positive integers.", - E_USER_WARNING); - return null; - } - - foreach ($bytes as $byte) { - $n = $this->mul($n, pow(2, 8)); - $n = $this->add($n, $byte); - } - - return $n; - } - - function base64ToLong($str) - { - $b64 = base64_decode($str); - - if ($b64 === false) { - return false; - } - - return $this->binaryToLong($b64); - } - - function longToBase64($str) - { - return base64_encode($this->longToBinary($str)); - } - - /** - * Returns a random number in the specified range. This function - * accepts $start, $stop, and $step values of arbitrary magnitude - * and will utilize the local large-number math library when - * available. - * - * @param integer $start The start of the range, or the minimum - * random number to return - * @param integer $stop The end of the range, or the maximum - * random number to return - * @param integer $step The step size, such that $result - ($step - * * N) = $start for some N - * @return integer $result The resulting randomly-generated number - */ - function rand($stop) - { - static $duplicate_cache = array(); - - // Used as the key for the duplicate cache - $rbytes = $this->longToBinary($stop); - - if (array_key_exists($rbytes, $duplicate_cache)) { - list($duplicate, $nbytes) = $duplicate_cache[$rbytes]; - } else { - if ($rbytes[0] == "\x00") { - $nbytes = strlen($rbytes) - 1; - } else { - $nbytes = strlen($rbytes); - } - - $mxrand = $this->pow(256, $nbytes); - - // If we get a number less than this, then it is in the - // duplicated range. - $duplicate = $this->mod($mxrand, $stop); - - if (count($duplicate_cache) > 10) { - $duplicate_cache = array(); - } - - $duplicate_cache[$rbytes] = array($duplicate, $nbytes); - } - - do { - $bytes = "\x00" . Auth_OpenID_CryptUtil::getBytes($nbytes); - $n = $this->binaryToLong($bytes); - // Keep looping if this value is in the low duplicated range - } while ($this->cmp($n, $duplicate) < 0); - - return $this->mod($n, $stop); - } + /** + * Given a long integer, returns the number converted to a binary + * string. This function accepts long integer values of arbitrary + * magnitude and uses the local large-number math library when + * available. + * + * @param integer $long The long number (can be a normal PHP + * integer or a number created by one of the available long number + * libraries) + * @return string $binary The binary version of $long + */ + function longToBinary($long) + { + $cmp = $this->cmp($long, 0); + if ($cmp < 0) { + $msg = __FUNCTION__ . " takes only positive integers."; + trigger_error($msg, E_USER_ERROR); + return null; + } + + if ($cmp == 0) { + return "\x00"; + } + + $bytes = array(); + + while ($this->cmp($long, 0) > 0) { + array_unshift($bytes, $this->mod($long, 256)); + $long = $this->div($long, pow(2, 8)); + } + + if ($bytes && ($bytes[0] > 127)) { + array_unshift($bytes, 0); + } + + $string = ''; + foreach ($bytes as $byte) { + $string .= pack('C', $byte); + } + + return $string; + } + + /** + * Given a binary string, returns the binary string converted to a + * long number. + * + * @param string $binary The binary version of a long number, + * probably as a result of calling longToBinary + * @return integer $long The long number equivalent of the binary + * string $str + */ + function binaryToLong($str) + { + if ($str === null) { + return null; + } + + // Use array_merge to return a zero-indexed array instead of a + // one-indexed array. + $bytes = array_merge(unpack('C*', $str)); + + $n = $this->init(0); + + if ($bytes && ($bytes[0] > 127)) { + trigger_error("bytesToNum works only for positive integers.", + E_USER_WARNING); + return null; + } + + foreach ($bytes as $byte) { + $n = $this->mul($n, pow(2, 8)); + $n = $this->add($n, $byte); + } + + return $n; + } + + function base64ToLong($str) + { + $b64 = base64_decode($str); + + if ($b64 === false) { + return false; + } + + return $this->binaryToLong($b64); + } + + function longToBase64($str) + { + return base64_encode($this->longToBinary($str)); + } + + /** + * Returns a random number in the specified range. This function + * accepts $start, $stop, and $step values of arbitrary magnitude + * and will utilize the local large-number math library when + * available. + * + * @param integer $start The start of the range, or the minimum + * random number to return + * @param integer $stop The end of the range, or the maximum + * random number to return + * @param integer $step The step size, such that $result - ($step + * * N) = $start for some N + * @return integer $result The resulting randomly-generated number + */ + function rand($stop) + { + static $duplicate_cache = array(); + + // Used as the key for the duplicate cache + $rbytes = $this->longToBinary($stop); + + if (array_key_exists($rbytes, $duplicate_cache)) { + list($duplicate, $nbytes) = $duplicate_cache[$rbytes]; + } else { + if ($rbytes[0] == "\x00") { + $nbytes = strlen($rbytes) - 1; + } else { + $nbytes = strlen($rbytes); + } + + $mxrand = $this->pow(256, $nbytes); + + // If we get a number less than this, then it is in the + // duplicated range. + $duplicate = $this->mod($mxrand, $stop); + + if (count($duplicate_cache) > 10) { + $duplicate_cache = array(); + } + + $duplicate_cache[$rbytes] = array($duplicate, $nbytes); + } + + do { + $bytes = "\x00" . Auth_OpenID_CryptUtil::getBytes($nbytes); + $n = $this->binaryToLong($bytes); + // Keep looping if this value is in the low duplicated range + } while ($this->cmp($n, $duplicate) < 0); + + return $this->mod($n, $stop); + } } /** @@ -185,80 +185,80 @@ function rand($stop) * @package OpenID */ class Auth_OpenID_BcMathWrapper extends Auth_OpenID_MathLibrary{ - var $type = 'bcmath'; - - function add($x, $y) - { - return bcadd($x, $y); - } - - function sub($x, $y) - { - return bcsub($x, $y); - } - - function pow($base, $exponent) - { - return bcpow($base, $exponent); - } - - function cmp($x, $y) - { - return bccomp($x, $y); - } - - function init($number, $base = 10) - { - return $number; - } - - function mod($base, $modulus) - { - return bcmod($base, $modulus); - } - - function mul($x, $y) - { - return bcmul($x, $y); - } - - function div($x, $y) - { - return bcdiv($x, $y); - } - - /** - * Same as bcpowmod when bcpowmod is missing - * - * @access private - */ - function _powmod($base, $exponent, $modulus) - { - $square = $this->mod($base, $modulus); - $result = 1; - while($this->cmp($exponent, 0) > 0) { - if ($this->mod($exponent, 2)) { - $result = $this->mod($this->mul($result, $square), $modulus); - } - $square = $this->mod($this->mul($square, $square), $modulus); - $exponent = $this->div($exponent, 2); - } - return $result; - } - - function powmod($base, $exponent, $modulus) - { - if (function_exists('bcpowmod')) { - return bcpowmod($base, $exponent, $modulus); - } else { - return $this->_powmod($base, $exponent, $modulus); - } - } - - function toString($num) - { - return $num; - } + var $type = 'bcmath'; + + function add($x, $y) + { + return bcadd($x, $y); + } + + function sub($x, $y) + { + return bcsub($x, $y); + } + + function pow($base, $exponent) + { + return bcpow($base, $exponent); + } + + function cmp($x, $y) + { + return bccomp($x, $y); + } + + function init($number, $base = 10) + { + return $number; + } + + function mod($base, $modulus) + { + return bcmod($base, $modulus); + } + + function mul($x, $y) + { + return bcmul($x, $y); + } + + function div($x, $y) + { + return bcdiv($x, $y); + } + + /** + * Same as bcpowmod when bcpowmod is missing + * + * @access private + */ + function _powmod($base, $exponent, $modulus) + { + $square = $this->mod($base, $modulus); + $result = 1; + while($this->cmp($exponent, 0) > 0) { + if ($this->mod($exponent, 2)) { + $result = $this->mod($this->mul($result, $square), $modulus); + } + $square = $this->mod($this->mul($square, $square), $modulus); + $exponent = $this->div($exponent, 2); + } + return $result; + } + + function powmod($base, $exponent, $modulus) + { + if (function_exists('bcpowmod')) { + return bcpowmod($base, $exponent, $modulus); + } else { + return $this->_powmod($base, $exponent, $modulus); + } + } + + function toString($num) + { + return $num; + } } /** @@ -271,57 +271,57 @@ function toString($num) * @package OpenID */ class Auth_OpenID_GmpMathWrapper extends Auth_OpenID_MathLibrary{ - var $type = 'gmp'; - - function add($x, $y) - { - return gmp_add($x, $y); - } - - function sub($x, $y) - { - return gmp_sub($x, $y); - } - - function pow($base, $exponent) - { - return gmp_pow($base, $exponent); - } - - function cmp($x, $y) - { - return gmp_cmp($x, $y); - } - - function init($number, $base = 10) - { - return gmp_init($number, $base); - } - - function mod($base, $modulus) - { - return gmp_mod($base, $modulus); - } - - function mul($x, $y) - { - return gmp_mul($x, $y); - } - - function div($x, $y) - { - return gmp_div_q($x, $y); - } - - function powmod($base, $exponent, $modulus) - { - return gmp_powm($base, $exponent, $modulus); - } - - function toString($num) - { - return gmp_strval($num); - } + var $type = 'gmp'; + + function add($x, $y) + { + return gmp_add($x, $y); + } + + function sub($x, $y) + { + return gmp_sub($x, $y); + } + + function pow($base, $exponent) + { + return gmp_pow($base, $exponent); + } + + function cmp($x, $y) + { + return gmp_cmp($x, $y); + } + + function init($number, $base = 10) + { + return gmp_init($number, $base); + } + + function mod($base, $modulus) + { + return gmp_mod($base, $modulus); + } + + function mul($x, $y) + { + return gmp_mul($x, $y); + } + + function div($x, $y) + { + return gmp_div_q($x, $y); + } + + function powmod($base, $exponent, $modulus) + { + return gmp_powm($base, $exponent, $modulus); + } + + function toString($num) + { + return gmp_strval($num); + } } /** @@ -339,47 +339,47 @@ function toString($num) */ global $_Auth_OpenID_math_extensions; $_Auth_OpenID_math_extensions = array( - array('modules' => array('gmp', 'php_gmp'), - 'extension' => 'gmp', - 'class' => 'Auth_OpenID_GmpMathWrapper'), - array('modules' => array('bcmath', 'php_bcmath'), - 'extension' => 'bcmath', - 'class' => 'Auth_OpenID_BcMathWrapper') - ); + array('modules' => array('gmp', 'php_gmp'), + 'extension' => 'gmp', + 'class' => 'Auth_OpenID_GmpMathWrapper'), + array('modules' => array('bcmath', 'php_bcmath'), + 'extension' => 'bcmath', + 'class' => 'Auth_OpenID_BcMathWrapper') + ); /** * Detect which (if any) math library is available */ function Auth_OpenID_detectMathLibrary($exts) { - $loaded = false; - - foreach ($exts as $extension) { - // See if the extension specified is already loaded. - if ($extension['extension'] && - extension_loaded($extension['extension'])) { - $loaded = true; - } - - // Try to load dynamic modules. - if (!$loaded) { - foreach ($extension['modules'] as $module) { - if (@dl($module . "." . PHP_SHLIB_SUFFIX)) { - $loaded = true; - break; - } - } - } - - // If the load succeeded, supply an instance of - // Auth_OpenID_MathWrapper which wraps the specified - // module's functionality. - if ($loaded) { - return $extension; - } - } - - return false; + $loaded = false; + + foreach ($exts as $extension) { + // See if the extension specified is already loaded. + if ($extension['extension'] && + extension_loaded($extension['extension'])) { + $loaded = true; + } + + // Try to load dynamic modules. + if (!$loaded) { + foreach ($extension['modules'] as $module) { + if (@dl($module . "." . PHP_SHLIB_SUFFIX)) { + $loaded = true; + break; + } + } + } + + // If the load succeeded, supply an instance of + // Auth_OpenID_MathWrapper which wraps the specified + // module's functionality. + if ($loaded) { + return $extension; + } + } + + return false; } /** @@ -406,42 +406,40 @@ function Auth_OpenID_detectMathLibrary($exts) */ function &Auth_OpenID_getMathLib() { - // The instance of Auth_OpenID_MathWrapper that we choose to - // supply will be stored here, so that subseqent calls to this - // method will return a reference to the same object. - static $lib = null; - - if (isset($lib)) { - return $lib; - } - - if (defined('Auth_OpenID_NO_MATH_SUPPORT')) { - $null = null; - return $null; - } - - // If this method has not been called before, look at - // $Auth_OpenID_math_extensions and try to find an extension that - // works. - global $_Auth_OpenID_math_extensions; - $ext = Auth_OpenID_detectMathLibrary($_Auth_OpenID_math_extensions); - if ($ext === false) { - $tried = array(); - foreach ($_Auth_OpenID_math_extensions as $extinfo) { - $tried[] = $extinfo['extension']; - } - $triedstr = implode(", ", $tried); - - define('Auth_OpenID_NO_MATH_SUPPORT', true); - $null = null; - return $null; - } - - // Instantiate a new wrapper - $class = $ext['class']; - $lib = new $class(); - - return $lib; -} - -?> \ No newline at end of file + // The instance of Auth_OpenID_MathWrapper that we choose to + // supply will be stored here, so that subseqent calls to this + // method will return a reference to the same object. + static $lib = null; + + if (isset($lib)) { + return $lib; + } + + if (defined('Auth_OpenID_NO_MATH_SUPPORT')) { + $null = null; + return $null; + } + + // If this method has not been called before, look at + // $Auth_OpenID_math_extensions and try to find an extension that + // works. + global $_Auth_OpenID_math_extensions; + $ext = Auth_OpenID_detectMathLibrary($_Auth_OpenID_math_extensions); + if ($ext === false) { + $tried = array(); + foreach ($_Auth_OpenID_math_extensions as $extinfo) { + $tried[] = $extinfo['extension']; + } + $triedstr = implode(", ", $tried); + + define('Auth_OpenID_NO_MATH_SUPPORT', true); + $null = null; + return $null; + } + + // Instantiate a new wrapper + $class = $ext['class']; + $lib = new $class(); + + return $lib; +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/Consumer.php b/libraries/openid/Auth/OpenID/Consumer.php index 0f84f27189f3c..3ffaafecf8b1c 100644 --- a/libraries/openid/Auth/OpenID/Consumer.php +++ b/libraries/openid/Auth/OpenID/Consumer.php @@ -16,15 +16,15 @@ * following steps, as visible to the user of this library: * * 1. The user enters their OpenID into a field on the consumer's - * site, and hits a login button. + * site, and hits a login button. * 2. The consumer site discovers the user's OpenID server using the - * YADIS protocol. + * YADIS protocol. * 3. The consumer site sends the browser a redirect to the identity - * server. This is the authentication request as described in - * the OpenID specification. + * server. This is the authentication request as described in + * the OpenID specification. * 4. The identity server's site sends the browser a redirect back - * to the consumer site. This redirect contains the server's - * response to the authentication request. + * to the consumer site. This redirect contains the server's + * response to the authentication request. * * The most important part of the flow to note is the consumer's site * must handle two separate HTTP requests in order to perform the full @@ -212,7 +212,7 @@ * This is the characters that the nonces are made from. */ define('Auth_OpenID_DEFAULT_NONCE_CHRS',"abcdefghijklmnopqrstuvwxyz" . - "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); /** * An OpenID consumer implementation that performs discovery and does @@ -223,250 +223,250 @@ */ class Auth_OpenID_Consumer { - /** - * @access private - */ - var $session_key_prefix = "_openid_consumer_"; - - /** - * @access private - */ - var $_token_suffix = "last_token"; - - /** - * Initialize a Consumer instance. - * - * You should create a new instance of the Consumer object with - * every HTTP request that handles OpenID transactions. - * - * @param Auth_OpenID_OpenIDStore $store This must be an object - * that implements the interface in {@link - * Auth_OpenID_OpenIDStore}. Several concrete implementations are - * provided, to cover most common use cases. For stores backed by - * MySQL, PostgreSQL, or SQLite, see the {@link - * Auth_OpenID_SQLStore} class and its sublcasses. For a - * filesystem-backed store, see the {@link Auth_OpenID_FileStore} - * module. As a last resort, if it isn't possible for the server - * to store state at all, an instance of {@link - * Auth_OpenID_DumbStore} can be used. - * - * @param mixed session An object which implements the interface - * of the Services_Yadis_Session class. Particularly, this object - * is expected to have these methods: get($key), set($key, - * $value), and del($key). This defaults to a session object - * which wraps PHP's native session machinery. You should only - * need to pass something here if you have your own sessioning - * implementation. - */ - function Auth_OpenID_Consumer(&$store, $session = null) - { - if ($session === null) { - $session = new Services_Yadis_PHPSession(); - } - - $this->session =& $session; - $this->consumer =& new Auth_OpenID_GenericConsumer($store); - $this->_token_key = $this->session_key_prefix . $this->_token_suffix; - } - - /** - * Start the OpenID authentication process. See steps 1-2 in the - * overview at the top of this file. - * - * @param User_url: Identity URL given by the user. This method - * performs a textual transformation of the URL to try and make - * sure it is normalized. For example, a user_url of example.com - * will be normalized to http://example.com/ normalizing and - * resolving any redirects the server might issue. - * - * @return Auth_OpenID_AuthRequest $auth_request An object - * containing the discovered information will be returned, with a - * method for building a redirect URL to the server, as described - * in step 3 of the overview. This object may also be used to add - * extension arguments to the request, using its 'addExtensionArg' - * method. - */ - function begin($user_url) - { - $discoverMethod = '_Auth_OpenID_discoverServiceList'; - $openid_url = $user_url; - - if (Services_Yadis_identifierScheme($user_url) == 'XRI') { - $discoverMethod = '_Auth_OpenID_discoverXRIServiceList'; - } else { - $openid_url = Auth_OpenID::normalizeUrl($user_url); - } - - $disco =& new Services_Yadis_Discovery($this->session, - $openid_url, - $this->session_key_prefix); - - // Set the 'stale' attribute of the manager. If discovery - // fails in a fatal way, the stale flag will cause the manager - // to be cleaned up next time discovery is attempted. - - $m = $disco->getManager(); - $loader = new Services_Yadis_ManagerLoader(); - - if ($m) { - if ($m->stale) { - $disco->destroyManager(); - } else { - $m->stale = true; - $disco->session->set($disco->session_key, - serialize($loader->toSession($m))); - } - } - - $endpoint = $disco->getNextService($discoverMethod, - $this->consumer->fetcher); - - // Reset the 'stale' attribute of the manager. - $m =& $disco->getManager(); - if ($m) { - $m->stale = false; - $disco->session->set($disco->session_key, - serialize($loader->toSession($m))); - } - - if ($endpoint === null) { - return null; - } else { - return $this->beginWithoutDiscovery($endpoint); - } - } - - /** - * Start OpenID verification without doing OpenID server - * discovery. This method is used internally by Consumer.begin - * after discovery is performed, and exists to provide an - * interface for library users needing to perform their own - * discovery. - * - * @param Auth_OpenID_ServiceEndpoint $endpoint an OpenID service - * endpoint descriptor. - * - * @return Auth_OpenID_AuthRequest $auth_request An OpenID - * authentication request object. - */ - function &beginWithoutDiscovery($endpoint) - { - $loader = new Auth_OpenID_ServiceEndpointLoader(); - $auth_req = $this->consumer->begin($endpoint); - $this->session->set($this->_token_key, - $loader->toSession($auth_req->endpoint)); - return $auth_req; - } - - /** - * Called to interpret the server's response to an OpenID - * request. It is called in step 4 of the flow described in the - * consumer overview. - * - * @param array $query An array of the query parameters (key => - * value pairs) for this HTTP request. - * - * @return Auth_OpenID_ConsumerResponse $response A instance of an - * Auth_OpenID_ConsumerResponse subclass. The type of response is - * indicated by the status attribute, which will be one of - * SUCCESS, CANCEL, FAILURE, or SETUP_NEEDED. - */ - function complete($query) - { - $query = Auth_OpenID::fixArgs($query); - - $loader = new Auth_OpenID_ServiceEndpointLoader(); - $endpoint_data = $this->session->get($this->_token_key); - $endpoint = - $loader->fromSession($endpoint_data); - - if ($endpoint === null) { - $response = new Auth_OpenID_FailureResponse(null, - 'No session state found'); - } else { - $response = $this->consumer->complete($query, $endpoint); - $this->session->del($this->_token_key); - } - - if (in_array($response->status, array(Auth_OpenID_SUCCESS, - Auth_OpenID_CANCEL))) { - if ($response->identity_url !== null) { - $disco = new Services_Yadis_Discovery($this->session, - $response->identity_url, - $this->session_key_prefix); - $disco->cleanup(); - } - } - - return $response; - } + /** + * @access private + */ + var $session_key_prefix = "_openid_consumer_"; + + /** + * @access private + */ + var $_token_suffix = "last_token"; + + /** + * Initialize a Consumer instance. + * + * You should create a new instance of the Consumer object with + * every HTTP request that handles OpenID transactions. + * + * @param Auth_OpenID_OpenIDStore $store This must be an object + * that implements the interface in {@link + * Auth_OpenID_OpenIDStore}. Several concrete implementations are + * provided, to cover most common use cases. For stores backed by + * MySQL, PostgreSQL, or SQLite, see the {@link + * Auth_OpenID_SQLStore} class and its sublcasses. For a + * filesystem-backed store, see the {@link Auth_OpenID_FileStore} + * module. As a last resort, if it isn't possible for the server + * to store state at all, an instance of {@link + * Auth_OpenID_DumbStore} can be used. + * + * @param mixed session An object which implements the interface + * of the Services_Yadis_Session class. Particularly, this object + * is expected to have these methods: get($key), set($key, + * $value), and del($key). This defaults to a session object + * which wraps PHP's native session machinery. You should only + * need to pass something here if you have your own sessioning + * implementation. + */ + function Auth_OpenID_Consumer(&$store, $session = null) + { + if ($session === null) { + $session = new Services_Yadis_PHPSession(); + } + + $this->session =& $session; + $this->consumer =& new Auth_OpenID_GenericConsumer($store); + $this->_token_key = $this->session_key_prefix . $this->_token_suffix; + } + + /** + * Start the OpenID authentication process. See steps 1-2 in the + * overview at the top of this file. + * + * @param User_url: Identity URL given by the user. This method + * performs a textual transformation of the URL to try and make + * sure it is normalized. For example, a user_url of example.com + * will be normalized to http://example.com/ normalizing and + * resolving any redirects the server might issue. + * + * @return Auth_OpenID_AuthRequest $auth_request An object + * containing the discovered information will be returned, with a + * method for building a redirect URL to the server, as described + * in step 3 of the overview. This object may also be used to add + * extension arguments to the request, using its 'addExtensionArg' + * method. + */ + function begin($user_url) + { + $discoverMethod = '_Auth_OpenID_discoverServiceList'; + $openid_url = $user_url; + + if (Services_Yadis_identifierScheme($user_url) == 'XRI') { + $discoverMethod = '_Auth_OpenID_discoverXRIServiceList'; + } else { + $openid_url = Auth_OpenID::normalizeUrl($user_url); + } + + $disco =& new Services_Yadis_Discovery($this->session, + $openid_url, + $this->session_key_prefix); + + // Set the 'stale' attribute of the manager. If discovery + // fails in a fatal way, the stale flag will cause the manager + // to be cleaned up next time discovery is attempted. + + $m = $disco->getManager(); + $loader = new Services_Yadis_ManagerLoader(); + + if ($m) { + if ($m->stale) { + $disco->destroyManager(); + } else { + $m->stale = true; + $disco->session->set($disco->session_key, + serialize($loader->toSession($m))); + } + } + + $endpoint = $disco->getNextService($discoverMethod, + $this->consumer->fetcher); + + // Reset the 'stale' attribute of the manager. + $m =& $disco->getManager(); + if ($m) { + $m->stale = false; + $disco->session->set($disco->session_key, + serialize($loader->toSession($m))); + } + + if ($endpoint === null) { + return null; + } else { + return $this->beginWithoutDiscovery($endpoint); + } + } + + /** + * Start OpenID verification without doing OpenID server + * discovery. This method is used internally by Consumer.begin + * after discovery is performed, and exists to provide an + * interface for library users needing to perform their own + * discovery. + * + * @param Auth_OpenID_ServiceEndpoint $endpoint an OpenID service + * endpoint descriptor. + * + * @return Auth_OpenID_AuthRequest $auth_request An OpenID + * authentication request object. + */ + function &beginWithoutDiscovery($endpoint) + { + $loader = new Auth_OpenID_ServiceEndpointLoader(); + $auth_req = $this->consumer->begin($endpoint); + $this->session->set($this->_token_key, + $loader->toSession($auth_req->endpoint)); + return $auth_req; + } + + /** + * Called to interpret the server's response to an OpenID + * request. It is called in step 4 of the flow described in the + * consumer overview. + * + * @param array $query An array of the query parameters (key => + * value pairs) for this HTTP request. + * + * @return Auth_OpenID_ConsumerResponse $response A instance of an + * Auth_OpenID_ConsumerResponse subclass. The type of response is + * indicated by the status attribute, which will be one of + * SUCCESS, CANCEL, FAILURE, or SETUP_NEEDED. + */ + function complete($query) + { + $query = Auth_OpenID::fixArgs($query); + + $loader = new Auth_OpenID_ServiceEndpointLoader(); + $endpoint_data = $this->session->get($this->_token_key); + $endpoint = + $loader->fromSession($endpoint_data); + + if ($endpoint === null) { + $response = new Auth_OpenID_FailureResponse(null, + 'No session state found'); + } else { + $response = $this->consumer->complete($query, $endpoint); + $this->session->del($this->_token_key); + } + + if (in_array($response->status, array(Auth_OpenID_SUCCESS, + Auth_OpenID_CANCEL))) { + if ($response->identity_url !== null) { + $disco = new Services_Yadis_Discovery($this->session, + $response->identity_url, + $this->session_key_prefix); + $disco->cleanup(); + } + } + + return $response; + } } class Auth_OpenID_DiffieHellmanConsumerSession { - var $session_type = 'DH-SHA1'; + var $session_type = 'DH-SHA1'; - function Auth_OpenID_DiffieHellmanConsumerSession($dh = null) - { - if ($dh === null) { - $dh = new Auth_OpenID_DiffieHellman(); - } + function Auth_OpenID_DiffieHellmanConsumerSession($dh = null) + { + if ($dh === null) { + $dh = new Auth_OpenID_DiffieHellman(); + } - $this->dh = $dh; - } + $this->dh = $dh; + } - function getRequest() - { - $math =& Auth_OpenID_getMathLib(); + function getRequest() + { + $math =& Auth_OpenID_getMathLib(); - $cpub = $math->longToBase64($this->dh->public); + $cpub = $math->longToBase64($this->dh->public); - $args = array('openid.dh_consumer_public' => $cpub); + $args = array('openid.dh_consumer_public' => $cpub); - if (!$this->dh->usingDefaultValues()) { - $args = array_merge($args, array( - 'openid.dh_modulus' => - $math->longToBase64($this->dh->mod), - 'openid.dh_gen' => - $math->longToBase64($this->dh->gen))); - } + if (!$this->dh->usingDefaultValues()) { + $args = array_merge($args, array( + 'openid.dh_modulus' => + $math->longToBase64($this->dh->mod), + 'openid.dh_gen' => + $math->longToBase64($this->dh->gen))); + } - return $args; - } + return $args; + } - function extractSecret($response) - { - if (!array_key_exists('dh_server_public', $response)) { - return null; - } + function extractSecret($response) + { + if (!array_key_exists('dh_server_public', $response)) { + return null; + } - if (!array_key_exists('enc_mac_key', $response)) { - return null; - } + if (!array_key_exists('enc_mac_key', $response)) { + return null; + } - $math =& Auth_OpenID_getMathLib(); - $spub = $math->base64ToLong($response['dh_server_public']); - $enc_mac_key = base64_decode($response['enc_mac_key']); + $math =& Auth_OpenID_getMathLib(); + $spub = $math->base64ToLong($response['dh_server_public']); + $enc_mac_key = base64_decode($response['enc_mac_key']); - return $this->dh->xorSecret($spub, $enc_mac_key); - } + return $this->dh->xorSecret($spub, $enc_mac_key); + } } class Auth_OpenID_PlainTextConsumerSession { - var $session_type = null; + var $session_type = null; - function getRequest() - { - return array(); - } + function getRequest() + { + return array(); + } - function extractSecret($response) - { - if (!array_key_exists('mac_key', $response)) { - return null; - } + function extractSecret($response) + { + if (!array_key_exists('mac_key', $response)) { + return null; + } - return base64_decode($response['mac_key']); - } + return base64_decode($response['mac_key']); + } } /** @@ -478,453 +478,453 @@ function extractSecret($response) * @access private */ class Auth_OpenID_GenericConsumer { - /** - * This consumer's store object. - */ - var $store; - - /** - * @access private - */ - var $_use_assocs; - - /** - * This is the number of characters in the generated nonce for - * each transaction. - */ - var $nonce_len = 8; - - /** - * What characters are allowed in nonces - */ - var $nonce_chrs = Auth_OpenID_DEFAULT_NONCE_CHRS; - - /** - * This method initializes a new {@link Auth_OpenID_Consumer} - * instance to access the library. - * - * @param Auth_OpenID_OpenIDStore $store This must be an object - * that implements the interface in {@link Auth_OpenID_OpenIDStore}. - * Several concrete implementations are provided, to cover most common use - * cases. For stores backed by MySQL, PostgreSQL, or SQLite, see - * the {@link Auth_OpenID_SQLStore} class and its sublcasses. For a - * filesystem-backed store, see the {@link Auth_OpenID_FileStore} module. - * As a last resort, if it isn't possible for the server to store - * state at all, an instance of {@link Auth_OpenID_DumbStore} can be used. - * - * @param bool $immediate This is an optional boolean value. It - * controls whether the library uses immediate mode, as explained - * in the module description. The default value is False, which - * disables immediate mode. - */ - function Auth_OpenID_GenericConsumer(&$store) - { - $this->store =& $store; - $this->_use_assocs = - !(defined('Auth_OpenID_NO_MATH_SUPPORT') || - ($this->store && $this->store->isDumb())); - - $this->fetcher = Services_Yadis_Yadis::getHTTPFetcher(); - } - - function begin($service_endpoint) - { - $nonce = $this->_createNonce(); - $assoc = $this->_getAssociation($service_endpoint->server_url); - $r = new Auth_OpenID_AuthRequest($assoc, $service_endpoint); - $r->return_to_args['nonce'] = $nonce; - return $r; - } - - function complete($query, $endpoint) - { - $mode = Auth_OpenID::arrayGet($query, 'openid.mode', - ''); - - if ($mode == Auth_OpenID_CANCEL) { - return new Auth_OpenID_CancelResponse($endpoint); - } else if ($mode == 'error') { - $error = Auth_OpenID::arrayGet($query, 'openid.error'); - return new Auth_OpenID_FailureResponse($endpoint, $error); - } else if ($mode == 'id_res') { - if ($endpoint->identity_url === null) { - return new Auth_OpenID_FailureResponse($identity_url, - "No session state found"); - } - - $response = $this->_doIdRes($query, $endpoint); - - if ($response === null) { - return new Auth_OpenID_FailureResponse($endpoint, - "HTTP request failed"); - } - if ($response->status == Auth_OpenID_SUCCESS) { - return $this->_checkNonce($response, - Auth_OpenID::arrayGet($query, - 'nonce')); - } else { - return $response; - } - } else { - return new Auth_OpenID_FailureResponse($endpoint, - sprintf("Invalid openid.mode '%s'", - $mode)); - } - } - - /** - * @access private - */ - function _doIdRes($query, $endpoint) - { - $user_setup_url = Auth_OpenID::arrayGet($query, - 'openid.user_setup_url'); - - if ($user_setup_url !== null) { - return new Auth_OpenID_SetupNeededResponse($endpoint, - $user_setup_url); - } - - $return_to = Auth_OpenID::arrayGet($query, 'openid.return_to', null); - $server_id2 = Auth_OpenID::arrayGet($query, 'openid.identity', null); - $assoc_handle = Auth_OpenID::arrayGet($query, - 'openid.assoc_handle', null); - - if (($return_to === null) || - ($server_id2 === null) || - ($assoc_handle === null)) { - return new Auth_OpenID_FailureResponse($endpoint, - "Missing required field"); - } - - if ($endpoint->getServerID() != $server_id2) { - return new Auth_OpenID_FailureResponse($endpoint, - "Server ID (delegate) mismatch"); - } - - $signed = Auth_OpenID::arrayGet($query, 'openid.signed'); - - $assoc = $this->store->getAssociation($endpoint->server_url, - $assoc_handle); - - if ($assoc === null) { - // It's not an association we know about. Dumb mode is - // our only possible path for recovery. - if ($this->_checkAuth($query, $endpoint->server_url)) { - return new Auth_OpenID_SuccessResponse($endpoint, $query, - $signed); - } else { - return new Auth_OpenID_FailureResponse($endpoint, - "Server denied check_authentication"); - } - } - - if ($assoc->getExpiresIn() <= 0) { - $msg = sprintf("Association with %s expired", - $endpoint->server_url); - return new Auth_OpenID_FailureResponse($endpoint, $msg); - } - - // Check the signature - $sig = Auth_OpenID::arrayGet($query, 'openid.sig', null); - if (($sig === null) || - ($signed === null)) { - return new Auth_OpenID_FailureResponse($endpoint, - "Missing argument signature"); - } - - $signed_list = explode(",", $signed); - - //Fail if the identity field is present but not signed - if (($endpoint->identity_url !== null) && - (!in_array('identity', $signed_list))) { - $msg = '"openid.identity" not signed'; - return new Auth_OpenID_FailureResponse($endpoint, $msg); - } - - $v_sig = $assoc->signDict($signed_list, $query); - - if ($v_sig != $sig) { - return new Auth_OpenID_FailureResponse($endpoint, - "Bad signature"); - } - - return Auth_OpenID_SuccessResponse::fromQuery($endpoint, - $query, $signed); - } - - /** - * @access private - */ - function _checkAuth($query, $server_url) - { - $request = $this->_createCheckAuthRequest($query); - if ($request === null) { - return false; - } - - $response = $this->_makeKVPost($request, $server_url); - if ($response == null) { - return false; - } - - return $this->_processCheckAuthResponse($response, $server_url); - } - - /** - * @access private - */ - function _createCheckAuthRequest($query) - { - $signed = Auth_OpenID::arrayGet($query, 'openid.signed', null); - if ($signed === null) { - return null; - } - - $whitelist = array('assoc_handle', 'sig', - 'signed', 'invalidate_handle'); - - $signed = array_merge(explode(",", $signed), $whitelist); - - $check_args = array(); - - foreach ($query as $key => $value) { - if (in_array(substr($key, 7), $signed)) { - $check_args[$key] = $value; - } - } - - $check_args['openid.mode'] = 'check_authentication'; - return $check_args; - } - - /** - * @access private - */ - function _processCheckAuthResponse($response, $server_url) - { - $is_valid = Auth_OpenID::arrayGet($response, 'is_valid', 'false'); - - $invalidate_handle = Auth_OpenID::arrayGet($response, - 'invalidate_handle'); - - if ($invalidate_handle !== null) { - $this->store->removeAssociation($server_url, - $invalidate_handle); - } - - if ($is_valid == 'true') { - return true; - } - - return false; - } - - /** - * @access private - */ - function _makeKVPost($args, $server_url) - { - $mode = $args['openid.mode']; - - $pairs = array(); - foreach ($args as $k => $v) { - $v = urlencode($v); - $pairs[] = "$k=$v"; - } - - $body = implode("&", $pairs); - - $resp = $this->fetcher->post($server_url, $body); - - if ($resp === null) { - return null; - } - - $response = Auth_OpenID_KVForm::toArray($resp->body); - - if ($resp->status == 400) { - return null; - } else if ($resp->status != 200) { - return null; - } - - return $response; - } - - /** - * @access private - */ - function _checkNonce($response, $nonce) - { - $parsed_url = parse_url($response->getReturnTo()); - $query_str = @$parsed_url['query']; - $query = array(); - parse_str($query_str, $query); - - $found = false; - - foreach ($query as $k => $v) { - if ($k == 'nonce') { - if ($v != $nonce) { - return new Auth_OpenID_FailureResponse($response, - "Nonce mismatch"); - } else { - $found = true; - break; - } - } - } - - if (!$found) { - return new Auth_OpenID_FailureResponse($response, - sprintf("Nonce missing from return_to: %s", - $response->getReturnTo())); - } - - if (!$this->store->useNonce($nonce)) { - return new Auth_OpenID_FailureResponse($response, - "Nonce missing from store"); - } - - return $response; - } - - /** - * @access private - */ - function _createNonce() - { - $nonce = Auth_OpenID_CryptUtil::randomString($this->nonce_len, - $this->nonce_chrs); - $this->store->storeNonce($nonce); - return $nonce; - } - - /** - * @access protected - */ - function _createDiffieHellman() - { - return new Auth_OpenID_DiffieHellman(); - } - - /** - * @access private - */ - function _getAssociation($server_url) - { - if (!$this->_use_assocs) { - return null; - } - - $assoc = $this->store->getAssociation($server_url); - - if (($assoc === null) || - ($assoc->getExpiresIn() <= 0)) { - - $parts = $this->_createAssociateRequest($server_url); - - if ($parts === null) { - return null; - } - - list($assoc_session, $args) = $parts; - - $response = $this->_makeKVPost($args, $server_url); - - if ($response === null) { - $assoc = null; - } else { - $assoc = $this->_parseAssociation($response, $assoc_session, - $server_url); - } - } - - return $assoc; - } - - function _createAssociateRequest($server_url) - { - $parts = parse_url($server_url); - - if ($parts === false) { - return null; - } - - if (array_key_exists('scheme', $parts)) { - $proto = $parts['scheme']; - } else { - $proto = 'http'; - } - - if ($proto == 'https') { - $assoc_session = new Auth_OpenID_PlainTextConsumerSession(); - } else { - $assoc_session = new Auth_OpenID_DiffieHellmanConsumerSession(); - } - - $args = array( - 'openid.mode' => 'associate', - 'openid.assoc_type' => 'HMAC-SHA1'); - - if ($assoc_session->session_type !== null) { - $args['openid.session_type'] = $assoc_session->session_type; - } - - $args = array_merge($args, $assoc_session->getRequest()); - return array($assoc_session, $args); - } - - /** - * @access private - */ - function _parseAssociation($results, $assoc_session, $server_url) - { - $required_keys = array('assoc_type', 'assoc_handle', - 'expires_in'); - - foreach ($required_keys as $key) { - if (!array_key_exists($key, $results)) { - return null; - } - } - - $assoc_type = $results['assoc_type']; - $assoc_handle = $results['assoc_handle']; - $expires_in_str = $results['expires_in']; - - if ($assoc_type != 'HMAC-SHA1') { - return null; - } - - $expires_in = intval($expires_in_str); - - if ($expires_in <= 0) { - return null; - } - - $session_type = Auth_OpenID::arrayGet($results, 'session_type'); - if ($session_type != $assoc_session->session_type) { - if ($session_type === null) { - $assoc_session = new Auth_OpenID_PlainTextConsumerSession(); - } else { - return null; - } - } - - $secret = $assoc_session->extractSecret($results); - - if (!$secret) { - return null; - } - - $assoc = Auth_OpenID_Association::fromExpiresIn( - $expires_in, $assoc_handle, $secret, $assoc_type); - $this->store->storeAssociation($server_url, $assoc); - - return $assoc; - } + /** + * This consumer's store object. + */ + var $store; + + /** + * @access private + */ + var $_use_assocs; + + /** + * This is the number of characters in the generated nonce for + * each transaction. + */ + var $nonce_len = 8; + + /** + * What characters are allowed in nonces + */ + var $nonce_chrs = Auth_OpenID_DEFAULT_NONCE_CHRS; + + /** + * This method initializes a new {@link Auth_OpenID_Consumer} + * instance to access the library. + * + * @param Auth_OpenID_OpenIDStore $store This must be an object + * that implements the interface in {@link Auth_OpenID_OpenIDStore}. + * Several concrete implementations are provided, to cover most common use + * cases. For stores backed by MySQL, PostgreSQL, or SQLite, see + * the {@link Auth_OpenID_SQLStore} class and its sublcasses. For a + * filesystem-backed store, see the {@link Auth_OpenID_FileStore} module. + * As a last resort, if it isn't possible for the server to store + * state at all, an instance of {@link Auth_OpenID_DumbStore} can be used. + * + * @param bool $immediate This is an optional boolean value. It + * controls whether the library uses immediate mode, as explained + * in the module description. The default value is False, which + * disables immediate mode. + */ + function Auth_OpenID_GenericConsumer(&$store) + { + $this->store =& $store; + $this->_use_assocs = + !(defined('Auth_OpenID_NO_MATH_SUPPORT') || + ($this->store && $this->store->isDumb())); + + $this->fetcher = Services_Yadis_Yadis::getHTTPFetcher(); + } + + function begin($service_endpoint) + { + $nonce = $this->_createNonce(); + $assoc = $this->_getAssociation($service_endpoint->server_url); + $r = new Auth_OpenID_AuthRequest($assoc, $service_endpoint); + $r->return_to_args['nonce'] = $nonce; + return $r; + } + + function complete($query, $endpoint) + { + $mode = Auth_OpenID::arrayGet($query, 'openid.mode', + ''); + + if ($mode == Auth_OpenID_CANCEL) { + return new Auth_OpenID_CancelResponse($endpoint); + } else if ($mode == 'error') { + $error = Auth_OpenID::arrayGet($query, 'openid.error'); + return new Auth_OpenID_FailureResponse($endpoint, $error); + } else if ($mode == 'id_res') { + if ($endpoint->identity_url === null) { + return new Auth_OpenID_FailureResponse($identity_url, + "No session state found"); + } + + $response = $this->_doIdRes($query, $endpoint); + + if ($response === null) { + return new Auth_OpenID_FailureResponse($endpoint, + "HTTP request failed"); + } + if ($response->status == Auth_OpenID_SUCCESS) { + return $this->_checkNonce($response, + Auth_OpenID::arrayGet($query, + 'nonce')); + } else { + return $response; + } + } else { + return new Auth_OpenID_FailureResponse($endpoint, + sprintf("Invalid openid.mode '%s'", + $mode)); + } + } + + /** + * @access private + */ + function _doIdRes($query, $endpoint) + { + $user_setup_url = Auth_OpenID::arrayGet($query, + 'openid.user_setup_url'); + + if ($user_setup_url !== null) { + return new Auth_OpenID_SetupNeededResponse($endpoint, + $user_setup_url); + } + + $return_to = Auth_OpenID::arrayGet($query, 'openid.return_to', null); + $server_id2 = Auth_OpenID::arrayGet($query, 'openid.identity', null); + $assoc_handle = Auth_OpenID::arrayGet($query, + 'openid.assoc_handle', null); + + if (($return_to === null) || + ($server_id2 === null) || + ($assoc_handle === null)) { + return new Auth_OpenID_FailureResponse($endpoint, + "Missing required field"); + } + + if ($endpoint->getServerID() != $server_id2) { + return new Auth_OpenID_FailureResponse($endpoint, + "Server ID (delegate) mismatch"); + } + + $signed = Auth_OpenID::arrayGet($query, 'openid.signed'); + + $assoc = $this->store->getAssociation($endpoint->server_url, + $assoc_handle); + + if ($assoc === null) { + // It's not an association we know about. Dumb mode is + // our only possible path for recovery. + if ($this->_checkAuth($query, $endpoint->server_url)) { + return new Auth_OpenID_SuccessResponse($endpoint, $query, + $signed); + } else { + return new Auth_OpenID_FailureResponse($endpoint, + "Server denied check_authentication"); + } + } + + if ($assoc->getExpiresIn() <= 0) { + $msg = sprintf("Association with %s expired", + $endpoint->server_url); + return new Auth_OpenID_FailureResponse($endpoint, $msg); + } + + // Check the signature + $sig = Auth_OpenID::arrayGet($query, 'openid.sig', null); + if (($sig === null) || + ($signed === null)) { + return new Auth_OpenID_FailureResponse($endpoint, + "Missing argument signature"); + } + + $signed_list = explode(",", $signed); + + //Fail if the identity field is present but not signed + if (($endpoint->identity_url !== null) && + (!in_array('identity', $signed_list))) { + $msg = '"openid.identity" not signed'; + return new Auth_OpenID_FailureResponse($endpoint, $msg); + } + + $v_sig = $assoc->signDict($signed_list, $query); + + if ($v_sig != $sig) { + return new Auth_OpenID_FailureResponse($endpoint, + "Bad signature"); + } + + return Auth_OpenID_SuccessResponse::fromQuery($endpoint, + $query, $signed); + } + + /** + * @access private + */ + function _checkAuth($query, $server_url) + { + $request = $this->_createCheckAuthRequest($query); + if ($request === null) { + return false; + } + + $response = $this->_makeKVPost($request, $server_url); + if ($response == null) { + return false; + } + + return $this->_processCheckAuthResponse($response, $server_url); + } + + /** + * @access private + */ + function _createCheckAuthRequest($query) + { + $signed = Auth_OpenID::arrayGet($query, 'openid.signed', null); + if ($signed === null) { + return null; + } + + $whitelist = array('assoc_handle', 'sig', + 'signed', 'invalidate_handle'); + + $signed = array_merge(explode(",", $signed), $whitelist); + + $check_args = array(); + + foreach ($query as $key => $value) { + if (in_array(substr($key, 7), $signed)) { + $check_args[$key] = $value; + } + } + + $check_args['openid.mode'] = 'check_authentication'; + return $check_args; + } + + /** + * @access private + */ + function _processCheckAuthResponse($response, $server_url) + { + $is_valid = Auth_OpenID::arrayGet($response, 'is_valid', 'false'); + + $invalidate_handle = Auth_OpenID::arrayGet($response, + 'invalidate_handle'); + + if ($invalidate_handle !== null) { + $this->store->removeAssociation($server_url, + $invalidate_handle); + } + + if ($is_valid == 'true') { + return true; + } + + return false; + } + + /** + * @access private + */ + function _makeKVPost($args, $server_url) + { + $mode = $args['openid.mode']; + + $pairs = array(); + foreach ($args as $k => $v) { + $v = urlencode($v); + $pairs[] = "$k=$v"; + } + + $body = implode("&", $pairs); + + $resp = $this->fetcher->post($server_url, $body); + + if ($resp === null) { + return null; + } + + $response = Auth_OpenID_KVForm::toArray($resp->body); + + if ($resp->status == 400) { + return null; + } else if ($resp->status != 200) { + return null; + } + + return $response; + } + + /** + * @access private + */ + function _checkNonce($response, $nonce) + { + $parsed_url = parse_url($response->getReturnTo()); + $query_str = @$parsed_url['query']; + $query = array(); + parse_str($query_str, $query); + + $found = false; + + foreach ($query as $k => $v) { + if ($k == 'nonce') { + if ($v != $nonce) { + return new Auth_OpenID_FailureResponse($response, + "Nonce mismatch"); + } else { + $found = true; + break; + } + } + } + + if (!$found) { + return new Auth_OpenID_FailureResponse($response, + sprintf("Nonce missing from return_to: %s", + $response->getReturnTo())); + } + + if (!$this->store->useNonce($nonce)) { + return new Auth_OpenID_FailureResponse($response, + "Nonce missing from store"); + } + + return $response; + } + + /** + * @access private + */ + function _createNonce() + { + $nonce = Auth_OpenID_CryptUtil::randomString($this->nonce_len, + $this->nonce_chrs); + $this->store->storeNonce($nonce); + return $nonce; + } + + /** + * @access protected + */ + function _createDiffieHellman() + { + return new Auth_OpenID_DiffieHellman(); + } + + /** + * @access private + */ + function _getAssociation($server_url) + { + if (!$this->_use_assocs) { + return null; + } + + $assoc = $this->store->getAssociation($server_url); + + if (($assoc === null) || + ($assoc->getExpiresIn() <= 0)) { + + $parts = $this->_createAssociateRequest($server_url); + + if ($parts === null) { + return null; + } + + list($assoc_session, $args) = $parts; + + $response = $this->_makeKVPost($args, $server_url); + + if ($response === null) { + $assoc = null; + } else { + $assoc = $this->_parseAssociation($response, $assoc_session, + $server_url); + } + } + + return $assoc; + } + + function _createAssociateRequest($server_url) + { + $parts = parse_url($server_url); + + if ($parts === false) { + return null; + } + + if (array_key_exists('scheme', $parts)) { + $proto = $parts['scheme']; + } else { + $proto = 'http'; + } + + if ($proto == 'https') { + $assoc_session = new Auth_OpenID_PlainTextConsumerSession(); + } else { + $assoc_session = new Auth_OpenID_DiffieHellmanConsumerSession(); + } + + $args = array( + 'openid.mode' => 'associate', + 'openid.assoc_type' => 'HMAC-SHA1'); + + if ($assoc_session->session_type !== null) { + $args['openid.session_type'] = $assoc_session->session_type; + } + + $args = array_merge($args, $assoc_session->getRequest()); + return array($assoc_session, $args); + } + + /** + * @access private + */ + function _parseAssociation($results, $assoc_session, $server_url) + { + $required_keys = array('assoc_type', 'assoc_handle', + 'expires_in'); + + foreach ($required_keys as $key) { + if (!array_key_exists($key, $results)) { + return null; + } + } + + $assoc_type = $results['assoc_type']; + $assoc_handle = $results['assoc_handle']; + $expires_in_str = $results['expires_in']; + + if ($assoc_type != 'HMAC-SHA1') { + return null; + } + + $expires_in = intval($expires_in_str); + + if ($expires_in <= 0) { + return null; + } + + $session_type = Auth_OpenID::arrayGet($results, 'session_type'); + if ($session_type != $assoc_session->session_type) { + if ($session_type === null) { + $assoc_session = new Auth_OpenID_PlainTextConsumerSession(); + } else { + return null; + } + } + + $secret = $assoc_session->extractSecret($results); + + if (!$secret) { + return null; + } + + $assoc = Auth_OpenID_Association::fromExpiresIn( + $expires_in, $assoc_handle, $secret, $assoc_type); + $this->store->storeAssociation($server_url, $assoc); + + return $assoc; + } } /** @@ -935,85 +935,85 @@ function _parseAssociation($results, $assoc_session, $server_url) */ class Auth_OpenID_AuthRequest { - /** - * Initialize an authentication request with the specified token, - * association, and endpoint. - * - * Users of this library should not create instances of this - * class. Instances of this class are created by the library when - * needed. - */ - function Auth_OpenID_AuthRequest($assoc, $endpoint) - { - $this->assoc = $assoc; - $this->endpoint = $endpoint; - $this->extra_args = array(); - $this->return_to_args = array(); - } - - /** - * Add an extension argument to this OpenID authentication - * request. - * - * Use caution when adding arguments, because they will be - * URL-escaped and appended to the redirect URL, which can easily - * get quite long. - * - * @param string $namespace The namespace for the extension. For - * example, the simple registration extension uses the namespace - * 'sreg'. - * - * @param string $key The key within the extension namespace. For - * example, the nickname field in the simple registration - * extension's key is 'nickname'. - * - * @param string $value The value to provide to the server for - * this argument. - */ - function addExtensionArg($namespace, $key, $value) - { - $arg_name = implode('.', array('openid', $namespace, $key)); - $this->extra_args[$arg_name] = $value; - } - - /** - * Compute the appropriate redirection URL for this request based - * on a specified trust root and return-to. - * - * @param string $trust_root The trust root URI for your - * application. - * - * @param string$ $return_to The return-to URL to be used when the - * OpenID server redirects the user back to your site. - * - * @return string $redirect_url The resulting redirect URL that - * you should send to the user agent. - */ - function redirectURL($trust_root, $return_to, $immediate=false) - { - if ($immediate) { - $mode = 'checkid_immediate'; - } else { - $mode = 'checkid_setup'; - } - - $return_to = Auth_OpenID::appendArgs($return_to, $this->return_to_args); - - $redir_args = array( - 'openid.mode' => $mode, - 'openid.identity' => $this->endpoint->getServerID(), - 'openid.return_to' => $return_to, - 'openid.trust_root' => $trust_root); - - if ($this->assoc) { - $redir_args['openid.assoc_handle'] = $this->assoc->handle; - } - - $redir_args = array_merge($redir_args, $this->extra_args); - - return Auth_OpenID::appendArgs($this->endpoint->server_url, - $redir_args); - } + /** + * Initialize an authentication request with the specified token, + * association, and endpoint. + * + * Users of this library should not create instances of this + * class. Instances of this class are created by the library when + * needed. + */ + function Auth_OpenID_AuthRequest($assoc, $endpoint) + { + $this->assoc = $assoc; + $this->endpoint = $endpoint; + $this->extra_args = array(); + $this->return_to_args = array(); + } + + /** + * Add an extension argument to this OpenID authentication + * request. + * + * Use caution when adding arguments, because they will be + * URL-escaped and appended to the redirect URL, which can easily + * get quite long. + * + * @param string $namespace The namespace for the extension. For + * example, the simple registration extension uses the namespace + * 'sreg'. + * + * @param string $key The key within the extension namespace. For + * example, the nickname field in the simple registration + * extension's key is 'nickname'. + * + * @param string $value The value to provide to the server for + * this argument. + */ + function addExtensionArg($namespace, $key, $value) + { + $arg_name = implode('.', array('openid', $namespace, $key)); + $this->extra_args[$arg_name] = $value; + } + + /** + * Compute the appropriate redirection URL for this request based + * on a specified trust root and return-to. + * + * @param string $trust_root The trust root URI for your + * application. + * + * @param string$ $return_to The return-to URL to be used when the + * OpenID server redirects the user back to your site. + * + * @return string $redirect_url The resulting redirect URL that + * you should send to the user agent. + */ + function redirectURL($trust_root, $return_to, $immediate=false) + { + if ($immediate) { + $mode = 'checkid_immediate'; + } else { + $mode = 'checkid_setup'; + } + + $return_to = Auth_OpenID::appendArgs($return_to, $this->return_to_args); + + $redir_args = array( + 'openid.mode' => $mode, + 'openid.identity' => $this->endpoint->getServerID(), + 'openid.return_to' => $return_to, + 'openid.trust_root' => $trust_root); + + if ($this->assoc) { + $redir_args['openid.assoc_handle'] = $this->assoc->handle; + } + + $redir_args = array_merge($redir_args, $this->extra_args); + + return Auth_OpenID::appendArgs($this->endpoint->server_url, + $redir_args); + } } /** @@ -1022,7 +1022,7 @@ function redirectURL($trust_root, $return_to, $immediate=false) * @package OpenID */ class Auth_OpenID_ConsumerResponse { - var $status = null; + var $status = null; } /** @@ -1041,67 +1041,67 @@ class Auth_OpenID_ConsumerResponse { * @package OpenID */ class Auth_OpenID_SuccessResponse extends Auth_OpenID_ConsumerResponse { - var $status = Auth_OpenID_SUCCESS; - - /** - * @access private - */ - function Auth_OpenID_SuccessResponse($endpoint, $signed_args) - { - $this->endpoint = $endpoint; - $this->identity_url = $endpoint->identity_url; - $this->signed_args = $signed_args; - } - - /** - * @access private - */ - function fromQuery($endpoint, $query, $signed) - { - $signed_args = array(); - foreach (explode(",", $signed) as $field_name) { - $field_name = 'openid.' . $field_name; - $signed_args[$field_name] = Auth_OpenID::arrayGet($query, - $field_name, ''); - } - return new Auth_OpenID_SuccessResponse($endpoint, $signed_args); - } - - /** - * Extract signed extension data from the server's response. - * - * @param string $prefix The extension namespace from which to - * extract the extension data. - */ - function extensionResponse($prefix) - { - $response = array(); - $prefix = sprintf('openid.%s.', $prefix); - $prefix_len = strlen($prefix); - foreach ($this->signed_args as $k => $v) { - if (strpos($k, $prefix) === 0) { - $response_key = substr($k, $prefix_len); - $response[$response_key] = $v; - } - } - - return $response; - } - - /** - * Get the openid.return_to argument from this response. - * - * This is useful for verifying that this request was initiated by - * this consumer. - * - * @return string $return_to The return_to URL supplied to the - * server on the initial request, or null if the response did not - * contain an 'openid.return_to' argument. - */ - function getReturnTo() - { - return Auth_OpenID::arrayGet($this->signed_args, 'openid.return_to'); - } + var $status = Auth_OpenID_SUCCESS; + + /** + * @access private + */ + function Auth_OpenID_SuccessResponse($endpoint, $signed_args) + { + $this->endpoint = $endpoint; + $this->identity_url = $endpoint->identity_url; + $this->signed_args = $signed_args; + } + + /** + * @access private + */ + function fromQuery($endpoint, $query, $signed) + { + $signed_args = array(); + foreach (explode(",", $signed) as $field_name) { + $field_name = 'openid.' . $field_name; + $signed_args[$field_name] = Auth_OpenID::arrayGet($query, + $field_name, ''); + } + return new Auth_OpenID_SuccessResponse($endpoint, $signed_args); + } + + /** + * Extract signed extension data from the server's response. + * + * @param string $prefix The extension namespace from which to + * extract the extension data. + */ + function extensionResponse($prefix) + { + $response = array(); + $prefix = sprintf('openid.%s.', $prefix); + $prefix_len = strlen($prefix); + foreach ($this->signed_args as $k => $v) { + if (strpos($k, $prefix) === 0) { + $response_key = substr($k, $prefix_len); + $response[$response_key] = $v; + } + } + + return $response; + } + + /** + * Get the openid.return_to argument from this response. + * + * This is useful for verifying that this request was initiated by + * this consumer. + * + * @return string $return_to The return_to URL supplied to the + * server on the initial request, or null if the response did not + * contain an 'openid.return_to' argument. + */ + function getReturnTo() + { + return Auth_OpenID::arrayGet($this->signed_args, 'openid.return_to'); + } } /** @@ -1120,18 +1120,18 @@ function getReturnTo() * @package OpenID */ class Auth_OpenID_FailureResponse extends Auth_OpenID_ConsumerResponse { - var $status = Auth_OpenID_FAILURE; - - function Auth_OpenID_FailureResponse($endpoint, $message = null) - { - $this->endpoint = $endpoint; - if ($endpoint !== null) { - $this->identity_url = $endpoint->identity_url; - } else { - $this->identity_url = null; - } - $this->message = $message; - } + var $status = Auth_OpenID_FAILURE; + + function Auth_OpenID_FailureResponse($endpoint, $message = null) + { + $this->endpoint = $endpoint; + if ($endpoint !== null) { + $this->identity_url = $endpoint->identity_url; + } else { + $this->identity_url = null; + } + $this->message = $message; + } } /** @@ -1147,13 +1147,13 @@ function Auth_OpenID_FailureResponse($endpoint, $message = null) * @package OpenID */ class Auth_OpenID_CancelResponse extends Auth_OpenID_ConsumerResponse { - var $status = Auth_OpenID_CANCEL; + var $status = Auth_OpenID_CANCEL; - function Auth_OpenID_CancelResponse($endpoint) - { - $this->endpoint = $endpoint; - $this->identity_url = $endpoint->identity_url; - } + function Auth_OpenID_CancelResponse($endpoint) + { + $this->endpoint = $endpoint; + $this->identity_url = $endpoint->identity_url; + } } /** @@ -1174,15 +1174,13 @@ function Auth_OpenID_CancelResponse($endpoint) * @package OpenID */ class Auth_OpenID_SetupNeededResponse extends Auth_OpenID_ConsumerResponse { - var $status = Auth_OpenID_SETUP_NEEDED; - - function Auth_OpenID_SetupNeededResponse($endpoint, - $setup_url = null) - { - $this->endpoint = $endpoint; - $this->identity_url = $endpoint->identity_url; - $this->setup_url = $setup_url; - } -} - -?> + var $status = Auth_OpenID_SETUP_NEEDED; + + function Auth_OpenID_SetupNeededResponse($endpoint, + $setup_url = null) + { + $this->endpoint = $endpoint; + $this->identity_url = $endpoint->identity_url; + $this->setup_url = $setup_url; + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/CryptUtil.php b/libraries/openid/Auth/OpenID/CryptUtil.php index 699c09daa30b6..801ec1d6f74f7 100644 --- a/libraries/openid/Auth/OpenID/CryptUtil.php +++ b/libraries/openid/Auth/OpenID/CryptUtil.php @@ -18,94 +18,92 @@ */ if (!defined('Auth_OpenID_RAND_SOURCE')) { - /** - * The filename for a source of random bytes. Define this yourself - * if you have a different source of randomness. - */ - define('Auth_OpenID_RAND_SOURCE', '/dev/urandom'); + /** + * The filename for a source of random bytes. Define this yourself + * if you have a different source of randomness. + */ + define('Auth_OpenID_RAND_SOURCE', '/dev/urandom'); } class Auth_OpenID_CryptUtil { - /** - * Get the specified number of random bytes. - * - * Attempts to use a cryptographically secure (not predictable) - * source of randomness if available. If there is no high-entropy - * randomness source available, it will fail. As a last resort, - * for non-critical systems, define - * Auth_OpenID_RAND_SOURCE as null, and - * the code will fall back on a pseudo-random number generator. - * - * @param int $num_bytes The length of the return value - * @return string $bytes random bytes - */ - function getBytes($num_bytes) - { - static $f = null; - $bytes = ''; - if ($f === null) { - if (Auth_OpenID_RAND_SOURCE === null) { - $f = false; - } else { - $f = @fopen(Auth_OpenID_RAND_SOURCE, "r"); - if ($f === false) { - $msg = 'Define Auth_OpenID_RAND_SOURCE as null to ' . - ' continue with an insecure random number generator.'; - trigger_error($msg, E_USER_ERROR); - } - } - } - if ($f === false) { - // pseudorandom used - $bytes = ''; - for ($i = 0; $i < $num_bytes; $i += 4) { - $bytes .= pack('L', mt_rand()); - } - $bytes = substr($bytes, 0, $num_bytes); - } else { - $bytes = fread($f, $num_bytes); - } - return $bytes; - } + /** + * Get the specified number of random bytes. + * + * Attempts to use a cryptographically secure (not predictable) + * source of randomness if available. If there is no high-entropy + * randomness source available, it will fail. As a last resort, + * for non-critical systems, define + * Auth_OpenID_RAND_SOURCE as null, and + * the code will fall back on a pseudo-random number generator. + * + * @param int $num_bytes The length of the return value + * @return string $bytes random bytes + */ + function getBytes($num_bytes) + { + static $f = null; + $bytes = ''; + if ($f === null) { + if (Auth_OpenID_RAND_SOURCE === null) { + $f = false; + } else { + $f = @fopen(Auth_OpenID_RAND_SOURCE, "r"); + if ($f === false) { + $msg = 'Define Auth_OpenID_RAND_SOURCE as null to ' . + ' continue with an insecure random number generator.'; + trigger_error($msg, E_USER_ERROR); + } + } + } + if ($f === false) { + // pseudorandom used + $bytes = ''; + for ($i = 0; $i < $num_bytes; $i += 4) { + $bytes .= pack('L', mt_rand()); + } + $bytes = substr($bytes, 0, $num_bytes); + } else { + $bytes = fread($f, $num_bytes); + } + return $bytes; + } - /** - * Produce a string of length random bytes, chosen from chrs. If - * $chrs is null, the resulting string may contain any characters. - * - * @param integer $length The length of the resulting - * randomly-generated string - * @param string $chrs A string of characters from which to choose - * to build the new string - * @return string $result A string of randomly-chosen characters - * from $chrs - */ - function randomString($length, $population = null) - { - if ($population === null) { - return Auth_OpenID_CryptUtil::getBytes($length); - } + /** + * Produce a string of length random bytes, chosen from chrs. If + * $chrs is null, the resulting string may contain any characters. + * + * @param integer $length The length of the resulting + * randomly-generated string + * @param string $chrs A string of characters from which to choose + * to build the new string + * @return string $result A string of randomly-chosen characters + * from $chrs + */ + function randomString($length, $population = null) + { + if ($population === null) { + return Auth_OpenID_CryptUtil::getBytes($length); + } - $popsize = strlen($population); + $popsize = strlen($population); - if ($popsize > 256) { - $msg = 'More than 256 characters supplied to ' . __FUNCTION__; - trigger_error($msg, E_USER_ERROR); - } + if ($popsize > 256) { + $msg = 'More than 256 characters supplied to ' . __FUNCTION__; + trigger_error($msg, E_USER_ERROR); + } - $duplicate = 256 % $popsize; + $duplicate = 256 % $popsize; - $str = ""; - for ($i = 0; $i < $length; $i++) { - do { - $n = ord(Auth_OpenID_CryptUtil::getBytes(1)); - } while ($n < $duplicate); + $str = ""; + for ($i = 0; $i < $length; $i++) { + do { + $n = ord(Auth_OpenID_CryptUtil::getBytes(1)); + } while ($n < $duplicate); - $n %= $popsize; - $str .= $population[$n]; - } + $n %= $popsize; + $str .= $population[$n]; + } - return $str; - } -} - -?> \ No newline at end of file + return $str; + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/DatabaseConnection.php b/libraries/openid/Auth/OpenID/DatabaseConnection.php index 3f4515fa59bce..4b04314d839b6 100644 --- a/libraries/openid/Auth/OpenID/DatabaseConnection.php +++ b/libraries/openid/Auth/OpenID/DatabaseConnection.php @@ -23,109 +23,107 @@ * @package OpenID */ class Auth_OpenID_DatabaseConnection { - /** - * Sets auto-commit mode on this database connection. - * - * @param bool $mode True if auto-commit is to be used; false if - * not. - */ - function autoCommit($mode) - { - } + /** + * Sets auto-commit mode on this database connection. + * + * @param bool $mode True if auto-commit is to be used; false if + * not. + */ + function autoCommit($mode) + { + } - /** - * Run an SQL query with the specified parameters, if any. - * - * @param string $sql An SQL string with placeholders. The - * placeholders are assumed to be specific to the database engine - * for this connection. - * - * @param array $params An array of parameters to insert into the - * SQL string using this connection's escaping mechanism. - * - * @return mixed $result The result of calling this connection's - * internal query function. The type of result depends on the - * underlying database engine. This method is usually used when - * the result of a query is not important, like a DDL query. - */ - function query($sql, $params = array()) - { - } + /** + * Run an SQL query with the specified parameters, if any. + * + * @param string $sql An SQL string with placeholders. The + * placeholders are assumed to be specific to the database engine + * for this connection. + * + * @param array $params An array of parameters to insert into the + * SQL string using this connection's escaping mechanism. + * + * @return mixed $result The result of calling this connection's + * internal query function. The type of result depends on the + * underlying database engine. This method is usually used when + * the result of a query is not important, like a DDL query. + */ + function query($sql, $params = array()) + { + } - /** - * Starts a transaction on this connection, if supported. - */ - function begin() - { - } + /** + * Starts a transaction on this connection, if supported. + */ + function begin() + { + } - /** - * Commits a transaction on this connection, if supported. - */ - function commit() - { - } + /** + * Commits a transaction on this connection, if supported. + */ + function commit() + { + } - /** - * Performs a rollback on this connection, if supported. - */ - function rollback() - { - } + /** + * Performs a rollback on this connection, if supported. + */ + function rollback() + { + } - /** - * Run an SQL query and return the first column of the first row - * of the result set, if any. - * - * @param string $sql An SQL string with placeholders. The - * placeholders are assumed to be specific to the database engine - * for this connection. - * - * @param array $params An array of parameters to insert into the - * SQL string using this connection's escaping mechanism. - * - * @return mixed $result The value of the first column of the - * first row of the result set. False if no such result was - * found. - */ - function getOne($sql, $params = array()) - { - } + /** + * Run an SQL query and return the first column of the first row + * of the result set, if any. + * + * @param string $sql An SQL string with placeholders. The + * placeholders are assumed to be specific to the database engine + * for this connection. + * + * @param array $params An array of parameters to insert into the + * SQL string using this connection's escaping mechanism. + * + * @return mixed $result The value of the first column of the + * first row of the result set. False if no such result was + * found. + */ + function getOne($sql, $params = array()) + { + } - /** - * Run an SQL query and return the first row of the result set, if - * any. - * - * @param string $sql An SQL string with placeholders. The - * placeholders are assumed to be specific to the database engine - * for this connection. - * - * @param array $params An array of parameters to insert into the - * SQL string using this connection's escaping mechanism. - * - * @return array $result The first row of the result set, if any, - * keyed on column name. False if no such result was found. - */ - function getRow($sql, $params = array()) - { - } + /** + * Run an SQL query and return the first row of the result set, if + * any. + * + * @param string $sql An SQL string with placeholders. The + * placeholders are assumed to be specific to the database engine + * for this connection. + * + * @param array $params An array of parameters to insert into the + * SQL string using this connection's escaping mechanism. + * + * @return array $result The first row of the result set, if any, + * keyed on column name. False if no such result was found. + */ + function getRow($sql, $params = array()) + { + } - /** - * Run an SQL query with the specified parameters, if any. - * - * @param string $sql An SQL string with placeholders. The - * placeholders are assumed to be specific to the database engine - * for this connection. - * - * @param array $params An array of parameters to insert into the - * SQL string using this connection's escaping mechanism. - * - * @return array $result An array of arrays representing the - * result of the query; each array is keyed on column name. - */ - function getAll($sql, $params = array()) - { - } -} - -?> \ No newline at end of file + /** + * Run an SQL query with the specified parameters, if any. + * + * @param string $sql An SQL string with placeholders. The + * placeholders are assumed to be specific to the database engine + * for this connection. + * + * @param array $params An array of parameters to insert into the + * SQL string using this connection's escaping mechanism. + * + * @return array $result An array of arrays representing the + * result of the query; each array is keyed on column name. + */ + function getAll($sql, $params = array()) + { + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/DiffieHellman.php b/libraries/openid/Auth/OpenID/DiffieHellman.php index ea7da1e891a57..422e5191b69a8 100644 --- a/libraries/openid/Auth/OpenID/DiffieHellman.php +++ b/libraries/openid/Auth/OpenID/DiffieHellman.php @@ -21,18 +21,18 @@ function Auth_OpenID_getDefaultMod() { - return '155172898181473697471232257763715539915724801'. - '966915404479707795314057629378541917580651227423'. - '698188993727816152646631438561595825688188889951'. - '272158842675419950341258706556549803580104870537'. - '681476726513255747040765857479291291572334510643'. - '245094715007229621094194349783925984760375594985'. - '848253359305585439638443'; + return '155172898181473697471232257763715539915724801'. + '966915404479707795314057629378541917580651227423'. + '698188993727816152646631438561595825688188889951'. + '272158842675419950341258706556549803580104870537'. + '681476726513255747040765857479291291572334510643'. + '245094715007229621094194349783925984760375594985'. + '848253359305585439638443'; } function Auth_OpenID_getDefaultGen() { - return '2'; + return '2'; } /** @@ -44,140 +44,140 @@ function Auth_OpenID_getDefaultGen() */ class Auth_OpenID_DiffieHellman { - var $mod; - var $gen; - var $private; - var $lib = null; - - function Auth_OpenID_DiffieHellman($mod = null, $gen = null, - $private = null, $lib = null) - { - if ($lib === null) { - $this->lib =& Auth_OpenID_getMathLib(); - } else { - $this->lib =& $lib; - } - - if ($mod === null) { - $this->mod = $this->lib->init(Auth_OpenID_getDefaultMod()); - } else { - $this->mod = $mod; - } - - if ($gen === null) { - $this->gen = $this->lib->init(Auth_OpenID_getDefaultGen()); - } else { - $this->gen = $gen; - } - - if ($private === null) { - $r = $this->lib->rand($this->mod); - $this->private = $this->lib->add($r, 1); - } else { - $this->private = $private; - } - - $this->public = $this->lib->powmod($this->gen, $this->private, - $this->mod); - } - - function getSharedSecret($composite) - { - return $this->lib->powmod($composite, $this->private, $this->mod); - } - - function getPublicKey() - { - return $this->public; - } - - /** - * Generate the arguments for an OpenID Diffie-Hellman association - * request - */ - function getAssocArgs() - { - $cpub = $this->lib->longToBase64($this->getPublicKey()); - $args = array( - 'openid.dh_consumer_public' => $cpub, - 'openid.session_type' => 'DH-SHA1' - ); - - if ($this->lib->cmp($this->mod, Auth_OpenID_getDefaultMod()) || - $this->lib->cmp($this->gen, Auth_OpenID_getDefaultGen())) { - $args['openid.dh_modulus'] = $this->lib->longToBase64($this->mod); - $args['openid.dh_gen'] = $this->lib->longToBase64($this->gen); - } - - return $args; - } - - function usingDefaultValues() - { - return ($this->mod == Auth_OpenID_getDefaultMod() && - $this->gen == Auth_OpenID_getDefaultGen()); - } - - /** - * Perform the server side of the OpenID Diffie-Hellman association - */ - function serverAssociate($consumer_args, $assoc_secret) - { - $lib =& Auth_OpenID_getMathLib(); - - if (isset($consumer_args['openid.dh_modulus'])) { - $mod = $lib->base64ToLong($consumer_args['openid.dh_modulus']); - } else { - $mod = null; - } - - if (isset($consumer_args['openid.dh_gen'])) { - $gen = $lib->base64ToLong($consumer_args['openid.dh_gen']); - } else { - $gen = null; - } - - $cpub64 = @$consumer_args['openid.dh_consumer_public']; - if (!isset($cpub64)) { - return false; - } - - $dh = new Auth_OpenID_DiffieHellman($mod, $gen); - $cpub = $lib->base64ToLong($cpub64); - $mac_key = $dh->xorSecret($cpub, $assoc_secret); - $enc_mac_key = base64_encode($mac_key); - $spub64 = $lib->longToBase64($dh->getPublicKey()); - - $server_args = array( - 'session_type' => 'DH-SHA1', - 'dh_server_public' => $spub64, - 'enc_mac_key' => $enc_mac_key - ); - - return $server_args; - } - - function consumerFinish($reply) - { - $spub = $this->lib->base64ToLong($reply['dh_server_public']); - if ($this->lib->cmp($spub, 0) <= 0) { - return false; - } - $enc_mac_key = base64_decode($reply['enc_mac_key']); - return $this->xorSecret($spub, $enc_mac_key); - } - - function xorSecret($composite, $secret) - { - $dh_shared = $this->getSharedSecret($composite); - $dh_shared_str = $this->lib->longToBinary($dh_shared); - $sha1_dh_shared = Auth_OpenID_SHA1($dh_shared_str); - - $xsecret = ""; - for ($i = 0; $i < strlen($secret); $i++) { - $xsecret .= chr(ord($secret[$i]) ^ ord($sha1_dh_shared[$i])); - } - - return $xsecret; - } + var $mod; + var $gen; + var $private; + var $lib = null; + + function Auth_OpenID_DiffieHellman($mod = null, $gen = null, + $private = null, $lib = null) + { + if ($lib === null) { + $this->lib =& Auth_OpenID_getMathLib(); + } else { + $this->lib =& $lib; + } + + if ($mod === null) { + $this->mod = $this->lib->init(Auth_OpenID_getDefaultMod()); + } else { + $this->mod = $mod; + } + + if ($gen === null) { + $this->gen = $this->lib->init(Auth_OpenID_getDefaultGen()); + } else { + $this->gen = $gen; + } + + if ($private === null) { + $r = $this->lib->rand($this->mod); + $this->private = $this->lib->add($r, 1); + } else { + $this->private = $private; + } + + $this->public = $this->lib->powmod($this->gen, $this->private, + $this->mod); + } + + function getSharedSecret($composite) + { + return $this->lib->powmod($composite, $this->private, $this->mod); + } + + function getPublicKey() + { + return $this->public; + } + + /** + * Generate the arguments for an OpenID Diffie-Hellman association + * request + */ + function getAssocArgs() + { + $cpub = $this->lib->longToBase64($this->getPublicKey()); + $args = array( + 'openid.dh_consumer_public' => $cpub, + 'openid.session_type' => 'DH-SHA1' + ); + + if ($this->lib->cmp($this->mod, Auth_OpenID_getDefaultMod()) || + $this->lib->cmp($this->gen, Auth_OpenID_getDefaultGen())) { + $args['openid.dh_modulus'] = $this->lib->longToBase64($this->mod); + $args['openid.dh_gen'] = $this->lib->longToBase64($this->gen); + } + + return $args; + } + + function usingDefaultValues() + { + return ($this->mod == Auth_OpenID_getDefaultMod() && + $this->gen == Auth_OpenID_getDefaultGen()); + } + + /** + * Perform the server side of the OpenID Diffie-Hellman association + */ + function serverAssociate($consumer_args, $assoc_secret) + { + $lib =& Auth_OpenID_getMathLib(); + + if (isset($consumer_args['openid.dh_modulus'])) { + $mod = $lib->base64ToLong($consumer_args['openid.dh_modulus']); + } else { + $mod = null; + } + + if (isset($consumer_args['openid.dh_gen'])) { + $gen = $lib->base64ToLong($consumer_args['openid.dh_gen']); + } else { + $gen = null; + } + + $cpub64 = @$consumer_args['openid.dh_consumer_public']; + if (!isset($cpub64)) { + return false; + } + + $dh = new Auth_OpenID_DiffieHellman($mod, $gen); + $cpub = $lib->base64ToLong($cpub64); + $mac_key = $dh->xorSecret($cpub, $assoc_secret); + $enc_mac_key = base64_encode($mac_key); + $spub64 = $lib->longToBase64($dh->getPublicKey()); + + $server_args = array( + 'session_type' => 'DH-SHA1', + 'dh_server_public' => $spub64, + 'enc_mac_key' => $enc_mac_key + ); + + return $server_args; + } + + function consumerFinish($reply) + { + $spub = $this->lib->base64ToLong($reply['dh_server_public']); + if ($this->lib->cmp($spub, 0) <= 0) { + return false; + } + $enc_mac_key = base64_decode($reply['enc_mac_key']); + return $this->xorSecret($spub, $enc_mac_key); + } + + function xorSecret($composite, $secret) + { + $dh_shared = $this->getSharedSecret($composite); + $dh_shared_str = $this->lib->longToBinary($dh_shared); + $sha1_dh_shared = Auth_OpenID_SHA1($dh_shared_str); + + $xsecret = ""; + for ($i = 0; $i < strlen($secret); $i++) { + $xsecret .= chr(ord($secret[$i]) ^ ord($sha1_dh_shared[$i])); + } + + return $xsecret; + } } diff --git a/libraries/openid/Auth/OpenID/Discover.php b/libraries/openid/Auth/OpenID/Discover.php index 26d8d0ba65bec..0e929b53c591a 100644 --- a/libraries/openid/Auth/OpenID/Discover.php +++ b/libraries/openid/Auth/OpenID/Discover.php @@ -20,241 +20,241 @@ * Object representing an OpenID service endpoint. */ class Auth_OpenID_ServiceEndpoint { - function Auth_OpenID_ServiceEndpoint() - { - $this->identity_url = null; - $this->server_url = null; - $this->type_uris = array(); - $this->delegate = null; - $this->canonicalID = null; - $this->used_yadis = false; // whether this came from an XRDS - } - - function usesExtension($extension_uri) - { - return in_array($extension_uri, $this->type_uris); - } - - function parseService($yadis_url, $uri, $type_uris, $service_element) - { - // Set the state of this object based on the contents of the - // service element. - $this->type_uris = $type_uris; - $this->identity_url = $yadis_url; - $this->server_url = $uri; - $this->delegate = Auth_OpenID_ServiceEndpoint::findDelegate( - $service_element); - $this->used_yadis = true; - } - - function findDelegate($service) - { - // Extract a openid:Delegate value from a Yadis Service - // element. If no delegate is found, returns null. - - // Try to register new namespace. - $service->parser->registerNamespace('openid', - 'http://openid.net/xmlns/1.0'); - - // XXX: should this die if there is more than one delegate - // element? - $delegates = $service->getElements("openid:Delegate"); - - if ($delegates) { - return $service->parser->content($delegates[0]); - } else { - return null; - } - } - - function getServerID() - { - // Return the identifier that should be sent as the - // openid.identity_url parameter to the server. - if ($this->delegate === null) { - if ($this->canonicalID) { - return $this->canonicalID; - } else { - return $this->identity_url; - } - } else { - return $this->delegate; - } - } - - function fromHTML($uri, $html) - { - // Parse the given document as HTML looking for an OpenID - $urls = Auth_OpenID_legacy_discover($html); - if ($urls === false) { - return null; - } - - list($delegate_url, $server_url) = $urls; - - $service = new Auth_OpenID_ServiceEndpoint(); - $service->identity_url = $uri; - $service->delegate = $delegate_url; - $service->server_url = $server_url; - $service->type_uris = array(_OPENID_1_0_TYPE); - return $service; - } + function Auth_OpenID_ServiceEndpoint() + { + $this->identity_url = null; + $this->server_url = null; + $this->type_uris = array(); + $this->delegate = null; + $this->canonicalID = null; + $this->used_yadis = false; // whether this came from an XRDS + } + + function usesExtension($extension_uri) + { + return in_array($extension_uri, $this->type_uris); + } + + function parseService($yadis_url, $uri, $type_uris, $service_element) + { + // Set the state of this object based on the contents of the + // service element. + $this->type_uris = $type_uris; + $this->identity_url = $yadis_url; + $this->server_url = $uri; + $this->delegate = Auth_OpenID_ServiceEndpoint::findDelegate( + $service_element); + $this->used_yadis = true; + } + + function findDelegate($service) + { + // Extract a openid:Delegate value from a Yadis Service + // element. If no delegate is found, returns null. + + // Try to register new namespace. + $service->parser->registerNamespace('openid', + 'http://openid.net/xmlns/1.0'); + + // XXX: should this die if there is more than one delegate + // element? + $delegates = $service->getElements("openid:Delegate"); + + if ($delegates) { + return $service->parser->content($delegates[0]); + } else { + return null; + } + } + + function getServerID() + { + // Return the identifier that should be sent as the + // openid.identity_url parameter to the server. + if ($this->delegate === null) { + if ($this->canonicalID) { + return $this->canonicalID; + } else { + return $this->identity_url; + } + } else { + return $this->delegate; + } + } + + function fromHTML($uri, $html) + { + // Parse the given document as HTML looking for an OpenID + $urls = Auth_OpenID_legacy_discover($html); + if ($urls === false) { + return null; + } + + list($delegate_url, $server_url) = $urls; + + $service = new Auth_OpenID_ServiceEndpoint(); + $service->identity_url = $uri; + $service->delegate = $delegate_url; + $service->server_url = $server_url; + $service->type_uris = array(_OPENID_1_0_TYPE); + return $service; + } } function filter_MatchesAnyOpenIDType(&$service) { - $uris = $service->getTypes(); - - foreach ($uris as $uri) { - if (in_array($uri, - array(_OPENID_1_0_TYPE, - _OPENID_1_1_TYPE, - _OPENID_1_2_TYPE))) { - return true; - } - } - - return false; + $uris = $service->getTypes(); + + foreach ($uris as $uri) { + if (in_array($uri, + array(_OPENID_1_0_TYPE, + _OPENID_1_1_TYPE, + _OPENID_1_2_TYPE))) { + return true; + } + } + + return false; } function Auth_OpenID_makeOpenIDEndpoints($uri, $endpoints) { - $s = array(); - - if (!$endpoints) { - return $s; - } - - foreach ($endpoints as $service) { - $type_uris = $service->getTypes(); - $uris = $service->getURIs(); - - // If any Type URIs match and there is an endpoint URI - // specified, then this is an OpenID endpoint - if ($type_uris && - $uris) { - - foreach ($uris as $service_uri) { - $openid_endpoint = new Auth_OpenID_ServiceEndpoint(); - $openid_endpoint->parseService($uri, - $service_uri, - $type_uris, - $service); - - $s[] = $openid_endpoint; - } - } - } - - return $s; + $s = array(); + + if (!$endpoints) { + return $s; + } + + foreach ($endpoints as $service) { + $type_uris = $service->getTypes(); + $uris = $service->getURIs(); + + // If any Type URIs match and there is an endpoint URI + // specified, then this is an OpenID endpoint + if ($type_uris && + $uris) { + + foreach ($uris as $service_uri) { + $openid_endpoint = new Auth_OpenID_ServiceEndpoint(); + $openid_endpoint->parseService($uri, + $service_uri, + $type_uris, + $service); + + $s[] = $openid_endpoint; + } + } + } + + return $s; } function Auth_OpenID_discoverWithYadis($uri, &$fetcher) { - // Discover OpenID services for a URI. Tries Yadis and falls back - // on old-style discovery if Yadis fails. - - // Might raise a yadis.discover.DiscoveryFailure if no document - // came back for that URI at all. I don't think falling back to - // OpenID 1.0 discovery on the same URL will help, so don't bother - // to catch it. - $openid_services = array(); - - $http_response = null; - $response = Services_Yadis_Yadis::discover($uri, $http_response, - $fetcher); - - if ($response) { - $identity_url = $response->uri; - $openid_services = - $response->xrds->services(array('filter_MatchesAnyOpenIDType')); - } - - if (!$openid_services) { - return @Auth_OpenID_discoverWithoutYadis($uri, - $fetcher); - } - - if (!$openid_services) { - $body = $response->body; - - // Try to parse the response as HTML to get OpenID 1.0/1.1 - // - $service = Auth_OpenID_ServiceEndpoint::fromHTML($identity_url, - $body); - - if ($service !== null) { - $openid_services = array($service); - } - } else { - $openid_services = Auth_OpenID_makeOpenIDEndpoints($response->uri, - $openid_services); - } - - return array($identity_url, $openid_services, $http_response); + // Discover OpenID services for a URI. Tries Yadis and falls back + // on old-style discovery if Yadis fails. + + // Might raise a yadis.discover.DiscoveryFailure if no document + // came back for that URI at all. I don't think falling back to + // OpenID 1.0 discovery on the same URL will help, so don't bother + // to catch it. + $openid_services = array(); + + $http_response = null; + $response = Services_Yadis_Yadis::discover($uri, $http_response, + $fetcher); + + if ($response) { + $identity_url = $response->uri; + $openid_services = + $response->xrds->services(array('filter_MatchesAnyOpenIDType')); + } + + if (!$openid_services) { + return @Auth_OpenID_discoverWithoutYadis($uri, + $fetcher); + } + + if (!$openid_services) { + $body = $response->body; + + // Try to parse the response as HTML to get OpenID 1.0/1.1 + // + $service = Auth_OpenID_ServiceEndpoint::fromHTML($identity_url, + $body); + + if ($service !== null) { + $openid_services = array($service); + } + } else { + $openid_services = Auth_OpenID_makeOpenIDEndpoints($response->uri, + $openid_services); + } + + return array($identity_url, $openid_services, $http_response); } function _Auth_OpenID_discoverServiceList($uri, &$fetcher) { - list($url, $services, $resp) = Auth_OpenID_discoverWithYadis($uri, - $fetcher); + list($url, $services, $resp) = Auth_OpenID_discoverWithYadis($uri, + $fetcher); - return $services; + return $services; } function _Auth_OpenID_discoverXRIServiceList($uri, &$fetcher) { - list($url, $services, $resp) = _Auth_OpenID_discoverXRI($uri, - $fetcher); - return $services; + list($url, $services, $resp) = _Auth_OpenID_discoverXRI($uri, + $fetcher); + return $services; } function Auth_OpenID_discoverWithoutYadis($uri, &$fetcher) { - $http_resp = @$fetcher->get($uri); + $http_resp = @$fetcher->get($uri); - if ($http_resp->status != 200) { - return array(null, array(), $http_resp); - } + if ($http_resp->status != 200) { + return array(null, array(), $http_resp); + } - $identity_url = $http_resp->final_url; + $identity_url = $http_resp->final_url; - // Try to parse the response as HTML to get OpenID 1.0/1.1 - $endpoint =& new Auth_OpenID_ServiceEndpoint(); - $service = $endpoint->fromHTML($identity_url, $http_resp->body); - if ($service === null) { - $openid_services = array(); - } else { - $openid_services = array($service); - } + // Try to parse the response as HTML to get OpenID 1.0/1.1 + $endpoint =& new Auth_OpenID_ServiceEndpoint(); + $service = $endpoint->fromHTML($identity_url, $http_resp->body); + if ($service === null) { + $openid_services = array(); + } else { + $openid_services = array($service); + } - return array($identity_url, $openid_services, $http_resp); + return array($identity_url, $openid_services, $http_resp); } function _Auth_OpenID_discoverXRI($iname, &$fetcher) { - $services = new Services_Yadis_ProxyResolver($fetcher); - list($canonicalID, $service_list) = $services->query($iname, - array(_OPENID_1_0_TYPE, - _OPENID_1_1_TYPE, - _OPENID_1_2_TYPE), - array('filter_MatchesAnyOpenIDType')); + $services = new Services_Yadis_ProxyResolver($fetcher); + list($canonicalID, $service_list) = $services->query($iname, + array(_OPENID_1_0_TYPE, + _OPENID_1_1_TYPE, + _OPENID_1_2_TYPE), + array('filter_MatchesAnyOpenIDType')); - $endpoints = Auth_OpenID_makeOpenIDEndpoints($iname, $service_list); + $endpoints = Auth_OpenID_makeOpenIDEndpoints($iname, $service_list); - for ($i = 0; $i < count($endpoints); $i++) { - $endpoints[$i]->canonicalID = $canonicalID; - } + for ($i = 0; $i < count($endpoints); $i++) { + $endpoints[$i]->canonicalID = $canonicalID; + } - // FIXME: returned xri should probably be in some normal form - return array($iname, $endpoints, null); + // FIXME: returned xri should probably be in some normal form + return array($iname, $endpoints, null); } function Auth_OpenID_discover($uri, &$fetcher) { - return @Auth_OpenID_discoverWithYadis($uri, $fetcher); + return @Auth_OpenID_discoverWithYadis($uri, $fetcher); } ?> \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/DumbStore.php b/libraries/openid/Auth/OpenID/DumbStore.php index 2ef7868192177..cceff42965288 100644 --- a/libraries/openid/Auth/OpenID/DumbStore.php +++ b/libraries/openid/Auth/OpenID/DumbStore.php @@ -35,84 +35,82 @@ */ class Auth_OpenID_DumbStore extends Auth_OpenID_OpenIDStore { - /** - * Creates a new {@link Auth_OpenID_DumbStore} instance. For the security - * of the tokens generated by the library, this class attempts to - * at least have a secure implementation of getAuthKey. - * - * When you create an instance of this class, pass in a secret - * phrase. The phrase is hashed with sha1 to make it the correct - * length and form for an auth key. That allows you to use a long - * string as the secret phrase, which means you can make it very - * difficult to guess. - * - * Each {@link Auth_OpenID_DumbStore} instance that is created for use by - * your consumer site needs to use the same $secret_phrase. - * - * @param string secret_phrase The phrase used to create the auth - * key returned by getAuthKey - */ - function Auth_OpenID_DumbStore($secret_phrase) - { - $this->auth_key = Auth_OpenID_SHA1($secret_phrase); - } + /** + * Creates a new {@link Auth_OpenID_DumbStore} instance. For the security + * of the tokens generated by the library, this class attempts to + * at least have a secure implementation of getAuthKey. + * + * When you create an instance of this class, pass in a secret + * phrase. The phrase is hashed with sha1 to make it the correct + * length and form for an auth key. That allows you to use a long + * string as the secret phrase, which means you can make it very + * difficult to guess. + * + * Each {@link Auth_OpenID_DumbStore} instance that is created for use by + * your consumer site needs to use the same $secret_phrase. + * + * @param string secret_phrase The phrase used to create the auth + * key returned by getAuthKey + */ + function Auth_OpenID_DumbStore($secret_phrase) + { + $this->auth_key = Auth_OpenID_SHA1($secret_phrase); + } - /** - * This implementation does nothing. - */ - function storeAssociation($server_url, $association) - { - } + /** + * This implementation does nothing. + */ + function storeAssociation($server_url, $association) + { + } - /** - * This implementation always returns null. - */ - function getAssociation($server_url, $handle = null) - { - return null; - } + /** + * This implementation always returns null. + */ + function getAssociation($server_url, $handle = null) + { + return null; + } - /** - * This implementation always returns false. - */ - function removeAssociation($server_url, $handle) - { - return false; - } + /** + * This implementation always returns false. + */ + function removeAssociation($server_url, $handle) + { + return false; + } - /** - * This implementation does nothing. - */ - function storeNonce($nonce) - { - } + /** + * This implementation does nothing. + */ + function storeNonce($nonce) + { + } - /** - * In a system truly limited to dumb mode, nonces must all be - * accepted. This therefore always returns true, which makes - * replay attacks feasible. - */ - function useNonce($nonce) - { - return true; - } + /** + * In a system truly limited to dumb mode, nonces must all be + * accepted. This therefore always returns true, which makes + * replay attacks feasible. + */ + function useNonce($nonce) + { + return true; + } - /** - * This method returns the auth key generated by the constructor. - */ - function getAuthKey() - { - return $this->auth_key; - } + /** + * This method returns the auth key generated by the constructor. + */ + function getAuthKey() + { + return $this->auth_key; + } - /** - * This store is a dumb mode store, so this method is overridden - * to return true. - */ - function isDumb() - { - return true; - } -} - -?> \ No newline at end of file + /** + * This store is a dumb mode store, so this method is overridden + * to return true. + */ + function isDumb() + { + return true; + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/FileStore.php b/libraries/openid/Auth/OpenID/FileStore.php index 61bcc09749337..9acc3d1966187 100644 --- a/libraries/openid/Auth/OpenID/FileStore.php +++ b/libraries/openid/Auth/OpenID/FileStore.php @@ -40,637 +40,635 @@ */ class Auth_OpenID_FileStore extends Auth_OpenID_OpenIDStore { - /** - * Initializes a new {@link Auth_OpenID_FileStore}. This - * initializes the nonce and association directories, which are - * subdirectories of the directory passed in. - * - * @param string $directory This is the directory to put the store - * directories in. - */ - function Auth_OpenID_FileStore($directory) - { - if (!Auth_OpenID::ensureDir($directory)) { - trigger_error('Not a directory and failed to create: ' - . $directory, E_USER_ERROR); - } - $directory = realpath($directory); - - $this->directory = $directory; - $this->active = true; - - $this->nonce_dir = $directory . DIRECTORY_SEPARATOR . 'nonces'; - - $this->association_dir = $directory . DIRECTORY_SEPARATOR . - 'associations'; - - // Temp dir must be on the same filesystem as the assciations - // $directory and the $directory containing the auth key file. - $this->temp_dir = $directory . DIRECTORY_SEPARATOR . 'temp'; - - $this->auth_key_name = $directory . DIRECTORY_SEPARATOR . 'auth_key'; - - $this->max_nonce_age = 6 * 60 * 60; // Six hours, in seconds - - if (!$this->_setup()) { - trigger_error('Failed to initialize OpenID file store in ' . - $directory, E_USER_ERROR); - } - } - - function destroy() - { - Auth_OpenID_FileStore::_rmtree($this->directory); - $this->active = false; - } - - /** - * Make sure that the directories in which we store our data - * exist. - * - * @access private - */ - function _setup() - { - return (Auth_OpenID::ensureDir(dirname($this->auth_key_name)) && - Auth_OpenID::ensureDir($this->nonce_dir) && - Auth_OpenID::ensureDir($this->association_dir) && - Auth_OpenID::ensureDir($this->temp_dir)); - } - - /** - * Create a temporary file on the same filesystem as - * $this->auth_key_name and $this->association_dir. - * - * The temporary directory should not be cleaned if there are any - * processes using the store. If there is no active process using - * the store, it is safe to remove all of the files in the - * temporary directory. - * - * @return array ($fd, $filename) - * @access private - */ - function _mktemp() - { - $name = Auth_OpenID_FileStore::_mkstemp($dir = $this->temp_dir); - $file_obj = @fopen($name, 'wb'); - if ($file_obj !== false) { - return array($file_obj, $name); - } else { - Auth_OpenID_FileStore::_removeIfPresent($name); - } - } - - /** - * Read the auth key from the auth key file. Will return None if - * there is currently no key. - * - * @return mixed - */ - function readAuthKey() - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return null; - } - - $auth_key_file = @fopen($this->auth_key_name, 'rb'); - if ($auth_key_file === false) { - return null; - } - - $key = fread($auth_key_file, filesize($this->auth_key_name)); - fclose($auth_key_file); - - return $key; - } - - /** - * Generate a new random auth key and safely store it in the - * location specified by $this->auth_key_name. - * - * @return string $key - */ - function createAuthKey() - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return null; - } - - $auth_key = Auth_OpenID_CryptUtil::randomString($this->AUTH_KEY_LEN); - - list($file_obj, $tmp) = $this->_mktemp(); - - fwrite($file_obj, $auth_key); - fflush($file_obj); - fclose($file_obj); - - if (function_exists('link')) { - // Posix filesystem - $saved = link($tmp, $this->auth_key_name); - Auth_OpenID_FileStore::_removeIfPresent($tmp); - } else { - // Windows filesystem - $saved = rename($tmp, $this->auth_key_name); - } - - if (!$saved) { - // The link failed, either because we lack the permission, - // or because the file already exists; try to read the key - // in case the file already existed. - $auth_key = $this->readAuthKey(); - } - - return $auth_key; - } - - /** - * Retrieve the auth key from the file specified by - * $this->auth_key_name, creating it if it does not exist. - * - * @return string $key - */ - function getAuthKey() - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return null; - } - - $auth_key = $this->readAuthKey(); - if ($auth_key === null) { - $auth_key = $this->createAuthKey(); - - if (strlen($auth_key) != $this->AUTH_KEY_LEN) { - $fmt = 'Got an invalid auth key from %s. Expected '. - '%d-byte string. Got: %s'; - $msg = sprintf($fmt, $this->auth_key_name, $this->AUTH_KEY_LEN, - $auth_key); - trigger_error($msg, E_USER_WARNING); - return null; - } - } - return $auth_key; - } - - /** - * Create a unique filename for a given server url and - * handle. This implementation does not assume anything about the - * format of the handle. The filename that is returned will - * contain the domain name from the server URL for ease of human - * inspection of the data directory. - * - * @return string $filename - */ - function getAssociationFilename($server_url, $handle) - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return null; - } - - if (strpos($server_url, '://') === false) { - trigger_error(sprintf("Bad server URL: %s", $server_url), - E_USER_WARNING); - return null; - } - - list($proto, $rest) = explode('://', $server_url, 2); - $parts = explode('/', $rest); - $domain = Auth_OpenID_FileStore::_filenameEscape($parts[0]); - $url_hash = Auth_OpenID_FileStore::_safe64($server_url); - if ($handle) { - $handle_hash = Auth_OpenID_FileStore::_safe64($handle); - } else { - $handle_hash = ''; - } - - $filename = sprintf('%s-%s-%s-%s', $proto, $domain, $url_hash, - $handle_hash); - - return $this->association_dir. DIRECTORY_SEPARATOR . $filename; - } - - /** - * Store an association in the association directory. - */ - function storeAssociation($server_url, $association) - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return false; - } - - $association_s = $association->serialize(); - $filename = $this->getAssociationFilename($server_url, - $association->handle); - list($tmp_file, $tmp) = $this->_mktemp(); - - if (!$tmp_file) { - trigger_error("_mktemp didn't return a valid file descriptor", - E_USER_WARNING); - return false; - } - - fwrite($tmp_file, $association_s); - - fflush($tmp_file); - - fclose($tmp_file); - - if (@rename($tmp, $filename)) { - return true; - } else { - // In case we are running on Windows, try unlinking the - // file in case it exists. - @unlink($filename); - - // Now the target should not exist. Try renaming again, - // giving up if it fails. - if (@rename($tmp, $filename)) { - return true; - } - } - - // If there was an error, don't leave the temporary file - // around. - Auth_OpenID_FileStore::_removeIfPresent($tmp); - return false; - } - - /** - * Retrieve an association. If no handle is specified, return the - * association with the most recent issue time. - * - * @return mixed $association - */ - function getAssociation($server_url, $handle = null) - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return null; - } - - if ($handle === null) { - $handle = ''; - } - - // The filename with the empty handle is a prefix of all other - // associations for the given server URL. - $filename = $this->getAssociationFilename($server_url, $handle); - - if ($handle) { - return $this->_getAssociation($filename); - } else { - $association_files = - Auth_OpenID_FileStore::_listdir($this->association_dir); - $matching_files = array(); - - // strip off the path to do the comparison - $name = basename($filename); - foreach ($association_files as $association_file) { - if (strpos($association_file, $name) === 0) { - $matching_files[] = $association_file; - } - } - - $matching_associations = array(); - // read the matching files and sort by time issued - foreach ($matching_files as $name) { - $full_name = $this->association_dir . DIRECTORY_SEPARATOR . - $name; - $association = $this->_getAssociation($full_name); - if ($association !== null) { - $matching_associations[] = array($association->issued, - $association); - } - } - - $issued = array(); - $assocs = array(); - foreach ($matching_associations as $key => $assoc) { - $issued[$key] = $assoc[0]; - $assocs[$key] = $assoc[1]; - } - - array_multisort($issued, SORT_DESC, $assocs, SORT_DESC, - $matching_associations); - - // return the most recently issued one. - if ($matching_associations) { - list($issued, $assoc) = $matching_associations[0]; - return $assoc; - } else { - return null; - } - } - } - - /** - * @access private - */ - function _getAssociation($filename) - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return null; - } - - $assoc_file = @fopen($filename, 'rb'); - - if ($assoc_file === false) { - return null; - } - - $assoc_s = fread($assoc_file, filesize($filename)); - fclose($assoc_file); - - if (!$assoc_s) { - return null; - } - - $association = - Auth_OpenID_Association::deserialize('Auth_OpenID_Association', - $assoc_s); - - if (!$association) { - Auth_OpenID_FileStore::_removeIfPresent($filename); - return null; - } - - if ($association->getExpiresIn() == 0) { - Auth_OpenID_FileStore::_removeIfPresent($filename); - return null; - } else { - return $association; - } - } - - /** - * Remove an association if it exists. Do nothing if it does not. - * - * @return bool $success - */ - function removeAssociation($server_url, $handle) - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return null; - } - - $assoc = $this->getAssociation($server_url, $handle); - if ($assoc === null) { - return false; - } else { - $filename = $this->getAssociationFilename($server_url, $handle); - return Auth_OpenID_FileStore::_removeIfPresent($filename); - } - } - - /** - * Mark this nonce as present. - */ - function storeNonce($nonce) - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return null; - } - - $filename = $this->nonce_dir . DIRECTORY_SEPARATOR . $nonce; - $nonce_file = fopen($filename, 'w'); - if ($nonce_file === false) { - return false; - } - fclose($nonce_file); - return true; - } - - /** - * Return whether this nonce is present. As a side effect, mark it - * as no longer present. - * - * @return bool $present - */ - function useNonce($nonce) - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return null; - } - - $filename = $this->nonce_dir . DIRECTORY_SEPARATOR . $nonce; - $st = @stat($filename); - - if ($st === false) { - return false; - } - - // Either it is too old or we are using it. Either way, we - // must remove the file. - if (!unlink($filename)) { - return false; - } - - $now = time(); - $nonce_age = $now - $st[9]; - - // We can us it if the age of the file is less than the - // expiration time. - return $nonce_age <= $this->max_nonce_age; - } - - /** - * Remove expired entries from the database. This is potentially - * expensive, so only run when it is acceptable to take time. - */ - function clean() - { - if (!$this->active) { - trigger_error("FileStore no longer active", E_USER_ERROR); - return null; - } - - $nonces = Auth_OpenID_FileStore::_listdir($this->nonce_dir); - $now = time(); - - // Check all nonces for expiry - foreach ($nonces as $nonce) { - $filename = $this->nonce_dir . DIRECTORY_SEPARATOR . $nonce; - $st = @stat($filename); - - if ($st !== false) { - // Remove the nonce if it has expired - $nonce_age = $now - $st[9]; - if ($nonce_age > $this->max_nonce_age) { - Auth_OpenID_FileStore::_removeIfPresent($filename); - } - } - } - - $association_filenames = - Auth_OpenID_FileStore::_listdir($this->association_dir); - - foreach ($association_filenames as $association_filename) { - $association_file = fopen($association_filename, 'rb'); - - if ($association_file !== false) { - $assoc_s = fread($association_file, - filesize($association_filename)); - fclose($association_file); - - // Remove expired or corrupted associations - $association = - Auth_OpenID_Association::deserialize( - 'Auth_OpenID_Association', $assoc_s); - - if ($association === null) { - Auth_OpenID_FileStore::_removeIfPresent( - $association_filename); - } else { - if ($association->getExpiresIn() == 0) { - Auth_OpenID_FileStore::_removeIfPresent( - $association_filename); - } - } - } - } - } - - /** - * @access private - */ - function _rmtree($dir) - { - if ($dir[strlen($dir) - 1] != DIRECTORY_SEPARATOR) { - $dir .= DIRECTORY_SEPARATOR; - } - - if ($handle = opendir($dir)) { - while ($item = readdir($handle)) { - if (!in_array($item, array('.', '..'))) { - if (is_dir($dir . $item)) { - - if (!Auth_OpenID_FileStore::_rmtree($dir . $item)) { - return false; - } - } else if (is_file($dir . $item)) { - if (!unlink($dir . $item)) { - return false; - } - } - } - } - - closedir($handle); - - if (!@rmdir($dir)) { - return false; - } - - return true; - } else { - // Couldn't open directory. - return false; - } - } - - /** - * @access private - */ - function _mkstemp($dir) - { - foreach (range(0, 4) as $i) { - $name = tempnam($dir, "php_openid_filestore_"); - - if ($name !== false) { - return $name; - } - } - return false; - } - - /** - * @access private - */ - function _mkdtemp($dir) - { - foreach (range(0, 4) as $i) { - $name = $dir . strval(DIRECTORY_SEPARATOR) . strval(getmypid()) . - "-" . strval(rand(1, time())); - if (!mkdir($name, 0700)) { - return false; - } else { - return $name; - } - } - return false; - } - - /** - * @access private - */ - function _listdir($dir) - { - $handle = opendir($dir); - $files = array(); - while (false !== ($filename = readdir($handle))) { - $files[] = $filename; - } - return $files; - } - - /** - * @access private - */ - function _isFilenameSafe($char) - { - $_Auth_OpenID_filename_allowed = Auth_OpenID_letters . - Auth_OpenID_digits . "."; - return (strpos($_Auth_OpenID_filename_allowed, $char) !== false); - } - - /** - * @access private - */ - function _safe64($str) - { - $h64 = base64_encode(Auth_OpenID_SHA1($str)); - $h64 = str_replace('+', '_', $h64); - $h64 = str_replace('/', '.', $h64); - $h64 = str_replace('=', '', $h64); - return $h64; - } - - /** - * @access private - */ - function _filenameEscape($str) - { - $filename = ""; - for ($i = 0; $i < strlen($str); $i++) { - $c = $str[$i]; - if (Auth_OpenID_FileStore::_isFilenameSafe($c)) { - $filename .= $c; - } else { - $filename .= sprintf("_%02X", ord($c)); - } - } - return $filename; - } - - /** - * Attempt to remove a file, returning whether the file existed at - * the time of the call. - * - * @access private - * @return bool $result True if the file was present, false if not. - */ - function _removeIfPresent($filename) - { - return @unlink($filename); - } -} - -?> + /** + * Initializes a new {@link Auth_OpenID_FileStore}. This + * initializes the nonce and association directories, which are + * subdirectories of the directory passed in. + * + * @param string $directory This is the directory to put the store + * directories in. + */ + function Auth_OpenID_FileStore($directory) + { + if (!Auth_OpenID::ensureDir($directory)) { + trigger_error('Not a directory and failed to create: ' + . $directory, E_USER_ERROR); + } + $directory = realpath($directory); + + $this->directory = $directory; + $this->active = true; + + $this->nonce_dir = $directory . DIRECTORY_SEPARATOR . 'nonces'; + + $this->association_dir = $directory . DIRECTORY_SEPARATOR . + 'associations'; + + // Temp dir must be on the same filesystem as the assciations + // $directory and the $directory containing the auth key file. + $this->temp_dir = $directory . DIRECTORY_SEPARATOR . 'temp'; + + $this->auth_key_name = $directory . DIRECTORY_SEPARATOR . 'auth_key'; + + $this->max_nonce_age = 6 * 60 * 60; // Six hours, in seconds + + if (!$this->_setup()) { + trigger_error('Failed to initialize OpenID file store in ' . + $directory, E_USER_ERROR); + } + } + + function destroy() + { + Auth_OpenID_FileStore::_rmtree($this->directory); + $this->active = false; + } + + /** + * Make sure that the directories in which we store our data + * exist. + * + * @access private + */ + function _setup() + { + return (Auth_OpenID::ensureDir(dirname($this->auth_key_name)) && + Auth_OpenID::ensureDir($this->nonce_dir) && + Auth_OpenID::ensureDir($this->association_dir) && + Auth_OpenID::ensureDir($this->temp_dir)); + } + + /** + * Create a temporary file on the same filesystem as + * $this->auth_key_name and $this->association_dir. + * + * The temporary directory should not be cleaned if there are any + * processes using the store. If there is no active process using + * the store, it is safe to remove all of the files in the + * temporary directory. + * + * @return array ($fd, $filename) + * @access private + */ + function _mktemp() + { + $name = Auth_OpenID_FileStore::_mkstemp($dir = $this->temp_dir); + $file_obj = @fopen($name, 'wb'); + if ($file_obj !== false) { + return array($file_obj, $name); + } else { + Auth_OpenID_FileStore::_removeIfPresent($name); + } + } + + /** + * Read the auth key from the auth key file. Will return None if + * there is currently no key. + * + * @return mixed + */ + function readAuthKey() + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return null; + } + + $auth_key_file = @fopen($this->auth_key_name, 'rb'); + if ($auth_key_file === false) { + return null; + } + + $key = fread($auth_key_file, filesize($this->auth_key_name)); + fclose($auth_key_file); + + return $key; + } + + /** + * Generate a new random auth key and safely store it in the + * location specified by $this->auth_key_name. + * + * @return string $key + */ + function createAuthKey() + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return null; + } + + $auth_key = Auth_OpenID_CryptUtil::randomString($this->AUTH_KEY_LEN); + + list($file_obj, $tmp) = $this->_mktemp(); + + fwrite($file_obj, $auth_key); + fflush($file_obj); + fclose($file_obj); + + if (function_exists('link')) { + // Posix filesystem + $saved = link($tmp, $this->auth_key_name); + Auth_OpenID_FileStore::_removeIfPresent($tmp); + } else { + // Windows filesystem + $saved = rename($tmp, $this->auth_key_name); + } + + if (!$saved) { + // The link failed, either because we lack the permission, + // or because the file already exists; try to read the key + // in case the file already existed. + $auth_key = $this->readAuthKey(); + } + + return $auth_key; + } + + /** + * Retrieve the auth key from the file specified by + * $this->auth_key_name, creating it if it does not exist. + * + * @return string $key + */ + function getAuthKey() + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return null; + } + + $auth_key = $this->readAuthKey(); + if ($auth_key === null) { + $auth_key = $this->createAuthKey(); + + if (strlen($auth_key) != $this->AUTH_KEY_LEN) { + $fmt = 'Got an invalid auth key from %s. Expected '. + '%d-byte string. Got: %s'; + $msg = sprintf($fmt, $this->auth_key_name, $this->AUTH_KEY_LEN, + $auth_key); + trigger_error($msg, E_USER_WARNING); + return null; + } + } + return $auth_key; + } + + /** + * Create a unique filename for a given server url and + * handle. This implementation does not assume anything about the + * format of the handle. The filename that is returned will + * contain the domain name from the server URL for ease of human + * inspection of the data directory. + * + * @return string $filename + */ + function getAssociationFilename($server_url, $handle) + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return null; + } + + if (strpos($server_url, '://') === false) { + trigger_error(sprintf("Bad server URL: %s", $server_url), + E_USER_WARNING); + return null; + } + + list($proto, $rest) = explode('://', $server_url, 2); + $parts = explode('/', $rest); + $domain = Auth_OpenID_FileStore::_filenameEscape($parts[0]); + $url_hash = Auth_OpenID_FileStore::_safe64($server_url); + if ($handle) { + $handle_hash = Auth_OpenID_FileStore::_safe64($handle); + } else { + $handle_hash = ''; + } + + $filename = sprintf('%s-%s-%s-%s', $proto, $domain, $url_hash, + $handle_hash); + + return $this->association_dir. DIRECTORY_SEPARATOR . $filename; + } + + /** + * Store an association in the association directory. + */ + function storeAssociation($server_url, $association) + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return false; + } + + $association_s = $association->serialize(); + $filename = $this->getAssociationFilename($server_url, + $association->handle); + list($tmp_file, $tmp) = $this->_mktemp(); + + if (!$tmp_file) { + trigger_error("_mktemp didn't return a valid file descriptor", + E_USER_WARNING); + return false; + } + + fwrite($tmp_file, $association_s); + + fflush($tmp_file); + + fclose($tmp_file); + + if (@rename($tmp, $filename)) { + return true; + } else { + // In case we are running on Windows, try unlinking the + // file in case it exists. + @unlink($filename); + + // Now the target should not exist. Try renaming again, + // giving up if it fails. + if (@rename($tmp, $filename)) { + return true; + } + } + + // If there was an error, don't leave the temporary file + // around. + Auth_OpenID_FileStore::_removeIfPresent($tmp); + return false; + } + + /** + * Retrieve an association. If no handle is specified, return the + * association with the most recent issue time. + * + * @return mixed $association + */ + function getAssociation($server_url, $handle = null) + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return null; + } + + if ($handle === null) { + $handle = ''; + } + + // The filename with the empty handle is a prefix of all other + // associations for the given server URL. + $filename = $this->getAssociationFilename($server_url, $handle); + + if ($handle) { + return $this->_getAssociation($filename); + } else { + $association_files = + Auth_OpenID_FileStore::_listdir($this->association_dir); + $matching_files = array(); + + // strip off the path to do the comparison + $name = basename($filename); + foreach ($association_files as $association_file) { + if (strpos($association_file, $name) === 0) { + $matching_files[] = $association_file; + } + } + + $matching_associations = array(); + // read the matching files and sort by time issued + foreach ($matching_files as $name) { + $full_name = $this->association_dir . DIRECTORY_SEPARATOR . + $name; + $association = $this->_getAssociation($full_name); + if ($association !== null) { + $matching_associations[] = array($association->issued, + $association); + } + } + + $issued = array(); + $assocs = array(); + foreach ($matching_associations as $key => $assoc) { + $issued[$key] = $assoc[0]; + $assocs[$key] = $assoc[1]; + } + + array_multisort($issued, SORT_DESC, $assocs, SORT_DESC, + $matching_associations); + + // return the most recently issued one. + if ($matching_associations) { + list($issued, $assoc) = $matching_associations[0]; + return $assoc; + } else { + return null; + } + } + } + + /** + * @access private + */ + function _getAssociation($filename) + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return null; + } + + $assoc_file = @fopen($filename, 'rb'); + + if ($assoc_file === false) { + return null; + } + + $assoc_s = fread($assoc_file, filesize($filename)); + fclose($assoc_file); + + if (!$assoc_s) { + return null; + } + + $association = + Auth_OpenID_Association::deserialize('Auth_OpenID_Association', + $assoc_s); + + if (!$association) { + Auth_OpenID_FileStore::_removeIfPresent($filename); + return null; + } + + if ($association->getExpiresIn() == 0) { + Auth_OpenID_FileStore::_removeIfPresent($filename); + return null; + } else { + return $association; + } + } + + /** + * Remove an association if it exists. Do nothing if it does not. + * + * @return bool $success + */ + function removeAssociation($server_url, $handle) + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return null; + } + + $assoc = $this->getAssociation($server_url, $handle); + if ($assoc === null) { + return false; + } else { + $filename = $this->getAssociationFilename($server_url, $handle); + return Auth_OpenID_FileStore::_removeIfPresent($filename); + } + } + + /** + * Mark this nonce as present. + */ + function storeNonce($nonce) + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return null; + } + + $filename = $this->nonce_dir . DIRECTORY_SEPARATOR . $nonce; + $nonce_file = fopen($filename, 'w'); + if ($nonce_file === false) { + return false; + } + fclose($nonce_file); + return true; + } + + /** + * Return whether this nonce is present. As a side effect, mark it + * as no longer present. + * + * @return bool $present + */ + function useNonce($nonce) + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return null; + } + + $filename = $this->nonce_dir . DIRECTORY_SEPARATOR . $nonce; + $st = @stat($filename); + + if ($st === false) { + return false; + } + + // Either it is too old or we are using it. Either way, we + // must remove the file. + if (!unlink($filename)) { + return false; + } + + $now = time(); + $nonce_age = $now - $st[9]; + + // We can us it if the age of the file is less than the + // expiration time. + return $nonce_age <= $this->max_nonce_age; + } + + /** + * Remove expired entries from the database. This is potentially + * expensive, so only run when it is acceptable to take time. + */ + function clean() + { + if (!$this->active) { + trigger_error("FileStore no longer active", E_USER_ERROR); + return null; + } + + $nonces = Auth_OpenID_FileStore::_listdir($this->nonce_dir); + $now = time(); + + // Check all nonces for expiry + foreach ($nonces as $nonce) { + $filename = $this->nonce_dir . DIRECTORY_SEPARATOR . $nonce; + $st = @stat($filename); + + if ($st !== false) { + // Remove the nonce if it has expired + $nonce_age = $now - $st[9]; + if ($nonce_age > $this->max_nonce_age) { + Auth_OpenID_FileStore::_removeIfPresent($filename); + } + } + } + + $association_filenames = + Auth_OpenID_FileStore::_listdir($this->association_dir); + + foreach ($association_filenames as $association_filename) { + $association_file = fopen($association_filename, 'rb'); + + if ($association_file !== false) { + $assoc_s = fread($association_file, + filesize($association_filename)); + fclose($association_file); + + // Remove expired or corrupted associations + $association = + Auth_OpenID_Association::deserialize( + 'Auth_OpenID_Association', $assoc_s); + + if ($association === null) { + Auth_OpenID_FileStore::_removeIfPresent( + $association_filename); + } else { + if ($association->getExpiresIn() == 0) { + Auth_OpenID_FileStore::_removeIfPresent( + $association_filename); + } + } + } + } + } + + /** + * @access private + */ + function _rmtree($dir) + { + if ($dir[strlen($dir) - 1] != DIRECTORY_SEPARATOR) { + $dir .= DIRECTORY_SEPARATOR; + } + + if ($handle = opendir($dir)) { + while ($item = readdir($handle)) { + if (!in_array($item, array('.', '..'))) { + if (is_dir($dir . $item)) { + + if (!Auth_OpenID_FileStore::_rmtree($dir . $item)) { + return false; + } + } else if (is_file($dir . $item)) { + if (!unlink($dir . $item)) { + return false; + } + } + } + } + + closedir($handle); + + if (!@rmdir($dir)) { + return false; + } + + return true; + } else { + // Couldn't open directory. + return false; + } + } + + /** + * @access private + */ + function _mkstemp($dir) + { + foreach (range(0, 4) as $i) { + $name = tempnam($dir, "php_openid_filestore_"); + + if ($name !== false) { + return $name; + } + } + return false; + } + + /** + * @access private + */ + function _mkdtemp($dir) + { + foreach (range(0, 4) as $i) { + $name = $dir . strval(DIRECTORY_SEPARATOR) . strval(getmypid()) . + "-" . strval(rand(1, time())); + if (!mkdir($name, 0700)) { + return false; + } else { + return $name; + } + } + return false; + } + + /** + * @access private + */ + function _listdir($dir) + { + $handle = opendir($dir); + $files = array(); + while (false !== ($filename = readdir($handle))) { + $files[] = $filename; + } + return $files; + } + + /** + * @access private + */ + function _isFilenameSafe($char) + { + $_Auth_OpenID_filename_allowed = Auth_OpenID_letters . + Auth_OpenID_digits . "."; + return (strpos($_Auth_OpenID_filename_allowed, $char) !== false); + } + + /** + * @access private + */ + function _safe64($str) + { + $h64 = base64_encode(Auth_OpenID_SHA1($str)); + $h64 = str_replace('+', '_', $h64); + $h64 = str_replace('/', '.', $h64); + $h64 = str_replace('=', '', $h64); + return $h64; + } + + /** + * @access private + */ + function _filenameEscape($str) + { + $filename = ""; + for ($i = 0; $i < strlen($str); $i++) { + $c = $str[$i]; + if (Auth_OpenID_FileStore::_isFilenameSafe($c)) { + $filename .= $c; + } else { + $filename .= sprintf("_%02X", ord($c)); + } + } + return $filename; + } + + /** + * Attempt to remove a file, returning whether the file existed at + * the time of the call. + * + * @access private + * @return bool $result True if the file was present, false if not. + */ + function _removeIfPresent($filename) + { + return @unlink($filename); + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/HMACSHA1.php b/libraries/openid/Auth/OpenID/HMACSHA1.php index 6daadb5f813d0..43004782fa831 100644 --- a/libraries/openid/Auth/OpenID/HMACSHA1.php +++ b/libraries/openid/Auth/OpenID/HMACSHA1.php @@ -21,30 +21,30 @@ define('Auth_OpenID_SHA1_BLOCKSIZE', 64); if (!function_exists('sha1')) { - /** - * Return a raw SHA1 hash of the given string - * - * XXX: include the SHA1 code from Dan Libby's OpenID library - */ - function Auth_OpenID_SHA1($text) - { - trigger_error('No SHA1 function found', E_USER_ERROR); - } + /** + * Return a raw SHA1 hash of the given string + * + * XXX: include the SHA1 code from Dan Libby's OpenID library + */ + function Auth_OpenID_SHA1($text) + { + trigger_error('No SHA1 function found', E_USER_ERROR); + } } else { - /** - * @ignore - */ - function Auth_OpenID_SHA1($text) - { - $hex = sha1($text); - $raw = ''; - for ($i = 0; $i < 40; $i += 2) { - $hexcode = substr($hex, $i, 2); - $charcode = (int)base_convert($hexcode, 16, 10); - $raw .= chr($charcode); - } - return $raw; - } + /** + * @ignore + */ + function Auth_OpenID_SHA1($text) + { + $hex = sha1($text); + $raw = ''; + for ($i = 0; $i < 40; $i += 2) { + $hexcode = substr($hex, $i, 2); + $charcode = (int)base_convert($hexcode, 16, 10); + $raw .= chr($charcode); + } + return $raw; + } } /** @@ -57,16 +57,14 @@ function Auth_OpenID_SHA1($text) */ function Auth_OpenID_HMACSHA1($key, $text) { - if (strlen($key) > Auth_OpenID_SHA1_BLOCKSIZE) { - $key = Auth_OpenID_SHA1($key, true); - } + if (strlen($key) > Auth_OpenID_SHA1_BLOCKSIZE) { + $key = Auth_OpenID_SHA1($key, true); + } - $key = str_pad($key, Auth_OpenID_SHA1_BLOCKSIZE, chr(0x00)); - $ipad = str_repeat(chr(0x36), Auth_OpenID_SHA1_BLOCKSIZE); - $opad = str_repeat(chr(0x5c), Auth_OpenID_SHA1_BLOCKSIZE); - $hash1 = Auth_OpenID_SHA1(($key ^ $ipad) . $text, true); - $hmac = Auth_OpenID_SHA1(($key ^ $opad) . $hash1, true); - return $hmac; -} - -?> \ No newline at end of file + $key = str_pad($key, Auth_OpenID_SHA1_BLOCKSIZE, chr(0x00)); + $ipad = str_repeat(chr(0x36), Auth_OpenID_SHA1_BLOCKSIZE); + $opad = str_repeat(chr(0x5c), Auth_OpenID_SHA1_BLOCKSIZE); + $hash1 = Auth_OpenID_SHA1(($key ^ $ipad) . $text, true); + $hmac = Auth_OpenID_SHA1(($key ^ $opad) . $hash1, true); + return $hmac; +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/Interface.php b/libraries/openid/Auth/OpenID/Interface.php index ce9fa1febc725..b38827d585041 100644 --- a/libraries/openid/Auth/OpenID/Interface.php +++ b/libraries/openid/Auth/OpenID/Interface.php @@ -24,165 +24,164 @@ * @author JanRain, Inc. */ class Auth_OpenID_OpenIDStore { - /** - * @var integer The length of the auth key that should be returned - * by the getAuthKey method. - */ - var $AUTH_KEY_LEN = 20; + /** + * @var integer The length of the auth key that should be returned + * by the getAuthKey method. + */ + var $AUTH_KEY_LEN = 20; - /** - * This method puts an Association object into storage, - * retrievable by server URL and handle. - * - * @param string $server_url The URL of the identity server that - * this association is with. Because of the way the server portion - * of the library uses this interface, don't assume there are any - * limitations on the character set of the input string. In - * particular, expect to see unescaped non-url-safe characters in - * the server_url field. - * - * @param Association $association The Association to store. - */ - function storeAssociation($server_url, $association) - { - trigger_error("Auth_OpenID_OpenIDStore::storeAssociation ". - "not implemented", E_USER_ERROR); - } + /** + * This method puts an Association object into storage, + * retrievable by server URL and handle. + * + * @param string $server_url The URL of the identity server that + * this association is with. Because of the way the server portion + * of the library uses this interface, don't assume there are any + * limitations on the character set of the input string. In + * particular, expect to see unescaped non-url-safe characters in + * the server_url field. + * + * @param Association $association The Association to store. + */ + function storeAssociation($server_url, $association) + { + trigger_error("Auth_OpenID_OpenIDStore::storeAssociation ". + "not implemented", E_USER_ERROR); + } - /** - * This method returns an Association object from storage that - * matches the server URL and, if specified, handle. It returns - * null if no such association is found or if the matching - * association is expired. - * - * If no handle is specified, the store may return any association - * which matches the server URL. If multiple associations are - * valid, the recommended return value for this method is the one - * that will remain valid for the longest duration. - * - * This method is allowed (and encouraged) to garbage collect - * expired associations when found. This method must not return - * expired associations. - * - * @param string $server_url The URL of the identity server to get - * the association for. Because of the way the server portion of - * the library uses this interface, don't assume there are any - * limitations on the character set of the input string. In - * particular, expect to see unescaped non-url-safe characters in - * the server_url field. - * - * @param mixed $handle This optional parameter is the handle of - * the specific association to get. If no specific handle is - * provided, any valid association matching the server URL is - * returned. - * - * @return Association The Association for the given identity - * server. - */ - function getAssociation($server_url, $handle = null) - { - trigger_error("Auth_OpenID_OpenIDStore::getAssociation ". - "not implemented", E_USER_ERROR); - } + /** + * This method returns an Association object from storage that + * matches the server URL and, if specified, handle. It returns + * null if no such association is found or if the matching + * association is expired. + * + * If no handle is specified, the store may return any association + * which matches the server URL. If multiple associations are + * valid, the recommended return value for this method is the one + * that will remain valid for the longest duration. + * + * This method is allowed (and encouraged) to garbage collect + * expired associations when found. This method must not return + * expired associations. + * + * @param string $server_url The URL of the identity server to get + * the association for. Because of the way the server portion of + * the library uses this interface, don't assume there are any + * limitations on the character set of the input string. In + * particular, expect to see unescaped non-url-safe characters in + * the server_url field. + * + * @param mixed $handle This optional parameter is the handle of + * the specific association to get. If no specific handle is + * provided, any valid association matching the server URL is + * returned. + * + * @return Association The Association for the given identity + * server. + */ + function getAssociation($server_url, $handle = null) + { + trigger_error("Auth_OpenID_OpenIDStore::getAssociation ". + "not implemented", E_USER_ERROR); + } - /** - * This method removes the matching association if it's found, and - * returns whether the association was removed or not. - * - * @param string $server_url The URL of the identity server the - * association to remove belongs to. Because of the way the server - * portion of the library uses this interface, don't assume there - * are any limitations on the character set of the input - * string. In particular, expect to see unescaped non-url-safe - * characters in the server_url field. - * - * @param string $handle This is the handle of the association to - * remove. If there isn't an association found that matches both - * the given URL and handle, then there was no matching handle - * found. - * - * @return mixed Returns whether or not the given association existed. - */ - function removeAssociation($server_url, $handle) - { - trigger_error("Auth_OpenID_OpenIDStore::removeAssociation ". - "not implemented", E_USER_ERROR); - } + /** + * This method removes the matching association if it's found, and + * returns whether the association was removed or not. + * + * @param string $server_url The URL of the identity server the + * association to remove belongs to. Because of the way the server + * portion of the library uses this interface, don't assume there + * are any limitations on the character set of the input + * string. In particular, expect to see unescaped non-url-safe + * characters in the server_url field. + * + * @param string $handle This is the handle of the association to + * remove. If there isn't an association found that matches both + * the given URL and handle, then there was no matching handle + * found. + * + * @return mixed Returns whether or not the given association existed. + */ + function removeAssociation($server_url, $handle) + { + trigger_error("Auth_OpenID_OpenIDStore::removeAssociation ". + "not implemented", E_USER_ERROR); + } - /** - * Stores a nonce. This is used by the consumer to prevent replay - * attacks. - * - * @param string $nonce The nonce to store. - * - * @return null - */ - function storeNonce($nonce) - { - trigger_error("Auth_OpenID_OpenIDStore::storeNonce ". - "not implemented", E_USER_ERROR); - } + /** + * Stores a nonce. This is used by the consumer to prevent replay + * attacks. + * + * @param string $nonce The nonce to store. + * + * @return null + */ + function storeNonce($nonce) + { + trigger_error("Auth_OpenID_OpenIDStore::storeNonce ". + "not implemented", E_USER_ERROR); + } - /** - * This method is called when the library is attempting to use a - * nonce. If the nonce is in the store, this method removes it and - * returns a value which evaluates as true. Otherwise it returns a - * value which evaluates as false. - * - * This method is allowed and encouraged to treat nonces older - * than some period (a very conservative window would be 6 hours, - * for example) as no longer existing, and return False and remove - * them. - * - * @param string $nonce The nonce to use. - * - * @return bool Whether or not the nonce was valid. - */ - function useNonce($nonce) - { - trigger_error("Auth_OpenID_OpenIDStore::useNonce ". - "not implemented", E_USER_ERROR); - } + /** + * This method is called when the library is attempting to use a + * nonce. If the nonce is in the store, this method removes it and + * returns a value which evaluates as true. Otherwise it returns a + * value which evaluates as false. + * + * This method is allowed and encouraged to treat nonces older + * than some period (a very conservative window would be 6 hours, + * for example) as no longer existing, and return False and remove + * them. + * + * @param string $nonce The nonce to use. + * + * @return bool Whether or not the nonce was valid. + */ + function useNonce($nonce) + { + trigger_error("Auth_OpenID_OpenIDStore::useNonce ". + "not implemented", E_USER_ERROR); + } - /** - * This method returns a key used to sign the tokens, to ensure - * that they haven't been tampered with in transit. It should - * return the same key every time it is called. The key returned - * should be {@link AUTH_KEY_LEN} bytes long. - * - * @return string The key. It should be {@link AUTH_KEY_LEN} bytes in - * length, and use the full range of byte values. That is, it - * should be treated as a lump of binary data stored in a string. - */ - function getAuthKey() - { - trigger_error("Auth_OpenID_OpenIDStore::getAuthKey ". - "not implemented", E_USER_ERROR); - } + /** + * This method returns a key used to sign the tokens, to ensure + * that they haven't been tampered with in transit. It should + * return the same key every time it is called. The key returned + * should be {@link AUTH_KEY_LEN} bytes long. + * + * @return string The key. It should be {@link AUTH_KEY_LEN} bytes in + * length, and use the full range of byte values. That is, it + * should be treated as a lump of binary data stored in a string. + */ + function getAuthKey() + { + trigger_error("Auth_OpenID_OpenIDStore::getAuthKey ". + "not implemented", E_USER_ERROR); + } - /** - * This method must return true if the store is a dumb-mode-style - * store. Unlike all other methods in this class, this one - * provides a default implementation, which returns false. - * - * In general, any custom subclass of {@link Auth_OpenID_OpenIDStore} - * won't override this method, as custom subclasses are only likely to - * be created when the store is fully functional. - * - * @return bool true if the store works fully, false if the - * consumer will have to use dumb mode to use this store. - */ - function isDumb() - { - return false; - } + /** + * This method must return true if the store is a dumb-mode-style + * store. Unlike all other methods in this class, this one + * provides a default implementation, which returns false. + * + * In general, any custom subclass of {@link Auth_OpenID_OpenIDStore} + * won't override this method, as custom subclasses are only likely to + * be created when the store is fully functional. + * + * @return bool true if the store works fully, false if the + * consumer will have to use dumb mode to use this store. + */ + function isDumb() + { + return false; + } - /** - * Removes all entries from the store; implementation is optional. - */ - function reset() - { - } + /** + * Removes all entries from the store; implementation is optional. + */ + function reset() + { + } -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/KVForm.php b/libraries/openid/Auth/OpenID/KVForm.php index 6075c44f00518..2bb6f9962652f 100644 --- a/libraries/openid/Auth/OpenID/KVForm.php +++ b/libraries/openid/Auth/OpenID/KVForm.php @@ -19,94 +19,92 @@ * Container for key-value/comma-newline OpenID format and parsing */ class Auth_OpenID_KVForm { - /** - * Convert an OpenID colon/newline separated string into an - * associative array - * - * @static - * @access private - */ - function toArray($kvs, $strict=false) - { - $lines = explode("\n", $kvs); - - $last = array_pop($lines); - if ($last !== '') { - array_push($lines, $last); - if ($strict) { - return false; - } - } - - $values = array(); - - for ($lineno = 0; $lineno < count($lines); $lineno++) { - $line = $lines[$lineno]; - $kv = explode(':', $line, 2); - if (count($kv) != 2) { - if ($strict) { - return false; - } - continue; - } - - $key = $kv[0]; - $tkey = trim($key); - if ($tkey != $key) { - if ($strict) { - return false; - } - } - - $value = $kv[1]; - $tval = trim($value); - if ($tval != $value) { - if ($strict) { - return false; - } - } - - $values[$tkey] = $tval; - } - - return $values; - } - - /** - * Convert an array into an OpenID colon/newline separated string - * - * @static - * @access private - */ - function fromArray($values) - { - if ($values === null) { - return null; - } - - ksort($values); - - $serialized = ''; - foreach ($values as $key => $value) { - if (is_array($value)) { - list($key, $value) = array($value[0], $value[1]); - } - - if (strpos($key, ':') !== false) { - return null; - } - - if (strpos($key, "\n") !== false) { - return null; - } - - if (strpos($value, "\n") !== false) { - return null; - } - $serialized .= "$key:$value\n"; - } - return $serialized; - } -} - -?> \ No newline at end of file + /** + * Convert an OpenID colon/newline separated string into an + * associative array + * + * @static + * @access private + */ + function toArray($kvs, $strict=false) + { + $lines = explode("\n", $kvs); + + $last = array_pop($lines); + if ($last !== '') { + array_push($lines, $last); + if ($strict) { + return false; + } + } + + $values = array(); + + for ($lineno = 0; $lineno < count($lines); $lineno++) { + $line = $lines[$lineno]; + $kv = explode(':', $line, 2); + if (count($kv) != 2) { + if ($strict) { + return false; + } + continue; + } + + $key = $kv[0]; + $tkey = trim($key); + if ($tkey != $key) { + if ($strict) { + return false; + } + } + + $value = $kv[1]; + $tval = trim($value); + if ($tval != $value) { + if ($strict) { + return false; + } + } + + $values[$tkey] = $tval; + } + + return $values; + } + + /** + * Convert an array into an OpenID colon/newline separated string + * + * @static + * @access private + */ + function fromArray($values) + { + if ($values === null) { + return null; + } + + ksort($values); + + $serialized = ''; + foreach ($values as $key => $value) { + if (is_array($value)) { + list($key, $value) = array($value[0], $value[1]); + } + + if (strpos($key, ':') !== false) { + return null; + } + + if (strpos($key, "\n") !== false) { + return null; + } + + if (strpos($value, "\n") !== false) { + return null; + } + $serialized .= "$key:$value\n"; + } + return $serialized; + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/MySQLStore.php b/libraries/openid/Auth/OpenID/MySQLStore.php index e7b660a374557..68f03686b89d6 100644 --- a/libraries/openid/Auth/OpenID/MySQLStore.php +++ b/libraries/openid/Auth/OpenID/MySQLStore.php @@ -19,62 +19,60 @@ * @package OpenID */ class Auth_OpenID_MySQLStore extends Auth_OpenID_SQLStore { - /** - * @access private - */ - function setSQL() - { - $this->sql['nonce_table'] = - "CREATE TABLE %s (nonce CHAR(8) UNIQUE PRIMARY KEY, ". - "expires INTEGER) TYPE=InnoDB"; - - $this->sql['assoc_table'] = - "CREATE TABLE %s (server_url BLOB, handle VARCHAR(255), ". - "secret BLOB, issued INTEGER, lifetime INTEGER, ". - "assoc_type VARCHAR(64), PRIMARY KEY (server_url(255), handle)) ". - "TYPE=InnoDB"; - - $this->sql['settings_table'] = - "CREATE TABLE %s (setting VARCHAR(128) UNIQUE PRIMARY KEY, ". - "value BLOB) TYPE=InnoDB"; - - $this->sql['create_auth'] = - "INSERT INTO %s VALUES ('auth_key', !)"; - - $this->sql['get_auth'] = - "SELECT value FROM %s WHERE setting = 'auth_key'"; - - $this->sql['set_assoc'] = - "REPLACE INTO %s VALUES (?, ?, !, ?, ?, ?)"; - - $this->sql['get_assocs'] = - "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ". - "WHERE server_url = ?"; - - $this->sql['get_assoc'] = - "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ". - "WHERE server_url = ? AND handle = ?"; - - $this->sql['remove_assoc'] = - "DELETE FROM %s WHERE server_url = ? AND handle = ?"; - - $this->sql['add_nonce'] = - "REPLACE INTO %s (nonce, expires) VALUES (?, ?)"; - - $this->sql['get_nonce'] = - "SELECT * FROM %s WHERE nonce = ?"; - - $this->sql['remove_nonce'] = - "DELETE FROM %s WHERE nonce = ?"; - } - - /** - * @access private - */ - function blobEncode($blob) - { - return "0x" . bin2hex($blob); - } -} - -?> \ No newline at end of file + /** + * @access private + */ + function setSQL() + { + $this->sql['nonce_table'] = + "CREATE TABLE %s (nonce CHAR(8) UNIQUE PRIMARY KEY, ". + "expires INTEGER) TYPE=InnoDB"; + + $this->sql['assoc_table'] = + "CREATE TABLE %s (server_url BLOB, handle VARCHAR(255), ". + "secret BLOB, issued INTEGER, lifetime INTEGER, ". + "assoc_type VARCHAR(64), PRIMARY KEY (server_url(255), handle)) ". + "TYPE=InnoDB"; + + $this->sql['settings_table'] = + "CREATE TABLE %s (setting VARCHAR(128) UNIQUE PRIMARY KEY, ". + "value BLOB) TYPE=InnoDB"; + + $this->sql['create_auth'] = + "INSERT INTO %s VALUES ('auth_key', !)"; + + $this->sql['get_auth'] = + "SELECT value FROM %s WHERE setting = 'auth_key'"; + + $this->sql['set_assoc'] = + "REPLACE INTO %s VALUES (?, ?, !, ?, ?, ?)"; + + $this->sql['get_assocs'] = + "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ". + "WHERE server_url = ?"; + + $this->sql['get_assoc'] = + "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ". + "WHERE server_url = ? AND handle = ?"; + + $this->sql['remove_assoc'] = + "DELETE FROM %s WHERE server_url = ? AND handle = ?"; + + $this->sql['add_nonce'] = + "REPLACE INTO %s (nonce, expires) VALUES (?, ?)"; + + $this->sql['get_nonce'] = + "SELECT * FROM %s WHERE nonce = ?"; + + $this->sql['remove_nonce'] = + "DELETE FROM %s WHERE nonce = ?"; + } + + /** + * @access private + */ + function blobEncode($blob) + { + return "0x" . bin2hex($blob); + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/Parse.php b/libraries/openid/Auth/OpenID/Parse.php index 684af77d69c49..fc9dea2b00ce0 100644 --- a/libraries/openid/Auth/OpenID/Parse.php +++ b/libraries/openid/Auth/OpenID/Parse.php @@ -88,223 +88,221 @@ class Auth_OpenID_Parse { - /** - * Specify some flags for use with regex matching. - */ - var $_re_flags = "si"; - - /** - * Stuff to remove before we start looking for tags - */ - var $_removed_re = - "||]*>.*?<\/script>"; - - /** - * Starts with the tag name at a word boundary, where the tag name - * is not a namespace - */ - var $_tag_expr = "<%s\b(?!:)([^>]*?)(?:\/>|>(.*?)(?:<\/?%s\s*>|\Z))"; - - var $_attr_find = '\b(\w+)=("[^"]*"|\'[^\']*\'|[^\'"\s\/<>]+)'; - - function Auth_OpenID_Parse() - { - $this->_link_find = sprintf("/]*)(?!<)>/%s", - $this->_re_flags); - - $this->_entity_replacements = array( - 'amp' => '&', - 'lt' => '<', - 'gt' => '>', - 'quot' => '"' - ); - - $this->_attr_find = sprintf("/%s/%s", - $this->_attr_find, - $this->_re_flags); - - $this->_removed_re = sprintf("/%s/%s", - $this->_removed_re, - $this->_re_flags); - - $this->_ent_replace = - sprintf("&(%s);", implode("|", - $this->_entity_replacements)); - } - - /** - * Returns a regular expression that will match a given tag in an - * SGML string. - */ - function tagMatcher($tag_name, $close_tags = null) - { - if ($close_tags) { - $options = implode("|", array_merge(array($tag_name), $close_tags)); - $closer = sprintf("(?:%s)", $options); - } else { - $closer = $tag_name; - } - - $expr = sprintf($this->_tag_expr, $tag_name, $closer); - return sprintf("/%s/%s", $expr, $this->_re_flags); - } - - function htmlFind() - { - return $this->tagMatcher('html'); - } - - function headFind() - { - return $this->tagMatcher('head', array('body')); - } - - function replaceEntities($str) - { - foreach ($this->_entity_replacements as $old => $new) { - $str = preg_replace(sprintf("/&%s;/", $old), $new, $str); - } - return $str; - } - - function removeQuotes($str) - { - $matches = array(); - $double = '/^"(.*)"$/'; - $single = "/^\'(.*)\'$/"; - - if (preg_match($double, $str, $matches)) { - return $matches[1]; - } else if (preg_match($single, $str, $matches)) { - return $matches[1]; - } else { - return $str; - } - } - - /** - * Find all link tags in a string representing a HTML document and - * return a list of their attributes. - * - * @param string $html The text to parse - * @return array $list An array of arrays of attributes, one for each - * link tag - */ - function parseLinkAttrs($html) - { - $stripped = preg_replace($this->_removed_re, - "", - $html); - - // Try to find the tag. - $html_re = $this->htmlFind(); - $html_matches = array(); - if (!preg_match($html_re, $stripped, $html_matches)) { - return array(); - } - - // Try to find the tag. - $head_re = $this->headFind(); - $head_matches = array(); - if (!preg_match($head_re, $html_matches[0], $head_matches)) { - return array(); - } - - $link_data = array(); - $link_matches = array(); - - if (!preg_match_all($this->_link_find, $head_matches[0], - $link_matches)) { - return array(); - } - - foreach ($link_matches[0] as $link) { - $attr_matches = array(); - preg_match_all($this->_attr_find, $link, $attr_matches); - $link_attrs = array(); - foreach ($attr_matches[0] as $index => $full_match) { - $name = $attr_matches[1][$index]; - $value = $this->replaceEntities( - $this->removeQuotes($attr_matches[2][$index])); - - $link_attrs[strtolower($name)] = $value; - } - $link_data[] = $link_attrs; - } - - return $link_data; - } - - function relMatches($rel_attr, $target_rel) - { - // Does this target_rel appear in the rel_str? - // XXX: TESTME - $rels = preg_split("/\s+/", trim($rel_attr)); - foreach ($rels as $rel) { - $rel = strtolower($rel); - if ($rel == $target_rel) { - return 1; - } - } - - return 0; - } - - function linkHasRel($link_attrs, $target_rel) - { - // Does this link have target_rel as a relationship? - // XXX: TESTME - $rel_attr = Auth_OpeniD::arrayGet($link_attrs, 'rel', null); - return ($rel_attr && $this->relMatches($rel_attr, - $target_rel)); - } - - function findLinksRel($link_attrs_list, $target_rel) - { - // Filter the list of link attributes on whether it has - // target_rel as a relationship. - // XXX: TESTME - $result = array(); - foreach ($link_attrs_list as $attr) { - if ($this->linkHasRel($attr, $target_rel)) { - $result[] = $attr; - } - } - - return $result; - } - - function findFirstHref($link_attrs_list, $target_rel) - { - // Return the value of the href attribute for the first link - // tag in the list that has target_rel as a relationship. - // XXX: TESTME - $matches = $this->findLinksRel($link_attrs_list, - $target_rel); - if (!$matches) { - return null; - } - $first = $matches[0]; - return Auth_OpenID::arrayGet($first, 'href', null); - } + /** + * Specify some flags for use with regex matching. + */ + var $_re_flags = "si"; + + /** + * Stuff to remove before we start looking for tags + */ + var $_removed_re = + "||]*>.*?<\/script>"; + + /** + * Starts with the tag name at a word boundary, where the tag name + * is not a namespace + */ + var $_tag_expr = "<%s\b(?!:)([^>]*?)(?:\/>|>(.*?)(?:<\/?%s\s*>|\Z))"; + + var $_attr_find = '\b(\w+)=("[^"]*"|\'[^\']*\'|[^\'"\s\/<>]+)'; + + function Auth_OpenID_Parse() + { + $this->_link_find = sprintf("/]*)(?!<)>/%s", + $this->_re_flags); + + $this->_entity_replacements = array( + 'amp' => '&', + 'lt' => '<', + 'gt' => '>', + 'quot' => '"' + ); + + $this->_attr_find = sprintf("/%s/%s", + $this->_attr_find, + $this->_re_flags); + + $this->_removed_re = sprintf("/%s/%s", + $this->_removed_re, + $this->_re_flags); + + $this->_ent_replace = + sprintf("&(%s);", implode("|", + $this->_entity_replacements)); + } + + /** + * Returns a regular expression that will match a given tag in an + * SGML string. + */ + function tagMatcher($tag_name, $close_tags = null) + { + if ($close_tags) { + $options = implode("|", array_merge(array($tag_name), $close_tags)); + $closer = sprintf("(?:%s)", $options); + } else { + $closer = $tag_name; + } + + $expr = sprintf($this->_tag_expr, $tag_name, $closer); + return sprintf("/%s/%s", $expr, $this->_re_flags); + } + + function htmlFind() + { + return $this->tagMatcher('html'); + } + + function headFind() + { + return $this->tagMatcher('head', array('body')); + } + + function replaceEntities($str) + { + foreach ($this->_entity_replacements as $old => $new) { + $str = preg_replace(sprintf("/&%s;/", $old), $new, $str); + } + return $str; + } + + function removeQuotes($str) + { + $matches = array(); + $double = '/^"(.*)"$/'; + $single = "/^\'(.*)\'$/"; + + if (preg_match($double, $str, $matches)) { + return $matches[1]; + } else if (preg_match($single, $str, $matches)) { + return $matches[1]; + } else { + return $str; + } + } + + /** + * Find all link tags in a string representing a HTML document and + * return a list of their attributes. + * + * @param string $html The text to parse + * @return array $list An array of arrays of attributes, one for each + * link tag + */ + function parseLinkAttrs($html) + { + $stripped = preg_replace($this->_removed_re, + "", + $html); + + // Try to find the tag. + $html_re = $this->htmlFind(); + $html_matches = array(); + if (!preg_match($html_re, $stripped, $html_matches)) { + return array(); + } + + // Try to find the tag. + $head_re = $this->headFind(); + $head_matches = array(); + if (!preg_match($head_re, $html_matches[0], $head_matches)) { + return array(); + } + + $link_data = array(); + $link_matches = array(); + + if (!preg_match_all($this->_link_find, $head_matches[0], + $link_matches)) { + return array(); + } + + foreach ($link_matches[0] as $link) { + $attr_matches = array(); + preg_match_all($this->_attr_find, $link, $attr_matches); + $link_attrs = array(); + foreach ($attr_matches[0] as $index => $full_match) { + $name = $attr_matches[1][$index]; + $value = $this->replaceEntities( + $this->removeQuotes($attr_matches[2][$index])); + + $link_attrs[strtolower($name)] = $value; + } + $link_data[] = $link_attrs; + } + + return $link_data; + } + + function relMatches($rel_attr, $target_rel) + { + // Does this target_rel appear in the rel_str? + // XXX: TESTME + $rels = preg_split("/\s+/", trim($rel_attr)); + foreach ($rels as $rel) { + $rel = strtolower($rel); + if ($rel == $target_rel) { + return 1; + } + } + + return 0; + } + + function linkHasRel($link_attrs, $target_rel) + { + // Does this link have target_rel as a relationship? + // XXX: TESTME + $rel_attr = Auth_OpeniD::arrayGet($link_attrs, 'rel', null); + return ($rel_attr && $this->relMatches($rel_attr, + $target_rel)); + } + + function findLinksRel($link_attrs_list, $target_rel) + { + // Filter the list of link attributes on whether it has + // target_rel as a relationship. + // XXX: TESTME + $result = array(); + foreach ($link_attrs_list as $attr) { + if ($this->linkHasRel($attr, $target_rel)) { + $result[] = $attr; + } + } + + return $result; + } + + function findFirstHref($link_attrs_list, $target_rel) + { + // Return the value of the href attribute for the first link + // tag in the list that has target_rel as a relationship. + // XXX: TESTME + $matches = $this->findLinksRel($link_attrs_list, + $target_rel); + if (!$matches) { + return null; + } + $first = $matches[0]; + return Auth_OpenID::arrayGet($first, 'href', null); + } } function Auth_OpenID_legacy_discover($html_text) { - $p = new Auth_OpenID_Parse(); + $p = new Auth_OpenID_Parse(); - $link_attrs = $p->parseLinkAttrs($html_text); + $link_attrs = $p->parseLinkAttrs($html_text); - $server_url = $p->findFirstHref($link_attrs, - 'openid.server'); + $server_url = $p->findFirstHref($link_attrs, + 'openid.server'); - if ($server_url === null) { - return false; - } else { - $delegate_url = $p->findFirstHref($link_attrs, - 'openid.delegate'); - return array($delegate_url, $server_url); - } -} - -?> \ No newline at end of file + if ($server_url === null) { + return false; + } else { + $delegate_url = $p->findFirstHref($link_attrs, + 'openid.delegate'); + return array($delegate_url, $server_url); + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/SQLStore.php b/libraries/openid/Auth/OpenID/SQLStore.php index 9d9c41cd16481..b486445dd8015 100644 --- a/libraries/openid/Auth/OpenID/SQLStore.php +++ b/libraries/openid/Auth/OpenID/SQLStore.php @@ -58,603 +58,601 @@ */ class Auth_OpenID_SQLStore extends Auth_OpenID_OpenIDStore { - /** - * This creates a new SQLStore instance. It requires an - * established database connection be given to it, and it allows - * overriding the default table names. - * - * @param connection $connection This must be an established - * connection to a database of the correct type for the SQLStore - * subclass you're using. This must either be an PEAR DB - * connection handle or an instance of a subclass of - * Auth_OpenID_DatabaseConnection. - * - * @param string $settings_table This is an optional parameter to - * specify the name of the table used for this store's settings. - * The default value is 'oid_settings'. - * - * @param associations_table: This is an optional parameter to - * specify the name of the table used for storing associations. - * The default value is 'oid_associations'. - * - * @param nonces_table: This is an optional parameter to specify - * the name of the table used for storing nonces. The default - * value is 'oid_nonces'. - */ - function Auth_OpenID_SQLStore($connection, $settings_table = null, - $associations_table = null, - $nonces_table = null) - { - global $__Auth_OpenID_PEAR_AVAILABLE; - - $this->settings_table_name = "oid_settings"; - $this->associations_table_name = "oid_associations"; - $this->nonces_table_name = "oid_nonces"; - - // Check the connection object type to be sure it's a PEAR - // database connection. - if (!(is_object($connection) && - (is_subclass_of($connection, 'db_common') || - is_subclass_of($connection, - 'auth_openid_databaseconnection')))) { - trigger_error("Auth_OpenID_SQLStore expected PEAR connection " . - "object (got ".get_class($connection).")", - E_USER_ERROR); - return; - } - - $this->connection = $connection; - - // Be sure to set the fetch mode so the results are keyed on - // column name instead of column index. This is a PEAR - // constant, so only try to use it if PEAR is present. Note - // that Auth_Openid_Databaseconnection instances need not - // implement ::setFetchMode for this reason. - if ($__Auth_OpenID_PEAR_AVAILABLE) { - $this->connection->setFetchMode(DB_FETCHMODE_ASSOC); - } - - if ($settings_table) { - $this->settings_table_name = $settings_table; - } - - if ($associations_table) { - $this->associations_table_name = $associations_table; - } - - if ($nonces_table) { - $this->nonces_table_name = $nonces_table; - } - - $this->max_nonce_age = 6 * 60 * 60; - - // Be sure to run the database queries with auto-commit mode - // turned OFF, because we want every function to run in a - // transaction, implicitly. As a rule, methods named with a - // leading underscore will NOT control transaction behavior. - // Callers of these methods will worry about transactions. - $this->connection->autoCommit(false); - - // Create an empty SQL strings array. - $this->sql = array(); - - // Call this method (which should be overridden by subclasses) - // to populate the $this->sql array with SQL strings. - $this->setSQL(); - - // Verify that all required SQL statements have been set, and - // raise an error if any expected SQL strings were either - // absent or empty. - list($missing, $empty) = $this->_verifySQL(); - - if ($missing) { - trigger_error("Expected keys in SQL query list: " . - implode(", ", $missing), - E_USER_ERROR); - return; - } - - if ($empty) { - trigger_error("SQL list keys have no SQL strings: " . - implode(", ", $empty), - E_USER_ERROR); - return; - } - - // Add table names to queries. - $this->_fixSQL(); - } - - function tableExists($table_name) - { - return !$this->isError( - $this->connection->query("SELECT * FROM %s LIMIT 0", - $table_name)); - } - - /** - * Returns true if $value constitutes a database error; returns - * false otherwise. - */ - function isError($value) - { - return PEAR::isError($value); - } - - /** - * Converts a query result to a boolean. If the result is a - * database error according to $this->isError(), this returns - * false; otherwise, this returns true. - */ - function resultToBool($obj) - { - if ($this->isError($obj)) { - return false; - } else { - return true; - } - } - - /** - * This method should be overridden by subclasses. This method is - * called by the constructor to set values in $this->sql, which is - * an array keyed on sql name. - */ - function setSQL() - { - } - - /** - * Resets the store by removing all records from the store's - * tables. - */ - function reset() - { - $this->connection->query(sprintf("DELETE FROM %s", - $this->associations_table_name)); - - $this->connection->query(sprintf("DELETE FROM %s", - $this->nonces_table_name)); - - $this->connection->query(sprintf("DELETE FROM %s", - $this->settings_table_name)); - } - - /** - * @access private - */ - function _verifySQL() - { - $missing = array(); - $empty = array(); - - $required_sql_keys = array( - 'nonce_table', - 'assoc_table', - 'settings_table', - 'get_auth', - 'create_auth', - 'set_assoc', - 'get_assoc', - 'get_assocs', - 'remove_assoc', - 'add_nonce', - 'get_nonce', - 'remove_nonce' - ); - - foreach ($required_sql_keys as $key) { - if (!array_key_exists($key, $this->sql)) { - $missing[] = $key; - } else if (!$this->sql[$key]) { - $empty[] = $key; - } - } - - return array($missing, $empty); - } - - /** - * @access private - */ - function _fixSQL() - { - $replacements = array( - array( - 'value' => $this->nonces_table_name, - 'keys' => array('nonce_table', - 'add_nonce', - 'get_nonce', - 'remove_nonce') - ), - array( - 'value' => $this->associations_table_name, - 'keys' => array('assoc_table', - 'set_assoc', - 'get_assoc', - 'get_assocs', - 'remove_assoc') - ), - array( - 'value' => $this->settings_table_name, - 'keys' => array('settings_table', - 'get_auth', - 'create_auth') - ) - ); - - foreach ($replacements as $item) { - $value = $item['value']; - $keys = $item['keys']; - - foreach ($keys as $k) { - if (is_array($this->sql[$k])) { - foreach ($this->sql[$k] as $part_key => $part_value) { - $this->sql[$k][$part_key] = sprintf($part_value, - $value); - } - } else { - $this->sql[$k] = sprintf($this->sql[$k], $value); - } - } - } - } - - function blobDecode($blob) - { - return $blob; - } - - function blobEncode($str) - { - return $str; - } - - function createTables() - { - $this->connection->autoCommit(true); - $n = $this->create_nonce_table(); - $a = $this->create_assoc_table(); - $s = $this->create_settings_table(); - $this->connection->autoCommit(false); - - if ($n && $a && $s) { - return true; - } else { - return false; - } - } - - function create_nonce_table() - { - if (!$this->tableExists($this->nonces_table_name)) { - $r = $this->connection->query($this->sql['nonce_table']); - return $this->resultToBool($r); - } - return true; - } - - function create_assoc_table() - { - if (!$this->tableExists($this->associations_table_name)) { - $r = $this->connection->query($this->sql['assoc_table']); - return $this->resultToBool($r); - } - return true; - } - - function create_settings_table() - { - if (!$this->tableExists($this->settings_table_name)) { - $r = $this->connection->query($this->sql['settings_table']); - return $this->resultToBool($r); - } - return true; - } - - /** - * @access private - */ - function _get_auth() - { - return $this->connection->getOne($this->sql['get_auth']); - } - - /** - * @access private - */ - function _create_auth($str) - { - return $this->connection->query($this->sql['create_auth'], - array($str)); - } - - function getAuthKey() - { - $value = $this->_get_auth(); - if (!$value) { - $auth_key = - Auth_OpenID_CryptUtil::randomString($this->AUTH_KEY_LEN); - - $auth_key_s = $this->blobEncode($auth_key); - $this->_create_auth($auth_key_s); - } else { - $auth_key_s = $value; - $auth_key = $this->blobDecode($auth_key_s); - } - - $this->connection->commit(); - - if (strlen($auth_key) != $this->AUTH_KEY_LEN) { - $fmt = "Expected %d-byte string for auth key. Got key of length %d"; - trigger_error(sprintf($fmt, $this->AUTH_KEY_LEN, strlen($auth_key)), - E_USER_WARNING); - return null; - } - - return $auth_key; - } - - /** - * @access private - */ - function _set_assoc($server_url, $handle, $secret, $issued, - $lifetime, $assoc_type) - { - return $this->connection->query($this->sql['set_assoc'], - array( - $server_url, - $handle, - $secret, - $issued, - $lifetime, - $assoc_type)); - } - - function storeAssociation($server_url, $association) - { - if ($this->resultToBool($this->_set_assoc( - $server_url, - $association->handle, - $this->blobEncode( - $association->secret), - $association->issued, - $association->lifetime, - $association->assoc_type - ))) { - $this->connection->commit(); - } else { - $this->connection->rollback(); - } - } - - /** - * @access private - */ - function _get_assoc($server_url, $handle) - { - $result = $this->connection->getRow($this->sql['get_assoc'], - array($server_url, $handle)); - if ($this->isError($result)) { - return null; - } else { - return $result; - } - } - - /** - * @access private - */ - function _get_assocs($server_url) - { - $result = $this->connection->getAll($this->sql['get_assocs'], - array($server_url)); - - if ($this->isError($result)) { - return array(); - } else { - return $result; - } - } - - function removeAssociation($server_url, $handle) - { - if ($this->_get_assoc($server_url, $handle) == null) { - return false; - } - - if ($this->resultToBool($this->connection->query( - $this->sql['remove_assoc'], - array($server_url, $handle)))) { - $this->connection->commit(); - } else { - $this->connection->rollback(); - } - - return true; - } - - function getAssociation($server_url, $handle = null) - { - if ($handle !== null) { - $assoc = $this->_get_assoc($server_url, $handle); - - $assocs = array(); - if ($assoc) { - $assocs[] = $assoc; - } - } else { - $assocs = $this->_get_assocs($server_url); - } - - if (!$assocs || (count($assocs) == 0)) { - return null; - } else { - $associations = array(); - - foreach ($assocs as $assoc_row) { - $assoc = new Auth_OpenID_Association($assoc_row['handle'], - $assoc_row['secret'], - $assoc_row['issued'], - $assoc_row['lifetime'], - $assoc_row['assoc_type']); - - $assoc->secret = $this->blobDecode($assoc->secret); - - if ($assoc->getExpiresIn() == 0) { - $this->removeAssociation($server_url, $assoc->handle); - } else { - $associations[] = array($assoc->issued, $assoc); - } - } - - if ($associations) { - $issued = array(); - $assocs = array(); - foreach ($associations as $key => $assoc) { - $issued[$key] = $assoc[0]; - $assocs[$key] = $assoc[1]; - } - - array_multisort($issued, SORT_DESC, $assocs, SORT_DESC, - $associations); - - // return the most recently issued one. - list($issued, $assoc) = $associations[0]; - return $assoc; - } else { - return null; - } - } - } - - /** - * @access private - */ - function _add_nonce($nonce, $expires) - { - $sql = $this->sql['add_nonce']; - $result = $this->connection->query($sql, array($nonce, $expires)); - return $this->resultToBool($result); - } - - /** - * @access private - */ - function storeNonce($nonce) - { - if ($this->_add_nonce($nonce, time())) { - $this->connection->commit(); - } else { - $this->connection->rollback(); - } - } - - /** - * @access private - */ - function _get_nonce($nonce) - { - $result = $this->connection->getRow($this->sql['get_nonce'], - array($nonce)); - - if ($this->isError($result)) { - return null; - } else { - return $result; - } - } - - /** - * @access private - */ - function _remove_nonce($nonce) - { - $this->connection->query($this->sql['remove_nonce'], - array($nonce)); - } - - function useNonce($nonce) - { - $row = $this->_get_nonce($nonce); - - if ($row !== null) { - $nonce = $row['nonce']; - $timestamp = $row['expires']; - $nonce_age = time() - $timestamp; - - if ($nonce_age > $this->max_nonce_age) { - $present = 0; - } else { - $present = 1; - } - - $this->_remove_nonce($nonce); - } else { - $present = 0; - } - - $this->connection->commit(); - - return $present; - } - - /** - * "Octifies" a binary string by returning a string with escaped - * octal bytes. This is used for preparing binary data for - * PostgreSQL BYTEA fields. - * - * @access private - */ - function _octify($str) - { - $result = ""; - for ($i = 0; $i < strlen($str); $i++) { - $ch = substr($str, $i, 1); - if ($ch == "\\") { - $result .= "\\\\\\\\"; - } else if (ord($ch) == 0) { - $result .= "\\\\000"; - } else { - $result .= "\\" . strval(decoct(ord($ch))); - } - } - return $result; - } - - /** - * "Unoctifies" octal-escaped data from PostgreSQL and returns the - * resulting ASCII (possibly binary) string. - * - * @access private - */ - function _unoctify($str) - { - $result = ""; - $i = 0; - while ($i < strlen($str)) { - $char = $str[$i]; - if ($char == "\\") { - // Look to see if the next char is a backslash and - // append it. - if ($str[$i + 1] != "\\") { - $octal_digits = substr($str, $i + 1, 3); - $dec = octdec($octal_digits); - $char = chr($dec); - $i += 4; - } else { - $char = "\\"; - $i += 2; - } - } else { - $i += 1; - } - - $result .= $char; - } - - return $result; - } -} - -?> + /** + * This creates a new SQLStore instance. It requires an + * established database connection be given to it, and it allows + * overriding the default table names. + * + * @param connection $connection This must be an established + * connection to a database of the correct type for the SQLStore + * subclass you're using. This must either be an PEAR DB + * connection handle or an instance of a subclass of + * Auth_OpenID_DatabaseConnection. + * + * @param string $settings_table This is an optional parameter to + * specify the name of the table used for this store's settings. + * The default value is 'oid_settings'. + * + * @param associations_table: This is an optional parameter to + * specify the name of the table used for storing associations. + * The default value is 'oid_associations'. + * + * @param nonces_table: This is an optional parameter to specify + * the name of the table used for storing nonces. The default + * value is 'oid_nonces'. + */ + function Auth_OpenID_SQLStore($connection, $settings_table = null, + $associations_table = null, + $nonces_table = null) + { + global $__Auth_OpenID_PEAR_AVAILABLE; + + $this->settings_table_name = "oid_settings"; + $this->associations_table_name = "oid_associations"; + $this->nonces_table_name = "oid_nonces"; + + // Check the connection object type to be sure it's a PEAR + // database connection. + if (!(is_object($connection) && + (is_subclass_of($connection, 'db_common') || + is_subclass_of($connection, + 'auth_openid_databaseconnection')))) { + trigger_error("Auth_OpenID_SQLStore expected PEAR connection " . + "object (got ".get_class($connection).")", + E_USER_ERROR); + return; + } + + $this->connection = $connection; + + // Be sure to set the fetch mode so the results are keyed on + // column name instead of column index. This is a PEAR + // constant, so only try to use it if PEAR is present. Note + // that Auth_Openid_Databaseconnection instances need not + // implement ::setFetchMode for this reason. + if ($__Auth_OpenID_PEAR_AVAILABLE) { + $this->connection->setFetchMode(DB_FETCHMODE_ASSOC); + } + + if ($settings_table) { + $this->settings_table_name = $settings_table; + } + + if ($associations_table) { + $this->associations_table_name = $associations_table; + } + + if ($nonces_table) { + $this->nonces_table_name = $nonces_table; + } + + $this->max_nonce_age = 6 * 60 * 60; + + // Be sure to run the database queries with auto-commit mode + // turned OFF, because we want every function to run in a + // transaction, implicitly. As a rule, methods named with a + // leading underscore will NOT control transaction behavior. + // Callers of these methods will worry about transactions. + $this->connection->autoCommit(false); + + // Create an empty SQL strings array. + $this->sql = array(); + + // Call this method (which should be overridden by subclasses) + // to populate the $this->sql array with SQL strings. + $this->setSQL(); + + // Verify that all required SQL statements have been set, and + // raise an error if any expected SQL strings were either + // absent or empty. + list($missing, $empty) = $this->_verifySQL(); + + if ($missing) { + trigger_error("Expected keys in SQL query list: " . + implode(", ", $missing), + E_USER_ERROR); + return; + } + + if ($empty) { + trigger_error("SQL list keys have no SQL strings: " . + implode(", ", $empty), + E_USER_ERROR); + return; + } + + // Add table names to queries. + $this->_fixSQL(); + } + + function tableExists($table_name) + { + return !$this->isError( + $this->connection->query("SELECT * FROM %s LIMIT 0", + $table_name)); + } + + /** + * Returns true if $value constitutes a database error; returns + * false otherwise. + */ + function isError($value) + { + return PEAR::isError($value); + } + + /** + * Converts a query result to a boolean. If the result is a + * database error according to $this->isError(), this returns + * false; otherwise, this returns true. + */ + function resultToBool($obj) + { + if ($this->isError($obj)) { + return false; + } else { + return true; + } + } + + /** + * This method should be overridden by subclasses. This method is + * called by the constructor to set values in $this->sql, which is + * an array keyed on sql name. + */ + function setSQL() + { + } + + /** + * Resets the store by removing all records from the store's + * tables. + */ + function reset() + { + $this->connection->query(sprintf("DELETE FROM %s", + $this->associations_table_name)); + + $this->connection->query(sprintf("DELETE FROM %s", + $this->nonces_table_name)); + + $this->connection->query(sprintf("DELETE FROM %s", + $this->settings_table_name)); + } + + /** + * @access private + */ + function _verifySQL() + { + $missing = array(); + $empty = array(); + + $required_sql_keys = array( + 'nonce_table', + 'assoc_table', + 'settings_table', + 'get_auth', + 'create_auth', + 'set_assoc', + 'get_assoc', + 'get_assocs', + 'remove_assoc', + 'add_nonce', + 'get_nonce', + 'remove_nonce' + ); + + foreach ($required_sql_keys as $key) { + if (!array_key_exists($key, $this->sql)) { + $missing[] = $key; + } else if (!$this->sql[$key]) { + $empty[] = $key; + } + } + + return array($missing, $empty); + } + + /** + * @access private + */ + function _fixSQL() + { + $replacements = array( + array( + 'value' => $this->nonces_table_name, + 'keys' => array('nonce_table', + 'add_nonce', + 'get_nonce', + 'remove_nonce') + ), + array( + 'value' => $this->associations_table_name, + 'keys' => array('assoc_table', + 'set_assoc', + 'get_assoc', + 'get_assocs', + 'remove_assoc') + ), + array( + 'value' => $this->settings_table_name, + 'keys' => array('settings_table', + 'get_auth', + 'create_auth') + ) + ); + + foreach ($replacements as $item) { + $value = $item['value']; + $keys = $item['keys']; + + foreach ($keys as $k) { + if (is_array($this->sql[$k])) { + foreach ($this->sql[$k] as $part_key => $part_value) { + $this->sql[$k][$part_key] = sprintf($part_value, + $value); + } + } else { + $this->sql[$k] = sprintf($this->sql[$k], $value); + } + } + } + } + + function blobDecode($blob) + { + return $blob; + } + + function blobEncode($str) + { + return $str; + } + + function createTables() + { + $this->connection->autoCommit(true); + $n = $this->create_nonce_table(); + $a = $this->create_assoc_table(); + $s = $this->create_settings_table(); + $this->connection->autoCommit(false); + + if ($n && $a && $s) { + return true; + } else { + return false; + } + } + + function create_nonce_table() + { + if (!$this->tableExists($this->nonces_table_name)) { + $r = $this->connection->query($this->sql['nonce_table']); + return $this->resultToBool($r); + } + return true; + } + + function create_assoc_table() + { + if (!$this->tableExists($this->associations_table_name)) { + $r = $this->connection->query($this->sql['assoc_table']); + return $this->resultToBool($r); + } + return true; + } + + function create_settings_table() + { + if (!$this->tableExists($this->settings_table_name)) { + $r = $this->connection->query($this->sql['settings_table']); + return $this->resultToBool($r); + } + return true; + } + + /** + * @access private + */ + function _get_auth() + { + return $this->connection->getOne($this->sql['get_auth']); + } + + /** + * @access private + */ + function _create_auth($str) + { + return $this->connection->query($this->sql['create_auth'], + array($str)); + } + + function getAuthKey() + { + $value = $this->_get_auth(); + if (!$value) { + $auth_key = + Auth_OpenID_CryptUtil::randomString($this->AUTH_KEY_LEN); + + $auth_key_s = $this->blobEncode($auth_key); + $this->_create_auth($auth_key_s); + } else { + $auth_key_s = $value; + $auth_key = $this->blobDecode($auth_key_s); + } + + $this->connection->commit(); + + if (strlen($auth_key) != $this->AUTH_KEY_LEN) { + $fmt = "Expected %d-byte string for auth key. Got key of length %d"; + trigger_error(sprintf($fmt, $this->AUTH_KEY_LEN, strlen($auth_key)), + E_USER_WARNING); + return null; + } + + return $auth_key; + } + + /** + * @access private + */ + function _set_assoc($server_url, $handle, $secret, $issued, + $lifetime, $assoc_type) + { + return $this->connection->query($this->sql['set_assoc'], + array( + $server_url, + $handle, + $secret, + $issued, + $lifetime, + $assoc_type)); + } + + function storeAssociation($server_url, $association) + { + if ($this->resultToBool($this->_set_assoc( + $server_url, + $association->handle, + $this->blobEncode( + $association->secret), + $association->issued, + $association->lifetime, + $association->assoc_type + ))) { + $this->connection->commit(); + } else { + $this->connection->rollback(); + } + } + + /** + * @access private + */ + function _get_assoc($server_url, $handle) + { + $result = $this->connection->getRow($this->sql['get_assoc'], + array($server_url, $handle)); + if ($this->isError($result)) { + return null; + } else { + return $result; + } + } + + /** + * @access private + */ + function _get_assocs($server_url) + { + $result = $this->connection->getAll($this->sql['get_assocs'], + array($server_url)); + + if ($this->isError($result)) { + return array(); + } else { + return $result; + } + } + + function removeAssociation($server_url, $handle) + { + if ($this->_get_assoc($server_url, $handle) == null) { + return false; + } + + if ($this->resultToBool($this->connection->query( + $this->sql['remove_assoc'], + array($server_url, $handle)))) { + $this->connection->commit(); + } else { + $this->connection->rollback(); + } + + return true; + } + + function getAssociation($server_url, $handle = null) + { + if ($handle !== null) { + $assoc = $this->_get_assoc($server_url, $handle); + + $assocs = array(); + if ($assoc) { + $assocs[] = $assoc; + } + } else { + $assocs = $this->_get_assocs($server_url); + } + + if (!$assocs || (count($assocs) == 0)) { + return null; + } else { + $associations = array(); + + foreach ($assocs as $assoc_row) { + $assoc = new Auth_OpenID_Association($assoc_row['handle'], + $assoc_row['secret'], + $assoc_row['issued'], + $assoc_row['lifetime'], + $assoc_row['assoc_type']); + + $assoc->secret = $this->blobDecode($assoc->secret); + + if ($assoc->getExpiresIn() == 0) { + $this->removeAssociation($server_url, $assoc->handle); + } else { + $associations[] = array($assoc->issued, $assoc); + } + } + + if ($associations) { + $issued = array(); + $assocs = array(); + foreach ($associations as $key => $assoc) { + $issued[$key] = $assoc[0]; + $assocs[$key] = $assoc[1]; + } + + array_multisort($issued, SORT_DESC, $assocs, SORT_DESC, + $associations); + + // return the most recently issued one. + list($issued, $assoc) = $associations[0]; + return $assoc; + } else { + return null; + } + } + } + + /** + * @access private + */ + function _add_nonce($nonce, $expires) + { + $sql = $this->sql['add_nonce']; + $result = $this->connection->query($sql, array($nonce, $expires)); + return $this->resultToBool($result); + } + + /** + * @access private + */ + function storeNonce($nonce) + { + if ($this->_add_nonce($nonce, time())) { + $this->connection->commit(); + } else { + $this->connection->rollback(); + } + } + + /** + * @access private + */ + function _get_nonce($nonce) + { + $result = $this->connection->getRow($this->sql['get_nonce'], + array($nonce)); + + if ($this->isError($result)) { + return null; + } else { + return $result; + } + } + + /** + * @access private + */ + function _remove_nonce($nonce) + { + $this->connection->query($this->sql['remove_nonce'], + array($nonce)); + } + + function useNonce($nonce) + { + $row = $this->_get_nonce($nonce); + + if ($row !== null) { + $nonce = $row['nonce']; + $timestamp = $row['expires']; + $nonce_age = time() - $timestamp; + + if ($nonce_age > $this->max_nonce_age) { + $present = 0; + } else { + $present = 1; + } + + $this->_remove_nonce($nonce); + } else { + $present = 0; + } + + $this->connection->commit(); + + return $present; + } + + /** + * "Octifies" a binary string by returning a string with escaped + * octal bytes. This is used for preparing binary data for + * PostgreSQL BYTEA fields. + * + * @access private + */ + function _octify($str) + { + $result = ""; + for ($i = 0; $i < strlen($str); $i++) { + $ch = substr($str, $i, 1); + if ($ch == "\\") { + $result .= "\\\\\\\\"; + } else if (ord($ch) == 0) { + $result .= "\\\\000"; + } else { + $result .= "\\" . strval(decoct(ord($ch))); + } + } + return $result; + } + + /** + * "Unoctifies" octal-escaped data from PostgreSQL and returns the + * resulting ASCII (possibly binary) string. + * + * @access private + */ + function _unoctify($str) + { + $result = ""; + $i = 0; + while ($i < strlen($str)) { + $char = $str[$i]; + if ($char == "\\") { + // Look to see if the next char is a backslash and + // append it. + if ($str[$i + 1] != "\\") { + $octal_digits = substr($str, $i + 1, 3); + $dec = octdec($octal_digits); + $char = chr($dec); + $i += 4; + } else { + $char = "\\"; + $i += 2; + } + } else { + $i += 1; + } + + $result .= $char; + } + + return $result; + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/SQLiteStore.php b/libraries/openid/Auth/OpenID/SQLiteStore.php index 3c3e1a7a10d68..992f833ffbe8b 100644 --- a/libraries/openid/Auth/OpenID/SQLiteStore.php +++ b/libraries/openid/Auth/OpenID/SQLiteStore.php @@ -19,50 +19,48 @@ * @package OpenID */ class Auth_OpenID_SQLiteStore extends Auth_OpenID_SQLStore { - function setSQL() - { - $this->sql['nonce_table'] = - "CREATE TABLE %s (nonce CHAR(8) UNIQUE PRIMARY KEY, ". - "expires INTEGER)"; + function setSQL() + { + $this->sql['nonce_table'] = + "CREATE TABLE %s (nonce CHAR(8) UNIQUE PRIMARY KEY, ". + "expires INTEGER)"; - $this->sql['assoc_table'] = - "CREATE TABLE %s (server_url VARCHAR(2047), handle VARCHAR(255), ". - "secret BLOB(128), issued INTEGER, lifetime INTEGER, ". - "assoc_type VARCHAR(64), PRIMARY KEY (server_url, handle))"; + $this->sql['assoc_table'] = + "CREATE TABLE %s (server_url VARCHAR(2047), handle VARCHAR(255), ". + "secret BLOB(128), issued INTEGER, lifetime INTEGER, ". + "assoc_type VARCHAR(64), PRIMARY KEY (server_url, handle))"; - $this->sql['settings_table'] = - "CREATE TABLE %s (setting VARCHAR(128) UNIQUE PRIMARY KEY, ". - "value BLOB(20))"; + $this->sql['settings_table'] = + "CREATE TABLE %s (setting VARCHAR(128) UNIQUE PRIMARY KEY, ". + "value BLOB(20))"; - $this->sql['create_auth'] = - "INSERT INTO %s VALUES ('auth_key', ?)"; + $this->sql['create_auth'] = + "INSERT INTO %s VALUES ('auth_key', ?)"; - $this->sql['get_auth'] = - "SELECT value FROM %s WHERE setting = 'auth_key'"; + $this->sql['get_auth'] = + "SELECT value FROM %s WHERE setting = 'auth_key'"; - $this->sql['set_assoc'] = - "INSERT OR REPLACE INTO %s VALUES (?, ?, ?, ?, ?, ?)"; + $this->sql['set_assoc'] = + "INSERT OR REPLACE INTO %s VALUES (?, ?, ?, ?, ?, ?)"; - $this->sql['get_assocs'] = - "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ". - "WHERE server_url = ?"; + $this->sql['get_assocs'] = + "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ". + "WHERE server_url = ?"; - $this->sql['get_assoc'] = - "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ". - "WHERE server_url = ? AND handle = ?"; + $this->sql['get_assoc'] = + "SELECT handle, secret, issued, lifetime, assoc_type FROM %s ". + "WHERE server_url = ? AND handle = ?"; - $this->sql['remove_assoc'] = - "DELETE FROM %s WHERE server_url = ? AND handle = ?"; + $this->sql['remove_assoc'] = + "DELETE FROM %s WHERE server_url = ? AND handle = ?"; - $this->sql['add_nonce'] = - "INSERT OR REPLACE INTO %s (nonce, expires) VALUES (?, ?)"; + $this->sql['add_nonce'] = + "INSERT OR REPLACE INTO %s (nonce, expires) VALUES (?, ?)"; - $this->sql['get_nonce'] = - "SELECT * FROM %s WHERE nonce = ?"; + $this->sql['get_nonce'] = + "SELECT * FROM %s WHERE nonce = ?"; - $this->sql['remove_nonce'] = - "DELETE FROM %s WHERE nonce = ?"; - } -} - -?> \ No newline at end of file + $this->sql['remove_nonce'] = + "DELETE FROM %s WHERE nonce = ?"; + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/Server.php b/libraries/openid/Auth/OpenID/Server.php index 1483c6b658cd8..18feeec5440e4 100644 --- a/libraries/openid/Auth/OpenID/Server.php +++ b/libraries/openid/Auth/OpenID/Server.php @@ -107,15 +107,15 @@ define('AUTH_OPENID_HTTP_ERROR', 400); global $_Auth_OpenID_Request_Modes, - $_Auth_OpenID_OpenID_Prefix, - $_Auth_OpenID_Encode_Kvform, - $_Auth_OpenID_Encode_Url; + $_Auth_OpenID_OpenID_Prefix, + $_Auth_OpenID_Encode_Kvform, + $_Auth_OpenID_Encode_Url; /** * @access private */ $_Auth_OpenID_Request_Modes = array('checkid_setup', - 'checkid_immediate'); + 'checkid_immediate'); /** * @access private @@ -137,7 +137,7 @@ */ function _isError($obj, $cls = 'Auth_OpenID_ServerError') { - return is_a($obj, $cls); + return is_a($obj, $cls); } /** @@ -148,99 +148,99 @@ function _isError($obj, $cls = 'Auth_OpenID_ServerError') * @package OpenID */ class Auth_OpenID_ServerError { - /** - * @access private - */ - function Auth_OpenID_ServerError($query = null, $message = null) - { - $this->message = $message; - $this->query = $query; - } - - /** - * Returns the return_to URL for the request which caused this - * error. - */ - function hasReturnTo() - { - global $_Auth_OpenID_OpenID_Prefix; - if ($this->query) { - return array_key_exists($_Auth_OpenID_OpenID_Prefix . - 'return_to', $this->query); - } else { - return false; - } - } - - /** - * Encodes this error's response as a URL suitable for - * redirection. If the response has no return_to, another - * Auth_OpenID_ServerError is returned. - */ - function encodeToURL() - { - global $_Auth_OpenID_OpenID_Prefix; - $return_to = Auth_OpenID::arrayGet($this->query, - $_Auth_OpenID_OpenID_Prefix . - 'return_to'); - if (!$return_to) { - return new Auth_OpenID_ServerError(null, "no return_to URL"); - } - - return Auth_OpenID::appendArgs($return_to, - array('openid.mode' => 'error', - 'openid.error' => $this->toString())); - } - - /** - * Encodes the response to key-value form. This is a - * machine-readable format used to respond to messages which came - * directly from the consumer and not through the user-agent. See - * the OpenID specification. - */ - function encodeToKVForm() - { - return Auth_OpenID_KVForm::fromArray( - array('mode' => 'error', - 'error' => $this->toString())); - } - - /** - * Returns one of $_Auth_OpenID_Encode_Url, - * $_Auth_OpenID_Encode_Kvform, or null, depending on the type of - * encoding expected for this error's payload. - */ - function whichEncoding() - { - global $_Auth_OpenID_Encode_Url, - $_Auth_OpenID_Encode_Kvform, - $_Auth_OpenID_Request_Modes; - - if ($this->hasReturnTo()) { - return $_Auth_OpenID_Encode_Url; - } - - $mode = Auth_OpenID::arrayGet($this->query, 'openid.mode'); - - if ($mode) { - if (!in_array($mode, $_Auth_OpenID_Request_Modes)) { - return $_Auth_OpenID_Encode_Kvform; - } - } - return null; - } - - /** - * Returns this error message. - */ - function toString() - { - if ($this->message) { - return $this->message; - } else { - return get_class($this) . " error"; - } - } + /** + * @access private + */ + function Auth_OpenID_ServerError($query = null, $message = null) + { + $this->message = $message; + $this->query = $query; + } + + /** + * Returns the return_to URL for the request which caused this + * error. + */ + function hasReturnTo() + { + global $_Auth_OpenID_OpenID_Prefix; + if ($this->query) { + return array_key_exists($_Auth_OpenID_OpenID_Prefix . + 'return_to', $this->query); + } else { + return false; + } + } + + /** + * Encodes this error's response as a URL suitable for + * redirection. If the response has no return_to, another + * Auth_OpenID_ServerError is returned. + */ + function encodeToURL() + { + global $_Auth_OpenID_OpenID_Prefix; + $return_to = Auth_OpenID::arrayGet($this->query, + $_Auth_OpenID_OpenID_Prefix . + 'return_to'); + if (!$return_to) { + return new Auth_OpenID_ServerError(null, "no return_to URL"); + } + + return Auth_OpenID::appendArgs($return_to, + array('openid.mode' => 'error', + 'openid.error' => $this->toString())); + } + + /** + * Encodes the response to key-value form. This is a + * machine-readable format used to respond to messages which came + * directly from the consumer and not through the user-agent. See + * the OpenID specification. + */ + function encodeToKVForm() + { + return Auth_OpenID_KVForm::fromArray( + array('mode' => 'error', + 'error' => $this->toString())); + } + + /** + * Returns one of $_Auth_OpenID_Encode_Url, + * $_Auth_OpenID_Encode_Kvform, or null, depending on the type of + * encoding expected for this error's payload. + */ + function whichEncoding() + { + global $_Auth_OpenID_Encode_Url, + $_Auth_OpenID_Encode_Kvform, + $_Auth_OpenID_Request_Modes; + + if ($this->hasReturnTo()) { + return $_Auth_OpenID_Encode_Url; + } + + $mode = Auth_OpenID::arrayGet($this->query, 'openid.mode'); + + if ($mode) { + if (!in_array($mode, $_Auth_OpenID_Request_Modes)) { + return $_Auth_OpenID_Encode_Kvform; + } + } + return null; + } + + /** + * Returns this error message. + */ + function toString() + { + if ($this->message) { + return $this->message; + } else { + return get_class($this) . " error"; + } + } } /** @@ -249,11 +249,11 @@ function toString() * @package OpenID */ class Auth_OpenID_MalformedReturnURL extends Auth_OpenID_ServerError { - function Auth_OpenID_MalformedReturnURL($query, $return_to) - { - $this->return_to = $return_to; - parent::Auth_OpenID_ServerError($query, "malformed return_to URL"); - } + function Auth_OpenID_MalformedReturnURL($query, $return_to) + { + $this->return_to = $return_to; + parent::Auth_OpenID_ServerError($query, "malformed return_to URL"); + } } /** @@ -262,10 +262,10 @@ function Auth_OpenID_MalformedReturnURL($query, $return_to) * @package OpenID */ class Auth_OpenID_MalformedTrustRoot extends Auth_OpenID_ServerError { - function toString() - { - return "Malformed trust root"; - } + function toString() + { + return "Malformed trust root"; + } } /** @@ -275,7 +275,7 @@ function toString() * @package OpenID */ class Auth_OpenID_Request { - var $mode = null; + var $mode = null; } /** @@ -285,190 +285,190 @@ class Auth_OpenID_Request { * @package OpenID */ class Auth_OpenID_CheckAuthRequest extends Auth_OpenID_Request { - var $mode = "check_authentication"; - var $invalidate_handle = null; - - function Auth_OpenID_CheckAuthRequest($assoc_handle, $sig, $signed, - $invalidate_handle = null) - { - $this->assoc_handle = $assoc_handle; - $this->sig = $sig; - $this->signed = $signed; - if ($invalidate_handle !== null) { - $this->invalidate_handle = $invalidate_handle; - } - } - - function fromQuery($query) - { - global $_Auth_OpenID_OpenID_Prefix; - - $required_keys = array('assoc_handle', 'sig', 'signed'); - - foreach ($required_keys as $k) { - if (!array_key_exists($_Auth_OpenID_OpenID_Prefix . $k, - $query)) { - return new Auth_OpenID_ServerError($query, - sprintf("%s request missing required parameter %s from \ - query", "check_authentication", $k)); - } - } - - $assoc_handle = $query[$_Auth_OpenID_OpenID_Prefix . 'assoc_handle']; - $sig = $query[$_Auth_OpenID_OpenID_Prefix . 'sig']; - $signed_list = $query[$_Auth_OpenID_OpenID_Prefix . 'signed']; - - $signed_list = explode(",", $signed_list); - $signed_pairs = array(); - - foreach ($signed_list as $field) { - if ($field == 'mode') { - // XXX KLUDGE HAX WEB PROTOCoL BR0KENNN - // - // openid.mode is currently check_authentication - // because that's the mode of this request. But the - // signature was made on something with a different - // openid.mode. - $value = "id_res"; - } else { - if (array_key_exists($_Auth_OpenID_OpenID_Prefix . $field, - $query)) { - $value = $query[$_Auth_OpenID_OpenID_Prefix . $field]; - } else { - return new Auth_OpenID_ServerError($query, - sprintf("Couldn't find signed field %r in query %s", - $field, var_export($query, true))); - } - } - $signed_pairs[] = array($field, $value); - } - - $result = new Auth_OpenID_CheckAuthRequest($assoc_handle, $sig, - $signed_pairs); - $result->invalidate_handle = Auth_OpenID::arrayGet($query, - $_Auth_OpenID_OpenID_Prefix . 'invalidate_handle'); - return $result; - } - - function answer(&$signatory) - { - $is_valid = $signatory->verify($this->assoc_handle, $this->sig, - $this->signed); - - // Now invalidate that assoc_handle so it this checkAuth - // message cannot be replayed. - $signatory->invalidate($this->assoc_handle, true); - $response = new Auth_OpenID_ServerResponse($this); - $response->fields['is_valid'] = $is_valid ? "true" : "false"; - - if ($this->invalidate_handle) { - $assoc = $signatory->getAssociation($this->invalidate_handle, - false); - if (!$assoc) { - $response->fields['invalidate_handle'] = - $this->invalidate_handle; - } - } - return $response; - } + var $mode = "check_authentication"; + var $invalidate_handle = null; + + function Auth_OpenID_CheckAuthRequest($assoc_handle, $sig, $signed, + $invalidate_handle = null) + { + $this->assoc_handle = $assoc_handle; + $this->sig = $sig; + $this->signed = $signed; + if ($invalidate_handle !== null) { + $this->invalidate_handle = $invalidate_handle; + } + } + + function fromQuery($query) + { + global $_Auth_OpenID_OpenID_Prefix; + + $required_keys = array('assoc_handle', 'sig', 'signed'); + + foreach ($required_keys as $k) { + if (!array_key_exists($_Auth_OpenID_OpenID_Prefix . $k, + $query)) { + return new Auth_OpenID_ServerError($query, + sprintf("%s request missing required parameter %s from \ + query", "check_authentication", $k)); + } + } + + $assoc_handle = $query[$_Auth_OpenID_OpenID_Prefix . 'assoc_handle']; + $sig = $query[$_Auth_OpenID_OpenID_Prefix . 'sig']; + $signed_list = $query[$_Auth_OpenID_OpenID_Prefix . 'signed']; + + $signed_list = explode(",", $signed_list); + $signed_pairs = array(); + + foreach ($signed_list as $field) { + if ($field == 'mode') { + // XXX KLUDGE HAX WEB PROTOCoL BR0KENNN + // + // openid.mode is currently check_authentication + // because that's the mode of this request. But the + // signature was made on something with a different + // openid.mode. + $value = "id_res"; + } else { + if (array_key_exists($_Auth_OpenID_OpenID_Prefix . $field, + $query)) { + $value = $query[$_Auth_OpenID_OpenID_Prefix . $field]; + } else { + return new Auth_OpenID_ServerError($query, + sprintf("Couldn't find signed field %r in query %s", + $field, var_export($query, true))); + } + } + $signed_pairs[] = array($field, $value); + } + + $result = new Auth_OpenID_CheckAuthRequest($assoc_handle, $sig, + $signed_pairs); + $result->invalidate_handle = Auth_OpenID::arrayGet($query, + $_Auth_OpenID_OpenID_Prefix . 'invalidate_handle'); + return $result; + } + + function answer(&$signatory) + { + $is_valid = $signatory->verify($this->assoc_handle, $this->sig, + $this->signed); + + // Now invalidate that assoc_handle so it this checkAuth + // message cannot be replayed. + $signatory->invalidate($this->assoc_handle, true); + $response = new Auth_OpenID_ServerResponse($this); + $response->fields['is_valid'] = $is_valid ? "true" : "false"; + + if ($this->invalidate_handle) { + $assoc = $signatory->getAssociation($this->invalidate_handle, + false); + if (!$assoc) { + $response->fields['invalidate_handle'] = + $this->invalidate_handle; + } + } + return $response; + } } class Auth_OpenID_PlainTextServerSession { - /** - * An object that knows how to handle association requests with no - * session type. - */ - var $session_type = 'plaintext'; - - function fromQuery($unused_request) - { - return new Auth_OpenID_PlainTextServerSession(); - } - - function answer($secret) - { - return array('mac_key' => base64_encode($secret)); - } + /** + * An object that knows how to handle association requests with no + * session type. + */ + var $session_type = 'plaintext'; + + function fromQuery($unused_request) + { + return new Auth_OpenID_PlainTextServerSession(); + } + + function answer($secret) + { + return array('mac_key' => base64_encode($secret)); + } } class Auth_OpenID_DiffieHellmanServerSession { - /** - * An object that knows how to handle association requests with - * the Diffie-Hellman session type. - */ - - var $session_type = 'DH-SHA1'; - - function Auth_OpenID_DiffieHellmanServerSession($dh, $consumer_pubkey) - { - $this->dh = $dh; - $this->consumer_pubkey = $consumer_pubkey; - } - - function fromQuery($query) - { - $dh_modulus = Auth_OpenID::arrayGet($query, 'openid.dh_modulus'); - $dh_gen = Auth_OpenID::arrayGet($query, 'openid.dh_gen'); - - if ((($dh_modulus === null) && ($dh_gen !== null)) || - (($dh_gen === null) && ($dh_modulus !== null))) { - - if ($dh_modulus === null) { - $missing = 'modulus'; - } else { - $missing = 'generator'; - } - - return new Auth_OpenID_ServerError( - 'If non-default modulus or generator is '. - 'supplied, both must be supplied. Missing '. - $missing); - } - - $lib =& Auth_OpenID_getMathLib(); - - if ($dh_modulus || $dh_gen) { - $dh_modulus = $lib->base64ToLong($dh_modulus); - $dh_gen = $lib->base64ToLong($dh_gen); - if ($lib->cmp($dh_modulus, 0) == 0 || - $lib->cmp($dh_gen, 0) == 0) { - return new Auth_OpenID_ServerError( - $query, "Failed to parse dh_mod or dh_gen"); - } - $dh = new Auth_OpenID_DiffieHellman($dh_modulus, $dh_gen); - } else { - $dh = new Auth_OpenID_DiffieHellman(); - } - - $consumer_pubkey = Auth_OpenID::arrayGet($query, - 'openid.dh_consumer_public'); - if ($consumer_pubkey === null) { - return new Auth_OpenID_ServerError( - 'Public key for DH-SHA1 session '. - 'not found in query'); - } - - $consumer_pubkey = - $lib->base64ToLong($consumer_pubkey); - - if ($consumer_pubkey === false) { - return new Auth_OpenID_ServerError($query, - "dh_consumer_public is not base64"); - } - - return new Auth_OpenID_DiffieHellmanServerSession($dh, - $consumer_pubkey); - } - - function answer($secret) - { - $lib =& Auth_OpenID_getMathLib(); - $mac_key = $this->dh->xorSecret($this->consumer_pubkey, $secret); - return array( - 'dh_server_public' => - $lib->longToBase64($this->dh->public), - 'enc_mac_key' => base64_encode($mac_key)); - } + /** + * An object that knows how to handle association requests with + * the Diffie-Hellman session type. + */ + + var $session_type = 'DH-SHA1'; + + function Auth_OpenID_DiffieHellmanServerSession($dh, $consumer_pubkey) + { + $this->dh = $dh; + $this->consumer_pubkey = $consumer_pubkey; + } + + function fromQuery($query) + { + $dh_modulus = Auth_OpenID::arrayGet($query, 'openid.dh_modulus'); + $dh_gen = Auth_OpenID::arrayGet($query, 'openid.dh_gen'); + + if ((($dh_modulus === null) && ($dh_gen !== null)) || + (($dh_gen === null) && ($dh_modulus !== null))) { + + if ($dh_modulus === null) { + $missing = 'modulus'; + } else { + $missing = 'generator'; + } + + return new Auth_OpenID_ServerError( + 'If non-default modulus or generator is '. + 'supplied, both must be supplied. Missing '. + $missing); + } + + $lib =& Auth_OpenID_getMathLib(); + + if ($dh_modulus || $dh_gen) { + $dh_modulus = $lib->base64ToLong($dh_modulus); + $dh_gen = $lib->base64ToLong($dh_gen); + if ($lib->cmp($dh_modulus, 0) == 0 || + $lib->cmp($dh_gen, 0) == 0) { + return new Auth_OpenID_ServerError( + $query, "Failed to parse dh_mod or dh_gen"); + } + $dh = new Auth_OpenID_DiffieHellman($dh_modulus, $dh_gen); + } else { + $dh = new Auth_OpenID_DiffieHellman(); + } + + $consumer_pubkey = Auth_OpenID::arrayGet($query, + 'openid.dh_consumer_public'); + if ($consumer_pubkey === null) { + return new Auth_OpenID_ServerError( + 'Public key for DH-SHA1 session '. + 'not found in query'); + } + + $consumer_pubkey = + $lib->base64ToLong($consumer_pubkey); + + if ($consumer_pubkey === false) { + return new Auth_OpenID_ServerError($query, + "dh_consumer_public is not base64"); + } + + return new Auth_OpenID_DiffieHellmanServerSession($dh, + $consumer_pubkey); + } + + function answer($secret) + { + $lib =& Auth_OpenID_getMathLib(); + $mac_key = $this->dh->xorSecret($this->consumer_pubkey, $secret); + return array( + 'dh_server_public' => + $lib->longToBase64($this->dh->public), + 'enc_mac_key' => base64_encode($mac_key)); + } } /** @@ -478,67 +478,67 @@ function answer($secret) * @package OpenID */ class Auth_OpenID_AssociateRequest extends Auth_OpenID_Request { - var $mode = "associate"; - var $assoc_type = 'HMAC-SHA1'; - - function Auth_OpenID_AssociateRequest(&$session) - { - $this->session =& $session; - } - - function fromQuery($query) - { - global $_Auth_OpenID_OpenID_Prefix; - - $session_classes = array( - 'DH-SHA1' => 'Auth_OpenID_DiffieHellmanServerSession', - null => 'Auth_OpenID_PlainTextServerSession'); - - $session_type = null; - - if (array_key_exists($_Auth_OpenID_OpenID_Prefix . 'session_type', - $query)) { - $session_type = $query[$_Auth_OpenID_OpenID_Prefix . - 'session_type']; - } - - if (!array_key_exists($session_type, $session_classes)) { - return new Auth_OpenID_ServerError($query, - "Unknown session type $session_type"); - } - - $session_cls = $session_classes[$session_type]; - $session = call_user_func_array(array($session_cls, 'fromQuery'), - array($query)); - - if (($session === null) || (_isError($session))) { - return new Auth_OpenID_ServerError($query, - "Error parsing $session_type session"); - } - - return new Auth_OpenID_AssociateRequest($session); - } - - function answer($assoc) - { - $ml =& Auth_OpenID_getMathLib(); - $response = new Auth_OpenID_ServerResponse($this); - - $response->fields = array('expires_in' => $assoc->getExpiresIn(), - 'assoc_type' => 'HMAC-SHA1', - 'assoc_handle' => $assoc->handle); - - $r = $this->session->answer($assoc->secret); - foreach ($r as $k => $v) { - $response->fields[$k] = $v; - } - - if ($this->session->session_type != 'plaintext') { - $response->fields['session_type'] = $this->session->session_type; - } - - return $response; - } + var $mode = "associate"; + var $assoc_type = 'HMAC-SHA1'; + + function Auth_OpenID_AssociateRequest(&$session) + { + $this->session =& $session; + } + + function fromQuery($query) + { + global $_Auth_OpenID_OpenID_Prefix; + + $session_classes = array( + 'DH-SHA1' => 'Auth_OpenID_DiffieHellmanServerSession', + null => 'Auth_OpenID_PlainTextServerSession'); + + $session_type = null; + + if (array_key_exists($_Auth_OpenID_OpenID_Prefix . 'session_type', + $query)) { + $session_type = $query[$_Auth_OpenID_OpenID_Prefix . + 'session_type']; + } + + if (!array_key_exists($session_type, $session_classes)) { + return new Auth_OpenID_ServerError($query, + "Unknown session type $session_type"); + } + + $session_cls = $session_classes[$session_type]; + $session = call_user_func_array(array($session_cls, 'fromQuery'), + array($query)); + + if (($session === null) || (_isError($session))) { + return new Auth_OpenID_ServerError($query, + "Error parsing $session_type session"); + } + + return new Auth_OpenID_AssociateRequest($session); + } + + function answer($assoc) + { + $ml =& Auth_OpenID_getMathLib(); + $response = new Auth_OpenID_ServerResponse($this); + + $response->fields = array('expires_in' => $assoc->getExpiresIn(), + 'assoc_type' => 'HMAC-SHA1', + 'assoc_handle' => $assoc->handle); + + $r = $this->session->answer($assoc->secret); + foreach ($r as $k => $v) { + $response->fields[$k] = $v; + } + + if ($this->session->session_type != 'plaintext') { + $response->fields['session_type'] = $this->session->session_type; + } + + return $response; + } } /** @@ -548,218 +548,218 @@ function answer($assoc) * @package OpenID */ class Auth_OpenID_CheckIDRequest extends Auth_OpenID_Request { - var $mode = "checkid_setup"; // or "checkid_immediate" - var $immediate = false; - var $trust_root = null; - - function make($query, $identity, $return_to, $trust_root = null, - $immediate = false, $assoc_handle = null) - { - if (!Auth_OpenID_TrustRoot::_parse($return_to)) { - return new Auth_OpenID_MalformedReturnURL($query, $return_to); - } - - $r = new Auth_OpenID_CheckIDRequest($identity, $return_to, - $trust_root, $immediate, - $assoc_handle); - - if (!$r->trustRootValid()) { - return new Auth_OpenID_UntrustedReturnURL($return_to, - $trust_root); - } else { - return $r; - } - } - - function Auth_OpenID_CheckIDRequest($identity, $return_to, - $trust_root = null, $immediate = false, - $assoc_handle = null) - { - $this->identity = $identity; - $this->return_to = $return_to; - $this->trust_root = $trust_root; - $this->assoc_handle = $assoc_handle; - - if ($immediate) { - $this->immediate = true; - $this->mode = "checkid_immediate"; - } else { - $this->immediate = false; - $this->mode = "checkid_setup"; - } - } - - function fromQuery($query) - { - global $_Auth_OpenID_OpenID_Prefix; - - $mode = $query[$_Auth_OpenID_OpenID_Prefix . 'mode']; - $immediate = null; - - if ($mode == "checkid_immediate") { - $immediate = true; - $mode = "checkid_immediate"; - } else { - $immediate = false; - $mode = "checkid_setup"; - } - - $required = array('identity', - 'return_to'); - - $optional = array('trust_root', - 'assoc_handle'); - - $values = array(); - - foreach ($required as $field) { - if (array_key_exists($_Auth_OpenID_OpenID_Prefix . $field, - $query)) { - $value = $query[$_Auth_OpenID_OpenID_Prefix . $field]; - } else { - return new Auth_OpenID_ServerError($query, - sprintf("Missing required field %s from request", - $field)); - } - $values[$field] = $value; - } - - foreach ($optional as $field) { - $value = null; - if (array_key_exists($_Auth_OpenID_OpenID_Prefix . $field, - $query)) { - $value = $query[$_Auth_OpenID_OpenID_Prefix. $field]; - } - if ($value) { - $values[$field] = $value; - } - } - - if (!Auth_OpenID_TrustRoot::_parse($values['return_to'])) { - return new Auth_OpenID_MalformedReturnURL($query, - $values['return_to']); - } - - $obj = Auth_OpenID_CheckIDRequest::make($query, - $values['identity'], - $values['return_to'], - Auth_OpenID::arrayGet($values, - 'trust_root', null), - $immediate); - - if (is_a($obj, 'Auth_OpenID_ServerError')) { - return $obj; - } - - if (Auth_OpenID::arrayGet($values, 'assoc_handle')) { - $obj->assoc_handle = $values['assoc_handle']; - } - - return $obj; - } - - function trustRootValid() - { - if (!$this->trust_root) { - return true; - } - - $tr = Auth_OpenID_TrustRoot::_parse($this->trust_root); - if ($tr === false) { - return new Auth_OpenID_MalformedTrustRoot(null, $this->trust_root); - } - - return Auth_OpenID_TrustRoot::match($this->trust_root, - $this->return_to); - } - - function answer($allow, $server_url = null) - { - if ($allow || $this->immediate) { - $mode = 'id_res'; - } else { - $mode = 'cancel'; - } - - $response = new Auth_OpenID_CheckIDResponse($this, $mode); - - if ($allow) { - $response->fields['identity'] = $this->identity; - $response->fields['return_to'] = $this->return_to; - if (!$this->trustRootValid()) { - return new Auth_OpenID_UntrustedReturnURL($this->return_to, - $this->trust_root); - } - } else { - $response->signed = array(); - if ($this->immediate) { - if (!$server_url) { - return new Auth_OpenID_ServerError(null, - 'setup_url is required for $allow=false \ - in immediate mode.'); - } - - $setup_request =& new Auth_OpenID_CheckIDRequest( - $this->identity, - $this->return_to, - $this->trust_root, - false, - $this->assoc_handle); - - $setup_url = $setup_request->encodeToURL($server_url); - - $response->fields['user_setup_url'] = $setup_url; - } - } - - return $response; - } - - function encodeToURL($server_url) - { - global $_Auth_OpenID_OpenID_Prefix; - - // Imported from the alternate reality where these classes are - // used in both the client and server code, so Requests are - // Encodable too. That's right, code imported from alternate - // realities all for the love of you, id_res/user_setup_url. - - $q = array('mode' => $this->mode, - 'identity' => $this->identity, - 'return_to' => $this->return_to); - - if ($this->trust_root) { - $q['trust_root'] = $this->trust_root; - } - - if ($this->assoc_handle) { - $q['assoc_handle'] = $this->assoc_handle; - } - - $_q = array(); - - foreach ($q as $k => $v) { - $_q[$_Auth_OpenID_OpenID_Prefix . $k] = $v; - } - - return Auth_OpenID::appendArgs($server_url, $_q); - } - - function getCancelURL() - { - global $_Auth_OpenID_OpenID_Prefix; - - if ($this->immediate) { - return new Auth_OpenID_ServerError(null, - "Cancel is not an appropriate \ - response to immediate mode \ - requests."); - } - - return Auth_OpenID::appendArgs($this->return_to, - array($_Auth_OpenID_OpenID_Prefix . 'mode' => - 'cancel')); - } + var $mode = "checkid_setup"; // or "checkid_immediate" + var $immediate = false; + var $trust_root = null; + + function make($query, $identity, $return_to, $trust_root = null, + $immediate = false, $assoc_handle = null) + { + if (!Auth_OpenID_TrustRoot::_parse($return_to)) { + return new Auth_OpenID_MalformedReturnURL($query, $return_to); + } + + $r = new Auth_OpenID_CheckIDRequest($identity, $return_to, + $trust_root, $immediate, + $assoc_handle); + + if (!$r->trustRootValid()) { + return new Auth_OpenID_UntrustedReturnURL($return_to, + $trust_root); + } else { + return $r; + } + } + + function Auth_OpenID_CheckIDRequest($identity, $return_to, + $trust_root = null, $immediate = false, + $assoc_handle = null) + { + $this->identity = $identity; + $this->return_to = $return_to; + $this->trust_root = $trust_root; + $this->assoc_handle = $assoc_handle; + + if ($immediate) { + $this->immediate = true; + $this->mode = "checkid_immediate"; + } else { + $this->immediate = false; + $this->mode = "checkid_setup"; + } + } + + function fromQuery($query) + { + global $_Auth_OpenID_OpenID_Prefix; + + $mode = $query[$_Auth_OpenID_OpenID_Prefix . 'mode']; + $immediate = null; + + if ($mode == "checkid_immediate") { + $immediate = true; + $mode = "checkid_immediate"; + } else { + $immediate = false; + $mode = "checkid_setup"; + } + + $required = array('identity', + 'return_to'); + + $optional = array('trust_root', + 'assoc_handle'); + + $values = array(); + + foreach ($required as $field) { + if (array_key_exists($_Auth_OpenID_OpenID_Prefix . $field, + $query)) { + $value = $query[$_Auth_OpenID_OpenID_Prefix . $field]; + } else { + return new Auth_OpenID_ServerError($query, + sprintf("Missing required field %s from request", + $field)); + } + $values[$field] = $value; + } + + foreach ($optional as $field) { + $value = null; + if (array_key_exists($_Auth_OpenID_OpenID_Prefix . $field, + $query)) { + $value = $query[$_Auth_OpenID_OpenID_Prefix. $field]; + } + if ($value) { + $values[$field] = $value; + } + } + + if (!Auth_OpenID_TrustRoot::_parse($values['return_to'])) { + return new Auth_OpenID_MalformedReturnURL($query, + $values['return_to']); + } + + $obj = Auth_OpenID_CheckIDRequest::make($query, + $values['identity'], + $values['return_to'], + Auth_OpenID::arrayGet($values, + 'trust_root', null), + $immediate); + + if (is_a($obj, 'Auth_OpenID_ServerError')) { + return $obj; + } + + if (Auth_OpenID::arrayGet($values, 'assoc_handle')) { + $obj->assoc_handle = $values['assoc_handle']; + } + + return $obj; + } + + function trustRootValid() + { + if (!$this->trust_root) { + return true; + } + + $tr = Auth_OpenID_TrustRoot::_parse($this->trust_root); + if ($tr === false) { + return new Auth_OpenID_MalformedTrustRoot(null, $this->trust_root); + } + + return Auth_OpenID_TrustRoot::match($this->trust_root, + $this->return_to); + } + + function answer($allow, $server_url = null) + { + if ($allow || $this->immediate) { + $mode = 'id_res'; + } else { + $mode = 'cancel'; + } + + $response = new Auth_OpenID_CheckIDResponse($this, $mode); + + if ($allow) { + $response->fields['identity'] = $this->identity; + $response->fields['return_to'] = $this->return_to; + if (!$this->trustRootValid()) { + return new Auth_OpenID_UntrustedReturnURL($this->return_to, + $this->trust_root); + } + } else { + $response->signed = array(); + if ($this->immediate) { + if (!$server_url) { + return new Auth_OpenID_ServerError(null, + 'setup_url is required for $allow=false \ + in immediate mode.'); + } + + $setup_request =& new Auth_OpenID_CheckIDRequest( + $this->identity, + $this->return_to, + $this->trust_root, + false, + $this->assoc_handle); + + $setup_url = $setup_request->encodeToURL($server_url); + + $response->fields['user_setup_url'] = $setup_url; + } + } + + return $response; + } + + function encodeToURL($server_url) + { + global $_Auth_OpenID_OpenID_Prefix; + + // Imported from the alternate reality where these classes are + // used in both the client and server code, so Requests are + // Encodable too. That's right, code imported from alternate + // realities all for the love of you, id_res/user_setup_url. + + $q = array('mode' => $this->mode, + 'identity' => $this->identity, + 'return_to' => $this->return_to); + + if ($this->trust_root) { + $q['trust_root'] = $this->trust_root; + } + + if ($this->assoc_handle) { + $q['assoc_handle'] = $this->assoc_handle; + } + + $_q = array(); + + foreach ($q as $k => $v) { + $_q[$_Auth_OpenID_OpenID_Prefix . $k] = $v; + } + + return Auth_OpenID::appendArgs($server_url, $_q); + } + + function getCancelURL() + { + global $_Auth_OpenID_OpenID_Prefix; + + if ($this->immediate) { + return new Auth_OpenID_ServerError(null, + "Cancel is not an appropriate \ + response to immediate mode \ + requests."); + } + + return Auth_OpenID::appendArgs($this->return_to, + array($_Auth_OpenID_OpenID_Prefix . 'mode' => + 'cancel')); + } } /** @@ -770,42 +770,42 @@ function getCancelURL() */ class Auth_OpenID_ServerResponse { - function Auth_OpenID_ServerResponse($request) - { - $this->request = $request; - $this->fields = array(); - } - - function whichEncoding() - { - global $_Auth_OpenID_Encode_Kvform, - $_Auth_OpenID_Request_Modes, - $_Auth_OpenID_Encode_Url; - - if (in_array($this->request->mode, $_Auth_OpenID_Request_Modes)) { - return $_Auth_OpenID_Encode_Url; - } else { - return $_Auth_OpenID_Encode_Kvform; - } - } - - function encodeToURL() - { - global $_Auth_OpenID_OpenID_Prefix; - - $fields = array(); - - foreach ($this->fields as $k => $v) { - $fields[$_Auth_OpenID_OpenID_Prefix . $k] = $v; - } - - return Auth_OpenID::appendArgs($this->request->return_to, $fields); - } - - function encodeToKVForm() - { - return Auth_OpenID_KVForm::fromArray($this->fields); - } + function Auth_OpenID_ServerResponse($request) + { + $this->request = $request; + $this->fields = array(); + } + + function whichEncoding() + { + global $_Auth_OpenID_Encode_Kvform, + $_Auth_OpenID_Request_Modes, + $_Auth_OpenID_Encode_Url; + + if (in_array($this->request->mode, $_Auth_OpenID_Request_Modes)) { + return $_Auth_OpenID_Encode_Url; + } else { + return $_Auth_OpenID_Encode_Kvform; + } + } + + function encodeToURL() + { + global $_Auth_OpenID_OpenID_Prefix; + + $fields = array(); + + foreach ($this->fields as $k => $v) { + $fields[$_Auth_OpenID_OpenID_Prefix . $k] = $v; + } + + return Auth_OpenID::appendArgs($this->request->return_to, $fields); + } + + function encodeToKVForm() + { + return Auth_OpenID_KVForm::fromArray($this->fields); + } } /** @@ -816,48 +816,48 @@ function encodeToKVForm() */ class Auth_OpenID_CheckIDResponse extends Auth_OpenID_ServerResponse { - function Auth_OpenID_CheckIDResponse(&$request, $mode = 'id_res') - { - parent::Auth_OpenID_ServerResponse($request); - $this->fields['mode'] = $mode; - $this->signed = array(); - - if ($mode == 'id_res') { - array_push($this->signed, 'mode', 'identity', 'return_to'); - } - } - - function addField($namespace, $key, $value, $signed = true) - { - if ($namespace) { - $key = sprintf('%s.%s', $namespace, $key); - } - $this->fields[$key] = $value; - if ($signed && !in_array($key, $this->signed)) { - $this->signed[] = $key; - } - } - - function addFields($namespace, $fields, $signed = true) - { - foreach ($fields as $k => $v) { - $this->addField($namespace, $k, $v, $signed); - } - } - - function update($namespace, $other) - { - $namespaced_fields = array(); - - foreach ($other->fields as $k => $v) { - $name = sprintf('%s.%s', $namespace, $k); - - $namespaced_fields[$name] = $v; - } - - $this->fields = array_merge($this->fields, $namespaced_fields); - $this->signed = array_merge($this->signed, $other->signed); - } + function Auth_OpenID_CheckIDResponse(&$request, $mode = 'id_res') + { + parent::Auth_OpenID_ServerResponse($request); + $this->fields['mode'] = $mode; + $this->signed = array(); + + if ($mode == 'id_res') { + array_push($this->signed, 'mode', 'identity', 'return_to'); + } + } + + function addField($namespace, $key, $value, $signed = true) + { + if ($namespace) { + $key = sprintf('%s.%s', $namespace, $key); + } + $this->fields[$key] = $value; + if ($signed && !in_array($key, $this->signed)) { + $this->signed[] = $key; + } + } + + function addFields($namespace, $fields, $signed = true) + { + foreach ($fields as $k => $v) { + $this->addField($namespace, $k, $v, $signed); + } + } + + function update($namespace, $other) + { + $namespaced_fields = array(); + + foreach ($other->fields as $k => $v) { + $name = sprintf('%s.%s', $namespace, $k); + + $namespaced_fields[$name] = $v; + } + + $this->fields = array_merge($this->fields, $namespaced_fields); + $this->signed = array_merge($this->signed, $other->signed); + } } /** @@ -867,26 +867,26 @@ function update($namespace, $other) * @package OpenID */ class Auth_OpenID_WebResponse { - var $code = AUTH_OPENID_HTTP_OK; - var $body = ""; - - function Auth_OpenID_WebResponse($code = null, $headers = null, - $body = null) - { - if ($code) { - $this->code = $code; - } - - if ($headers !== null) { - $this->headers = $headers; - } else { - $this->headers = array(); - } - - if ($body !== null) { - $this->body = $body; - } - } + var $code = AUTH_OPENID_HTTP_OK; + var $body = ""; + + function Auth_OpenID_WebResponse($code = null, $headers = null, + $body = null) + { + if ($code) { + $this->code = $code; + } + + if ($headers !== null) { + $this->headers = $headers; + } else { + $this->headers = array(); + } + + if ($body !== null) { + $this->body = $body; + } + } } /** @@ -897,132 +897,132 @@ function Auth_OpenID_WebResponse($code = null, $headers = null, */ class Auth_OpenID_Signatory { - // = 14 * 24 * 60 * 60; # 14 days, in seconds - var $SECRET_LIFETIME = 1209600; - - // keys have a bogus server URL in them because the filestore - // really does expect that key to be a URL. This seems a little - // silly for the server store, since I expect there to be only one - // server URL. - var $normal_key = 'http://localhost/|normal'; - var $dumb_key = 'http://localhost/|dumb'; - - /** - * Create a new signatory using a given store. - */ - function Auth_OpenID_Signatory(&$store) - { - // assert store is not None - $this->store =& $store; - } - - /** - * Verify, using a given association handle, a signature with - * signed key-value pairs from an HTTP request. - */ - function verify($assoc_handle, $sig, $signed_pairs) - { - $assoc = $this->getAssociation($assoc_handle, true); - if (!$assoc) { - // oidutil.log("failed to get assoc with handle %r to verify sig %r" - // % (assoc_handle, sig)) - return false; - } - - $expected_sig = base64_encode($assoc->sign($signed_pairs)); - - return $sig == $expected_sig; - } - - /** - * Given a response, sign the fields in the response's 'signed' - * list, and insert the signature into the response. - */ - function sign($response) - { - $signed_response = $response; - $assoc_handle = $response->request->assoc_handle; - - if ($assoc_handle) { - // normal mode - $assoc = $this->getAssociation($assoc_handle, false); - if (!$assoc) { - // fall back to dumb mode - $signed_response->fields['invalidate_handle'] = $assoc_handle; - $assoc = $this->createAssociation(true); - } - } else { - // dumb mode. - $assoc = $this->createAssociation(true); - } - - $signed_response->fields['assoc_handle'] = $assoc->handle; - $assoc->addSignature($signed_response->signed, - $signed_response->fields, ''); - return $signed_response; - } - - /** - * Make a new association. - */ - function createAssociation($dumb = true, $assoc_type = 'HMAC-SHA1') - { - $secret = Auth_OpenID_CryptUtil::getBytes(20); - $uniq = base64_encode(Auth_OpenID_CryptUtil::getBytes(4)); - $handle = sprintf('{%s}{%x}{%s}', $assoc_type, intval(time()), $uniq); - - $assoc = Auth_OpenID_Association::fromExpiresIn( - $this->SECRET_LIFETIME, $handle, $secret, $assoc_type); - - if ($dumb) { - $key = $this->dumb_key; - } else { - $key = $this->normal_key; - } - - $this->store->storeAssociation($key, $assoc); - return $assoc; - } - - /** - * Given an association handle, get the association from the - * store, or return a ServerError or null if something goes wrong. - */ - function getAssociation($assoc_handle, $dumb) - { - if ($assoc_handle === null) { - return new Auth_OpenID_ServerError(null, - "assoc_handle must not be null"); - } - - if ($dumb) { - $key = $this->dumb_key; - } else { - $key = $this->normal_key; - } - - $assoc = $this->store->getAssociation($key, $assoc_handle); - - if (($assoc !== null) && ($assoc->getExpiresIn() <= 0)) { - $this->store->removeAssociation($key, $assoc_handle); - $assoc = null; - } - - return $assoc; - } - - /** - * Invalidate a given association handle. - */ - function invalidate($assoc_handle, $dumb) - { - if ($dumb) { - $key = $this->dumb_key; - } else { - $key = $this->normal_key; - } - $this->store->removeAssociation($key, $assoc_handle); - } + // = 14 * 24 * 60 * 60; # 14 days, in seconds + var $SECRET_LIFETIME = 1209600; + + // keys have a bogus server URL in them because the filestore + // really does expect that key to be a URL. This seems a little + // silly for the server store, since I expect there to be only one + // server URL. + var $normal_key = 'http://localhost/|normal'; + var $dumb_key = 'http://localhost/|dumb'; + + /** + * Create a new signatory using a given store. + */ + function Auth_OpenID_Signatory(&$store) + { + // assert store is not None + $this->store =& $store; + } + + /** + * Verify, using a given association handle, a signature with + * signed key-value pairs from an HTTP request. + */ + function verify($assoc_handle, $sig, $signed_pairs) + { + $assoc = $this->getAssociation($assoc_handle, true); + if (!$assoc) { + // oidutil.log("failed to get assoc with handle %r to verify sig %r" + // % (assoc_handle, sig)) + return false; + } + + $expected_sig = base64_encode($assoc->sign($signed_pairs)); + + return $sig == $expected_sig; + } + + /** + * Given a response, sign the fields in the response's 'signed' + * list, and insert the signature into the response. + */ + function sign($response) + { + $signed_response = $response; + $assoc_handle = $response->request->assoc_handle; + + if ($assoc_handle) { + // normal mode + $assoc = $this->getAssociation($assoc_handle, false); + if (!$assoc) { + // fall back to dumb mode + $signed_response->fields['invalidate_handle'] = $assoc_handle; + $assoc = $this->createAssociation(true); + } + } else { + // dumb mode. + $assoc = $this->createAssociation(true); + } + + $signed_response->fields['assoc_handle'] = $assoc->handle; + $assoc->addSignature($signed_response->signed, + $signed_response->fields, ''); + return $signed_response; + } + + /** + * Make a new association. + */ + function createAssociation($dumb = true, $assoc_type = 'HMAC-SHA1') + { + $secret = Auth_OpenID_CryptUtil::getBytes(20); + $uniq = base64_encode(Auth_OpenID_CryptUtil::getBytes(4)); + $handle = sprintf('{%s}{%x}{%s}', $assoc_type, intval(time()), $uniq); + + $assoc = Auth_OpenID_Association::fromExpiresIn( + $this->SECRET_LIFETIME, $handle, $secret, $assoc_type); + + if ($dumb) { + $key = $this->dumb_key; + } else { + $key = $this->normal_key; + } + + $this->store->storeAssociation($key, $assoc); + return $assoc; + } + + /** + * Given an association handle, get the association from the + * store, or return a ServerError or null if something goes wrong. + */ + function getAssociation($assoc_handle, $dumb) + { + if ($assoc_handle === null) { + return new Auth_OpenID_ServerError(null, + "assoc_handle must not be null"); + } + + if ($dumb) { + $key = $this->dumb_key; + } else { + $key = $this->normal_key; + } + + $assoc = $this->store->getAssociation($key, $assoc_handle); + + if (($assoc !== null) && ($assoc->getExpiresIn() <= 0)) { + $this->store->removeAssociation($key, $assoc_handle); + $assoc = null; + } + + return $assoc; + } + + /** + * Invalidate a given association handle. + */ + function invalidate($assoc_handle, $dumb) + { + if ($dumb) { + $key = $this->dumb_key; + } else { + $key = $this->normal_key; + } + $this->store->removeAssociation($key, $assoc_handle); + } } /** @@ -1032,34 +1032,34 @@ function invalidate($assoc_handle, $dumb) */ class Auth_OpenID_Encoder { - var $responseFactory = 'Auth_OpenID_WebResponse'; - - /** - * Encode an Auth_OpenID_Response and return an - * Auth_OpenID_WebResponse. - */ - function encode(&$response) - { - global $_Auth_OpenID_Encode_Kvform, - $_Auth_OpenID_Encode_Url; - - $cls = $this->responseFactory; - - $encode_as = $response->whichEncoding(); - if ($encode_as == $_Auth_OpenID_Encode_Kvform) { - $wr = new $cls(null, null, $response->encodeToKVForm()); - if (is_a($response, 'Auth_OpenID_ServerError')) { - $wr->code = AUTH_OPENID_HTTP_ERROR; - } - } else if ($encode_as == $_Auth_OpenID_Encode_Url) { - $location = $response->encodeToURL(); - $wr = new $cls(AUTH_OPENID_HTTP_REDIRECT, - array('location' => $location)); - } else { - return new Auth_OpenID_EncodingError($response); - } - return $wr; - } + var $responseFactory = 'Auth_OpenID_WebResponse'; + + /** + * Encode an Auth_OpenID_Response and return an + * Auth_OpenID_WebResponse. + */ + function encode(&$response) + { + global $_Auth_OpenID_Encode_Kvform, + $_Auth_OpenID_Encode_Url; + + $cls = $this->responseFactory; + + $encode_as = $response->whichEncoding(); + if ($encode_as == $_Auth_OpenID_Encode_Kvform) { + $wr = new $cls(null, null, $response->encodeToKVForm()); + if (is_a($response, 'Auth_OpenID_ServerError')) { + $wr->code = AUTH_OPENID_HTTP_ERROR; + } + } else if ($encode_as == $_Auth_OpenID_Encode_Url) { + $location = $response->encodeToURL(); + $wr = new $cls(AUTH_OPENID_HTTP_REDIRECT, + array('location' => $location)); + } else { + return new Auth_OpenID_EncodingError($response); + } + return $wr; + } } /** @@ -1069,9 +1069,9 @@ function encode(&$response) */ function needsSigning($response) { - return (in_array($response->request->mode, array('checkid_setup', - 'checkid_immediate')) && - $response->signed); + return (in_array($response->request->mode, array('checkid_setup', + 'checkid_immediate')) && + $response->signed); } /** @@ -1081,33 +1081,33 @@ function needsSigning($response) */ class Auth_OpenID_SigningEncoder extends Auth_OpenID_Encoder { - function Auth_OpenID_SigningEncoder(&$signatory) - { - $this->signatory =& $signatory; - } - - /** - * Sign an Auth_OpenID_Response and return an - * Auth_OpenID_WebResponse. - */ - function encode(&$response) - { - // the isinstance is a bit of a kludge... it means there isn't - // really an adapter to make the interfaces quite match. - if (!is_a($response, 'Auth_OpenID_ServerError') && - needsSigning($response)) { - - if (!$this->signatory) { - return new Auth_OpenID_ServerError(null, - "Must have a store to sign request"); - } - if (array_key_exists('sig', $response->fields)) { - return new Auth_OpenID_AlreadySigned($response); - } - $response = $this->signatory->sign($response); - } - return parent::encode($response); - } + function Auth_OpenID_SigningEncoder(&$signatory) + { + $this->signatory =& $signatory; + } + + /** + * Sign an Auth_OpenID_Response and return an + * Auth_OpenID_WebResponse. + */ + function encode(&$response) + { + // the isinstance is a bit of a kludge... it means there isn't + // really an adapter to make the interfaces quite match. + if (!is_a($response, 'Auth_OpenID_ServerError') && + needsSigning($response)) { + + if (!$this->signatory) { + return new Auth_OpenID_ServerError(null, + "Must have a store to sign request"); + } + if (array_key_exists('sig', $response->fields)) { + return new Auth_OpenID_AlreadySigned($response); + } + $response = $this->signatory->sign($response); + } + return parent::encode($response); + } } /** @@ -1118,64 +1118,64 @@ function encode(&$response) */ class Auth_OpenID_Decoder { - function Auth_OpenID_Decoder() - { - global $_Auth_OpenID_OpenID_Prefix; - $this->prefix = $_Auth_OpenID_OpenID_Prefix; - - $this->handlers = array( - 'checkid_setup' => 'Auth_OpenID_CheckIDRequest', - 'checkid_immediate' => 'Auth_OpenID_CheckIDRequest', - 'check_authentication' => 'Auth_OpenID_CheckAuthRequest', - 'associate' => 'Auth_OpenID_AssociateRequest' - ); - } - - /** - * Given an HTTP query in an array (key-value pairs), decode it - * into an Auth_OpenID_Request object. - */ - function decode($query) - { - if (!$query) { - return null; - } - - $myquery = array(); - - foreach ($query as $k => $v) { - if (strpos($k, $this->prefix) === 0) { - $myquery[$k] = $v; - } - } - - if (!$myquery) { - return null; - } - - $mode = Auth_OpenID::arrayGet($myquery, $this->prefix . 'mode'); - if (!$mode) { - return new Auth_OpenID_ServerError($query, - sprintf("No %s mode found in query", $this->prefix)); - } - - $handlerCls = Auth_OpenID::arrayGet($this->handlers, $mode, - $this->defaultDecoder($query)); - - if (!is_a($handlerCls, 'Auth_OpenID_ServerError')) { - return call_user_func_array(array($handlerCls, 'fromQuery'), - array($query)); - } else { - return $handlerCls; - } - } - - function defaultDecoder($query) - { - $mode = $query[$this->prefix . 'mode']; - return new Auth_OpenID_ServerError($query, - sprintf("No decoder for mode %s", $mode)); - } + function Auth_OpenID_Decoder() + { + global $_Auth_OpenID_OpenID_Prefix; + $this->prefix = $_Auth_OpenID_OpenID_Prefix; + + $this->handlers = array( + 'checkid_setup' => 'Auth_OpenID_CheckIDRequest', + 'checkid_immediate' => 'Auth_OpenID_CheckIDRequest', + 'check_authentication' => 'Auth_OpenID_CheckAuthRequest', + 'associate' => 'Auth_OpenID_AssociateRequest' + ); + } + + /** + * Given an HTTP query in an array (key-value pairs), decode it + * into an Auth_OpenID_Request object. + */ + function decode($query) + { + if (!$query) { + return null; + } + + $myquery = array(); + + foreach ($query as $k => $v) { + if (strpos($k, $this->prefix) === 0) { + $myquery[$k] = $v; + } + } + + if (!$myquery) { + return null; + } + + $mode = Auth_OpenID::arrayGet($myquery, $this->prefix . 'mode'); + if (!$mode) { + return new Auth_OpenID_ServerError($query, + sprintf("No %s mode found in query", $this->prefix)); + } + + $handlerCls = Auth_OpenID::arrayGet($this->handlers, $mode, + $this->defaultDecoder($query)); + + if (!is_a($handlerCls, 'Auth_OpenID_ServerError')) { + return call_user_func_array(array($handlerCls, 'fromQuery'), + array($query)); + } else { + return $handlerCls; + } + } + + function defaultDecoder($query) + { + $mode = $query[$this->prefix . 'mode']; + return new Auth_OpenID_ServerError($query, + sprintf("No decoder for mode %s", $mode)); + } } /** @@ -1184,10 +1184,10 @@ function defaultDecoder($query) * @package OpenID */ class Auth_OpenID_EncodingError { - function Auth_OpenID_EncodingError(&$response) - { - $this->response =& $response; - } + function Auth_OpenID_EncodingError(&$response) + { + $this->response =& $response; + } } /** @@ -1196,7 +1196,7 @@ function Auth_OpenID_EncodingError(&$response) * @package OpenID */ class Auth_OpenID_AlreadySigned extends Auth_OpenID_EncodingError { - // This response is already signed. + // This response is already signed. } /** @@ -1206,27 +1206,27 @@ class Auth_OpenID_AlreadySigned extends Auth_OpenID_EncodingError { * @package OpenID */ class Auth_OpenID_UntrustedReturnURL extends Auth_OpenID_ServerError { - function Auth_OpenID_UntrustedReturnURL($return_to, $trust_root) - { - global $_Auth_OpenID_OpenID_Prefix; + function Auth_OpenID_UntrustedReturnURL($return_to, $trust_root) + { + global $_Auth_OpenID_OpenID_Prefix; - $query = array( - $_Auth_OpenID_OpenID_Prefix . 'return_to' => $return_to, - $_Auth_OpenID_OpenID_Prefix . 'trust_root' => $trust_root); + $query = array( + $_Auth_OpenID_OpenID_Prefix . 'return_to' => $return_to, + $_Auth_OpenID_OpenID_Prefix . 'trust_root' => $trust_root); - parent::Auth_OpenID_ServerError($query); - } + parent::Auth_OpenID_ServerError($query); + } - function toString() - { - global $_Auth_OpenID_OpenID_Prefix; + function toString() + { + global $_Auth_OpenID_OpenID_Prefix; - $return_to = $this->query[$_Auth_OpenID_OpenID_Prefix . 'return_to']; - $trust_root = $this->query[$_Auth_OpenID_OpenID_Prefix . 'trust_root']; + $return_to = $this->query[$_Auth_OpenID_OpenID_Prefix . 'return_to']; + $trust_root = $this->query[$_Auth_OpenID_OpenID_Prefix . 'trust_root']; - return sprintf("return_to %s not under trust_root %s", - $return_to, $trust_root); - } + return sprintf("return_to %s not under trust_root %s", + $return_to, $trust_root); + } } /** @@ -1238,72 +1238,70 @@ function toString() * @package OpenID */ class Auth_OpenID_Server { - function Auth_OpenID_Server(&$store) - { - $this->store =& $store; - $this->signatory =& new Auth_OpenID_Signatory($this->store); - $this->encoder =& new Auth_OpenID_SigningEncoder($this->signatory); - $this->decoder =& new Auth_OpenID_Decoder(); - } - - /** - * Handle a request. Given an Auth_OpenID_Request object, call - * the appropriate Auth_OpenID_Server method to process the - * request and generate a response. - * - * @param Auth_OpenID_Request $request An Auth_OpenID_Request - * returned by Auth_OpenID_Server::decodeRequest. - * - * @return Auth_OpenID_Response $response A response object - * capable of generating a user-agent reply. - */ - function handleRequest($request) - { - if (method_exists($this, "openid_" . $request->mode)) { - $handler = array($this, "openid_" . $request->mode); - return call_user_func($handler, $request); - } - return null; - } - - /** - * The callback for 'check_authentication' messages. - * - * @access private - */ - function openid_check_authentication(&$request) - { - return $request->answer($this->signatory); - } - - /** - * The callback for 'associate' messages. - * - * @access private - */ - function openid_associate(&$request) - { - $assoc = $this->signatory->createAssociation(false); - return $request->answer($assoc); - } - - /** - * Encodes as response in the appropriate format suitable for - * sending to the user agent. - */ - function encodeResponse(&$response) - { - return $this->encoder->encode($response); - } - - /** - * Decodes a query args array into the appropriate - * Auth_OpenID_Request object. - */ - function decodeRequest(&$query) - { - return $this->decoder->decode($query); - } -} - -?> + function Auth_OpenID_Server(&$store) + { + $this->store =& $store; + $this->signatory =& new Auth_OpenID_Signatory($this->store); + $this->encoder =& new Auth_OpenID_SigningEncoder($this->signatory); + $this->decoder =& new Auth_OpenID_Decoder(); + } + + /** + * Handle a request. Given an Auth_OpenID_Request object, call + * the appropriate Auth_OpenID_Server method to process the + * request and generate a response. + * + * @param Auth_OpenID_Request $request An Auth_OpenID_Request + * returned by Auth_OpenID_Server::decodeRequest. + * + * @return Auth_OpenID_Response $response A response object + * capable of generating a user-agent reply. + */ + function handleRequest($request) + { + if (method_exists($this, "openid_" . $request->mode)) { + $handler = array($this, "openid_" . $request->mode); + return call_user_func($handler, $request); + } + return null; + } + + /** + * The callback for 'check_authentication' messages. + * + * @access private + */ + function openid_check_authentication(&$request) + { + return $request->answer($this->signatory); + } + + /** + * The callback for 'associate' messages. + * + * @access private + */ + function openid_associate(&$request) + { + $assoc = $this->signatory->createAssociation(false); + return $request->answer($assoc); + } + + /** + * Encodes as response in the appropriate format suitable for + * sending to the user agent. + */ + function encodeResponse(&$response) + { + return $this->encoder->encode($response); + } + + /** + * Decodes a query args array into the appropriate + * Auth_OpenID_Request object. + */ + function decodeRequest(&$query) + { + return $this->decoder->decode($query); + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/ServerRequest.php b/libraries/openid/Auth/OpenID/ServerRequest.php index f4bf3e9e7c09d..3221e72265633 100644 --- a/libraries/openid/Auth/OpenID/ServerRequest.php +++ b/libraries/openid/Auth/OpenID/ServerRequest.php @@ -31,10 +31,8 @@ * @package OpenID */ class Auth_OpenID_ServerRequest { - function Auth_OpenID_ServerRequest() - { - $this->mode = null; - } -} - -?> \ No newline at end of file + function Auth_OpenID_ServerRequest() + { + $this->mode = null; + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/TrustRoot.php b/libraries/openid/Auth/OpenID/TrustRoot.php index 88eff295d7300..f232b13220b57 100644 --- a/libraries/openid/Auth/OpenID/TrustRoot.php +++ b/libraries/openid/Auth/OpenID/TrustRoot.php @@ -19,225 +19,224 @@ * @access private */ define('Auth_OpenID___TLDs', - '/\.(com|edu|gov|int|mil|net|org|biz|info|name|museum|coop|aero|ac|' . - 'ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|' . - 'bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|' . - 'cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|' . - 'fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|' . - 'gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|' . - 'ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|' . - 'ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|' . - 'nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|' . - 'ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|' . - 'so|sr|st|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|' . - 'ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$/'); + '/\.(com|edu|gov|int|mil|net|org|biz|info|name|museum|coop|aero|ac|' . + 'ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|' . + 'bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|' . + 'cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|' . + 'fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|' . + 'gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|' . + 'ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|' . + 'ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|' . + 'nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|' . + 'ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|' . + 'so|sr|st|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|' . + 'ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$/'); /** * A wrapper for trust-root related functions */ class Auth_OpenID_TrustRoot { - /** - * Parse a URL into its trust_root parts. - * - * @static - * - * @access private - * - * @param string $trust_root The url to parse - * - * @return mixed $parsed Either an associative array of trust root - * parts or false if parsing failed. - */ - function _parse($trust_root) - { - $parts = @parse_url($trust_root); - if ($parts === false) { - return false; - } - $required_parts = array('scheme', 'host'); - $forbidden_parts = array('user', 'pass', 'fragment'); - $keys = array_keys($parts); - if (array_intersect($keys, $required_parts) != $required_parts) { - return false; - } - - if (array_intersect($keys, $forbidden_parts) != array()) { - return false; - } - - // Return false if the original trust root value has more than - // one port specification. - if (preg_match("/:\/\/[^:]+(:\d+){2,}(\/|$)/", $trust_root)) { - return false; - } - - $scheme = strtolower($parts['scheme']); - $allowed_schemes = array('http', 'https'); - if (!in_array($scheme, $allowed_schemes)) { - return false; - } - $parts['scheme'] = $scheme; - - $host = strtolower($parts['host']); - $hostparts = explode('*', $host); - switch (count($hostparts)) { - case 1: - $parts['wildcard'] = false; - break; - case 2: - if ($hostparts[0] || - ($hostparts[1] && substr($hostparts[1], 0, 1) != '.')) { - return false; - } - $host = $hostparts[1]; - $parts['wildcard'] = true; - break; - default: - return false; - } - if (strpos($host, ':') !== false) { - return false; - } - - $parts['host'] = $host; - - if (isset($parts['path'])) { - $path = strtolower($parts['path']); - if (substr($path, -1) != '/') { - $path .= '/'; - } - } else { - $path = '/'; - } - $parts['path'] = $path; - if (!isset($parts['port'])) { - $parts['port'] = false; - } - return $parts; - } - - /** - * Is this trust root sane? - * - * A trust root is sane if it is syntactically valid and it has a - * reasonable domain name. Specifically, the domain name must be - * more than one level below a standard TLD or more than two - * levels below a two-letter tld. - * - * For example, '*.com' is not a sane trust root, but '*.foo.com' - * is. '*.co.uk' is not sane, but '*.bbc.co.uk' is. - * - * This check is not always correct, but it attempts to err on the - * side of marking sane trust roots insane instead of marking - * insane trust roots sane. For example, 'kink.fm' is marked as - * insane even though it "should" (for some meaning of should) be - * marked sane. - * - * This function should be used when creating OpenID servers to - * alert the users of the server when a consumer attempts to get - * the user to accept a suspicious trust root. - * - * @static - * @param string $trust_root The trust root to check - * @return bool $sanity Whether the trust root looks OK - */ - function isSane($trust_root) - { - $parts = Auth_OpenID_TrustRoot::_parse($trust_root); - if ($parts === false) { - return false; - } - - // Localhost is a special case - if ($parts['host'] == 'localhost') { - return true; - } - - // Get the top-level domain of the host. If it is not a valid TLD, - // it's not sane. - preg_match(Auth_OpenID___TLDs, $parts['host'], $matches); - if (!$matches) { - return false; - } - $tld = $matches[1]; - - // Require at least two levels of specificity for non-country - // tlds and three levels for country tlds. - $elements = explode('.', $parts['host']); - $n = count($elements); - if ($parts['wildcard']) { - $n -= 1; - } - if (strlen($tld) == 2) { - $n -= 1; - } - if ($n <= 1) { - return false; - } - return true; - } - - /** - * Does this URL match the given trust root? - * - * Return whether the URL falls under the given trust root. This - * does not check whether the trust root is sane. If the URL or - * trust root do not parse, this function will return false. - * - * @param string $trust_root The trust root to match against - * - * @param string $url The URL to check - * - * @return bool $matches Whether the URL matches against the - * trust root - */ - function match($trust_root, $url) - { - $trust_root_parsed = Auth_OpenID_TrustRoot::_parse($trust_root); - $url_parsed = Auth_OpenID_TrustRoot::_parse($url); - if (!$trust_root_parsed || !$url_parsed) { - return false; - } - - // Check hosts matching - if ($url_parsed['wildcard']) { - return false; - } - if ($trust_root_parsed['wildcard']) { - $host_tail = $trust_root_parsed['host']; - $host = $url_parsed['host']; - if ($host_tail && - substr($host, -(strlen($host_tail))) != $host_tail && - substr($host_tail, 1) != $host) { - return false; - } - } else { - if ($trust_root_parsed['host'] != $url_parsed['host']) { - return false; - } - } - - // Check path and query matching - $base_path = $trust_root_parsed['path']; - $path = $url_parsed['path']; - if (!isset($trust_root_parsed['query'])) { - if (substr($path, 0, strlen($base_path)) != $base_path) { - return false; - } - } else { - $base_query = $trust_root_parsed['query']; - $query = @$url_parsed['query']; - $qplus = substr($query, 0, strlen($base_query) + 1); - $bqplus = $base_query . '&'; - if ($base_path != $path || - ($base_query != $query && $qplus != $bqplus)) { - return false; - } - } - - // The port and scheme need to match exactly - return ($trust_root_parsed['scheme'] == $url_parsed['scheme'] && - $url_parsed['port'] === $trust_root_parsed['port']); - } -} -?> \ No newline at end of file + /** + * Parse a URL into its trust_root parts. + * + * @static + * + * @access private + * + * @param string $trust_root The url to parse + * + * @return mixed $parsed Either an associative array of trust root + * parts or false if parsing failed. + */ + function _parse($trust_root) + { + $parts = @parse_url($trust_root); + if ($parts === false) { + return false; + } + $required_parts = array('scheme', 'host'); + $forbidden_parts = array('user', 'pass', 'fragment'); + $keys = array_keys($parts); + if (array_intersect($keys, $required_parts) != $required_parts) { + return false; + } + + if (array_intersect($keys, $forbidden_parts) != array()) { + return false; + } + + // Return false if the original trust root value has more than + // one port specification. + if (preg_match("/:\/\/[^:]+(:\d+){2,}(\/|$)/", $trust_root)) { + return false; + } + + $scheme = strtolower($parts['scheme']); + $allowed_schemes = array('http', 'https'); + if (!in_array($scheme, $allowed_schemes)) { + return false; + } + $parts['scheme'] = $scheme; + + $host = strtolower($parts['host']); + $hostparts = explode('*', $host); + switch (count($hostparts)) { + case 1: + $parts['wildcard'] = false; + break; + case 2: + if ($hostparts[0] || + ($hostparts[1] && substr($hostparts[1], 0, 1) != '.')) { + return false; + } + $host = $hostparts[1]; + $parts['wildcard'] = true; + break; + default: + return false; + } + if (strpos($host, ':') !== false) { + return false; + } + + $parts['host'] = $host; + + if (isset($parts['path'])) { + $path = strtolower($parts['path']); + if (substr($path, -1) != '/') { + $path .= '/'; + } + } else { + $path = '/'; + } + $parts['path'] = $path; + if (!isset($parts['port'])) { + $parts['port'] = false; + } + return $parts; + } + + /** + * Is this trust root sane? + * + * A trust root is sane if it is syntactically valid and it has a + * reasonable domain name. Specifically, the domain name must be + * more than one level below a standard TLD or more than two + * levels below a two-letter tld. + * + * For example, '*.com' is not a sane trust root, but '*.foo.com' + * is. '*.co.uk' is not sane, but '*.bbc.co.uk' is. + * + * This check is not always correct, but it attempts to err on the + * side of marking sane trust roots insane instead of marking + * insane trust roots sane. For example, 'kink.fm' is marked as + * insane even though it "should" (for some meaning of should) be + * marked sane. + * + * This function should be used when creating OpenID servers to + * alert the users of the server when a consumer attempts to get + * the user to accept a suspicious trust root. + * + * @static + * @param string $trust_root The trust root to check + * @return bool $sanity Whether the trust root looks OK + */ + function isSane($trust_root) + { + $parts = Auth_OpenID_TrustRoot::_parse($trust_root); + if ($parts === false) { + return false; + } + + // Localhost is a special case + if ($parts['host'] == 'localhost') { + return true; + } + + // Get the top-level domain of the host. If it is not a valid TLD, + // it's not sane. + preg_match(Auth_OpenID___TLDs, $parts['host'], $matches); + if (!$matches) { + return false; + } + $tld = $matches[1]; + + // Require at least two levels of specificity for non-country + // tlds and three levels for country tlds. + $elements = explode('.', $parts['host']); + $n = count($elements); + if ($parts['wildcard']) { + $n -= 1; + } + if (strlen($tld) == 2) { + $n -= 1; + } + if ($n <= 1) { + return false; + } + return true; + } + + /** + * Does this URL match the given trust root? + * + * Return whether the URL falls under the given trust root. This + * does not check whether the trust root is sane. If the URL or + * trust root do not parse, this function will return false. + * + * @param string $trust_root The trust root to match against + * + * @param string $url The URL to check + * + * @return bool $matches Whether the URL matches against the + * trust root + */ + function match($trust_root, $url) + { + $trust_root_parsed = Auth_OpenID_TrustRoot::_parse($trust_root); + $url_parsed = Auth_OpenID_TrustRoot::_parse($url); + if (!$trust_root_parsed || !$url_parsed) { + return false; + } + + // Check hosts matching + if ($url_parsed['wildcard']) { + return false; + } + if ($trust_root_parsed['wildcard']) { + $host_tail = $trust_root_parsed['host']; + $host = $url_parsed['host']; + if ($host_tail && + substr($host, -(strlen($host_tail))) != $host_tail && + substr($host_tail, 1) != $host) { + return false; + } + } else { + if ($trust_root_parsed['host'] != $url_parsed['host']) { + return false; + } + } + + // Check path and query matching + $base_path = $trust_root_parsed['path']; + $path = $url_parsed['path']; + if (!isset($trust_root_parsed['query'])) { + if (substr($path, 0, strlen($base_path)) != $base_path) { + return false; + } + } else { + $base_query = $trust_root_parsed['query']; + $query = @$url_parsed['query']; + $qplus = substr($query, 0, strlen($base_query) + 1); + $bqplus = $base_query . '&'; + if ($base_path != $path || + ($base_query != $query && $qplus != $bqplus)) { + return false; + } + } + + // The port and scheme need to match exactly + return ($trust_root_parsed['scheme'] == $url_parsed['scheme'] && + $url_parsed['port'] === $trust_root_parsed['port']); + } +} \ No newline at end of file diff --git a/libraries/openid/Auth/OpenID/URINorm.php b/libraries/openid/Auth/OpenID/URINorm.php index 1f2ab6567ac43..051ad3adb93d4 100644 --- a/libraries/openid/Auth/OpenID/URINorm.php +++ b/libraries/openid/Auth/OpenID/URINorm.php @@ -16,218 +16,218 @@ // from appendix B of rfc 3986 (http://www.ietf.org/rfc/rfc3986.txt) function Auth_OpenID_getURIPattern() { - return '&^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?&'; + return '&^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?&'; } function Auth_OpenID_getAuthorityPattern() { - return '/^([^@]*@)?([^:]*)(:.*)?/'; + return '/^([^@]*@)?([^:]*)(:.*)?/'; } function Auth_OpenID_getEncodedPattern() { - return '/%([0-9A-Fa-f]{2})/'; + return '/%([0-9A-Fa-f]{2})/'; } function Auth_OpenID_getUnreserved() { - $_unreserved = array(); - for ($i = 0; $i < 256; $i++) { - $_unreserved[$i] = false; - } + $_unreserved = array(); + for ($i = 0; $i < 256; $i++) { + $_unreserved[$i] = false; + } - for ($i = ord('A'); $i <= ord('Z'); $i++) { - $_unreserved[$i] = true; - } + for ($i = ord('A'); $i <= ord('Z'); $i++) { + $_unreserved[$i] = true; + } - for ($i = ord('0'); $i <= ord('9'); $i++) { - $_unreserved[$i] = true; - } + for ($i = ord('0'); $i <= ord('9'); $i++) { + $_unreserved[$i] = true; + } - for ($i = ord('a'); $i <= ord('z'); $i++) { - $_unreserved[$i] = true; - } + for ($i = ord('a'); $i <= ord('z'); $i++) { + $_unreserved[$i] = true; + } - $_unreserved[ord('-')] = true; - $_unreserved[ord('.')] = true; - $_unreserved[ord('_')] = true; - $_unreserved[ord('~')] = true; + $_unreserved[ord('-')] = true; + $_unreserved[ord('.')] = true; + $_unreserved[ord('_')] = true; + $_unreserved[ord('~')] = true; - return $_unreserved; + return $_unreserved; } function Auth_OpenID_getEscapeRE() { - $parts = array(); - foreach (array_merge(Services_Yadis_getUCSChars(), - Services_Yadis_getIPrivateChars()) as $pair) { - list($m, $n) = $pair; - $parts[] = sprintf("%s-%s", chr($m), chr($n)); - } - - return sprintf('[%s]', implode('', $parts)); + $parts = array(); + foreach (array_merge(Services_Yadis_getUCSChars(), + Services_Yadis_getIPrivateChars()) as $pair) { + list($m, $n) = $pair; + $parts[] = sprintf("%s-%s", chr($m), chr($n)); + } + + return sprintf('[%s]', implode('', $parts)); } function Auth_OpenID_pct_encoded_replace_unreserved($mo) { - $_unreserved = Auth_OpenID_getUnreserved(); + $_unreserved = Auth_OpenID_getUnreserved(); - $i = intval($mo[1], 16); - if ($_unreserved[$i]) { - return chr($i); - } else { - return strtoupper($mo[0]); - } + $i = intval($mo[1], 16); + if ($_unreserved[$i]) { + return chr($i); + } else { + return strtoupper($mo[0]); + } - return $mo[0]; + return $mo[0]; } function Auth_OpenID_pct_encoded_replace($mo) { - return chr(intval($mo[1], 16)); + return chr(intval($mo[1], 16)); } function Auth_OpenID_remove_dot_segments($path) { - $result_segments = array(); - - while ($path) { - if (Services_Yadis_startswith($path, '../')) { - $path = substr($path, 3); - } else if (Services_Yadis_startswith($path, './')) { - $path = substr($path, 2); - } else if (Services_Yadis_startswith($path, '/./')) { - $path = substr($path, 2); - } else if ($path == '/.') { - $path = '/'; - } else if (Services_Yadis_startswith($path, '/../')) { - $path = substr($path, 3); - if ($result_segments) { - array_pop($result_segments); - } - } else if ($path == '/..') { - $path = '/'; - if ($result_segments) { - array_pop($result_segments); - } - } else if (($path == '..') || - ($path == '.')) { - $path = ''; - } else { - $i = 0; - if ($path[0] == '/') { - $i = 1; - } - $i = strpos($path, '/', $i); - if ($i === false) { - $i = strlen($path); - } - $result_segments[] = substr($path, 0, $i); - $path = substr($path, $i); - } - } - - return implode('', $result_segments); + $result_segments = array(); + + while ($path) { + if (Services_Yadis_startswith($path, '../')) { + $path = substr($path, 3); + } else if (Services_Yadis_startswith($path, './')) { + $path = substr($path, 2); + } else if (Services_Yadis_startswith($path, '/./')) { + $path = substr($path, 2); + } else if ($path == '/.') { + $path = '/'; + } else if (Services_Yadis_startswith($path, '/../')) { + $path = substr($path, 3); + if ($result_segments) { + array_pop($result_segments); + } + } else if ($path == '/..') { + $path = '/'; + if ($result_segments) { + array_pop($result_segments); + } + } else if (($path == '..') || + ($path == '.')) { + $path = ''; + } else { + $i = 0; + if ($path[0] == '/') { + $i = 1; + } + $i = strpos($path, '/', $i); + if ($i === false) { + $i = strlen($path); + } + $result_segments[] = substr($path, 0, $i); + $path = substr($path, $i); + } + } + + return implode('', $result_segments); } function Auth_OpenID_urinorm($uri) { - $uri_matches = array(); - preg_match(Auth_OpenID_getURIPattern(), $uri, $uri_matches); - - if (count($uri_matches) < 9) { - for ($i = count($uri_matches); $i <= 9; $i++) { - $uri_matches[] = ''; - } - } - - $scheme = $uri_matches[2]; - if ($scheme) { - $scheme = strtolower($scheme); - } - - $scheme = $uri_matches[2]; - if ($scheme === '') { - // No scheme specified - return null; - } - - $scheme = strtolower($scheme); - if (!in_array($scheme, array('http', 'https'))) { - // Not an absolute HTTP or HTTPS URI - return null; - } - - $authority = $uri_matches[4]; - if ($authority === '') { - // Not an absolute URI - return null; - } - - $authority_matches = array(); - preg_match(Auth_OpenID_getAuthorityPattern(), - $authority, $authority_matches); - if (count($authority_matches) === 0) { - // URI does not have a valid authority - return null; - } - - if (count($authority_matches) < 4) { - for ($i = count($authority_matches); $i <= 4; $i++) { - $authority_matches[] = ''; - } - } - - list($_whole, $userinfo, $host, $port) = $authority_matches; - - if ($userinfo === null) { - $userinfo = ''; - } - - if (strpos($host, '%') !== -1) { - $host = strtolower($host); - $host = preg_replace_callback( - Auth_OpenID_getEncodedPattern(), - 'Auth_OpenID_pct_encoded_replace', $host); - // NO IDNA. - // $host = unicode($host, 'utf-8').encode('idna'); - } else { - $host = strtolower($host); - } - - if ($port) { - if (($port == ':') || - ($scheme == 'http' && $port == ':80') || - ($scheme == 'https' && $port == ':443')) { - $port = ''; - } - } else { - $port = ''; - } - - $authority = $userinfo . $host . $port; - - $path = $uri_matches[5]; - $path = preg_replace_callback( - Auth_OpenID_getEncodedPattern(), - 'Auth_OpenID_pct_encoded_replace_unreserved', $path); - - $path = Auth_OpenID_remove_dot_segments($path); - if (!$path) { - $path = '/'; - } - - $query = $uri_matches[6]; - if ($query === null) { - $query = ''; - } - - $fragment = $uri_matches[8]; - if ($fragment === null) { - $fragment = ''; - } - - return $scheme . '://' . $authority . $path . $query . $fragment; + $uri_matches = array(); + preg_match(Auth_OpenID_getURIPattern(), $uri, $uri_matches); + + if (count($uri_matches) < 9) { + for ($i = count($uri_matches); $i <= 9; $i++) { + $uri_matches[] = ''; + } + } + + $scheme = $uri_matches[2]; + if ($scheme) { + $scheme = strtolower($scheme); + } + + $scheme = $uri_matches[2]; + if ($scheme === '') { + // No scheme specified + return null; + } + + $scheme = strtolower($scheme); + if (!in_array($scheme, array('http', 'https'))) { + // Not an absolute HTTP or HTTPS URI + return null; + } + + $authority = $uri_matches[4]; + if ($authority === '') { + // Not an absolute URI + return null; + } + + $authority_matches = array(); + preg_match(Auth_OpenID_getAuthorityPattern(), + $authority, $authority_matches); + if (count($authority_matches) === 0) { + // URI does not have a valid authority + return null; + } + + if (count($authority_matches) < 4) { + for ($i = count($authority_matches); $i <= 4; $i++) { + $authority_matches[] = ''; + } + } + + list($_whole, $userinfo, $host, $port) = $authority_matches; + + if ($userinfo === null) { + $userinfo = ''; + } + + if (strpos($host, '%') !== -1) { + $host = strtolower($host); + $host = preg_replace_callback( + Auth_OpenID_getEncodedPattern(), + 'Auth_OpenID_pct_encoded_replace', $host); + // NO IDNA. + // $host = unicode($host, 'utf-8').encode('idna'); + } else { + $host = strtolower($host); + } + + if ($port) { + if (($port == ':') || + ($scheme == 'http' && $port == ':80') || + ($scheme == 'https' && $port == ':443')) { + $port = ''; + } + } else { + $port = ''; + } + + $authority = $userinfo . $host . $port; + + $path = $uri_matches[5]; + $path = preg_replace_callback( + Auth_OpenID_getEncodedPattern(), + 'Auth_OpenID_pct_encoded_replace_unreserved', $path); + + $path = Auth_OpenID_remove_dot_segments($path); + if (!$path) { + $path = '/'; + } + + $query = $uri_matches[6]; + if ($query === null) { + $query = ''; + } + + $fragment = $uri_matches[8]; + if ($fragment === null) { + $fragment = ''; + } + + return $scheme . '://' . $authority . $path . $query . $fragment; } ?> diff --git a/libraries/openid/Auth/OpenID/index.html b/libraries/openid/Auth/OpenID/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/openid/Auth/OpenID/index.html +++ b/libraries/openid/Auth/OpenID/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/openid/Auth/index.html b/libraries/openid/Auth/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/openid/Auth/index.html +++ b/libraries/openid/Auth/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/HTTPFetcher.php b/libraries/openid/Services/Yadis/HTTPFetcher.php index 97940a4d58bca..d1c83c691d378 100644 --- a/libraries/openid/Services/Yadis/HTTPFetcher.php +++ b/libraries/openid/Services/Yadis/HTTPFetcher.php @@ -14,14 +14,14 @@ */ class Services_Yadis_HTTPResponse { - function Services_Yadis_HTTPResponse($final_url = null, $status = null, - $headers = null, $body = null) - { - $this->final_url = $final_url; - $this->status = $status; - $this->headers = $headers; - $this->body = $body; - } + function Services_Yadis_HTTPResponse($final_url = null, $status = null, + $headers = null, $body = null) + { + $this->final_url = $final_url; + $this->status = $status; + $this->headers = $headers; + $this->body = $body; + } } /** @@ -34,59 +34,57 @@ function Services_Yadis_HTTPResponse($final_url = null, $status = null, */ class Services_Yadis_HTTPFetcher { - var $timeout = 20; // timeout in seconds. + var $timeout = 20; // timeout in seconds. - /** - * Return whether a URL should be allowed. Override this method to - * conform to your local policy. - * - * By default, will attempt to fetch any http or https URL. - */ - function allowedURL($url) - { - return $this->URLHasAllowedScheme($url); - } + /** + * Return whether a URL should be allowed. Override this method to + * conform to your local policy. + * + * By default, will attempt to fetch any http or https URL. + */ + function allowedURL($url) + { + return $this->URLHasAllowedScheme($url); + } - /** - * Is this an http or https URL? - * - * @access private - */ - function URLHasAllowedScheme($url) - { - return (bool)preg_match('/^https?:\/\//i', $url); - } + /** + * Is this an http or https URL? + * + * @access private + */ + function URLHasAllowedScheme($url) + { + return (bool)preg_match('/^https?:\/\//i', $url); + } - /** - * @access private - */ - function _findRedirect($headers) - { - foreach ($headers as $line) { - if (strpos($line, "Location: ") === 0) { - $parts = explode(" ", $line, 2); - return $parts[1]; - } - } - return null; - } + /** + * @access private + */ + function _findRedirect($headers) + { + foreach ($headers as $line) { + if (strpos($line, "Location: ") === 0) { + $parts = explode(" ", $line, 2); + return $parts[1]; + } + } + return null; + } - /** - * Fetches the specified URL using optional extra headers and - * returns the server's response. - * - * @param string $url The URL to be fetched. - * @param array $extra_headers An array of header strings - * (e.g. "Accept: text/html"). - * @return mixed $result An array of ($code, $url, $headers, - * $body) if the URL could be fetched; null if the URL does not - * pass the URLHasAllowedScheme check or if the server's response - * is malformed. - */ - function get($url, $headers) - { - trigger_error("not implemented", E_USER_ERROR); - } -} - -?> \ No newline at end of file + /** + * Fetches the specified URL using optional extra headers and + * returns the server's response. + * + * @param string $url The URL to be fetched. + * @param array $extra_headers An array of header strings + * (e.g. "Accept: text/html"). + * @return mixed $result An array of ($code, $url, $headers, + * $body) if the URL could be fetched; null if the URL does not + * pass the URLHasAllowedScheme check or if the server's response + * is malformed. + */ + function get($url, $headers) + { + trigger_error("not implemented", E_USER_ERROR); + } +} \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/Manager.php b/libraries/openid/Services/Yadis/Manager.php index 524eea2ae9de0..83d570b5b1d68 100644 --- a/libraries/openid/Services/Yadis/Manager.php +++ b/libraries/openid/Services/Yadis/Manager.php @@ -15,52 +15,52 @@ * @package Yadis */ class Services_Yadis_PHPSession { - /** - * Set a session key/value pair. - * - * @param string $name The name of the session key to add. - * @param string $value The value to add to the session. - */ - function set($name, $value) - { - $_SESSION[$name] = $value; - } - - /** - * Get a key's value from the session. - * - * @param string $name The name of the key to retrieve. - * @param string $default The optional value to return if the key - * is not found in the session. - * @return string $result The key's value in the session or - * $default if it isn't found. - */ - function get($name, $default=null) - { - if (array_key_exists($name, $_SESSION)) { - return $_SESSION[$name]; - } else { - return $default; - } - } - - /** - * Remove a key/value pair from the session. - * - * @param string $name The name of the key to remove. - */ - function del($name) - { - unset($_SESSION[$name]); - } - - /** - * Return the contents of the session in array form. - */ - function contents() - { - return $_SESSION; - } + /** + * Set a session key/value pair. + * + * @param string $name The name of the session key to add. + * @param string $value The value to add to the session. + */ + function set($name, $value) + { + $_SESSION[$name] = $value; + } + + /** + * Get a key's value from the session. + * + * @param string $name The name of the key to retrieve. + * @param string $default The optional value to return if the key + * is not found in the session. + * @return string $result The key's value in the session or + * $default if it isn't found. + */ + function get($name, $default=null) + { + if (array_key_exists($name, $_SESSION)) { + return $_SESSION[$name]; + } else { + return $default; + } + } + + /** + * Remove a key/value pair from the session. + * + * @param string $name The name of the key to remove. + */ + function del($name) + { + unset($_SESSION[$name]); + } + + /** + * Return the contents of the session in array form. + */ + function contents() + { + return $_SESSION; + } } /** @@ -72,173 +72,173 @@ function contents() * bool to implement your own session data validation. */ class Services_Yadis_SessionLoader { - /** - * Override this. - */ - function check($data) - { - return true; - } - - /** - * Given a session data value (an array), this creates an object - * (returned by $this->newObject()) whose attributes and values - * are those in $data. Returns null if $data lacks keys found in - * $this->requiredKeys(). Returns null if $this->check($data) - * evaluates to false. Returns null if $this->newObject() - * evaluates to false. - */ - function fromSession($data) - { - if (!$data) { - return null; - } - - $required = $this->requiredKeys(); - - foreach ($required as $k) { - if (!array_key_exists($k, $data)) { - return null; - } - } - - if (!$this->check($data)) { - return null; - } - - $data = array_merge($data, $this->prepareForLoad($data)); - $obj = $this->newObject($data); - - if (!$obj) { - return null; - } - - foreach ($required as $k) { - $obj->$k = $data[$k]; - } - - return $obj; - } - - /** - * Prepares the data array by making any necessary changes. - * Returns an array whose keys and values will be used to update - * the original data array before calling $this->newObject($data). - */ - function prepareForLoad($data) - { - return array(); - } - - /** - * Returns a new instance of this loader's class, using the - * session data to construct it if necessary. The object need - * only be created; $this->fromSession() will take care of setting - * the object's attributes. - */ - function newObject($data) - { - return null; - } - - /** - * Returns an array of keys and values built from the attributes - * of $obj. If $this->prepareForSave($obj) returns an array, its keys - * and values are used to update the $data array of attributes - * from $obj. - */ - function toSession($obj) - { - $data = array(); - foreach ($obj as $k => $v) { - $data[$k] = $v; - } - - $extra = $this->prepareForSave($obj); - - if ($extra && is_array($extra)) { - foreach ($extra as $k => $v) { - $data[$k] = $v; - } - } - - return $data; - } - - /** - * Override this. - */ - function prepareForSave($obj) - { - return array(); - } + /** + * Override this. + */ + function check($data) + { + return true; + } + + /** + * Given a session data value (an array), this creates an object + * (returned by $this->newObject()) whose attributes and values + * are those in $data. Returns null if $data lacks keys found in + * $this->requiredKeys(). Returns null if $this->check($data) + * evaluates to false. Returns null if $this->newObject() + * evaluates to false. + */ + function fromSession($data) + { + if (!$data) { + return null; + } + + $required = $this->requiredKeys(); + + foreach ($required as $k) { + if (!array_key_exists($k, $data)) { + return null; + } + } + + if (!$this->check($data)) { + return null; + } + + $data = array_merge($data, $this->prepareForLoad($data)); + $obj = $this->newObject($data); + + if (!$obj) { + return null; + } + + foreach ($required as $k) { + $obj->$k = $data[$k]; + } + + return $obj; + } + + /** + * Prepares the data array by making any necessary changes. + * Returns an array whose keys and values will be used to update + * the original data array before calling $this->newObject($data). + */ + function prepareForLoad($data) + { + return array(); + } + + /** + * Returns a new instance of this loader's class, using the + * session data to construct it if necessary. The object need + * only be created; $this->fromSession() will take care of setting + * the object's attributes. + */ + function newObject($data) + { + return null; + } + + /** + * Returns an array of keys and values built from the attributes + * of $obj. If $this->prepareForSave($obj) returns an array, its keys + * and values are used to update the $data array of attributes + * from $obj. + */ + function toSession($obj) + { + $data = array(); + foreach ($obj as $k => $v) { + $data[$k] = $v; + } + + $extra = $this->prepareForSave($obj); + + if ($extra && is_array($extra)) { + foreach ($extra as $k => $v) { + $data[$k] = $v; + } + } + + return $data; + } + + /** + * Override this. + */ + function prepareForSave($obj) + { + return array(); + } } class Auth_OpenID_ServiceEndpointLoader extends Services_Yadis_SessionLoader { - function newObject($data) - { - return new Auth_OpenID_ServiceEndpoint(); - } - - function requiredKeys() - { - $obj = new Auth_OpenID_ServiceEndpoint(); - $data = array(); - foreach ($obj as $k => $v) { - $data[] = $k; - } - return $data; - } - - function check($data) - { - return is_array($data['type_uris']); - } + function newObject($data) + { + return new Auth_OpenID_ServiceEndpoint(); + } + + function requiredKeys() + { + $obj = new Auth_OpenID_ServiceEndpoint(); + $data = array(); + foreach ($obj as $k => $v) { + $data[] = $k; + } + return $data; + } + + function check($data) + { + return is_array($data['type_uris']); + } } class Services_Yadis_ManagerLoader extends Services_Yadis_SessionLoader { - function requiredKeys() - { - return array('starting_url', - 'yadis_url', - 'services', - 'session_key', - '_current', - 'stale'); - } - - function newObject($data) - { - return new Services_Yadis_Manager($data['starting_url'], - $data['yadis_url'], - $data['services'], - $data['session_key']); - } - - function check($data) - { - return is_array($data['services']); - } - - function prepareForLoad($data) - { - $loader = new Auth_OpenID_ServiceEndpointLoader(); - $services = array(); - foreach ($data['services'] as $s) { - $services[] = $loader->fromSession($s); - } - return array('services' => $services); - } - - function prepareForSave($obj) - { - $loader = new Auth_OpenID_ServiceEndpointLoader(); - $services = array(); - foreach ($obj->services as $s) { - $services[] = $loader->toSession($s); - } - return array('services' => $services); - } + function requiredKeys() + { + return array('starting_url', + 'yadis_url', + 'services', + 'session_key', + '_current', + 'stale'); + } + + function newObject($data) + { + return new Services_Yadis_Manager($data['starting_url'], + $data['yadis_url'], + $data['services'], + $data['session_key']); + } + + function check($data) + { + return is_array($data['services']); + } + + function prepareForLoad($data) + { + $loader = new Auth_OpenID_ServiceEndpointLoader(); + $services = array(); + foreach ($data['services'] as $s) { + $services[] = $loader->fromSession($s); + } + return array('services' => $services); + } + + function prepareForSave($obj) + { + $loader = new Auth_OpenID_ServiceEndpointLoader(); + $services = array(); + foreach ($obj->services as $s) { + $services[] = $loader->toSession($s); + } + return array('services' => $services); + } } /** @@ -251,85 +251,85 @@ function prepareForSave($obj) */ class Services_Yadis_Manager { - /** - * Intialize a new yadis service manager. - * - * @access private - */ - function Services_Yadis_Manager($starting_url, $yadis_url, - $services, $session_key) - { - // The URL that was used to initiate the Yadis protocol - $this->starting_url = $starting_url; - - // The URL after following redirects (the identifier) - $this->yadis_url = $yadis_url; - - // List of service elements - $this->services = $services; - - $this->session_key = $session_key; - - // Reference to the current service object - $this->_current = null; - - // Stale flag for cleanup if PHP lib has trouble. - $this->stale = false; - } - - /** - * @access private - */ - function length() - { - // How many untried services remain? - return count($this->services); - } - - /** - * Return the next service - * - * $this->current() will continue to return that service until the - * next call to this method. - */ - function nextService() - { - - if ($this->services) { - $this->_current = array_shift($this->services); - } else { - $this->_current = null; - } - - return $this->_current; - } - - /** - * @access private - */ - function current() - { - // Return the current service. - // Returns None if there are no services left. - return $this->_current; - } - - /** - * @access private - */ - function forURL($url) - { - return in_array($url, array($this->starting_url, $this->yadis_url)); - } - - /** - * @access private - */ - function started() - { - // Has the first service been returned? - return $this->_current !== null; - } + /** + * Intialize a new yadis service manager. + * + * @access private + */ + function Services_Yadis_Manager($starting_url, $yadis_url, + $services, $session_key) + { + // The URL that was used to initiate the Yadis protocol + $this->starting_url = $starting_url; + + // The URL after following redirects (the identifier) + $this->yadis_url = $yadis_url; + + // List of service elements + $this->services = $services; + + $this->session_key = $session_key; + + // Reference to the current service object + $this->_current = null; + + // Stale flag for cleanup if PHP lib has trouble. + $this->stale = false; + } + + /** + * @access private + */ + function length() + { + // How many untried services remain? + return count($this->services); + } + + /** + * Return the next service + * + * $this->current() will continue to return that service until the + * next call to this method. + */ + function nextService() + { + + if ($this->services) { + $this->_current = array_shift($this->services); + } else { + $this->_current = null; + } + + return $this->_current; + } + + /** + * @access private + */ + function current() + { + // Return the current service. + // Returns None if there are no services left. + return $this->_current; + } + + /** + * @access private + */ + function forURL($url) + { + return in_array($url, array($this->starting_url, $this->yadis_url)); + } + + /** + * @access private + */ + function started() + { + // Has the first service been returned? + return $this->_current !== null; + } } /** @@ -344,153 +344,153 @@ function started() */ class Services_Yadis_Discovery { - /** - * @access private - */ - var $DEFAULT_SUFFIX = 'auth'; - - /** - * @access private - */ - var $PREFIX = '_yadis_services_'; - - /** - * Initialize a discovery object. - * - * @param Services_Yadis_PHPSession $session An object which - * implements the Services_Yadis_PHPSession API. - * @param string $url The URL on which to attempt discovery. - * @param string $session_key_suffix The optional session key - * suffix override. - */ - function Services_Yadis_Discovery(&$session, $url, - $session_key_suffix = null) - { - /// Initialize a discovery object - $this->session =& $session; - $this->url = $url; - if ($session_key_suffix === null) { - $session_key_suffix = $this->DEFAULT_SUFFIX; - } - - $this->session_key_suffix = $session_key_suffix; - $this->session_key = $this->PREFIX . $this->session_key_suffix; - } - - /** - * Return the next authentication service for the pair of - * user_input and session. This function handles fallback. - */ - function getNextService($discover_cb, &$fetcher) - { - $manager = $this->getManager(); - if (!$manager || (!$manager->services)) { - $this->destroyManager(); - $http_response = array(); - - $services = call_user_func($discover_cb, $this->url, - $fetcher); - - $manager = $this->createManager($services, $this->url); - } - - if ($manager) { - $loader = new Services_Yadis_ManagerLoader(); - $service = $manager->nextService(); - $this->session->set($this->session_key, - serialize($loader->toSession($manager))); - } else { - $service = null; - } - - return $service; - } - - /** - * Clean up Yadis-related services in the session and return the - * most-recently-attempted service from the manager, if one - * exists. - */ - function cleanup() - { - $manager = $this->getManager(); - if ($manager) { - $service = $manager->current(); - $this->destroyManager(); - } else { - $service = null; - } - - return $service; - } - - /** - * @access private - */ - function getSessionKey() - { - // Get the session key for this starting URL and suffix - return $this->PREFIX . $this->session_key_suffix; - } - - /** - * @access private - */ - function &getManager() - { - // Extract the YadisServiceManager for this object's URL and - // suffix from the session. - - $manager_str = $this->session->get($this->getSessionKey()); - $manager = null; - - if ($manager_str !== null) { - $loader = new Services_Yadis_ManagerLoader(); - $manager = $loader->fromSession(unserialize($manager_str)); - } - - if ($manager && $manager->forURL($this->url)) { - return $manager; - } else { - $unused = null; - return $unused; - } - } - - /** - * @access private - */ - function &createManager($services, $yadis_url = null) - { - $key = $this->getSessionKey(); - if ($this->getManager()) { - return $this->getManager(); - } - - if ($services) { - $loader = new Services_Yadis_ManagerLoader(); - $manager = new Services_Yadis_Manager($this->url, $yadis_url, - $services, $key); - $this->session->set($this->session_key, - serialize($loader->toSession($manager))); - return $manager; - } else { - // Oh, PHP. - $unused = null; - return $unused; - } - } - - /** - * @access private - */ - function destroyManager() - { - if ($this->getManager() !== null) { - $key = $this->getSessionKey(); - $this->session->del($key); - } - } + /** + * @access private + */ + var $DEFAULT_SUFFIX = 'auth'; + + /** + * @access private + */ + var $PREFIX = '_yadis_services_'; + + /** + * Initialize a discovery object. + * + * @param Services_Yadis_PHPSession $session An object which + * implements the Services_Yadis_PHPSession API. + * @param string $url The URL on which to attempt discovery. + * @param string $session_key_suffix The optional session key + * suffix override. + */ + function Services_Yadis_Discovery(&$session, $url, + $session_key_suffix = null) + { + /// Initialize a discovery object + $this->session =& $session; + $this->url = $url; + if ($session_key_suffix === null) { + $session_key_suffix = $this->DEFAULT_SUFFIX; + } + + $this->session_key_suffix = $session_key_suffix; + $this->session_key = $this->PREFIX . $this->session_key_suffix; + } + + /** + * Return the next authentication service for the pair of + * user_input and session. This function handles fallback. + */ + function getNextService($discover_cb, &$fetcher) + { + $manager = $this->getManager(); + if (!$manager || (!$manager->services)) { + $this->destroyManager(); + $http_response = array(); + + $services = call_user_func($discover_cb, $this->url, + $fetcher); + + $manager = $this->createManager($services, $this->url); + } + + if ($manager) { + $loader = new Services_Yadis_ManagerLoader(); + $service = $manager->nextService(); + $this->session->set($this->session_key, + serialize($loader->toSession($manager))); + } else { + $service = null; + } + + return $service; + } + + /** + * Clean up Yadis-related services in the session and return the + * most-recently-attempted service from the manager, if one + * exists. + */ + function cleanup() + { + $manager = $this->getManager(); + if ($manager) { + $service = $manager->current(); + $this->destroyManager(); + } else { + $service = null; + } + + return $service; + } + + /** + * @access private + */ + function getSessionKey() + { + // Get the session key for this starting URL and suffix + return $this->PREFIX . $this->session_key_suffix; + } + + /** + * @access private + */ + function &getManager() + { + // Extract the YadisServiceManager for this object's URL and + // suffix from the session. + + $manager_str = $this->session->get($this->getSessionKey()); + $manager = null; + + if ($manager_str !== null) { + $loader = new Services_Yadis_ManagerLoader(); + $manager = $loader->fromSession(unserialize($manager_str)); + } + + if ($manager && $manager->forURL($this->url)) { + return $manager; + } else { + $unused = null; + return $unused; + } + } + + /** + * @access private + */ + function &createManager($services, $yadis_url = null) + { + $key = $this->getSessionKey(); + if ($this->getManager()) { + return $this->getManager(); + } + + if ($services) { + $loader = new Services_Yadis_ManagerLoader(); + $manager = new Services_Yadis_Manager($this->url, $yadis_url, + $services, $key); + $this->session->set($this->session_key, + serialize($loader->toSession($manager))); + return $manager; + } else { + // Oh, PHP. + $unused = null; + return $unused; + } + } + + /** + * @access private + */ + function destroyManager() + { + if ($this->getManager() !== null) { + $key = $this->getSessionKey(); + $this->session->del($key); + } + } } ?> \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/Misc.php b/libraries/openid/Services/Yadis/Misc.php index 794b62eadba55..1dee2e8b2843b 100644 --- a/libraries/openid/Services/Yadis/Misc.php +++ b/libraries/openid/Services/Yadis/Misc.php @@ -11,49 +11,47 @@ function Services_Yadis_getUCSChars() { - return array( - array(0xA0, 0xD7FF), - array(0xF900, 0xFDCF), - array(0xFDF0, 0xFFEF), - array(0x10000, 0x1FFFD), - array(0x20000, 0x2FFFD), - array(0x30000, 0x3FFFD), - array(0x40000, 0x4FFFD), - array(0x50000, 0x5FFFD), - array(0x60000, 0x6FFFD), - array(0x70000, 0x7FFFD), - array(0x80000, 0x8FFFD), - array(0x90000, 0x9FFFD), - array(0xA0000, 0xAFFFD), - array(0xB0000, 0xBFFFD), - array(0xC0000, 0xCFFFD), - array(0xD0000, 0xDFFFD), - array(0xE1000, 0xEFFFD) - ); + return array( + array(0xA0, 0xD7FF), + array(0xF900, 0xFDCF), + array(0xFDF0, 0xFFEF), + array(0x10000, 0x1FFFD), + array(0x20000, 0x2FFFD), + array(0x30000, 0x3FFFD), + array(0x40000, 0x4FFFD), + array(0x50000, 0x5FFFD), + array(0x60000, 0x6FFFD), + array(0x70000, 0x7FFFD), + array(0x80000, 0x8FFFD), + array(0x90000, 0x9FFFD), + array(0xA0000, 0xAFFFD), + array(0xB0000, 0xBFFFD), + array(0xC0000, 0xCFFFD), + array(0xD0000, 0xDFFFD), + array(0xE1000, 0xEFFFD) + ); } function Services_Yadis_getIPrivateChars() { - return array( - array(0xE000, 0xF8FF), - array(0xF0000, 0xFFFFD), - array(0x100000, 0x10FFFD) - ); + return array( + array(0xE000, 0xF8FF), + array(0xF0000, 0xFFFFD), + array(0x100000, 0x10FFFD) + ); } function Services_Yadis_pct_escape_unicode($char_match) { - $c = $char_match[0]; - $result = ""; - for ($i = 0; $i < strlen($c); $i++) { - $result .= "%".sprintf("%X", ord($c[$i])); - } - return $result; + $c = $char_match[0]; + $result = ""; + for ($i = 0; $i < strlen($c); $i++) { + $result .= "%".sprintf("%X", ord($c[$i])); + } + return $result; } function Services_Yadis_startswith($s, $stuff) { - return strpos($s, $stuff) === 0; -} - -?> \ No newline at end of file + return strpos($s, $stuff) === 0; +} \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/ParanoidHTTPFetcher.php b/libraries/openid/Services/Yadis/ParanoidHTTPFetcher.php index 70072bd13001d..737bcbf90b172 100644 --- a/libraries/openid/Services/Yadis/ParanoidHTTPFetcher.php +++ b/libraries/openid/Services/Yadis/ParanoidHTTPFetcher.php @@ -27,153 +27,151 @@ * @package Yadis */ class Services_Yadis_ParanoidHTTPFetcher extends Services_Yadis_HTTPFetcher { - function Services_Yadis_ParanoidHTTPFetcher() - { - $this->reset(); - } - - function reset() - { - $this->headers = array(); - $this->data = ""; - } - - /** - * @access private - */ - function _writeHeader($ch, $header) - { - array_push($this->headers, rtrim($header)); - return strlen($header); - } - - /** - * @access private - */ - function _writeData($ch, $data) - { - $this->data .= $data; - return strlen($data); - } - - function get($url, $extra_headers = null) - { - $stop = time() + $this->timeout; - $off = $this->timeout; - - $redir = true; - - while ($redir && ($off > 0)) { - $this->reset(); - - $c = curl_init(); - if (defined('CURLOPT_NOSIGNAL')) { - curl_setopt($c, CURLOPT_NOSIGNAL, true); - } - - if (!$this->allowedURL($url)) { - trigger_error(sprintf("Fetching URL not allowed: %s", $url), - E_USER_WARNING); - return null; - } - - curl_setopt($c, CURLOPT_WRITEFUNCTION, - array(&$this, "_writeData")); - curl_setopt($c, CURLOPT_HEADERFUNCTION, - array(&$this, "_writeHeader")); - - if ($extra_headers) { - curl_setopt($c, CURLOPT_HTTPHEADER, $extra_headers); - } - - curl_setopt($c, CURLOPT_TIMEOUT, $off); - curl_setopt($c, CURLOPT_URL, $url); - - curl_exec($c); - - $code = curl_getinfo($c, CURLINFO_HTTP_CODE); - $body = $this->data; - $headers = $this->headers; - - if (!$code) { - return null; - } - - if (in_array($code, array(301, 302, 303, 307))) { - $url = $this->_findRedirect($headers); - $redir = true; - } else { - $redir = false; - curl_close($c); - - $new_headers = array(); - - foreach ($headers as $header) { - if (preg_match("/:/", $header)) { - list($name, $value) = explode(": ", $header, 2); - $new_headers[$name] = $value; - } - } - - return new Services_Yadis_HTTPResponse($url, $code, - $new_headers, $body); - } - - $off = $stop - time(); - } - - trigger_error(sprintf("Timed out fetching: %s", $url), - E_USER_WARNING); - - return null; - } - - function post($url, $body) - { - $this->reset(); - - if (!$this->allowedURL($url)) { - trigger_error(sprintf("Fetching URL not allowed: %s", $url), - E_USER_WARNING); - return null; - } - - $c = curl_init(); - - curl_setopt($c, CURLOPT_NOSIGNAL, true); - curl_setopt($c, CURLOPT_POST, true); - curl_setopt($c, CURLOPT_POSTFIELDS, $body); - curl_setopt($c, CURLOPT_TIMEOUT, $this->timeout); - curl_setopt($c, CURLOPT_URL, $url); - curl_setopt($c, CURLOPT_WRITEFUNCTION, - array(&$this, "_writeData")); + function Services_Yadis_ParanoidHTTPFetcher() + { + $this->reset(); + } + + function reset() + { + $this->headers = array(); + $this->data = ""; + } + + /** + * @access private + */ + function _writeHeader($ch, $header) + { + array_push($this->headers, rtrim($header)); + return strlen($header); + } + + /** + * @access private + */ + function _writeData($ch, $data) + { + $this->data .= $data; + return strlen($data); + } + + function get($url, $extra_headers = null) + { + $stop = time() + $this->timeout; + $off = $this->timeout; + + $redir = true; + + while ($redir && ($off > 0)) { + $this->reset(); + + $c = curl_init(); + if (defined('CURLOPT_NOSIGNAL')) { + curl_setopt($c, CURLOPT_NOSIGNAL, true); + } + + if (!$this->allowedURL($url)) { + trigger_error(sprintf("Fetching URL not allowed: %s", $url), + E_USER_WARNING); + return null; + } + + curl_setopt($c, CURLOPT_WRITEFUNCTION, + array(&$this, "_writeData")); + curl_setopt($c, CURLOPT_HEADERFUNCTION, + array(&$this, "_writeHeader")); + + if ($extra_headers) { + curl_setopt($c, CURLOPT_HTTPHEADER, $extra_headers); + } + + curl_setopt($c, CURLOPT_TIMEOUT, $off); + curl_setopt($c, CURLOPT_URL, $url); + + curl_exec($c); + + $code = curl_getinfo($c, CURLINFO_HTTP_CODE); + $body = $this->data; + $headers = $this->headers; + + if (!$code) { + return null; + } + + if (in_array($code, array(301, 302, 303, 307))) { + $url = $this->_findRedirect($headers); + $redir = true; + } else { + $redir = false; + curl_close($c); + + $new_headers = array(); + + foreach ($headers as $header) { + if (preg_match("/:/", $header)) { + list($name, $value) = explode(": ", $header, 2); + $new_headers[$name] = $value; + } + } + + return new Services_Yadis_HTTPResponse($url, $code, + $new_headers, $body); + } + + $off = $stop - time(); + } + + trigger_error(sprintf("Timed out fetching: %s", $url), + E_USER_WARNING); + + return null; + } + + function post($url, $body) + { + $this->reset(); + + if (!$this->allowedURL($url)) { + trigger_error(sprintf("Fetching URL not allowed: %s", $url), + E_USER_WARNING); + return null; + } + + $c = curl_init(); + + curl_setopt($c, CURLOPT_NOSIGNAL, true); + curl_setopt($c, CURLOPT_POST, true); + curl_setopt($c, CURLOPT_POSTFIELDS, $body); + curl_setopt($c, CURLOPT_TIMEOUT, $this->timeout); + curl_setopt($c, CURLOPT_URL, $url); + curl_setopt($c, CURLOPT_WRITEFUNCTION, + array(&$this, "_writeData")); + + curl_exec($c); - curl_exec($c); + $code = curl_getinfo($c, CURLINFO_HTTP_CODE); - $code = curl_getinfo($c, CURLINFO_HTTP_CODE); + if (!$code) { + trigger_error("No HTTP code returned", E_USER_WARNING); + return null; + } - if (!$code) { - trigger_error("No HTTP code returned", E_USER_WARNING); - return null; - } + $body = $this->data; - $body = $this->data; + curl_close($c); - curl_close($c); + $new_headers = array(); - $new_headers = array(); + foreach ($this->headers as $header) { + if (preg_match("/:/", $header)) { + list($name, $value) = explode(": ", $header, 2); + $new_headers[$name] = $value; + } - foreach ($this->headers as $header) { - if (preg_match("/:/", $header)) { - list($name, $value) = explode(": ", $header, 2); - $new_headers[$name] = $value; - } + } - } - - return new Services_Yadis_HTTPResponse($url, $code, - $new_headers, $body); - } -} - -?> \ No newline at end of file + return new Services_Yadis_HTTPResponse($url, $code, + $new_headers, $body); + } +} \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/ParseHTML.php b/libraries/openid/Services/Yadis/ParseHTML.php index 3446660655d1a..5906b1a9ffcf8 100644 --- a/libraries/openid/Services/Yadis/ParseHTML.php +++ b/libraries/openid/Services/Yadis/ParseHTML.php @@ -22,223 +22,221 @@ */ class Services_Yadis_ParseHTML { - /** - * @access private - */ - var $_re_flags = "si"; - - /** - * @access private - */ - var $_tag_expr = "<%s%s(?:\s.*?)?%s>"; - - /** - * @access private - */ - var $_attr_find = '\b([-\w]+)=(".*?"|\'.*?\'|.+?)[\s>]'; - - function Services_Yadis_ParseHTML() - { - $this->_attr_find = sprintf("/%s/%s", - $this->_attr_find, - $this->_re_flags); - - $this->_entity_replacements = array( - 'amp' => '&', - 'lt' => '<', - 'gt' => '>', - 'quot' => '"' - ); - - $this->_ent_replace = - sprintf("&(%s);", implode("|", - $this->_entity_replacements)); - } - - /** - * Replace HTML entities (amp, lt, gt, and quot) as well as - * numeric entities (e.g. #x9f;) with their actual values and - * return the new string. - * - * @access private - * @param string $str The string in which to look for entities - * @return string $new_str The new string entities decoded - */ - function replaceEntities($str) - { - foreach ($this->_entity_replacements as $old => $new) { - $str = preg_replace(sprintf("/&%s;/", $old), $new, $str); - } - - // Replace numeric entities because html_entity_decode doesn't - // do it for us. - $str = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $str); - $str = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $str); - - return $str; - } - - /** - * Strip single and double quotes off of a string, if they are - * present. - * - * @access private - * @param string $str The original string - * @return string $new_str The new string with leading and - * trailing quotes removed - */ - function removeQuotes($str) - { - $matches = array(); - $double = '/^"(.*)"$/'; - $single = "/^\'(.*)\'$/"; - - if (preg_match($double, $str, $matches)) { - return $matches[1]; - } else if (preg_match($single, $str, $matches)) { - return $matches[1]; - } else { - return $str; - } - } - - /** - * Create a regular expression that will match an opening - * or closing tag from a set of names. - * - * @access private - * @param mixed $tag_names Tag names to match - * @param mixed $close false/0 = no, true/1 = yes, other = maybe - * @param mixed $self_close false/0 = no, true/1 = yes, other = maybe - * @return string $regex A regular expression string to be used - * in, say, preg_match. - */ - function tagPattern($tag_names, $close, $self_close) - { - if (is_array($tag_names)) { - $tag_names = '(?:'.implode('|',$tag_names).')'; - } - if ($close) { - $close = '\/' . (($close == 1)? '' : '?'); - } else { - $close = ''; - } - if ($self_close) { - $self_close = '(?:\/\s*)' . (($self_close == 1)? '' : '?'); - } else { - $self_close = ''; - } - $expr = sprintf($this->_tag_expr, $close, $tag_names, $self_close); - - return sprintf("/%s/%s", $expr, $this->_re_flags); - } - - /** - * Given an HTML document string, this finds all the META tags in - * the document, provided they are found in the - * ... section of the document. The tag - * may be missing. - * - * @access private - * @param string $html_string An HTMl document string - * @return array $tag_list Array of tags; each tag is an array of - * attribute -> value. - */ - function getMetaTags($html_string) - { - $key_tags = array($this->tagPattern('html', false, false), - $this->tagPattern('head', false, false), - $this->tagPattern('head', true, false), - $this->tagPattern('html', true, false), - $this->tagPattern(array( - 'body', 'frameset', 'frame', 'p', 'div', - 'table','span','a'), 'maybe', 'maybe')); - $key_tags_pos = array(); - foreach ($key_tags as $pat) { - $matches = array(); - preg_match($pat, $html_string, $matches, PREG_OFFSET_CAPTURE); - if($matches) { - $key_tags_pos[] = $matches[0][1]; - } else { - $key_tags_pos[] = null; - } - } - // no opening head tag - if (is_null($key_tags_pos[1])) { - return array(); - } - // the effective is the min of the following - if (is_null($key_tags_pos[2])) { - $key_tags_pos[2] = strlen($html_string); - } - foreach (array($key_tags_pos[3], $key_tags_pos[4]) as $pos) { - if (!is_null($pos) && $pos < $key_tags_pos[2]) { - $key_tags_pos[2] = $pos; - } - } - // closing head tag comes before opening head tag - if ($key_tags_pos[1] > $key_tags_pos[2]) { - return array(); - } - // if there is an opening html tag, make sure the opening head tag - // comes after it - if (!is_null($key_tags_pos[0]) && $key_tags_pos[1] < $key_tags_pos[0]) { - return array(); - } - $html_string = substr($html_string, $key_tags_pos[1], ($key_tags_pos[2]-$key_tags_pos[1])); - - $link_data = array(); - $link_matches = array(); - - if (!preg_match_all($this->tagPattern('meta', false, 'maybe'), - $html_string, $link_matches)) { - return array(); - } - - foreach ($link_matches[0] as $link) { - $attr_matches = array(); - preg_match_all($this->_attr_find, $link, $attr_matches); - $link_attrs = array(); - foreach ($attr_matches[0] as $index => $full_match) { - $name = $attr_matches[1][$index]; - $value = $this->replaceEntities( - $this->removeQuotes($attr_matches[2][$index])); - - $link_attrs[strtolower($name)] = $value; - } - $link_data[] = $link_attrs; - } - - return $link_data; - } - - /** - * Looks for a META tag with an "http-equiv" attribute whose value - * is one of ("x-xrds-location", "x-yadis-location"), ignoring - * case. If such a META tag is found, its "content" attribute - * value is returned. - * - * @param string $html_string An HTML document in string format - * @return mixed $content The "content" attribute value of the - * META tag, if found, or null if no such tag was found. - */ - function getHTTPEquiv($html_string) - { - $meta_tags = $this->getMetaTags($html_string); - - if ($meta_tags) { - foreach ($meta_tags as $tag) { - if (array_key_exists('http-equiv', $tag) && - (in_array(strtolower($tag['http-equiv']), - array('x-xrds-location', 'x-yadis-location'))) && - array_key_exists('content', $tag)) { - return $tag['content']; - } - } - } - - return null; - } -} - -?> \ No newline at end of file + /** + * @access private + */ + var $_re_flags = "si"; + + /** + * @access private + */ + var $_tag_expr = "<%s%s(?:\s.*?)?%s>"; + + /** + * @access private + */ + var $_attr_find = '\b([-\w]+)=(".*?"|\'.*?\'|.+?)[\s>]'; + + function Services_Yadis_ParseHTML() + { + $this->_attr_find = sprintf("/%s/%s", + $this->_attr_find, + $this->_re_flags); + + $this->_entity_replacements = array( + 'amp' => '&', + 'lt' => '<', + 'gt' => '>', + 'quot' => '"' + ); + + $this->_ent_replace = + sprintf("&(%s);", implode("|", + $this->_entity_replacements)); + } + + /** + * Replace HTML entities (amp, lt, gt, and quot) as well as + * numeric entities (e.g. #x9f;) with their actual values and + * return the new string. + * + * @access private + * @param string $str The string in which to look for entities + * @return string $new_str The new string entities decoded + */ + function replaceEntities($str) + { + foreach ($this->_entity_replacements as $old => $new) { + $str = preg_replace(sprintf("/&%s;/", $old), $new, $str); + } + + // Replace numeric entities because html_entity_decode doesn't + // do it for us. + $str = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $str); + $str = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $str); + + return $str; + } + + /** + * Strip single and double quotes off of a string, if they are + * present. + * + * @access private + * @param string $str The original string + * @return string $new_str The new string with leading and + * trailing quotes removed + */ + function removeQuotes($str) + { + $matches = array(); + $double = '/^"(.*)"$/'; + $single = "/^\'(.*)\'$/"; + + if (preg_match($double, $str, $matches)) { + return $matches[1]; + } else if (preg_match($single, $str, $matches)) { + return $matches[1]; + } else { + return $str; + } + } + + /** + * Create a regular expression that will match an opening + * or closing tag from a set of names. + * + * @access private + * @param mixed $tag_names Tag names to match + * @param mixed $close false/0 = no, true/1 = yes, other = maybe + * @param mixed $self_close false/0 = no, true/1 = yes, other = maybe + * @return string $regex A regular expression string to be used + * in, say, preg_match. + */ + function tagPattern($tag_names, $close, $self_close) + { + if (is_array($tag_names)) { + $tag_names = '(?:'.implode('|',$tag_names).')'; + } + if ($close) { + $close = '\/' . (($close == 1)? '' : '?'); + } else { + $close = ''; + } + if ($self_close) { + $self_close = '(?:\/\s*)' . (($self_close == 1)? '' : '?'); + } else { + $self_close = ''; + } + $expr = sprintf($this->_tag_expr, $close, $tag_names, $self_close); + + return sprintf("/%s/%s", $expr, $this->_re_flags); + } + + /** + * Given an HTML document string, this finds all the META tags in + * the document, provided they are found in the + * ... section of the document. The tag + * may be missing. + * + * @access private + * @param string $html_string An HTMl document string + * @return array $tag_list Array of tags; each tag is an array of + * attribute -> value. + */ + function getMetaTags($html_string) + { + $key_tags = array($this->tagPattern('html', false, false), + $this->tagPattern('head', false, false), + $this->tagPattern('head', true, false), + $this->tagPattern('html', true, false), + $this->tagPattern(array( + 'body', 'frameset', 'frame', 'p', 'div', + 'table','span','a'), 'maybe', 'maybe')); + $key_tags_pos = array(); + foreach ($key_tags as $pat) { + $matches = array(); + preg_match($pat, $html_string, $matches, PREG_OFFSET_CAPTURE); + if($matches) { + $key_tags_pos[] = $matches[0][1]; + } else { + $key_tags_pos[] = null; + } + } + // no opening head tag + if (is_null($key_tags_pos[1])) { + return array(); + } + // the effective is the min of the following + if (is_null($key_tags_pos[2])) { + $key_tags_pos[2] = strlen($html_string); + } + foreach (array($key_tags_pos[3], $key_tags_pos[4]) as $pos) { + if (!is_null($pos) && $pos < $key_tags_pos[2]) { + $key_tags_pos[2] = $pos; + } + } + // closing head tag comes before opening head tag + if ($key_tags_pos[1] > $key_tags_pos[2]) { + return array(); + } + // if there is an opening html tag, make sure the opening head tag + // comes after it + if (!is_null($key_tags_pos[0]) && $key_tags_pos[1] < $key_tags_pos[0]) { + return array(); + } + $html_string = substr($html_string, $key_tags_pos[1], ($key_tags_pos[2]-$key_tags_pos[1])); + + $link_data = array(); + $link_matches = array(); + + if (!preg_match_all($this->tagPattern('meta', false, 'maybe'), + $html_string, $link_matches)) { + return array(); + } + + foreach ($link_matches[0] as $link) { + $attr_matches = array(); + preg_match_all($this->_attr_find, $link, $attr_matches); + $link_attrs = array(); + foreach ($attr_matches[0] as $index => $full_match) { + $name = $attr_matches[1][$index]; + $value = $this->replaceEntities( + $this->removeQuotes($attr_matches[2][$index])); + + $link_attrs[strtolower($name)] = $value; + } + $link_data[] = $link_attrs; + } + + return $link_data; + } + + /** + * Looks for a META tag with an "http-equiv" attribute whose value + * is one of ("x-xrds-location", "x-yadis-location"), ignoring + * case. If such a META tag is found, its "content" attribute + * value is returned. + * + * @param string $html_string An HTML document in string format + * @return mixed $content The "content" attribute value of the + * META tag, if found, or null if no such tag was found. + */ + function getHTTPEquiv($html_string) + { + $meta_tags = $this->getMetaTags($html_string); + + if ($meta_tags) { + foreach ($meta_tags as $tag) { + if (array_key_exists('http-equiv', $tag) && + (in_array(strtolower($tag['http-equiv']), + array('x-xrds-location', 'x-yadis-location'))) && + array_key_exists('content', $tag)) { + return $tag['content']; + } + } + } + + return null; + } +} \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/PlainHTTPFetcher.php b/libraries/openid/Services/Yadis/PlainHTTPFetcher.php index 34d0760d47c74..a39f605401af8 100644 --- a/libraries/openid/Services/Yadis/PlainHTTPFetcher.php +++ b/libraries/openid/Services/Yadis/PlainHTTPFetcher.php @@ -28,220 +28,218 @@ * @package Yadis */ class Services_Yadis_PlainHTTPFetcher extends Services_Yadis_HTTPFetcher { - function get($url, $extra_headers = null) - { - if (!$this->allowedURL($url)) { - trigger_error("Bad URL scheme in url: " . $url, - E_USER_WARNING); - return null; - } - - $redir = true; - - $stop = time() + $this->timeout; - $off = $this->timeout; - - while ($redir && ($off > 0)) { - - $parts = parse_url($url); - - $specify_port = true; - - // Set a default port. - if (!array_key_exists('port', $parts)) { - $specify_port = false; - if ($parts['scheme'] == 'http') { - $parts['port'] = 80; - } elseif ($parts['scheme'] == 'https') { - $parts['port'] = 443; - } else { - trigger_error("fetcher post method doesn't support " . - " scheme '" . $parts['scheme'] . - "', no default port available", - E_USER_WARNING); - return null; - } - } - - $host = $parts['host']; - - if ($parts['scheme'] == 'https') { - $host = 'ssl://' . $host; - } - - $user_agent = "PHP Yadis Library Fetcher"; - - $headers = array( - "GET ".$parts['path']. - (array_key_exists('query', $parts) ? - "?".$parts['query'] : ""). - " HTTP/1.0", - "User-Agent: $user_agent", - "Host: ".$parts['host']. - ($specify_port ? ":".$parts['port'] : ""), - "Port: ".$parts['port']); - - $errno = 0; - $errstr = ''; - - if ($extra_headers) { - foreach ($extra_headers as $h) { - $headers[] = $h; - } - } - - @$sock = fsockopen($host, $parts['port'], $errno, $errstr, - $this->timeout); - if ($sock === false) { - return false; - } - - stream_set_timeout($sock, $this->timeout); - - fputs($sock, implode("\r\n", $headers) . "\r\n\r\n"); - - $data = ""; - while (!feof($sock)) { - $data .= fgets($sock, 1024); - } - - fclose($sock); - - // Split response into header and body sections - list($headers, $body) = explode("\r\n\r\n", $data, 2); - $headers = explode("\r\n", $headers); - - $http_code = explode(" ", $headers[0]); - $code = $http_code[1]; - - if (in_array($code, array('301', '302'))) { - $url = $this->_findRedirect($headers); - $redir = true; - } else { - $redir = false; - } - - $off = $stop - time(); - } - - $new_headers = array(); - - foreach ($headers as $header) { - if (preg_match("/:/", $header)) { - list($name, $value) = explode(": ", $header, 2); - $new_headers[$name] = $value; - } - - } - - return new Services_Yadis_HTTPResponse($url, $code, $new_headers, $body); - } - - function post($url, $body, $extra_headers = null) - { - if (!$this->allowedURL($url)) { - trigger_error("Bad URL scheme in url: " . $url, - E_USER_WARNING); - return null; - } - - $parts = parse_url($url); - - $headers = array(); - - $post_path = $parts['path']; - if (isset($parts['query'])) { - $post_path .= '?' . $parts['query']; - } - - $headers[] = "POST ".$post_path." HTTP/1.0"; - $headers[] = "Host: " . $parts['host']; - $headers[] = "Content-type: application/x-www-form-urlencoded"; - $headers[] = "Content-length: " . strval(strlen($body)); - - if ($extra_headers && - is_array($extra_headers)) { - $headers = array_merge($headers, $extra_headers); - } - - // Join all headers together. - $all_headers = implode("\r\n", $headers); - - // Add headers, two newlines, and request body. - $request = $all_headers . "\r\n\r\n" . $body; - - // Set a default port. - if (!array_key_exists('port', $parts)) { - if ($parts['scheme'] == 'http') { - $parts['port'] = 80; - } elseif ($parts['scheme'] == 'https') { - $parts['port'] = 443; - } else { - trigger_error("fetcher post method doesn't support scheme '" . - $parts['scheme'] . - "', no default port available", - E_USER_WARNING); - return null; - } - } - - if ($parts['scheme'] == 'https') { - $parts['host'] = sprintf("ssl://%s", $parts['host']); - } - - // Connect to the remote server. - $errno = 0; - $errstr = ''; - - $sock = fsockopen($parts['host'], $parts['port'], $errno, $errstr, - $this->timeout); - - if ($sock === false) { - trigger_error("Could not connect to " . $parts['host'] . - " port " . $parts['port'], - E_USER_WARNING); - return null; - } - - stream_set_timeout($sock, $this->timeout); - - // Write the POST request. - fputs($sock, $request); - - // Get the response from the server. - $response = ""; - while (!feof($sock)) { - if ($data = fgets($sock, 128)) { - $response .= $data; - } else { - break; - } - } - - // Split the request into headers and body. - list($headers, $response_body) = explode("\r\n\r\n", $response, 2); - - $headers = explode("\r\n", $headers); - - // Expect the first line of the headers data to be something - // like HTTP/1.1 200 OK. Split the line on spaces and take - // the second token, which should be the return code. - $http_code = explode(" ", $headers[0]); - $code = $http_code[1]; - - $new_headers = array(); - - foreach ($headers as $header) { - if (preg_match("/:/", $header)) { - list($name, $value) = explode(": ", $header, 2); - $new_headers[$name] = $value; - } - - } - - return new Services_Yadis_HTTPResponse($url, $code, - $headers, $response_body); - } -} - -?> \ No newline at end of file + function get($url, $extra_headers = null) + { + if (!$this->allowedURL($url)) { + trigger_error("Bad URL scheme in url: " . $url, + E_USER_WARNING); + return null; + } + + $redir = true; + + $stop = time() + $this->timeout; + $off = $this->timeout; + + while ($redir && ($off > 0)) { + + $parts = parse_url($url); + + $specify_port = true; + + // Set a default port. + if (!array_key_exists('port', $parts)) { + $specify_port = false; + if ($parts['scheme'] == 'http') { + $parts['port'] = 80; + } elseif ($parts['scheme'] == 'https') { + $parts['port'] = 443; + } else { + trigger_error("fetcher post method doesn't support " . + " scheme '" . $parts['scheme'] . + "', no default port available", + E_USER_WARNING); + return null; + } + } + + $host = $parts['host']; + + if ($parts['scheme'] == 'https') { + $host = 'ssl://' . $host; + } + + $user_agent = "PHP Yadis Library Fetcher"; + + $headers = array( + "GET ".$parts['path']. + (array_key_exists('query', $parts) ? + "?".$parts['query'] : ""). + " HTTP/1.0", + "User-Agent: $user_agent", + "Host: ".$parts['host']. + ($specify_port ? ":".$parts['port'] : ""), + "Port: ".$parts['port']); + + $errno = 0; + $errstr = ''; + + if ($extra_headers) { + foreach ($extra_headers as $h) { + $headers[] = $h; + } + } + + @$sock = fsockopen($host, $parts['port'], $errno, $errstr, + $this->timeout); + if ($sock === false) { + return false; + } + + stream_set_timeout($sock, $this->timeout); + + fputs($sock, implode("\r\n", $headers) . "\r\n\r\n"); + + $data = ""; + while (!feof($sock)) { + $data .= fgets($sock, 1024); + } + + fclose($sock); + + // Split response into header and body sections + list($headers, $body) = explode("\r\n\r\n", $data, 2); + $headers = explode("\r\n", $headers); + + $http_code = explode(" ", $headers[0]); + $code = $http_code[1]; + + if (in_array($code, array('301', '302'))) { + $url = $this->_findRedirect($headers); + $redir = true; + } else { + $redir = false; + } + + $off = $stop - time(); + } + + $new_headers = array(); + + foreach ($headers as $header) { + if (preg_match("/:/", $header)) { + list($name, $value) = explode(": ", $header, 2); + $new_headers[$name] = $value; + } + + } + + return new Services_Yadis_HTTPResponse($url, $code, $new_headers, $body); + } + + function post($url, $body, $extra_headers = null) + { + if (!$this->allowedURL($url)) { + trigger_error("Bad URL scheme in url: " . $url, + E_USER_WARNING); + return null; + } + + $parts = parse_url($url); + + $headers = array(); + + $post_path = $parts['path']; + if (isset($parts['query'])) { + $post_path .= '?' . $parts['query']; + } + + $headers[] = "POST ".$post_path." HTTP/1.0"; + $headers[] = "Host: " . $parts['host']; + $headers[] = "Content-type: application/x-www-form-urlencoded"; + $headers[] = "Content-length: " . strval(strlen($body)); + + if ($extra_headers && + is_array($extra_headers)) { + $headers = array_merge($headers, $extra_headers); + } + + // Join all headers together. + $all_headers = implode("\r\n", $headers); + + // Add headers, two newlines, and request body. + $request = $all_headers . "\r\n\r\n" . $body; + + // Set a default port. + if (!array_key_exists('port', $parts)) { + if ($parts['scheme'] == 'http') { + $parts['port'] = 80; + } elseif ($parts['scheme'] == 'https') { + $parts['port'] = 443; + } else { + trigger_error("fetcher post method doesn't support scheme '" . + $parts['scheme'] . + "', no default port available", + E_USER_WARNING); + return null; + } + } + + if ($parts['scheme'] == 'https') { + $parts['host'] = sprintf("ssl://%s", $parts['host']); + } + + // Connect to the remote server. + $errno = 0; + $errstr = ''; + + $sock = fsockopen($parts['host'], $parts['port'], $errno, $errstr, + $this->timeout); + + if ($sock === false) { + trigger_error("Could not connect to " . $parts['host'] . + " port " . $parts['port'], + E_USER_WARNING); + return null; + } + + stream_set_timeout($sock, $this->timeout); + + // Write the POST request. + fputs($sock, $request); + + // Get the response from the server. + $response = ""; + while (!feof($sock)) { + if ($data = fgets($sock, 128)) { + $response .= $data; + } else { + break; + } + } + + // Split the request into headers and body. + list($headers, $response_body) = explode("\r\n\r\n", $response, 2); + + $headers = explode("\r\n", $headers); + + // Expect the first line of the headers data to be something + // like HTTP/1.1 200 OK. Split the line on spaces and take + // the second token, which should be the return code. + $http_code = explode(" ", $headers[0]); + $code = $http_code[1]; + + $new_headers = array(); + + foreach ($headers as $header) { + if (preg_match("/:/", $header)) { + list($name, $value) = explode(": ", $header, 2); + $new_headers[$name] = $value; + } + + } + + return new Services_Yadis_HTTPResponse($url, $code, + $headers, $response_body); + } +} \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/XML.php b/libraries/openid/Services/Yadis/XML.php index 8e1d2376384fc..1c5f77738799d 100644 --- a/libraries/openid/Services/Yadis/XML.php +++ b/libraries/openid/Services/Yadis/XML.php @@ -19,109 +19,109 @@ * @package Yadis */ class Services_Yadis_XMLParser { - /** - * Initialize an instance of Services_Yadis_XMLParser with some - * XML and namespaces. This SHOULD NOT be overridden by - * subclasses. - * - * @param string $xml_string A string of XML to be parsed. - * @param array $namespace_map An array of ($ns_name => $ns_uri) - * to be registered with the XML parser. May be empty. - * @return boolean $result True if the initialization and - * namespace registration(s) succeeded; false otherwise. - */ - function init($xml_string, $namespace_map) - { - if (!$this->setXML($xml_string)) { - return false; - } - - foreach ($namespace_map as $prefix => $uri) { - if (!$this->registerNamespace($prefix, $uri)) { - return false; - } - } - - return true; - } - - /** - * Register a namespace with the XML parser. This should be - * overridden by subclasses. - * - * @param string $prefix The namespace prefix to appear in XML tag - * names. - * - * @param string $uri The namespace URI to be used to identify the - * namespace in the XML. - * - * @return boolean $result True if the registration succeeded; - * false otherwise. - */ - function registerNamespace($prefix, $uri) - { - // Not implemented. - } - - /** - * Set this parser object's XML payload. This should be - * overridden by subclasses. - * - * @param string $xml_string The XML string to pass to this - * object's XML parser. - * - * @return boolean $result True if the initialization succeeded; - * false otherwise. - */ - function setXML($xml_string) - { - // Not implemented. - } - - /** - * Evaluate an XPath expression and return the resulting node - * list. This should be overridden by subclasses. - * - * @param string $xpath The XPath expression to be evaluated. - * - * @param mixed $node A node object resulting from a previous - * evalXPath call. This node, if specified, provides the context - * for the evaluation of this xpath expression. - * - * @return array $node_list An array of matching opaque node - * objects to be used with other methods of this parser class. - */ - function evalXPath($xpath, $node = null) - { - // Not implemented. - } - - /** - * Return the textual content of a specified node. - * - * @param mixed $node A node object from a previous call to - * $this->evalXPath(). - * - * @return string $content The content of this node. - */ - function content($node) - { - // Not implemented. - } - - /** - * Return the attributes of a specified node. - * - * @param mixed $node A node object from a previous call to - * $this->evalXPath(). - * - * @return array $attrs An array mapping attribute names to - * values. - */ - function attributes($node) - { - // Not implemented. - } + /** + * Initialize an instance of Services_Yadis_XMLParser with some + * XML and namespaces. This SHOULD NOT be overridden by + * subclasses. + * + * @param string $xml_string A string of XML to be parsed. + * @param array $namespace_map An array of ($ns_name => $ns_uri) + * to be registered with the XML parser. May be empty. + * @return boolean $result True if the initialization and + * namespace registration(s) succeeded; false otherwise. + */ + function init($xml_string, $namespace_map) + { + if (!$this->setXML($xml_string)) { + return false; + } + + foreach ($namespace_map as $prefix => $uri) { + if (!$this->registerNamespace($prefix, $uri)) { + return false; + } + } + + return true; + } + + /** + * Register a namespace with the XML parser. This should be + * overridden by subclasses. + * + * @param string $prefix The namespace prefix to appear in XML tag + * names. + * + * @param string $uri The namespace URI to be used to identify the + * namespace in the XML. + * + * @return boolean $result True if the registration succeeded; + * false otherwise. + */ + function registerNamespace($prefix, $uri) + { + // Not implemented. + } + + /** + * Set this parser object's XML payload. This should be + * overridden by subclasses. + * + * @param string $xml_string The XML string to pass to this + * object's XML parser. + * + * @return boolean $result True if the initialization succeeded; + * false otherwise. + */ + function setXML($xml_string) + { + // Not implemented. + } + + /** + * Evaluate an XPath expression and return the resulting node + * list. This should be overridden by subclasses. + * + * @param string $xpath The XPath expression to be evaluated. + * + * @param mixed $node A node object resulting from a previous + * evalXPath call. This node, if specified, provides the context + * for the evaluation of this xpath expression. + * + * @return array $node_list An array of matching opaque node + * objects to be used with other methods of this parser class. + */ + function evalXPath($xpath, $node = null) + { + // Not implemented. + } + + /** + * Return the textual content of a specified node. + * + * @param mixed $node A node object from a previous call to + * $this->evalXPath(). + * + * @return string $content The content of this node. + */ + function content($node) + { + // Not implemented. + } + + /** + * Return the attributes of a specified node. + * + * @param mixed $node A node object from a previous call to + * $this->evalXPath(). + * + * @return array $attrs An array mapping attribute names to + * values. + */ + function attributes($node) + { + // Not implemented. + } } /** @@ -134,72 +134,72 @@ function attributes($node) * @package Yadis */ class Services_Yadis_domxml extends Services_Yadis_XMLParser { - function Services_Yadis_domxml() - { - $this->xml = null; - $this->doc = null; - $this->xpath = null; - $this->errors = array(); - } - - function setXML($xml_string) - { - $this->xml = $xml_string; - $this->doc = @domxml_open_mem($xml_string, DOMXML_LOAD_PARSING, - $this->errors); - - if (!$this->doc) { - return false; - } - - $this->xpath = $this->doc->xpath_new_context(); - - return true; - } - - function registerNamespace($prefix, $uri) - { - return xpath_register_ns($this->xpath, $prefix, $uri); - } - - function &evalXPath($xpath, $node = null) - { - if ($node) { - $result = @$this->xpath->xpath_eval($xpath, $node); - } else { - $result = @$this->xpath->xpath_eval($xpath); - } - - if (!$result->nodeset) { - $n = array(); - return $n; - } - - return $result->nodeset; - } - - function content($node) - { - if ($node) { - return $node->get_content(); - } - } - - function attributes($node) - { - if ($node) { - $arr = $node->attributes(); - $result = array(); - - if ($arr) { - foreach ($arr as $attrnode) { - $result[$attrnode->name] = $attrnode->value; - } - } - - return $result; - } - } + function Services_Yadis_domxml() + { + $this->xml = null; + $this->doc = null; + $this->xpath = null; + $this->errors = array(); + } + + function setXML($xml_string) + { + $this->xml = $xml_string; + $this->doc = @domxml_open_mem($xml_string, DOMXML_LOAD_PARSING, + $this->errors); + + if (!$this->doc) { + return false; + } + + $this->xpath = $this->doc->xpath_new_context(); + + return true; + } + + function registerNamespace($prefix, $uri) + { + return xpath_register_ns($this->xpath, $prefix, $uri); + } + + function &evalXPath($xpath, $node = null) + { + if ($node) { + $result = @$this->xpath->xpath_eval($xpath, $node); + } else { + $result = @$this->xpath->xpath_eval($xpath); + } + + if (!$result->nodeset) { + $n = array(); + return $n; + } + + return $result->nodeset; + } + + function content($node) + { + if ($node) { + return $node->get_content(); + } + } + + function attributes($node) + { + if ($node) { + $arr = $node->attributes(); + $result = array(); + + if ($arr) { + foreach ($arr as $attrnode) { + $result[$attrnode->name] = $attrnode->value; + } + } + + return $result; + } + } } /** @@ -212,81 +212,81 @@ function attributes($node) * @package Yadis */ class Services_Yadis_dom extends Services_Yadis_XMLParser { - function Services_Yadis_dom() - { - $this->xml = null; - $this->doc = null; - $this->xpath = null; - $this->errors = array(); - } - - function setXML($xml_string) - { - $this->xml = $xml_string; - $this->doc = new DOMDocument; - - if (!$this->doc) { - return false; - } - - if (!@$this->doc->loadXML($xml_string)) { - return false; - } - - $this->xpath = new DOMXPath($this->doc); - - if ($this->xpath) { - return true; - } else { - return false; - } - } - - function registerNamespace($prefix, $uri) - { - return $this->xpath->registerNamespace($prefix, $uri); - } - - function &evalXPath($xpath, $node = null) - { - if ($node) { - $result = @$this->xpath->query($xpath, $node); - } else { - $result = @$this->xpath->query($xpath); - } - - $n = array(); - - for ($i = 0; $i < $result->length; $i++) { - $n[] = $result->item($i); - } - - return $n; - } - - function content($node) - { - if ($node) { - return $node->textContent; - } - } - - function attributes($node) - { - if ($node) { - $arr = $node->attributes; - $result = array(); - - if ($arr) { - for ($i = 0; $i < $arr->length; $i++) { - $node = $arr->item($i); - $result[$node->nodeName] = $node->nodeValue; - } - } - - return $result; - } - } + function Services_Yadis_dom() + { + $this->xml = null; + $this->doc = null; + $this->xpath = null; + $this->errors = array(); + } + + function setXML($xml_string) + { + $this->xml = $xml_string; + $this->doc = new DOMDocument; + + if (!$this->doc) { + return false; + } + + if (!@$this->doc->loadXML($xml_string)) { + return false; + } + + $this->xpath = new DOMXPath($this->doc); + + if ($this->xpath) { + return true; + } else { + return false; + } + } + + function registerNamespace($prefix, $uri) + { + return $this->xpath->registerNamespace($prefix, $uri); + } + + function &evalXPath($xpath, $node = null) + { + if ($node) { + $result = @$this->xpath->query($xpath, $node); + } else { + $result = @$this->xpath->query($xpath); + } + + $n = array(); + + for ($i = 0; $i < $result->length; $i++) { + $n[] = $result->item($i); + } + + return $n; + } + + function content($node) + { + if ($node) { + return $node->textContent; + } + } + + function attributes($node) + { + if ($node) { + $arr = $node->attributes; + $result = array(); + + if ($arr) { + for ($i = 0; $i < $arr->length; $i++) { + $node = $arr->item($i); + $result[$node->nodeName] = $node->nodeValue; + } + } + + return $result; + } + } } global $__Services_Yadis_defaultParser; @@ -303,18 +303,18 @@ function attributes($node) */ function Services_Yadis_setDefaultParser(&$parser) { - global $__Services_Yadis_defaultParser; - $__Services_Yadis_defaultParser =& $parser; + global $__Services_Yadis_defaultParser; + $__Services_Yadis_defaultParser =& $parser; } function Services_Yadis_getSupportedExtensions() { - return array( - 'dom' => array('classname' => 'Services_Yadis_dom', - 'libname' => array('dom.so', 'dom.dll')), - 'domxml' => array('classname' => 'Services_Yadis_domxml', - 'libname' => array('domxml.so', 'php_domxml.dll')), - ); + return array( + 'dom' => array('classname' => 'Services_Yadis_dom', + 'libname' => array('dom.so', 'dom.dll')), + 'domxml' => array('classname' => 'Services_Yadis_domxml', + 'libname' => array('domxml.so', 'php_domxml.dll')), + ); } /** @@ -325,41 +325,39 @@ function Services_Yadis_getSupportedExtensions() */ function &Services_Yadis_getXMLParser() { - global $__Services_Yadis_defaultParser; - - if (isset($__Services_Yadis_defaultParser)) { - return $__Services_Yadis_defaultParser; - } - - $p = null; - $classname = null; - - $extensions = Services_Yadis_getSupportedExtensions(); - - // Return a wrapper for the resident implementation, if any. - foreach ($extensions as $name => $params) { - if (!extension_loaded($name)) { - foreach ($params['libname'] as $libname) { - if (@dl($libname)) { - $classname = $params['classname']; - } - } - } else { - $classname = $params['classname']; - } - if (isset($classname)) { - $p = new $classname(); - return $p; - } - } - - if (!isset($p)) { - trigger_error('No XML parser was found', E_USER_ERROR); - } else { - Services_Yadis_setDefaultParser($p); - } - - return $p; -} - -?> + global $__Services_Yadis_defaultParser; + + if (isset($__Services_Yadis_defaultParser)) { + return $__Services_Yadis_defaultParser; + } + + $p = null; + $classname = null; + + $extensions = Services_Yadis_getSupportedExtensions(); + + // Return a wrapper for the resident implementation, if any. + foreach ($extensions as $name => $params) { + if (!extension_loaded($name)) { + foreach ($params['libname'] as $libname) { + if (@dl($libname)) { + $classname = $params['classname']; + } + } + } else { + $classname = $params['classname']; + } + if (isset($classname)) { + $p = new $classname(); + return $p; + } + } + + if (!isset($p)) { + trigger_error('No XML parser was found', E_USER_ERROR); + } else { + Services_Yadis_setDefaultParser($p); + } + + return $p; +} \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/XRDS.php b/libraries/openid/Services/Yadis/XRDS.php index 620e9dac8f7b1..7d533f23ef1c1 100644 --- a/libraries/openid/Services/Yadis/XRDS.php +++ b/libraries/openid/Services/Yadis/XRDS.php @@ -40,8 +40,8 @@ function Services_Yadis_getNSMap() { - return array('xrds' => 'xri://$xrds', - 'xrd' => 'xri://$xrd*($v*2.0)'); + return array('xrds' => 'xri://$xrds', + 'xrd' => 'xri://$xrd*($v*2.0)'); } /** @@ -49,15 +49,15 @@ function Services_Yadis_getNSMap() */ function Services_Yadis_array_scramble($arr) { - $result = array(); + $result = array(); - while (count($arr)) { - $index = array_rand($arr, 1); - $result[] = $arr[$index]; - unset($arr[$index]); - } + while (count($arr)) { + $index = array_rand($arr, 1); + $result[] = $arr[$index]; + unset($arr[$index]); + } - return $result; + return $result; } /** @@ -74,113 +74,113 @@ function Services_Yadis_array_scramble($arr) */ class Services_Yadis_Service { - /** - * Creates an empty service object. - */ - function Services_Yadis_Service() - { - $this->element = null; - $this->parser = null; - } - - /** - * Return the URIs in the "Type" elements, if any, of this Service - * element. - * - * @return array $type_uris An array of Type URI strings. - */ - function getTypes() - { - $t = array(); - foreach ($this->getElements('xrd:Type') as $elem) { - $c = $this->parser->content($elem); - if ($c) { - $t[] = $c; - } - } - return $t; - } - - /** - * Return the URIs in the "URI" elements, if any, of this Service - * element. The URIs are returned sorted in priority order. - * - * @return array $uris An array of URI strings. - */ - function getURIs() - { - $uris = array(); - $last = array(); - - foreach ($this->getElements('xrd:URI') as $elem) { - $uri_string = $this->parser->content($elem); - $attrs = $this->parser->attributes($elem); - if ($attrs && - array_key_exists('priority', $attrs)) { - $priority = intval($attrs['priority']); - if (!array_key_exists($priority, $uris)) { - $uris[$priority] = array(); - } - - $uris[$priority][] = $uri_string; - } else { - $last[] = $uri_string; - } - } - - $keys = array_keys($uris); - sort($keys); - - // Rebuild array of URIs. - $result = array(); - foreach ($keys as $k) { - $new_uris = Services_Yadis_array_scramble($uris[$k]); - $result = array_merge($result, $new_uris); - } - - $result = array_merge($result, - Services_Yadis_array_scramble($last)); - - return $result; - } - - /** - * Returns the "priority" attribute value of this - * element, if the attribute is present. Returns null if not. - * - * @return mixed $result Null or integer, depending on whether - * this Service element has a 'priority' attribute. - */ - function getPriority() - { - $attributes = $this->parser->attributes($this->element); - - if (array_key_exists('priority', $attributes)) { - return intval($attributes['priority']); - } - - return null; - } - - /** - * Used to get XML elements from this object's element. - * - * This is what you should use to get all custom information out - * of this element. This is used by service filter functions to - * determine whether a service element contains specific tags, - * etc. NOTE: this only considers elements which are direct - * children of the element for this object. - * - * @param string $name The name of the element to look for - * @return array $list An array of elements with the specified - * name which are direct children of the element. The - * nodes returned by this function can be passed to $this->parser - * methods (see {@link Services_Yadis_XMLParser}). - */ - function getElements($name) - { - return $this->parser->evalXPath($name, $this->element); - } + /** + * Creates an empty service object. + */ + function Services_Yadis_Service() + { + $this->element = null; + $this->parser = null; + } + + /** + * Return the URIs in the "Type" elements, if any, of this Service + * element. + * + * @return array $type_uris An array of Type URI strings. + */ + function getTypes() + { + $t = array(); + foreach ($this->getElements('xrd:Type') as $elem) { + $c = $this->parser->content($elem); + if ($c) { + $t[] = $c; + } + } + return $t; + } + + /** + * Return the URIs in the "URI" elements, if any, of this Service + * element. The URIs are returned sorted in priority order. + * + * @return array $uris An array of URI strings. + */ + function getURIs() + { + $uris = array(); + $last = array(); + + foreach ($this->getElements('xrd:URI') as $elem) { + $uri_string = $this->parser->content($elem); + $attrs = $this->parser->attributes($elem); + if ($attrs && + array_key_exists('priority', $attrs)) { + $priority = intval($attrs['priority']); + if (!array_key_exists($priority, $uris)) { + $uris[$priority] = array(); + } + + $uris[$priority][] = $uri_string; + } else { + $last[] = $uri_string; + } + } + + $keys = array_keys($uris); + sort($keys); + + // Rebuild array of URIs. + $result = array(); + foreach ($keys as $k) { + $new_uris = Services_Yadis_array_scramble($uris[$k]); + $result = array_merge($result, $new_uris); + } + + $result = array_merge($result, + Services_Yadis_array_scramble($last)); + + return $result; + } + + /** + * Returns the "priority" attribute value of this + * element, if the attribute is present. Returns null if not. + * + * @return mixed $result Null or integer, depending on whether + * this Service element has a 'priority' attribute. + */ + function getPriority() + { + $attributes = $this->parser->attributes($this->element); + + if (array_key_exists('priority', $attributes)) { + return intval($attributes['priority']); + } + + return null; + } + + /** + * Used to get XML elements from this object's element. + * + * This is what you should use to get all custom information out + * of this element. This is used by service filter functions to + * determine whether a service element contains specific tags, + * etc. NOTE: this only considers elements which are direct + * children of the element for this object. + * + * @param string $name The name of the element to look for + * @return array $list An array of elements with the specified + * name which are direct children of the element. The + * nodes returned by this function can be passed to $this->parser + * methods (see {@link Services_Yadis_XMLParser}). + */ + function getElements($name) + { + return $this->parser->evalXPath($name, $this->element); + } } /** @@ -200,228 +200,226 @@ function getElements($name) */ class Services_Yadis_XRDS { - /** - * Instantiate a Services_Yadis_XRDS object. Requires an XPath - * instance which has been used to parse a valid XRDS document. - */ - function Services_Yadis_XRDS(&$xmlParser, &$xrdNodes) - { - $this->parser =& $xmlParser; - $this->xrdNode = $xrdNodes[count($xrdNodes) - 1]; - $this->allXrdNodes =& $xrdNodes; - $this->serviceList = array(); - $this->_parse(); - } - - /** - * Parse an XML string (XRDS document) and return either a - * Services_Yadis_XRDS object or null, depending on whether the - * XRDS XML is valid. - * - * @param string $xml_string An XRDS XML string. - * @return mixed $xrds An instance of Services_Yadis_XRDS or null, - * depending on the validity of $xml_string - */ - function &parseXRDS($xml_string, $extra_ns_map = null) - { - $_null = null; - - if (!$xml_string) { - return $_null; - } - - $parser = Services_Yadis_getXMLParser(); - - $ns_map = Services_Yadis_getNSMap(); - - if ($extra_ns_map && is_array($extra_ns_map)) { - $ns_map = array_merge($ns_map, $extra_ns_map); - } - - if (!($parser && $parser->init($xml_string, $ns_map))) { - return $_null; - } - - // Try to get root element. - $root = $parser->evalXPath('/xrds:XRDS[1]'); - if (!$root) { - return $_null; - } - - if (is_array($root)) { - $root = $root[0]; - } - - $attrs = $parser->attributes($root); - - if (array_key_exists('xmlns:xrd', $attrs) && - $attrs['xmlns:xrd'] != 'xri://$xrd*($v*2.0)') { - return $_null; - } else if (array_key_exists('xmlns', $attrs) && - preg_match('/xri/', $attrs['xmlns']) && - $attrs['xmlns'] != 'xri://$xrd*($v*2.0)') { - return $_null; - } - - // Get the last XRD node. - $xrd_nodes = $parser->evalXPath('/xrds:XRDS[1]/xrd:XRD'); - - if (!$xrd_nodes) { - return $_null; - } - - $xrds = new Services_Yadis_XRDS($parser, $xrd_nodes); - return $xrds; - } - - /** - * @access private - */ - function _addService($priority, $service) - { - $priority = intval($priority); - - if (!array_key_exists($priority, $this->serviceList)) { - $this->serviceList[$priority] = array(); - } - - $this->serviceList[$priority][] = $service; - } - - /** - * Creates the service list using nodes from the XRDS XML - * document. - * - * @access private - */ - function _parse() - { - $this->serviceList = array(); - - $services = $this->parser->evalXPath('xrd:Service', $this->xrdNode); - - foreach ($services as $node) { - $s =& new Services_Yadis_Service(); - $s->element = $node; - $s->parser =& $this->parser; - - $priority = $s->getPriority(); - - if ($priority === null) { - $priority = SERVICES_YADIS_MAX_PRIORITY; - } - - $this->_addService($priority, $s); - } - } - - /** - * Returns a list of service objects which correspond to - * elements in the XRDS XML document for this object. - * - * Optionally, an array of filter callbacks may be given to limit - * the list of returned service objects. Furthermore, the default - * mode is to return all service objects which match ANY of the - * specified filters, but $filter_mode may be - * SERVICES_YADIS_MATCH_ALL if you want to be sure that the - * returned services match all the given filters. See {@link - * Services_Yadis_Yadis} for detailed usage information on filter - * functions. - * - * @param mixed $filters An array of callbacks to filter the - * returned services, or null if all services are to be returned. - * @param integer $filter_mode SERVICES_YADIS_MATCH_ALL or - * SERVICES_YADIS_MATCH_ANY, depending on whether the returned - * services should match ALL or ANY of the specified filters, - * respectively. - * @return mixed $services An array of {@link - * Services_Yadis_Service} objects if $filter_mode is a valid - * mode; null if $filter_mode is an invalid mode (i.e., not - * SERVICES_YADIS_MATCH_ANY or SERVICES_YADIS_MATCH_ALL). - */ - function services($filters = null, - $filter_mode = SERVICES_YADIS_MATCH_ANY) - { - - $pri_keys = array_keys($this->serviceList); - sort($pri_keys, SORT_NUMERIC); - - // If no filters are specified, return the entire service - // list, ordered by priority. - if (!$filters || - (!is_array($filters))) { - - $result = array(); - foreach ($pri_keys as $pri) { - $result = array_merge($result, $this->serviceList[$pri]); - } - - return $result; - } - - // If a bad filter mode is specified, return null. - if (!in_array($filter_mode, array(SERVICES_YADIS_MATCH_ANY, - SERVICES_YADIS_MATCH_ALL))) { - return null; - } - - // Otherwise, use the callbacks in the filter list to - // determine which services are returned. - $filtered = array(); - - foreach ($pri_keys as $priority_value) { - $service_obj_list = $this->serviceList[$priority_value]; - - foreach ($service_obj_list as $service) { - - $matches = 0; - - foreach ($filters as $filter) { - if (call_user_func_array($filter, array($service))) { - $matches++; - - if ($filter_mode == SERVICES_YADIS_MATCH_ANY) { - $pri = $service->getPriority(); - if ($pri === null) { - $pri = SERVICES_YADIS_MAX_PRIORITY; - } - - if (!array_key_exists($pri, $filtered)) { - $filtered[$pri] = array(); - } - - $filtered[$pri][] = $service; - break; - } - } - } - - if (($filter_mode == SERVICES_YADIS_MATCH_ALL) && - ($matches == count($filters))) { - - $pri = $service->getPriority(); - if ($pri === null) { - $pri = SERVICES_YADIS_MAX_PRIORITY; - } - - if (!array_key_exists($pri, $filtered)) { - $filtered[$pri] = array(); - } - $filtered[$pri][] = $service; - } - } - } - - $pri_keys = array_keys($filtered); - sort($pri_keys, SORT_NUMERIC); - - $result = array(); - foreach ($pri_keys as $pri) { - $result = array_merge($result, $filtered[$pri]); - } - - return $result; - } -} - -?> \ No newline at end of file + /** + * Instantiate a Services_Yadis_XRDS object. Requires an XPath + * instance which has been used to parse a valid XRDS document. + */ + function Services_Yadis_XRDS(&$xmlParser, &$xrdNodes) + { + $this->parser =& $xmlParser; + $this->xrdNode = $xrdNodes[count($xrdNodes) - 1]; + $this->allXrdNodes =& $xrdNodes; + $this->serviceList = array(); + $this->_parse(); + } + + /** + * Parse an XML string (XRDS document) and return either a + * Services_Yadis_XRDS object or null, depending on whether the + * XRDS XML is valid. + * + * @param string $xml_string An XRDS XML string. + * @return mixed $xrds An instance of Services_Yadis_XRDS or null, + * depending on the validity of $xml_string + */ + function &parseXRDS($xml_string, $extra_ns_map = null) + { + $_null = null; + + if (!$xml_string) { + return $_null; + } + + $parser = Services_Yadis_getXMLParser(); + + $ns_map = Services_Yadis_getNSMap(); + + if ($extra_ns_map && is_array($extra_ns_map)) { + $ns_map = array_merge($ns_map, $extra_ns_map); + } + + if (!($parser && $parser->init($xml_string, $ns_map))) { + return $_null; + } + + // Try to get root element. + $root = $parser->evalXPath('/xrds:XRDS[1]'); + if (!$root) { + return $_null; + } + + if (is_array($root)) { + $root = $root[0]; + } + + $attrs = $parser->attributes($root); + + if (array_key_exists('xmlns:xrd', $attrs) && + $attrs['xmlns:xrd'] != 'xri://$xrd*($v*2.0)') { + return $_null; + } else if (array_key_exists('xmlns', $attrs) && + preg_match('/xri/', $attrs['xmlns']) && + $attrs['xmlns'] != 'xri://$xrd*($v*2.0)') { + return $_null; + } + + // Get the last XRD node. + $xrd_nodes = $parser->evalXPath('/xrds:XRDS[1]/xrd:XRD'); + + if (!$xrd_nodes) { + return $_null; + } + + $xrds = new Services_Yadis_XRDS($parser, $xrd_nodes); + return $xrds; + } + + /** + * @access private + */ + function _addService($priority, $service) + { + $priority = intval($priority); + + if (!array_key_exists($priority, $this->serviceList)) { + $this->serviceList[$priority] = array(); + } + + $this->serviceList[$priority][] = $service; + } + + /** + * Creates the service list using nodes from the XRDS XML + * document. + * + * @access private + */ + function _parse() + { + $this->serviceList = array(); + + $services = $this->parser->evalXPath('xrd:Service', $this->xrdNode); + + foreach ($services as $node) { + $s =& new Services_Yadis_Service(); + $s->element = $node; + $s->parser =& $this->parser; + + $priority = $s->getPriority(); + + if ($priority === null) { + $priority = SERVICES_YADIS_MAX_PRIORITY; + } + + $this->_addService($priority, $s); + } + } + + /** + * Returns a list of service objects which correspond to + * elements in the XRDS XML document for this object. + * + * Optionally, an array of filter callbacks may be given to limit + * the list of returned service objects. Furthermore, the default + * mode is to return all service objects which match ANY of the + * specified filters, but $filter_mode may be + * SERVICES_YADIS_MATCH_ALL if you want to be sure that the + * returned services match all the given filters. See {@link + * Services_Yadis_Yadis} for detailed usage information on filter + * functions. + * + * @param mixed $filters An array of callbacks to filter the + * returned services, or null if all services are to be returned. + * @param integer $filter_mode SERVICES_YADIS_MATCH_ALL or + * SERVICES_YADIS_MATCH_ANY, depending on whether the returned + * services should match ALL or ANY of the specified filters, + * respectively. + * @return mixed $services An array of {@link + * Services_Yadis_Service} objects if $filter_mode is a valid + * mode; null if $filter_mode is an invalid mode (i.e., not + * SERVICES_YADIS_MATCH_ANY or SERVICES_YADIS_MATCH_ALL). + */ + function services($filters = null, + $filter_mode = SERVICES_YADIS_MATCH_ANY) + { + + $pri_keys = array_keys($this->serviceList); + sort($pri_keys, SORT_NUMERIC); + + // If no filters are specified, return the entire service + // list, ordered by priority. + if (!$filters || + (!is_array($filters))) { + + $result = array(); + foreach ($pri_keys as $pri) { + $result = array_merge($result, $this->serviceList[$pri]); + } + + return $result; + } + + // If a bad filter mode is specified, return null. + if (!in_array($filter_mode, array(SERVICES_YADIS_MATCH_ANY, + SERVICES_YADIS_MATCH_ALL))) { + return null; + } + + // Otherwise, use the callbacks in the filter list to + // determine which services are returned. + $filtered = array(); + + foreach ($pri_keys as $priority_value) { + $service_obj_list = $this->serviceList[$priority_value]; + + foreach ($service_obj_list as $service) { + + $matches = 0; + + foreach ($filters as $filter) { + if (call_user_func_array($filter, array($service))) { + $matches++; + + if ($filter_mode == SERVICES_YADIS_MATCH_ANY) { + $pri = $service->getPriority(); + if ($pri === null) { + $pri = SERVICES_YADIS_MAX_PRIORITY; + } + + if (!array_key_exists($pri, $filtered)) { + $filtered[$pri] = array(); + } + + $filtered[$pri][] = $service; + break; + } + } + } + + if (($filter_mode == SERVICES_YADIS_MATCH_ALL) && + ($matches == count($filters))) { + + $pri = $service->getPriority(); + if ($pri === null) { + $pri = SERVICES_YADIS_MAX_PRIORITY; + } + + if (!array_key_exists($pri, $filtered)) { + $filtered[$pri] = array(); + } + $filtered[$pri][] = $service; + } + } + } + + $pri_keys = array_keys($filtered); + sort($pri_keys, SORT_NUMERIC); + + $result = array(); + foreach ($pri_keys as $pri) { + $result = array_merge($result, $filtered[$pri]); + } + + return $result; + } +} \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/XRI.php b/libraries/openid/Services/Yadis/XRI.php index 2f405ca774371..24264578cbd96 100644 --- a/libraries/openid/Services/Yadis/XRI.php +++ b/libraries/openid/Services/Yadis/XRI.php @@ -17,219 +17,217 @@ function Services_Yadis_getDefaultProxy() { - return 'http://proxy.xri.net/'; + return 'http://proxy.xri.net/'; } function Services_Yadis_getXRIAuthorities() { - return array('!', '=', '@', '+', '$', '('); + return array('!', '=', '@', '+', '$', '('); } function Services_Yadis_getEscapeRE() { - $parts = array(); - foreach (array_merge(Services_Yadis_getUCSChars(), - Services_Yadis_getIPrivateChars()) as $pair) { - list($m, $n) = $pair; - $parts[] = sprintf("%s-%s", chr($m), chr($n)); - } - - return sprintf('/[%s]/', implode('', $parts)); + $parts = array(); + foreach (array_merge(Services_Yadis_getUCSChars(), + Services_Yadis_getIPrivateChars()) as $pair) { + list($m, $n) = $pair; + $parts[] = sprintf("%s-%s", chr($m), chr($n)); + } + + return sprintf('/[%s]/', implode('', $parts)); } function Services_Yadis_getXrefRE() { - return '/\((.*?)\)/'; + return '/\((.*?)\)/'; } function Services_Yadis_identifierScheme($identifier) { - if (Services_Yadis_startswith($identifier, 'xri://') || - (in_array($identifier[0], Services_Yadis_getXRIAuthorities()))) { - return "XRI"; - } else { - return "URI"; - } + if (Services_Yadis_startswith($identifier, 'xri://') || + (in_array($identifier[0], Services_Yadis_getXRIAuthorities()))) { + return "XRI"; + } else { + return "URI"; + } } function Services_Yadis_toIRINormal($xri) { - if (!Services_Yadis_startswith($xri, 'xri://')) { - $xri = 'xri://' . $xri; - } + if (!Services_Yadis_startswith($xri, 'xri://')) { + $xri = 'xri://' . $xri; + } - return Services_Yadis_escapeForIRI($xri); + return Services_Yadis_escapeForIRI($xri); } function _escape_xref($xref_match) { - $xref = $xref_match[0]; - $xref = str_replace('/', '%2F', $xref); - $xref = str_replace('?', '%3F', $xref); - $xref = str_replace('#', '%23', $xref); - return $xref; + $xref = $xref_match[0]; + $xref = str_replace('/', '%2F', $xref); + $xref = str_replace('?', '%3F', $xref); + $xref = str_replace('#', '%23', $xref); + return $xref; } function Services_Yadis_escapeForIRI($xri) { - $xri = str_replace('%', '%25', $xri); - $xri = preg_replace_callback(Services_Yadis_getXrefRE(), - '_escape_xref', $xri); - return $xri; + $xri = str_replace('%', '%25', $xri); + $xri = preg_replace_callback(Services_Yadis_getXrefRE(), + '_escape_xref', $xri); + return $xri; } function Services_Yadis_toURINormal($xri) { - return Services_Yadis_iriToURI(Services_Yadis_toIRINormal($xri)); + return Services_Yadis_iriToURI(Services_Yadis_toIRINormal($xri)); } function Services_Yadis_iriToURI($iri) { - if (1) { - return $iri; - } else { - // According to RFC 3987, section 3.1, "Mapping of IRIs to URIs" - return preg_replace_callback(Services_Yadis_getEscapeRE(), - 'Services_Yadis_pct_escape_unicode', $iri); - } + if (1) { + return $iri; + } else { + // According to RFC 3987, section 3.1, "Mapping of IRIs to URIs" + return preg_replace_callback(Services_Yadis_getEscapeRE(), + 'Services_Yadis_pct_escape_unicode', $iri); + } } function Services_Yadis_XRIAppendArgs($url, $args) { - // Append some arguments to an HTTP query. Yes, this is just like - // OpenID's appendArgs, but with special seasoning for XRI - // queries. - - if (count($args) == 0) { - return $url; - } - - // Non-empty array; if it is an array of arrays, use multisort; - // otherwise use sort. - if (array_key_exists(0, $args) && - is_array($args[0])) { - // Do nothing here. - } else { - $keys = array_keys($args); - sort($keys); - $new_args = array(); - foreach ($keys as $key) { - $new_args[] = array($key, $args[$key]); - } - $args = $new_args; - } - - // According to XRI Resolution section "QXRI query parameters": - // - // "If the original QXRI had a null query component (only a - // leading question mark), or a query component consisting of - // only question marks, one additional leading question mark MUST - // be added when adding any XRI resolution parameters." - if (strpos(rtrim($url, '?'), '?') !== false) { - $sep = '&'; - } else { - $sep = '?'; - } - - return $url . $sep . Auth_OpenID::httpBuildQuery($args); + // Append some arguments to an HTTP query. Yes, this is just like + // OpenID's appendArgs, but with special seasoning for XRI + // queries. + + if (count($args) == 0) { + return $url; + } + + // Non-empty array; if it is an array of arrays, use multisort; + // otherwise use sort. + if (array_key_exists(0, $args) && + is_array($args[0])) { + // Do nothing here. + } else { + $keys = array_keys($args); + sort($keys); + $new_args = array(); + foreach ($keys as $key) { + $new_args[] = array($key, $args[$key]); + } + $args = $new_args; + } + + // According to XRI Resolution section "QXRI query parameters": + // + // "If the original QXRI had a null query component (only a + // leading question mark), or a query component consisting of + // only question marks, one additional leading question mark MUST + // be added when adding any XRI resolution parameters." + if (strpos(rtrim($url, '?'), '?') !== false) { + $sep = '&'; + } else { + $sep = '?'; + } + + return $url . $sep . Auth_OpenID::httpBuildQuery($args); } function Services_Yadis_providerIsAuthoritative($providerID, $canonicalID) { - $lastbang = strrpos($canonicalID, '!'); - $p = substr($canonicalID, 0, $lastbang); - return $p == $providerID; + $lastbang = strrpos($canonicalID, '!'); + $p = substr($canonicalID, 0, $lastbang); + return $p == $providerID; } function Services_Yadis_rootAuthority($xri) { - // Return the root authority for an XRI. - - $root = null; - - if (Services_Yadis_startswith($xri, 'xri://')) { - $xri = substr($xri, 6); - } - - $authority = explode('/', $xri, 2); - $authority = $authority[0]; - if ($authority[0] == '(') { - // Cross-reference. - // XXX: This is incorrect if someone nests cross-references so - // there is another close-paren in there. Hopefully nobody - // does that before we have a real xriparse function. - // Hopefully nobody does that *ever*. - $root = substr($authority, 0, strpos($authority, ')') + 1); - } else if (in_array($authority[0], Services_Yadis_getXRIAuthorities())) { - // Other XRI reference. - $root = $authority[0]; - } else { - // IRI reference. - $_segments = explode("!", $authority); - $segments = array(); - foreach ($_segments as $s) { - $segments = array_merge($segments, explode("*", $s)); - } - $root = $segments[0]; - } - - return Services_Yadis_XRI($root); + // Return the root authority for an XRI. + + $root = null; + + if (Services_Yadis_startswith($xri, 'xri://')) { + $xri = substr($xri, 6); + } + + $authority = explode('/', $xri, 2); + $authority = $authority[0]; + if ($authority[0] == '(') { + // Cross-reference. + // XXX: This is incorrect if someone nests cross-references so + // there is another close-paren in there. Hopefully nobody + // does that before we have a real xriparse function. + // Hopefully nobody does that *ever*. + $root = substr($authority, 0, strpos($authority, ')') + 1); + } else if (in_array($authority[0], Services_Yadis_getXRIAuthorities())) { + // Other XRI reference. + $root = $authority[0]; + } else { + // IRI reference. + $_segments = explode("!", $authority); + $segments = array(); + foreach ($_segments as $s) { + $segments = array_merge($segments, explode("*", $s)); + } + $root = $segments[0]; + } + + return Services_Yadis_XRI($root); } function Services_Yadis_XRI($xri) { - if (!Services_Yadis_startswith($xri, 'xri://')) { - $xri = 'xri://' . $xri; - } - return $xri; + if (!Services_Yadis_startswith($xri, 'xri://')) { + $xri = 'xri://' . $xri; + } + return $xri; } function Services_Yadis_getCanonicalID($iname, $xrds) { - // Returns FALSE or a canonical ID value. + // Returns FALSE or a canonical ID value. - // Now nodes are in reverse order. - $xrd_list = array_reverse($xrds->allXrdNodes); - $parser =& $xrds->parser; - $node = $xrd_list[0]; + // Now nodes are in reverse order. + $xrd_list = array_reverse($xrds->allXrdNodes); + $parser =& $xrds->parser; + $node = $xrd_list[0]; - $canonicalID_nodes = $parser->evalXPath('xrd:CanonicalID', $node); + $canonicalID_nodes = $parser->evalXPath('xrd:CanonicalID', $node); - if (!$canonicalID_nodes) { - return false; - } + if (!$canonicalID_nodes) { + return false; + } - $canonicalID = $canonicalID_nodes[count($canonicalID_nodes) - 1]; - $canonicalID = Services_Yadis_XRI($parser->content($canonicalID)); + $canonicalID = $canonicalID_nodes[count($canonicalID_nodes) - 1]; + $canonicalID = Services_Yadis_XRI($parser->content($canonicalID)); - $childID = $canonicalID; + $childID = $canonicalID; - for ($i = 1; $i < count($xrd_list); $i++) { - $xrd = $xrd_list[$i]; + for ($i = 1; $i < count($xrd_list); $i++) { + $xrd = $xrd_list[$i]; - $parent_sought = substr($childID, 0, strrpos($childID, '!')); - $parent_list = array(); + $parent_sought = substr($childID, 0, strrpos($childID, '!')); + $parent_list = array(); - foreach ($parser->evalXPath('xrd:CanonicalID', $xrd) as $c) { - $parent_list[] = Services_Yadis_XRI($parser->content($c)); - } + foreach ($parser->evalXPath('xrd:CanonicalID', $xrd) as $c) { + $parent_list[] = Services_Yadis_XRI($parser->content($c)); + } - if (!in_array($parent_sought, $parent_list)) { - // raise XRDSFraud. - return false; - } + if (!in_array($parent_sought, $parent_list)) { + // raise XRDSFraud. + return false; + } - $childID = $parent_sought; - } + $childID = $parent_sought; + } - $root = Services_Yadis_rootAuthority($iname); - if (!Services_Yadis_providerIsAuthoritative($root, $childID)) { - // raise XRDSFraud. - return false; - } + $root = Services_Yadis_rootAuthority($iname); + if (!Services_Yadis_providerIsAuthoritative($root, $childID)) { + // raise XRDSFraud. + return false; + } - return $canonicalID; -} - -?> \ No newline at end of file + return $canonicalID; +} \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/XRIRes.php b/libraries/openid/Services/Yadis/XRIRes.php index bc8d6085b2da1..b035ab3f5ffd6 100644 --- a/libraries/openid/Services/Yadis/XRIRes.php +++ b/libraries/openid/Services/Yadis/XRIRes.php @@ -6,65 +6,63 @@ require_once 'Services/Yadis/XRI.php'; class Services_Yadis_ProxyResolver { - function Services_Yadis_ProxyResolver(&$fetcher, $proxy_url = null) - { - $this->fetcher =& $fetcher; - $this->proxy_url = $proxy_url; - if (!$this->proxy_url) { - $this->proxy_url = Services_Yadis_getDefaultProxy(); - } - } + function Services_Yadis_ProxyResolver(&$fetcher, $proxy_url = null) + { + $this->fetcher =& $fetcher; + $this->proxy_url = $proxy_url; + if (!$this->proxy_url) { + $this->proxy_url = Services_Yadis_getDefaultProxy(); + } + } - function queryURL($xri, $service_type = null) - { - // trim off the xri:// prefix - $qxri = substr(Services_Yadis_toURINormal($xri), 6); - $hxri = $this->proxy_url . $qxri; - $args = array( - '_xrd_r' => 'application/xrds+xml' - ); + function queryURL($xri, $service_type = null) + { + // trim off the xri:// prefix + $qxri = substr(Services_Yadis_toURINormal($xri), 6); + $hxri = $this->proxy_url . $qxri; + $args = array( + '_xrd_r' => 'application/xrds+xml' + ); - if ($service_type) { - $args['_xrd_t'] = $service_type; - } else { - // Don't perform service endpoint selection. - $args['_xrd_r'] .= ';sep=false'; - } + if ($service_type) { + $args['_xrd_t'] = $service_type; + } else { + // Don't perform service endpoint selection. + $args['_xrd_r'] .= ';sep=false'; + } - $query = Services_Yadis_XRIAppendArgs($hxri, $args); - return $query; - } + $query = Services_Yadis_XRIAppendArgs($hxri, $args); + return $query; + } - function query($xri, $service_types, $filters = array()) - { - $services = array(); - $canonicalID = null; - foreach ($service_types as $service_type) { - $url = $this->queryURL($xri, $service_type); - $response = $this->fetcher->get($url); - if ($response->status != 200) { - continue; - } - $xrds = Services_Yadis_XRDS::parseXRDS($response->body); - if (!$xrds) { - continue; - } - $canonicalID = Services_Yadis_getCanonicalID($xri, - $xrds); + function query($xri, $service_types, $filters = array()) + { + $services = array(); + $canonicalID = null; + foreach ($service_types as $service_type) { + $url = $this->queryURL($xri, $service_type); + $response = $this->fetcher->get($url); + if ($response->status != 200) { + continue; + } + $xrds = Services_Yadis_XRDS::parseXRDS($response->body); + if (!$xrds) { + continue; + } + $canonicalID = Services_Yadis_getCanonicalID($xri, + $xrds); - if ($canonicalID === false) { - return null; - } + if ($canonicalID === false) { + return null; + } - $some_services = $xrds->services($filters); - $services = array_merge($services, $some_services); - // TODO: - // * If we do get hits for multiple service_types, we're - // almost certainly going to have duplicated service - // entries and broken priority ordering. - } - return array($canonicalID, $services); - } -} - -?> \ No newline at end of file + $some_services = $xrds->services($filters); + $services = array_merge($services, $some_services); + // TODO: + // * If we do get hits for multiple service_types, we're + // almost certainly going to have duplicated service + // entries and broken priority ordering. + } + return array($canonicalID, $services); + } +} \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/Yadis.php b/libraries/openid/Services/Yadis/Yadis.php index 8fa8a00974da8..61dd33ca23887 100644 --- a/libraries/openid/Services/Yadis/Yadis.php +++ b/libraries/openid/Services/Yadis/Yadis.php @@ -47,7 +47,7 @@ *
        $http_response = array();
        *  $fetcher = Services_Yadis_Yadis::getHTTPFetcher();
        *  $yadis_object = Services_Yadis_Yadis::discover($uri,
      - *                                    $http_response, $fetcher);
      + * $http_response, $fetcher); * * If the discovery succeeds, $yadis_object will be an instance of * {@link Services_Yadis_Yadis}. If not, it will be null. The XRDS @@ -64,15 +64,15 @@ * write one or more filter functions and pass those to services(): * *
        $service_list = $yadis_object->services(
      - *                               array("filterByURI",
      - *                                     "filterByExtension"));
      + * array("filterByURI", + * "filterByExtension")); * * The filter functions (whose names appear in the array passed to * services()) take the following form: * *
        function myFilter(&$service) {
      - *       // Query $service object here.  Return true if the service
      - *       // matches your query; false if not.
      + *	   // Query $service object here.  Return true if the service
      + *	   // matches your query; false if not.
        *  }
      * * This is an example of a filter which uses a regular expression to @@ -82,13 +82,13 @@ * *
        *  function URIMatcher(&$service) {
      - *      foreach ($service->getElements('xrd:URI') as $uri) {
      - *          if (preg_match("/some_pattern/",
      - *                         $service->parser->content($uri))) {
      - *              return true;
      - *          }
      - *      }
      - *      return false;
      + *	  foreach ($service->getElements('xrd:URI') as $uri) {
      + *		  if (preg_match("/some_pattern/",
      + *						 $service->parser->content($uri))) {
      + *			  return true;
      + *		  }
      + *	  }
      + *	  return false;
        *  }
      * * The filter functions you pass will be called for each service @@ -100,7 +100,7 @@ * the match mode of services(): * *
        $yadis_object->services(array("filter1", "filter2"),
      - *                          SERVICES_YADIS_MATCH_ALL);
      + * SERVICES_YADIS_MATCH_ALL); * * See {@link SERVICES_YADIS_MATCH_ALL} and {@link * SERVICES_YADIS_MATCH_ANY}. @@ -115,201 +115,199 @@ */ class Services_Yadis_Yadis { - /** - * Returns an HTTP fetcher object. If the CURL extension is - * present, an instance of {@link Services_Yadis_ParanoidHTTPFetcher} - * is returned. If not, an instance of - * {@link Services_Yadis_PlainHTTPFetcher} is returned. - */ - function getHTTPFetcher($timeout = 20) - { - if (Services_Yadis_Yadis::curlPresent()) { - $fetcher = new Services_Yadis_ParanoidHTTPFetcher($timeout); - } else { - $fetcher = new Services_Yadis_PlainHTTPFetcher($timeout); - } - return $fetcher; - } + /** + * Returns an HTTP fetcher object. If the CURL extension is + * present, an instance of {@link Services_Yadis_ParanoidHTTPFetcher} + * is returned. If not, an instance of + * {@link Services_Yadis_PlainHTTPFetcher} is returned. + */ + function getHTTPFetcher($timeout = 20) + { + if (Services_Yadis_Yadis::curlPresent()) { + $fetcher = new Services_Yadis_ParanoidHTTPFetcher($timeout); + } else { + $fetcher = new Services_Yadis_PlainHTTPFetcher($timeout); + } + return $fetcher; + } - function curlPresent() - { - return function_exists('curl_init'); - } + function curlPresent() + { + return function_exists('curl_init'); + } - /** - * @access private - */ - function _getHeader($header_list, $names) - { - foreach ($header_list as $name => $value) { - foreach ($names as $n) { - if (strtolower($name) == strtolower($n)) { - return $value; - } - } - } + /** + * @access private + */ + function _getHeader($header_list, $names) + { + foreach ($header_list as $name => $value) { + foreach ($names as $n) { + if (strtolower($name) == strtolower($n)) { + return $value; + } + } + } - return null; - } + return null; + } - /** - * @access private - */ - function _getContentType($content_type_header) - { - if ($content_type_header) { - $parts = explode(";", $content_type_header); - return strtolower($parts[0]); - } - } + /** + * @access private + */ + function _getContentType($content_type_header) + { + if ($content_type_header) { + $parts = explode(";", $content_type_header); + return strtolower($parts[0]); + } + } - /** - * This should be called statically and will build a Yadis - * instance if the discovery process succeeds. This implements - * Yadis discovery as specified in the Yadis specification. - * - * @param string $uri The URI on which to perform Yadis discovery. - * - * @param array $http_response An array reference where the HTTP - * response object will be stored (see {@link - * Services_Yadis_HTTPResponse}. - * - * @param Services_Yadis_HTTPFetcher $fetcher An instance of a - * Services_Yadis_HTTPFetcher subclass. - * - * @param array $extra_ns_map An array which maps namespace names - * to namespace URIs to be used when parsing the Yadis XRDS - * document. - * - * @param integer $timeout An optional fetcher timeout, in seconds. - * - * @return mixed $obj Either null or an instance of - * Services_Yadis_Yadis, depending on whether the discovery - * succeeded. - */ - function discover($uri, &$http_response, &$fetcher, - $extra_ns_map = null, $timeout = 20) - { - if (!$uri) { - return null; - } + /** + * This should be called statically and will build a Yadis + * instance if the discovery process succeeds. This implements + * Yadis discovery as specified in the Yadis specification. + * + * @param string $uri The URI on which to perform Yadis discovery. + * + * @param array $http_response An array reference where the HTTP + * response object will be stored (see {@link + * Services_Yadis_HTTPResponse}. + * + * @param Services_Yadis_HTTPFetcher $fetcher An instance of a + * Services_Yadis_HTTPFetcher subclass. + * + * @param array $extra_ns_map An array which maps namespace names + * to namespace URIs to be used when parsing the Yadis XRDS + * document. + * + * @param integer $timeout An optional fetcher timeout, in seconds. + * + * @return mixed $obj Either null or an instance of + * Services_Yadis_Yadis, depending on whether the discovery + * succeeded. + */ + function discover($uri, &$http_response, &$fetcher, + $extra_ns_map = null, $timeout = 20) + { + if (!$uri) { + return null; + } - $request_uri = $uri; - $headers = array("Accept: application/xrds+xml"); + $request_uri = $uri; + $headers = array("Accept: application/xrds+xml"); - if (!$fetcher) { - $fetcher = Services_Yadis_Yadis::getHTTPFetcher($timeout); - } + if (!$fetcher) { + $fetcher = Services_Yadis_Yadis::getHTTPFetcher($timeout); + } - $response = $fetcher->get($uri, $headers); - $http_response = $response; + $response = $fetcher->get($uri, $headers); + $http_response = $response; - if (!$response) { - return null; - } + if (!$response) { + return null; + } - if ($response->status != 200) { - return null; - } + if ($response->status != 200) { + return null; + } - $xrds_uri = $response->final_url; - $uri = $response->final_url; - $body = $response->body; + $xrds_uri = $response->final_url; + $uri = $response->final_url; + $body = $response->body; - $xrds_header_uri = Services_Yadis_Yadis::_getHeader( - $response->headers, - array('x-xrds-location', - 'x-yadis-location')); + $xrds_header_uri = Services_Yadis_Yadis::_getHeader( + $response->headers, + array('x-xrds-location', + 'x-yadis-location')); - $content_type = Services_Yadis_Yadis::_getHeader($response->headers, - array('content-type')); + $content_type = Services_Yadis_Yadis::_getHeader($response->headers, + array('content-type')); - if ($xrds_header_uri) { - $xrds_uri = $xrds_header_uri; - $response = $fetcher->get($xrds_uri); - $http_response = $response; - if (!$response) { - return null; - } else { - $body = $response->body; - $headers = $response->headers; - $content_type = Services_Yadis_Yadis::_getHeader($headers, - array('content-type')); - } - } + if ($xrds_header_uri) { + $xrds_uri = $xrds_header_uri; + $response = $fetcher->get($xrds_uri); + $http_response = $response; + if (!$response) { + return null; + } else { + $body = $response->body; + $headers = $response->headers; + $content_type = Services_Yadis_Yadis::_getHeader($headers, + array('content-type')); + } + } - if (Services_Yadis_Yadis::_getContentType($content_type) != - 'application/xrds+xml') { - // Treat the body as HTML and look for a META tag. - $parser = new Services_Yadis_ParseHTML(); - $new_uri = $parser->getHTTPEquiv($body); - $xrds_uri = null; - if ($new_uri) { - $response = $fetcher->get($new_uri); - if ($response->status != 200) { - return null; - } - $http_response = $response; - $body = $response->body; - $xrds_uri = $new_uri; - $content_type = Services_Yadis_Yadis::_getHeader( - $response->headers, - array('content-type')); - } - } + if (Services_Yadis_Yadis::_getContentType($content_type) != + 'application/xrds+xml') { + // Treat the body as HTML and look for a META tag. + $parser = new Services_Yadis_ParseHTML(); + $new_uri = $parser->getHTTPEquiv($body); + $xrds_uri = null; + if ($new_uri) { + $response = $fetcher->get($new_uri); + if ($response->status != 200) { + return null; + } + $http_response = $response; + $body = $response->body; + $xrds_uri = $new_uri; + $content_type = Services_Yadis_Yadis::_getHeader( + $response->headers, + array('content-type')); + } + } - $xrds = Services_Yadis_XRDS::parseXRDS($body, $extra_ns_map); + $xrds = Services_Yadis_XRDS::parseXRDS($body, $extra_ns_map); - if ($xrds !== null) { - $y = new Services_Yadis_Yadis(); + if ($xrds !== null) { + $y = new Services_Yadis_Yadis(); - $y->request_uri = $request_uri; - $y->xrds = $xrds; - $y->uri = $uri; - $y->xrds_uri = $xrds_uri; - $y->body = $body; - $y->content_type = $content_type; + $y->request_uri = $request_uri; + $y->xrds = $xrds; + $y->uri = $uri; + $y->xrds_uri = $xrds_uri; + $y->body = $body; + $y->content_type = $content_type; - return $y; - } else { - return null; - } - } + return $y; + } else { + return null; + } + } - /** - * Instantiates an empty Services_Yadis_Yadis object. This - * constructor should not be used by any user of the library. - * This constructor results in a completely useless object which - * must be populated with valid discovery information. Instead of - * using this constructor, call - * Services_Yadis_Yadis::discover($uri). - */ - function Services_Yadis_Yadis() - { - $this->request_uri = null; - $this->uri = null; - $this->xrds = null; - $this->xrds_uri = null; - $this->body = null; - $this->content_type = null; - } + /** + * Instantiates an empty Services_Yadis_Yadis object. This + * constructor should not be used by any user of the library. + * This constructor results in a completely useless object which + * must be populated with valid discovery information. Instead of + * using this constructor, call + * Services_Yadis_Yadis::discover($uri). + */ + function Services_Yadis_Yadis() + { + $this->request_uri = null; + $this->uri = null; + $this->xrds = null; + $this->xrds_uri = null; + $this->body = null; + $this->content_type = null; + } - /** - * Returns the list of service objects as described by the XRDS - * document, if this yadis object represents a successful Yadis - * discovery. - * - * @return array $services An array of {@link Services_Yadis_Service} - * objects - */ - function services() - { - if ($this->xrds) { - return $this->xrds->services(); - } + /** + * Returns the list of service objects as described by the XRDS + * document, if this yadis object represents a successful Yadis + * discovery. + * + * @return array $services An array of {@link Services_Yadis_Service} + * objects + */ + function services() + { + if ($this->xrds) { + return $this->xrds->services(); + } - return null; - } -} - -?> \ No newline at end of file + return null; + } +} \ No newline at end of file diff --git a/libraries/openid/Services/Yadis/index.html b/libraries/openid/Services/Yadis/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/openid/Services/Yadis/index.html +++ b/libraries/openid/Services/Yadis/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/openid/Services/index.html b/libraries/openid/Services/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/openid/Services/index.html +++ b/libraries/openid/Services/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/openid/index.html b/libraries/openid/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/openid/index.html +++ b/libraries/openid/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/pattemplate/index.html b/libraries/pattemplate/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/pattemplate/index.html +++ b/libraries/pattemplate/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/pattemplate/patError.php b/libraries/pattemplate/patError.php index 72a9eb5713362..674cfa3799aa6 100644 --- a/libraries/pattemplate/patError.php +++ b/libraries/pattemplate/patError.php @@ -129,10 +129,10 @@ class patError * @param string $info Optional: The additional error information. * @see __construct() */ - function patError( $level, $code, $msg, $info = null ) - { + function patError( $level, $code, $msg, $info = null ) + { $this->__construct( $level, $code, $msg, $info ); - } + } /** * constructor - used to set up the error with all needed error details. @@ -144,8 +144,8 @@ function patError( $level, $code, $msg, $info = null ) * @param string $info Optional: The additional error information. * @todo all calls to patErrorManager::raise* should not be included in backtrace */ - function __construct( $level, $code, $msg, $info = null ) - { + function __construct( $level, $code, $msg, $info = null ) + { static $raise = array( 'raise', 'raiseerror', 'raisewarning', @@ -190,7 +190,7 @@ function __construct( $level, $code, $msg, $info = null ) } } } - } + } /** * returns the error level of the error - corresponds to the PHP @@ -200,10 +200,10 @@ function __construct( $level, $code, $msg, $info = null ) * @return int $level The error level * @see $level */ - function getLevel() - { - return $this->level; - } + function getLevel() + { + return $this->level; + } /** @@ -213,10 +213,10 @@ function getLevel() * @return string $msg The stored error message * @see $message */ - function getMessage() - { + function getMessage() + { return $this->message; - } + } /** * retrieves the additional error information (information usually @@ -226,10 +226,10 @@ function getMessage() * @return mixed $info The additional information * @see $info */ - function getInfo() - { + function getInfo() + { return $this->info; - } + } /** * recieve error code @@ -238,10 +238,10 @@ function getInfo() * @return string|integer error code (may be a string or an integer) * @see $code */ - function getCode() - { + function getCode() + { return $this->code; - } + } /** * get the backtrace @@ -252,19 +252,19 @@ function getCode() * @return array backtrace * @see $backtrace */ - function getBacktrace( $formatted=false ) - { - if ($formatted && is_array( $this->backtrace )) { - $result = ''; - foreach( debug_backtrace() as $back) { - if (!eregi( 'patErrorManager.php', $back['file'])) { - $result .= '
      '.$back['file'].':'.$back['line']; + function getBacktrace( $formatted=false ) + { + if ($formatted && is_array( $this->backtrace )) { + $result = ''; + foreach( debug_backtrace() as $back) { + if (!eregi( 'patErrorManager.php', $back['file'])) { + $result .= '
      '.$back['file'].':'.$back['line']; } } return $result; } return $this->backtrace; - } + } /** * get the filename in which the error occured @@ -275,10 +275,10 @@ function getBacktrace( $formatted=false ) * @return string filename * @see $file */ - function getFile() - { + function getFile() + { return $this->file; - } + } /** * get the line number in which the error occured @@ -289,9 +289,9 @@ function getFile() * @return integer line number * @see $line */ - function getLine() - { + function getLine() + { return $this->line; - } + } } ?> \ No newline at end of file diff --git a/libraries/pattemplate/patErrorManager.php b/libraries/pattemplate/patErrorManager.php index 6bfa1665b1ac6..6f19fc247acdb 100644 --- a/libraries/pattemplate/patErrorManager.php +++ b/libraries/pattemplate/patErrorManager.php @@ -89,8 +89,8 @@ class patErrorManager * @param mixed &$object * @return boolean $result True if argument is a patError-object, false otherwise. */ - function isError( &$object ) - { + function isError( &$object ) + { if( !is_object( $object ) ) { return false; @@ -103,8 +103,8 @@ function isError( &$object ) return false; } - return true; - } + return true; + } /** * wrapper for the {@link raise()} method where you do not have to specify the @@ -173,8 +173,8 @@ function &raiseNotice( $code, $msg, $info = null ) * @todo implement 'simple' mode that returns just false (BC for patConfiguration) * @todo either remove HTML tags and entities from output or test for enviroment!!! in shell is ugly! */ - function &raise( $level, $code, $msg, $info = null ) - { + function &raise( $level, $code, $msg, $info = null ) + { // ignore this error? if( in_array( $code, $GLOBALS['_pat_errorIgnores'] ) ) { @@ -216,7 +216,7 @@ function &raise( $level, $code, $msg, $info = null ) '
      ' . $error->getMessage() ); } - } + } /** * register a new error level @@ -277,8 +277,8 @@ function registerErrorLevel( $level, $name ) * @return mixed $result True on success, or a patError object if failed. * @see getErrorHandling() */ - function setErrorHandling( $level, $mode, $options = null ) - { + function setErrorHandling( $level, $mode, $options = null ) + { $levels = $GLOBALS['_pat_errorLevels']; $function = 'handleError' . ucfirst( $mode ); @@ -339,8 +339,8 @@ function setErrorHandling( $level, $mode, $options = null ) } } - return true; - } + return true; + } /** * retrieves the current error handling settings for the specified error level. @@ -349,10 +349,10 @@ function setErrorHandling( $level, $mode, $options = null ) * @param int $level The error level to retrieve. This can be any of PHP's own error levels, e.g. E_ALL, E_NOTICE... * @return array $handling All error handling details */ - function getErrorHandling( $level ) - { + function getErrorHandling( $level ) + { return $GLOBALS['_pat_errorHandling'][$level]; - } + } /** * translate an error level @@ -384,8 +384,8 @@ function translateErrorLevel( $level ) * @param string $name classname * @return boolean $result true on success */ - function setErrorClass( $name ) - { + function setErrorClass( $name ) + { // include old error-class if( $name !== $GLOBALS['_pat_errorClass'] && !class_exists( $GLOBALS['_pat_errorClass'] ) ) { @@ -394,7 +394,7 @@ function setErrorClass( $name ) $GLOBALS['_pat_errorClass'] = $name; return true; - } + } /** * add error codes to be ingored @@ -404,8 +404,8 @@ function setErrorClass( $name ) * @param mixed $codes either an array of error code or a single code that will be ignored in future * @return boolean $result true on success */ - function addIgnore( $codes ) - { + function addIgnore( $codes ) + { if( !is_array( $codes ) ) { $codes = array( $codes ); @@ -415,7 +415,7 @@ function addIgnore( $codes ) $GLOBALS['_pat_errorIgnores'] = array_unique( $codes ); return true; - } + } /** * removeIgnore @@ -425,8 +425,8 @@ function addIgnore( $codes ) * @access public * @return boolean $result true on success */ - function removeIgnore( $codes ) - { + function removeIgnore( $codes ) + { if( !is_array( $codes ) ) { $codes = array( $codes ); @@ -447,7 +447,7 @@ function removeIgnore( $codes ) $GLOBALS['_pat_errorIgnores'] = array_values( $GLOBALS['_pat_errorIgnores'] ); return true; - } + } /** * recieve all registerd error codes that will be ignored @@ -456,10 +456,10 @@ function removeIgnore( $codes ) * @access public * @return array $codes list of error codes */ - function getIgnore() - { + function getIgnore() + { return $GLOBALS['_pat_errorIgnores']; - } + } /** * empty list of errors to be ignored @@ -468,11 +468,11 @@ function getIgnore() * @access public * @return boolean $result true on success */ - function clearIgnore() - { + function clearIgnore() + { $GLOBALS['_pat_errorIgnores'] = array(); return true; - } + } /** * add expected errors to stack @@ -482,8 +482,8 @@ function clearIgnore() * @param mixed $codes either an array of error code or a single code that will be ignored in future * @return boolean $result true on success */ - function pushExpect( $codes ) - { + function pushExpect( $codes ) + { if( !is_array( $codes ) ) { $codes = array( $codes ); @@ -492,7 +492,7 @@ function pushExpect( $codes ) array_push( $GLOBALS['_pat_errorExpects'], $codes ); return true; - } + } /** * remove top of error-codes from stack @@ -501,8 +501,8 @@ function pushExpect( $codes ) * @access public * @return boolean $result true on success */ - function popExpect() - { + function popExpect() + { if( empty( $GLOBALS['_pat_errorExpects'] ) ) { return false; @@ -510,7 +510,7 @@ function popExpect() array_pop( $GLOBALS['_pat_errorExpects'] ); return true; - } + } /** * recieve all registerd error codes that will be ignored @@ -519,10 +519,10 @@ function popExpect() * @access public * @return array $codes list of error codes */ - function getExpect() - { + function getExpect() + { return $GLOBALS['_pat_errorExpects']; - } + } /** * empty list of errors to be ignored @@ -531,11 +531,11 @@ function getExpect() * @access public * @return boolean $result true on success */ - function clearExpect() - { + function clearExpect() + { $GLOBALS['_pat_errorExpects'] = array(); return true; - } + } /** * handleError: Ignore @@ -547,10 +547,10 @@ function clearExpect() * @return object $error error-object * @see raise() */ - function &handleErrorIgnore( &$error, $options ) - { + function &handleErrorIgnore( &$error, $options ) + { return $error; - } + } /** * handleError: Echo @@ -562,8 +562,8 @@ function &handleErrorIgnore( &$error, $options ) * @return object $error error-object * @see raise() */ - function &handleErrorEcho( &$error, $options ) - { + function &handleErrorEcho( &$error, $options ) + { $level_human = patErrorManager::translateErrorLevel( $error->getLevel() ); if( isset( $_SERVER['HTTP_HOST'] ) ) @@ -584,7 +584,7 @@ function &handleErrorEcho( &$error, $options ) } } return $error; - } + } /** * handleError: Verbose @@ -596,8 +596,8 @@ function &handleErrorEcho( &$error, $options ) * @return object $error error-object * @see raise() */ - function &handleErrorVerbose( &$error, $options ) - { + function &handleErrorVerbose( &$error, $options ) + { $level_human = patErrorManager::translateErrorLevel( $error->getLevel() ); $info = $error->getInfo(); @@ -617,12 +617,12 @@ function &handleErrorVerbose( &$error, $options ) echo "pat-$level_human: " . $error->getMessage() . "\n"; if( $info != null ) { - echo " " . $error->getInfo() . "\n"; + echo " " . $error->getInfo() . "\n"; } } return $error; - } + } /** * handleError: die @@ -634,8 +634,8 @@ function &handleErrorVerbose( &$error, $options ) * @return object $error error-object * @see raise() */ - function &handleErrorDie( &$error, $options ) - { + function &handleErrorDie( &$error, $options ) + { $level_human = patErrorManager::translateErrorLevel( $error->getLevel() ); if( isset( $_SERVER['HTTP_HOST'] ) ) @@ -656,7 +656,7 @@ function &handleErrorDie( &$error, $options ) } } return $error; - } + } /** * handleError: trigger @@ -668,8 +668,8 @@ function &handleErrorDie( &$error, $options ) * @return object $error error-object * @see raise() */ - function &handleErrorTrigger( &$error, $options ) - { + function &handleErrorTrigger( &$error, $options ) + { switch( $error->getLevel() ) { case E_NOTICE: @@ -688,7 +688,7 @@ function &handleErrorTrigger( &$error, $options ) trigger_error( $error->getMessage(), $level ); return $error; - } + } /** * handleError: callback @@ -700,11 +700,11 @@ function &handleErrorTrigger( &$error, $options ) * @return object $error error-object * @see raise() */ - function &handleErrorCallback( &$error, $options ) - { + function &handleErrorCallback( &$error, $options ) + { $opt = $options['options']; $result = &call_user_func( $opt, $error ); return $result; - } + } } ?> \ No newline at end of file diff --git a/libraries/pattemplate/patTemplate.php b/libraries/pattemplate/patTemplate.php index b5c99f008d60c..775cae5fc3a75 100644 --- a/libraries/pattemplate/patTemplate.php +++ b/libraries/pattemplate/patTemplate.php @@ -1946,11 +1946,11 @@ function _fetchTemplate( $template ) } } if ($value !== null) { - if ($var[2] === null) { - continue; - } else { - // Joomla! addition 23-June-2005 - // value wrapped in ## uses regex for comparison + if ($var[2] === null) { + continue; + } else { + // Joomla! addition 23-June-2005 + // value wrapped in ## uses regex for comparison $condition = $var[2]; if (substr( $condition, 0, 1 ) == '#' && substr( $condition, -1, 1 ) == '#' ) { if (preg_match( $condition, $value )) { @@ -1959,13 +1959,13 @@ function _fetchTemplate( $template ) } else if ($condition == $value) { continue; } - /* Pat Original - if ($var[2] == $value) { - continue; - } - */ - } - } + /* Pat Original + if ($var[2] == $value) { + continue; + } + */ + } + } $this->_templates[$template]['work'] = ''; $this->_templates[$template]['currentDependencies'] = array(); diff --git a/libraries/pattemplate/patTemplate/Dump/index.html b/libraries/pattemplate/patTemplate/Dump/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pattemplate/patTemplate/Dump/index.html +++ b/libraries/pattemplate/patTemplate/Dump/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pattemplate/patTemplate/Function/Img.php b/libraries/pattemplate/patTemplate/Function/Img.php index 03abaee5aeda9..f821a250b5fb1 100644 --- a/libraries/pattemplate/patTemplate/Function/Img.php +++ b/libraries/pattemplate/patTemplate/Function/Img.php @@ -55,7 +55,7 @@ function call ($params, $content) $this->_defaults= array( 'border' => 0, 'title' => '', - 'alt' => '', + 'alt' => '', 'width' => $width, 'height' => $height ); diff --git a/libraries/pattemplate/patTemplate/Function/index.html b/libraries/pattemplate/patTemplate/Function/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pattemplate/patTemplate/Function/index.html +++ b/libraries/pattemplate/patTemplate/Function/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pattemplate/patTemplate/InputFilter/ShortModifiers.php b/libraries/pattemplate/patTemplate/InputFilter/ShortModifiers.php index 030898b960c6e..86386994f66c2 100644 --- a/libraries/pattemplate/patTemplate/InputFilter/ShortModifiers.php +++ b/libraries/pattemplate/patTemplate/InputFilter/ShortModifiers.php @@ -32,7 +32,7 @@ class patTemplate_InputFilter_ShortModifiers extends patTemplate_InputFilter * filter name * * @access private - * @var string + * @var string */ var $_name = 'ShortModifiers'; @@ -40,7 +40,7 @@ class patTemplate_InputFilter_ShortModifiers extends patTemplate_InputFilter * parameters of the filter * * @access private - * @var array + * @var array */ var $_params = array( 'copyVars' => true @@ -50,7 +50,7 @@ class patTemplate_InputFilter_ShortModifiers extends patTemplate_InputFilter * namespace * * @access private - * @var string + * @var string */ var $_ns = null; @@ -66,7 +66,7 @@ class patTemplate_InputFilter_ShortModifiers extends patTemplate_InputFilter * set the template reference * * @access public - * @param object patTemplate + * @param object patTemplate */ function setTemplateReference(&$tmpl) { @@ -77,7 +77,7 @@ function setTemplateReference(&$tmpl) * generate the tag * * @access public - * @param array matches from preg_replace + * @param array matches from preg_replace * @return string tag */ function _generateReplace($matches) diff --git a/libraries/pattemplate/patTemplate/InputFilter/index.html b/libraries/pattemplate/patTemplate/InputFilter/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pattemplate/patTemplate/InputFilter/index.html +++ b/libraries/pattemplate/patTemplate/InputFilter/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pattemplate/patTemplate/Modifier/HTML/Img.php b/libraries/pattemplate/patTemplate/Modifier/HTML/Img.php index 6fe8057f90914..9cad1687493a5 100644 --- a/libraries/pattemplate/patTemplate/Modifier/HTML/Img.php +++ b/libraries/pattemplate/patTemplate/Modifier/HTML/Img.php @@ -37,7 +37,7 @@ class patTemplate_Modifier_HTML_Img extends patTemplate_Modifier function modify( $value, $params = array() ) { $size = getimagesize( $value ); - $params['src'] = $value; + $params['src'] = $value; $params['width'] = $size[0]; $params['height'] = $size[1]; return 'arrayToAttributes($params).' />'; diff --git a/libraries/pattemplate/patTemplate/Modifier/HTML/index.html b/libraries/pattemplate/patTemplate/Modifier/HTML/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pattemplate/patTemplate/Modifier/HTML/index.html +++ b/libraries/pattemplate/patTemplate/Modifier/HTML/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pattemplate/patTemplate/Modifier/Numberformat.php b/libraries/pattemplate/patTemplate/Modifier/Numberformat.php index a4c1be79bcf4b..1288f91402332 100644 --- a/libraries/pattemplate/patTemplate/Modifier/Numberformat.php +++ b/libraries/pattemplate/patTemplate/Modifier/Numberformat.php @@ -32,11 +32,11 @@ */ class patTemplate_Modifier_Numberformat extends patTemplate_Modifier { - var $defaults = array( - 'decimals' => 2, - 'point' => '.', - 'separator' => ',' - ); + var $defaults = array( + 'decimals' => 2, + 'point' => '.', + 'separator' => ',' + ); /** * modify the value * @@ -46,8 +46,8 @@ class patTemplate_Modifier_Numberformat extends patTemplate_Modifier */ function modify($value, $params = array()) { - $params = array_merge($this->defaults, $params); - return @number_format($value, $params['decimals'], $params['point'], $params['separator']); + $params = array_merge($this->defaults, $params); + return @number_format($value, $params['decimals'], $params['point'], $params['separator']); } } ?> diff --git a/libraries/pattemplate/patTemplate/Modifier/Truncate.php b/libraries/pattemplate/patTemplate/Modifier/Truncate.php index 6f4a45d9476d1..80ab9298bb0a0 100644 --- a/libraries/pattemplate/patTemplate/Modifier/Truncate.php +++ b/libraries/pattemplate/patTemplate/Modifier/Truncate.php @@ -5,9 +5,9 @@ * Truncate a string variable to fixed length and add a suffix if it was truncated. * It can also start from an offset and add a prefix. * - * @package patTemplate + * @package patTemplate * @subpackage Modifiers - * @author Rafa Couto + * @author Rafa Couto */ // Check to ensure this file is within the rest of the framework @@ -25,9 +25,9 @@ * - start * - prefix (string) * - * @package patTemplate + * @package patTemplate * @subpackage Modifiers - * @author Rafa Couto + * @author Rafa Couto */ class patTemplate_Modifier_Truncate extends patTemplate_Modifier { @@ -36,8 +36,8 @@ class patTemplate_Modifier_Truncate extends patTemplate_Modifier * modify the value * * @access public - * @param string value - * @return string modified value + * @param string value + * @return string modified value */ function modify($value, $params = array()) { @@ -47,12 +47,12 @@ function modify($value, $params = array()) } settype($params['length'], 'integer'); - $decode = isset( $params['htmlsafe'] ); + $decode = isset( $params['htmlsafe'] ); if (function_exists( 'html_entity_decode' ) && $decode) { - $value = html_entity_decode( $value ); - } + $value = html_entity_decode( $value ); + } - // start + // start if (isset($params['start'])) { settype( $params['start'], 'integer' ); } else { @@ -80,9 +80,9 @@ function modify($value, $params = array()) $suffix = ''; } - $value = $prefix.$value.$suffix; + $value = $prefix.$value.$suffix; - return $decode ? htmlspecialchars( $value, ENT_QUOTES ) : $value; + return $decode ? htmlspecialchars( $value, ENT_QUOTES ) : $value; } } ?> diff --git a/libraries/pattemplate/patTemplate/Modifier/index.html b/libraries/pattemplate/patTemplate/Modifier/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pattemplate/patTemplate/Modifier/index.html +++ b/libraries/pattemplate/patTemplate/Modifier/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pattemplate/patTemplate/OutputFilter/Gzip.php b/libraries/pattemplate/patTemplate/OutputFilter/Gzip.php index bbb1b71dadd62..872627ce3be51 100644 --- a/libraries/pattemplate/patTemplate/OutputFilter/Gzip.php +++ b/libraries/pattemplate/patTemplate/OutputFilter/Gzip.php @@ -89,9 +89,9 @@ function _clientSupportsGzip() /** * get value as hex-string * - * @access public - * @param integer $value value to convert - * @return string $string converted string + * @access public + * @param integer $value value to convert + * @return string $string converted string */ function _gfc( $value ) { diff --git a/libraries/pattemplate/patTemplate/OutputFilter/index.html b/libraries/pattemplate/patTemplate/OutputFilter/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pattemplate/patTemplate/OutputFilter/index.html +++ b/libraries/pattemplate/patTemplate/OutputFilter/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pattemplate/patTemplate/Reader/DB.php b/libraries/pattemplate/patTemplate/Reader/DB.php index 9f1d59e32c9e0..e0d152f54ef29 100644 --- a/libraries/pattemplate/patTemplate/Reader/DB.php +++ b/libraries/pattemplate/patTemplate/Reader/DB.php @@ -78,7 +78,7 @@ function readTemplates($input) * fetch the template data from the database * * @access protected - * @param string input to read from + * @param string input to read from */ function getDataFromDb($input) { diff --git a/libraries/pattemplate/patTemplate/Reader/index.html b/libraries/pattemplate/patTemplate/Reader/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pattemplate/patTemplate/Reader/index.html +++ b/libraries/pattemplate/patTemplate/Reader/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pattemplate/patTemplate/Stat/index.html b/libraries/pattemplate/patTemplate/Stat/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pattemplate/patTemplate/Stat/index.html +++ b/libraries/pattemplate/patTemplate/Stat/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pattemplate/patTemplate/TemplateCache/index.html b/libraries/pattemplate/patTemplate/TemplateCache/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pattemplate/patTemplate/TemplateCache/index.html +++ b/libraries/pattemplate/patTemplate/TemplateCache/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pattemplate/patTemplate/index.html b/libraries/pattemplate/patTemplate/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pattemplate/patTemplate/index.html +++ b/libraries/pattemplate/patTemplate/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pear/archive_tar/index.html b/libraries/pear/archive_tar/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pear/archive_tar/index.html +++ b/libraries/pear/archive_tar/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/pear/index.html b/libraries/pear/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/pear/index.html +++ b/libraries/pear/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/phpgacl/gacl.php b/libraries/phpgacl/gacl.php index fe99506499c8e..08696cc7a3535 100644 --- a/libraries/phpgacl/gacl.php +++ b/libraries/phpgacl/gacl.php @@ -130,6 +130,10 @@ function gacl($options = NULL) { //If your using ADODB v3.5+ feel free to comment out the following line if its giving you problems. //$ADODB_FETCH_MODE = ADODB_FETCH_NUM; + if(!is_object($this->_db)) { + $this->_db = &JFactory::getDBO(); + } + if (is_object($this->_db)) { $this->db = &$this->_db; } else { @@ -140,7 +144,7 @@ function gacl($options = NULL) { $this->db->SetFetchMode(ADODB_FETCH_NUM); $this->db->PConnect($this->_db_host, $this->_db_user, $this->_db_password, $this->_db_name); } - $this->db->debug = $this->_debug; + if ( $this->_caching == TRUE ) { if (!class_exists('Hashed_Cache_Lite')) { @@ -306,7 +310,7 @@ function acl_query($aco_section_value, $aco_value, $aro_section_value, $aro_valu $sql_aro_group_ids = implode(',', $aro_group_ids); } - if ($axo_section_value != '' AND $axo_value != '') { + if ($axo_section_value !== '' AND $axo_value !== '') { $axo_group_ids = $this->acl_get_groups($axo_section_value, $axo_value, $root_axo_group, 'AXO'); if (is_array($axo_group_ids) AND !empty($axo_group_ids)) { diff --git a/libraries/phpgacl/gacl_api.php b/libraries/phpgacl/gacl_api.php index 55d8f48b3ac4d..b3db938922dfd 100644 --- a/libraries/phpgacl/gacl_api.php +++ b/libraries/phpgacl/gacl_api.php @@ -235,7 +235,7 @@ function consolidated_edit_acl($aco_section_value, $aco_value, $aro_section_valu $this->debug_text("add_consolidated_acl(): Didn't find any current ACLs with a single ACO. "); } //unset($acl_ids); - $acl_ids = array(); + $acl_ids = array(); unset($acl_ids_count); //At this point there should be no conflicting ACLs, searching for an existing ACL with the new values. @@ -940,7 +940,7 @@ function is_conflicting_acl($aco_array, $aro_array, $aro_group_ids=NULL, $axo_ar * @param int ACL ID # Specific Request */ - function add_acl($aco_array, $aro_array, $aro_group_ids=NULL, $axo_array=NULL, $axo_group_ids=NULL, $allow=1, $enabled=1, $return_value=NULL, $note=NULL, $section_value=NULL, $acl_id=FALSE ) { + function add_acl($aco_array, $aro_array, $aro_group_ids=NULL, $axo_array=NULL, $axo_group_ids=NULL, $allow=1, $enabled=1, $return_value=NULL, $note=NULL, $section_value=NULL, $acl_id=FALSE, $aclType = 1 ) { $this->debug_text("add_acl():"); @@ -1024,7 +1024,7 @@ function add_acl($aco_array, $aro_array, $aro_group_ids=NULL, $axo_array=NULL, $ //the transaction will fail. $this->db->BeginTrans(); - $query = 'INSERT INTO '.$this->_db_table_prefix."acl (id,section_value,allow,enabled,return_value,note,updated_date) VALUES($acl_id,".$this->db->quote($section_value).",$allow,$enabled,".$this->db->quote($return_value).','.$this->db->quote($note).','.time().')'; + $query = 'INSERT INTO '.$this->_db_table_prefix."acl (id,section_value,allow,enabled,return_value,note,updated_date,acl_type) VALUES($acl_id,".$this->db->quote($section_value).",$allow,$enabled,".$this->db->quote($return_value).','.$this->db->quote($note).','.time().','.(int)$aclType.')'; $result = $this->db->Execute($query); // Joomla/MySQL @@ -1040,12 +1040,13 @@ function add_acl($aco_array, $aro_array, $aro_group_ids=NULL, $axo_array=NULL, $ //Update ACL row, and remove all mappings so they can be re-inserted. $query = ' UPDATE '. $this->_db_table_prefix .'acl - SET ' . $section_sql . ' + SET ' . $section_sql . ' allow='. (int) $allow .', enabled='. (int) $enabled .', return_value='. $this->db->quote($return_value) .', note='. $this->db->quote($note) .', - updated_date='. time() .' + updated_date='. time() .', + acl_type='. (int) $aclType .' WHERE id='. (int) $acl_id; $result = $this->db->Execute($query); @@ -1453,13 +1454,13 @@ function get_group_id($value = NULL, $name = NULL, $group_type = 'ARO') { $name = trim($name); $value = trim($value); - if (empty($name) AND empty($value) ) { + if (empty($name) AND $value === '') { $this->debug_text("get_group_id(): name and value, at least one is required"); return false; } $query = 'SELECT id FROM '. $table .' WHERE '; - if ( !empty($value) ) { + if ($value !== '') { $query .= ' value='. $this->db->quote($value); } else { $query .= ' name='. $this->db->quote($name); @@ -1961,7 +1962,7 @@ function add_group_object($group_id, $object_section_value, $object_value, $grou $object_section_value = trim($object_section_value); $object_value = trim($object_value); - if (empty($group_id) OR empty($object_value) OR empty($object_section_value)) { + if (empty($group_id) OR $object_value === '' OR $object_section_value === '') { $this->debug_text("add_group_object(): Group ID: ($group_id) OR Value ($object_value) OR Section value ($object_section_value) is empty, this is required"); return false; } @@ -2049,7 +2050,7 @@ function del_group_object($group_id, $object_section_value, $object_value, $grou $object_section_value = trim($object_section_value); $object_value = trim($object_value); - if (empty($group_id) OR empty($object_value) OR empty($object_section_value)) { + if (empty($group_id) OR $object_value === '' OR $object_section_value === '') { $this->debug_text("del_group_object(): Group ID: ($group_id) OR Section value: $object_section_value OR Value ($object_value) is empty, this is required"); return false; } @@ -2163,7 +2164,7 @@ function edit_group($group_id, $value=NULL, $name=NULL, $parent_id=NULL, $group_ } // update value if it is specified. - if (!empty($value)) { + if ($value !== '' OR $value !== null) { $set[] = 'value='. $this->db->quote($value); } @@ -2840,7 +2841,7 @@ function get_object_id($section_value, $value, $object_type=NULL) { $section_value = trim($section_value); $value = trim($value); - if (empty($section_value) AND empty($value) ) { + if (empty($section_value) AND $value === '') { $this->debug_text("get_object_id(): Section Value ($value) AND value ($value) is empty, this is required"); return false; } @@ -2983,15 +2984,15 @@ function get_object_groups($object_id, $object_type = 'ARO', $option = 'NO_RECUR } if (strtoupper($option) == 'RECURSE') { - $query = ' + $query = ' SELECT DISTINCT g.id AS group_id FROM '. $map_table .' gm LEFT JOIN '. $group_table .' g1 ON g1.id=gm.group_id LEFT JOIN '. $group_table .' g ON g.lft<=g1.lft AND g.rgt>=g1.rgt'; } else { - $query = ' - SELECT gm.group_id - FROM '. $map_table .' gm'; + $query = ' + SELECT gm.group_id + FROM '. $map_table .' gm'; } $query .= ' @@ -3113,6 +3114,9 @@ function add_object($section_value, $name, $value=0, $order=0, $hidden=0, $objec return false; } + // Joomla/MySQL + $insert_id = $this->db->insertid(); + $this->debug_text("add_object(): Added object as ID: $insert_id"); return $insert_id; } @@ -3176,7 +3180,7 @@ function edit_object($object_id, $section_value, $name, $value=0, $order=0, $hid return false; } - $this->db->BeginTrans(); + $this->db->BeginTrans(); //Get old value incase it changed, before we do the update. $query = 'SELECT value, section_value FROM '. $table .' WHERE id='. $object_id; @@ -3220,7 +3224,7 @@ function edit_object($object_id, $section_value, $name, $value=0, $order=0, $hid $this->debug_text ('edit_object(): Modified Map Value: '. $value .' Section Value: '. $section_value); } - $this->db->CommitTrans(); + $this->db->CommitTrans(); return TRUE; } @@ -3342,7 +3346,7 @@ function del_object($object_id, $object_type=NULL, $erase=FALSE) { // In these cases the acl MUST NOT be deleted // Get rid of $object_id map referencing erased objects - $query = "DELETE FROM $object_map_table WHERE section_value=$section_value AND value=$value"; + $query = "DELETE FROM $object_map_table WHERE section_value=$section_value AND value=$value"; $this->db->Execute($query); if (!is_object($rs)) { @@ -3474,7 +3478,7 @@ function get_object_section_section_id($name = NULL, $value = NULL, $object_type $name = trim($name); $value = trim($value); - if (empty($name) AND empty($value) ) { + if (empty($name) AND $value === '') { $this->debug_text('get_object_section_section_id(): Both Name ('. $name .') and Value ('. $value .') are empty, you must specify at least one.'); return FALSE; } @@ -3483,7 +3487,7 @@ function get_object_section_section_id($name = NULL, $value = NULL, $object_type $where = ' WHERE '; // limit by value if specified - if (!empty($value)) { + if ($value !== '') { $query .= $where .'value='. $this->db->quote($value); $where = ' AND '; } @@ -3725,7 +3729,7 @@ function edit_object_section($object_section_id, $name, $value=0, $order=0, $hid } } - $this->db->CommitTrans(); + $this->db->CommitTrans(); return true; } } @@ -3893,43 +3897,43 @@ function get_section_data($section_value, $object_type=NULL) { * @return bool Returns TRUE if successful, FALSE otherwise * */ - function clear_database() - { - $tablesToClear = array( - $this->_db_table_prefix.'acl', - $this->_db_table_prefix.'aco', - $this->_db_table_prefix.'aco_map', - $this->_db_table_prefix.'aco_sections', - $this->_db_table_prefix.'aro', - $this->_db_table_prefix.'aro_groups', - $this->_db_table_prefix.'aro_groups_map', - $this->_db_table_prefix.'aro_map', - $this->_db_table_prefix.'aro_sections', - $this->_db_table_prefix.'axo', - $this->_db_table_prefix.'axo_groups', - $this->_db_table_prefix.'axo_groups_map', - $this->_db_table_prefix.'axo_map', - $this->_db_table_prefix.'axo_sections', - $this->_db_table_prefix.'groups_aro_map', - $this->_db_table_prefix.'groups_axo_map' - ); - - // Get all the table names and loop - $tableNames = $this->db->MetaTables('TABLES'); - $query = array(); - foreach ($tableNames as $key => $value){ - if (in_array($value, $tablesToClear) ) { - $query[] = 'TRUNCATE TABLE '.$value.';'; - } - } - - // Loop the queries and return. - foreach ($query as $key => $value){ - $result = $this->db->Execute($value); - } + function clear_database() + { + $tablesToClear = array( + $this->_db_table_prefix.'acl', + $this->_db_table_prefix.'aco', + $this->_db_table_prefix.'aco_map', + $this->_db_table_prefix.'aco_sections', + $this->_db_table_prefix.'aro', + $this->_db_table_prefix.'aro_groups', + $this->_db_table_prefix.'aro_groups_map', + $this->_db_table_prefix.'aro_map', + $this->_db_table_prefix.'aro_sections', + $this->_db_table_prefix.'axo', + $this->_db_table_prefix.'axo_groups', + $this->_db_table_prefix.'axo_groups_map', + $this->_db_table_prefix.'axo_map', + $this->_db_table_prefix.'axo_sections', + $this->_db_table_prefix.'groups_aro_map', + $this->_db_table_prefix.'groups_axo_map' + ); + + // Get all the table names and loop + $tableNames = $this->db->MetaTables('TABLES'); + $query = array(); + foreach ($tableNames as $key => $value){ + if (in_array($value, $tablesToClear) ) { + $query[] = 'TRUNCATE TABLE '.$value.';'; + } + } + + // Loop the queries and return. + foreach ($query as $key => $value){ + $result = $this->db->Execute($value); + } return TRUE; - } + } /** * Calculates the start number for a sequence table diff --git a/libraries/phpgacl/index.html b/libraries/phpgacl/index.html index 0e44bd0ebe788..6bfc7988e1279 100644 --- a/libraries/phpgacl/index.html +++ b/libraries/phpgacl/index.html @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/libraries/phpinputfilter/index.html b/libraries/phpinputfilter/index.html deleted file mode 100644 index 0e44bd0ebe788..0000000000000 --- a/libraries/phpinputfilter/index.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/libraries/phpinputfilter/inputfilter.php b/libraries/phpinputfilter/inputfilter.php deleted file mode 100644 index bf85a75269076..0000000000000 --- a/libraries/phpinputfilter/inputfilter.php +++ /dev/null @@ -1,551 +0,0 @@ -tagsArray = $tagsArray; - $this->attrArray = $attrArray; - $this->tagsMethod = $tagsMethod; - $this->attrMethod = $attrMethod; - $this->xssAuto = $xssAuto; - } - - /** - * Method to be called by another php script. Processes for XSS and - * specified bad code. - * - * @access public - * @param mixed $source Input string/array-of-string to be 'cleaned' - * @return mixed $source 'cleaned' version of input parameter - */ - function process($source) - { - /* - * Are we dealing with an array? - */ - if (is_array($source)) - { - foreach ($source as $key => $value) - { - // filter element for XSS and other 'bad' code etc. - if (is_string($value)) - { - $source[$key] = $this->remove($this->decode($value)); - } - } - return $source; - } else - /* - * Or a string? - */ - if (is_string($source) && !empty ($source)) - { - // filter source for XSS and other 'bad' code etc. - return $this->remove($this->decode($source)); - } else - { - /* - * Not an array or string.. return the passed parameter - */ - return $source; - } - } - - /** - * Internal method to iteratively remove all unwanted tags and attributes - * - * @access protected - * @param string $source Input string to be 'cleaned' - * @return string $source 'cleaned' version of input parameter - */ - function remove($source) - { - $loopCounter = 0; - /* - * Iteration provides nested tag protection - */ - while ($source != $this->filterTags($source)) - { - $source = $this->filterTags($source); - $loopCounter ++; - } - return $source; - } - - /** - * Internal method to strip a string of certain tags - * - * @access protected - * @param string $source Input string to be 'cleaned' - * @return string $source 'cleaned' version of input parameter - */ - function filterTags($source) - { - /* - * In the beginning we don't really have a tag, so everything is - * postTag - */ - $preTag = null; - $postTag = $source; - - /* - * Is there a tag? If so it will certainly start with a '<' - */ - $tagOpen_start = strpos($source, '<'); - - while ($tagOpen_start !== false) - { - - /* - * Get some information about the tag we are processing - */ - $preTag .= substr($postTag, 0, $tagOpen_start); - $postTag = substr($postTag, $tagOpen_start); - $fromTagOpen = substr($postTag, 1); - $tagOpen_end = strpos($fromTagOpen, '>'); - - /* - * Let's catch any non-terminated tags and skip over them - */ - if ($tagOpen_end === false) - { - $postTag = substr($postTag, $tagOpen_start +1); - $tagOpen_start = strpos($postTag, '<'); - continue; - } - - /* - * Do we have a nested tag? - */ - $tagOpen_nested = strpos($fromTagOpen, '<'); - $tagOpen_nested_end = strpos(substr($postTag, $tagOpen_end), '>'); - if (($tagOpen_nested !== false) && ($tagOpen_nested < $tagOpen_end)) - { - $preTag .= substr($postTag, 0, ($tagOpen_nested +1)); - $postTag = substr($postTag, ($tagOpen_nested +1)); - $tagOpen_start = strpos($postTag, '<'); - continue; - } - - - /* - * Lets get some information about our tag and setup attribute pairs - */ - $tagOpen_nested = (strpos($fromTagOpen, '<') + $tagOpen_start +1); - $currentTag = substr($fromTagOpen, 0, $tagOpen_end); - $tagLength = strlen($currentTag); - $tagLeft = $currentTag; - $attrSet = array (); - $currentSpace = strpos($tagLeft, ' '); - - /* - * Are we an open tag or a close tag? - */ - if (substr($currentTag, 0, 1) == "/") - { - // Close Tag - $isCloseTag = true; - list ($tagName) = explode(' ', $currentTag); - $tagName = substr($tagName, 1); - } else - { - // Open Tag - $isCloseTag = false; - list ($tagName) = explode(' ', $currentTag); - } - - /* - * Exclude all "non-regular" tagnames - * OR no tagname - * OR remove if xssauto is on and tag is blacklisted - */ - if ((!preg_match("/^[a-z][a-z0-9]*$/i", $tagName)) || (!$tagName) || ((in_array(strtolower($tagName), $this->tagBlacklist)) && ($this->xssAuto))) - { - $postTag = substr($postTag, ($tagLength +2)); - $tagOpen_start = strpos($postTag, '<'); - // Strip tag - continue; - } - - /* - * Time to grab any attributes from the tag... need this section in - * case attributes have spaces in the values. - */ - while ($currentSpace !== false) - { - $fromSpace = substr($tagLeft, ($currentSpace +1)); - $nextSpace = strpos($fromSpace, ' '); - $openQuotes = strpos($fromSpace, '"'); - $closeQuotes = strpos(substr($fromSpace, ($openQuotes +1)), '"') + $openQuotes +1; - - /* - * Do we have an attribute to process? [check for equal sign] - */ - if (strpos($fromSpace, '=') !== false) - { - /* - * If the attribute value is wrapped in quotes we need to - * grab the substring from the closing quote, otherwise grab - * till the next space - */ - if (($openQuotes !== false) && (strpos(substr($fromSpace, ($openQuotes +1)), '"') !== false)) - { - $attr = substr($fromSpace, 0, ($closeQuotes +1)); - } else - { - $attr = substr($fromSpace, 0, $nextSpace); - } - } else - { - /* - * No more equal signs so add any extra text in the tag into - * the attribute array [eg. checked] - */ - $attr = substr($fromSpace, 0, $nextSpace); - } - - // Last Attribute Pair - if (!$attr) - { - $attr = $fromSpace; - } - - /* - * Add attribute pair to the attribute array - */ - $attrSet[] = $attr; - - /* - * Move search point and continue iteration - */ - $tagLeft = substr($fromSpace, strlen($attr)); - $currentSpace = strpos($tagLeft, ' '); - } - - /* - * Is our tag in the user input array? - */ - $tagFound = in_array(strtolower($tagName), $this->tagsArray); - - /* - * If the tag is allowed lets append it to the output string - */ - if ((!$tagFound && $this->tagsMethod) || ($tagFound && !$this->tagsMethod)) - { - /* - * Reconstruct tag with allowed attributes - */ - if (!$isCloseTag) - { - // Open or Single tag - $attrSet = $this->filterAttr($attrSet); - $preTag .= '<'.$tagName; - for ($i = 0; $i < count($attrSet); $i ++) - { - $preTag .= ' '.$attrSet[$i]; - } - - /* - * Reformat single tags to XHTML - */ - if (strpos($fromTagOpen, "'; - } else - { - $preTag .= ' />'; - } - } else - { - // Closing Tag - $preTag .= ''; - } - } - - /* - * Find next tag's start and continue iteration - */ - $postTag = substr($postTag, ($tagLength +2)); - $tagOpen_start = strpos($postTag, '<'); - } - - /* - * Append any code after the end of tags and return - */ - if ($postTag != '<') - { - $preTag .= $postTag; - } - return $preTag; - } - - /** - * Internal method to strip a tag of certain attributes - * - * @access protected - * @param array $attrSet Array of attribute pairs to filter - * @return array $newSet Filtered array of attribute pairs - */ - function filterAttr($attrSet) - { - /* - * Initialize variables - */ - $newSet = array (); - - /* - * Iterate through attribute pairs - */ - for ($i = 0; $i < count($attrSet); $i ++) - { - /* - * Skip blank spaces - */ - if (!$attrSet[$i]) - { - continue; - } - - /* - * Split into name/value pairs - */ - $attrSubSet = explode('=', trim($attrSet[$i]), 2); - list ($attrSubSet[0]) = explode(' ', $attrSubSet[0]); - - /* - * Remove all "non-regular" attribute names - * AND blacklisted attributes - */ - if ((!eregi("^[a-z]*$", $attrSubSet[0])) || (($this->xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) || (substr($attrSubSet[0], 0, 2) == 'on')))) - { - continue; - } - - /* - * XSS attribute value filtering - */ - if ($attrSubSet[1]) - { - // strips unicode, hex, etc - $attrSubSet[1] = str_replace('&#', '', $attrSubSet[1]); - // strip normal newline within attr value - $attrSubSet[1] = preg_replace('/\s+/', '', $attrSubSet[1]); - // strip double quotes - $attrSubSet[1] = str_replace('"', '', $attrSubSet[1]); - // [requested feature] convert single quotes from either side to doubles (Single quotes shouldn't be used to pad attr value) - if ((substr($attrSubSet[1], 0, 1) == "'") && (substr($attrSubSet[1], (strlen($attrSubSet[1]) - 1), 1) == "'")) - { - $attrSubSet[1] = substr($attrSubSet[1], 1, (strlen($attrSubSet[1]) - 2)); - } - // strip slashes - $attrSubSet[1] = stripslashes($attrSubSet[1]); - } - - /* - * Autostrip script tags - */ - if (InputFilter::badAttributeValue($attrSubSet)) - { - continue; - } - - /* - * Is our attribute in the user input array? - */ - $attrFound = in_array(strtolower($attrSubSet[0]), $this->attrArray); - - /* - * If the tag is allowed lets keep it - */ - if ((!$attrFound && $this->attrMethod) || ($attrFound && !$this->attrMethod)) - { - /* - * Does the attribute have a value? - */ - if ($attrSubSet[1]) - { - $newSet[] = $attrSubSet[0].'="'.$attrSubSet[1].'"'; - } - elseif ($attrSubSet[1] == "0") - { - /* - * Special Case - * Is the value 0? - */ - $newSet[] = $attrSubSet[0].'="0"'; - } else - { - $newSet[] = $attrSubSet[0].'="'.$attrSubSet[0].'"'; - } - } - } - return $newSet; - } - - /** - * Function to determine if contents of an attribute is safe - * - * @access protected - * @param array $attrSubSet A 2 element array for attributes name,value - * @return boolean True if bad code is detected - */ - function badAttributeValue($attrSubSet) - { - $attrSubSet[0] = strtolower($attrSubSet[0]); - $attrSubSet[1] = strtolower($attrSubSet[1]); - return (((strpos($attrSubSet[1], 'expression') !== false) && ($attrSubSet[0]) == 'style') || (strpos($attrSubSet[1], 'javascript:') !== false) || (strpos($attrSubSet[1], 'behaviour:') !== false) || (strpos($attrSubSet[1], 'vbscript:') !== false) || (strpos($attrSubSet[1], 'mocha:') !== false) || (strpos($attrSubSet[1], 'livescript:') !== false)); - } - - /** - * Try to convert to plaintext - * - * @access protected - * @param string $source - * @return string Plaintext string - */ - function decode($source) - { - // url decode - $source = html_entity_decode($source, ENT_QUOTES, "ISO-8859-1"); - // convert decimal - $source = preg_replace('/&#(\d+);/me', "chr(\\1)", $source); // decimal notation - // convert hex - $source = preg_replace('/&#x([a-f0-9]+);/mei', "chr(0x\\1)", $source); // hex notation - return $source; - } - - /** - * Method to be called by another php script. Processes for SQL injection - * - * @access public - * @param mixed $source input string/array-of-string to be 'cleaned' - * @param resource $connection - An open MySQL connection - * @return string 'cleaned' version of input parameter - */ - function safeSQL($source, & $connection) - { - // clean all elements in this array - if (is_array($source)) - { - foreach ($source as $key => $value) - { - // filter element for SQL injection - if (is_string($value)) - { - $source[$key] = $this->quoteSmart($this->decode($value), $connection); - } - } - return $source; - // clean this string - } else - if (is_string($source)) - { - // filter source for SQL injection - if (is_string($source)) - { - return $this->quoteSmart($this->decode($source), $connection); - } - // return parameter as given - } else - { - return $source; - } - } - - /** - * Method to escape a string - * - * @author Chris Tobin - * @author Daniel Morris - * - * @access protected - * @param string $source - * @param resource $connection An open MySQL connection - * @return string Escaped string - */ - function quoteSmart($source, & $connection) - { - /* - * Strip escaping slashes if necessary - */ - if (get_magic_quotes_gpc()) - { - $source = stripslashes($source); - } - - /* - * Escape numeric and text values - */ - $source = $this->escapeString($source, $connection); - return $source; - } - - /** - * @author Chris Tobin - * @author Daniel Morris - * - * @access protected - * @param string $source - * @param resource $connection An open MySQL connection - * @return string Escaped string - */ - function escapeString($string, & $connection) { - /* - * Use the appropriate escape string depending upon which version of php - * you are running - */ - if (version_compare(phpversion(), '4.3.0', '<')) { - $string = mysql_escape_string($string); - } else { - $string = mysql_real_escape_string($string); - } - - return $string; - } -} -?> \ No newline at end of file diff --git a/libraries/phpmailer/index.html b/libraries/phpmailer/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/phpmailer/index.html +++ b/libraries/phpmailer/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/phpmailer/language/index.html b/libraries/phpmailer/language/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/phpmailer/language/index.html +++ b/libraries/phpmailer/language/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/phpmailer/language/phpmailer.lang-en.php b/libraries/phpmailer/language/phpmailer.lang-en.php index 91e1fba907ac0..44a55ff7ad64e 100644 --- a/libraries/phpmailer/language/phpmailer.lang-en.php +++ b/libraries/phpmailer/language/phpmailer.lang-en.php @@ -7,14 +7,14 @@ $PHPMAILER_LANG = array(); $PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' . - 'recipient email address.'; + 'recipient email address.'; $PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.'; $PHPMAILER_LANG["execute"] = 'Could not execute: '; $PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.'; $PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.'; $PHPMAILER_LANG["from_failed"] = 'The following From address failed: '; $PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' . - 'recipients failed: '; + 'recipients failed: '; $PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.'; $PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.'; $PHPMAILER_LANG["file_access"] = 'Could not access file: '; diff --git a/libraries/phpmailer/phpmailer.php b/libraries/phpmailer/phpmailer.php index 89e9077b5e84a..01b148d7ea882 100644 --- a/libraries/phpmailer/phpmailer.php +++ b/libraries/phpmailer/phpmailer.php @@ -19,1482 +19,1482 @@ */ class PHPMailer { - ///////////////////////////////////////////////// - // PUBLIC VARIABLES - ///////////////////////////////////////////////// - - /** - * Email priority (1 = High, 3 = Normal, 5 = low). - * @var int - */ - var $Priority = 3; - - /** - * Sets the CharSet of the message. - * @var string - */ - var $CharSet = "utf-8"; - - /** - * Sets the Content-type of the message. - * @var string - */ - var $ContentType = "text/plain"; - - /** - * Sets the Encoding of the message. Options for this are "8bit", - * "7bit", "binary", "base64", and "quoted-printable". - * @var string - */ - var $Encoding = "8bit"; - - /** - * Holds the most recent mailer error message. - * @var string - */ - var $ErrorInfo = ""; - - /** - * Sets the From email address for the message. - * @var string - */ - var $From = "root@localhost"; - - /** - * Sets the From name of the message. - * @var string - */ - var $FromName = "Root User"; - - /** - * Sets the Sender email (Return-Path) of the message. If not empty, - * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. - * @var string - */ - var $Sender = ""; - - /** - * Sets the Subject of the message. - * @var string - */ - var $Subject = ""; - - /** - * Sets the Body of the message. This can be either an HTML or text body. - * If HTML then run IsHTML(true). - * @var string - */ - var $Body = ""; - - /** - * Sets the text-only body of the message. This automatically sets the - * email to multipart/alternative. This body can be read by mail - * clients that do not have HTML email capability such as mutt. Clients - * that can read HTML will view the normal Body. - * @var string - */ - var $AltBody = ""; - - /** - * Sets word wrapping on the body of the message to a given number of - * characters. - * @var int - */ - var $WordWrap = 0; - - /** - * Method to send mail: ("mail", "sendmail", or "smtp"). - * @var string - */ - var $Mailer = "mail"; - - /** - * Sets the path of the sendmail program. - * @var string - */ - var $Sendmail = "/usr/sbin/sendmail"; - - /** - * Path to PHPMailer plugins. This is now only useful if the SMTP class - * is in a different directory than the PHP include path. - * @var string - */ - var $PluginDir = ""; - - /** - * Holds PHPMailer version. - * @var string - */ - var $Version = "1.73"; - - /** - * Sets the email address that a reading confirmation will be sent. - * @var string - */ - var $ConfirmReadingTo = ""; - - /** - * Sets the hostname to use in Message-Id and Received headers - * and as default HELO string. If empty, the value returned - * by SERVER_NAME is used or 'localhost.localdomain'. - * @var string - */ - var $Hostname = ""; - - ///////////////////////////////////////////////// - // SMTP VARIABLES - ///////////////////////////////////////////////// - - /** - * Sets the SMTP hosts. All hosts must be separated by a - * semicolon. You can also specify a different port - * for each host by using this format: [hostname:port] - * (e.g. "smtp1.example.com:25;smtp2.example.com"). - * Hosts will be tried in order. - * @var string - */ - var $Host = "localhost"; - - /** - * Sets the default SMTP server port. - * @var int - */ - var $Port = 25; - - /** - * Sets the SMTP HELO of the message (Default is $Hostname). - * @var string - */ - var $Helo = ""; - - /** - * Sets SMTP authentication. Utilizes the Username and Password variables. - * @var bool - */ - var $SMTPAuth = false; - - /** - * Sets SMTP username. - * @var string - */ - var $Username = ""; - - /** - * Sets SMTP password. - * @var string - */ - var $Password = ""; - - /** - * Sets the SMTP server timeout in seconds. This function will not - * work with the win32 version. - * @var int - */ - var $Timeout = 10; - - /** - * Sets SMTP class debugging on or off. - * @var bool - */ - var $SMTPDebug = false; - - /** - * Prevents the SMTP connection from being closed after each mail - * sending. If this is set to true then to close the connection - * requires an explicit call to SmtpClose(). - * @var bool - */ - var $SMTPKeepAlive = false; - - /**#@+ - * @access private - */ - var $smtp = NULL; - var $to = array(); - var $cc = array(); - var $bcc = array(); - var $ReplyTo = array(); - var $attachment = array(); - var $CustomHeader = array(); - var $message_type = ""; - var $boundary = array(); - var $language = array(); - var $error_count = 0; - var $LE = "\n"; - /**#@-*/ - - ///////////////////////////////////////////////// - // VARIABLE METHODS - ///////////////////////////////////////////////// - - /** - * Sets message type to HTML. - * @param bool $bool - * @return void - */ - function IsHTML($bool) { - if($bool == true) - $this->ContentType = "text/html"; - else - $this->ContentType = "text/plain"; - } - - /** - * Sets Mailer to send message using SMTP. - * @return void - */ - function IsSMTP() { - $this->Mailer = "smtp"; - } - - /** - * Sets Mailer to send message using PHP mail() function. - * @return void - */ - function IsMail() { - $this->Mailer = "mail"; - } - - /** - * Sets Mailer to send message using the $Sendmail program. - * @return void - */ - function IsSendmail() { - $this->Mailer = "sendmail"; - } - - /** - * Sets Mailer to send message using the qmail MTA. - * @return void - */ - function IsQmail() { - $this->Sendmail = "/var/qmail/bin/sendmail"; - $this->Mailer = "sendmail"; - } - - - ///////////////////////////////////////////////// - // RECIPIENT METHODS - ///////////////////////////////////////////////// - - /** - * Adds a "To" address. - * @param string $address - * @param string $name - * @return void - */ - function AddAddress($address, $name = "") { - $cur = count($this->to); - $this->to[$cur][0] = trim($address); - $this->to[$cur][1] = $name; - } - - /** - * Adds a "Cc" address. Note: this function works - * with the SMTP mailer on win32, not with the "mail" - * mailer. - * @param string $address - * @param string $name - * @return void - */ - function AddCC($address, $name = "") { - $cur = count($this->cc); - $this->cc[$cur][0] = trim($address); - $this->cc[$cur][1] = $name; - } - - /** - * Adds a "Bcc" address. Note: this function works - * with the SMTP mailer on win32, not with the "mail" - * mailer. - * @param string $address - * @param string $name - * @return void - */ - function AddBCC($address, $name = "") { - $cur = count($this->bcc); - $this->bcc[$cur][0] = trim($address); - $this->bcc[$cur][1] = $name; - } - - /** - * Adds a "Reply-to" address. - * @param string $address - * @param string $name - * @return void - */ - function AddReplyTo($address, $name = "") { - $cur = count($this->ReplyTo); - $this->ReplyTo[$cur][0] = trim($address); - $this->ReplyTo[$cur][1] = $name; - } - - - ///////////////////////////////////////////////// - // MAIL SENDING METHODS - ///////////////////////////////////////////////// - - /** - * Creates message and assigns Mailer. If the message is - * not sent successfully then it returns false. Use the ErrorInfo - * variable to view description of the error. - * @return bool - */ - function Send() { - $header = ""; - $body = ""; - $result = true; - - if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) - { - $this->SetError($this->Lang("provide_address")); - return false; - } - - // Set whether the message is multipart/alternative - if(!empty($this->AltBody)) - $this->ContentType = "multipart/alternative"; - - $this->error_count = 0; // reset errors - $this->SetMessageType(); - $header .= $this->CreateHeader(); - $body = $this->CreateBody(); - - if($body == "") { return false; } - - // Choose the mailer - switch($this->Mailer) - { - case "sendmail": - $result = $this->SendmailSend($header, $body); - break; - case "mail": - $result = $this->MailSend($header, $body); - break; - case "smtp": - $result = $this->SmtpSend($header, $body); - break; - default: - $this->SetError($this->Mailer . $this->Lang("mailer_not_supported")); - $result = false; - break; - } - - return $result; - } - - /** - * Sends mail using the $Sendmail program. - * @access private - * @return bool - */ - function SendmailSend($header, $body) { - if ($this->Sender != "") { + ///////////////////////////////////////////////// + // PUBLIC VARIABLES + ///////////////////////////////////////////////// + + /** + * Email priority (1 = High, 3 = Normal, 5 = low). + * @var int + */ + var $Priority = 3; + + /** + * Sets the CharSet of the message. + * @var string + */ + var $CharSet = "utf-8"; + + /** + * Sets the Content-type of the message. + * @var string + */ + var $ContentType = "text/plain"; + + /** + * Sets the Encoding of the message. Options for this are "8bit", + * "7bit", "binary", "base64", and "quoted-printable". + * @var string + */ + var $Encoding = "8bit"; + + /** + * Holds the most recent mailer error message. + * @var string + */ + var $ErrorInfo = ""; + + /** + * Sets the From email address for the message. + * @var string + */ + var $From = "root@localhost"; + + /** + * Sets the From name of the message. + * @var string + */ + var $FromName = "Root User"; + + /** + * Sets the Sender email (Return-Path) of the message. If not empty, + * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. + * @var string + */ + var $Sender = ""; + + /** + * Sets the Subject of the message. + * @var string + */ + var $Subject = ""; + + /** + * Sets the Body of the message. This can be either an HTML or text body. + * If HTML then run IsHTML(true). + * @var string + */ + var $Body = ""; + + /** + * Sets the text-only body of the message. This automatically sets the + * email to multipart/alternative. This body can be read by mail + * clients that do not have HTML email capability such as mutt. Clients + * that can read HTML will view the normal Body. + * @var string + */ + var $AltBody = ""; + + /** + * Sets word wrapping on the body of the message to a given number of + * characters. + * @var int + */ + var $WordWrap = 0; + + /** + * Method to send mail: ("mail", "sendmail", or "smtp"). + * @var string + */ + var $Mailer = "mail"; + + /** + * Sets the path of the sendmail program. + * @var string + */ + var $Sendmail = "/usr/sbin/sendmail"; + + /** + * Path to PHPMailer plugins. This is now only useful if the SMTP class + * is in a different directory than the PHP include path. + * @var string + */ + var $PluginDir = ""; + + /** + * Holds PHPMailer version. + * @var string + */ + var $Version = "1.73"; + + /** + * Sets the email address that a reading confirmation will be sent. + * @var string + */ + var $ConfirmReadingTo = ""; + + /** + * Sets the hostname to use in Message-Id and Received headers + * and as default HELO string. If empty, the value returned + * by SERVER_NAME is used or 'localhost.localdomain'. + * @var string + */ + var $Hostname = ""; + + ///////////////////////////////////////////////// + // SMTP VARIABLES + ///////////////////////////////////////////////// + + /** + * Sets the SMTP hosts. All hosts must be separated by a + * semicolon. You can also specify a different port + * for each host by using this format: [hostname:port] + * (e.g. "smtp1.example.com:25;smtp2.example.com"). + * Hosts will be tried in order. + * @var string + */ + var $Host = "localhost"; + + /** + * Sets the default SMTP server port. + * @var int + */ + var $Port = 25; + + /** + * Sets the SMTP HELO of the message (Default is $Hostname). + * @var string + */ + var $Helo = ""; + + /** + * Sets SMTP authentication. Utilizes the Username and Password variables. + * @var bool + */ + var $SMTPAuth = false; + + /** + * Sets SMTP username. + * @var string + */ + var $Username = ""; + + /** + * Sets SMTP password. + * @var string + */ + var $Password = ""; + + /** + * Sets the SMTP server timeout in seconds. This function will not + * work with the win32 version. + * @var int + */ + var $Timeout = 10; + + /** + * Sets SMTP class debugging on or off. + * @var bool + */ + var $SMTPDebug = false; + + /** + * Prevents the SMTP connection from being closed after each mail + * sending. If this is set to true then to close the connection + * requires an explicit call to SmtpClose(). + * @var bool + */ + var $SMTPKeepAlive = false; + + /**#@+ + * @access private + */ + var $smtp = NULL; + var $to = array(); + var $cc = array(); + var $bcc = array(); + var $ReplyTo = array(); + var $attachment = array(); + var $CustomHeader = array(); + var $message_type = ""; + var $boundary = array(); + var $language = array(); + var $error_count = 0; + var $LE = "\n"; + /**#@-*/ + + ///////////////////////////////////////////////// + // VARIABLE METHODS + ///////////////////////////////////////////////// + + /** + * Sets message type to HTML. + * @param bool $bool + * @return void + */ + function IsHTML($bool) { + if($bool == true) + $this->ContentType = "text/html"; + else + $this->ContentType = "text/plain"; + } + + /** + * Sets Mailer to send message using SMTP. + * @return void + */ + function IsSMTP() { + $this->Mailer = "smtp"; + } + + /** + * Sets Mailer to send message using PHP mail() function. + * @return void + */ + function IsMail() { + $this->Mailer = "mail"; + } + + /** + * Sets Mailer to send message using the $Sendmail program. + * @return void + */ + function IsSendmail() { + $this->Mailer = "sendmail"; + } + + /** + * Sets Mailer to send message using the qmail MTA. + * @return void + */ + function IsQmail() { + $this->Sendmail = "/var/qmail/bin/sendmail"; + $this->Mailer = "sendmail"; + } + + + ///////////////////////////////////////////////// + // RECIPIENT METHODS + ///////////////////////////////////////////////// + + /** + * Adds a "To" address. + * @param string $address + * @param string $name + * @return void + */ + function AddAddress($address, $name = "") { + $cur = count($this->to); + $this->to[$cur][0] = trim($address); + $this->to[$cur][1] = $name; + } + + /** + * Adds a "Cc" address. Note: this function works + * with the SMTP mailer on win32, not with the "mail" + * mailer. + * @param string $address + * @param string $name + * @return void + */ + function AddCC($address, $name = "") { + $cur = count($this->cc); + $this->cc[$cur][0] = trim($address); + $this->cc[$cur][1] = $name; + } + + /** + * Adds a "Bcc" address. Note: this function works + * with the SMTP mailer on win32, not with the "mail" + * mailer. + * @param string $address + * @param string $name + * @return void + */ + function AddBCC($address, $name = "") { + $cur = count($this->bcc); + $this->bcc[$cur][0] = trim($address); + $this->bcc[$cur][1] = $name; + } + + /** + * Adds a "Reply-to" address. + * @param string $address + * @param string $name + * @return void + */ + function AddReplyTo($address, $name = "") { + $cur = count($this->ReplyTo); + $this->ReplyTo[$cur][0] = trim($address); + $this->ReplyTo[$cur][1] = $name; + } + + + ///////////////////////////////////////////////// + // MAIL SENDING METHODS + ///////////////////////////////////////////////// + + /** + * Creates message and assigns Mailer. If the message is + * not sent successfully then it returns false. Use the ErrorInfo + * variable to view description of the error. + * @return bool + */ + function Send() { + $header = ""; + $body = ""; + $result = true; + + if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) + { + $this->SetError($this->Lang("provide_address")); + return false; + } + + // Set whether the message is multipart/alternative + if(!empty($this->AltBody)) + $this->ContentType = "multipart/alternative"; + + $this->error_count = 0; // reset errors + $this->SetMessageType(); + $header .= $this->CreateHeader(); + $body = $this->CreateBody(); + + if($body == "") { return false; } + + // Choose the mailer + switch($this->Mailer) + { + case "sendmail": + $result = $this->SendmailSend($header, $body); + break; + case "mail": + $result = $this->MailSend($header, $body); + break; + case "smtp": + $result = $this->SmtpSend($header, $body); + break; + default: + $this->SetError($this->Mailer . $this->Lang("mailer_not_supported")); + $result = false; + break; + } + + return $result; + } + + /** + * Sends mail using the $Sendmail program. + * @access private + * @return bool + */ + function SendmailSend($header, $body) { + if ($this->Sender != "") { $this->Sender = escapeshellcmd($this->Sender); - $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender); + $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender); } else { - $sendmail = sprintf("%s -oi -t", $this->Sendmail); + $sendmail = sprintf("%s -oi -t", $this->Sendmail); + } + if(!@$mail = popen($sendmail, "w")) + { + $this->SetError($this->Lang("execute") . $this->Sendmail); + return false; + } + + fputs($mail, $header); + fputs($mail, $body); + + $result = pclose($mail) >> 8 & 0xFF; + if($result != 0) + { + $this->SetError($this->Lang("execute") . $this->Sendmail); + return false; + } + + return true; + } + + /** + * Sends mail using the PHP mail() function. + * @access private + * @return bool + */ + function MailSend($header, $body) { + $to = ""; + for($i = 0; $i < count($this->to); $i++) + { + if($i != 0) { $to .= ", "; } + $to .= $this->to[$i][0]; + } + + if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1) + { + $old_from = ini_get("sendmail_from"); + ini_set("sendmail_from", $this->Sender); + $params = sprintf("-oi -f %s", $this->Sender); + $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, + $header, $params); + } + else + $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header); + + if (isset($old_from)) + ini_set("sendmail_from", $old_from); + + if(!$rt) + { + $this->SetError($this->Lang("instantiate")); + return false; } - if(!@$mail = popen($sendmail, "w")) - { - $this->SetError($this->Lang("execute") . $this->Sendmail); - return false; - } - - fputs($mail, $header); - fputs($mail, $body); - - $result = pclose($mail) >> 8 & 0xFF; - if($result != 0) - { - $this->SetError($this->Lang("execute") . $this->Sendmail); - return false; - } - - return true; - } - - /** - * Sends mail using the PHP mail() function. - * @access private - * @return bool - */ - function MailSend($header, $body) { - $to = ""; - for($i = 0; $i < count($this->to); $i++) - { - if($i != 0) { $to .= ", "; } - $to .= $this->to[$i][0]; - } - - if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1) - { - $old_from = ini_get("sendmail_from"); - ini_set("sendmail_from", $this->Sender); - $params = sprintf("-oi -f %s", $this->Sender); - $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, - $header, $params); - } - else - $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header); - - if (isset($old_from)) - ini_set("sendmail_from", $old_from); - - if(!$rt) - { - $this->SetError($this->Lang("instantiate")); - return false; - } - - return true; - } - - /** - * Sends mail via SMTP using PhpSMTP (Author: - * Chris Ryan). Returns bool. Returns false if there is a - * bad MAIL FROM, RCPT, or DATA input. - * @access private - * @return bool - */ - function SmtpSend($header, $body) { - include_once($this->PluginDir . "smtp.php"); - $error = ""; - $bad_rcpt = array(); - - if(!$this->SmtpConnect()) - return false; - - $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender; - if(!$this->smtp->Mail($smtp_from)) - { - $error = $this->Lang("from_failed") . $smtp_from; - $this->SetError($error); - $this->smtp->Reset(); - return false; - } - - // Attempt to send attach all recipients - for($i = 0; $i < count($this->to); $i++) - { - if(!$this->smtp->Recipient($this->to[$i][0])) - $bad_rcpt[] = $this->to[$i][0]; - } - for($i = 0; $i < count($this->cc); $i++) - { - if(!$this->smtp->Recipient($this->cc[$i][0])) - $bad_rcpt[] = $this->cc[$i][0]; - } - for($i = 0; $i < count($this->bcc); $i++) - { - if(!$this->smtp->Recipient($this->bcc[$i][0])) - $bad_rcpt[] = $this->bcc[$i][0]; - } - - if(count($bad_rcpt) > 0) // Create error message - { - for($i = 0; $i < count($bad_rcpt); $i++) - { - if($i != 0) { $error .= ", "; } - $error .= $bad_rcpt[$i]; - } - $error = $this->Lang("recipients_failed") . $error; - $this->SetError($error); - $this->smtp->Reset(); - return false; - } - - if(!$this->smtp->Data($header . $body)) - { - $this->SetError($this->Lang("data_not_accepted")); - $this->smtp->Reset(); - return false; - } - if($this->SMTPKeepAlive == true) - $this->smtp->Reset(); - else - $this->SmtpClose(); - - return true; - } - - /** - * Initiates a connection to an SMTP server. Returns false if the - * operation failed. - * @access private - * @return bool - */ - function SmtpConnect() { - if($this->smtp == NULL) { $this->smtp = new SMTP(); } - - $this->smtp->do_debug = $this->SMTPDebug; - $hosts = explode(";", $this->Host); - $index = 0; - $connection = ($this->smtp->Connected()); - - // Retry while there is no connection - while($index < count($hosts) && $connection == false) - { - if(strstr($hosts[$index], ":")) - list($host, $port) = explode(":", $hosts[$index]); - else - { - $host = $hosts[$index]; - $port = $this->Port; - } - - if($this->smtp->Connect($host, $port, $this->Timeout)) - { - if ($this->Helo != '') - $this->smtp->Hello($this->Helo); - else - $this->smtp->Hello($this->ServerHostname()); - - if($this->SMTPAuth) - { - if(!$this->smtp->Authenticate($this->Username, - $this->Password)) - { - $this->SetError($this->Lang("authenticate")); - $this->smtp->Reset(); - $connection = false; - } - } - $connection = true; - } - $index++; - } - if(!$connection) - $this->SetError($this->Lang("connect_host")); - - return $connection; - } - - /** - * Closes the active SMTP session if one exists. - * @return void - */ - function SmtpClose() { - if($this->smtp != NULL) - { - if($this->smtp->Connected()) - { - $this->smtp->Quit(); - $this->smtp->Close(); - } - } - } - - /** - * Sets the language for all class error messages. Returns false - * if it cannot load the language file. The default language type - * is English. - * @param string $lang_type Type of language (e.g. Portuguese: "br") - * @param string $lang_path Path to the language file directory - * @access public - * @return bool - */ - function SetLanguage($lang_type, $lang_path = "language/") { - if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) - include($lang_path.'phpmailer.lang-'.$lang_type.'.php'); - else if(file_exists($lang_path.'phpmailer.lang-en.php')) - include($lang_path.'phpmailer.lang-en.php'); - else - { - $this->SetError("Could not load language file"); - return false; - } - $this->language = $PHPMAILER_LANG; - - return true; - } - - ///////////////////////////////////////////////// - // MESSAGE CREATION METHODS - ///////////////////////////////////////////////// - - /** - * Creates recipient headers. - * @access private - * @return string - */ - function AddrAppend($type, $addr) { - $addr_str = $type . ": "; - $addr_str .= $this->AddrFormat($addr[0]); - if(count($addr) > 1) - { - for($i = 1; $i < count($addr); $i++) - $addr_str .= ", " . $this->AddrFormat($addr[$i]); - } - $addr_str .= $this->LE; - - return $addr_str; - } - - /** - * Formats an address correctly. - * @access private - * @return string - */ - function AddrFormat($addr) { - if(empty($addr[1])) - $formatted = $addr[0]; - else - { - $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . - $addr[0] . ">"; - } - - return $formatted; - } - - /** - * Wraps message for use with mailers that do not - * automatically perform wrapping and for quoted-printable. - * Original written by philippe. - * @access private - * @return string - */ - function WrapText($message, $length, $qp_mode = false) { - $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; - - $message = $this->FixEOL($message); - if (substr($message, -1) == $this->LE) - $message = substr($message, 0, -1); - - $line = explode($this->LE, $message); - $message = ""; - for ($i=0 ;$i < count($line); $i++) - { - $line_part = explode(" ", $line[$i]); - $buf = ""; - for ($e = 0; $e $length)) - { - $space_left = $length - strlen($buf) - 1; - if ($e != 0) - { - if ($space_left > 20) - { - $len = $space_left; - if (substr($word, $len - 1, 1) == "=") - $len--; - elseif (substr($word, $len - 2, 1) == "=") - $len -= 2; - $part = substr($word, 0, $len); - $word = substr($word, $len); - $buf .= " " . $part; - $message .= $buf . sprintf("=%s", $this->LE); - } - else - { - $message .= $buf . $soft_break; - } - $buf = ""; - } - while (strlen($word) > 0) - { - $len = $length; - if (substr($word, $len - 1, 1) == "=") - $len--; - elseif (substr($word, $len - 2, 1) == "=") - $len -= 2; - $part = substr($word, 0, $len); - $word = substr($word, $len); - - if (strlen($word) > 0) - $message .= $part . sprintf("=%s", $this->LE); - else - $buf = $part; - } - } - else - { - $buf_o = $buf; - $buf .= ($e == 0) ? $word : (" " . $word); - - if (strlen($buf) > $length and $buf_o != "") - { - $message .= $buf_o . $soft_break; - $buf = $word; - } - } - } - $message .= $buf . $this->LE; - } - - return $message; - } - - /** - * Set the body wrapping. - * @access private - * @return void - */ - function SetWordWrap() { - if($this->WordWrap < 1) - return; - - switch($this->message_type) - { - case "alt": - // fall through - case "alt_attachments": - $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); - break; - default: - $this->Body = $this->WrapText($this->Body, $this->WordWrap); - break; - } - } - - /** - * Assembles message header. - * @access private - * @return string - */ - function CreateHeader() { - $result = ""; - - // Set the boundaries - $uniq_id = md5(uniqid(time())); - $this->boundary[1] = "b1_" . $uniq_id; - $this->boundary[2] = "b2_" . $uniq_id; - - $result .= $this->HeaderLine("Date", $this->RFCDate()); - if($this->Sender == "") - $result .= $this->HeaderLine("Return-Path", trim($this->From)); - else - $result .= $this->HeaderLine("Return-Path", trim($this->Sender)); - - // To be created automatically by mail() - if($this->Mailer != "mail") - { - if(count($this->to) > 0) - $result .= $this->AddrAppend("To", $this->to); - else if (count($this->cc) == 0) - $result .= $this->HeaderLine("To", "undisclosed-recipients:;"); - if(count($this->cc) > 0) - $result .= $this->AddrAppend("Cc", $this->cc); - } - - $from = array(); - $from[0][0] = trim($this->From); - $from[0][1] = $this->FromName; - $result .= $this->AddrAppend("From", $from); - - // sendmail and mail() extract Bcc from the header before sending - if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0)) - $result .= $this->AddrAppend("Bcc", $this->bcc); - - if(count($this->ReplyTo) > 0) - $result .= $this->AddrAppend("Reply-to", $this->ReplyTo); - - // mail() sets the subject itself - if($this->Mailer != "mail") - $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject))); - - $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); - $result .= $this->HeaderLine("X-Priority", $this->Priority); - $result .= $this->HeaderLine("X-Mailer", "PHPMailer [version " . $this->Version . "]"); - - if($this->ConfirmReadingTo != "") - { - $result .= $this->HeaderLine("Disposition-Notification-To", - "<" . trim($this->ConfirmReadingTo) . ">"); - } - - // Add custom headers - for($index = 0; $index < count($this->CustomHeader); $index++) - { - $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), - $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); - } - $result .= $this->HeaderLine("MIME-Version", "1.0"); - - switch($this->message_type) - { - case "plain": - $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding); - $result .= sprintf("Content-Type: %s; charset=\"%s\"", - $this->ContentType, $this->CharSet); - break; - case "attachments": - // fall through - case "alt_attachments": - if($this->InlineImageExists()) - { - $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", - "multipart/related", $this->LE, $this->LE, - $this->boundary[1], $this->LE); - } - else - { - $result .= $this->HeaderLine("Content-Type", "multipart/mixed;"); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - } - break; - case "alt": - $result .= $this->HeaderLine("Content-Type", "multipart/alternative;"); - $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); - break; - } - - if($this->Mailer != "mail") - $result .= $this->LE.$this->LE; - - return $result; - } - - /** - * Assembles the message body. Returns an empty string on failure. - * @access private - * @return string - */ - function CreateBody() { - $result = ""; - - $this->SetWordWrap(); - - switch($this->message_type) - { - case "alt": - $result .= $this->GetBoundary($this->boundary[1], "", - "text/plain", ""); - $result .= $this->EncodeString($this->AltBody, $this->Encoding); - $result .= $this->LE.$this->LE; - $result .= $this->GetBoundary($this->boundary[1], "", - "text/html", ""); - - $result .= $this->EncodeString($this->Body, $this->Encoding); - $result .= $this->LE.$this->LE; - - $result .= $this->EndBoundary($this->boundary[1]); - break; - case "plain": - $result .= $this->EncodeString($this->Body, $this->Encoding); - break; - case "attachments": - $result .= $this->GetBoundary($this->boundary[1], "", "", ""); - $result .= $this->EncodeString($this->Body, $this->Encoding); - $result .= $this->LE; - - $result .= $this->AttachAll(); - break; - case "alt_attachments": - $result .= sprintf("--%s%s", $this->boundary[1], $this->LE); - $result .= sprintf("Content-Type: %s;%s" . - "\tboundary=\"%s\"%s", - "multipart/alternative", $this->LE, - $this->boundary[2], $this->LE.$this->LE); - - // Create text body - $result .= $this->GetBoundary($this->boundary[2], "", - "text/plain", "") . $this->LE; - - $result .= $this->EncodeString($this->AltBody, $this->Encoding); - $result .= $this->LE.$this->LE; - - // Create the HTML body - $result .= $this->GetBoundary($this->boundary[2], "", - "text/html", "") . $this->LE; - - $result .= $this->EncodeString($this->Body, $this->Encoding); - $result .= $this->LE.$this->LE; - - $result .= $this->EndBoundary($this->boundary[2]); - - $result .= $this->AttachAll(); - break; - } - if($this->IsError()) - $result = ""; - - return $result; - } - - /** - * Returns the start of a message boundary. - * @access private - */ - function GetBoundary($boundary, $charSet, $contentType, $encoding) { - $result = ""; - if($charSet == "") { $charSet = $this->CharSet; } - if($contentType == "") { $contentType = $this->ContentType; } - if($encoding == "") { $encoding = $this->Encoding; } - - $result .= $this->TextLine("--" . $boundary); - $result .= sprintf("Content-Type: %s; charset = \"%s\"", - $contentType, $charSet); - $result .= $this->LE; - $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding); - $result .= $this->LE; - - return $result; - } - - /** - * Returns the end of a message boundary. - * @access private - */ - function EndBoundary($boundary) { - return $this->LE . "--" . $boundary . "--" . $this->LE; - } - - /** - * Sets the message type. - * @access private - * @return void - */ - function SetMessageType() { - if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) - $this->message_type = "plain"; - else - { - if(count($this->attachment) > 0) - $this->message_type = "attachments"; - if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) - $this->message_type = "alt"; - if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) - $this->message_type = "alt_attachments"; - } - } - - /** - * Returns a formatted header line. - * @access private - * @return string - */ - function HeaderLine($name, $value) { - return $name . ": " . $value . $this->LE; - } - - /** - * Returns a formatted mail line. - * @access private - * @return string - */ - function TextLine($value) { - return $value . $this->LE; - } - - ///////////////////////////////////////////////// - // ATTACHMENT METHODS - ///////////////////////////////////////////////// - - /** - * Adds an attachment from a path on the filesystem. - * Returns false if the file could not be found - * or accessed. - * @param string $path Path to the attachment. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @return bool - */ - function AddAttachment($path, $name = "", $encoding = "base64", - $type = "application/octet-stream") { - if(!@is_file($path)) - { - $this->SetError($this->Lang("file_access") . $path); - return false; - } - - $filename = basename($path); - if($name == "") - $name = $filename; - - $cur = count($this->attachment); - $this->attachment[$cur][0] = $path; - $this->attachment[$cur][1] = $filename; - $this->attachment[$cur][2] = $name; - $this->attachment[$cur][3] = $encoding; - $this->attachment[$cur][4] = $type; - $this->attachment[$cur][5] = false; // isStringAttachment - $this->attachment[$cur][6] = "attachment"; - $this->attachment[$cur][7] = 0; - - return true; - } - - /** - * Attaches all fs, string, and binary attachments to the message. - * Returns an empty string on failure. - * @access private - * @return string - */ - function AttachAll() { - // Return text of body - $mime = array(); - - // Add all attachments - for($i = 0; $i < count($this->attachment); $i++) - { - // Check for string attachment - $bString = $this->attachment[$i][5]; - if ($bString) - $string = $this->attachment[$i][0]; - else - $path = $this->attachment[$i][0]; - - $filename = $this->attachment[$i][1]; - $name = $this->attachment[$i][2]; - $encoding = $this->attachment[$i][3]; - $type = $this->attachment[$i][4]; - $disposition = $this->attachment[$i][6]; - $cid = $this->attachment[$i][7]; - - $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); - $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE); - $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); - - if($disposition == "inline") - $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); - - $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", - $disposition, $name, $this->LE.$this->LE); - - // Encode as string attachment - if($bString) - { - $mime[] = $this->EncodeString($string, $encoding); - if($this->IsError()) { return ""; } - $mime[] = $this->LE.$this->LE; - } - else - { - $mime[] = $this->EncodeFile($path, $encoding); - if($this->IsError()) { return ""; } - $mime[] = $this->LE.$this->LE; - } - } - - $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE); - - return join("", $mime); - } - - /** - * Encodes attachment in requested format. Returns an - * empty string on failure. - * @access private - * @return string - */ - function EncodeFile ($path, $encoding = "base64") { - if(!@$fd = fopen($path, "rb")) - { - $this->SetError($this->Lang("file_open") . $path); - return ""; - } - $magic_quotes = get_magic_quotes_runtime(); - set_magic_quotes_runtime(0); - $file_buffer = fread($fd, filesize($path)); - $file_buffer = $this->EncodeString($file_buffer, $encoding); - fclose($fd); - set_magic_quotes_runtime($magic_quotes); - - return $file_buffer; - } - - /** - * Encodes string to requested format. Returns an - * empty string on failure. - * @access private - * @return string - */ - function EncodeString ($str, $encoding = "base64") { - $encoded = ""; - switch(strtolower($encoding)) { - case "base64": - // chunk_split is found in PHP >= 3.0.6 - $encoded = chunk_split(base64_encode($str), 76, $this->LE); - break; - case "7bit": - case "8bit": - $encoded = $this->FixEOL($str); - if (substr($encoded, -(strlen($this->LE))) != $this->LE) - $encoded .= $this->LE; - break; - case "binary": - $encoded = $str; - break; - case "quoted-printable": - $encoded = $this->EncodeQP($str); - break; - default: - $this->SetError($this->Lang("encoding") . $encoding); - break; - } - return $encoded; - } - - /** - * Encode a header string to best of Q, B, quoted or none. - * @access private - * @return string - */ - function EncodeHeader ($str, $position = 'text') { - $x = 0; - - switch (strtolower($position)) { - case 'phrase': - if (!preg_match('/[\200-\377]/', $str)) { - // Can't use addslashes as we don't know what value has magic_quotes_sybase. - $encoded = addcslashes($str, "\0..\37\177\\\""); - - if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) - return ($encoded); - else - return ("\"$encoded\""); - } - $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); - break; - case 'comment': - $x = preg_match_all('/[()"]/', $str, $matches); - // Fall-through - case 'text': - default: - $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); - break; - } - - if ($x == 0) - return ($str); - - $maxlen = 75 - 7 - strlen($this->CharSet); - // Try to select the encoding which should produce the shortest output - if (strlen($str)/3 < $x) { - $encoding = 'B'; - $encoded = base64_encode($str); - $maxlen -= $maxlen % 4; - $encoded = trim(chunk_split($encoded, $maxlen, "\n")); - } else { - $encoding = 'Q'; - $encoded = $this->EncodeQ($str, $position); - $encoded = $this->WrapText($encoded, $maxlen, true); - $encoded = str_replace("=".$this->LE, "\n", trim($encoded)); - } - - $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); - $encoded = trim(str_replace("\n", $this->LE, $encoded)); - - return $encoded; - } - - /** - * Encode string to quoted-printable. - * @access private - * @return string - */ - function EncodeQP ($str) { - $encoded = $this->FixEOL($str); - if (substr($encoded, -(strlen($this->LE))) != $this->LE) - $encoded .= $this->LE; - - // Replace every high ascii, control and = characters - $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e', - "'='.sprintf('%02X', ord('\\1'))", $encoded); - // Replace every spaces and tabs when it's the last character on a line - $encoded = preg_replace("/([\011\040])".$this->LE."/e", - "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded); - - // Maximum line length of 76 characters before CRLF (74 + space + '=') - $encoded = $this->WrapText($encoded, 74, true); - - return $encoded; - } - - /** - * Encode string to q encoding. - * @access private - * @return string - */ - function EncodeQ ($str, $position = "text") { - // There should not be any EOL in the string - $encoded = preg_replace("[\r\n]", "", $str); - - switch (strtolower($position)) { - case "phrase": - $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); - break; - case "comment": - $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); - case "text": - default: - // Replace every high ascii, control =, ? and _ characters - $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', - "'='.sprintf('%02X', ord('\\1'))", $encoded); - break; - } - - // Replace every spaces to _ (more readable than =20) - $encoded = str_replace(" ", "_", $encoded); - - return $encoded; - } - - /** - * Adds a string or binary attachment (non-filesystem) to the list. - * This method can be used to attach ascii or binary data, - * such as a BLOB record from a database. - * @param string $string String attachment data. - * @param string $filename Name of the attachment. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @return void - */ - function AddStringAttachment($string, $filename, $encoding = "base64", - $type = "application/octet-stream") { - // Append to $attachment array - $cur = count($this->attachment); - $this->attachment[$cur][0] = $string; - $this->attachment[$cur][1] = $filename; - $this->attachment[$cur][2] = $filename; - $this->attachment[$cur][3] = $encoding; - $this->attachment[$cur][4] = $type; - $this->attachment[$cur][5] = true; // isString - $this->attachment[$cur][6] = "attachment"; - $this->attachment[$cur][7] = 0; - } - - /** - * Adds an embedded attachment. This can include images, sounds, and - * just about any other document. Make sure to set the $type to an - * image type. For JPEG images use "image/jpeg" and for GIF images - * use "image/gif". - * @param string $path Path to the attachment. - * @param string $cid Content ID of the attachment. Use this to identify - * the Id for accessing the image in an HTML form. - * @param string $name Overrides the attachment name. - * @param string $encoding File encoding (see $Encoding). - * @param string $type File extension (MIME) type. - * @return bool - */ - function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", - $type = "application/octet-stream") { - - if(!@is_file($path)) - { - $this->SetError($this->Lang("file_access") . $path); - return false; - } - - $filename = basename($path); - if($name == "") - $name = $filename; - - // Append to $attachment array - $cur = count($this->attachment); - $this->attachment[$cur][0] = $path; - $this->attachment[$cur][1] = $filename; - $this->attachment[$cur][2] = $name; - $this->attachment[$cur][3] = $encoding; - $this->attachment[$cur][4] = $type; - $this->attachment[$cur][5] = false; // isStringAttachment - $this->attachment[$cur][6] = "inline"; - $this->attachment[$cur][7] = $cid; - - return true; - } - - /** - * Returns true if an inline attachment is present. - * @access private - * @return bool - */ - function InlineImageExists() { - $result = false; - for($i = 0; $i < count($this->attachment); $i++) - { - if($this->attachment[$i][6] == "inline") - { - $result = true; - break; - } - } - - return $result; - } - - ///////////////////////////////////////////////// - // MESSAGE RESET METHODS - ///////////////////////////////////////////////// - - /** - * Clears all recipients assigned in the TO array. Returns void. - * @return void - */ - function ClearAddresses() { - $this->to = array(); - } - - /** - * Clears all recipients assigned in the CC array. Returns void. - * @return void - */ - function ClearCCs() { - $this->cc = array(); - } - - /** - * Clears all recipients assigned in the BCC array. Returns void. - * @return void - */ - function ClearBCCs() { - $this->bcc = array(); - } - - /** - * Clears all recipients assigned in the ReplyTo array. Returns void. - * @return void - */ - function ClearReplyTos() { - $this->ReplyTo = array(); - } - - /** - * Clears all recipients assigned in the TO, CC and BCC - * array. Returns void. - * @return void - */ - function ClearAllRecipients() { - $this->to = array(); - $this->cc = array(); - $this->bcc = array(); - } - - /** - * Clears all previously set filesystem, string, and binary - * attachments. Returns void. - * @return void - */ - function ClearAttachments() { - $this->attachment = array(); - } - - /** - * Clears all custom headers. Returns void. - * @return void - */ - function ClearCustomHeaders() { - $this->CustomHeader = array(); - } - - - ///////////////////////////////////////////////// - // MISCELLANEOUS METHODS - ///////////////////////////////////////////////// - - /** - * Adds the error message to the error container. - * Returns void. - * @access private - * @return void - */ - function SetError($msg) { - $this->error_count++; - $this->ErrorInfo = $msg; - } - - /** - * Returns the proper RFC 822 formatted date. - * @access private - * @return string - */ - function RFCDate() { - $tz = date("Z"); - $tzs = ($tz < 0) ? "-" : "+"; - $tz = abs($tz); - $tz = ($tz/3600)*100 + ($tz%3600)/60; - $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz); - - return $result; - } - - /** - * Returns the appropriate server variable. Should work with both - * PHP 4.1.0+ as well as older versions. Returns an empty string - * if nothing is found. - * @access private - * @return mixed - */ - function ServerVar($varName) { - global $HTTP_SERVER_VARS; - global $HTTP_ENV_VARS; - - if(!isset($_SERVER)) - { - $_SERVER = $HTTP_SERVER_VARS; - if(!isset($_SERVER["REMOTE_ADDR"])) - $_SERVER = $HTTP_ENV_VARS; // must be Apache - } - - if(isset($_SERVER[$varName])) - return $_SERVER[$varName]; - else - return ""; - } - - /** - * Returns the server hostname or 'localhost.localdomain' if unknown. - * @access private - * @return string - */ - function ServerHostname() { - if ($this->Hostname != "") - $result = $this->Hostname; - elseif ($this->ServerVar('SERVER_NAME') != "") - $result = $this->ServerVar('SERVER_NAME'); - else - $result = "localhost.localdomain"; - - return $result; - } - - /** - * Returns a message in the appropriate language. - * @access private - * @return string - */ - function Lang($key) { - if(count($this->language) < 1) - $this->SetLanguage("en"); // set the default language - - if(isset($this->language[$key])) - return $this->language[$key]; - else - return "Language string failed to load: " . $key; - } - - /** - * Returns true if an error occurred. - * @return bool - */ - function IsError() { - return ($this->error_count > 0); - } - - /** - * Changes every end of line from CR or LF to CRLF. - * @access private - * @return string - */ - function FixEOL($str) { - $str = str_replace("\r\n", "\n", $str); - $str = str_replace("\r", "\n", $str); - $str = str_replace("\n", $this->LE, $str); - return $str; - } - - /** - * Adds a custom header. - * @return void - */ - function AddCustomHeader($custom_header) { - $this->CustomHeader[] = explode(":", $custom_header, 2); - } + + return true; + } + + /** + * Sends mail via SMTP using PhpSMTP (Author: + * Chris Ryan). Returns bool. Returns false if there is a + * bad MAIL FROM, RCPT, or DATA input. + * @access private + * @return bool + */ + function SmtpSend($header, $body) { + include_once($this->PluginDir . "smtp.php"); + $error = ""; + $bad_rcpt = array(); + + if(!$this->SmtpConnect()) + return false; + + $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender; + if(!$this->smtp->Mail($smtp_from)) + { + $error = $this->Lang("from_failed") . $smtp_from; + $this->SetError($error); + $this->smtp->Reset(); + return false; + } + + // Attempt to send attach all recipients + for($i = 0; $i < count($this->to); $i++) + { + if(!$this->smtp->Recipient($this->to[$i][0])) + $bad_rcpt[] = $this->to[$i][0]; + } + for($i = 0; $i < count($this->cc); $i++) + { + if(!$this->smtp->Recipient($this->cc[$i][0])) + $bad_rcpt[] = $this->cc[$i][0]; + } + for($i = 0; $i < count($this->bcc); $i++) + { + if(!$this->smtp->Recipient($this->bcc[$i][0])) + $bad_rcpt[] = $this->bcc[$i][0]; + } + + if(count($bad_rcpt) > 0) // Create error message + { + for($i = 0; $i < count($bad_rcpt); $i++) + { + if($i != 0) { $error .= ", "; } + $error .= $bad_rcpt[$i]; + } + $error = $this->Lang("recipients_failed") . $error; + $this->SetError($error); + $this->smtp->Reset(); + return false; + } + + if(!$this->smtp->Data($header . $body)) + { + $this->SetError($this->Lang("data_not_accepted")); + $this->smtp->Reset(); + return false; + } + if($this->SMTPKeepAlive == true) + $this->smtp->Reset(); + else + $this->SmtpClose(); + + return true; + } + + /** + * Initiates a connection to an SMTP server. Returns false if the + * operation failed. + * @access private + * @return bool + */ + function SmtpConnect() { + if($this->smtp == NULL) { $this->smtp = new SMTP(); } + + $this->smtp->do_debug = $this->SMTPDebug; + $hosts = explode(";", $this->Host); + $index = 0; + $connection = ($this->smtp->Connected()); + + // Retry while there is no connection + while($index < count($hosts) && $connection == false) + { + if(strstr($hosts[$index], ":")) + list($host, $port) = explode(":", $hosts[$index]); + else + { + $host = $hosts[$index]; + $port = $this->Port; + } + + if($this->smtp->Connect($host, $port, $this->Timeout)) + { + if ($this->Helo != '') + $this->smtp->Hello($this->Helo); + else + $this->smtp->Hello($this->ServerHostname()); + + if($this->SMTPAuth) + { + if(!$this->smtp->Authenticate($this->Username, + $this->Password)) + { + $this->SetError($this->Lang("authenticate")); + $this->smtp->Reset(); + $connection = false; + } + } + $connection = true; + } + $index++; + } + if(!$connection) + $this->SetError($this->Lang("connect_host")); + + return $connection; + } + + /** + * Closes the active SMTP session if one exists. + * @return void + */ + function SmtpClose() { + if($this->smtp != NULL) + { + if($this->smtp->Connected()) + { + $this->smtp->Quit(); + $this->smtp->Close(); + } + } + } + + /** + * Sets the language for all class error messages. Returns false + * if it cannot load the language file. The default language type + * is English. + * @param string $lang_type Type of language (e.g. Portuguese: "br") + * @param string $lang_path Path to the language file directory + * @access public + * @return bool + */ + function SetLanguage($lang_type, $lang_path = "language/") { + if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) + include($lang_path.'phpmailer.lang-'.$lang_type.'.php'); + else if(file_exists($lang_path.'phpmailer.lang-en.php')) + include($lang_path.'phpmailer.lang-en.php'); + else + { + $this->SetError("Could not load language file"); + return false; + } + $this->language = $PHPMAILER_LANG; + + return true; + } + + ///////////////////////////////////////////////// + // MESSAGE CREATION METHODS + ///////////////////////////////////////////////// + + /** + * Creates recipient headers. + * @access private + * @return string + */ + function AddrAppend($type, $addr) { + $addr_str = $type . ": "; + $addr_str .= $this->AddrFormat($addr[0]); + if(count($addr) > 1) + { + for($i = 1; $i < count($addr); $i++) + $addr_str .= ", " . $this->AddrFormat($addr[$i]); + } + $addr_str .= $this->LE; + + return $addr_str; + } + + /** + * Formats an address correctly. + * @access private + * @return string + */ + function AddrFormat($addr) { + if(empty($addr[1])) + $formatted = $addr[0]; + else + { + $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" . + $addr[0] . ">"; + } + + return $formatted; + } + + /** + * Wraps message for use with mailers that do not + * automatically perform wrapping and for quoted-printable. + * Original written by philippe. + * @access private + * @return string + */ + function WrapText($message, $length, $qp_mode = false) { + $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE; + + $message = $this->FixEOL($message); + if (substr($message, -1) == $this->LE) + $message = substr($message, 0, -1); + + $line = explode($this->LE, $message); + $message = ""; + for ($i=0 ;$i < count($line); $i++) + { + $line_part = explode(" ", $line[$i]); + $buf = ""; + for ($e = 0; $e $length)) + { + $space_left = $length - strlen($buf) - 1; + if ($e != 0) + { + if ($space_left > 20) + { + $len = $space_left; + if (substr($word, $len - 1, 1) == "=") + $len--; + elseif (substr($word, $len - 2, 1) == "=") + $len -= 2; + $part = substr($word, 0, $len); + $word = substr($word, $len); + $buf .= " " . $part; + $message .= $buf . sprintf("=%s", $this->LE); + } + else + { + $message .= $buf . $soft_break; + } + $buf = ""; + } + while (strlen($word) > 0) + { + $len = $length; + if (substr($word, $len - 1, 1) == "=") + $len--; + elseif (substr($word, $len - 2, 1) == "=") + $len -= 2; + $part = substr($word, 0, $len); + $word = substr($word, $len); + + if (strlen($word) > 0) + $message .= $part . sprintf("=%s", $this->LE); + else + $buf = $part; + } + } + else + { + $buf_o = $buf; + $buf .= ($e == 0) ? $word : (" " . $word); + + if (strlen($buf) > $length and $buf_o != "") + { + $message .= $buf_o . $soft_break; + $buf = $word; + } + } + } + $message .= $buf . $this->LE; + } + + return $message; + } + + /** + * Set the body wrapping. + * @access private + * @return void + */ + function SetWordWrap() { + if($this->WordWrap < 1) + return; + + switch($this->message_type) + { + case "alt": + // fall through + case "alt_attachments": + $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap); + break; + default: + $this->Body = $this->WrapText($this->Body, $this->WordWrap); + break; + } + } + + /** + * Assembles message header. + * @access private + * @return string + */ + function CreateHeader() { + $result = ""; + + // Set the boundaries + $uniq_id = md5(uniqid(time())); + $this->boundary[1] = "b1_" . $uniq_id; + $this->boundary[2] = "b2_" . $uniq_id; + + $result .= $this->HeaderLine("Date", $this->RFCDate()); + if($this->Sender == "") + $result .= $this->HeaderLine("Return-Path", trim($this->From)); + else + $result .= $this->HeaderLine("Return-Path", trim($this->Sender)); + + // To be created automatically by mail() + if($this->Mailer != "mail") + { + if(count($this->to) > 0) + $result .= $this->AddrAppend("To", $this->to); + else if (count($this->cc) == 0) + $result .= $this->HeaderLine("To", "undisclosed-recipients:;"); + if(count($this->cc) > 0) + $result .= $this->AddrAppend("Cc", $this->cc); + } + + $from = array(); + $from[0][0] = trim($this->From); + $from[0][1] = $this->FromName; + $result .= $this->AddrAppend("From", $from); + + // sendmail and mail() extract Bcc from the header before sending + if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0)) + $result .= $this->AddrAppend("Bcc", $this->bcc); + + if(count($this->ReplyTo) > 0) + $result .= $this->AddrAppend("Reply-to", $this->ReplyTo); + + // mail() sets the subject itself + if($this->Mailer != "mail") + $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject))); + + $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE); + $result .= $this->HeaderLine("X-Priority", $this->Priority); + $result .= $this->HeaderLine("X-Mailer", "PHPMailer [version " . $this->Version . "]"); + + if($this->ConfirmReadingTo != "") + { + $result .= $this->HeaderLine("Disposition-Notification-To", + "<" . trim($this->ConfirmReadingTo) . ">"); + } + + // Add custom headers + for($index = 0; $index < count($this->CustomHeader); $index++) + { + $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), + $this->EncodeHeader(trim($this->CustomHeader[$index][1]))); + } + $result .= $this->HeaderLine("MIME-Version", "1.0"); + + switch($this->message_type) + { + case "plain": + $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding); + $result .= sprintf("Content-Type: %s; charset=\"%s\"", + $this->ContentType, $this->CharSet); + break; + case "attachments": + // fall through + case "alt_attachments": + if($this->InlineImageExists()) + { + $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", + "multipart/related", $this->LE, $this->LE, + $this->boundary[1], $this->LE); + } + else + { + $result .= $this->HeaderLine("Content-Type", "multipart/mixed;"); + $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); + } + break; + case "alt": + $result .= $this->HeaderLine("Content-Type", "multipart/alternative;"); + $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); + break; + } + + if($this->Mailer != "mail") + $result .= $this->LE.$this->LE; + + return $result; + } + + /** + * Assembles the message body. Returns an empty string on failure. + * @access private + * @return string + */ + function CreateBody() { + $result = ""; + + $this->SetWordWrap(); + + switch($this->message_type) + { + case "alt": + $result .= $this->GetBoundary($this->boundary[1], "", + "text/plain", ""); + $result .= $this->EncodeString($this->AltBody, $this->Encoding); + $result .= $this->LE.$this->LE; + $result .= $this->GetBoundary($this->boundary[1], "", + "text/html", ""); + + $result .= $this->EncodeString($this->Body, $this->Encoding); + $result .= $this->LE.$this->LE; + + $result .= $this->EndBoundary($this->boundary[1]); + break; + case "plain": + $result .= $this->EncodeString($this->Body, $this->Encoding); + break; + case "attachments": + $result .= $this->GetBoundary($this->boundary[1], "", "", ""); + $result .= $this->EncodeString($this->Body, $this->Encoding); + $result .= $this->LE; + + $result .= $this->AttachAll(); + break; + case "alt_attachments": + $result .= sprintf("--%s%s", $this->boundary[1], $this->LE); + $result .= sprintf("Content-Type: %s;%s" . + "\tboundary=\"%s\"%s", + "multipart/alternative", $this->LE, + $this->boundary[2], $this->LE.$this->LE); + + // Create text body + $result .= $this->GetBoundary($this->boundary[2], "", + "text/plain", "") . $this->LE; + + $result .= $this->EncodeString($this->AltBody, $this->Encoding); + $result .= $this->LE.$this->LE; + + // Create the HTML body + $result .= $this->GetBoundary($this->boundary[2], "", + "text/html", "") . $this->LE; + + $result .= $this->EncodeString($this->Body, $this->Encoding); + $result .= $this->LE.$this->LE; + + $result .= $this->EndBoundary($this->boundary[2]); + + $result .= $this->AttachAll(); + break; + } + if($this->IsError()) + $result = ""; + + return $result; + } + + /** + * Returns the start of a message boundary. + * @access private + */ + function GetBoundary($boundary, $charSet, $contentType, $encoding) { + $result = ""; + if($charSet == "") { $charSet = $this->CharSet; } + if($contentType == "") { $contentType = $this->ContentType; } + if($encoding == "") { $encoding = $this->Encoding; } + + $result .= $this->TextLine("--" . $boundary); + $result .= sprintf("Content-Type: %s; charset = \"%s\"", + $contentType, $charSet); + $result .= $this->LE; + $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding); + $result .= $this->LE; + + return $result; + } + + /** + * Returns the end of a message boundary. + * @access private + */ + function EndBoundary($boundary) { + return $this->LE . "--" . $boundary . "--" . $this->LE; + } + + /** + * Sets the message type. + * @access private + * @return void + */ + function SetMessageType() { + if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) + $this->message_type = "plain"; + else + { + if(count($this->attachment) > 0) + $this->message_type = "attachments"; + if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) + $this->message_type = "alt"; + if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) + $this->message_type = "alt_attachments"; + } + } + + /** + * Returns a formatted header line. + * @access private + * @return string + */ + function HeaderLine($name, $value) { + return $name . ": " . $value . $this->LE; + } + + /** + * Returns a formatted mail line. + * @access private + * @return string + */ + function TextLine($value) { + return $value . $this->LE; + } + + ///////////////////////////////////////////////// + // ATTACHMENT METHODS + ///////////////////////////////////////////////// + + /** + * Adds an attachment from a path on the filesystem. + * Returns false if the file could not be found + * or accessed. + * @param string $path Path to the attachment. + * @param string $name Overrides the attachment name. + * @param string $encoding File encoding (see $Encoding). + * @param string $type File extension (MIME) type. + * @return bool + */ + function AddAttachment($path, $name = "", $encoding = "base64", + $type = "application/octet-stream") { + if(!@is_file($path)) + { + $this->SetError($this->Lang("file_access") . $path); + return false; + } + + $filename = basename($path); + if($name == "") + $name = $filename; + + $cur = count($this->attachment); + $this->attachment[$cur][0] = $path; + $this->attachment[$cur][1] = $filename; + $this->attachment[$cur][2] = $name; + $this->attachment[$cur][3] = $encoding; + $this->attachment[$cur][4] = $type; + $this->attachment[$cur][5] = false; // isStringAttachment + $this->attachment[$cur][6] = "attachment"; + $this->attachment[$cur][7] = 0; + + return true; + } + + /** + * Attaches all fs, string, and binary attachments to the message. + * Returns an empty string on failure. + * @access private + * @return string + */ + function AttachAll() { + // Return text of body + $mime = array(); + + // Add all attachments + for($i = 0; $i < count($this->attachment); $i++) + { + // Check for string attachment + $bString = $this->attachment[$i][5]; + if ($bString) + $string = $this->attachment[$i][0]; + else + $path = $this->attachment[$i][0]; + + $filename = $this->attachment[$i][1]; + $name = $this->attachment[$i][2]; + $encoding = $this->attachment[$i][3]; + $type = $this->attachment[$i][4]; + $disposition = $this->attachment[$i][6]; + $cid = $this->attachment[$i][7]; + + $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE); + $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE); + $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE); + + if($disposition == "inline") + $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE); + + $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", + $disposition, $name, $this->LE.$this->LE); + + // Encode as string attachment + if($bString) + { + $mime[] = $this->EncodeString($string, $encoding); + if($this->IsError()) { return ""; } + $mime[] = $this->LE.$this->LE; + } + else + { + $mime[] = $this->EncodeFile($path, $encoding); + if($this->IsError()) { return ""; } + $mime[] = $this->LE.$this->LE; + } + } + + $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE); + + return join("", $mime); + } + + /** + * Encodes attachment in requested format. Returns an + * empty string on failure. + * @access private + * @return string + */ + function EncodeFile ($path, $encoding = "base64") { + if(!@$fd = fopen($path, "rb")) + { + $this->SetError($this->Lang("file_open") . $path); + return ""; + } + $magic_quotes = get_magic_quotes_runtime(); + set_magic_quotes_runtime(0); + $file_buffer = fread($fd, filesize($path)); + $file_buffer = $this->EncodeString($file_buffer, $encoding); + fclose($fd); + set_magic_quotes_runtime($magic_quotes); + + return $file_buffer; + } + + /** + * Encodes string to requested format. Returns an + * empty string on failure. + * @access private + * @return string + */ + function EncodeString ($str, $encoding = "base64") { + $encoded = ""; + switch(strtolower($encoding)) { + case "base64": + // chunk_split is found in PHP >= 3.0.6 + $encoded = chunk_split(base64_encode($str), 76, $this->LE); + break; + case "7bit": + case "8bit": + $encoded = $this->FixEOL($str); + if (substr($encoded, -(strlen($this->LE))) != $this->LE) + $encoded .= $this->LE; + break; + case "binary": + $encoded = $str; + break; + case "quoted-printable": + $encoded = $this->EncodeQP($str); + break; + default: + $this->SetError($this->Lang("encoding") . $encoding); + break; + } + return $encoded; + } + + /** + * Encode a header string to best of Q, B, quoted or none. + * @access private + * @return string + */ + function EncodeHeader ($str, $position = 'text') { + $x = 0; + + switch (strtolower($position)) { + case 'phrase': + if (!preg_match('/[\200-\377]/', $str)) { + // Can't use addslashes as we don't know what value has magic_quotes_sybase. + $encoded = addcslashes($str, "\0..\37\177\\\""); + + if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) + return ($encoded); + else + return ("\"$encoded\""); + } + $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches); + break; + case 'comment': + $x = preg_match_all('/[()"]/', $str, $matches); + // Fall-through + case 'text': + default: + $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches); + break; + } + + if ($x == 0) + return ($str); + + $maxlen = 75 - 7 - strlen($this->CharSet); + // Try to select the encoding which should produce the shortest output + if (strlen($str)/3 < $x) { + $encoding = 'B'; + $encoded = base64_encode($str); + $maxlen -= $maxlen % 4; + $encoded = trim(chunk_split($encoded, $maxlen, "\n")); + } else { + $encoding = 'Q'; + $encoded = $this->EncodeQ($str, $position); + $encoded = $this->WrapText($encoded, $maxlen, true); + $encoded = str_replace("=".$this->LE, "\n", trim($encoded)); + } + + $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded); + $encoded = trim(str_replace("\n", $this->LE, $encoded)); + + return $encoded; + } + + /** + * Encode string to quoted-printable. + * @access private + * @return string + */ + function EncodeQP ($str) { + $encoded = $this->FixEOL($str); + if (substr($encoded, -(strlen($this->LE))) != $this->LE) + $encoded .= $this->LE; + + // Replace every high ascii, control and = characters + $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e', + "'='.sprintf('%02X', ord('\\1'))", $encoded); + // Replace every spaces and tabs when it's the last character on a line + $encoded = preg_replace("/([\011\040])".$this->LE."/e", + "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded); + + // Maximum line length of 76 characters before CRLF (74 + space + '=') + $encoded = $this->WrapText($encoded, 74, true); + + return $encoded; + } + + /** + * Encode string to q encoding. + * @access private + * @return string + */ + function EncodeQ ($str, $position = "text") { + // There should not be any EOL in the string + $encoded = preg_replace("[\r\n]", "", $str); + + switch (strtolower($position)) { + case "phrase": + $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + break; + case "comment": + $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded); + case "text": + default: + // Replace every high ascii, control =, ? and _ characters + $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e', + "'='.sprintf('%02X', ord('\\1'))", $encoded); + break; + } + + // Replace every spaces to _ (more readable than =20) + $encoded = str_replace(" ", "_", $encoded); + + return $encoded; + } + + /** + * Adds a string or binary attachment (non-filesystem) to the list. + * This method can be used to attach ascii or binary data, + * such as a BLOB record from a database. + * @param string $string String attachment data. + * @param string $filename Name of the attachment. + * @param string $encoding File encoding (see $Encoding). + * @param string $type File extension (MIME) type. + * @return void + */ + function AddStringAttachment($string, $filename, $encoding = "base64", + $type = "application/octet-stream") { + // Append to $attachment array + $cur = count($this->attachment); + $this->attachment[$cur][0] = $string; + $this->attachment[$cur][1] = $filename; + $this->attachment[$cur][2] = $filename; + $this->attachment[$cur][3] = $encoding; + $this->attachment[$cur][4] = $type; + $this->attachment[$cur][5] = true; // isString + $this->attachment[$cur][6] = "attachment"; + $this->attachment[$cur][7] = 0; + } + + /** + * Adds an embedded attachment. This can include images, sounds, and + * just about any other document. Make sure to set the $type to an + * image type. For JPEG images use "image/jpeg" and for GIF images + * use "image/gif". + * @param string $path Path to the attachment. + * @param string $cid Content ID of the attachment. Use this to identify + * the Id for accessing the image in an HTML form. + * @param string $name Overrides the attachment name. + * @param string $encoding File encoding (see $Encoding). + * @param string $type File extension (MIME) type. + * @return bool + */ + function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64", + $type = "application/octet-stream") { + + if(!@is_file($path)) + { + $this->SetError($this->Lang("file_access") . $path); + return false; + } + + $filename = basename($path); + if($name == "") + $name = $filename; + + // Append to $attachment array + $cur = count($this->attachment); + $this->attachment[$cur][0] = $path; + $this->attachment[$cur][1] = $filename; + $this->attachment[$cur][2] = $name; + $this->attachment[$cur][3] = $encoding; + $this->attachment[$cur][4] = $type; + $this->attachment[$cur][5] = false; // isStringAttachment + $this->attachment[$cur][6] = "inline"; + $this->attachment[$cur][7] = $cid; + + return true; + } + + /** + * Returns true if an inline attachment is present. + * @access private + * @return bool + */ + function InlineImageExists() { + $result = false; + for($i = 0; $i < count($this->attachment); $i++) + { + if($this->attachment[$i][6] == "inline") + { + $result = true; + break; + } + } + + return $result; + } + + ///////////////////////////////////////////////// + // MESSAGE RESET METHODS + ///////////////////////////////////////////////// + + /** + * Clears all recipients assigned in the TO array. Returns void. + * @return void + */ + function ClearAddresses() { + $this->to = array(); + } + + /** + * Clears all recipients assigned in the CC array. Returns void. + * @return void + */ + function ClearCCs() { + $this->cc = array(); + } + + /** + * Clears all recipients assigned in the BCC array. Returns void. + * @return void + */ + function ClearBCCs() { + $this->bcc = array(); + } + + /** + * Clears all recipients assigned in the ReplyTo array. Returns void. + * @return void + */ + function ClearReplyTos() { + $this->ReplyTo = array(); + } + + /** + * Clears all recipients assigned in the TO, CC and BCC + * array. Returns void. + * @return void + */ + function ClearAllRecipients() { + $this->to = array(); + $this->cc = array(); + $this->bcc = array(); + } + + /** + * Clears all previously set filesystem, string, and binary + * attachments. Returns void. + * @return void + */ + function ClearAttachments() { + $this->attachment = array(); + } + + /** + * Clears all custom headers. Returns void. + * @return void + */ + function ClearCustomHeaders() { + $this->CustomHeader = array(); + } + + + ///////////////////////////////////////////////// + // MISCELLANEOUS METHODS + ///////////////////////////////////////////////// + + /** + * Adds the error message to the error container. + * Returns void. + * @access private + * @return void + */ + function SetError($msg) { + $this->error_count++; + $this->ErrorInfo = $msg; + } + + /** + * Returns the proper RFC 822 formatted date. + * @access private + * @return string + */ + function RFCDate() { + $tz = date("Z"); + $tzs = ($tz < 0) ? "-" : "+"; + $tz = abs($tz); + $tz = ($tz/3600)*100 + ($tz%3600)/60; + $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz); + + return $result; + } + + /** + * Returns the appropriate server variable. Should work with both + * PHP 4.1.0+ as well as older versions. Returns an empty string + * if nothing is found. + * @access private + * @return mixed + */ + function ServerVar($varName) { + global $HTTP_SERVER_VARS; + global $HTTP_ENV_VARS; + + if(!isset($_SERVER)) + { + $_SERVER = $HTTP_SERVER_VARS; + if(!isset($_SERVER["REMOTE_ADDR"])) + $_SERVER = $HTTP_ENV_VARS; // must be Apache + } + + if(isset($_SERVER[$varName])) + return $_SERVER[$varName]; + else + return ""; + } + + /** + * Returns the server hostname or 'localhost.localdomain' if unknown. + * @access private + * @return string + */ + function ServerHostname() { + if ($this->Hostname != "") + $result = $this->Hostname; + elseif ($this->ServerVar('SERVER_NAME') != "") + $result = $this->ServerVar('SERVER_NAME'); + else + $result = "localhost.localdomain"; + + return $result; + } + + /** + * Returns a message in the appropriate language. + * @access private + * @return string + */ + function Lang($key) { + if(count($this->language) < 1) + $this->SetLanguage("en"); // set the default language + + if(isset($this->language[$key])) + return $this->language[$key]; + else + return "Language string failed to load: " . $key; + } + + /** + * Returns true if an error occurred. + * @return bool + */ + function IsError() { + return ($this->error_count > 0); + } + + /** + * Changes every end of line from CR or LF to CRLF. + * @access private + * @return string + */ + function FixEOL($str) { + $str = str_replace("\r\n", "\n", $str); + $str = str_replace("\r", "\n", $str); + $str = str_replace("\n", $this->LE, $str); + return $str; + } + + /** + * Adds a custom header. + * @return void + */ + function AddCustomHeader($custom_header) { + $this->CustomHeader[] = explode(":", $custom_header, 2); + } } ?> diff --git a/libraries/phpmailer/smtp.php b/libraries/phpmailer/smtp.php index 74abb06ef588f..3e5e4d2a9b785 100644 --- a/libraries/phpmailer/smtp.php +++ b/libraries/phpmailer/smtp.php @@ -23,1021 +23,1021 @@ */ class SMTP { - /** - * SMTP server port - * @var int - */ - var $SMTP_PORT = 25; - - /** - * SMTP reply line ending - * @var string - */ - var $CRLF = "\r\n"; - - /** - * Sets whether debugging is turned on - * @var bool - */ - var $do_debug; # the level of debug to perform - - /**#@+ - * @access private - */ - var $smtp_conn; # the socket to the server - var $error; # error if any on the last call - var $helo_rply; # the reply the server sent to us for HELO - /**#@-*/ - - /** - * Initialize the class so that the data is in a known state. - * @access public - * @return void - */ - function SMTP() { - $this->smtp_conn = 0; - $this->error = null; - $this->helo_rply = null; - - $this->do_debug = 0; - } - - /************************************************************* - * CONNECTION FUNCTIONS * - ***********************************************************/ - - /** - * Connect to the server specified on the port specified. - * If the port is not specified use the default SMTP_PORT. - * If tval is specified then a connection will try and be - * established with the server for that number of seconds. - * If tval is not specified the default is 30 seconds to - * try on the connection. - * - * SMTP CODE SUCCESS: 220 - * SMTP CODE FAILURE: 421 - * @access public - * @return bool - */ - function Connect($host,$port=0,$tval=30) { - # set the error val to null so there is no confusion - $this->error = null; - - # make sure we are __not__ connected - if($this->connected()) { - # ok we are connected! what should we do? - # for now we will just give an error saying we - # are already connected - $this->error = - array("error" => "Already connected to a server"); - return false; - } - - if(empty($port)) { - $port = $this->SMTP_PORT; - } - - #connect to the smtp server - $this->smtp_conn = fsockopen($host, # the host of the server - $port, # the port to use - $errno, # error number if any - $errstr, # error message if any - $tval); # give up after ? secs - # verify we connected properly - if(empty($this->smtp_conn)) { - $this->error = array("error" => "Failed to connect to server", - "errno" => $errno, - "errstr" => $errstr); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": $errstr ($errno)" . $this->CRLF; - } - return false; - } - - # sometimes the SMTP server takes a little longer to respond - # so we will give it a longer timeout for the first read - // Windows still does not have support for this timeout function - if(substr(PHP_OS, 0, 3) != "WIN") - socket_set_timeout($this->smtp_conn, $tval, 0); - - # get any announcement stuff - $announce = $this->get_lines(); - - # set the timeout of any socket functions at 1/10 of a second - //if(function_exists("socket_set_timeout")) - // socket_set_timeout($this->smtp_conn, 0, 100000); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce; - } - - return true; - } - - /** - * Performs SMTP authentication. Must be run after running the - * Hello() method. Returns true if successfully authenticated. - * @access public - * @return bool - */ - function Authenticate($username, $password) { - // Start authentication - fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($code != 334) { - $this->error = - array("error" => "AUTH not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - // Send encoded username - fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($code != 334) { - $this->error = - array("error" => "Username not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - // Send encoded password - fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($code != 235) { - $this->error = - array("error" => "Password not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - return true; - } - - /** - * Returns true if connected to a server otherwise false - * @access private - * @return bool - */ - function Connected() { - if(!empty($this->smtp_conn)) { - $sock_status = socket_get_status($this->smtp_conn); - if($sock_status["eof"]) { - # hmm this is an odd situation... the socket is - # valid but we aren't connected anymore - if($this->do_debug >= 1) { - echo "SMTP -> NOTICE:" . $this->CRLF . - "EOF caught while checking if connected"; - } - $this->Close(); - return false; - } - return true; # everything looks good - } - return false; - } - - /** - * Closes the socket and cleans up the state of the class. - * It is not considered good to use this function without - * first trying to use QUIT. - * @access public - * @return void - */ - function Close() { - $this->error = null; # so there is no confusion - $this->helo_rply = null; - if(!empty($this->smtp_conn)) { - # close the connection and cleanup - fclose($this->smtp_conn); - $this->smtp_conn = 0; - } - } - - - /*************************************************************** - * SMTP COMMANDS * - *************************************************************/ - - /** - * Issues a data command and sends the msg_data to the server - * finializing the mail transaction. $msg_data is the message - * that is to be send with the headers. Each header needs to be - * on a single line followed by a with the message headers - * and the message body being seperated by and additional . - * - * Implements rfc 821: DATA - * - * SMTP CODE INTERMEDIATE: 354 - * [data] - * . - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 552,554,451,452 - * SMTP CODE FAILURE: 451,554 - * SMTP CODE ERROR : 500,501,503,421 - * @access public - * @return bool - */ - function Data($msg_data) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Data() without being connected"); - return false; - } - - fputs($this->smtp_conn,"DATA" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 354) { - $this->error = - array("error" => "DATA command not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - # the server is ready to accept data! - # according to rfc 821 we should not send more than 1000 - # including the CRLF - # characters on a single line so we will break the data up - # into lines by \r and/or \n then if needed we will break - # each of those into smaller lines to fit within the limit. - # in addition we will be looking for lines that start with - # a period '.' and append and additional period '.' to that - # line. NOTE: this does not count towards are limit. - - # normalize the line breaks so we know the explode works - $msg_data = str_replace("\r\n","\n",$msg_data); - $msg_data = str_replace("\r","\n",$msg_data); - $lines = explode("\n",$msg_data); - - # we need to find a good way to determine is headers are - # in the msg_data or if it is a straight msg body - # currently I'm assuming rfc 822 definitions of msg headers - # and if the first field of the first line (':' sperated) - # does not contain a space then it _should_ be a header - # and we can process all lines before a blank "" line as - # headers. - $field = substr($lines[0],0,strpos($lines[0],":")); - $in_headers = false; - if(!empty($field) && !strstr($field," ")) { - $in_headers = true; - } - - $max_line_length = 998; # used below; set here for ease in change - - while(list(,$line) = @each($lines)) { - $lines_out = null; - if($line == "" && $in_headers) { - $in_headers = false; - } - # ok we need to break this line up into several - # smaller lines - while(strlen($line) > $max_line_length) { - $pos = strrpos(substr($line,0,$max_line_length)," "); - - # Patch to fix DOS attack - if(!$pos) { - $pos = $max_line_length - 1; - } - - $lines_out[] = substr($line,0,$pos); - $line = substr($line,$pos + 1); - # if we are processing headers we need to - # add a LWSP-char to the front of the new line - # rfc 822 on long msg headers - if($in_headers) { - $line = "\t" . $line; - } - } - $lines_out[] = $line; - - # now send the lines to the server - while(list(,$line_out) = @each($lines_out)) { - if(strlen($line_out) > 0) - { - if(substr($line_out, 0, 1) == ".") { - $line_out = "." . $line_out; - } - } - fputs($this->smtp_conn,$line_out . $this->CRLF); - } - } - - # ok all the message data has been sent so lets get this - # over with aleady - fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "DATA not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Expand takes the name and asks the server to list all the - * people who are members of the _list_. Expand will return - * back and array of the result or false if an error occurs. - * Each value in the array returned has the format of: - * [ ] - * The definition of is defined in rfc 821 - * - * Implements rfc 821: EXPN - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 550 - * SMTP CODE ERROR : 500,501,502,504,421 - * @access public - * @return string array - */ - function Expand($name) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Expand() without being connected"); - return false; - } - - fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "EXPN not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - # parse the reply and place in our array to return to user - $entries = explode($this->CRLF,$rply); - while(list(,$l) = @each($entries)) { - $list[] = substr($l,4); - } - - return $list; - } - - /** - * Sends the HELO command to the smtp server. - * This makes sure that we and the server are in - * the same known state. - * - * Implements from rfc 821: HELO - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500, 501, 504, 421 - * @access public - * @return bool - */ - function Hello($host="") { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Hello() without being connected"); - return false; - } - - # if a hostname for the HELO wasn't specified determine - # a suitable one to send - if(empty($host)) { - # we need to determine some sort of appopiate default - # to send to the server - $host = "localhost"; - } - - // Send extended hello first (RFC 2821) - if(!$this->SendHello("EHLO", $host)) - { - if(!$this->SendHello("HELO", $host)) - return false; - } - - return true; - } - - /** - * Sends a HELO/EHLO command. - * @access private - * @return bool - */ - function SendHello($hello, $host) { - fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => $hello . " not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - $this->helo_rply = $rply; - - return true; - } - - /** - * Gets help information on the keyword specified. If the keyword - * is not specified then returns generic help, ussually contianing - * A list of keywords that help is available on. This function - * returns the results back to the user. It is up to the user to - * handle the returned data. If an error occurs then false is - * returned with $this->error set appropiately. - * - * Implements rfc 821: HELP [ ] - * - * SMTP CODE SUCCESS: 211,214 - * SMTP CODE ERROR : 500,501,502,504,421 - * @access public - * @return string - */ - function Help($keyword="") { - $this->error = null; # to avoid confusion - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Help() without being connected"); - return false; - } - - $extra = ""; - if(!empty($keyword)) { - $extra = " " . $keyword; - } - - fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 211 && $code != 214) { - $this->error = - array("error" => "HELP not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - return $rply; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. - * - * Implements rfc 821: MAIL FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,421 - * @access public - * @return bool - */ - function Mail($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Mail() without being connected"); - return false; - } - - fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "MAIL not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Sends the command NOOP to the SMTP server. - * - * Implements from rfc 821: NOOP - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500, 421 - * @access public - * @return bool - */ - function Noop() { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Noop() without being connected"); - return false; - } - - fputs($this->smtp_conn,"NOOP" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "NOOP not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Sends the quit command to the server and then closes the socket - * if there is no error or the $close_on_error argument is true. - * - * Implements from rfc 821: QUIT - * - * SMTP CODE SUCCESS: 221 - * SMTP CODE ERROR : 500 - * @access public - * @return bool - */ - function Quit($close_on_error=true) { - $this->error = null; # so there is no confusion - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Quit() without being connected"); - return false; - } - - # send the quit command to the server - fputs($this->smtp_conn,"quit" . $this->CRLF); - - # get any good-bye messages - $byemsg = $this->get_lines(); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg; - } - - $rval = true; - $e = null; - - $code = substr($byemsg,0,3); - if($code != 221) { - # use e as a tmp var cause Close will overwrite $this->error - $e = array("error" => "SMTP server rejected quit command", - "smtp_code" => $code, - "smtp_rply" => substr($byemsg,4)); - $rval = false; - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $e["error"] . ": " . - $byemsg . $this->CRLF; - } - } - - if(empty($e) || $close_on_error) { - $this->Close(); - } - - return $rval; - } - - /** - * Sends the command RCPT to the SMTP server with the TO: argument of $to. - * Returns true if the recipient was accepted false if it was rejected. - * - * Implements from rfc 821: RCPT TO: - * - * SMTP CODE SUCCESS: 250,251 - * SMTP CODE FAILURE: 550,551,552,553,450,451,452 - * SMTP CODE ERROR : 500,501,503,421 - * @access public - * @return bool - */ - function Recipient($to) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Recipient() without being connected"); - return false; - } - - fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250 && $code != 251) { - $this->error = - array("error" => "RCPT not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Sends the RSET command to abort and transaction that is - * currently in progress. Returns true if successful false - * otherwise. - * - * Implements rfc 821: RSET - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE ERROR : 500,501,504,421 - * @access public - * @return bool - */ - function Reset() { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Reset() without being connected"); - return false; - } - - fputs($this->smtp_conn,"RSET" . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "RSET failed", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - - return true; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the users terminal if they are logged - * in. - * - * Implements rfc 821: SEND FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,502,421 - * @access public - * @return bool - */ - function Send($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Send() without being connected"); - return false; - } - - fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "SEND not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the users terminal if they are logged - * in and send them an email. - * - * Implements rfc 821: SAML FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,502,421 - * @access public - * @return bool - */ - function SendAndMail($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called SendAndMail() without being connected"); - return false; - } - - fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "SAML not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * Starts a mail transaction from the email address specified in - * $from. Returns true if successful or false otherwise. If True - * the mail transaction is started and then one or more Recipient - * commands may be called followed by a Data command. This command - * will send the message to the users terminal if they are logged - * in or mail it to them if they are not. - * - * Implements rfc 821: SOML FROM: - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE SUCCESS: 552,451,452 - * SMTP CODE SUCCESS: 500,501,502,421 - * @access public - * @return bool - */ - function SendOrMail($from) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called SendOrMail() without being connected"); - return false; - } - - fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250) { - $this->error = - array("error" => "SOML not accepted from server", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return true; - } - - /** - * This is an optional command for SMTP that this class does not - * support. This method is here to make the RFC821 Definition - * complete for this class and __may__ be implimented in the future - * - * Implements from rfc 821: TURN - * - * SMTP CODE SUCCESS: 250 - * SMTP CODE FAILURE: 502 - * SMTP CODE ERROR : 500, 503 - * @access public - * @return bool - */ - function Turn() { - $this->error = array("error" => "This method, TURN, of the SMTP ". - "is not implemented"); - if($this->do_debug >= 1) { - echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF; - } - return false; - } - - /** - * Verifies that the name is recognized by the server. - * Returns false if the name could not be verified otherwise - * the response from the server is returned. - * - * Implements rfc 821: VRFY - * - * SMTP CODE SUCCESS: 250,251 - * SMTP CODE FAILURE: 550,551,553 - * SMTP CODE ERROR : 500,501,502,421 - * @access public - * @return int - */ - function Verify($name) { - $this->error = null; # so no confusion is caused - - if(!$this->connected()) { - $this->error = array( - "error" => "Called Verify() without being connected"); - return false; - } - - fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF); - - $rply = $this->get_lines(); - $code = substr($rply,0,3); - - if($this->do_debug >= 2) { - echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; - } - - if($code != 250 && $code != 251) { - $this->error = - array("error" => "VRFY failed on name '$name'", - "smtp_code" => $code, - "smtp_msg" => substr($rply,4)); - if($this->do_debug >= 1) { - echo "SMTP -> ERROR: " . $this->error["error"] . - ": " . $rply . $this->CRLF; - } - return false; - } - return $rply; - } - - /******************************************************************* - * INTERNAL FUNCTIONS * - ******************************************************************/ - - /** - * Read in as many lines as possible - * either before eof or socket timeout occurs on the operation. - * With SMTP we can tell if we have more lines to read if the - * 4th character is '-' symbol. If it is a space then we don't - * need to read anything else. - * @access private - * @return string - */ - function get_lines() { - $data = ""; - while($str = fgets($this->smtp_conn,515)) { - if($this->do_debug >= 4) { - echo "SMTP -> get_lines(): \$data was \"$data\"" . - $this->CRLF; - echo "SMTP -> get_lines(): \$str is \"$str\"" . - $this->CRLF; - } - $data .= $str; - if($this->do_debug >= 4) { - echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF; - } - # if the 4th character is a space then we are done reading - # so just break the loop - if(substr($str,3,1) == " ") { break; } - } - return $data; - } + /** + * SMTP server port + * @var int + */ + var $SMTP_PORT = 25; + + /** + * SMTP reply line ending + * @var string + */ + var $CRLF = "\r\n"; + + /** + * Sets whether debugging is turned on + * @var bool + */ + var $do_debug; # the level of debug to perform + + /**#@+ + * @access private + */ + var $smtp_conn; # the socket to the server + var $error; # error if any on the last call + var $helo_rply; # the reply the server sent to us for HELO + /**#@-*/ + + /** + * Initialize the class so that the data is in a known state. + * @access public + * @return void + */ + function SMTP() { + $this->smtp_conn = 0; + $this->error = null; + $this->helo_rply = null; + + $this->do_debug = 0; + } + + /************************************************************* + * CONNECTION FUNCTIONS * + ***********************************************************/ + + /** + * Connect to the server specified on the port specified. + * If the port is not specified use the default SMTP_PORT. + * If tval is specified then a connection will try and be + * established with the server for that number of seconds. + * If tval is not specified the default is 30 seconds to + * try on the connection. + * + * SMTP CODE SUCCESS: 220 + * SMTP CODE FAILURE: 421 + * @access public + * @return bool + */ + function Connect($host,$port=0,$tval=30) { + # set the error val to null so there is no confusion + $this->error = null; + + # make sure we are __not__ connected + if($this->connected()) { + # ok we are connected! what should we do? + # for now we will just give an error saying we + # are already connected + $this->error = + array("error" => "Already connected to a server"); + return false; + } + + if(empty($port)) { + $port = $this->SMTP_PORT; + } + + #connect to the smtp server + $this->smtp_conn = fsockopen($host, # the host of the server + $port, # the port to use + $errno, # error number if any + $errstr, # error message if any + $tval); # give up after ? secs + # verify we connected properly + if(empty($this->smtp_conn)) { + $this->error = array("error" => "Failed to connect to server", + "errno" => $errno, + "errstr" => $errstr); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": $errstr ($errno)" . $this->CRLF; + } + return false; + } + + # sometimes the SMTP server takes a little longer to respond + # so we will give it a longer timeout for the first read + // Windows still does not have support for this timeout function + if(substr(PHP_OS, 0, 3) != "WIN") + socket_set_timeout($this->smtp_conn, $tval, 0); + + # get any announcement stuff + $announce = $this->get_lines(); + + # set the timeout of any socket functions at 1/10 of a second + //if(function_exists("socket_set_timeout")) + // socket_set_timeout($this->smtp_conn, 0, 100000); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce; + } + + return true; + } + + /** + * Performs SMTP authentication. Must be run after running the + * Hello() method. Returns true if successfully authenticated. + * @access public + * @return bool + */ + function Authenticate($username, $password) { + // Start authentication + fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 334) { + $this->error = + array("error" => "AUTH not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + + // Send encoded username + fputs($this->smtp_conn, base64_encode($username) . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 334) { + $this->error = + array("error" => "Username not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + + // Send encoded password + fputs($this->smtp_conn, base64_encode($password) . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($code != 235) { + $this->error = + array("error" => "Password not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + + return true; + } + + /** + * Returns true if connected to a server otherwise false + * @access private + * @return bool + */ + function Connected() { + if(!empty($this->smtp_conn)) { + $sock_status = socket_get_status($this->smtp_conn); + if($sock_status["eof"]) { + # hmm this is an odd situation... the socket is + # valid but we aren't connected anymore + if($this->do_debug >= 1) { + echo "SMTP -> NOTICE:" . $this->CRLF . + "EOF caught while checking if connected"; + } + $this->Close(); + return false; + } + return true; # everything looks good + } + return false; + } + + /** + * Closes the socket and cleans up the state of the class. + * It is not considered good to use this function without + * first trying to use QUIT. + * @access public + * @return void + */ + function Close() { + $this->error = null; # so there is no confusion + $this->helo_rply = null; + if(!empty($this->smtp_conn)) { + # close the connection and cleanup + fclose($this->smtp_conn); + $this->smtp_conn = 0; + } + } + + + /*************************************************************** + * SMTP COMMANDS * + *************************************************************/ + + /** + * Issues a data command and sends the msg_data to the server + * finializing the mail transaction. $msg_data is the message + * that is to be send with the headers. Each header needs to be + * on a single line followed by a with the message headers + * and the message body being seperated by and additional . + * + * Implements rfc 821: DATA + * + * SMTP CODE INTERMEDIATE: 354 + * [data] + * . + * SMTP CODE SUCCESS: 250 + * SMTP CODE FAILURE: 552,554,451,452 + * SMTP CODE FAILURE: 451,554 + * SMTP CODE ERROR : 500,501,503,421 + * @access public + * @return bool + */ + function Data($msg_data) { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Data() without being connected"); + return false; + } + + fputs($this->smtp_conn,"DATA" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 354) { + $this->error = + array("error" => "DATA command not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + + # the server is ready to accept data! + # according to rfc 821 we should not send more than 1000 + # including the CRLF + # characters on a single line so we will break the data up + # into lines by \r and/or \n then if needed we will break + # each of those into smaller lines to fit within the limit. + # in addition we will be looking for lines that start with + # a period '.' and append and additional period '.' to that + # line. NOTE: this does not count towards are limit. + + # normalize the line breaks so we know the explode works + $msg_data = str_replace("\r\n","\n",$msg_data); + $msg_data = str_replace("\r","\n",$msg_data); + $lines = explode("\n",$msg_data); + + # we need to find a good way to determine is headers are + # in the msg_data or if it is a straight msg body + # currently I'm assuming rfc 822 definitions of msg headers + # and if the first field of the first line (':' sperated) + # does not contain a space then it _should_ be a header + # and we can process all lines before a blank "" line as + # headers. + $field = substr($lines[0],0,strpos($lines[0],":")); + $in_headers = false; + if(!empty($field) && !strstr($field," ")) { + $in_headers = true; + } + + $max_line_length = 998; # used below; set here for ease in change + + while(list(,$line) = @each($lines)) { + $lines_out = null; + if($line == "" && $in_headers) { + $in_headers = false; + } + # ok we need to break this line up into several + # smaller lines + while(strlen($line) > $max_line_length) { + $pos = strrpos(substr($line,0,$max_line_length)," "); + + # Patch to fix DOS attack + if(!$pos) { + $pos = $max_line_length - 1; + } + + $lines_out[] = substr($line,0,$pos); + $line = substr($line,$pos + 1); + # if we are processing headers we need to + # add a LWSP-char to the front of the new line + # rfc 822 on long msg headers + if($in_headers) { + $line = "\t" . $line; + } + } + $lines_out[] = $line; + + # now send the lines to the server + while(list(,$line_out) = @each($lines_out)) { + if(strlen($line_out) > 0) + { + if(substr($line_out, 0, 1) == ".") { + $line_out = "." . $line_out; + } + } + fputs($this->smtp_conn,$line_out . $this->CRLF); + } + } + + # ok all the message data has been sent so lets get this + # over with aleady + fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 250) { + $this->error = + array("error" => "DATA not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + return true; + } + + /** + * Expand takes the name and asks the server to list all the + * people who are members of the _list_. Expand will return + * back and array of the result or false if an error occurs. + * Each value in the array returned has the format of: + * [ ] + * The definition of is defined in rfc 821 + * + * Implements rfc 821: EXPN + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE FAILURE: 550 + * SMTP CODE ERROR : 500,501,502,504,421 + * @access public + * @return string array + */ + function Expand($name) { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Expand() without being connected"); + return false; + } + + fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 250) { + $this->error = + array("error" => "EXPN not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + + # parse the reply and place in our array to return to user + $entries = explode($this->CRLF,$rply); + while(list(,$l) = @each($entries)) { + $list[] = substr($l,4); + } + + return $list; + } + + /** + * Sends the HELO command to the smtp server. + * This makes sure that we and the server are in + * the same known state. + * + * Implements from rfc 821: HELO + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE ERROR : 500, 501, 504, 421 + * @access public + * @return bool + */ + function Hello($host="") { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Hello() without being connected"); + return false; + } + + # if a hostname for the HELO wasn't specified determine + # a suitable one to send + if(empty($host)) { + # we need to determine some sort of appopiate default + # to send to the server + $host = "localhost"; + } + + // Send extended hello first (RFC 2821) + if(!$this->SendHello("EHLO", $host)) + { + if(!$this->SendHello("HELO", $host)) + return false; + } + + return true; + } + + /** + * Sends a HELO/EHLO command. + * @access private + * @return bool + */ + function SendHello($hello, $host) { + fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply; + } + + if($code != 250) { + $this->error = + array("error" => $hello . " not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + + $this->helo_rply = $rply; + + return true; + } + + /** + * Gets help information on the keyword specified. If the keyword + * is not specified then returns generic help, ussually contianing + * A list of keywords that help is available on. This function + * returns the results back to the user. It is up to the user to + * handle the returned data. If an error occurs then false is + * returned with $this->error set appropiately. + * + * Implements rfc 821: HELP [ ] + * + * SMTP CODE SUCCESS: 211,214 + * SMTP CODE ERROR : 500,501,502,504,421 + * @access public + * @return string + */ + function Help($keyword="") { + $this->error = null; # to avoid confusion + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Help() without being connected"); + return false; + } + + $extra = ""; + if(!empty($keyword)) { + $extra = " " . $keyword; + } + + fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 211 && $code != 214) { + $this->error = + array("error" => "HELP not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + + return $rply; + } + + /** + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more Recipient + * commands may be called followed by a Data command. + * + * Implements rfc 821: MAIL FROM: + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE SUCCESS: 552,451,452 + * SMTP CODE SUCCESS: 500,501,421 + * @access public + * @return bool + */ + function Mail($from) { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Mail() without being connected"); + return false; + } + + fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 250) { + $this->error = + array("error" => "MAIL not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + return true; + } + + /** + * Sends the command NOOP to the SMTP server. + * + * Implements from rfc 821: NOOP + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE ERROR : 500, 421 + * @access public + * @return bool + */ + function Noop() { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Noop() without being connected"); + return false; + } + + fputs($this->smtp_conn,"NOOP" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 250) { + $this->error = + array("error" => "NOOP not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + return true; + } + + /** + * Sends the quit command to the server and then closes the socket + * if there is no error or the $close_on_error argument is true. + * + * Implements from rfc 821: QUIT + * + * SMTP CODE SUCCESS: 221 + * SMTP CODE ERROR : 500 + * @access public + * @return bool + */ + function Quit($close_on_error=true) { + $this->error = null; # so there is no confusion + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Quit() without being connected"); + return false; + } + + # send the quit command to the server + fputs($this->smtp_conn,"quit" . $this->CRLF); + + # get any good-bye messages + $byemsg = $this->get_lines(); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg; + } + + $rval = true; + $e = null; + + $code = substr($byemsg,0,3); + if($code != 221) { + # use e as a tmp var cause Close will overwrite $this->error + $e = array("error" => "SMTP server rejected quit command", + "smtp_code" => $code, + "smtp_rply" => substr($byemsg,4)); + $rval = false; + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $e["error"] . ": " . + $byemsg . $this->CRLF; + } + } + + if(empty($e) || $close_on_error) { + $this->Close(); + } + + return $rval; + } + + /** + * Sends the command RCPT to the SMTP server with the TO: argument of $to. + * Returns true if the recipient was accepted false if it was rejected. + * + * Implements from rfc 821: RCPT TO: + * + * SMTP CODE SUCCESS: 250,251 + * SMTP CODE FAILURE: 550,551,552,553,450,451,452 + * SMTP CODE ERROR : 500,501,503,421 + * @access public + * @return bool + */ + function Recipient($to) { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Recipient() without being connected"); + return false; + } + + fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 250 && $code != 251) { + $this->error = + array("error" => "RCPT not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + return true; + } + + /** + * Sends the RSET command to abort and transaction that is + * currently in progress. Returns true if successful false + * otherwise. + * + * Implements rfc 821: RSET + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE ERROR : 500,501,504,421 + * @access public + * @return bool + */ + function Reset() { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Reset() without being connected"); + return false; + } + + fputs($this->smtp_conn,"RSET" . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 250) { + $this->error = + array("error" => "RSET failed", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + + return true; + } + + /** + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more Recipient + * commands may be called followed by a Data command. This command + * will send the message to the users terminal if they are logged + * in. + * + * Implements rfc 821: SEND FROM: + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE SUCCESS: 552,451,452 + * SMTP CODE SUCCESS: 500,501,502,421 + * @access public + * @return bool + */ + function Send($from) { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Send() without being connected"); + return false; + } + + fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 250) { + $this->error = + array("error" => "SEND not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + return true; + } + + /** + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more Recipient + * commands may be called followed by a Data command. This command + * will send the message to the users terminal if they are logged + * in and send them an email. + * + * Implements rfc 821: SAML FROM: + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE SUCCESS: 552,451,452 + * SMTP CODE SUCCESS: 500,501,502,421 + * @access public + * @return bool + */ + function SendAndMail($from) { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called SendAndMail() without being connected"); + return false; + } + + fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 250) { + $this->error = + array("error" => "SAML not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + return true; + } + + /** + * Starts a mail transaction from the email address specified in + * $from. Returns true if successful or false otherwise. If True + * the mail transaction is started and then one or more Recipient + * commands may be called followed by a Data command. This command + * will send the message to the users terminal if they are logged + * in or mail it to them if they are not. + * + * Implements rfc 821: SOML FROM: + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE SUCCESS: 552,451,452 + * SMTP CODE SUCCESS: 500,501,502,421 + * @access public + * @return bool + */ + function SendOrMail($from) { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called SendOrMail() without being connected"); + return false; + } + + fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 250) { + $this->error = + array("error" => "SOML not accepted from server", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + return true; + } + + /** + * This is an optional command for SMTP that this class does not + * support. This method is here to make the RFC821 Definition + * complete for this class and __may__ be implimented in the future + * + * Implements from rfc 821: TURN + * + * SMTP CODE SUCCESS: 250 + * SMTP CODE FAILURE: 502 + * SMTP CODE ERROR : 500, 503 + * @access public + * @return bool + */ + function Turn() { + $this->error = array("error" => "This method, TURN, of the SMTP ". + "is not implemented"); + if($this->do_debug >= 1) { + echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF; + } + return false; + } + + /** + * Verifies that the name is recognized by the server. + * Returns false if the name could not be verified otherwise + * the response from the server is returned. + * + * Implements rfc 821: VRFY + * + * SMTP CODE SUCCESS: 250,251 + * SMTP CODE FAILURE: 550,551,553 + * SMTP CODE ERROR : 500,501,502,421 + * @access public + * @return int + */ + function Verify($name) { + $this->error = null; # so no confusion is caused + + if(!$this->connected()) { + $this->error = array( + "error" => "Called Verify() without being connected"); + return false; + } + + fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF); + + $rply = $this->get_lines(); + $code = substr($rply,0,3); + + if($this->do_debug >= 2) { + echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply; + } + + if($code != 250 && $code != 251) { + $this->error = + array("error" => "VRFY failed on name '$name'", + "smtp_code" => $code, + "smtp_msg" => substr($rply,4)); + if($this->do_debug >= 1) { + echo "SMTP -> ERROR: " . $this->error["error"] . + ": " . $rply . $this->CRLF; + } + return false; + } + return $rply; + } + + /******************************************************************* + * INTERNAL FUNCTIONS * + ******************************************************************/ + + /** + * Read in as many lines as possible + * either before eof or socket timeout occurs on the operation. + * With SMTP we can tell if we have more lines to read if the + * 4th character is '-' symbol. If it is a space then we don't + * need to read anything else. + * @access private + * @return string + */ + function get_lines() { + $data = ""; + while($str = fgets($this->smtp_conn,515)) { + if($this->do_debug >= 4) { + echo "SMTP -> get_lines(): \$data was \"$data\"" . + $this->CRLF; + echo "SMTP -> get_lines(): \$str is \"$str\"" . + $this->CRLF; + } + $data .= $str; + if($this->do_debug >= 4) { + echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF; + } + # if the 4th character is a space then we are done reading + # so just break the loop + if(substr($str,3,1) == " ") { break; } + } + return $data; + } } diff --git a/libraries/phputf8/LICENSE b/libraries/phputf8/LICENSE deleted file mode 100644 index 8add30ad590a6..0000000000000 --- a/libraries/phputf8/LICENSE +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/libraries/phputf8/README b/libraries/phputf8/README deleted file mode 100644 index 9d14d91dcfc19..0000000000000 --- a/libraries/phputf8/README +++ /dev/null @@ -1,85 +0,0 @@ -++PHP UTF-8++ - -Version 0.1 - -++DOCUMENTATION++ - -Nothing yet, other than source code documentation. A tutorial on -how to handle UTF-8 with this library is pending. You will find help at; - -http://www.phpwact.org/php/i18n/charsets -http://www.phpwact.org/php/i18n/utf-8 - -Important Note: DO NOT use these functions without understanding WHY -you are using them. In particular, do not blindly replace all use of PHP's -string functions which functions found here - most of the time you will -not need to, and you will be introducing a significant performance -overhead to your application. You can get a good idea of when to use what -from reading: http://www.phpwact.org/php/i18n/utf-8 - -Important Note: For sake of performance most of the functions here are -not "defensive" (e.g. there is not extensive parameter checking, well -formed UTF-8 is assumed). This is particularily relevant when is comes to -catching badly formed UTF-8 - you should screen input on the "outer -perimeter" with help from functions in the utf8_validation.php and -utf8_bad.php files. - -Important Note: this library treats ALL ASCII characters as valid, including ASCII control characters. But if you use some ASCII control characters in XML, it will render the XML ill-formed. Don't be a bozo: http://hsivonen.iki.fi/producing-xml/#controlchar - -++BUGS / SUPPORT / FEATURE REQUESTS ++ - -Please report bugs to: -http://sourceforge.net/tracker/?group_id=142846&atid=753842 -- if you are able, please submit a failing unit test -(http://www.lastcraft.com/simple_test.php) with your bug report. - -For feature requests / faster implementation of functions found here, -please drop them in via the RFE tracker: http://sourceforge.net/tracker/?group_id=142846&atid=753845 -Particularily interested in faster implementations! - -For general support / help, use: -http://sourceforge.net/tracker/?group_id=142846&atid=753843 - -In the VERY WORST case, you can email me: hfuecks gmail com - I tend to be slow to respond though so be warned. - -Important Note: when reporting bugs, please provide the following -information; - -PHP version, whether the iconv extension is loaded (in PHP5 it's -there by default), whether the mbstring extension is loaded. The -following PHP script can be used to determine this information; - -"; -if ( extension_loaded('mbstring') ) { - print "mbstring available
      "; -} else { - print "mbstring not available
      "; -} -if ( extension_loaded('iconv') ) { - print "iconv available
      "; -} else { - print "iconv not available
      "; -} -?> - -++LICENSING++ - -Parts of the code in this library come from other places, under different -licenses. -The authors involved have been contacted (see below). Attribution for -which code came from where can be found in the source code itself. - -+Andreas Gohr (author of Dokuwuki: http://splitbrain.org / -http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php) has -given permission for functions he wrote to be released here and -under the terms of the LGPL license. - -Note: that this is potentially a problem (any clarification appreciated -to hfuecks gmail com) - Dokuwuki is licensed under GPL so is Andi actually -allowed to "downgrade" to LGPL? - -+Henri Sivonen (http://hsivonen.iki.fi/php-utf8/ / -http://hsivonen.iki.fi/php-utf8/) has also given permission for his -code to be released under the terms of the LGPL. He ported a Unicode / UTF-8 -converter from the Mozilla codebase to PHP, which is re-used in phputf8 diff --git a/libraries/phputf8/TODO.tsk b/libraries/phputf8/TODO.tsk deleted file mode 100644 index 011e11fc4312e..0000000000000 --- a/libraries/phputf8/TODO.tsk +++ /dev/null @@ -1,4 +0,0 @@ - - Add further ways to "build" library to reduce number of includes necessary - -- this is now partially mitigated by utf.php which works pretty well, Comparisons of utf_* fns vs. the PHP str* functions for edge behaviour (e.g. sub_str with positions outside of string)Benchmark different implementations of functions against each other Stuff to add Where functions accept an integer character count as an argument, would be good to have byte index versions as well - can be useful in some instances where you're mingling with native str functions Add the "romanize" stuff \ No newline at end of file diff --git a/libraries/phputf8/index.html b/libraries/phputf8/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/libraries/phputf8/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libraries/phputf8/mbstring/case.php b/libraries/phputf8/mbstring/case.php deleted file mode 100644 index 48bcf14ffff37..0000000000000 --- a/libraries/phputf8/mbstring/case.php +++ /dev/null @@ -1,49 +0,0 @@ - \ No newline at end of file diff --git a/libraries/phputf8/mbstring/strlen.php b/libraries/phputf8/mbstring/strlen.php deleted file mode 100644 index 344bf218c2311..0000000000000 --- a/libraries/phputf8/mbstring/strlen.php +++ /dev/null @@ -1,28 +0,0 @@ - -* @param string -* @return mixed either string in lowercase or FALSE is UTF-8 invalid -* @see http://www.php.net/strtolower -* @see utf8_to_unicode -* @see utf8_from_unicode -* @see http://www.unicode.org/reports/tr21/tr21-5.html -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @package utf8 -* @subpackage strings -*/ -function utf8_strtolower($string){ - global $UTF8_UPPER_TO_LOWER; - - $uni = utf8_to_unicode($string); - - if ( !$uni ) { - return FALSE; - } - - $cnt = count($uni); - for ($i=0; $i < $cnt; $i++){ - if ( isset($UTF8_UPPER_TO_LOWER[$uni[$i]]) ) { - $uni[$i] = $UTF8_UPPER_TO_LOWER[$uni[$i]]; - } - } - - return utf8_from_unicode($uni); -} - -//--------------------------------------------------------------- -/** -* UTF-8 Case lookup table -* This lookuptable defines the lower case letters to their correspponding -* upper case letter in UTF-8 -* @author Andreas Gohr -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @see utf8_strtolower -* @package utf8 -* @subpackage strings -*/ -$GLOBALS['UTF8_UPPER_TO_LOWER'] = array( - 0x0041=>0x0061, 0x03A6=>0x03C6, 0x0162=>0x0163, 0x00C5=>0x00E5, 0x0042=>0x0062, - 0x0139=>0x013A, 0x00C1=>0x00E1, 0x0141=>0x0142, 0x038E=>0x03CD, 0x0100=>0x0101, - 0x0490=>0x0491, 0x0394=>0x03B4, 0x015A=>0x015B, 0x0044=>0x0064, 0x0393=>0x03B3, - 0x00D4=>0x00F4, 0x042A=>0x044A, 0x0419=>0x0439, 0x0112=>0x0113, 0x041C=>0x043C, - 0x015E=>0x015F, 0x0143=>0x0144, 0x00CE=>0x00EE, 0x040E=>0x045E, 0x042F=>0x044F, - 0x039A=>0x03BA, 0x0154=>0x0155, 0x0049=>0x0069, 0x0053=>0x0073, 0x1E1E=>0x1E1F, - 0x0134=>0x0135, 0x0427=>0x0447, 0x03A0=>0x03C0, 0x0418=>0x0438, 0x00D3=>0x00F3, - 0x0420=>0x0440, 0x0404=>0x0454, 0x0415=>0x0435, 0x0429=>0x0449, 0x014A=>0x014B, - 0x0411=>0x0431, 0x0409=>0x0459, 0x1E02=>0x1E03, 0x00D6=>0x00F6, 0x00D9=>0x00F9, - 0x004E=>0x006E, 0x0401=>0x0451, 0x03A4=>0x03C4, 0x0423=>0x0443, 0x015C=>0x015D, - 0x0403=>0x0453, 0x03A8=>0x03C8, 0x0158=>0x0159, 0x0047=>0x0067, 0x00C4=>0x00E4, - 0x0386=>0x03AC, 0x0389=>0x03AE, 0x0166=>0x0167, 0x039E=>0x03BE, 0x0164=>0x0165, - 0x0116=>0x0117, 0x0108=>0x0109, 0x0056=>0x0076, 0x00DE=>0x00FE, 0x0156=>0x0157, - 0x00DA=>0x00FA, 0x1E60=>0x1E61, 0x1E82=>0x1E83, 0x00C2=>0x00E2, 0x0118=>0x0119, - 0x0145=>0x0146, 0x0050=>0x0070, 0x0150=>0x0151, 0x042E=>0x044E, 0x0128=>0x0129, - 0x03A7=>0x03C7, 0x013D=>0x013E, 0x0422=>0x0442, 0x005A=>0x007A, 0x0428=>0x0448, - 0x03A1=>0x03C1, 0x1E80=>0x1E81, 0x016C=>0x016D, 0x00D5=>0x00F5, 0x0055=>0x0075, - 0x0176=>0x0177, 0x00DC=>0x00FC, 0x1E56=>0x1E57, 0x03A3=>0x03C3, 0x041A=>0x043A, - 0x004D=>0x006D, 0x016A=>0x016B, 0x0170=>0x0171, 0x0424=>0x0444, 0x00CC=>0x00EC, - 0x0168=>0x0169, 0x039F=>0x03BF, 0x004B=>0x006B, 0x00D2=>0x00F2, 0x00C0=>0x00E0, - 0x0414=>0x0434, 0x03A9=>0x03C9, 0x1E6A=>0x1E6B, 0x00C3=>0x00E3, 0x042D=>0x044D, - 0x0416=>0x0436, 0x01A0=>0x01A1, 0x010C=>0x010D, 0x011C=>0x011D, 0x00D0=>0x00F0, - 0x013B=>0x013C, 0x040F=>0x045F, 0x040A=>0x045A, 0x00C8=>0x00E8, 0x03A5=>0x03C5, - 0x0046=>0x0066, 0x00DD=>0x00FD, 0x0043=>0x0063, 0x021A=>0x021B, 0x00CA=>0x00EA, - 0x0399=>0x03B9, 0x0179=>0x017A, 0x00CF=>0x00EF, 0x01AF=>0x01B0, 0x0045=>0x0065, - 0x039B=>0x03BB, 0x0398=>0x03B8, 0x039C=>0x03BC, 0x040C=>0x045C, 0x041F=>0x043F, - 0x042C=>0x044C, 0x00DE=>0x00FE, 0x00D0=>0x00F0, 0x1EF2=>0x1EF3, 0x0048=>0x0068, - 0x00CB=>0x00EB, 0x0110=>0x0111, 0x0413=>0x0433, 0x012E=>0x012F, 0x00C6=>0x00E6, - 0x0058=>0x0078, 0x0160=>0x0161, 0x016E=>0x016F, 0x0391=>0x03B1, 0x0407=>0x0457, - 0x0172=>0x0173, 0x0178=>0x00FF, 0x004F=>0x006F, 0x041B=>0x043B, 0x0395=>0x03B5, - 0x0425=>0x0445, 0x0120=>0x0121, 0x017D=>0x017E, 0x017B=>0x017C, 0x0396=>0x03B6, - 0x0392=>0x03B2, 0x0388=>0x03AD, 0x1E84=>0x1E85, 0x0174=>0x0175, 0x0051=>0x0071, - 0x0417=>0x0437, 0x1E0A=>0x1E0B, 0x0147=>0x0148, 0x0104=>0x0105, 0x0408=>0x0458, - 0x014C=>0x014D, 0x00CD=>0x00ED, 0x0059=>0x0079, 0x010A=>0x010B, 0x038F=>0x03CE, - 0x0052=>0x0072, 0x0410=>0x0430, 0x0405=>0x0455, 0x0402=>0x0452, 0x0126=>0x0127, - 0x0136=>0x0137, 0x012A=>0x012B, 0x038A=>0x03AF, 0x042B=>0x044B, 0x004C=>0x006C, - 0x0397=>0x03B7, 0x0124=>0x0125, 0x0218=>0x0219, 0x00DB=>0x00FB, 0x011E=>0x011F, - 0x041E=>0x043E, 0x1E40=>0x1E41, 0x039D=>0x03BD, 0x0106=>0x0107, 0x03AB=>0x03CB, - 0x0426=>0x0446, 0x00DE=>0x00FE, 0x00C7=>0x00E7, 0x03AA=>0x03CA, 0x0421=>0x0441, - 0x0412=>0x0432, 0x010E=>0x010F, 0x00D8=>0x00F8, 0x0057=>0x0077, 0x011A=>0x011B, - 0x0054=>0x0074, 0x004A=>0x006A, 0x040B=>0x045B, 0x0406=>0x0456, 0x0102=>0x0103, - 0x039B=>0x03BB, 0x00D1=>0x00F1, 0x041D=>0x043D, 0x038C=>0x03CC, 0x00C9=>0x00E9, - 0x00D0=>0x00F0, 0x0407=>0x0457, 0x0122=>0x0123, -); - -//--------------------------------------------------------------- -/** -* UTF-8 aware alternative to strtoupper -* Make a string uppercase -* Note: The concept of a characters "case" only exists is some alphabets -* such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does -* not exist in the Chinese alphabet, for example. See Unicode Standard -* Annex #21: Case Mappings -* Note: requires utf8_to_unicode and utf8_from_unicode -* @author Andreas Gohr -* @param string -* @return mixed either string in lowercase or FALSE is UTF-8 invalid -* @see http://www.php.net/strtoupper -* @see utf8_to_unicode -* @see utf8_from_unicode -* @see http://www.unicode.org/reports/tr21/tr21-5.html -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @package utf8 -* @subpackage strings -*/ -function utf8_strtoupper($string){ - global $UTF8_LOWER_TO_UPPER; - - $uni = utf8_to_unicode($string); - - if ( !$uni ) { - return FALSE; - } - - $cnt = count($uni); - for ($i=0; $i < $cnt; $i++){ - if( isset($UTF8_LOWER_TO_UPPER[$uni[$i]]) ) { - $uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]]; - } - } - - return utf8_from_unicode($uni); -} - -//--------------------------------------------------------------- -/** -* UTF-8 Case lookup table -* This lookuptable defines the upper case letters to their correspponding -* lower case letter in UTF-8 -* @author Andreas Gohr -* @see utf8_strtoupper -* @package utf8 -* @subpackage strings -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -*/ -$GLOBALS['UTF8_LOWER_TO_UPPER'] = array( - 0x0061=>0x0041, 0x03C6=>0x03A6, 0x0163=>0x0162, 0x00E5=>0x00C5, 0x0062=>0x0042, - 0x013A=>0x0139, 0x00E1=>0x00C1, 0x0142=>0x0141, 0x03CD=>0x038E, 0x0101=>0x0100, - 0x0491=>0x0490, 0x03B4=>0x0394, 0x015B=>0x015A, 0x0064=>0x0044, 0x03B3=>0x0393, - 0x00F4=>0x00D4, 0x044A=>0x042A, 0x0439=>0x0419, 0x0113=>0x0112, 0x043C=>0x041C, - 0x015F=>0x015E, 0x0144=>0x0143, 0x00EE=>0x00CE, 0x045E=>0x040E, 0x044F=>0x042F, - 0x03BA=>0x039A, 0x0155=>0x0154, 0x0069=>0x0049, 0x0073=>0x0053, 0x1E1F=>0x1E1E, - 0x0135=>0x0134, 0x0447=>0x0427, 0x03C0=>0x03A0, 0x0438=>0x0418, 0x00F3=>0x00D3, - 0x0440=>0x0420, 0x0454=>0x0404, 0x0435=>0x0415, 0x0449=>0x0429, 0x014B=>0x014A, - 0x0431=>0x0411, 0x0459=>0x0409, 0x1E03=>0x1E02, 0x00F6=>0x00D6, 0x00F9=>0x00D9, - 0x006E=>0x004E, 0x0451=>0x0401, 0x03C4=>0x03A4, 0x0443=>0x0423, 0x015D=>0x015C, - 0x0453=>0x0403, 0x03C8=>0x03A8, 0x0159=>0x0158, 0x0067=>0x0047, 0x00E4=>0x00C4, - 0x03AC=>0x0386, 0x03AE=>0x0389, 0x0167=>0x0166, 0x03BE=>0x039E, 0x0165=>0x0164, - 0x0117=>0x0116, 0x0109=>0x0108, 0x0076=>0x0056, 0x00FE=>0x00DE, 0x0157=>0x0156, - 0x00FA=>0x00DA, 0x1E61=>0x1E60, 0x1E83=>0x1E82, 0x00E2=>0x00C2, 0x0119=>0x0118, - 0x0146=>0x0145, 0x0070=>0x0050, 0x0151=>0x0150, 0x044E=>0x042E, 0x0129=>0x0128, - 0x03C7=>0x03A7, 0x013E=>0x013D, 0x0442=>0x0422, 0x007A=>0x005A, 0x0448=>0x0428, - 0x03C1=>0x03A1, 0x1E81=>0x1E80, 0x016D=>0x016C, 0x00F5=>0x00D5, 0x0075=>0x0055, - 0x0177=>0x0176, 0x00FC=>0x00DC, 0x1E57=>0x1E56, 0x03C3=>0x03A3, 0x043A=>0x041A, - 0x006D=>0x004D, 0x016B=>0x016A, 0x0171=>0x0170, 0x0444=>0x0424, 0x00EC=>0x00CC, - 0x0169=>0x0168, 0x03BF=>0x039F, 0x006B=>0x004B, 0x00F2=>0x00D2, 0x00E0=>0x00C0, - 0x0434=>0x0414, 0x03C9=>0x03A9, 0x1E6B=>0x1E6A, 0x00E3=>0x00C3, 0x044D=>0x042D, - 0x0436=>0x0416, 0x01A1=>0x01A0, 0x010D=>0x010C, 0x011D=>0x011C, 0x00F0=>0x00D0, - 0x013C=>0x013B, 0x045F=>0x040F, 0x045A=>0x040A, 0x00E8=>0x00C8, 0x03C5=>0x03A5, - 0x0066=>0x0046, 0x00FD=>0x00DD, 0x0063=>0x0043, 0x021B=>0x021A, 0x00EA=>0x00CA, - 0x03B9=>0x0399, 0x017A=>0x0179, 0x00EF=>0x00CF, 0x01B0=>0x01AF, 0x0065=>0x0045, - 0x03BB=>0x039B, 0x03B8=>0x0398, 0x03BC=>0x039C, 0x045C=>0x040C, 0x043F=>0x041F, - 0x044C=>0x042C, 0x00FE=>0x00DE, 0x00F0=>0x00D0, 0x1EF3=>0x1EF2, 0x0068=>0x0048, - 0x00EB=>0x00CB, 0x0111=>0x0110, 0x0433=>0x0413, 0x012F=>0x012E, 0x00E6=>0x00C6, - 0x0078=>0x0058, 0x0161=>0x0160, 0x016F=>0x016E, 0x03B1=>0x0391, 0x0457=>0x0407, - 0x0173=>0x0172, 0x00FF=>0x0178, 0x006F=>0x004F, 0x043B=>0x041B, 0x03B5=>0x0395, - 0x0445=>0x0425, 0x0121=>0x0120, 0x017E=>0x017D, 0x017C=>0x017B, 0x03B6=>0x0396, - 0x03B2=>0x0392, 0x03AD=>0x0388, 0x1E85=>0x1E84, 0x0175=>0x0174, 0x0071=>0x0051, - 0x0437=>0x0417, 0x1E0B=>0x1E0A, 0x0148=>0x0147, 0x0105=>0x0104, 0x0458=>0x0408, - 0x014D=>0x014C, 0x00ED=>0x00CD, 0x0079=>0x0059, 0x010B=>0x010A, 0x03CE=>0x038F, - 0x0072=>0x0052, 0x0430=>0x0410, 0x0455=>0x0405, 0x0452=>0x0402, 0x0127=>0x0126, - 0x0137=>0x0136, 0x012B=>0x012A, 0x03AF=>0x038A, 0x044B=>0x042B, 0x006C=>0x004C, - 0x03B7=>0x0397, 0x0125=>0x0124, 0x0219=>0x0218, 0x00FB=>0x00DB, 0x011F=>0x011E, - 0x043E=>0x041E, 0x1E41=>0x1E40, 0x03BD=>0x039D, 0x0107=>0x0106, 0x03CB=>0x03AB, - 0x0446=>0x0426, 0x00FE=>0x00DE, 0x00E7=>0x00C7, 0x03CA=>0x03AA, 0x0441=>0x0421, - 0x0432=>0x0412, 0x010F=>0x010E, 0x00F8=>0x00D8, 0x0077=>0x0057, 0x011B=>0x011A, - 0x0074=>0x0054, 0x006A=>0x004A, 0x045B=>0x040B, 0x0456=>0x0406, 0x0103=>0x0102, - 0x03BB=>0x039B, 0x00F1=>0x00D1, 0x043D=>0x041D, 0x03CC=>0x038C, 0x00E9=>0x00C9, - 0x00F0=>0x00D0, 0x0457=>0x0407, 0x0123=>0x0122, -); - diff --git a/libraries/phputf8/native/core.php b/libraries/phputf8/native/core.php deleted file mode 100644 index 5463e932c89ff..0000000000000 --- a/libraries/phputf8/native/core.php +++ /dev/null @@ -1,170 +0,0 @@ - 1 ) { - return utf8_strlen($ar[0]); - } - return FALSE; - - } else { - - if ( !is_int($offset) ) { - trigger_error('utf8_strpos: Offset must be an integer',E_USER_ERROR); - return FALSE; - } - - $str = utf8_substr($str, $offset); - - if ( FALSE !== ( $pos = utf8_strpos($str, $needle) ) ) { - return $pos + $offset; - } - - return FALSE; - } - -} - -//-------------------------------------------------------------------- -/** -* UTF-8 aware alternative to strrpos -* Find position of last occurrence of a char in a string -* Note: This will get alot slower if offset is used -* Note: requires utf8_substr and utf8_strlen to be loaded -* @param string haystack -* @param string needle (you should validate this with utf8_is_valid) -* @param integer (optional) offset (from left) -* @return mixed integer position or FALSE on failure -* @see http://www.php.net/strrpos -* @see utf8_substr -* @see utf8_strlen -* @package utf8 -* @subpackage strings -*/ -function utf8_strrpos($str, $needle, $offset = NULL) { - - if ( is_null($offset) ) { - - $ar = explode($needle, $str); - - if ( count($ar) > 1 ) { - // Pop off the end of the string where the last match was made - array_pop($ar); - $str = join($needle,$ar); - return utf8_strlen($str); - } - return FALSE; - - } else { - - if ( !is_int($offset) ) { - trigger_error('utf8_strrpos expects parameter 3 to be long',E_USER_WARNING); - return FALSE; - } - - $str = utf8_substr($str, $offset); - - if ( FALSE !== ( $pos = utf8_strrpos($str, $needle) ) ) { - return $pos + $offset; - } - - return FALSE; - } - -} - -//-------------------------------------------------------------------- -/** -* UTF-8 aware alternative to substr -* Return part of a string given character offset (and optionally length) -* Note: supports use of negative offsets and lengths but will be slower -* when doing so -* @param string -* @param integer number of UTF-8 characters offset (from left) -* @param integer (optional) length in UTF-8 characters from offset -* @return mixed string or FALSE if failure -* @package utf8 -* @subpackage strings -*/ -function utf8_substr($str, $offset, $length = NULL) { - - if ( $offset >= 0 && $length >= 0 ) { - - if ( $length === NULL ) { - $length = '*'; - } else { - if ( !preg_match('/^[0-9]+$/', $length) ) { - trigger_error('utf8_substr expects parameter 3 to be long', E_USER_WARNING); - return FALSE; - } - - $strlen = strlen(utf8_decode($str)); - if ( $offset > $strlen ) { - return ''; - } - - if ( ( $offset + $length ) > $strlen ) { - $length = '*'; - } else { - $length = '{'.$length.'}'; - } - } - - if ( !preg_match('/^[0-9]+$/', $offset) ) { - trigger_error('utf8_substr expects parameter 2 to be long', E_USER_WARNING); - return FALSE; - } - - $pattern = '/^.{'.$offset.'}(.'.$length.')/us'; - - preg_match($pattern, $str, $matches); - - if ( isset($matches[1]) ) { - return $matches[1]; - } - - return FALSE; - - } else { - - // Handle negatives using different, slower technique - // From: http://www.php.net/manual/en/function.substr.php#44838 - preg_match_all('/./u', $str, $ar); - if( $length !== NULL ) { - return join('',array_slice($ar[0],$offset,$length)); - } else { - return join('',array_slice($ar[0],$offset)); - } - } -} diff --git a/libraries/phputf8/native/index.html b/libraries/phputf8/native/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/libraries/phputf8/native/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libraries/phputf8/native/strlen.php b/libraries/phputf8/native/strlen.php deleted file mode 100644 index e54f7313b8255..0000000000000 --- a/libraries/phputf8/native/strlen.php +++ /dev/null @@ -1,35 +0,0 @@ - -* @link http://www.php.net/manual/en/function.strlen.php -* @link http://www.php.net/manual/en/function.utf8-decode.php -* @param string UTF-8 string -* @return int number of UTF-8 characters in string -* @package utf8 -* @subpackage strings -*/ -function utf8_strlen($str){ - return strlen(utf8_decode($str)); -} diff --git a/libraries/phputf8/str_ireplace.php b/libraries/phputf8/str_ireplace.php deleted file mode 100644 index d932c19c1f517..0000000000000 --- a/libraries/phputf8/str_ireplace.php +++ /dev/null @@ -1,80 +0,0 @@ - -* @see http://www.php.net/ltrim -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @return string -* @package utf8 -* @subpackage strings -*/ -function utf8_ltrim( $str, $charlist = FALSE ) { - if($charlist === FALSE) return ltrim($str); - - //quote charlist for use in a characterclass - $charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist); - - return preg_replace('/^['.$charlist.']+/u','',$str); -} - -//--------------------------------------------------------------- -/** -* UTF-8 aware replacement for rtrim() -* Note: you only need to use this if you are supplying the charlist -* optional arg and it contains UTF-8 characters. Otherwise rtrim will -* work normally on a UTF-8 string -* @author Andreas Gohr -* @see http://www.php.net/rtrim -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @return string -* @package utf8 -* @subpackage strings -*/ -function utf8_rtrim( $str, $charlist = FALSE ) { - if($charlist === FALSE) return rtrim($str); - - //quote charlist for use in a characterclass - $charlist = preg_replace('!([\\\\\\-\\]\\[/^])!','\\\${1}',$charlist); - - return preg_replace('/['.$charlist.']+$/u','',$str); -} - -//--------------------------------------------------------------- -/** -* UTF-8 aware replacement for trim() -* Note: you only need to use this if you are supplying the charlist -* optional arg and it contains UTF-8 characters. Otherwise trim will -* work normally on a UTF-8 string -* @author Andreas Gohr -* @see http://www.php.net/trim -* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php -* @return string -* @package utf8 -* @subpackage strings -*/ -function utf8_trim( $str, $charlist = FALSE ) { - if($charlist === FALSE) return trim($str); - return utf8_ltrim(utf8_rtrim($str, $charlist), $charlist); -} \ No newline at end of file diff --git a/libraries/phputf8/ucfirst.php b/libraries/phputf8/ucfirst.php deleted file mode 100644 index f7049c7ec8f30..0000000000000 --- a/libraries/phputf8/ucfirst.php +++ /dev/null @@ -1,34 +0,0 @@ - -* @see utf8_deaccent() -* @package utf8 -* @subpackage ascii -*/ -$GLOBALS['UTF8_LOWER_ACCENTS'] = array( - 'à ' => 'a', 'ô' => 'o', '�' => 'd', 'ḟ' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o', - 'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', '�' => 'a', 'ķ' => 'k', - '�' => 's', 'ỳ' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', 'ṗ' => 'p', 'ó' => 'o', - 'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', '�' => 'w', 'ċ' => 'c', 'õ' => 'o', - 'ṡ' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c', - 'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', 'ṫ' => 't', - 'ū' => 'u', '�' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l', - 'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z', - 'ẃ' => 'w', 'ḃ' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', 'ḋ' => 'd', 'ť' => 't', - 'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o', - 'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', '�' => 'g', 'đ' => 'd', 'ĵ' => 'j', - 'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o', - 'â' => 'a', 'ľ' => 'l', 'ẅ' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g', - '�' => 'm', '�' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a', - 'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', -); - - -//--------------------------------------------------------------- -/** -* UTF-8 lookup table for upper case accented letters -* This lookuptable defines replacements for accented characters from the ASCII-7 -* range. This are upper case letters only. -* @author Andreas Gohr -* @see utf8_deaccent() -* @package utf8 -* @subpackage ascii - */ - -$GLOBALS['UTF8_UPPER_ACCENTS'] = array( - 'à ' => 'A', 'ô' => 'O', '�' => 'D', 'ḟ' => 'F', 'ë' => 'E', 'š' => 'S', 'ơ' => 'O', - 'ß' => 'Ss', 'ă' => 'A', 'ř' => 'R', 'ț' => 'T', 'ň' => 'N', '�' => 'A', 'ķ' => 'K', - '�' => 'S', 'ỳ' => 'Y', 'ņ' => 'N', 'ĺ' => 'L', 'ħ' => 'H', 'ṗ' => 'P', 'ó' => 'O', - 'ú' => 'U', 'ě' => 'E', 'é' => 'E', 'ç' => 'C', '�' => 'W', 'ċ' => 'C', 'õ' => 'O', - 'ṡ' => 'S', 'ø' => 'O', 'ģ' => 'G', 'ŧ' => 'T', 'ș' => 'S', 'ė' => 'E', 'ĉ' => 'C', - 'ś' => 'S', 'î' => 'I', 'ű' => 'U', 'ć' => 'C', 'ę' => 'E', 'ŵ' => 'W', 'ṫ' => 'T', - 'ū' => 'U', '�' => 'C', 'ö' => 'Oe', 'è' => 'E', 'ŷ' => 'Y', 'ą' => 'A', 'ł' => 'L', - 'ų' => 'U', 'ů' => 'U', 'ş' => 'S', 'ğ' => 'G', 'ļ' => 'L', 'ƒ' => 'F', 'ž' => 'Z', - 'ẃ' => 'W', 'ḃ' => 'B', 'å' => 'A', 'ì' => 'I', 'ï' => 'I', 'ḋ' => 'D', 'ť' => 'T', - 'ŗ' => 'R', 'ä' => 'Ae', 'í' => 'I', 'ŕ' => 'R', 'ê' => 'E', 'ü' => 'Ue', 'ò' => 'O', - 'ē' => 'E', 'ñ' => 'N', 'ń' => 'N', 'ĥ' => 'H', '�' => 'G', 'đ' => 'D', 'ĵ' => 'J', - 'ÿ' => 'Y', 'ũ' => 'U', 'ŭ' => 'U', 'ư' => 'U', 'ţ' => 'T', 'ý' => 'Y', 'ő' => 'O', - 'â' => 'A', 'ľ' => 'L', 'ẅ' => 'W', 'ż' => 'Z', 'ī' => 'I', 'ã' => 'A', 'ġ' => 'G', - '�' => 'M', '�' => 'O', 'ĩ' => 'I', 'ù' => 'U', 'į' => 'I', 'ź' => 'Z', 'á' => 'A', - 'û' => 'U', 'Þ' => 'Th', '�' => 'Dh', 'Æ' => 'Ae', -); - -//-------------------------------------------------------------------- -/** -* Tests whether a string contains only 7bit ASCII bytes. -* You might use this to conditionally check whether a string -* needs handling as UTF-8 or not, potentially offering performance -* benefits by using the native PHP equivalent if it's just ASCII e.g.; -* -* -* -* -* -* @param string -* @return boolean TRUE if it's all ASCII -* @package utf8 -* @subpackage ascii -* @see utf8_is_ascii_ctrl -*/ -function utf8_is_ascii($str) { - if ( strlen($str) > 0 ) { - // Search for any bytes which are outside the ASCII range... - return (preg_match('/[^\x00-\x7F]/',$str) !== 1); - } - return FALSE; -} - -//-------------------------------------------------------------------- -/** -* Tests whether a string contains only 7bit ASCII bytes with device -* control codes omitted. The device control codes can be found on the -* second table here: http://www.w3schools.com/tags/ref_ascii.asp -* -* @param string -* @return boolean TRUE if it's all ASCII without device control codes -* @package utf8 -* @subpackage ascii -* @see utf8_is_ascii -*/ -function utf8_is_ascii_ctrl($str) { - if ( strlen($str) > 0 ) { - // Search for any bytes which are outside the ASCII range, - // or are device control codes - return (preg_match('/[^\x09\x0A\x0D\x20-\x7E]/',$str) !== 1); - } - return FALSE; -} - -//-------------------------------------------------------------------- -/** -* Strip out all non-7bit ASCII bytes -* If you need to transmit a string to system which you know can only -* support 7bit ASCII, you could use this function. -* @param string -* @return string with non ASCII bytes removed -* @package utf8 -* @subpackage ascii -* @see utf8_strip_non_ascii_ctrl -*/ -function utf8_strip_non_ascii($str) { - ob_start(); - while ( preg_match( - '/^([\x00-\x7F]+)|([^\x00-\x7F]+)/S', - $str, $matches) ) { - if ( !isset($matches[2]) ) { - echo $matches[0]; - } - $str = substr($str, strlen($matches[0])); - } - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} - -//-------------------------------------------------------------------- -/** -* Strip out all non 7bit ASCII bytes and ASCII device control codes. -* For a list of ASCII device control codes see the 2nd table here: -* http://www.w3schools.com/tags/ref_ascii.asp -* -* @param string -* @return boolean TRUE if it's all ASCII -* @package utf8 -* @subpackage ascii -*/ -function utf8_strip_non_ascii_ctrl($str) { - ob_start(); - while ( preg_match( - '/^([\x09\x0A\x0D\x20-\x7E]+)|([^\x09\x0A\x0D\x20-\x7E]+)/S', - $str, $matches) ) { - if ( !isset($matches[2]) ) { - echo $matches[0]; - } - $str = substr($str, strlen($matches[0])); - } - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} - -//--------------------------------------------------------------- -/** -* Replace accented UTF-8 characters by unaccented ASCII-7 "equivalents". -* The purpose of this function is to replace characters commonly found in Latin -* alphabets with something more or less equivalent from the ASCII range. This can -* be useful for converting a UTF-8 to something ready for a filename, for example. -* Following the use of this function, you would probably also pass the string -* through utf8_strip_non_ascii to clean out any other non-ASCII chars -* Use the optional parameter to just deaccent lower ($case = -1) or upper ($case = 1) -* letters. Default is to deaccent both cases ($case = 0) -* @param string UTF-8 string -* @param int (optional) -1 lowercase only, +1 uppercase only, 1 both cases -* @param string UTF-8 with accented characters replaced by ASCII chars -* @return string accented chars replaced with ascii equivalents -* @author Andreas Gohr -* @package utf8 -* @subpackage ascii -*/ -function utf8_accents_to_ascii( $str, $case=0 ){ - - if($case <= 0){ - global $UTF8_LOWER_ACCENTS; - $string = str_replace( - array_keys($UTF8_LOWER_ACCENTS), - array_values($UTF8_LOWER_ACCENTS), - $str - ); - } - - if($case >= 0){ - global $UTF8_UPPER_ACCENTS; - $string = str_replace( - array_keys($UTF8_UPPER_ACCENTS), - array_values($UTF8_UPPER_ACCENTS), - $str - ); - } - - return $str; - -} \ No newline at end of file diff --git a/libraries/phputf8/utils/bad.php b/libraries/phputf8/utils/bad.php deleted file mode 100644 index 2eef96168a8cc..0000000000000 --- a/libraries/phputf8/utils/bad.php +++ /dev/null @@ -1,421 +0,0 @@ - 0 ) { - return $badList; - } - return FALSE; -} - -//-------------------------------------------------------------------- -/** -* Strips out any bad bytes from a UTF-8 string and returns the rest -* PCRE Pattern to locate bad bytes in a UTF-8 string -* Comes from W3 FAQ: Multilingual Forms -* Note: modified to include full ASCII range including control chars -* @see http://www.w3.org/International/questions/qa-forms-utf-8 -* @param string -* @return string -* @package utf8 -* @subpackage bad -*/ -function utf8_bad_strip($str) { - $UTF8_BAD = - '([\x00-\x7F]'. # ASCII (including control chars) - '|[\xC2-\xDF][\x80-\xBF]'. # non-overlong 2-byte - '|\xE0[\xA0-\xBF][\x80-\xBF]'. # excluding overlongs - '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # straight 3-byte - '|\xED[\x80-\x9F][\x80-\xBF]'. # excluding surrogates - '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # planes 1-3 - '|[\xF1-\xF3][\x80-\xBF]{3}'. # planes 4-15 - '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # plane 16 - '|(.{1}))'; # invalid byte - ob_start(); - while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { - if ( !isset($matches[2])) { - echo $matches[0]; - } - $str = substr($str,strlen($matches[0])); - } - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} - -//-------------------------------------------------------------------- -/** -* Replace bad bytes with an alternative character - ASCII character -* recommended is replacement char -* PCRE Pattern to locate bad bytes in a UTF-8 string -* Comes from W3 FAQ: Multilingual Forms -* Note: modified to include full ASCII range including control chars -* @see http://www.w3.org/International/questions/qa-forms-utf-8 -* @param string to search -* @param string to replace bad bytes with (defaults to '?') - use ASCII -* @return string -* @package utf8 -* @subpackage bad -*/ -function utf8_bad_replace($str, $replace = '?') { - $UTF8_BAD = - '([\x00-\x7F]'. # ASCII (including control chars) - '|[\xC2-\xDF][\x80-\xBF]'. # non-overlong 2-byte - '|\xE0[\xA0-\xBF][\x80-\xBF]'. # excluding overlongs - '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. # straight 3-byte - '|\xED[\x80-\x9F][\x80-\xBF]'. # excluding surrogates - '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. # planes 1-3 - '|[\xF1-\xF3][\x80-\xBF]{3}'. # planes 4-15 - '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. # plane 16 - '|(.{1}))'; # invalid byte - ob_start(); - while (preg_match('/'.$UTF8_BAD.'/S', $str, $matches)) { - if ( !isset($matches[2])) { - echo $matches[0]; - } else { - echo $replace; - } - $str = substr($str,strlen($matches[0])); - } - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} - -//-------------------------------------------------------------------- -/** -* Return code from utf8_bad_identify() when a five octet sequence is detected. -* Note: 5 octets sequences are valid UTF-8 but are not supported by Unicode so -* do not represent a useful character -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_5OCTET',1); - -/** -* Return code from utf8_bad_identify() when a six octet sequence is detected. -* Note: 6 octets sequences are valid UTF-8 but are not supported by Unicode so -* do not represent a useful character -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_6OCTET',2); - -/** -* Return code from utf8_bad_identify(). -* Invalid octet for use as start of multi-byte UTF-8 sequence -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_SEQID',3); - -/** -* Return code from utf8_bad_identify(). -* From Unicode 3.1, non-shortest form is illegal -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_NONSHORT',4); - -/** -* Return code from utf8_bad_identify(). -* From Unicode 3.2, surrogate characters are illegal -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_SURROGATE',5); - -/** -* Return code from utf8_bad_identify(). -* Codepoints outside the Unicode range are illegal -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_UNIOUTRANGE',6); - -/** -* Return code from utf8_bad_identify(). -* Incomplete multi-octet sequence -* Note: this is kind of a "catch-all" -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -define('UTF8_BAD_SEQINCOMPLETE',7); - -//-------------------------------------------------------------------- -/** -* Reports on the type of bad byte found in a UTF-8 string. Returns a -* status code on the first bad byte found -* @author -* @param string UTF-8 encoded string -* @return mixed integer constant describing problem or FALSE if valid UTF-8 -* @see utf8_bad_explain -* @see http://hsivonen.iki.fi/php-utf8/ -* @package utf8 -* @subpackage bad -*/ -function utf8_bad_identify($str, &$i) { - - $mState = 0; // cached expected number of octets after the current octet - // until the beginning of the next UTF8 character sequence - $mUcs4 = 0; // cached Unicode character - $mBytes = 1; // cached expected number of octets in the current sequence - - $len = strlen($str); - - for($i = 0; $i < $len; $i++) { - - $in = ord($str{$i}); - - if ( $mState == 0) { - - // When mState is zero we expect either a US-ASCII character or a - // multi-octet sequence. - if (0 == (0x80 & ($in))) { - // US-ASCII, pass straight through. - $mBytes = 1; - - } else if (0xC0 == (0xE0 & ($in))) { - // First octet of 2 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x1F) << 6; - $mState = 1; - $mBytes = 2; - - } else if (0xE0 == (0xF0 & ($in))) { - // First octet of 3 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x0F) << 12; - $mState = 2; - $mBytes = 3; - - } else if (0xF0 == (0xF8 & ($in))) { - // First octet of 4 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x07) << 18; - $mState = 3; - $mBytes = 4; - - } else if (0xF8 == (0xFC & ($in))) { - - /* First octet of 5 octet sequence. - * - * This is illegal because the encoded codepoint must be either - * (a) not the shortest form or - * (b) outside the Unicode range of 0-0x10FFFF. - */ - - return UTF8_BAD_5OCTET; - - } else if (0xFC == (0xFE & ($in))) { - - // First octet of 6 octet sequence, see comments for 5 octet sequence. - return UTF8_BAD_6OCTET; - - } else { - // Current octet is neither in the US-ASCII range nor a legal first - // octet of a multi-octet sequence. - return UTF8_BAD_SEQID; - - } - - } else { - - // When mState is non-zero, we expect a continuation of the multi-octet - // sequence - if (0x80 == (0xC0 & ($in))) { - - // Legal continuation. - $shift = ($mState - 1) * 6; - $tmp = $in; - $tmp = ($tmp & 0x0000003F) << $shift; - $mUcs4 |= $tmp; - - /** - * End of the multi-octet sequence. mUcs4 now contains the final - * Unicode codepoint to be output - */ - if (0 == --$mState) { - - // From Unicode 3.1, non-shortest form is illegal - if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || - ((3 == $mBytes) && ($mUcs4 < 0x0800)) || - ((4 == $mBytes) && ($mUcs4 < 0x10000)) ) { - return UTF8_BAD_NONSHORT; - - // From Unicode 3.2, surrogate characters are illegal - } else if (($mUcs4 & 0xFFFFF800) == 0xD800) { - return UTF8_BAD_SURROGATE; - - // Codepoints outside the Unicode range are illegal - } else if ($mUcs4 > 0x10FFFF) { - return UTF8_BAD_UNIOUTRANGE; - } - - //initialize UTF8 cache - $mState = 0; - $mUcs4 = 0; - $mBytes = 1; - } - - } else { - // ((0xC0 & (*in) != 0x80) && (mState != 0)) - // Incomplete multi-octet sequence. - $i--; - return UTF8_BAD_SEQINCOMPLETE; - } - } - } - - if ( $mState != 0 ) { - // Incomplete multi-octet sequence. - $i--; - return UTF8_BAD_SEQINCOMPLETE; - } - - // No bad octets found - $i = NULL; - return FALSE; -} - -//-------------------------------------------------------------------- -/** -* Takes a return code from utf8_bad_identify() are returns a message -* (in English) explaining what the problem is. -* @param int return code from utf8_bad_identify -* @return mixed string message or FALSE if return code unknown -* @see utf8_bad_identify -* @package utf8 -* @subpackage bad -*/ -function utf8_bad_explain($code) { - - switch ($code) { - - case UTF8_BAD_5OCTET: - return 'Five octet sequences are valid UTF-8 but are not supported by Unicode'; - break; - - case UTF8_BAD_6OCTET: - return 'Six octet sequences are valid UTF-8 but are not supported by Unicode'; - break; - - case UTF8_BAD_SEQID: - return 'Invalid octet for use as start of multi-byte UTF-8 sequence'; - break; - - case UTF8_BAD_NONSHORT: - return 'From Unicode 3.1, non-shortest form is illegal'; - break; - - case UTF8_BAD_SURROGATE: - return 'From Unicode 3.2, surrogate characters are illegal'; - break; - - case UTF8_BAD_UNIOUTRANGE: - return 'Codepoints outside the Unicode range are illegal'; - break; - - case UTF8_BAD_SEQINCOMPLETE: - return 'Incomplete multi-octet sequence'; - break; - - } - - trigger_error('Unknown error code: '.$code,E_USER_WARNING); - return FALSE; - -} diff --git a/libraries/phputf8/utils/index.html b/libraries/phputf8/utils/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/libraries/phputf8/utils/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libraries/phputf8/utils/patterns.php b/libraries/phputf8/utils/patterns.php deleted file mode 100644 index 9477891c252cc..0000000000000 --- a/libraries/phputf8/utils/patterns.php +++ /dev/null @@ -1,69 +0,0 @@ - -* @param string $string The UTF8 string to strip of special chars -* @param string (optional) $repl Replace special with this string -* @return string with common non-alphanumeric characters removed -* @see utf8_specials_pattern -*/ -function utf8_strip_specials($string, $repl=''){ - return preg_replace(utf8_specials_pattern(), $repl, $string); -} - -//-------------------------------------------------------------------- -/** -* UTF-8 array of common special characters -* This array should contain all special characters (not a letter or digit) -* defined in the various local charsets - it's not a complete list of -* non-alphanum characters in UTF-8. It's not perfect but should match most -* cases of special chars. -* The controlchars 0x00 to 0x19 are _not_ included in this array. The space -* 0x20 is! These chars are _not_ in the array either: _ (0x5f), : 0x3a, -* . 0x2e, - 0x2d -* @package utf8 -* @subpackage utils -* @author Andreas Gohr -* @see utf8_specials_pattern -*/ -$UTF8_SPECIAL_CHARS = array( - 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, 0x0021, 0x0022, 0x0023, - 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, - 0x002f, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, 0x005b, - 0x005c, 0x005d, 0x005e, 0x0060, 0x007b, 0x007c, 0x007d, 0x007e, - 0x007f, 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, - 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, 0x0090, 0x0091, 0x0092, - 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, - 0x009d, 0x009e, 0x009f, 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, - 0x00a7, 0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, 0x00b0, - 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x00b9, 0x00ba, - 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, 0x00d7, 0x00f7, 0x02c7, 0x02d8, 0x02d9, - 0x02da, 0x02db, 0x02dc, 0x02dd, 0x0300, 0x0301, 0x0303, 0x0309, 0x0323, 0x0384, - 0x0385, 0x0387, 0x03b2, 0x03c6, 0x03d1, 0x03d2, 0x03d5, 0x03d6, 0x05b0, 0x05b1, - 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, 0x05b8, 0x05b9, 0x05bb, 0x05bc, - 0x05bd, 0x05be, 0x05bf, 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f3, 0x05f4, 0x060c, - 0x061b, 0x061f, 0x0640, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, 0x0650, 0x0651, - 0x0652, 0x066a, 0x0e3f, 0x200c, 0x200d, 0x200e, 0x200f, 0x2013, 0x2014, 0x2015, - 0x2017, 0x2018, 0x2019, 0x201a, 0x201c, 0x201d, 0x201e, 0x2020, 0x2021, 0x2022, - 0x2026, 0x2030, 0x2032, 0x2033, 0x2039, 0x203a, 0x2044, 0x20a7, 0x20aa, 0x20ab, - 0x20ac, 0x2116, 0x2118, 0x2122, 0x2126, 0x2135, 0x2190, 0x2191, 0x2192, 0x2193, - 0x2194, 0x2195, 0x21b5, 0x21d0, 0x21d1, 0x21d2, 0x21d3, 0x21d4, 0x2200, 0x2202, - 0x2203, 0x2205, 0x2206, 0x2207, 0x2208, 0x2209, 0x220b, 0x220f, 0x2211, 0x2212, - 0x2215, 0x2217, 0x2219, 0x221a, 0x221d, 0x221e, 0x2220, 0x2227, 0x2228, 0x2229, - 0x222a, 0x222b, 0x2234, 0x223c, 0x2245, 0x2248, 0x2260, 0x2261, 0x2264, 0x2265, - 0x2282, 0x2283, 0x2284, 0x2286, 0x2287, 0x2295, 0x2297, 0x22a5, 0x22c5, 0x2310, - 0x2320, 0x2321, 0x2329, 0x232a, 0x2469, 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, - 0x2518, 0x251c, 0x2524, 0x252c, 0x2534, 0x253c, 0x2550, 0x2551, 0x2552, 0x2553, - 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, - 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, - 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, - 0x2591, 0x2592, 0x2593, 0x25a0, 0x25b2, 0x25bc, 0x25c6, 0x25ca, 0x25cf, 0x25d7, - 0x2605, 0x260e, 0x261b, 0x261e, 0x2660, 0x2663, 0x2665, 0x2666, 0x2701, 0x2702, - 0x2703, 0x2704, 0x2706, 0x2707, 0x2708, 0x2709, 0x270c, 0x270d, 0x270e, 0x270f, - 0x2710, 0x2711, 0x2712, 0x2713, 0x2714, 0x2715, 0x2716, 0x2717, 0x2718, 0x2719, - 0x271a, 0x271b, 0x271c, 0x271d, 0x271e, 0x271f, 0x2720, 0x2721, 0x2722, 0x2723, - 0x2724, 0x2725, 0x2726, 0x2727, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, 0x272e, - 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, - 0x2739, 0x273a, 0x273b, 0x273c, 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, 0x2742, - 0x2743, 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274a, 0x274b, 0x274d, - 0x274f, 0x2750, 0x2751, 0x2752, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, - 0x275d, 0x275e, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x277f, - 0x2789, 0x2793, 0x2794, 0x2798, 0x2799, 0x279a, 0x279b, 0x279c, 0x279d, 0x279e, - 0x279f, 0x27a0, 0x27a1, 0x27a2, 0x27a3, 0x27a4, 0x27a5, 0x27a6, 0x27a7, 0x27a8, - 0x27a9, 0x27aa, 0x27ab, 0x27ac, 0x27ad, 0x27ae, 0x27af, 0x27b1, 0x27b2, 0x27b3, - 0x27b4, 0x27b5, 0x27b6, 0x27b7, 0x27b8, 0x27b9, 0x27ba, 0x27bb, 0x27bc, 0x27bd, - 0x27be, 0xf6d9, 0xf6da, 0xf6db, 0xf8d7, 0xf8d8, 0xf8d9, 0xf8da, 0xf8db, 0xf8dc, - 0xf8dd, 0xf8de, 0xf8df, 0xf8e0, 0xf8e1, 0xf8e2, 0xf8e3, 0xf8e4, 0xf8e5, 0xf8e6, - 0xf8e7, 0xf8e8, 0xf8e9, 0xf8ea, 0xf8eb, 0xf8ec, 0xf8ed, 0xf8ee, 0xf8ef, 0xf8f0, - 0xf8f1, 0xf8f2, 0xf8f3, 0xf8f4, 0xf8f5, 0xf8f6, 0xf8f7, 0xf8f8, 0xf8f9, 0xf8fa, - 0xf8fb, 0xf8fc, 0xf8fd, 0xf8fe, 0xfe7c, 0xfe7d, -); - diff --git a/libraries/phputf8/utils/unicode.php b/libraries/phputf8/utils/unicode.php deleted file mode 100644 index 0b22d066c9873..0000000000000 --- a/libraries/phputf8/utils/unicode.php +++ /dev/null @@ -1,269 +0,0 @@ - 0xFFFF. Occurrances of the BOM are ignored. Surrogates -* are not allowed. -* Returns false if the input string isn't a valid UTF-8 octet sequence -* and raises a PHP error at level E_USER_WARNING -* Note: this function has been modified slightly in this library to -* trigger errors on encountering bad bytes -* @author -* @param string UTF-8 encoded string -* @return mixed array of unicode code points or FALSE if UTF-8 invalid -* @see utf8_from_unicode -* @see http://hsivonen.iki.fi/php-utf8/ -* @package utf8 -* @subpackage unicode -*/ -function utf8_to_unicode($str) { - $mState = 0; // cached expected number of octets after the current octet - // until the beginning of the next UTF8 character sequence - $mUcs4 = 0; // cached Unicode character - $mBytes = 1; // cached expected number of octets in the current sequence - - $out = array(); - - $len = strlen($str); - - for($i = 0; $i < $len; $i++) { - - $in = ord($str{$i}); - - if ( $mState == 0) { - - // When mState is zero we expect either a US-ASCII character or a - // multi-octet sequence. - if (0 == (0x80 & ($in))) { - // US-ASCII, pass straight through. - $out[] = $in; - $mBytes = 1; - - } else if (0xC0 == (0xE0 & ($in))) { - // First octet of 2 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x1F) << 6; - $mState = 1; - $mBytes = 2; - - } else if (0xE0 == (0xF0 & ($in))) { - // First octet of 3 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x0F) << 12; - $mState = 2; - $mBytes = 3; - - } else if (0xF0 == (0xF8 & ($in))) { - // First octet of 4 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x07) << 18; - $mState = 3; - $mBytes = 4; - - } else if (0xF8 == (0xFC & ($in))) { - /* First octet of 5 octet sequence. - * - * This is illegal because the encoded codepoint must be either - * (a) not the shortest form or - * (b) outside the Unicode range of 0-0x10FFFF. - * Rather than trying to resynchronize, we will carry on until the end - * of the sequence and let the later error handling code catch it. - */ - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x03) << 24; - $mState = 4; - $mBytes = 5; - - } else if (0xFC == (0xFE & ($in))) { - // First octet of 6 octet sequence, see comments for 5 octet sequence. - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 1) << 30; - $mState = 5; - $mBytes = 6; - - } else { - /* Current octet is neither in the US-ASCII range nor a legal first - * octet of a multi-octet sequence. - */ - trigger_error( - 'utf8_to_unicode: Illegal sequence identifier '. - 'in UTF-8 at byte '.$i, - E_USER_WARNING - ); - return FALSE; - - } - - } else { - - // When mState is non-zero, we expect a continuation of the multi-octet - // sequence - if (0x80 == (0xC0 & ($in))) { - - // Legal continuation. - $shift = ($mState - 1) * 6; - $tmp = $in; - $tmp = ($tmp & 0x0000003F) << $shift; - $mUcs4 |= $tmp; - - /** - * End of the multi-octet sequence. mUcs4 now contains the final - * Unicode codepoint to be output - */ - if (0 == --$mState) { - - /* - * Check for illegal sequences and codepoints. - */ - // From Unicode 3.1, non-shortest form is illegal - if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || - ((3 == $mBytes) && ($mUcs4 < 0x0800)) || - ((4 == $mBytes) && ($mUcs4 < 0x10000)) || - (4 < $mBytes) || - // From Unicode 3.2, surrogate characters are illegal - (($mUcs4 & 0xFFFFF800) == 0xD800) || - // Codepoints outside the Unicode range are illegal - ($mUcs4 > 0x10FFFF)) { - - trigger_error( - 'utf8_to_unicode: Illegal sequence or codepoint '. - 'in UTF-8 at byte '.$i, - E_USER_WARNING - ); - - return FALSE; - - } - - if (0xFEFF != $mUcs4) { - // BOM is legal but we don't want to output it - $out[] = $mUcs4; - } - - //initialize UTF8 cache - $mState = 0; - $mUcs4 = 0; - $mBytes = 1; - } - - } else { - /** - *((0xC0 & (*in) != 0x80) && (mState != 0)) - * Incomplete multi-octet sequence. - */ - trigger_error( - 'utf8_to_unicode: Incomplete multi-octet '. - ' sequence in UTF-8 at byte '.$i, - E_USER_WARNING - ); - - return FALSE; - } - } - } - return $out; -} - -//-------------------------------------------------------------------- -/** -* Takes an array of ints representing the Unicode characters and returns -* a UTF-8 string. Astral planes are supported ie. the ints in the -* input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates -* are not allowed. -* Returns false if the input array contains ints that represent -* surrogates or are outside the Unicode range -* and raises a PHP error at level E_USER_WARNING -* Note: this function has been modified slightly in this library to use -* output buffering to concatenate the UTF-8 string (faster) as well as -* reference the array by it's keys -* @param array of unicode code points representing a string -* @return mixed UTF-8 string or FALSE if array contains invalid code points -* @author -* @see utf8_to_unicode -* @see http://hsivonen.iki.fi/php-utf8/ -* @package utf8 -* @subpackage unicode -*/ -function utf8_from_unicode($arr) { - ob_start(); - - foreach (array_keys($arr) as $k) { - - # ASCII range (including control chars) - if ( ($arr[$k] >= 0) && ($arr[$k] <= 0x007f) ) { - - echo chr($arr[$k]); - - # 2 byte sequence - } else if ($arr[$k] <= 0x07ff) { - - echo chr(0xc0 | ($arr[$k] >> 6)); - echo chr(0x80 | ($arr[$k] & 0x003f)); - - # Byte order mark (skip) - } else if($arr[$k] == 0xFEFF) { - - // nop -- zap the BOM - - # Test for illegal surrogates - } else if ($arr[$k] >= 0xD800 && $arr[$k] <= 0xDFFF) { - - // found a surrogate - trigger_error( - 'utf8_from_unicode: Illegal surrogate '. - 'at index: '.$k.', value: '.$arr[$k], - E_USER_WARNING - ); - - return FALSE; - - # 3 byte sequence - } else if ($arr[$k] <= 0xffff) { - - echo chr(0xe0 | ($arr[$k] >> 12)); - echo chr(0x80 | (($arr[$k] >> 6) & 0x003f)); - echo chr(0x80 | ($arr[$k] & 0x003f)); - - # 4 byte sequence - } else if ($arr[$k] <= 0x10ffff) { - - echo chr(0xf0 | ($arr[$k] >> 18)); - echo chr(0x80 | (($arr[$k] >> 12) & 0x3f)); - echo chr(0x80 | (($arr[$k] >> 6) & 0x3f)); - echo chr(0x80 | ($arr[$k] & 0x3f)); - - } else { - - trigger_error( - 'utf8_from_unicode: Codepoint out of Unicode range '. - 'at index: '.$k.', value: '.$arr[$k], - E_USER_WARNING - ); - - // out of range - return FALSE; - } - } - - $result = ob_get_contents(); - ob_end_clean(); - return $result; -} diff --git a/libraries/phputf8/utils/validation.php b/libraries/phputf8/utils/validation.php deleted file mode 100644 index 5f4cd0b879608..0000000000000 --- a/libraries/phputf8/utils/validation.php +++ /dev/null @@ -1,185 +0,0 @@ - -* @param string UTF-8 encoded string -* @return boolean true if valid -* @see http://hsivonen.iki.fi/php-utf8/ -* @see utf8_compliant -* @package utf8 -* @subpackage validation -*/ -function utf8_is_valid($str) { - - $mState = 0; // cached expected number of octets after the current octet - // until the beginning of the next UTF8 character sequence - $mUcs4 = 0; // cached Unicode character - $mBytes = 1; // cached expected number of octets in the current sequence - - $len = strlen($str); - - for($i = 0; $i < $len; $i++) { - - $in = ord($str{$i}); - - if ( $mState == 0) { - - // When mState is zero we expect either a US-ASCII character or a - // multi-octet sequence. - if (0 == (0x80 & ($in))) { - // US-ASCII, pass straight through. - $mBytes = 1; - - } else if (0xC0 == (0xE0 & ($in))) { - // First octet of 2 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x1F) << 6; - $mState = 1; - $mBytes = 2; - - } else if (0xE0 == (0xF0 & ($in))) { - // First octet of 3 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x0F) << 12; - $mState = 2; - $mBytes = 3; - - } else if (0xF0 == (0xF8 & ($in))) { - // First octet of 4 octet sequence - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x07) << 18; - $mState = 3; - $mBytes = 4; - - } else if (0xF8 == (0xFC & ($in))) { - /* First octet of 5 octet sequence. - * - * This is illegal because the encoded codepoint must be either - * (a) not the shortest form or - * (b) outside the Unicode range of 0-0x10FFFF. - * Rather than trying to resynchronize, we will carry on until the end - * of the sequence and let the later error handling code catch it. - */ - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 0x03) << 24; - $mState = 4; - $mBytes = 5; - - } else if (0xFC == (0xFE & ($in))) { - // First octet of 6 octet sequence, see comments for 5 octet sequence. - $mUcs4 = ($in); - $mUcs4 = ($mUcs4 & 1) << 30; - $mState = 5; - $mBytes = 6; - - } else { - /* Current octet is neither in the US-ASCII range nor a legal first - * octet of a multi-octet sequence. - */ - return FALSE; - - } - - } else { - - // When mState is non-zero, we expect a continuation of the multi-octet - // sequence - if (0x80 == (0xC0 & ($in))) { - - // Legal continuation. - $shift = ($mState - 1) * 6; - $tmp = $in; - $tmp = ($tmp & 0x0000003F) << $shift; - $mUcs4 |= $tmp; - - /** - * End of the multi-octet sequence. mUcs4 now contains the final - * Unicode codepoint to be output - */ - if (0 == --$mState) { - - /* - * Check for illegal sequences and codepoints. - */ - // From Unicode 3.1, non-shortest form is illegal - if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || - ((3 == $mBytes) && ($mUcs4 < 0x0800)) || - ((4 == $mBytes) && ($mUcs4 < 0x10000)) || - (4 < $mBytes) || - // From Unicode 3.2, surrogate characters are illegal - (($mUcs4 & 0xFFFFF800) == 0xD800) || - // Codepoints outside the Unicode range are illegal - ($mUcs4 > 0x10FFFF)) { - - return FALSE; - - } - - //initialize UTF8 cache - $mState = 0; - $mUcs4 = 0; - $mBytes = 1; - } - - } else { - /** - *((0xC0 & (*in) != 0x80) && (mState != 0)) - * Incomplete multi-octet sequence. - */ - - return FALSE; - } - } - } - return TRUE; -} - -//-------------------------------------------------------------------- -/** -* Tests whether a string complies as UTF-8. This will be much -* faster than utf8_is_valid but will pass five and six octet -* UTF-8 sequences, which are not supported by Unicode and -* so cannot be displayed correctly in a browser. In other words -* it is not as strict as utf8_is_valid but it's faster. If you use -* is to validate user input, you place yourself at the risk that -* attackers will be able to inject 5 and 6 byte sequences (which -* may or may not be a significant risk, depending on what you are -* are doing) -* @see utf8_is_valid -* @see http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php#54805 -* @param string UTF-8 string to check -* @return boolean TRUE if string is valid UTF-8 -* @package utf8 -* @subpackage validation -*/ -function utf8_compliant($str) { - if ( strlen($str) == 0 ) { - return TRUE; - } - // If even just the first character can be matched, when the /u - // modifier is used, then it's valid UTF-8. If the UTF-8 is somehow - // invalid, nothing at all will match, even if the string contains - // some valid sequences - return (preg_match('/^.{1}/us',$str,$ar) == 1); -} - diff --git a/libraries/phpxmlrpc/compat/array_key_exists.php b/libraries/phpxmlrpc/compat/array_key_exists.php index c5ae5192c0be5..ca44cdda8038a 100644 --- a/libraries/phpxmlrpc/compat/array_key_exists.php +++ b/libraries/phpxmlrpc/compat/array_key_exists.php @@ -1,18 +1,18 @@ | +// | Authors: Aidan Lister | // +----------------------------------------------------------------------+ // // $Id: array_key_exists.php,v 1.1 2005/07/11 16:34:35 ggiunta Exp $ @@ -21,35 +21,35 @@ /** * Replace array_key_exists() * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.array_key_exists - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.1.0 - * @require PHP 4.0.0 (user_error) + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.array_key_exists + * @author Aidan Lister + * @version $Revision: 1.1 $ + * @since PHP 4.1.0 + * @require PHP 4.0.0 (user_error) */ if (!function_exists('array_key_exists')) { - function array_key_exists($key, $search) - { - if (!is_scalar($key)) { - user_error('array_key_exists() The first argument should be either a string or an integer', - E_USER_WARNING); - return false; - } + function array_key_exists($key, $search) + { + if (!is_scalar($key)) { + user_error('array_key_exists() The first argument should be either a string or an integer', + E_USER_WARNING); + return false; + } - if (is_object($search)) { - $search = get_object_vars($search); - } + if (is_object($search)) { + $search = get_object_vars($search); + } - if (!is_array($search)) { - user_error('array_key_exists() The second argument should be either an array or an object', - E_USER_WARNING); - return false; - } + if (!is_array($search)) { + user_error('array_key_exists() The second argument should be either an array or an object', + E_USER_WARNING); + return false; + } - return in_array($key, array_keys($search)); - } + return in_array($key, array_keys($search)); + } } ?> \ No newline at end of file diff --git a/libraries/phpxmlrpc/compat/index.html b/libraries/phpxmlrpc/compat/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/phpxmlrpc/compat/index.html +++ b/libraries/phpxmlrpc/compat/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/phpxmlrpc/compat/is_a.php b/libraries/phpxmlrpc/compat/is_a.php index d98db1f148284..75beb9f181565 100644 --- a/libraries/phpxmlrpc/compat/is_a.php +++ b/libraries/phpxmlrpc/compat/is_a.php @@ -1,18 +1,18 @@ | +// | Authors: Aidan Lister | // +----------------------------------------------------------------------+ // // $Id: is_a.php,v 1.2 2005/11/21 10:57:23 ggiunta Exp $ @@ -21,27 +21,27 @@ /** * Replace function is_a() * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.is_a - * @author Aidan Lister - * @version $Revision: 1.2 $ - * @since PHP 4.2.0 - * @require PHP 4.0.0 (user_error) (is_subclass_of) + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.is_a + * @author Aidan Lister + * @version $Revision: 1.2 $ + * @since PHP 4.2.0 + * @require PHP 4.0.0 (user_error) (is_subclass_of) */ if (!function_exists('is_a')) { - function is_a($object, $class) - { - if (!is_object($object)) { - return false; - } + function is_a($object, $class) + { + if (!is_object($object)) { + return false; + } - if (get_class($object) == strtolower($class)) { - return true; - } else { - return is_subclass_of($object, $class); - } - } + if (get_class($object) == strtolower($class)) { + return true; + } else { + return is_subclass_of($object, $class); + } + } } ?> \ No newline at end of file diff --git a/libraries/phpxmlrpc/compat/is_callable.php b/libraries/phpxmlrpc/compat/is_callable.php index b769c410a214d..636af643c1a81 100644 --- a/libraries/phpxmlrpc/compat/is_callable.php +++ b/libraries/phpxmlrpc/compat/is_callable.php @@ -2,52 +2,52 @@ /** * Replace function is_callable() * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.is_callable - * @author Gaetano Giunta - * @version $Id: is_callable.php,v 1.3 2006/08/21 14:03:15 ggiunta Exp $ - * @since PHP 4.0.6 - * @require PHP 4.0.0 (true, false, etc...) - * @todo add the 3rd parameter syntax... + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.is_callable + * @author Gaetano Giunta + * @version $Id: is_callable.php,v 1.3 2006/08/21 14:03:15 ggiunta Exp $ + * @since PHP 4.0.6 + * @require PHP 4.0.0 (true, false, etc...) + * @todo add the 3rd parameter syntax... */ if (!function_exists('is_callable')) { - function is_callable($var, $syntax_only=false) - { - if ($syntax_only) - { - /* from The Manual: - * If the syntax_only argument is TRUE the function only verifies - * that var might be a function or method. It will only reject simple - * variables that are not strings, or an array that does not have a - * valid structure to be used as a callback. The valid ones are - * supposed to have only 2 entries, the first of which is an object - * or a string, and the second a string - */ - return (is_string($var) || (is_array($var) && count($var) == 2 && is_string(end($var)) && (is_string(reset($var)) || is_object(reset($var))))); - } - else - { - if (is_string($var)) - { - return function_exists($var); - } - else if (is_array($var) && count($var) == 2 && is_string($method = end($var))) - { - $obj = reset($var); - if (is_string($obj)) - { - $methods = get_class_methods($obj); - return (bool)(is_array($methods) && in_array(strtolower($method), $methods)); - } - else if (is_object($obj)) - { - return method_exists($obj, $method); - } - } - return false; - } - } + function is_callable($var, $syntax_only=false) + { + if ($syntax_only) + { + /* from The Manual: + * If the syntax_only argument is TRUE the function only verifies + * that var might be a function or method. It will only reject simple + * variables that are not strings, or an array that does not have a + * valid structure to be used as a callback. The valid ones are + * supposed to have only 2 entries, the first of which is an object + * or a string, and the second a string + */ + return (is_string($var) || (is_array($var) && count($var) == 2 && is_string(end($var)) && (is_string(reset($var)) || is_object(reset($var))))); + } + else + { + if (is_string($var)) + { + return function_exists($var); + } + else if (is_array($var) && count($var) == 2 && is_string($method = end($var))) + { + $obj = reset($var); + if (is_string($obj)) + { + $methods = get_class_methods($obj); + return (bool)(is_array($methods) && in_array(strtolower($method), $methods)); + } + else if (is_object($obj)) + { + return method_exists($obj, $method); + } + } + return false; + } + } } ?> \ No newline at end of file diff --git a/libraries/phpxmlrpc/compat/is_scalar.php b/libraries/phpxmlrpc/compat/is_scalar.php index c8f2bfcd46dc5..9a9087b1de370 100644 --- a/libraries/phpxmlrpc/compat/is_scalar.php +++ b/libraries/phpxmlrpc/compat/is_scalar.php @@ -1,16 +1,16 @@ \ No newline at end of file diff --git a/libraries/phpxmlrpc/compat/var_export.php b/libraries/phpxmlrpc/compat/var_export.php index 3a5ac3f3180ca..d262935582f9d 100644 --- a/libraries/phpxmlrpc/compat/var_export.php +++ b/libraries/phpxmlrpc/compat/var_export.php @@ -1,18 +1,18 @@ | +// | Authors: Aidan Lister | // +----------------------------------------------------------------------+ // // $Id: var_export.php,v 1.2 2005/11/21 10:57:23 ggiunta Exp $ @@ -21,85 +21,85 @@ /** * Replace var_export() * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.var_export - * @author Aidan Lister - * @version $Revision: 1.2 $ - * @since PHP 4.2.0 - * @require PHP 4.0.0 (user_error) + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.var_export + * @author Aidan Lister + * @version $Revision: 1.2 $ + * @since PHP 4.2.0 + * @require PHP 4.0.0 (user_error) */ if (!function_exists('var_export')) { - function var_export($array, $return = false, $lvl=0) - { - // Common output variables - $indent = ' '; - $doublearrow = ' => '; - $lineend = ",\n"; - $stringdelim = '\''; + function var_export($array, $return = false, $lvl=0) + { + // Common output variables + $indent = ' '; + $doublearrow = ' => '; + $lineend = ",\n"; + $stringdelim = '\''; - // Check the export isn't a simple string / int - if (is_string($array)) { - $out = $stringdelim . str_replace('\'', '\\\'', str_replace('\\', '\\\\', $array)) . $stringdelim; - } elseif (is_int($array) || is_float($array)) { - $out = (string)$array; - } elseif (is_bool($array)) { - $out = $array ? 'true' : 'false'; - } elseif (is_null($array)) { - $out = 'NULL'; - } elseif (is_resource($array)) { - $out = 'resource'; - } else { - // Begin the array export - // Start the string - $out = "array (\n"; + // Check the export isn't a simple string / int + if (is_string($array)) { + $out = $stringdelim . str_replace('\'', '\\\'', str_replace('\\', '\\\\', $array)) . $stringdelim; + } elseif (is_int($array) || is_float($array)) { + $out = (string)$array; + } elseif (is_bool($array)) { + $out = $array ? 'true' : 'false'; + } elseif (is_null($array)) { + $out = 'NULL'; + } elseif (is_resource($array)) { + $out = 'resource'; + } else { + // Begin the array export + // Start the string + $out = "array (\n"; - // Loop through each value in array - foreach ($array as $key => $value) { - // If the key is a string, delimit it - if (is_string($key)) { - $key = str_replace('\'', '\\\'', str_replace('\\', '\\\\', $key)); - $key = $stringdelim . $key . $stringdelim; - } + // Loop through each value in array + foreach ($array as $key => $value) { + // If the key is a string, delimit it + if (is_string($key)) { + $key = str_replace('\'', '\\\'', str_replace('\\', '\\\\', $key)); + $key = $stringdelim . $key . $stringdelim; + } - $val = var_export($value, true, $lvl+1); - // Delimit value - /*if (is_array($value)) { - // We have an array, so do some recursion - // Do some basic recursion while increasing the indent - $recur_array = explode($newline, var_export($value, true)); - $temp_array = array(); - foreach ($recur_array as $recur_line) { - $temp_array[] = $indent . $recur_line; - } - $recur_array = implode($newline, $temp_array); - $value = $newline . $recur_array; - } elseif (is_null($value)) { - $value = 'NULL'; - } else { - $value = str_replace($find, $replace, $value); - $value = $stringdelim . $value . $stringdelim; - }*/ + $val = var_export($value, true, $lvl+1); + // Delimit value + /*if (is_array($value)) { + // We have an array, so do some recursion + // Do some basic recursion while increasing the indent + $recur_array = explode($newline, var_export($value, true)); + $temp_array = array(); + foreach ($recur_array as $recur_line) { + $temp_array[] = $indent . $recur_line; + } + $recur_array = implode($newline, $temp_array); + $value = $newline . $recur_array; + } elseif (is_null($value)) { + $value = 'NULL'; + } else { + $value = str_replace($find, $replace, $value); + $value = $stringdelim . $value . $stringdelim; + }*/ - // Piece together the line - for ($i = 0; $i < $lvl; $i++) - $out .= $indent; - $out .= $key . $doublearrow . $val . $lineend; - } + // Piece together the line + for ($i = 0; $i < $lvl; $i++) + $out .= $indent; + $out .= $key . $doublearrow . $val . $lineend; + } - // End our string - for ($i = 0; $i < $lvl; $i++) - $out .= $indent; - $out .= ")"; - } + // End our string + for ($i = 0; $i < $lvl; $i++) + $out .= $indent; + $out .= ")"; + } - // Decide method of output - if ($return === true) { - return $out; - } else { - echo $out; - return; - } - } + // Decide method of output + if ($return === true) { + return $out; + } else { + echo $out; + return; + } + } } ?> \ No newline at end of file diff --git a/libraries/phpxmlrpc/compat/version_compare.php b/libraries/phpxmlrpc/compat/version_compare.php index fc3abac098548..974d7fb2351d8 100644 --- a/libraries/phpxmlrpc/compat/version_compare.php +++ b/libraries/phpxmlrpc/compat/version_compare.php @@ -1,19 +1,19 @@ | -// | Aidan Lister | +// | Authors: Philippe Jausions | +// | Aidan Lister | // +----------------------------------------------------------------------+ // // $Id: version_compare.php,v 1.1 2005/07/11 16:34:36 ggiunta Exp $ @@ -22,158 +22,158 @@ /** * Replace version_compare() * - * @category PHP - * @package PHP_Compat - * @link http://php.net/function.version_compare - * @author Philippe Jausions - * @author Aidan Lister - * @version $Revision: 1.1 $ - * @since PHP 4.1.0 - * @require PHP 4.0.0 (user_error) + * @category PHP + * @package PHP_Compat + * @link http://php.net/function.version_compare + * @author Philippe Jausions + * @author Aidan Lister + * @version $Revision: 1.1 $ + * @since PHP 4.1.0 + * @require PHP 4.0.0 (user_error) */ if (!function_exists('version_compare')) { - function version_compare($version1, $version2, $operator = '<') - { - // Check input - if (!is_scalar($version1)) { - user_error('version_compare() expects parameter 1 to be string, ' . - gettype($version1) . ' given', E_USER_WARNING); - return; - } + function version_compare($version1, $version2, $operator = '<') + { + // Check input + if (!is_scalar($version1)) { + user_error('version_compare() expects parameter 1 to be string, ' . + gettype($version1) . ' given', E_USER_WARNING); + return; + } - if (!is_scalar($version2)) { - user_error('version_compare() expects parameter 2 to be string, ' . - gettype($version2) . ' given', E_USER_WARNING); - return; - } + if (!is_scalar($version2)) { + user_error('version_compare() expects parameter 2 to be string, ' . + gettype($version2) . ' given', E_USER_WARNING); + return; + } - if (!is_scalar($operator)) { - user_error('version_compare() expects parameter 3 to be string, ' . - gettype($operator) . ' given', E_USER_WARNING); - return; - } + if (!is_scalar($operator)) { + user_error('version_compare() expects parameter 3 to be string, ' . + gettype($operator) . ' given', E_USER_WARNING); + return; + } - // Standardise versions - $v1 = explode('.', - str_replace('..', '.', - preg_replace('/([^0-9\.]+)/', '.$1.', - str_replace(array('-', '_', '+'), '.', - trim($version1))))); + // Standardise versions + $v1 = explode('.', + str_replace('..', '.', + preg_replace('/([^0-9\.]+)/', '.$1.', + str_replace(array('-', '_', '+'), '.', + trim($version1))))); - $v2 = explode('.', - str_replace('..', '.', - preg_replace('/([^0-9\.]+)/', '.$1.', - str_replace(array('-', '_', '+'), '.', - trim($version2))))); + $v2 = explode('.', + str_replace('..', '.', + preg_replace('/([^0-9\.]+)/', '.$1.', + str_replace(array('-', '_', '+'), '.', + trim($version2))))); - // Replace empty entries at the start of the array - while (empty($v1[0]) && array_shift($v1)) {} - while (empty($v2[0]) && array_shift($v2)) {} + // Replace empty entries at the start of the array + while (empty($v1[0]) && array_shift($v1)) {} + while (empty($v2[0]) && array_shift($v2)) {} - // Release state order - // '#' stands for any number - $versions = array( - 'dev' => 0, - 'alpha' => 1, - 'a' => 1, - 'beta' => 2, - 'b' => 2, - 'RC' => 3, - '#' => 4, - 'p' => 5, - 'pl' => 5); + // Release state order + // '#' stands for any number + $versions = array( + 'dev' => 0, + 'alpha' => 1, + 'a' => 1, + 'beta' => 2, + 'b' => 2, + 'RC' => 3, + '#' => 4, + 'p' => 5, + 'pl' => 5); - // Loop through each segment in the version string - $compare = 0; - for ($i = 0, $x = min(count($v1), count($v2)); $i < $x; $i++) { - if ($v1[$i] == $v2[$i]) { - continue; - } - $i1 = $v1[$i]; - $i2 = $v2[$i]; - if (is_numeric($i1) && is_numeric($i2)) { - $compare = ($i1 < $i2) ? -1 : 1; - break; - } - // We use the position of '#' in the versions list - // for numbers... (so take care of # in original string) - if ($i1 == '#') { - $i1 = ''; - } elseif (is_numeric($i1)) { - $i1 = '#'; - } - if ($i2 == '#') { - $i2 = ''; - } elseif (is_numeric($i2)) { - $i2 = '#'; - } - if (isset($versions[$i1]) && isset($versions[$i2])) { - $compare = ($versions[$i1] < $versions[$i2]) ? -1 : 1; - } elseif (isset($versions[$i1])) { - $compare = 1; - } elseif (isset($versions[$i2])) { - $compare = -1; - } else { - $compare = 0; - } + // Loop through each segment in the version string + $compare = 0; + for ($i = 0, $x = min(count($v1), count($v2)); $i < $x; $i++) { + if ($v1[$i] == $v2[$i]) { + continue; + } + $i1 = $v1[$i]; + $i2 = $v2[$i]; + if (is_numeric($i1) && is_numeric($i2)) { + $compare = ($i1 < $i2) ? -1 : 1; + break; + } + // We use the position of '#' in the versions list + // for numbers... (so take care of # in original string) + if ($i1 == '#') { + $i1 = ''; + } elseif (is_numeric($i1)) { + $i1 = '#'; + } + if ($i2 == '#') { + $i2 = ''; + } elseif (is_numeric($i2)) { + $i2 = '#'; + } + if (isset($versions[$i1]) && isset($versions[$i2])) { + $compare = ($versions[$i1] < $versions[$i2]) ? -1 : 1; + } elseif (isset($versions[$i1])) { + $compare = 1; + } elseif (isset($versions[$i2])) { + $compare = -1; + } else { + $compare = 0; + } - break; - } + break; + } - // If previous loop didn't find anything, compare the "extra" segments - if ($compare == 0) { - if (count($v2) > count($v1)) { - if (isset($versions[$v2[$i]])) { - $compare = ($versions[$v2[$i]] < 4) ? 1 : -1; - } else { - $compare = -1; - } - } elseif (count($v2) < count($v1)) { - if (isset($versions[$v1[$i]])) { - $compare = ($versions[$v1[$i]] < 4) ? -1 : 1; - } else { - $compare = 1; - } - } - } + // If previous loop didn't find anything, compare the "extra" segments + if ($compare == 0) { + if (count($v2) > count($v1)) { + if (isset($versions[$v2[$i]])) { + $compare = ($versions[$v2[$i]] < 4) ? 1 : -1; + } else { + $compare = -1; + } + } elseif (count($v2) < count($v1)) { + if (isset($versions[$v1[$i]])) { + $compare = ($versions[$v1[$i]] < 4) ? -1 : 1; + } else { + $compare = 1; + } + } + } - // Compare the versions - if (func_num_args() > 2) { - switch ($operator) { - case '>': - case 'gt': - return (bool) ($compare > 0); - break; - case '>=': - case 'ge': - return (bool) ($compare >= 0); - break; - case '<=': - case 'le': - return (bool) ($compare <= 0); - break; - case '==': - case '=': - case 'eq': - return (bool) ($compare == 0); - break; - case '<>': - case '!=': - case 'ne': - return (bool) ($compare != 0); - break; - case '': - case '<': - case 'lt': - return (bool) ($compare < 0); - break; - default: - return; - } - } + // Compare the versions + if (func_num_args() > 2) { + switch ($operator) { + case '>': + case 'gt': + return (bool) ($compare > 0); + break; + case '>=': + case 'ge': + return (bool) ($compare >= 0); + break; + case '<=': + case 'le': + return (bool) ($compare <= 0); + break; + case '==': + case '=': + case 'eq': + return (bool) ($compare == 0); + break; + case '<>': + case '!=': + case 'ne': + return (bool) ($compare != 0); + break; + case '': + case '<': + case 'lt': + return (bool) ($compare < 0); + break; + default: + return; + } + } - return $compare; - } + return $compare; + } } ?> \ No newline at end of file diff --git a/libraries/phpxmlrpc/index.html b/libraries/phpxmlrpc/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/phpxmlrpc/index.html +++ b/libraries/phpxmlrpc/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/phpxmlrpc/xmlrpc.php b/libraries/phpxmlrpc/xmlrpc.php index 0c3702e9c6e5b..acb3d8b0b377d 100644 --- a/libraries/phpxmlrpc/xmlrpc.php +++ b/libraries/phpxmlrpc/xmlrpc.php @@ -10,17 +10,17 @@ // modification, are permitted provided that the following conditions // are met: // -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. // -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. // -// * Neither the name of the "XML-RPC for PHP" nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. +// * Neither the name of the "XML-RPC for PHP" nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -83,14 +83,14 @@ $GLOBALS['xmlrpcValue']='undefined'; $GLOBALS['xmlrpcTypes']=array( - $GLOBALS['xmlrpcI4'] => 1, - $GLOBALS['xmlrpcInt'] => 1, + $GLOBALS['xmlrpcI4'] => 1, + $GLOBALS['xmlrpcInt'] => 1, $GLOBALS['xmlrpcBoolean'] => 1, $GLOBALS['xmlrpcString'] => 1, $GLOBALS['xmlrpcDouble'] => 1, $GLOBALS['xmlrpcDateTime'] => 1, $GLOBALS['xmlrpcBase64'] => 1, - $GLOBALS['xmlrpcArray'] => 2, + $GLOBALS['xmlrpcArray'] => 2, $GLOBALS['xmlrpcStruct'] => 3 ); @@ -243,11 +243,11 @@ // isf - used to indicate a parsing fault (2) or xmlrpcresp fault (1) // isf_reason - used for storing xmlrpcresp fault string // lv - used to indicate "looking for a value": implements - // the logic to allow values with no types to be strings + // the logic to allow values with no types to be strings // params - used to store parameters in method calls // method - used to store method name // stack - array with genealogy of xml elements names: - // used to validate nesting of xmlrpc elements + // used to validate nesting of xmlrpc elements $GLOBALS['_xh']=null; /** @@ -384,7 +384,7 @@ function xmlrpc_se($parser, $name, $attrs, $accept_single_vals=false) // check for correct element nesting // top level element can only be of 2 types /// @todo optimization creep: save this check into a bool variable, instead of using count() every time: - /// there is only a single top level element in xml anyway + /// there is only a single top level element in xml anyway if (count($GLOBALS['_xh']['stack']) == 0) { if ($name != 'METHODRESPONSE' && $name != 'METHODCALL' && ( @@ -594,8 +594,8 @@ function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true) case 'DATETIME.ISO8601': case 'BASE64': $GLOBALS['_xh']['vt']=strtolower($name); - /// @todo: optimization creep - remove the if/elseif cycle below - /// since the case() in which we are already did that + /// @todo: optimization creep - remove the if/elseif cycle below + /// since the case() in which we are already did that if ($name=='STRING') { $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac']; @@ -3533,9 +3533,9 @@ function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null) // 1 - test if encoding is specified in HTTP HEADERS //Details: - // LWS: (\13\10)?( |\t)+ - // token: (any char but excluded stuff)+ - // header: Content-type = ...; charset=value(; ...)* + // LWS: (\13\10)?( |\t)+ + // token: (any char but excluded stuff)+ + // header: Content-type = ...; charset=value(; ...)* // where value is of type token, no LWS allowed between 'charset' and value // Note: we do not check for invalid chars in VALUE: // this had better be done using pure ereg as below @@ -3548,10 +3548,10 @@ function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null) } // 2 - scan the first bytes of the data for a UTF-16 (or other) BOM pattern - // (source: http://www.w3.org/TR/2000/REC-xml-20001006) - // NOTE: actually, according to the spec, even if we find the BOM and determine - // an encoding, we should check if there is an encoding specified - // in the xml declaration, and verify if they match. + // (source: http://www.w3.org/TR/2000/REC-xml-20001006) + // NOTE: actually, according to the spec, even if we find the BOM and determine + // an encoding, we should check if there is an encoding specified + // in the xml declaration, and verify if they match. /// @todo implement check as described above? /// @todo implement check for first bytes of string even without a BOM? (It sure looks harder than for cases WITH a BOM) if(preg_match('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\x00\x00\xFF\xFE|\xFE\xFF\x00\x00)/', $xmlchunk)) @@ -3569,8 +3569,8 @@ function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null) // 3 - test if encoding is specified in the xml declaration // Details: - // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ - // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* + // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+ + // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]* if (preg_match('/^<\?xml\s+version\s*=\s*'. "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))". '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/", $xmlchunk, $matches)) diff --git a/libraries/phpxmlrpc/xmlrpc_wrappers.php b/libraries/phpxmlrpc/xmlrpc_wrappers.php index 0b6f5b210a791..8c95116db6343 100644 --- a/libraries/phpxmlrpc/xmlrpc_wrappers.php +++ b/libraries/phpxmlrpc/xmlrpc_wrappers.php @@ -124,12 +124,12 @@ function xmlrpc_2_php_type($xmlrpctype) * @param string $funcname the name of the PHP user function to be exposed as xmlrpc method; array($obj, 'methodname') might be ok too, in the future... * @param string $newfuncname (optional) name for function to be created * @param array $extra_options (optional) array of options for conversion. valid values include: - * bool return_source when true, php code w. function definition will be returned, not evaluated - * bool encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects - * bool decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers --- - * bool suppress_warnings remove from produced xml any runtime warnings due to the php function being invoked + * bool return_source when true, php code w. function definition will be returned, not evaluated + * bool encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects + * bool decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers --- + * bool suppress_warnings remove from produced xml any runtime warnings due to the php function being invoked * @return false on error, or an array containing the name of the new php function, - * its signature and docs, to be used in the server dispatch map + * its signature and docs, to be used in the server dispatch map * * @todo decide how to deal with params passed by ref: bomb out or allow? * @todo finish using javadoc info to build method sig if all params are named but out of order @@ -419,19 +419,19 @@ function wrap_php_function($funcname, $newfuncname='', $extra_options=array()) * An extra 'debug' param is appended to param list of xmlrpc method, useful * for debugging purposes. * - * @param xmlrpc_client $client an xmlrpc client set up correctly to communicate with target server - * @param string $methodname the xmlrpc method to be mapped to a php function - * @param array $extra_options array of options that specify conversion details. valid ptions include - * integer signum the index of the method signature to use in mapping (if method exposes many sigs) - * integer timeout timeout (in secs) to be used when executing function/calling remote method - * string protocol 'http' (default), 'http11' or 'https' - * string new_function_name the name of php function to create. If unsepcified, lib will pick an appropriate name - * string return_source if true return php code w. function definition instead fo function name - * bool encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects - * bool decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers --- - * mixed return_on_fault a php value to be returned when the xmlrpc call fails/returns a fault response (by default the xmlrpcresp object is returned in this case). If a string is used, '%faultCode%' and '%faultString%' tokens will be substituted with actual error values - * bool debug set it to 1 or 2 to see debug results of querying server for method synopsis - * @return string the name of the generated php function (or false) - OR AN ARRAY... + * @param xmlrpc_client $client an xmlrpc client set up correctly to communicate with target server + * @param string $methodname the xmlrpc method to be mapped to a php function + * @param array $extra_options array of options that specify conversion details. valid ptions include + * integer signum the index of the method signature to use in mapping (if method exposes many sigs) + * integer timeout timeout (in secs) to be used when executing function/calling remote method + * string protocol 'http' (default), 'http11' or 'https' + * string new_function_name the name of php function to create. If unsepcified, lib will pick an appropriate name + * string return_source if true return php code w. function definition instead fo function name + * bool encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects + * bool decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers --- + * mixed return_on_fault a php value to be returned when the xmlrpc call fails/returns a fault response (by default the xmlrpcresp object is returned in this case). If a string is used, '%faultCode%' and '%faultString%' tokens will be substituted with actual error values + * bool debug set it to 1 or 2 to see debug results of querying server for method synopsis + * @return string the name of the generated php function (or false) - OR AN ARRAY... */ function wrap_xmlrpc_method($client, $methodname, $extra_options=0, $timeout=0, $protocol='', $newfuncname='') { diff --git a/libraries/phpxmlrpc/xmlrpcs.php b/libraries/phpxmlrpc/xmlrpcs.php index 37e9ecfe2fcbe..290d9bace1f1d 100644 --- a/libraries/phpxmlrpc/xmlrpcs.php +++ b/libraries/phpxmlrpc/xmlrpcs.php @@ -10,17 +10,17 @@ // modification, are permitted provided that the following conditions // are met: // -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. // -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. // -// * Neither the name of the "XML-RPC for PHP" nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. +// * Neither the name of the "XML-RPC for PHP" nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT diff --git a/libraries/simplepie/idn/idna_convert.class.php b/libraries/simplepie/idn/idna_convert.class.php index ed2bae26dbacd..a8203b8a73642 100644 --- a/libraries/simplepie/idn/idna_convert.class.php +++ b/libraries/simplepie/idn/idna_convert.class.php @@ -5,19 +5,19 @@ // // +----------------------------------------------------------------------+ // | This library is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU Lesser General Public License as | +// | it under the terms of the GNU Lesser General Public License as | // | published by the Free Software Foundation; either version 2.1 of the | -// | License, or (at your option) any later version. | -// | | +// | License, or (at your option) any later version. | +// | | // | This library is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | Lesser General Public License for more details. | -// | | -// | You should have received a copy of the GNU Lesser General Public | +// | WITHOUT ANY WARRANTY; without even the implied warranty of | +// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | +// | Lesser General Public License for more details. | +// | | +// | You should have received a copy of the GNU Lesser General Public | // | License along with this library; if not, write to the Free Software | // | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | -// | USA. | +// | USA. | // +----------------------------------------------------------------------+ // @@ -53,889 +53,889 @@ */ class idna_convert { - /** - * Holds all relevant mapping tables, loaded from a seperate file on construct - * See RFC3454 for details - * - * @var array - * @access private - */ - var $NP = array(); - - // Internal settings, do not mess with them - var $_punycode_prefix = 'xn--'; - var $_invalid_ucs = 0x80000000; - var $_max_ucs = 0x10FFFF; - var $_base = 36; - var $_tmin = 1; - var $_tmax = 26; - var $_skew = 38; - var $_damp = 700; - var $_initial_bias = 72; - var $_initial_n = 0x80; - var $_sbase = 0xAC00; - var $_lbase = 0x1100; - var $_vbase = 0x1161; - var $_tbase = 0x11A7; - var $_lcount = 19; - var $_vcount = 21; - var $_tcount = 28; - var $_ncount = 588; // _vcount * _tcount - var $_scount = 11172; // _lcount * _tcount * _vcount - var $_error = false; - - // See {@link set_paramter()} for details of how to change the following - // settings from within your script / application - var $_api_encoding = 'utf8'; // Default input charset is UTF-8 - var $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden - var $_strict_mode = false; // Behave strict or not - - // The constructor - function idna_convert($options = false) - { - $this->slast = $this->_sbase + $this->_lcount * $this->_vcount * $this->_tcount; - if (function_exists('file_get_contents')) { - $this->NP = unserialize(file_get_contents(dirname(__FILE__).'/npdata.ser')); - } else { - $this->NP = unserialize(join('', file(dirname(__FILE__).'/npdata.ser'))); - } - // If parameters are given, pass these to the respective method - if (is_array($options)) { - return $this->set_parameter($options); - } - return true; - } - - /** - * Sets a new option value. Available options and values: - * [encoding - Use either UTF-8, UCS4 as array or UCS4 as string as input ('utf8' for UTF-8, - * 'ucs4_string' and 'ucs4_array' respectively for UCS4); The output is always UTF-8] - * [overlong - Unicode does not allow unnecessarily long encodings of chars, - * to allow this, set this parameter to true, else to false; - * default is false.] - * [strict - true: strict mode, good for registration purposes - Causes errors - * on failures; false: loose mode, ideal for "wildlife" applications - * by silently ignoring errors and returning the original input instead - * - * @param mixed Parameter to set (string: single parameter; array of Parameter => Value pairs) - * @param string Value to use (if parameter 1 is a string) - * @return boolean true on success, false otherwise - * @access public - */ - function set_parameter($option, $value = false) - { - if (!is_array($option)) { - $option = array($option => $value); - } - foreach ($option as $k => $v) { - switch ($k) { - case 'encoding': - switch ($v) { - case 'utf8': - case 'ucs4_string': - case 'ucs4_array': - $this->_api_encoding = $v; - break; - default: - $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); - return false; - } - break; - case 'overlong': - $this->_allow_overlong = ($v) ? true : false; - break; - case 'strict': - $this->_strict_mode = ($v) ? true : false; - break; - default: - $this->_error('Set Parameter: Unknown option '.$k); - return false; - } - } - return true; - } - - /** - * Decode a given ACE domain name - * @param string Domain name (ACE string) - * [@param string Desired output encoding, see {@link set_parameter}] - * @return string Decoded Domain name (UTF-8 or UCS-4) - * @access public - */ - function decode($input, $one_time_encoding = false) - { - // Optionally set - if ($one_time_encoding) { - switch ($one_time_encoding) { - case 'utf8': - case 'ucs4_string': - case 'ucs4_array': - break; - default: - $this->_error('Unknown encoding '.$one_time_encoding); - return false; - } - } - // Make sure to drop any newline characters around - $input = trim($input); - - // Negotiate input and try to determine, whether it is a plain string, - // an email address or something like a complete URL - if (strpos($input, '@')) { // Maybe it is an email address - // No no in strict mode - if ($this->_strict_mode) { - $this->_error('Only simple domain name parts can be handled in strict mode'); - return false; - } - list ($email_pref, $input) = explode('@', $input, 2); - $arr = explode('.', $input); - foreach ($arr as $k => $v) { - if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { - $conv = $this->_decode($v); - if ($conv) $arr[$k] = $conv; - } - } - $input = join('.', $arr); - $arr = explode('.', $email_pref); - foreach ($arr as $k => $v) { - if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { - $conv = $this->_decode($v); - if ($conv) $arr[$k] = $conv; - } - } - $email_pref = join('.', $arr); - $return = $email_pref . '@' . $input; - } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters) - // No no in strict mode - if ($this->_strict_mode) { - $this->_error('Only simple domain name parts can be handled in strict mode'); - return false; - } - $parsed = parse_url($input); - if (isset($parsed['host'])) { - $arr = explode('.', $parsed['host']); - foreach ($arr as $k => $v) { - $conv = $this->_decode($v); - if ($conv) $arr[$k] = $conv; - } - $parsed['host'] = join('.', $arr); - $return = - (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')) - .(empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@') - .$parsed['host'] - .(empty($parsed['port']) ? '' : ':'.$parsed['port']) - .(empty($parsed['path']) ? '' : $parsed['path']) - .(empty($parsed['query']) ? '' : '?'.$parsed['query']) - .(empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']); - } else { // parse_url seems to have failed, try without it - $arr = explode('.', $input); - foreach ($arr as $k => $v) { - $conv = $this->_decode($v); - $arr[$k] = ($conv) ? $conv : $v; - } - $return = join('.', $arr); - } - } else { // Otherwise we consider it being a pure domain name string - $return = $this->_decode($input); - if (!$return) $return = $input; - } - // The output is UTF-8 by default, other output formats need conversion here - // If one time encoding is given, use this, else the objects property - switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) { - case 'utf8': - return $return; - break; - case 'ucs4_string': - return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); - break; - case 'ucs4_array': - return $this->_utf8_to_ucs4($return); - break; - default: - $this->_error('Unsupported output format'); - return false; - } - } - - /** - * Encode a given UTF-8 domain name - * @param string Domain name (UTF-8 or UCS-4) - * [@param string Desired input encoding, see {@link set_parameter}] - * @return string Encoded Domain name (ACE string) - * @access public - */ - function encode($decoded, $one_time_encoding = false) - { - // Forcing conversion of input to UCS4 array - // If one time encoding is given, use this, else the objects property - switch ($one_time_encoding ? $one_time_encoding : $this->_api_encoding) { - case 'utf8': - $decoded = $this->_utf8_to_ucs4($decoded); - break; - case 'ucs4_string': - $decoded = $this->_ucs4_string_to_ucs4($decoded); - case 'ucs4_array': - break; - default: - $this->_error('Unsupported input format: '.($one_time_encoding ? $one_time_encoding : $this->_api_encoding)); - return false; - } - - // No input, no output, what else did you expect? - if (empty($decoded)) return ''; - - // Anchors for iteration - $last_begin = 0; - // Output string - $output = ''; - foreach ($decoded as $k => $v) { - // Make sure to use just the plain dot - switch($v) { - case 0x3002: - case 0xFF0E: - case 0xFF61: - $decoded[$k] = 0x2E; - // Right, no break here, the above are converted to dots anyway - // Stumbling across an anchoring character - case 0x2E: - case 0x2F: - case 0x3A: - case 0x3F: - case 0x40: - // Neither email addresses nor URLs allowed in strict mode - if ($this->_strict_mode) { - $this->_error('Neither email addresses nor URLs are allowed in strict mode.'); - return false; - } else { - // Skip first char - if ($k) { - $encoded = ''; - $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin))); - if ($encoded) { - $output .= $encoded; - } else { - $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin))); - } - $output .= chr($decoded[$k]); - } - $last_begin = $k + 1; - } - } - } - // Catch the rest of the string - if ($last_begin) { - $inp_len = sizeof($decoded); - $encoded = ''; - $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len)-$last_begin))); - if ($encoded) { - $output .= $encoded; - } else { - $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len)-$last_begin))); - } - return $output; - } else { - if ($output = $this->_encode($decoded)) { - return $output; - } else { - return $this->_ucs4_to_utf8($decoded); - } - } - } - - /** - * Use this method to get the last error ocurred - * @param void - * @return string The last error, that occured - * @access public - */ - function get_last_error() - { - return $this->_error; - } - - /** - * The actual decoding algorithm - * @access private - */ - function _decode($encoded) - { - // We do need to find the Punycode prefix - if (!preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $encoded)) { - $this->_error('This is not a punycode string'); - return false; - } - $encode_test = preg_replace('!^'.preg_quote($this->_punycode_prefix, '!').'!', '', $encoded); - // If nothing left after removing the prefix, it is hopeless - if (!$encode_test) { - $this->_error('The given encoded string was empty'); - return false; - } - // Find last occurence of the delimiter - $delim_pos = strrpos($encoded, '-'); - if ($delim_pos > strlen($this->_punycode_prefix)) { - for ($k = strlen($this->_punycode_prefix); $k < $delim_pos; ++$k) { - $decoded[] = ord($encoded{$k}); - } - } else { - $decoded = array(); - } - $deco_len = count($decoded); - $enco_len = strlen($encoded); - - // Wandering through the strings; init - $is_first = true; - $bias = $this->_initial_bias; - $idx = 0; - $char = $this->_initial_n; - - for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) { - for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_base) { - $digit = $this->_decode_digit($encoded{$enco_idx++}); - $idx += $digit * $w; - $t = ($k <= $bias) ? $this->_tmin : - (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); - if ($digit < $t) break; - $w = (int) ($w * ($this->_base - $t)); - } - $bias = $this->_adapt($idx - $old_idx, $deco_len + 1, $is_first); - $is_first = false; - $char += (int) ($idx / ($deco_len + 1)); - $idx %= ($deco_len + 1); - if ($deco_len > 0) { - // Make room for the decoded char - for ($i = $deco_len; $i > $idx; $i--) { - $decoded[$i] = $decoded[($i - 1)]; - } - } - $decoded[$idx++] = $char; - } - return $this->_ucs4_to_utf8($decoded); - } - - /** - * The actual encoding algorithm - * @access private - */ - function _encode($decoded) - { - // We cannot encode a domain name containing the Punycode prefix - $extract = strlen($this->_punycode_prefix); - $check_pref = $this->_utf8_to_ucs4($this->_punycode_prefix); - $check_deco = array_slice($decoded, 0, $extract); - - if ($check_pref == $check_deco) { - $this->_error('This is already a punycode string'); - return false; - } - // We will not try to encode strings consisting of basic code points only - $encodable = false; - foreach ($decoded as $k => $v) { - if ($v > 0x7a) { - $encodable = true; - break; - } - } - if (!$encodable) { - $this->_error('The given string does not contain encodable chars'); - return false; - } - - // Do NAMEPREP - $decoded = $this->_nameprep($decoded); - if (!$decoded || !is_array($decoded)) return false; // NAMEPREP failed - - $deco_len = count($decoded); - if (!$deco_len) return false; // Empty array - - $codecount = 0; // How many chars have been consumed - - $encoded = ''; - // Copy all basic code points to output - for ($i = 0; $i < $deco_len; ++$i) { - $test = $decoded[$i]; - // Will match [-0-9a-zA-Z] - if ((0x2F < $test && $test < 0x40) || (0x40 < $test && $test < 0x5B) - || (0x60 < $test && $test <= 0x7B) || (0x2D == $test)) { - $encoded .= chr($decoded[$i]); - $codecount++; - } - } - if ($codecount == $deco_len) return $encoded; // All codepoints were basic ones - - // Start with the prefix; copy it to output - $encoded = $this->_punycode_prefix.$encoded; - - // If we have basic code points in output, add an hyphen to the end - if ($codecount) $encoded .= '-'; - - // Now find and encode all non-basic code points - $is_first = true; - $cur_code = $this->_initial_n; - $bias = $this->_initial_bias; - $delta = 0; - while ($codecount < $deco_len) { - // Find the smallest code point >= the current code point and - // remember the last ouccrence of it in the input - for ($i = 0, $next_code = $this->_max_ucs; $i < $deco_len; $i++) { - if ($decoded[$i] >= $cur_code && $decoded[$i] <= $next_code) { - $next_code = $decoded[$i]; - } - } - - $delta += ($next_code - $cur_code) * ($codecount + 1); - $cur_code = $next_code; - - // Scan input again and encode all characters whose code point is $cur_code - for ($i = 0; $i < $deco_len; $i++) { - if ($decoded[$i] < $cur_code) { - $delta++; - } elseif ($decoded[$i] == $cur_code) { - for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) { - $t = ($k <= $bias) ? $this->_tmin : - (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); - if ($q < $t) break; - $encoded .= $this->_encode_digit(intval($t + (($q - $t) % ($this->_base - $t)))); //v0.4.5 Changed from ceil() to intval() - $q = (int) (($q - $t) / ($this->_base - $t)); - } - $encoded .= $this->_encode_digit($q); - $bias = $this->_adapt($delta, $codecount+1, $is_first); - $codecount++; - $delta = 0; - $is_first = false; - } - } - $delta++; - $cur_code++; - } - return $encoded; - } - - /** - * Adapt the bias according to the current code point and position - * @access private - */ - function _adapt($delta, $npoints, $is_first) - { - $delta = intval($is_first ? ($delta / $this->_damp) : ($delta / 2)); - $delta += intval($delta / $npoints); - for ($k = 0; $delta > (($this->_base - $this->_tmin) * $this->_tmax) / 2; $k += $this->_base) { - $delta = intval($delta / ($this->_base - $this->_tmin)); - } - return intval($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew)); - } - - /** - * Encoding a certain digit - * @access private - */ - function _encode_digit($d) - { - return chr($d + 22 + 75 * ($d < 26)); - } - - /** - * Decode a certain digit - * @access private - */ - function _decode_digit($cp) - { - $cp = ord($cp); - return ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $this->_base)); - } - - /** - * Internal error handling method - * @access private - */ - function _error($error = '') - { - $this->_error = $error; - } - - /** - * Do Nameprep according to RFC3491 and RFC3454 - * @param array Unicode Characters - * @return string Unicode Characters, Nameprep'd - * @access private - */ - function _nameprep($input) - { - $output = array(); - $error = false; - // - // Mapping - // Walking through the input array, performing the required steps on each of - // the input chars and putting the result into the output array - // While mapping required chars we apply the cannonical ordering - foreach ($input as $v) { - // Map to nothing == skip that code point - if (in_array($v, $this->NP['map_nothing'])) continue; - - // Try to find prohibited input - if (in_array($v, $this->NP['prohibit']) || in_array($v, $this->NP['general_prohibited'])) { - $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); - return false; - } - foreach ($this->NP['prohibit_ranges'] as $range) { - if ($range[0] <= $v && $v <= $range[1]) { - $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); - return false; - } - } - // - // Hangul syllable decomposition - if (0xAC00 <= $v && $v <= 0xD7AF) { - foreach ($this->_hangul_decompose($v) as $out) { - $output[] = (int) $out; - } - // There's a decomposition mapping for that code point - } elseif (isset($this->NP['replacemaps'][$v])) { - foreach ($this->_apply_cannonical_ordering($this->NP['replacemaps'][$v]) as $out) { - $output[] = (int) $out; - } - } else { - $output[] = (int) $v; - } - } - // Before applying any Combining, try to rearrange any Hangul syllables - $output = $this->_hangul_compose($output); - // - // Combine code points - // - $last_class = 0; - $last_starter = 0; - $out_len = count($output); - for ($i = 0; $i < $out_len; ++$i) { - $class = $this->_get_combining_class($output[$i]); - if ((!$last_class || $last_class > $class) && $class) { - // Try to match - $seq_len = $i - $last_starter; - $out = $this->_combine(array_slice($output, $last_starter, $seq_len)); - // On match: Replace the last starter with the composed character and remove - // the now redundant non-starter(s) - if ($out) { - $output[$last_starter] = $out; - if (count($out) != $seq_len) { - for ($j = $i+1; $j < $out_len; ++$j) { - $output[$j-1] = $output[$j]; - } - unset($output[$out_len]); - } - // Rewind the for loop by one, since there can be more possible compositions - $i--; - $out_len--; - $last_class = ($i == $last_starter) ? 0 : $this->_get_combining_class($output[$i-1]); - continue; - } - } - // The current class is 0 - if (!$class) $last_starter = $i; - $last_class = $class; - } - return $output; - } - - /** - * Decomposes a Hangul syllable - * (see http://www.unicode.org/unicode/reports/tr15/#Hangul - * @param integer 32bit UCS4 code point - * @return array Either Hangul Syllable decomposed or original 32bit value as one value array - * @access private - */ - function _hangul_decompose($char) - { - $sindex = (int) $char - $this->_sbase; - if ($sindex < 0 || $sindex >= $this->_scount) { - return array($char); - } - $result = array(); - $result[] = (int) $this->_lbase + $sindex / $this->_ncount; - $result[] = (int) $this->_vbase + ($sindex % $this->_ncount) / $this->_tcount; - $T = intval($this->_tbase + $sindex % $this->_tcount); - if ($T != $this->_tbase) $result[] = $T; - return $result; - } - /** - * Ccomposes a Hangul syllable - * (see http://www.unicode.org/unicode/reports/tr15/#Hangul - * @param array Decomposed UCS4 sequence - * @return array UCS4 sequence with syllables composed - * @access private - */ - function _hangul_compose($input) - { - $inp_len = count($input); - if (!$inp_len) return array(); - $result = array(); - $last = (int) $input[0]; - $result[] = $last; // copy first char from input to output - - for ($i = 1; $i < $inp_len; ++$i) { - $char = (int) $input[$i]; - $sindex = $last - $this->_sbase; - $lindex = $last - $this->_lbase; - $vindex = $char - $this->_vbase; - $tindex = $char - $this->_tbase; - // Find out, whether two current characters are LV and T - if (0 <= $sindex && $sindex < $this->_scount && ($sindex % $this->_tcount == 0) - && 0 <= $tindex && $tindex <= $this->_tcount) { - // create syllable of form LVT - $last += $tindex; - $result[(count($result) - 1)] = $last; // reset last - continue; // discard char - } - // Find out, whether two current characters form L and V - if (0 <= $lindex && $lindex < $this->_lcount && 0 <= $vindex && $vindex < $this->_vcount) { - // create syllable of form LV - $last = (int) $this->_sbase + ($lindex * $this->_vcount + $vindex) * $this->_tcount; - $result[(count($result) - 1)] = $last; // reset last - continue; // discard char - } - // if neither case was true, just add the character - $last = $char; - $result[] = $char; - } - return $result; - } - - /** - * Returns the combining class of a certain wide char - * @param integer Wide char to check (32bit integer) - * @return integer Combining class if found, else 0 - * @access private - */ - function _get_combining_class($char) - { - return isset($this->NP['norm_combcls'][$char]) ? $this->NP['norm_combcls'][$char] : 0; - } - - /** - * Apllies the cannonical ordering of a decomposed UCS4 sequence - * @param array Decomposed UCS4 sequence - * @return array Ordered USC4 sequence - * @access private - */ - function _apply_cannonical_ordering($input) - { - $swap = true; - $size = count($input); - while ($swap) { - $swap = false; - $last = $this->_get_combining_class(intval($input[0])); - for ($i = 0; $i < $size-1; ++$i) { - $next = $this->_get_combining_class(intval($input[$i+1])); - if ($next != 0 && $last > $next) { - // Move item leftward until it fits - for ($j = $i + 1; $j > 0; --$j) { - if ($this->_get_combining_class(intval($input[$j-1])) <= $next) break; - $t = intval($input[$j]); - $input[$j] = intval($input[$j-1]); - $input[$j-1] = $t; - $swap = true; - } - // Reentering the loop looking at the old character again - $next = $last; - } - $last = $next; - } - } - return $input; - } - - /** - * Do composition of a sequence of starter and non-starter - * @param array UCS4 Decomposed sequence - * @return array Ordered USC4 sequence - * @access private - */ - function _combine($input) - { - $inp_len = count($input); - foreach ($this->NP['replacemaps'] as $np_src => $np_target) { - if ($np_target[0] != $input[0]) continue; - if (count($np_target) != $inp_len) continue; - $hit = false; - foreach ($input as $k2 => $v2) { - if ($v2 == $np_target[$k2]) { - $hit = true; - } else { - $hit = false; - break; - } - } - if ($hit) return $np_src; - } - return false; - } - - /** - * This converts an UTF-8 encoded string to its UCS-4 representation - * By talking about UCS-4 "strings" we mean arrays of 32bit integers representing - * each of the "chars". This is due to PHP not being able to handle strings with - * bit depth different from 8. This apllies to the reverse method _ucs4_to_utf8(), too. - * The following UTF-8 encodings are supported: - * bytes bits representation - * 1 7 0xxxxxxx - * 2 11 110xxxxx 10xxxxxx - * 3 16 1110xxxx 10xxxxxx 10xxxxxx - * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - * 5 26 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - * 6 31 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - * Each x represents a bit that can be used to store character data. - * The five and six byte sequences are part of Annex D of ISO/IEC 10646-1:2000 - * @access private - */ - function _utf8_to_ucs4($input) - { - $output = array(); - $out_len = 0; - $inp_len = strlen($input); - $mode = 'next'; - $test = 'none'; - for ($k = 0; $k < $inp_len; ++$k) { - $v = ord($input{$k}); // Extract byte from input string - - if ($v < 128) { // We found an ASCII char - put into stirng as is - $output[$out_len] = $v; - ++$out_len; - if ('add' == $mode) { - $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); - return false; - } - continue; - } - if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char - $start_byte = $v; - $mode = 'add'; - $test = 'range'; - if ($v >> 5 == 6) { // &110xxxxx 10xxxxx - $next_byte = 0; // Tells, how many times subsequent bitmasks must rotate 6bits to the left - $v = ($v - 192) << 6; - } elseif ($v >> 4 == 14) { // &1110xxxx 10xxxxxx 10xxxxxx - $next_byte = 1; - $v = ($v - 224) << 12; - } elseif ($v >> 3 == 30) { // &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - $next_byte = 2; - $v = ($v - 240) << 18; - } elseif ($v >> 2 == 62) { // &111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - $next_byte = 3; - $v = ($v - 248) << 24; - } elseif ($v >> 1 == 126) { // &1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx - $next_byte = 4; - $v = ($v - 252) << 30; - } else { - $this->_error('This might be UTF-8, but I don\'t understand it at byte '.$k); - return false; - } - if ('add' == $mode) { - $output[$out_len] = (int) $v; - ++$out_len; - continue; - } - } - if ('add' == $mode) { - if (!$this->_allow_overlong && $test == 'range') { - $test = 'none'; - if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) { - $this->_error('Bogus UTF-8 character detected (out of legal range) at byte '.$k); - return false; - } - } - if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx - $v = ($v - 128) << ($next_byte * 6); - $output[($out_len - 1)] += $v; - --$next_byte; - } else { - $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); - return false; - } - if ($next_byte < 0) { - $mode = 'next'; - } - } - } // for - return $output; - } - - /** - * Convert UCS-4 string into UTF-8 string - * See _utf8_to_ucs4() for details - * @access private - */ - function _ucs4_to_utf8($input) - { - $output = ''; - $k = 0; - foreach ($input as $v) { - ++$k; - // $v = ord($v); - if ($v < 128) { // 7bit are transferred literally - $output .= chr($v); - } elseif ($v < (1 << 11)) { // 2 bytes - $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); - } elseif ($v < (1 << 16)) { // 3 bytes - $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); - } elseif ($v < (1 << 21)) { // 4 bytes - $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) - . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); - } elseif ($v < (1 << 26)) { // 5 bytes - $output .= chr(248 + ($v >> 24)) . chr(128 + (($v >> 18) & 63)) - . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) - . chr(128 + ($v & 63)); - } elseif ($v < (1 << 31)) { // 6 bytes - $output .= chr(252 + ($v >> 30)) . chr(128 + (($v >> 24) & 63)) - . chr(128 + (($v >> 18) & 63)) . chr(128 + (($v >> 12) & 63)) - . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); - } else { - $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k); - return false; - } - } - return $output; - } - - /** - * Convert UCS-4 array into UCS-4 string - * - * @access private - */ - function _ucs4_to_ucs4_string($input) - { - $output = ''; - // Take array values and split output to 4 bytes per value - // The bit mask is 255, which reads &11111111 - foreach ($input as $v) { - $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255); - } - return $output; - } - - /** - * Convert UCS-4 strin into UCS-4 garray - * - * @access private - */ - function _ucs4_string_to_ucs4($input) - { - $output = array(); - $inp_len = strlen($input); - // Input length must be dividable by 4 - if ($inp_len % 4) { - $this->_error('Input UCS4 string is broken'); - return false; - } - // Empty input - return empty output - if (!$inp_len) return $output; - for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) { - // Increment output position every 4 input bytes - if (!($i % 4)) { - $out_len++; - $output[$out_len] = 0; - } - $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); - } - return $output; - } + /** + * Holds all relevant mapping tables, loaded from a seperate file on construct + * See RFC3454 for details + * + * @var array + * @access private + */ + var $NP = array(); + + // Internal settings, do not mess with them + var $_punycode_prefix = 'xn--'; + var $_invalid_ucs = 0x80000000; + var $_max_ucs = 0x10FFFF; + var $_base = 36; + var $_tmin = 1; + var $_tmax = 26; + var $_skew = 38; + var $_damp = 700; + var $_initial_bias = 72; + var $_initial_n = 0x80; + var $_sbase = 0xAC00; + var $_lbase = 0x1100; + var $_vbase = 0x1161; + var $_tbase = 0x11A7; + var $_lcount = 19; + var $_vcount = 21; + var $_tcount = 28; + var $_ncount = 588; // _vcount * _tcount + var $_scount = 11172; // _lcount * _tcount * _vcount + var $_error = false; + + // See {@link set_paramter()} for details of how to change the following + // settings from within your script / application + var $_api_encoding = 'utf8'; // Default input charset is UTF-8 + var $_allow_overlong = false; // Overlong UTF-8 encodings are forbidden + var $_strict_mode = false; // Behave strict or not + + // The constructor + function idna_convert($options = false) + { + $this->slast = $this->_sbase + $this->_lcount * $this->_vcount * $this->_tcount; + if (function_exists('file_get_contents')) { + $this->NP = unserialize(file_get_contents(dirname(__FILE__).'/npdata.ser')); + } else { + $this->NP = unserialize(join('', file(dirname(__FILE__).'/npdata.ser'))); + } + // If parameters are given, pass these to the respective method + if (is_array($options)) { + return $this->set_parameter($options); + } + return true; + } + + /** + * Sets a new option value. Available options and values: + * [encoding - Use either UTF-8, UCS4 as array or UCS4 as string as input ('utf8' for UTF-8, + * 'ucs4_string' and 'ucs4_array' respectively for UCS4); The output is always UTF-8] + * [overlong - Unicode does not allow unnecessarily long encodings of chars, + * to allow this, set this parameter to true, else to false; + * default is false.] + * [strict - true: strict mode, good for registration purposes - Causes errors + * on failures; false: loose mode, ideal for "wildlife" applications + * by silently ignoring errors and returning the original input instead + * + * @param mixed Parameter to set (string: single parameter; array of Parameter => Value pairs) + * @param string Value to use (if parameter 1 is a string) + * @return boolean true on success, false otherwise + * @access public + */ + function set_parameter($option, $value = false) + { + if (!is_array($option)) { + $option = array($option => $value); + } + foreach ($option as $k => $v) { + switch ($k) { + case 'encoding': + switch ($v) { + case 'utf8': + case 'ucs4_string': + case 'ucs4_array': + $this->_api_encoding = $v; + break; + default: + $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); + return false; + } + break; + case 'overlong': + $this->_allow_overlong = ($v) ? true : false; + break; + case 'strict': + $this->_strict_mode = ($v) ? true : false; + break; + default: + $this->_error('Set Parameter: Unknown option '.$k); + return false; + } + } + return true; + } + + /** + * Decode a given ACE domain name + * @param string Domain name (ACE string) + * [@param string Desired output encoding, see {@link set_parameter}] + * @return string Decoded Domain name (UTF-8 or UCS-4) + * @access public + */ + function decode($input, $one_time_encoding = false) + { + // Optionally set + if ($one_time_encoding) { + switch ($one_time_encoding) { + case 'utf8': + case 'ucs4_string': + case 'ucs4_array': + break; + default: + $this->_error('Unknown encoding '.$one_time_encoding); + return false; + } + } + // Make sure to drop any newline characters around + $input = trim($input); + + // Negotiate input and try to determine, whether it is a plain string, + // an email address or something like a complete URL + if (strpos($input, '@')) { // Maybe it is an email address + // No no in strict mode + if ($this->_strict_mode) { + $this->_error('Only simple domain name parts can be handled in strict mode'); + return false; + } + list ($email_pref, $input) = explode('@', $input, 2); + $arr = explode('.', $input); + foreach ($arr as $k => $v) { + if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { + $conv = $this->_decode($v); + if ($conv) $arr[$k] = $conv; + } + } + $input = join('.', $arr); + $arr = explode('.', $email_pref); + foreach ($arr as $k => $v) { + if (preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $v)) { + $conv = $this->_decode($v); + if ($conv) $arr[$k] = $conv; + } + } + $email_pref = join('.', $arr); + $return = $email_pref . '@' . $input; + } elseif (preg_match('![:\./]!', $input)) { // Or a complete domain name (with or without paths / parameters) + // No no in strict mode + if ($this->_strict_mode) { + $this->_error('Only simple domain name parts can be handled in strict mode'); + return false; + } + $parsed = parse_url($input); + if (isset($parsed['host'])) { + $arr = explode('.', $parsed['host']); + foreach ($arr as $k => $v) { + $conv = $this->_decode($v); + if ($conv) $arr[$k] = $conv; + } + $parsed['host'] = join('.', $arr); + $return = + (empty($parsed['scheme']) ? '' : $parsed['scheme'].(strtolower($parsed['scheme']) == 'mailto' ? ':' : '://')) + .(empty($parsed['user']) ? '' : $parsed['user'].(empty($parsed['pass']) ? '' : ':'.$parsed['pass']).'@') + .$parsed['host'] + .(empty($parsed['port']) ? '' : ':'.$parsed['port']) + .(empty($parsed['path']) ? '' : $parsed['path']) + .(empty($parsed['query']) ? '' : '?'.$parsed['query']) + .(empty($parsed['fragment']) ? '' : '#'.$parsed['fragment']); + } else { // parse_url seems to have failed, try without it + $arr = explode('.', $input); + foreach ($arr as $k => $v) { + $conv = $this->_decode($v); + $arr[$k] = ($conv) ? $conv : $v; + } + $return = join('.', $arr); + } + } else { // Otherwise we consider it being a pure domain name string + $return = $this->_decode($input); + if (!$return) $return = $input; + } + // The output is UTF-8 by default, other output formats need conversion here + // If one time encoding is given, use this, else the objects property + switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) { + case 'utf8': + return $return; + break; + case 'ucs4_string': + return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); + break; + case 'ucs4_array': + return $this->_utf8_to_ucs4($return); + break; + default: + $this->_error('Unsupported output format'); + return false; + } + } + + /** + * Encode a given UTF-8 domain name + * @param string Domain name (UTF-8 or UCS-4) + * [@param string Desired input encoding, see {@link set_parameter}] + * @return string Encoded Domain name (ACE string) + * @access public + */ + function encode($decoded, $one_time_encoding = false) + { + // Forcing conversion of input to UCS4 array + // If one time encoding is given, use this, else the objects property + switch ($one_time_encoding ? $one_time_encoding : $this->_api_encoding) { + case 'utf8': + $decoded = $this->_utf8_to_ucs4($decoded); + break; + case 'ucs4_string': + $decoded = $this->_ucs4_string_to_ucs4($decoded); + case 'ucs4_array': + break; + default: + $this->_error('Unsupported input format: '.($one_time_encoding ? $one_time_encoding : $this->_api_encoding)); + return false; + } + + // No input, no output, what else did you expect? + if (empty($decoded)) return ''; + + // Anchors for iteration + $last_begin = 0; + // Output string + $output = ''; + foreach ($decoded as $k => $v) { + // Make sure to use just the plain dot + switch($v) { + case 0x3002: + case 0xFF0E: + case 0xFF61: + $decoded[$k] = 0x2E; + // Right, no break here, the above are converted to dots anyway + // Stumbling across an anchoring character + case 0x2E: + case 0x2F: + case 0x3A: + case 0x3F: + case 0x40: + // Neither email addresses nor URLs allowed in strict mode + if ($this->_strict_mode) { + $this->_error('Neither email addresses nor URLs are allowed in strict mode.'); + return false; + } else { + // Skip first char + if ($k) { + $encoded = ''; + $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin))); + if ($encoded) { + $output .= $encoded; + } else { + $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin))); + } + $output .= chr($decoded[$k]); + } + $last_begin = $k + 1; + } + } + } + // Catch the rest of the string + if ($last_begin) { + $inp_len = sizeof($decoded); + $encoded = ''; + $encoded = $this->_encode(array_slice($decoded, $last_begin, (($inp_len)-$last_begin))); + if ($encoded) { + $output .= $encoded; + } else { + $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($inp_len)-$last_begin))); + } + return $output; + } else { + if ($output = $this->_encode($decoded)) { + return $output; + } else { + return $this->_ucs4_to_utf8($decoded); + } + } + } + + /** + * Use this method to get the last error ocurred + * @param void + * @return string The last error, that occured + * @access public + */ + function get_last_error() + { + return $this->_error; + } + + /** + * The actual decoding algorithm + * @access private + */ + function _decode($encoded) + { + // We do need to find the Punycode prefix + if (!preg_match('!^'.preg_quote($this->_punycode_prefix, '!').'!', $encoded)) { + $this->_error('This is not a punycode string'); + return false; + } + $encode_test = preg_replace('!^'.preg_quote($this->_punycode_prefix, '!').'!', '', $encoded); + // If nothing left after removing the prefix, it is hopeless + if (!$encode_test) { + $this->_error('The given encoded string was empty'); + return false; + } + // Find last occurence of the delimiter + $delim_pos = strrpos($encoded, '-'); + if ($delim_pos > strlen($this->_punycode_prefix)) { + for ($k = strlen($this->_punycode_prefix); $k < $delim_pos; ++$k) { + $decoded[] = ord($encoded{$k}); + } + } else { + $decoded = array(); + } + $deco_len = count($decoded); + $enco_len = strlen($encoded); + + // Wandering through the strings; init + $is_first = true; + $bias = $this->_initial_bias; + $idx = 0; + $char = $this->_initial_n; + + for ($enco_idx = ($delim_pos) ? ($delim_pos + 1) : 0; $enco_idx < $enco_len; ++$deco_len) { + for ($old_idx = $idx, $w = 1, $k = $this->_base; 1 ; $k += $this->_base) { + $digit = $this->_decode_digit($encoded{$enco_idx++}); + $idx += $digit * $w; + $t = ($k <= $bias) ? $this->_tmin : + (($k >= $bias + $this->_tmax) ? $this->_tmax : ($k - $bias)); + if ($digit < $t) break; + $w = (int) ($w * ($this->_base - $t)); + } + $bias = $this->_adapt($idx - $old_idx, $deco_len + 1, $is_first); + $is_first = false; + $char += (int) ($idx / ($deco_len + 1)); + $idx %= ($deco_len + 1); + if ($deco_len > 0) { + // Make room for the decoded char + for ($i = $deco_len; $i > $idx; $i--) { + $decoded[$i] = $decoded[($i - 1)]; + } + } + $decoded[$idx++] = $char; + } + return $this->_ucs4_to_utf8($decoded); + } + + /** + * The actual encoding algorithm + * @access private + */ + function _encode($decoded) + { + // We cannot encode a domain name containing the Punycode prefix + $extract = strlen($this->_punycode_prefix); + $check_pref = $this->_utf8_to_ucs4($this->_punycode_prefix); + $check_deco = array_slice($decoded, 0, $extract); + + if ($check_pref == $check_deco) { + $this->_error('This is already a punycode string'); + return false; + } + // We will not try to encode strings consisting of basic code points only + $encodable = false; + foreach ($decoded as $k => $v) { + if ($v > 0x7a) { + $encodable = true; + break; + } + } + if (!$encodable) { + $this->_error('The given string does not contain encodable chars'); + return false; + } + + // Do NAMEPREP + $decoded = $this->_nameprep($decoded); + if (!$decoded || !is_array($decoded)) return false; // NAMEPREP failed + + $deco_len = count($decoded); + if (!$deco_len) return false; // Empty array + + $codecount = 0; // How many chars have been consumed + + $encoded = ''; + // Copy all basic code points to output + for ($i = 0; $i < $deco_len; ++$i) { + $test = $decoded[$i]; + // Will match [-0-9a-zA-Z] + if ((0x2F < $test && $test < 0x40) || (0x40 < $test && $test < 0x5B) + || (0x60 < $test && $test <= 0x7B) || (0x2D == $test)) { + $encoded .= chr($decoded[$i]); + $codecount++; + } + } + if ($codecount == $deco_len) return $encoded; // All codepoints were basic ones + + // Start with the prefix; copy it to output + $encoded = $this->_punycode_prefix.$encoded; + + // If we have basic code points in output, add an hyphen to the end + if ($codecount) $encoded .= '-'; + + // Now find and encode all non-basic code points + $is_first = true; + $cur_code = $this->_initial_n; + $bias = $this->_initial_bias; + $delta = 0; + while ($codecount < $deco_len) { + // Find the smallest code point >= the current code point and + // remember the last ouccrence of it in the input + for ($i = 0, $next_code = $this->_max_ucs; $i < $deco_len; $i++) { + if ($decoded[$i] >= $cur_code && $decoded[$i] <= $next_code) { + $next_code = $decoded[$i]; + } + } + + $delta += ($next_code - $cur_code) * ($codecount + 1); + $cur_code = $next_code; + + // Scan input again and encode all characters whose code point is $cur_code + for ($i = 0; $i < $deco_len; $i++) { + if ($decoded[$i] < $cur_code) { + $delta++; + } elseif ($decoded[$i] == $cur_code) { + for ($q = $delta, $k = $this->_base; 1; $k += $this->_base) { + $t = ($k <= $bias) ? $this->_tmin : + (($k >= $bias + $this->_tmax) ? $this->_tmax : $k - $bias); + if ($q < $t) break; + $encoded .= $this->_encode_digit(intval($t + (($q - $t) % ($this->_base - $t)))); //v0.4.5 Changed from ceil() to intval() + $q = (int) (($q - $t) / ($this->_base - $t)); + } + $encoded .= $this->_encode_digit($q); + $bias = $this->_adapt($delta, $codecount+1, $is_first); + $codecount++; + $delta = 0; + $is_first = false; + } + } + $delta++; + $cur_code++; + } + return $encoded; + } + + /** + * Adapt the bias according to the current code point and position + * @access private + */ + function _adapt($delta, $npoints, $is_first) + { + $delta = intval($is_first ? ($delta / $this->_damp) : ($delta / 2)); + $delta += intval($delta / $npoints); + for ($k = 0; $delta > (($this->_base - $this->_tmin) * $this->_tmax) / 2; $k += $this->_base) { + $delta = intval($delta / ($this->_base - $this->_tmin)); + } + return intval($k + ($this->_base - $this->_tmin + 1) * $delta / ($delta + $this->_skew)); + } + + /** + * Encoding a certain digit + * @access private + */ + function _encode_digit($d) + { + return chr($d + 22 + 75 * ($d < 26)); + } + + /** + * Decode a certain digit + * @access private + */ + function _decode_digit($cp) + { + $cp = ord($cp); + return ($cp - 48 < 10) ? $cp - 22 : (($cp - 65 < 26) ? $cp - 65 : (($cp - 97 < 26) ? $cp - 97 : $this->_base)); + } + + /** + * Internal error handling method + * @access private + */ + function _error($error = '') + { + $this->_error = $error; + } + + /** + * Do Nameprep according to RFC3491 and RFC3454 + * @param array Unicode Characters + * @return string Unicode Characters, Nameprep'd + * @access private + */ + function _nameprep($input) + { + $output = array(); + $error = false; + // + // Mapping + // Walking through the input array, performing the required steps on each of + // the input chars and putting the result into the output array + // While mapping required chars we apply the cannonical ordering + foreach ($input as $v) { + // Map to nothing == skip that code point + if (in_array($v, $this->NP['map_nothing'])) continue; + + // Try to find prohibited input + if (in_array($v, $this->NP['prohibit']) || in_array($v, $this->NP['general_prohibited'])) { + $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); + return false; + } + foreach ($this->NP['prohibit_ranges'] as $range) { + if ($range[0] <= $v && $v <= $range[1]) { + $this->_error('NAMEPREP: Prohibited input U+'.sprintf('%08X', $v)); + return false; + } + } + // + // Hangul syllable decomposition + if (0xAC00 <= $v && $v <= 0xD7AF) { + foreach ($this->_hangul_decompose($v) as $out) { + $output[] = (int) $out; + } + // There's a decomposition mapping for that code point + } elseif (isset($this->NP['replacemaps'][$v])) { + foreach ($this->_apply_cannonical_ordering($this->NP['replacemaps'][$v]) as $out) { + $output[] = (int) $out; + } + } else { + $output[] = (int) $v; + } + } + // Before applying any Combining, try to rearrange any Hangul syllables + $output = $this->_hangul_compose($output); + // + // Combine code points + // + $last_class = 0; + $last_starter = 0; + $out_len = count($output); + for ($i = 0; $i < $out_len; ++$i) { + $class = $this->_get_combining_class($output[$i]); + if ((!$last_class || $last_class > $class) && $class) { + // Try to match + $seq_len = $i - $last_starter; + $out = $this->_combine(array_slice($output, $last_starter, $seq_len)); + // On match: Replace the last starter with the composed character and remove + // the now redundant non-starter(s) + if ($out) { + $output[$last_starter] = $out; + if (count($out) != $seq_len) { + for ($j = $i+1; $j < $out_len; ++$j) { + $output[$j-1] = $output[$j]; + } + unset($output[$out_len]); + } + // Rewind the for loop by one, since there can be more possible compositions + $i--; + $out_len--; + $last_class = ($i == $last_starter) ? 0 : $this->_get_combining_class($output[$i-1]); + continue; + } + } + // The current class is 0 + if (!$class) $last_starter = $i; + $last_class = $class; + } + return $output; + } + + /** + * Decomposes a Hangul syllable + * (see http://www.unicode.org/unicode/reports/tr15/#Hangul + * @param integer 32bit UCS4 code point + * @return array Either Hangul Syllable decomposed or original 32bit value as one value array + * @access private + */ + function _hangul_decompose($char) + { + $sindex = (int) $char - $this->_sbase; + if ($sindex < 0 || $sindex >= $this->_scount) { + return array($char); + } + $result = array(); + $result[] = (int) $this->_lbase + $sindex / $this->_ncount; + $result[] = (int) $this->_vbase + ($sindex % $this->_ncount) / $this->_tcount; + $T = intval($this->_tbase + $sindex % $this->_tcount); + if ($T != $this->_tbase) $result[] = $T; + return $result; + } + /** + * Ccomposes a Hangul syllable + * (see http://www.unicode.org/unicode/reports/tr15/#Hangul + * @param array Decomposed UCS4 sequence + * @return array UCS4 sequence with syllables composed + * @access private + */ + function _hangul_compose($input) + { + $inp_len = count($input); + if (!$inp_len) return array(); + $result = array(); + $last = (int) $input[0]; + $result[] = $last; // copy first char from input to output + + for ($i = 1; $i < $inp_len; ++$i) { + $char = (int) $input[$i]; + $sindex = $last - $this->_sbase; + $lindex = $last - $this->_lbase; + $vindex = $char - $this->_vbase; + $tindex = $char - $this->_tbase; + // Find out, whether two current characters are LV and T + if (0 <= $sindex && $sindex < $this->_scount && ($sindex % $this->_tcount == 0) + && 0 <= $tindex && $tindex <= $this->_tcount) { + // create syllable of form LVT + $last += $tindex; + $result[(count($result) - 1)] = $last; // reset last + continue; // discard char + } + // Find out, whether two current characters form L and V + if (0 <= $lindex && $lindex < $this->_lcount && 0 <= $vindex && $vindex < $this->_vcount) { + // create syllable of form LV + $last = (int) $this->_sbase + ($lindex * $this->_vcount + $vindex) * $this->_tcount; + $result[(count($result) - 1)] = $last; // reset last + continue; // discard char + } + // if neither case was true, just add the character + $last = $char; + $result[] = $char; + } + return $result; + } + + /** + * Returns the combining class of a certain wide char + * @param integer Wide char to check (32bit integer) + * @return integer Combining class if found, else 0 + * @access private + */ + function _get_combining_class($char) + { + return isset($this->NP['norm_combcls'][$char]) ? $this->NP['norm_combcls'][$char] : 0; + } + + /** + * Apllies the cannonical ordering of a decomposed UCS4 sequence + * @param array Decomposed UCS4 sequence + * @return array Ordered USC4 sequence + * @access private + */ + function _apply_cannonical_ordering($input) + { + $swap = true; + $size = count($input); + while ($swap) { + $swap = false; + $last = $this->_get_combining_class(intval($input[0])); + for ($i = 0; $i < $size-1; ++$i) { + $next = $this->_get_combining_class(intval($input[$i+1])); + if ($next != 0 && $last > $next) { + // Move item leftward until it fits + for ($j = $i + 1; $j > 0; --$j) { + if ($this->_get_combining_class(intval($input[$j-1])) <= $next) break; + $t = intval($input[$j]); + $input[$j] = intval($input[$j-1]); + $input[$j-1] = $t; + $swap = true; + } + // Reentering the loop looking at the old character again + $next = $last; + } + $last = $next; + } + } + return $input; + } + + /** + * Do composition of a sequence of starter and non-starter + * @param array UCS4 Decomposed sequence + * @return array Ordered USC4 sequence + * @access private + */ + function _combine($input) + { + $inp_len = count($input); + foreach ($this->NP['replacemaps'] as $np_src => $np_target) { + if ($np_target[0] != $input[0]) continue; + if (count($np_target) != $inp_len) continue; + $hit = false; + foreach ($input as $k2 => $v2) { + if ($v2 == $np_target[$k2]) { + $hit = true; + } else { + $hit = false; + break; + } + } + if ($hit) return $np_src; + } + return false; + } + + /** + * This converts an UTF-8 encoded string to its UCS-4 representation + * By talking about UCS-4 "strings" we mean arrays of 32bit integers representing + * each of the "chars". This is due to PHP not being able to handle strings with + * bit depth different from 8. This apllies to the reverse method _ucs4_to_utf8(), too. + * The following UTF-8 encodings are supported: + * bytes bits representation + * 1 7 0xxxxxxx + * 2 11 110xxxxx 10xxxxxx + * 3 16 1110xxxx 10xxxxxx 10xxxxxx + * 4 21 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + * 5 26 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx + * 6 31 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx + * Each x represents a bit that can be used to store character data. + * The five and six byte sequences are part of Annex D of ISO/IEC 10646-1:2000 + * @access private + */ + function _utf8_to_ucs4($input) + { + $output = array(); + $out_len = 0; + $inp_len = strlen($input); + $mode = 'next'; + $test = 'none'; + for ($k = 0; $k < $inp_len; ++$k) { + $v = ord($input{$k}); // Extract byte from input string + + if ($v < 128) { // We found an ASCII char - put into stirng as is + $output[$out_len] = $v; + ++$out_len; + if ('add' == $mode) { + $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); + return false; + } + continue; + } + if ('next' == $mode) { // Try to find the next start byte; determine the width of the Unicode char + $start_byte = $v; + $mode = 'add'; + $test = 'range'; + if ($v >> 5 == 6) { // &110xxxxx 10xxxxx + $next_byte = 0; // Tells, how many times subsequent bitmasks must rotate 6bits to the left + $v = ($v - 192) << 6; + } elseif ($v >> 4 == 14) { // &1110xxxx 10xxxxxx 10xxxxxx + $next_byte = 1; + $v = ($v - 224) << 12; + } elseif ($v >> 3 == 30) { // &11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + $next_byte = 2; + $v = ($v - 240) << 18; + } elseif ($v >> 2 == 62) { // &111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx + $next_byte = 3; + $v = ($v - 248) << 24; + } elseif ($v >> 1 == 126) { // &1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx + $next_byte = 4; + $v = ($v - 252) << 30; + } else { + $this->_error('This might be UTF-8, but I don\'t understand it at byte '.$k); + return false; + } + if ('add' == $mode) { + $output[$out_len] = (int) $v; + ++$out_len; + continue; + } + } + if ('add' == $mode) { + if (!$this->_allow_overlong && $test == 'range') { + $test = 'none'; + if (($v < 0xA0 && $start_byte == 0xE0) || ($v < 0x90 && $start_byte == 0xF0) || ($v > 0x8F && $start_byte == 0xF4)) { + $this->_error('Bogus UTF-8 character detected (out of legal range) at byte '.$k); + return false; + } + } + if ($v >> 6 == 2) { // Bit mask must be 10xxxxxx + $v = ($v - 128) << ($next_byte * 6); + $output[($out_len - 1)] += $v; + --$next_byte; + } else { + $this->_error('Conversion from UTF-8 to UCS-4 failed: malformed input at byte '.$k); + return false; + } + if ($next_byte < 0) { + $mode = 'next'; + } + } + } // for + return $output; + } + + /** + * Convert UCS-4 string into UTF-8 string + * See _utf8_to_ucs4() for details + * @access private + */ + function _ucs4_to_utf8($input) + { + $output = ''; + $k = 0; + foreach ($input as $v) { + ++$k; + // $v = ord($v); + if ($v < 128) { // 7bit are transferred literally + $output .= chr($v); + } elseif ($v < (1 << 11)) { // 2 bytes + $output .= chr(192 + ($v >> 6)) . chr(128 + ($v & 63)); + } elseif ($v < (1 << 16)) { // 3 bytes + $output .= chr(224 + ($v >> 12)) . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); + } elseif ($v < (1 << 21)) { // 4 bytes + $output .= chr(240 + ($v >> 18)) . chr(128 + (($v >> 12) & 63)) + . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); + } elseif ($v < (1 << 26)) { // 5 bytes + $output .= chr(248 + ($v >> 24)) . chr(128 + (($v >> 18) & 63)) + . chr(128 + (($v >> 12) & 63)) . chr(128 + (($v >> 6) & 63)) + . chr(128 + ($v & 63)); + } elseif ($v < (1 << 31)) { // 6 bytes + $output .= chr(252 + ($v >> 30)) . chr(128 + (($v >> 24) & 63)) + . chr(128 + (($v >> 18) & 63)) . chr(128 + (($v >> 12) & 63)) + . chr(128 + (($v >> 6) & 63)) . chr(128 + ($v & 63)); + } else { + $this->_error('Conversion from UCS-4 to UTF-8 failed: malformed input at byte '.$k); + return false; + } + } + return $output; + } + + /** + * Convert UCS-4 array into UCS-4 string + * + * @access private + */ + function _ucs4_to_ucs4_string($input) + { + $output = ''; + // Take array values and split output to 4 bytes per value + // The bit mask is 255, which reads &11111111 + foreach ($input as $v) { + $output .= chr(($v >> 24) & 255).chr(($v >> 16) & 255).chr(($v >> 8) & 255).chr($v & 255); + } + return $output; + } + + /** + * Convert UCS-4 strin into UCS-4 garray + * + * @access private + */ + function _ucs4_string_to_ucs4($input) + { + $output = array(); + $inp_len = strlen($input); + // Input length must be dividable by 4 + if ($inp_len % 4) { + $this->_error('Input UCS4 string is broken'); + return false; + } + // Empty input - return empty output + if (!$inp_len) return $output; + for ($i = 0, $out_len = -1; $i < $inp_len; ++$i) { + // Increment output position every 4 input bytes + if (!($i % 4)) { + $out_len++; + $output[$out_len] = 0; + } + $output[$out_len] += ord($input{$i}) << (8 * (3 - ($i % 4) ) ); + } + return $output; + } } /** @@ -944,26 +944,26 @@ function _ucs4_string_to_ucs4($input) */ class Net_IDNA_php4 extends idna_convert { - /** - * Sets a new option value. Available options and values: - * [encoding - Use either UTF-8, UCS4 as array or UCS4 as string as input ('utf8' for UTF-8, - * 'ucs4_string' and 'ucs4_array' respectively for UCS4); The output is always UTF-8] - * [overlong - Unicode does not allow unnecessarily long encodings of chars, - * to allow this, set this parameter to true, else to false; - * default is false.] - * [strict - true: strict mode, good for registration purposes - Causes errors - * on failures; false: loose mode, ideal for "wildlife" applications - * by silently ignoring errors and returning the original input instead - * - * @param mixed Parameter to set (string: single parameter; array of Parameter => Value pairs) - * @param string Value to use (if parameter 1 is a string) - * @return boolean true on success, false otherwise - * @access public - */ - function setParams($option, $param = false) - { - return $this->IC->set_parameters($option, $param); - } + /** + * Sets a new option value. Available options and values: + * [encoding - Use either UTF-8, UCS4 as array or UCS4 as string as input ('utf8' for UTF-8, + * 'ucs4_string' and 'ucs4_array' respectively for UCS4); The output is always UTF-8] + * [overlong - Unicode does not allow unnecessarily long encodings of chars, + * to allow this, set this parameter to true, else to false; + * default is false.] + * [strict - true: strict mode, good for registration purposes - Causes errors + * on failures; false: loose mode, ideal for "wildlife" applications + * by silently ignoring errors and returning the original input instead + * + * @param mixed Parameter to set (string: single parameter; array of Parameter => Value pairs) + * @param string Value to use (if parameter 1 is a string) + * @return boolean true on success, false otherwise + * @access public + */ + function setParams($option, $param = false) + { + return $this->IC->set_parameters($option, $param); + } } ?> \ No newline at end of file diff --git a/libraries/simplepie/idn/index.html b/libraries/simplepie/idn/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/simplepie/idn/index.html +++ b/libraries/simplepie/idn/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/simplepie/index.html b/libraries/simplepie/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/simplepie/index.html +++ b/libraries/simplepie/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/simplepie/simplepie.php b/libraries/simplepie/simplepie.php index ef6fdbd8da6e1..f81a7b07d400c 100644 --- a/libraries/simplepie/simplepie.php +++ b/libraries/simplepie/simplepie.php @@ -9750,11 +9750,11 @@ function is_a($object, $class_name) * @access string * @param object $haystack * @param string $needle Note that the needle may be a string of one or more - * characters. If needle is not a string, it is converted to an integer - * and applied as the ordinal value of a character. + * characters. If needle is not a string, it is converted to an integer + * and applied as the ordinal value of a character. * @param int $offset The optional offset parameter allows you to specify which - * character in haystack to start searching. The position returned is still - * relative to the beginning of haystack. + * character in haystack to start searching. The position returned is still + * relative to the beginning of haystack. * @return bool If needle is not found, stripos() will return boolean false. */ function stripos($haystack, $needle, $offset = 0) diff --git a/libraries/tcpdf/cache/index.html b/libraries/tcpdf/cache/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/tcpdf/cache/index.html +++ b/libraries/tcpdf/cache/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/tcpdf/config/index.html b/libraries/tcpdf/config/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/tcpdf/config/index.html +++ b/libraries/tcpdf/config/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/tcpdf/config/lang/eng.php b/libraries/tcpdf/config/lang/eng.php index ff5e75e053db2..85c62502245f9 100644 --- a/libraries/tcpdf/config/lang/eng.php +++ b/libraries/tcpdf/config/lang/eng.php @@ -1,22 +1,22 @@ \ No newline at end of file + \ No newline at end of file diff --git a/libraries/tcpdf/config/tcpdf_config.php b/libraries/tcpdf/config/tcpdf_config.php index edb9ad2bc09a0..c5d012f6bce11 100644 --- a/libraries/tcpdf/config/tcpdf_config.php +++ b/libraries/tcpdf/config/tcpdf_config.php @@ -1,7 +1,7 @@ \ No newline at end of file + \ No newline at end of file diff --git a/libraries/tcpdf/index.html b/libraries/tcpdf/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/libraries/tcpdf/index.html +++ b/libraries/tcpdf/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/libraries/tcpdf/tcpdf.php b/libraries/tcpdf/tcpdf.php index cbd36ad0468a5..bca116be456f6 100644 --- a/libraries/tcpdf/tcpdf.php +++ b/libraries/tcpdf/tcpdf.php @@ -1,15 +1,15 @@ AddPage(); * $pdf->SetFont('vera','',12); * for($i=1;$i<=300;$i++) { - * $pdf->Cell(0,5,"Line $i",0,1); + * $pdf->Cell(0,5,"Line $i",0,1); * } * $pdf->Output(); * @@ -4133,26 +4133,26 @@ function _puttruetypeunicode($font) { * Invalid byte sequences will be replaced with 0xFFFD (replacement character)
      * Based on: http://www.faqs.org/rfcs/rfc3629.html *
      -		 * 	  Char. number range  |        UTF-8 octet sequence
      -		 *       (hexadecimal)    |              (binary)
      -		 *    --------------------+-----------------------------------------------
      -		 *    0000 0000-0000 007F | 0xxxxxxx
      -		 *    0000 0080-0000 07FF | 110xxxxx 10xxxxxx
      -		 *    0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
      -		 *    0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
      -		 *    ---------------------------------------------------------------------
      +		 * 	  Char. number range  |		UTF-8 octet sequence
      +		 *	   (hexadecimal)	|			  (binary)
      +		 *	--------------------+-----------------------------------------------
      +		 *	0000 0000-0000 007F | 0xxxxxxx
      +		 *	0000 0080-0000 07FF | 110xxxxx 10xxxxxx
      +		 *	0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
      +		 *	0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
      +		 *	---------------------------------------------------------------------
       		 *
       		 *   ABFN notation:
       		 *   ---------------------------------------------------------------------
       		 *   UTF8-octets = *( UTF8-char )
       		 *   UTF8-char   = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4
      -		 *   UTF8-1      = %x00-7F
      -		 *   UTF8-2      = %xC2-DF UTF8-tail
      +		 *   UTF8-1	  = %x00-7F
      +		 *   UTF8-2	  = %xC2-DF UTF8-tail
       		 *
      -		 *   UTF8-3      = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) /
      -		 *                 %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail )
      -		 *   UTF8-4      = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) /
      -		 *                 %xF4 %x80-8F 2( UTF8-tail )
      +		 *   UTF8-3	  = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) /
      +		 *				 %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail )
      +		 *   UTF8-4	  = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) /
      +		 *				 %xF4 %x80-8F 2( UTF8-tail )
       		 *   UTF8-tail   = %x80-BF
       		 *   ---------------------------------------------------------------------
       		 * 
      @@ -4257,28 +4257,28 @@ function UTF8ToUTF16BE($str, $setbom=true) { * Encoding UTF-16: * * Encoding of a single character from an ISO 10646 character value to - * UTF-16 proceeds as follows. Let U be the character number, no greater - * than 0x10FFFF. + * UTF-16 proceeds as follows. Let U be the character number, no greater + * than 0x10FFFF. * - * 1) If U < 0x10000, encode U as a 16-bit unsigned integer and - * terminate. + * 1) If U < 0x10000, encode U as a 16-bit unsigned integer and + * terminate. * - * 2) Let U' = U - 0x10000. Because U is less than or equal to 0x10FFFF, - * U' must be less than or equal to 0xFFFFF. That is, U' can be - * represented in 20 bits. + * 2) Let U' = U - 0x10000. Because U is less than or equal to 0x10FFFF, + * U' must be less than or equal to 0xFFFFF. That is, U' can be + * represented in 20 bits. * - * 3) Initialize two 16-bit unsigned integers, W1 and W2, to 0xD800 and - * 0xDC00, respectively. These integers each have 10 bits free to - * encode the character value, for a total of 20 bits. + * 3) Initialize two 16-bit unsigned integers, W1 and W2, to 0xD800 and + * 0xDC00, respectively. These integers each have 10 bits free to + * encode the character value, for a total of 20 bits. * - * 4) Assign the 10 high-order bits of the 20-bit U' to the 10 low-order - * bits of W1 and the 10 low-order bits of U' to the 10 low-order - * bits of W2. Terminate. + * 4) Assign the 10 high-order bits of the 20-bit U' to the 10 low-order + * bits of W1 and the 10 low-order bits of U' to the 10 low-order + * bits of W2. Terminate. * - * Graphically, steps 2 through 4 look like: - * U' = yyyyyyyyyyxxxxxxxxxx - * W1 = 110110yyyyyyyyyy - * W2 = 110111xxxxxxxxxx + * Graphically, steps 2 through 4 look like: + * U' = yyyyyyyyyyxxxxxxxxxx + * W1 = 110110yyyyyyyyyy + * W2 = 110111xxxxxxxxxx * * @param array $unicode array containing UTF-8 unicode values * @param boolean $setbom if true set the Byte Order Mark (BOM = 0xFEFF) @@ -4787,10 +4787,10 @@ function openHTMLTagHandler($tag, $attr, $fill=0) { if (isset($attr['value'])) { $this->listcount = intval($attr['value']); } - $this->lispacer = " ".(++$this->listcount).". "; + $this->lispacer = " ".(++$this->listcount).". "; } else { //unordered list simbol - $this->lispacer = " - "; + $this->lispacer = " - "; } $rtldir = $this->tmprtl; $this->tmprtl = false; @@ -6713,7 +6713,7 @@ function utf8Bidi($ta, $forcertl=false) { * @since 2.1.002 (2008-02-12) */ function Bookmark($txt, $level=0, $y=-1) { - if($y == -1) { + if($y == -1) { $y = $this->GetY(); } $this->outlines[]=array('t'=>$txt,'l'=>$level,'y'=>$y,'p'=>$this->PageNo()); diff --git a/libraries/tcpdf/unicode_data.php b/libraries/tcpdf/unicode_data.php index afd1356d06eb9..d6c53979e5c9b 100644 --- a/libraries/tcpdf/unicode_data.php +++ b/libraries/tcpdf/unicode_data.php @@ -1,7 +1,7 @@ \ No newline at end of file + \ No newline at end of file diff --git a/media/index.html b/media/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/media/index.html +++ b/media/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/media/system/css/index.html b/media/system/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/media/system/css/index.html +++ b/media/system/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/media/system/images/index.html b/media/system/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/media/system/images/index.html +++ b/media/system/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/includes/js/ThemeOffice/warning.png b/media/system/images/warning.png similarity index 100% rename from includes/js/ThemeOffice/warning.png rename to media/system/images/warning.png diff --git a/media/system/index.html b/media/system/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/media/system/index.html +++ b/media/system/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/media/system/js/index.html b/media/system/js/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/media/system/js/index.html +++ b/media/system/js/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/includes/js/joomla.javascript.js b/media/system/js/legacy.js similarity index 95% rename from includes/js/joomla.javascript.js rename to media/system/js/legacy.js index 29f885e6f6374..323ca83ea3f09 100644 --- a/includes/js/joomla.javascript.js +++ b/media/system/js/legacy.js @@ -1,6 +1,6 @@ // \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_archive/index.html b/modules/mod_archive/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_archive/index.html +++ b/modules/mod_archive/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_archive/mod_archive.php b/modules/mod_archive/mod_archive.php index de228357d985a..d9d5bd63cc646 100644 --- a/modules/mod_archive/mod_archive.php +++ b/modules/mod_archive/mod_archive.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $params->def('count', 10); $list = modArchiveHelper::getList($params); diff --git a/modules/mod_archive/tmpl/index.html b/modules/mod_archive/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_archive/tmpl/index.html +++ b/modules/mod_archive/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_banners/helper.php b/modules/mod_banners/helper.php index c2cf159b72a8e..a667052978dd4 100644 --- a/modules/mod_banners/helper.php +++ b/modules/mod_banners/helper.php @@ -14,7 +14,7 @@ // no direct access defined('_JEXEC') or die('Restricted access'); -require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_banners'.DS.'helpers'.DS.'banner.php'); +require_once JPATH_ADMINISTRATOR.DS.'components'.DS.'com_banners'.DS.'helpers'.DS.'banner.php'; class modBannersHelper { @@ -52,7 +52,7 @@ function getModel() // If the model file exists include it and try to instantiate the object if (file_exists( $path )) { - require_once( $path ); + require_once $path; if (!class_exists( 'BannersModelBanner' )) { JError::raiseWarning( 0, 'Model class BannersModelBanner not found in file.' ); return $false; diff --git a/modules/mod_banners/index.html b/modules/mod_banners/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_banners/index.html +++ b/modules/mod_banners/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_banners/mod_banners.php b/modules/mod_banners/mod_banners.php index 9554e7fbdb8cf..98f02f9ce74ba 100644 --- a/modules/mod_banners/mod_banners.php +++ b/modules/mod_banners/mod_banners.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $headerText = trim( $params->get( 'header_text' ) ); $footerText = trim( $params->get( 'footer_text' ) ); diff --git a/modules/mod_banners/tmpl/index.html b/modules/mod_banners/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_banners/tmpl/index.html +++ b/modules/mod_banners/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_breadcrumbs/index.html b/modules/mod_breadcrumbs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_breadcrumbs/index.html +++ b/modules/mod_breadcrumbs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_breadcrumbs/mod_breadcrumbs.php b/modules/mod_breadcrumbs/mod_breadcrumbs.php index 6c2f2253c9387..2f2a0181dc579 100644 --- a/modules/mod_breadcrumbs/mod_breadcrumbs.php +++ b/modules/mod_breadcrumbs/mod_breadcrumbs.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; // Get the breadcrumbs $list = modBreadCrumbsHelper::getList($params); diff --git a/modules/mod_breadcrumbs/tmpl/default.php b/modules/mod_breadcrumbs/tmpl/default.php index 8a03d06e7eb6c..2bf962b4b455c 100644 --- a/modules/mod_breadcrumbs/tmpl/default.php +++ b/modules/mod_breadcrumbs/tmpl/default.php @@ -12,7 +12,7 @@ } echo ' '.$separator.' '; } else { // when $i == $count -1 - echo $list[$i]->name; + echo $list[$i]->name; } endfor; ?> \ No newline at end of file diff --git a/modules/mod_breadcrumbs/tmpl/index.html b/modules/mod_breadcrumbs/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_breadcrumbs/tmpl/index.html +++ b/modules/mod_breadcrumbs/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_custom/index.html b/modules/mod_custom/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_custom/index.html +++ b/modules/mod_custom/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_feed/index.html b/modules/mod_feed/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_feed/index.html +++ b/modules/mod_feed/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_feed/mod_feed.php b/modules/mod_feed/mod_feed.php index 9afca9d2535bb..f996e8d7ec19a 100644 --- a/modules/mod_feed/mod_feed.php +++ b/modules/mod_feed/mod_feed.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Direct Access to this location is not allowed.'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $rssurl = $params->get('rssurl', ''); $rssrtl = $params->get('rssrtl', 0); diff --git a/modules/mod_feed/tmpl/default.php b/modules/mod_feed/tmpl/default.php index 233cc8e9eefa3..988e664dc2d66 100644 --- a/modules/mod_feed/tmpl/default.php +++ b/modules/mod_feed/tmpl/default.php @@ -43,7 +43,7 @@ } $actualItems = count( $feed->items ); - $setItems = $params->get('rssitems', 5); + $setItems = $params->get('rssitems', 5); if ($setItems > $actualItems) { $totalItems = $actualItems; diff --git a/modules/mod_feed/tmpl/index.html b/modules/mod_feed/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_feed/tmpl/index.html +++ b/modules/mod_feed/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_footer/index.html b/modules/mod_footer/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_footer/index.html +++ b/modules/mod_footer/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_footer/tmpl/index.html b/modules/mod_footer/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_footer/tmpl/index.html +++ b/modules/mod_footer/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_latestnews/helper.php b/modules/mod_latestnews/helper.php index 1f7534e2f198f..592cde0040578 100644 --- a/modules/mod_latestnews/helper.php +++ b/modules/mod_latestnews/helper.php @@ -14,7 +14,7 @@ // no direct access defined('_JEXEC') or die('Restricted access'); -require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'); +require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'; class modLatestNewsHelper { diff --git a/modules/mod_latestnews/index.html b/modules/mod_latestnews/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_latestnews/index.html +++ b/modules/mod_latestnews/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_latestnews/mod_latestnews.php b/modules/mod_latestnews/mod_latestnews.php index 92a01aaa11fdf..7d3a8c6669df0 100644 --- a/modules/mod_latestnews/mod_latestnews.php +++ b/modules/mod_latestnews/mod_latestnews.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $list = modLatestNewsHelper::getList($params); require(JModuleHelper::getLayoutPath('mod_latestnews')); \ No newline at end of file diff --git a/modules/mod_latestnews/mod_latestnews.xml b/modules/mod_latestnews/mod_latestnews.xml index dd3df5d5b7a42..7bb8580a55cd1 100644 --- a/modules/mod_latestnews/mod_latestnews.xml +++ b/modules/mod_latestnews/mod_latestnews.xml @@ -17,12 +17,12 @@ - + - + diff --git a/modules/mod_latestnews/tmpl/index.html b/modules/mod_latestnews/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_latestnews/tmpl/index.html +++ b/modules/mod_latestnews/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_login/index.html b/modules/mod_login/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_login/index.html +++ b/modules/mod_login/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_login/mod_login.php b/modules/mod_login/mod_login.php index f999756e35193..c519aa76beef7 100644 --- a/modules/mod_login/mod_login.php +++ b/modules/mod_login/mod_login.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $params->def('greeting', 1); diff --git a/modules/mod_login/tmpl/index.html b/modules/mod_login/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_login/tmpl/index.html +++ b/modules/mod_login/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_mainmenu/helper.php b/modules/mod_mainmenu/helper.php index 707e8e44816a1..cee4c42a2f84c 100644 --- a/modules/mod_mainmenu/helper.php +++ b/modules/mod_mainmenu/helper.php @@ -28,6 +28,7 @@ */ class modMainMenuHelper { + function buildXML(&$params) { $menu = new JMenuTree($params); @@ -117,7 +118,7 @@ function &getXML($type, &$params, $decorator) break; } } - if ((!is_a($doc, 'JSimpleXMLElement')) || (!$found) || ($root)) { + if ((!($doc INSTANCEOF JSimpleXMLElement)) || (!$found) || ($root)) { $doc = false; } } @@ -131,41 +132,19 @@ function &getXML($type, &$params, $decorator) function render(&$params, $callback) { - switch ( $params->get( 'menu_style', 'list' ) ) + // Include the new menu class + $xml = modMainMenuHelper::getXML($params->get('menutype'), $params, $callback); + if ($xml) { - case 'list_flat' : - // Include the legacy library file - require_once(dirname(__FILE__).DS.'legacy.php'); - mosShowHFMenu($params, 1); - break; - - case 'horiz_flat' : - // Include the legacy library file - require_once(dirname(__FILE__).DS.'legacy.php'); - mosShowHFMenu($params, 0); - break; - - case 'vert_indent' : - // Include the legacy library file - require_once(dirname(__FILE__).DS.'legacy.php'); - mosShowVIMenu($params); - break; - - default : - // Include the new menu class - $xml = modMainMenuHelper::getXML($params->get('menutype'), $params, $callback); - if ($xml) { - $class = $params->get('class_sfx'); - $xml->addAttribute('class', 'menu'.$class); - if ($tagId = $params->get('tag_id')) { - $xml->addAttribute('id', $tagId); - } + $class = $params->get('class_sfx'); + $xml->addAttribute('class', 'menu'.$class); + if ($tagId = $params->get('tag_id')) { + $xml->addAttribute('id', $tagId); + } - $result = JFilterOutput::ampReplace($xml->toString((bool)$params->get('show_whitespace'))); - $result = str_replace(array('
        ', '
          '), '', $result); - echo $result; - } - break; + $result = JFilterOutput::ampReplace($xml->toString((bool)$params->get('show_whitespace'))); + $result = str_replace(array('
            ', '
              '), '', $result); + echo $result; } } } @@ -182,17 +161,20 @@ class JMenuTree extends JTree /** * Node/Id Hash for quickly handling node additions to the tree. */ - var $_nodeHash = array(); + protected $_nodeHash = array(); /** * Menu parameters */ - var $_params = null; + protected $_params = null; /** * Menu parameters */ - var $_buffer = null; + protected $_buffer = null; + + protected $_root; + protected $_current; function __construct(&$params) { @@ -374,17 +356,20 @@ class JMenuNode extends JNode /** * Node Title */ - var $title = null; + public $title = null; /** * Node Link */ - var $link = null; + public $link = null; /** * CSS Class for node */ - var $class = null; + public $class = null; + + public $id = null; + public $access = null; function __construct($id, $title, $access = null, $link = null, $class = null) { @@ -394,4 +379,4 @@ function __construct($id, $title, $access = null, $link = null, $class = null) $this->link = $link; $this->class = $class; } -} \ No newline at end of file +} diff --git a/modules/mod_mainmenu/index.html b/modules/mod_mainmenu/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_mainmenu/index.html +++ b/modules/mod_mainmenu/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_mainmenu/legacy.php b/modules/mod_mainmenu/legacy.php deleted file mode 100644 index 1a60c3a9e153b..0000000000000 --- a/modules/mod_mainmenu/legacy.php +++ /dev/null @@ -1,425 +0,0 @@ -type == 'menulink') - { - $menu = &JSite::getMenu(); - if ($tmp = $menu->getItem($mitem->query['Itemid'])) { - $name = $mitem->name; - $mid = $mitem->id; - $parent = $mitem->parent; - $mitem = clone($tmp); - $mitem->name = $name; - $mitem->mid = $mid; - $mitem->parent = $parent; - } else { - return; - } - } - - switch ($mitem->type) - { - case 'separator' : - break; - - case 'url' : - if (eregi('index.php\?', $mitem->link)) { - if (!eregi('Itemid=', $mitem->link)) { - $mitem->link .= '&Itemid='.$mitem->id; - } - } - break; - - default : - $mitem->link = 'index.php?Itemid='.$mitem->id; - break; - } - - // Active Menu highlighting - $current_itemid = intval( $Itemid ); - if (!$current_itemid) { - $id = ''; - } else { - if ($current_itemid == $mitem->id) { - $id = 'id="active_menu' . $params->get('class_sfx') . '"'; - } else { - if ($params->get('activate_parent') && isset ($open) && in_array($mitem->id, $open)) { - $id = 'id="active_menu' . $params->get('class_sfx') . '"'; - } else { - if ($mitem->type == 'url' && ItemidContained($mitem->link, $current_itemid)) { - $id = 'id="active_menu' . $params->get('class_sfx') . '"'; - } else { - $id = ''; - } - } - } - } - - if ($params->get('full_active_id')) - { - // support for `active_menu` of 'Link - Url' if link is relative - if ($id == '' && $mitem->type == 'url' && strpos('http', $mitem->link) === false) { - $url = array(); - if(strpos($mitem->link, '&') !== false) - { - $mitem->link = str_replace('&','&',$mitem->link); - } - - parse_str($mitem->link, $url); - if (isset ($url['Itemid'])) { - if ($url['Itemid'] == $current_itemid) { - $id = 'id="active_menu' . $params->get('class_sfx') . '"'; - } - } - } - } - - // replace & with amp; for xhtml compliance - $menu_params = new stdClass(); - $menu_params = new JParameter($mitem->params); - $menu_secure = $menu_params->def('secure', 0); - - if (strcasecmp(substr($mitem->link, 0, 4), 'http')) { - $mitem->url = JRoute::_($mitem->link, true, $menu_secure); - } else { - $mitem->url = $mitem->link; - } - - $menuclass = 'mainlevel' . $params->get('class_sfx'); - if ($level > 0) { - $menuclass = 'sublevel' . $params->get('class_sfx'); - } - - // replace & with amp; for xhtml compliance - // remove slashes from excaped characters - $mitem->name = stripslashes(htmlspecialchars($mitem->name)); - - switch ($mitem->browserNav) - { - // cases are slightly different - case 1 : - // open in a new window - $txt = '' . $mitem->name . ''; - break; - - case 2 : - // open in a popup window - $txt = "url . "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\" " . $id . ">" . $mitem->name . "\n"; - break; - - case 3 : - // don't link it - $txt = '' . $mitem->name . ''; - break; - - default : // formerly case 2 - // open in parent window - $txt = '' . $mitem->name . ''; - break; - } - - if ($params->get('menu_images')) - { - $menu_params = new stdClass(); - $menu_params = new JParameter($mitem->params); - - $menu_image = $menu_params->def('menu_image', -1); - if (($menu_image <> '-1') && $menu_image) { - $image = '' . $mitem->name . ''; - if ($params->get('menu_images_align')) { - $txt = $txt . ' ' . $image; - } else { - $txt = $image . ' ' . $txt; - } - } - } - - return $txt; -} - -/** -* Vertically Indented Menu -*/ -function mosShowVIMenu(& $params) -{ - global $mainframe, $Itemid; - - $template = $mainframe->getTemplate(); - $menu =& JSite::getMenu(); - $user =& JFactory::getUser(); - - // indent icons - switch ($params->get('indent_image')) { - case '1' : - { - // Default images - $imgpath = JURI::base(true).'/images/M_images'; - for ($i = 1; $i < 7; $i++) { - $img[$i] = ''; - } - } - break; - - case '2' : - { - // Use Params - $imgpath = JURI::base(true).'/images/M_images'; - for ($i = 1; $i < 7; $i++) { - if ($params->get('indent_image' . $i) == '-1') { - $img[$i] = NULL; - } else { - $img[$i] = ''; - } - } - } - break; - - case '3' : - { - // None - for ($i = 1; $i < 7; $i++) { - $img[$i] = NULL; - } - } - break; - - default : - { - // Template - $imgpath = JURI::base(true).'/templates/' . $template . '/images'; - for ($i = 1; $i < 7; $i++) { - $img[$i] = ''; - } - } - } - - $indents = array ( - // block prefix / item prefix / item suffix / block suffix - array ( - '', - '', - '
              ', - '
              ' - ), - array ( - '', - '
              ' . $img[1], - '
              ', - '' - ), - array ( - '', - '
              ' . $img[2], - '
              ', - '' - ), - array ( - '', - '
              ' . $img[3], - '
              ', - '' - ), - array ( - '', - '
              ' . $img[4], - '
              ', - '' - ), - array ( - '', - '
              ' . $img[5], - '
              ', - '' - ), - array ( - '', - '
              ' . $img[6], - '
              ', - '' - ), - - ); - - // establish the hierarchy of the menu - $children = array (); - - //get menu items - $rows = $menu->getItems('menutype', $params->get('menutype')); - - // first pass - collect children - $cacheIndex = array(); - if(is_array($rows) && count($rows)) { - foreach ($rows as $index => $v) { - if ($v->access <= $user->get('gid')) { - $pt = $v->parent; - $list = @ $children[$pt] ? $children[$pt] : array (); - array_push($list, $v); - $children[$pt] = $list; - } - $cacheIndex[$v->id] = $index; - } - } - - // second pass - collect 'open' menus - $open = array ( - $Itemid - ); - $count = 20; // maximum levels - to prevent runaway loop - $id = $Itemid; - - while (-- $count) - { - if (isset($cacheIndex[$id])) { - $index = $cacheIndex[$id]; - if (isset ($rows[$index]) && $rows[$index]->parent > 0) { - $id = $rows[$index]->parent; - $open[] = $id; - } else { - break; - } - } - } - - mosRecurseVIMenu(0, 0, $children, $open, $indents, $params); -} - -/** -* Utility function to recursively work through a vertically indented -* hierarchial menu -*/ -function mosRecurseVIMenu($id, $level, & $children, & $open, & $indents, & $params) -{ - if (@ $children[$id]) { - $n = min($level, count($indents) - 1); - - echo "\n" . $indents[$n][0]; - foreach ($children[$id] as $row) { - - echo "\n" . $indents[$n][1]; - - echo mosGetMenuLink($row, $level, $params, $open); - - // show menu with menu expanded - submenus visible - if (!$params->get('expand_menu')) { - if (in_array($row->id, $open)) { - mosRecurseVIMenu($row->id, $level +1, $children, $open, $indents, $params); - } - } else { - mosRecurseVIMenu($row->id, $level +1, $children, $open, $indents, $params); - } - echo $indents[$n][2]; - } - echo "\n" . $indents[$n][3]; - } -} - -/** -* Draws a horizontal 'flat' style menu (very simple case) -*/ -function mosShowHFMenu(& $params, $style = 0) -{ - $menu = & JSite::getMenu(); - $user = & JFactory::getUser(); - - //get menu items - $rows = $menu->getItems('menutype', $params->get('menutype')); - - $links = array (); - if(is_array($rows) && count($rows)) { - foreach ($rows as $row) - { - if ($row->access <= $user->get('aid', 0)) { - $links[] = mosGetMenuLink($row, 0, $params); - } - } - } - - $menuclass = 'mainlevel' . $params->get('class_sfx'); - $lang =& JFactory::getLanguage(); - - if (count($links)) - { - switch ($style) - { - case 1 : - echo '
                '; - foreach ($links as $link) { - echo '
              • ' . $link . '
              • '; - } - echo '
              '; - break; - - default : - $spacer_start = $params->get('spacer'); - $spacer_end = $params->get('end_spacer'); - - echo ''; - echo ''; - echo ''; - echo ''; - echo '
              '; - - if ($spacer_end) { - echo ' ' . $spacer_end . ' '; - } - - if ($spacer_start) { - $html = ' ' . $spacer_start . ' '; - echo implode($html, $links); - } else { - echo implode('', $links); - } - - if ($spacer_end) { - echo ' ' . $spacer_end . ' '; - } - - echo '
              '; - break; - } - } -} - -/** -* Search for Itemid in link -*/ -function ItemidContained($link, $Itemid) -{ - $link = str_replace('&', '&', $link); - $temp = explode("&", $link); - $linkItemid = ""; - foreach ($temp as $value) { - $temp2 = explode("=", $value); - if ($temp2[0] == "Itemid") { - $linkItemid = $temp2[1]; - break; - } - } - if ($linkItemid != "" && $linkItemid == $Itemid) { - return true; - } else { - return false; - } -} diff --git a/modules/mod_mainmenu/mod_mainmenu.php b/modules/mod_mainmenu/mod_mainmenu.php index f7459b80e5598..9ab3a72369324 100644 --- a/modules/mod_mainmenu/mod_mainmenu.php +++ b/modules/mod_mainmenu/mod_mainmenu.php @@ -15,24 +15,13 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $params->def('menutype', 'mainmenu'); $params->def('class_sfx', ''); $params->def('menu_images', 0); -$params->def('menu_images_align', 0); $params->def('expand_menu', 0); $params->def('activate_parent', 0); -$params->def('indent_image', 0); -$params->def('indent_image1', 'indent1.png'); -$params->def('indent_image2', 'indent2.png'); -$params->def('indent_image3', 'indent3.png'); -$params->def('indent_image4', 'indent4.png'); -$params->def('indent_image5', 'indent5.png'); -$params->def('indent_image6', 'indent.png'); -$params->def('spacer', ''); -$params->def('end_spacer', ''); -$params->def('full_active_id', 0); // Added in 1.5 $params->def('startLevel', 0); diff --git a/modules/mod_mainmenu/mod_mainmenu.xml b/modules/mod_mainmenu/mod_mainmenu.xml index 803f1d11ab770..e04661a4604a0 100644 --- a/modules/mod_mainmenu/mod_mainmenu.xml +++ b/modules/mod_mainmenu/mod_mainmenu.xml @@ -14,12 +14,6 @@ - - - - - - @@ -51,41 +45,9 @@ - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - diff --git a/modules/mod_mainmenu/tmpl/index.html b/modules/mod_mainmenu/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_mainmenu/tmpl/index.html +++ b/modules/mod_mainmenu/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_mostread/helper.php b/modules/mod_mostread/helper.php index 7c58827c15adc..4b1b5f7e37e72 100644 --- a/modules/mod_mostread/helper.php +++ b/modules/mod_mostread/helper.php @@ -14,7 +14,7 @@ // no direct access defined('_JEXEC') or die('Restricted access'); -require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'); +require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'; class modMostReadHelper { diff --git a/modules/mod_mostread/index.html b/modules/mod_mostread/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_mostread/index.html +++ b/modules/mod_mostread/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_mostread/mod_mostread.php b/modules/mod_mostread/mod_mostread.php index 95880b28c5d9a..69e3d6b78e7d8 100644 --- a/modules/mod_mostread/mod_mostread.php +++ b/modules/mod_mostread/mod_mostread.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $list = modMostReadHelper::getList($params); require(JModuleHelper::getLayoutPath('mod_mostread')); \ No newline at end of file diff --git a/modules/mod_mostread/tmpl/index.html b/modules/mod_mostread/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_mostread/tmpl/index.html +++ b/modules/mod_mostread/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_newsflash/helper.php b/modules/mod_newsflash/helper.php index fabff70642a99..3545645ed7a8d 100644 --- a/modules/mod_newsflash/helper.php +++ b/modules/mod_newsflash/helper.php @@ -14,7 +14,7 @@ // no direct access defined('_JEXEC') or die('Restricted access'); -require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'); +require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'; class modNewsFlashHelper { diff --git a/modules/mod_newsflash/index.html b/modules/mod_newsflash/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_newsflash/index.html +++ b/modules/mod_newsflash/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_newsflash/mod_newsflash.php b/modules/mod_newsflash/mod_newsflash.php index baff7bd333997..fe21f1b170c0b 100644 --- a/modules/mod_newsflash/mod_newsflash.php +++ b/modules/mod_newsflash/mod_newsflash.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $params->set('intro_only', 1); $params->set('hide_author', 1); diff --git a/modules/mod_newsflash/tmpl/index.html b/modules/mod_newsflash/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_newsflash/tmpl/index.html +++ b/modules/mod_newsflash/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_poll/index.html b/modules/mod_poll/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_poll/index.html +++ b/modules/mod_poll/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_poll/mod_poll.php b/modules/mod_poll/mod_poll.php index a1ae36fe1307e..d33843039ee8c 100644 --- a/modules/mod_poll/mod_poll.php +++ b/modules/mod_poll/mod_poll.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $tabclass_arr = array ('sectiontableentry2', 'sectiontableentry1'); @@ -26,9 +26,9 @@ $poll = modPollHelper::getPoll($params->get( 'id', 0 )); if ( $poll && $poll->id ) { - $layout = JModuleHelper::getLayoutPath('mod_poll'); - $tabcnt = 0; - $options = modPollHelper::getPollOptions($poll->id); + $layout = JModuleHelper::getLayoutPath('mod_poll'); + $tabcnt = 0; + $options = modPollHelper::getPollOptions($poll->id); require($layout); } \ No newline at end of file diff --git a/modules/mod_poll/tmpl/index.html b/modules/mod_poll/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_poll/tmpl/index.html +++ b/modules/mod_poll/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_random_image/index.html b/modules/mod_random_image/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_random_image/index.html +++ b/modules/mod_random_image/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_random_image/mod_random_image.php b/modules/mod_random_image/mod_random_image.php index 6191123f5af11..6108706e261b1 100644 --- a/modules/mod_random_image/mod_random_image.php +++ b/modules/mod_random_image/mod_random_image.php @@ -15,7 +15,7 @@ defined( '_JEXEC' ) or die( 'Restricted access' ); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $link = $params->get( 'link' ); diff --git a/modules/mod_random_image/tmpl/index.html b/modules/mod_random_image/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_random_image/tmpl/index.html +++ b/modules/mod_random_image/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_related_items/helper.php b/modules/mod_related_items/helper.php index acdfe09fa1e08..d250c0c9cd0fa 100644 --- a/modules/mod_related_items/helper.php +++ b/modules/mod_related_items/helper.php @@ -14,7 +14,7 @@ // no direct access defined('_JEXEC') or die('Restricted access'); -require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'); +require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'; class modRelatedItemsHelper { diff --git a/modules/mod_related_items/index.html b/modules/mod_related_items/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_related_items/index.html +++ b/modules/mod_related_items/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_related_items/mod_related_items.php b/modules/mod_related_items/mod_related_items.php index 9c328873d2ce3..9cc8149eb91be 100644 --- a/modules/mod_related_items/mod_related_items.php +++ b/modules/mod_related_items/mod_related_items.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $list = modRelatedItemsHelper::getList($params); diff --git a/modules/mod_related_items/tmpl/index.html b/modules/mod_related_items/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_related_items/tmpl/index.html +++ b/modules/mod_related_items/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_search/helper.php b/modules/mod_search/helper.php index 6be86cc7176c9..2aae2b5bdd706 100644 --- a/modules/mod_search/helper.php +++ b/modules/mod_search/helper.php @@ -15,8 +15,8 @@ defined('_JEXEC') or die('Restricted access'); class modSearchHelper { - function getSearchImage($button_text) { - $img = JHTML::_('image.site', 'searchButton.gif', '/images/M_images/', NULL, NULL, $button_text, null, 0); + function getSearchImage($button_text) { + $img = JHTML::_('image.site', 'searchButton.gif', '/images/M_images/', NULL, NULL, $button_text, null, 0); return $img; } } \ No newline at end of file diff --git a/modules/mod_search/index.html b/modules/mod_search/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_search/index.html +++ b/modules/mod_search/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_search/mod_search.php b/modules/mod_search/mod_search.php index a10b72503ad5a..3b4d01b3d2860 100644 --- a/modules/mod_search/mod_search.php +++ b/modules/mod_search/mod_search.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once( dirname(__FILE__).DS.'helper.php' ); +require_once dirname(__FILE__).DS.'helper.php'; $button = $params->get('button', ''); $imagebutton = $params->get('imagebutton', ''); @@ -27,6 +27,6 @@ $moduleclass_sfx = $params->get('moduleclass_sfx', ''); if ($imagebutton) { - $img = modSearchHelper::getSearchImage( $button_text ); + $img = modSearchHelper::getSearchImage( $button_text ); } require(JModuleHelper::getLayoutPath('mod_search')); \ No newline at end of file diff --git a/modules/mod_search/tmpl/default.php b/modules/mod_search/tmpl/default.php index 4500c2f0e4176..97439fc485348 100644 --- a/modules/mod_search/tmpl/default.php +++ b/modules/mod_search/tmpl/default.php @@ -3,35 +3,35 @@
              '; + $output = ''; if ($button) : - if ($imagebutton) : - $button = ''; - else : - $button = ''; - endif; + if ($imagebutton) : + $button = ''; + else : + $button = ''; + endif; endif; switch ($button_pos) : - case 'top' : - $button = $button.'
              '; - $output = $button.$output; - break; + case 'top' : + $button = $button.'
              '; + $output = $button.$output; + break; - case 'bottom' : - $button = '
              '.$button; - $output = $output.$button; - break; + case 'bottom' : + $button = '
              '.$button; + $output = $output.$button; + break; - case 'right' : - $output = $output.$button; - break; + case 'right' : + $output = $output.$button; + break; - case 'left' : - default : - $output = $button.$output; - break; + case 'left' : + default : + $output = $button.$output; + break; endswitch; echo $output; diff --git a/modules/mod_search/tmpl/index.html b/modules/mod_search/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_search/tmpl/index.html +++ b/modules/mod_search/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_sections/helper.php b/modules/mod_sections/helper.php index d7a99c014c892..df774e9d62efa 100644 --- a/modules/mod_sections/helper.php +++ b/modules/mod_sections/helper.php @@ -14,7 +14,7 @@ /// no direct access defined('_JEXEC') or die('Restricted access'); -require_once (JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'); +require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'; class modSectionsHelper { diff --git a/modules/mod_sections/index.html b/modules/mod_sections/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_sections/index.html +++ b/modules/mod_sections/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_sections/mod_sections.php b/modules/mod_sections/mod_sections.php index f0c356979845f..c54ffbf248539 100644 --- a/modules/mod_sections/mod_sections.php +++ b/modules/mod_sections/mod_sections.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $list = modSectionsHelper::getList($params); diff --git a/modules/mod_sections/tmpl/index.html b/modules/mod_sections/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_sections/tmpl/index.html +++ b/modules/mod_sections/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_stats/index.html b/modules/mod_stats/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_stats/index.html +++ b/modules/mod_stats/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_stats/mod_stats.php b/modules/mod_stats/mod_stats.php index f879fcd88ccaa..922042c20dbac 100644 --- a/modules/mod_stats/mod_stats.php +++ b/modules/mod_stats/mod_stats.php @@ -15,7 +15,7 @@ defined( '_JEXEC' ) or die( 'Restricted access' ); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $serverinfo = $params->get( 'serverinfo' ); $siteinfo = $params->get( 'siteinfo' ); diff --git a/modules/mod_stats/tmpl/index.html b/modules/mod_stats/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_stats/tmpl/index.html +++ b/modules/mod_stats/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_syndicate/index.html b/modules/mod_syndicate/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_syndicate/index.html +++ b/modules/mod_syndicate/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_syndicate/mod_syndicate.php b/modules/mod_syndicate/mod_syndicate.php index 0e7d574193dbd..73c40171a7192 100644 --- a/modules/mod_syndicate/mod_syndicate.php +++ b/modules/mod_syndicate/mod_syndicate.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Direct Access to this location is not allowed.'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $params->def('text', 'Feed Entries'); $params->def('format', 'rss'); diff --git a/modules/mod_syndicate/tmpl/index.html b/modules/mod_syndicate/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_syndicate/tmpl/index.html +++ b/modules/mod_syndicate/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_whosonline/helper.php b/modules/mod_whosonline/helper.php index ecd6d0b2f8993..aa80544229528 100644 --- a/modules/mod_whosonline/helper.php +++ b/modules/mod_whosonline/helper.php @@ -18,12 +18,12 @@ class modWhosonlineHelper { // show online count function getOnlineCount() { - $db =& JFactory::getDBO(); - $sessions = null; + $db =& JFactory::getDBO(); + $sessions = null; // calculate number of guests and members - $result = array(); - $user_array = 0; - $guest_array = 0; + $result = array(); + $user_array = 0; + $guest_array= 0; $query = 'SELECT guest, usertype, client_id' . ' FROM #__session' . @@ -36,10 +36,10 @@ function getOnlineCount() { } if (count($sessions)) { - foreach ($sessions as $session) { - // if guest increase guest count by 1 + foreach ($sessions as $session) { + // if guest increase guest count by 1 if ($session->guest == 1 && !$session->usertype) { - $guest_array ++; + $guest_array ++; } // if member increase member count by 1 if ($session->guest == 0) { @@ -56,7 +56,7 @@ function getOnlineCount() { // show online member names function getOnlineMemberNames() { - $db =& JFactory::getDBO(); + $db =& JFactory::getDBO(); $result = null; $query = 'SELECT DISTINCT a.username' . diff --git a/modules/mod_whosonline/index.html b/modules/mod_whosonline/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_whosonline/index.html +++ b/modules/mod_whosonline/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_whosonline/mod_whosonline.php b/modules/mod_whosonline/mod_whosonline.php index ae0efae6ac31c..515cb73ef77bf 100644 --- a/modules/mod_whosonline/mod_whosonline.php +++ b/modules/mod_whosonline/mod_whosonline.php @@ -15,16 +15,16 @@ defined('_JEXEC') or die('Restricted access'); // Include the whosonline functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $showmode = $params->get( 'showmode', 0 ); if ($showmode == 0 || $showmode == 2) { - $count = modWhosonlineHelper::getOnlineCount(); + $count = modWhosonlineHelper::getOnlineCount(); } if ($showmode > 0) { - $names = modWhosonlineHelper::getOnlineMemberNames(); + $names = modWhosonlineHelper::getOnlineMemberNames(); } require(JModuleHelper::getLayoutPath('mod_whosonline')); diff --git a/modules/mod_whosonline/tmpl/default.php b/modules/mod_whosonline/tmpl/default.php index 711f2ab7660a6..a72282930855b 100644 --- a/modules/mod_whosonline/tmpl/default.php +++ b/modules/mod_whosonline/tmpl/default.php @@ -2,35 +2,35 @@ defined('_JEXEC') or die('Restricted access'); if ($showmode == 0 || $showmode == 2) : - if ($count['guest'] != 0 || $count['user'] != 0) : - echo JText::_('We have') . ' '; + if ($count['guest'] != 0 || $count['user'] != 0) : + echo JText::_('We have') . ' '; if ($count['guest'] == 1) : - echo JText::sprintf('guest', '1'); + echo JText::sprintf('guest', '1'); else : - if ($count['guest'] > 1) : - echo JText::sprintf('guests', $count['guest']); + if ($count['guest'] > 1) : + echo JText::sprintf('guests', $count['guest']); endif; endif; if ($count['guest'] != 0 && $count['user'] != 0) : - echo ' ' . JText::_('and') . ' '; - endif; + echo ' ' . JText::_('and') . ' '; + endif; if ($count['user'] == 1) : - echo JText::sprintf('member', '1'); + echo JText::sprintf('member', '1'); else : - if ($count['user'] > 1) : - echo JText::sprintf('members', $count['user']); + if ($count['user'] > 1) : + echo JText::sprintf('members', $count['user']); endif; endif; echo ' ' . JText::_('online'); - endif; + endif; endif; if(($showmode > 0) && count($names)) : ?> -
                +
                  -
                • username; ?>
                • +
                • username; ?>
                \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_wrapper/index.html b/modules/mod_wrapper/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_wrapper/index.html +++ b/modules/mod_wrapper/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/modules/mod_wrapper/mod_wrapper.php b/modules/mod_wrapper/mod_wrapper.php index b42d776e7062d..957f50e0d225e 100644 --- a/modules/mod_wrapper/mod_wrapper.php +++ b/modules/mod_wrapper/mod_wrapper.php @@ -15,7 +15,7 @@ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once -require_once (dirname(__FILE__).DS.'helper.php'); +require_once dirname(__FILE__).DS.'helper.php'; $params = modWrapperHelper::getParams($params); diff --git a/modules/mod_wrapper/tmpl/index.html b/modules/mod_wrapper/tmpl/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/modules/mod_wrapper/tmpl/index.html +++ b/modules/mod_wrapper/tmpl/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/authentication/example.php b/plugins/authentication/example.php index 6e38b04faf95e..f521d146bc34d 100644 --- a/plugins/authentication/example.php +++ b/plugins/authentication/example.php @@ -26,22 +26,6 @@ */ class plgAuthenticationExample extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgAuthenticationExample(& $subject, $config) - { - parent::__construct($subject, $config); - } - /** * This method should handle any authentication and report back to the subject * diff --git a/plugins/authentication/gmail.php b/plugins/authentication/gmail.php index e5609a9bb1b63..505a6cf8b42a5 100644 --- a/plugins/authentication/gmail.php +++ b/plugins/authentication/gmail.php @@ -20,34 +20,18 @@ /** * GMail Authentication Plugin * - * @author Samuel Moffatt * @package Joomla * @subpackage JFramework * @since 1.5 */ class plgAuthenticationGMail extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgAuthenticationGMail(& $subject, $config) { - parent::__construct($subject, $config); - } - /** * This method should handle any authentication and report back to the subject * * @access public * @param array $credentials Array holding the user credentials - * @param array $options Array of extra options + * @param array $options Array of extra options * @param object $response Authentication response object * @return boolean * @since 1.5 @@ -92,7 +76,7 @@ function onAuthenticate( $credentials, $options, &$response ) if ($success) { - $response->status = JAUTHENTICATE_STATUS_SUCCESS; + $response->status = JAUTHENTICATE_STATUS_SUCCESS; $response->error_message = ''; $response->email = $credentials['username']; $response->fullname = $credentials['username']; diff --git a/plugins/authentication/index.html b/plugins/authentication/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/authentication/index.html +++ b/plugins/authentication/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/authentication/joomla.php b/plugins/authentication/joomla.php index 1ef4df10f2ac0..a559b432287ad 100644 --- a/plugins/authentication/joomla.php +++ b/plugins/authentication/joomla.php @@ -20,35 +20,18 @@ /** * Joomla Authentication plugin * - * @author Louis Landry * @package Joomla * @subpackage JFramework * @since 1.5 */ class plgAuthenticationJoomla extends JPlugin { - - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgAuthenticationJoomla(& $subject, $config) { - parent::__construct($subject, $config); - } - /** * This method should handle any authentication and report back to the subject * * @access public * @param array $credentials Array holding the user credentials - * @param array $options Array of extra options + * @param array $options Array of extra options * @param object $response Authentication response object * @return boolean * @since 1.5 diff --git a/plugins/authentication/ldap.php b/plugins/authentication/ldap.php index d58e3ead9b07f..5c74053916c36 100644 --- a/plugins/authentication/ldap.php +++ b/plugins/authentication/ldap.php @@ -20,7 +20,6 @@ /** * LDAP Authentication Plugin * - * @author Sam Moffatt * @package Joomla * @subpackage JFramework * @since 1.5 @@ -28,28 +27,12 @@ class plgAuthenticationLdap extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgAuthenticationLdap(& $subject, $config) - { - parent::__construct($subject, $config); - } - /** * This method should handle any authentication and report back to the subject * * @access public * @param array $credentials Array holding the user credentials - * @param array $options Array of extra options + * @param array $options Array of extra options * @param object $response Authentication response object * @return object boolean * @since 1.5 @@ -143,7 +126,7 @@ function onAuthenticate( $credentials, $options, &$response ) } // Were good - So say so. - $response->status = JAUTHENTICATE_STATUS_SUCCESS; + $response->status = JAUTHENTICATE_STATUS_SUCCESS; $response->error_message = ''; } diff --git a/plugins/authentication/openid.php b/plugins/authentication/openid.php index 3ea2d34473bde..92101f77f1e52 100644 --- a/plugins/authentication/openid.php +++ b/plugins/authentication/openid.php @@ -20,7 +20,6 @@ /** * OpenID Authentication Plugin * - * @author Johan Janssens * @package Joomla * @subpackage openID * @since 1.5 @@ -28,28 +27,12 @@ class plgAuthenticationOpenID extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgAuthenticationOpenID(& $subject, $config) - { - parent::__construct($subject, $config); - } - /** * This method should handle any authentication and report back to the subject * * @access public * @param array $credentials Array holding the user credentials - * @param array $options Array of extra options (return, entry_url) + * @param array $options Array of extra options (return, entry_url) * @param object $response Authentication response object * @return boolean * @since 1.5 @@ -62,7 +45,7 @@ function onAuthenticate( $credentials, $options, &$response ) define ("Auth_OpenID_RAND_SOURCE", null); } - require_once(JPATH_LIBRARIES.DS.'openid'.DS.'consumer.php'); + require_once JPATH_LIBRARIES.DS.'openid'.DS.'consumer.php'; // Access the session data $session =& JFactory::getSession(); @@ -117,7 +100,7 @@ function onAuthenticate( $credentials, $options, &$response ) $process_url = sprintf($entry_url->toString()."&username=%s", $credentials['username']); $process_url .= '&'.JURI::buildQuery($options); - $trust_url = $entry_url->toString(array('path', 'host', 'port', 'scheme')); + $trust_url = $entry_url->toString(array('path', 'host', 'port', 'scheme')); $redirect_url = $request->redirectURL($trust_url, $process_url); $session->set('trust_url', $trust_url); @@ -137,8 +120,8 @@ function onAuthenticate( $credentials, $options, &$response ) { $sreg = $result->extensionResponse('sreg'); - $response->status = JAUTHENTICATE_STATUS_SUCCESS; - $response->error_message = ''; + $response->status = JAUTHENTICATE_STATUS_SUCCESS; + $response->error_message = ''; $response->email = isset($sreg['email']) ? $sreg['email'] : ""; $response->fullname = isset($sreg['fullname']) ? $sreg['fullname'] : ""; $response->language = isset($sreg['language']) ? $sreg['language'] : ""; diff --git a/plugins/content/example.php b/plugins/content/example.php index b8a76cb38ce54..652d84199f953 100644 --- a/plugins/content/example.php +++ b/plugins/content/example.php @@ -26,23 +26,6 @@ */ class plgContentExample extends JPlugin { - - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param object $params The object that holds the plugin parameters - * @since 1.5 - */ - function plgContentExample( &$subject, $params ) - { - parent::__construct( $subject, $params ); - } - /** * Example prepare content method * diff --git a/plugins/content/index.html b/plugins/content/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/content/index.html +++ b/plugins/content/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors-xtd/image.php b/plugins/editors-xtd/image.php index 44ecd3abdb603..733887c2eb894 100644 --- a/plugins/editors-xtd/image.php +++ b/plugins/editors-xtd/image.php @@ -19,28 +19,11 @@ /** * Editor Image buton * - * @author Johan Janssens * @package Editors-xtd * @since 1.5 */ class plgButtonImage extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgButtonImage(& $subject, $config) - { - parent::__construct($subject, $config); - } - /** * Display the button * @@ -57,7 +40,7 @@ function onDisplay($name) JHTML::_('behavior.modal'); - $button = new JObject(); + $button = new JStdClass(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('Image')); @@ -66,4 +49,4 @@ function onDisplay($name) return $button; } -} \ No newline at end of file +} diff --git a/plugins/editors-xtd/index.html b/plugins/editors-xtd/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors-xtd/index.html +++ b/plugins/editors-xtd/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors-xtd/pagebreak.php b/plugins/editors-xtd/pagebreak.php index 09672f6bbad71..c343101de8c08 100644 --- a/plugins/editors-xtd/pagebreak.php +++ b/plugins/editors-xtd/pagebreak.php @@ -19,28 +19,11 @@ /** * Editor Pagebreak buton * - * @author Johan Janssens * @package Editors-xtd * @since 1.5 */ class plgButtonPagebreak extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgButtonPagebreak(& $subject, $config) - { - parent::__construct($subject, $config); - } - /** * Display the button * @@ -57,7 +40,7 @@ function onDisplay($name) JHTML::_('behavior.modal'); - $button = new JObject(); + $button = new JStdClass(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('Pagebreak')); @@ -66,4 +49,4 @@ function onDisplay($name) return $button; } -} \ No newline at end of file +} diff --git a/plugins/editors-xtd/readmore.php b/plugins/editors-xtd/readmore.php index dd6307440f964..5fde5bce088fd 100644 --- a/plugins/editors-xtd/readmore.php +++ b/plugins/editors-xtd/readmore.php @@ -19,28 +19,11 @@ /** * Editor Readmore buton * - * @author Johan Janssens * @package Editors-xtd * @since 1.5 */ class plgButtonReadmore extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgButtonReadmore(& $subject, $config) - { - parent::__construct($subject, $config); - } - /** * readmore button * @return array A two element array of ( imageName, textToInsert ) @@ -70,7 +53,7 @@ function insertReadmore(editor) { $doc->addScriptDeclaration($js); - $button = new JObject(); + $button = new JStdClass(); $button->set('modal', false); $button->set('onclick', 'insertReadmore(\''.$name.'\');return false;'); $button->set('text', JText::_('Readmore')); @@ -81,4 +64,4 @@ function insertReadmore(editor) { return $button; } -} \ No newline at end of file +} diff --git a/plugins/editors/index.html b/plugins/editors/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/index.html +++ b/plugins/editors/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/none.php b/plugins/editors/none.php index 43fa4cf48340b..90eb2e271a821 100644 --- a/plugins/editors/none.php +++ b/plugins/editors/none.php @@ -19,28 +19,11 @@ /** * No WYSIWYG Editor Plugin * - * @author Louis Landry * @package Editors * @since 1.5 */ class plgEditorNone extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgEditorNone(& $subject, $config) - { - parent::__construct($subject, $config); - } - /** * Method to handle the onInitEditor event. * - Initializes the Editor diff --git a/plugins/editors/tinymce.php b/plugins/editors/tinymce.php index ce35d06be37c1..52ada896df419 100644 --- a/plugins/editors/tinymce.php +++ b/plugins/editors/tinymce.php @@ -19,28 +19,11 @@ /** * TinyMCE WYSIWYG Editor Plugin * - * @author Louis Landry * @package Editors * @since 1.5 */ class plgEditorTinymce extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgEditorTinymce(& $subject, $config) - { - parent::__construct($subject, $config); - } - /** * Method to handle the onInit event. * - Initializes the TinyMCE WYSIWYG Editor diff --git a/plugins/editors/tinymce.xml b/plugins/editors/tinymce.xml index 8687f4a17d1e5..034cb06a3e11b 100644 --- a/plugins/editors/tinymce.xml +++ b/plugins/editors/tinymce.xml @@ -19,11 +19,11 @@ - - - - - + + + + + diff --git a/plugins/editors/tinymce/index.html b/plugins/editors/tinymce/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/index.html +++ b/plugins/editors/tinymce/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/index.html b/plugins/editors/tinymce/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/_template/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advhr/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advimage/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/advlink/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/autosave/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/bbcode/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/bbcode/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/bbcode/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/bbcode/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/cleanup/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/cleanup/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/cleanup/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/cleanup/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/contextmenu/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/devkit/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/directionality/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/emotions/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/flash/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullpage/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/fullscreen/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/iespell/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/inlinepopups/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/insertdatetime/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/layer/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/media/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/nonbreaking/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/noneditable/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/noneditable/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/noneditable/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/noneditable/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/noneditable/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/noneditable/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/noneditable/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/noneditable/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/paste/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/preview/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/print/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/save/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/searchreplace/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/style/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/table/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/template/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/visualchars/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/zoom/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/zoom/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/plugins/zoom/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/plugins/zoom/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/images/xp/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/images/xp/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/images/xp/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/images/xp/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/jscripts/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/jscripts/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/jscripts/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/jscripts/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/langs/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/langs/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/langs/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/themes/advanced/langs/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/themes/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/themes/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/themes/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/themes/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/css/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/css/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/images/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/images/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/themes/simple/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php b/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php index 50d535996127f..20c17f4097d0e 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php +++ b/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce_gzip.php @@ -3,7 +3,7 @@ * $Id$ * * @author Moxiecode - * @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved. + * @copyright Copyright (c) 2005-2006, Moxiecode Systems AB, All rights reserved. * * This file compresses the TinyMCE JavaScript using GZip and * enables the browser to do two requests instead of one for each .js file. diff --git a/plugins/editors/tinymce/jscripts/tiny_mce/utils/index.html b/plugins/editors/tinymce/jscripts/tiny_mce/utils/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/tinymce/jscripts/tiny_mce/utils/index.html +++ b/plugins/editors/tinymce/jscripts/tiny_mce/utils/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/editors/xstandard.php b/plugins/editors/xstandard.php index 96833c86305fd..277c7cd931da5 100644 --- a/plugins/editors/xstandard.php +++ b/plugins/editors/xstandard.php @@ -19,28 +19,11 @@ /** * XStandard Lite for Joomla! WYSIWYG Editor Plugin * - * @author Johan Janssens * @package Editors * @since 1.5 */ class plgEditorXstandard extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgEditorXstandard(& $subject, $config) - { - parent::__construct($subject, $config); - } - /** * Method to handle the onInitEditor event. * - Initializes the XStandard Lite WYSIWYG Editor @@ -173,7 +156,7 @@ function onDisplay( $name, $content, $width, $height, $col, $row, $buttons = tru - + diff --git a/plugins/editors/xstandard/index.html b/plugins/editors/xstandard/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/editors/xstandard/index.html +++ b/plugins/editors/xstandard/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/index.html b/plugins/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/index.html +++ b/plugins/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/search/categories.php b/plugins/search/categories.php index 6a86e7c985813..7e52ff7ff4c0d 100644 --- a/plugins/search/categories.php +++ b/plugins/search/categories.php @@ -46,7 +46,7 @@ function plgSearchCategories( $text, $phrase='', $ordering='', $areas=null ) $db =& JFactory::getDBO(); $user =& JFactory::getUser(); - require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'); + require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'; if (is_array( $areas )) { if (!array_intersect( $areas, array_keys( plgSearchCategoryAreas() ) )) { diff --git a/plugins/search/content.php b/plugins/search/content.php index d8a146172ec2b..92ad8f236b8f2 100644 --- a/plugins/search/content.php +++ b/plugins/search/content.php @@ -46,7 +46,7 @@ function plgSearchContent( $text, $phrase='', $ordering='', $areas=null ) $db =& JFactory::getDBO(); $user =& JFactory::getUser(); - require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'); + require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'; if (is_array( $areas )) { if (!array_intersect( $areas, array_keys( plgSearchContentAreas() ) )) { diff --git a/plugins/search/index.html b/plugins/search/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/search/index.html +++ b/plugins/search/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/search/sections.php b/plugins/search/sections.php index d9847b1c176dc..7aca2d7111d4c 100644 --- a/plugins/search/sections.php +++ b/plugins/search/sections.php @@ -44,7 +44,7 @@ function plgSearchSections( $text, $phrase='', $ordering='', $areas=null ) $db =& JFactory::getDBO(); $user =& JFactory::getUser(); - require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'); + require_once JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'; if (is_array( $areas )) { if (!array_intersect( $areas, array_keys( plgSearchSectionAreas() ) )) { diff --git a/plugins/search/weblinks.php b/plugins/search/weblinks.php index d3a72cc690290..e1f9072387106 100644 --- a/plugins/search/weblinks.php +++ b/plugins/search/weblinks.php @@ -44,7 +44,7 @@ function plgSearchWeblinks( $text, $phrase='', $ordering='', $areas=null ) $db =& JFactory::getDBO(); $user =& JFactory::getUser(); - require_once(JPATH_SITE.DS.'components'.DS.'com_weblinks'.DS.'helpers'.DS.'route.php'); + require_once JPATH_SITE.DS.'components'.DS.'com_weblinks'.DS.'helpers'.DS.'route.php'; if (is_array( $areas )) { if (!array_intersect( $areas, array_keys( plgSearchWeblinksAreas() ) )) { diff --git a/plugins/system/backlink.php b/plugins/system/backlink.php deleted file mode 100644 index c67c5bd2e91e8..0000000000000 --- a/plugins/system/backlink.php +++ /dev/null @@ -1,529 +0,0 @@ -_db = JFactory::getDBO(); - parent :: __construct($subject, $config); - } - - function onAfterInitialise() - { - global $mainframe; - if ($mainframe->isAdmin()) { - return; // Dont run in admin - } - - $sef = $this->params->get('sef', 1); - $url = $this->params->get('url', 1); - - $legacysef = $this->params->get('legacysef', 1); - if (!$sef && !$url && !$legacysef) - return; // None of the options enabled, bail! - - // Grab the system as early as possible, we're going to terminate it potentially - // Case 1: Query string match (shouldn't need this but its here anyway) - if ($url && isset ($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) && strpos($_SERVER['QUERY_STRING'], '&')) { - $query_string = $_SERVER['QUERY_STRING']; - $this->_lookup($query_string); - } - - // Case 2: SEF or similar match - if ($sef && isset ($_SERVER['SCRIPT_NAME']) && isset ($_SERVER['REQUEST_URI'])) { - $part = str_replace('index.php', '', $_SERVER['SCRIPT_NAME']); - if($part != '/') { - $search = str_replace($part, '', $_SERVER['REQUEST_URI']); - } else { - $search = ltrim($_SERVER['REQUEST_URI'],'/'); - } - $this->_lookup($search); - } - // Case 3: Old school core sef; used to backlink - // Enable only if: - // 1: SEF is enabled - // 2: Legacy SEF Plugin Param is set - // 3: And there is no backlink - if ($mainframe->getCfg('sef') - && $legacysef - && !strstr($_SERVER['REQUEST_URI'],'nobacklink') - && !strlen($_SERVER['QUERY_STRING'])) { - $this->_legacysef(); - } - - } - - function _lookup($searchstring) - { - // return blank strings and just index.php on its own... - if (!strlen($searchstring) || $searchstring == trim('index.php',' ?')) { - return; - } - - $sef = $this->params->get('sef', 1); - $url = $this->params->get('url', 1); - - if (!$sef && !$url) { - return; // Neither option enabled, bail! - } - - $query = 'SELECT * FROM #__migration_backlinks WHERE '; - $where = Array (); - $search = $this->_db->Quote( $this->_db->getEscaped( $searchstring, true ).'%', false ); - - if ($url) { - $where[] = 'url LIKE ' . $search; - } - if ($sef) { - $where[] = 'sefurl LIKE ' . $search; - } - - $query .= implode(' OR ', $where); - $this->_db->setQuery($query); - $results = $this->_db->loadAssocList(); - - if (count($results)) { - // Get the first one... - $this->_redirect($results[0]['itemid'], $results[0]['name'], $results[0]['newurl']); - } - } - - function _redirect($Itemid, $name, $url = null) - { - global $mainframe; - if (!strlen($url)) - { - $menu = & JSite :: getMenu(); - $item = $menu->getItem($Itemid); - //$url = $item->link; - - switch ($item->type) - { - case 'url' : - if ((strpos($item->link, 'index.php?') !== false) && (strpos($item->link, 'Itemid=') === false)) { - $url = $item->link . '&Itemid=' . $item->id; - } else { - $url = $item->link; - } - break; - - default : - $url = 'index.php?Itemid=' . $item->id; - //$url = $item->link . '&Itemid='.$item->id; - break; - } - $url = JRoute :: _($url); - //$url = JURI :: base() . $url; // was $surl with third option of below being url and second being surl - $name = $item->name; - } - // Check we're not redirecting to ourselves - if(!stristr($url,$_SERVER['REQUEST_URI']) && !stristr($url,$_SERVER['SCRIPT_NAME'].'/'.$_SERVER['QUERY_STRING'])) { - return; - } - - $name = $name ? $name : "Unknown"; - - header('Location: ' . str_replace('&','&',$url), true, '301'); // redirect and kill of and & - jexit(JText :: sprintf('"%s" has moved to %s. Click the link if your browser does not redirect you automatically.', $name, $url, $url)); - } - - function _legacysef() - { - $mosConfig_absolute_path = JPATH_SITE; - $mosConfig_live_site = JURI :: base(); - $url_array = explode('/', $_SERVER['REQUEST_URI']); - - if (in_array('content', $url_array)) - { - /** - * Content - * http://www.domain.com/$option/$task/$sectionid/$id/$Itemid/$limit/$limitstart - */ - - $uri = explode('content/', $_SERVER['REQUEST_URI']); - $option = 'com_content'; - $_GET['option'] = $option; - $_REQUEST['option'] = $option; - $pos = array_search('content', $url_array); - - // language hook for content - $lang = ''; - foreach ($url_array as $key => $value) - { - if (!strcasecmp(substr($value, 0, 5), 'lang,')) - { - $temp = explode(',', $value); - if (isset ($temp[0]) && $temp[0] != '' && isset ($temp[1]) && $temp[1] != '') - { - $_GET['lang'] = $temp[1]; - $_REQUEST['lang'] = $temp[1]; - $lang = $temp[1]; - } - unset ($url_array[$key]); - } - } - - if (isset ($url_array[$pos +8]) && $url_array[$pos +8] != '' && in_array('category', $url_array) && (strpos($url_array[$pos +5], 'order,') !== false) && (strpos($url_array[$pos +6], 'filter,') !== false)) - { - // $option/$task/$sectionid/$id/$Itemid/$order/$filter/$limit/$limitstart - $task = $url_array[$pos +1]; - $sectionid = $url_array[$pos +2]; - $id = $url_array[$pos +3]; - $Itemid = $url_array[$pos +4]; - $order = str_replace('order,', '', $url_array[$pos +5]); - $filter = str_replace('filter,', '', $url_array[$pos +6]); - $limit = $url_array[$pos +7]; - $limitstart = $url_array[$pos +8]; - - // pass data onto global variables - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - $_GET['sectionid'] = $sectionid; - $_REQUEST['sectionid'] = $sectionid; - $_GET['id'] = $id; - $_REQUEST['id'] = $id; - $_GET['Itemid'] = $Itemid; - $_REQUEST['Itemid'] = $Itemid; - $_GET['order'] = $order; - $_REQUEST['order'] = $order; - $_GET['filter'] = $filter; - $_REQUEST['filter'] = $filter; - $_GET['limit'] = $limit; - $_REQUEST['limit'] = $limit; - $_GET['limitstart'] = $limitstart; - $_REQUEST['limitstart'] = $limitstart; - - $QUERY_STRING = "option=com_content&task=$task§ionid=$sectionid&id=$id&Itemid=$Itemid&order=$order&filter=$filter&limit=$limit&limitstart=$limitstart"; - } - else if (isset ($url_array[$pos +7]) && $url_array[$pos +7] != '' && $url_array[$pos +5] > 1000 && (in_array('archivecategory', $url_array) || in_array('archivesection', $url_array))) - { - // $option/$task/$id/$limit/$limitstart/year/month/module - $task = $url_array[$pos +1]; - $id = $url_array[$pos +2]; - $limit = $url_array[$pos +3]; - $limitstart = $url_array[$pos +4]; - $year = $url_array[$pos +5]; - $month = $url_array[$pos +6]; - $module = $url_array[$pos +7]; - - // pass data onto global variables - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - $_GET['id'] = $id; - $_REQUEST['id'] = $id; - $_GET['limit'] = $limit; - $_REQUEST['limit'] = $limit; - $_GET['limitstart'] = $limitstart; - $_REQUEST['limitstart'] = $limitstart; - $_GET['year'] = $year; - $_REQUEST['year'] = $year; - $_GET['month'] = $month; - $_REQUEST['month'] = $month; - $_GET['module'] = $module; - $_REQUEST['module'] = $module; - - $QUERY_STRING = "option=com_content&task=$task&id=$id&limit=$limit&limitstart=$limitstart&year=$year&month=$month&module=$module"; - } - else if (isset ($url_array[$pos +7]) && $url_array[$pos +7] != '' && $url_array[$pos +6] > 1000 && (in_array('archivecategory', $url_array) || in_array('archivesection', $url_array))) - { - // $option/$task/$id/$Itemid/$limit/$limitstart/year/month - $task = $url_array[$pos +1]; - $id = $url_array[$pos +2]; - $Itemid = $url_array[$pos +3]; - $limit = $url_array[$pos +4]; - $limitstart = $url_array[$pos +5]; - $year = $url_array[$pos +6]; - $month = $url_array[$pos +7]; - - // pass data onto global variables - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - $_GET['id'] = $id; - $_REQUEST['id'] = $id; - $_GET['Itemid'] = $Itemid; - $_REQUEST['Itemid'] = $Itemid; - $_GET['limit'] = $limit; - $_REQUEST['limit'] = $limit; - $_GET['limitstart'] = $limitstart; - $_REQUEST['limitstart'] = $limitstart; - $_GET['year'] = $year; - $_REQUEST['year'] = $year; - $_GET['month'] = $month; - $_REQUEST['month'] = $month; - - $QUERY_STRING = "option=com_content&task=$task&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart&year=$year&month=$month"; - } - else if (isset ($url_array[$pos +7]) && $url_array[$pos +7] != '' && in_array('category', $url_array) && (strpos($url_array[$pos +5], 'order,') !== false)) - { - // $option/$task/$sectionid/$id/$Itemid/$order/$limit/$limitstart - $task = $url_array[$pos +1]; - $sectionid = $url_array[$pos +2]; - $id = $url_array[$pos +3]; - $Itemid = $url_array[$pos +4]; - $order = str_replace('order,', '', $url_array[$pos +5]); - $limit = $url_array[$pos +6]; - $limitstart = $url_array[$pos +7]; - - // pass data onto global variables - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - $_GET['sectionid'] = $sectionid; - $_REQUEST['sectionid'] = $sectionid; - $_GET['id'] = $id; - $_REQUEST['id'] = $id; - $_GET['Itemid'] = $Itemid; - $_REQUEST['Itemid'] = $Itemid; - $_GET['order'] = $order; - $_REQUEST['order'] = $order; - $_GET['limit'] = $limit; - $_REQUEST['limit'] = $limit; - $_GET['limitstart'] = $limitstart; - $_REQUEST['limitstart'] = $limitstart; - - $QUERY_STRING = "option=com_content&task=$task§ionid=$sectionid&id=$id&Itemid=$Itemid&order=$order&limit=$limit&limitstart=$limitstart"; - } - else if (isset ($url_array[$pos +6]) && $url_array[$pos +6] != '') - { - // $option/$task/$sectionid/$id/$Itemid/$limit/$limitstart - $task = $url_array[$pos +1]; - $sectionid = $url_array[$pos +2]; - $id = $url_array[$pos +3]; - $Itemid = $url_array[$pos +4]; - $limit = $url_array[$pos +5]; - $limitstart = $url_array[$pos +6]; - - // pass data onto global variables - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - $_GET['sectionid'] = $sectionid; - $_REQUEST['sectionid'] = $sectionid; - $_GET['id'] = $id; - $_REQUEST['id'] = $id; - $_GET['Itemid'] = $Itemid; - $_REQUEST['Itemid'] = $Itemid; - $_GET['limit'] = $limit; - $_REQUEST['limit'] = $limit; - $_GET['limitstart'] = $limitstart; - $_REQUEST['limitstart'] = $limitstart; - - $QUERY_STRING = "option=com_content&task=$task§ionid=$sectionid&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart"; - } - else if (isset ($url_array[$pos +5]) && $url_array[$pos +5] != '') - { - // $option/$task/$id/$Itemid/$limit/$limitstart - $task = $url_array[$pos +1]; - $id = $url_array[$pos +2]; - $Itemid = $url_array[$pos +3]; - $limit = $url_array[$pos +4]; - $limitstart = $url_array[$pos +5]; - - // pass data onto global variables - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - $_GET['id'] = $id; - $_REQUEST['id'] = $id; - $_GET['Itemid'] = $Itemid; - $_REQUEST['Itemid'] = $Itemid; - $_GET['limit'] = $limit; - $_REQUEST['limit'] = $limit; - $_GET['limitstart'] = $limitstart; - $_REQUEST['limitstart'] = $limitstart; - - $QUERY_STRING = "option=com_content&task=$task&id=$id&Itemid=$Itemid&limit=$limit&limitstart=$limitstart"; - } - else if (isset ($url_array[$pos +4]) && $url_array[$pos +4] != '' && (in_array('archivecategory', $url_array) || in_array('archivesection', $url_array))) - { - // $option/$task/$year/$month/$module - $task = $url_array[$pos +1]; - $year = $url_array[$pos +2]; - $month = $url_array[$pos +3]; - $module = $url_array[$pos +4]; - - // pass data onto global variables - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - $_GET['year'] = $year; - $_REQUEST['year'] = $year; - $_GET['month'] = $month; - $_REQUEST['month'] = $month; - $_GET['module'] = $module; - $_REQUEST['module'] = $module; - - $QUERY_STRING = "option=com_content&task=$task&year=$year&month=$month&module=$module"; - } - else if (!(isset ($url_array[$pos +5]) && $url_array[$pos +5] != '') && isset ($url_array[$pos +4]) && $url_array[$pos +4] != '') - { - // $option/$task/$sectionid/$id/$Itemid - $task = $url_array[$pos +1]; - $sectionid = $url_array[$pos +2]; - $id = $url_array[$pos +3]; - $Itemid = $url_array[$pos +4]; - - // pass data onto global variables - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - $_GET['sectionid'] = $sectionid; - $_REQUEST['sectionid'] = $sectionid; - $_GET['id'] = $id; - $_REQUEST['id'] = $id; - $_GET['Itemid'] = $Itemid; - $_REQUEST['Itemid'] = $Itemid; - - $QUERY_STRING = "option=com_content&task=$task§ionid=$sectionid&id=$id&Itemid=$Itemid"; - } - else if (!(isset ($url_array[$pos +4]) && $url_array[$pos +4] != '') && (isset ($url_array[$pos +3]) && $url_array[$pos +3] != '')) - { - // $option/$task/$id/$Itemid - $task = $url_array[$pos +1]; - $id = $url_array[$pos +2]; - $Itemid = $url_array[$pos +3]; - - // pass data onto global variables - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - $_GET['id'] = $id; - $_REQUEST['id'] = $id; - $_GET['Itemid'] = $Itemid; - $_REQUEST['Itemid'] = $Itemid; - - $QUERY_STRING = "option=com_content&task=$task&id=$id&Itemid=$Itemid"; - } - else if (!(isset ($url_array[$pos +3]) && $url_array[$pos +3] != '') && (isset ($url_array[$pos +2]) && $url_array[$pos +2] != '')) - { - // $option/$task/$id - $task = $url_array[$pos +1]; - $id = $url_array[$pos +2]; - - // pass data onto global variables - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - $_GET['id'] = $id; - $_REQUEST['id'] = $id; - - $QUERY_STRING = "option=com_content&task=$task&id=$id"; - } - else if (!(isset ($url_array[$pos +2]) && $url_array[$pos +2] != '') && (isset ($url_array[$pos +1]) && $url_array[$pos +1] != '')) - { - // $option/$task - $task = $url_array[$pos +1]; - - $_GET['task'] = $task; - $_REQUEST['task'] = $task; - - $QUERY_STRING = 'option=com_content&task=' . $task; - } - - if ($lang != '') { - $QUERY_STRING .= '&lang=' . $lang; - } - - $_SERVER['QUERY_STRING'] = $QUERY_STRING; - $REQUEST_URI = $uri[0] . 'index.php?' . $QUERY_STRING; - $_SERVER['REQUEST_URI'] = $REQUEST_URI; - - } - else if (in_array('component', $url_array)) - { - $name = 'component'; - /* - Components - http://www.domain.com/component/$name,$value - */ - $uri = explode('component/', $_SERVER['REQUEST_URI']); - $uri_array = explode('/', $uri[1]); - $QUERY_STRING = ''; - - // needed for check if component exists - $path = $mosConfig_absolute_path . '/components'; - $dirlist = array (); - if (is_dir($path)) - { - $base = opendir($path); - while (false !== ($dir = readdir($base))) - { - if ($dir !== '.' && $dir !== '..' && is_dir($path . '/' . $dir) && strtolower($dir) !== 'cvs' && strtolower($dir) !== '.svn') { - $dirlist[] = $dir; - } - } - closedir($base); - } - - foreach ($uri_array as $value) - { - $temp = explode(',', $value); - if (isset ($temp[0]) && $temp[0] != '' && isset ($temp[1]) && $temp[1] != '') - { - $_GET[$temp[0]] = $temp[1]; - $_REQUEST[$temp[0]] = $temp[1]; - - // check to ensure component actually exists - if ($temp[0] == 'option') - { - $check = ''; - if (count($dirlist)) { - foreach ($dirlist as $dir) { - if ($temp[1] == $dir) { - $check = 1; - break; - } - } - } - // redirect to 404 page if no component found to match url - if (!$check) - { - header('HTTP/1.0 404 Not Found'); - require_once ($mosConfig_absolute_path . '/templates/404.php'); - exit (404); - } - } - - if ($QUERY_STRING == '') { - $QUERY_STRING .= "$temp[0]=$temp[1]"; - } else { - $QUERY_STRING .= "&$temp[0]=$temp[1]"; - } - } - } - - $_SERVER['QUERY_STRING'] = $QUERY_STRING; - $REQUEST_URI = $uri[0] . 'index.php?' . $QUERY_STRING; - $_SERVER['REQUEST_URI'] = $REQUEST_URI; - - } - // let this go through and the rest of the system should handle it properly - } - -} \ No newline at end of file diff --git a/plugins/system/backlink.xml b/plugins/system/backlink.xml deleted file mode 100644 index 6ca1ab233116f..0000000000000 --- a/plugins/system/backlink.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - System - Backlinks - Joomla! Project - September 2007 - Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - admin@joomla.org - www.joomla.org - 1.5 - Provides backlink support - - backlink.php - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/system/cache.php b/plugins/system/cache.php index c9d7e4d31209e..4a65c7879978c 100644 --- a/plugins/system/cache.php +++ b/plugins/system/cache.php @@ -19,7 +19,6 @@ /** * Joomla! Page Cache Plugin * - * @author Johan Janssens * @package Joomla * @subpackage System */ @@ -31,19 +30,13 @@ class plgSystemCache extends JPlugin /** * Constructor * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * * @access protected * @param object $subject The object to observe * @param array $config An array that holds the plugin configuration - * @since 1.0 + * @since 1.6 */ - function plgSystemCache(& $subject, $config) - { - parent::__construct($subject, $config); - + function __construct($subject, $config) + { $user =& JFactory::getUser(); $options = array( @@ -59,7 +52,9 @@ function plgSystemCache(& $subject, $config) if (!$user->get('aid') && $_SERVER['REQUEST_METHOD'] == 'GET') { $this->_cache->setCaching(true); - } + } + + parent::__construct($subject, $config); } /** diff --git a/plugins/system/debug.php b/plugins/system/debug.php index a91913f1e1a02..bbca6fdb63158 100644 --- a/plugins/system/debug.php +++ b/plugins/system/debug.php @@ -1,170 +1,213 @@ - - * @package Joomla - * @subpackage System - */ -class plgSystemDebug extends JPlugin -{ - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @access protected - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.0 - */ - function plgSystemDebug(& $subject, $config) - { - parent::__construct($subject, $config); - - //load the translation - $this->loadLanguage( ); - } - - /** - * Converting the site URL to fit to the HTTP request - * - */ - function onAfterRender() - { - global $_PROFILER, $mainframe, $database; - - // Do not render if debugging is not enabled - if(!JDEBUG) { return; } - - $document =& JFactory::getDocument(); - $doctype = $document->getType(); - - // Only render for HTML output - if ( $doctype !== 'html' ) { return; } - - $profiler =& $_PROFILER; - - ob_start(); - echo '
                '; - echo '

                '.JText::_( 'Profile Information' ).'

                '; - foreach ( $profiler->getBuffer() as $mark ) { - echo '
                '.$mark.'
                '; - } - - if ($this->params->get('memory', 1)) { - echo '

                '.JText::_( 'Memory Usage' ).'

                '; - echo $profiler->getMemory(); - } - - if ($this->params->get('queries', 1)) - { - jimport('geshi.geshi'); - - $geshi = new GeSHi( '', 'sql' ); - $geshi->set_header_type(GESHI_HEADER_DIV); - //$geshi->enable_line_numbers( GESHI_FANCY_LINE_NONE ); - - $newlineKeywords = '/' - .'(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND)' - .'<\\/span>/i' - ; - - $db =& JFactory::getDBO(); - - echo '

                '.JText::sprintf( 'Queries logged', $db->getTicker() ).'

                '; - - if ($log = $db->getLog()) - { - echo '
                  '; - foreach ($log as $k=>$sql) - { - $geshi->set_source($sql); - $text = $geshi->parse_code(); - $text = preg_replace($newlineKeywords, '
                    \\0', $text); - echo '
                1. '.$text.'
                2. '; - } - echo '
                '; - } - - if(isset($database)) - { - echo '

                '.JText::sprintf( 'Legacy Queries logged', $database->getTicker() ).'

                '; - echo '
                  '; - - foreach ($database->getLog() as $k=>$sql) - { - $geshi->set_source($sql); - $text = $geshi->parse_code(); - $text = preg_replace($newlineKeywords, '
                    \\0', $text); - echo '
                1. '.$text.'
                2. '; - } - - echo '
                '; - } - } - - if ($this->params->get('language', 1)) - { - echo '

                '.JText::_( 'Language Files Loaded' ).'

                '; - echo '
                  '; - $lang = &JFactory::getLanguage(); - $extensions = $lang->getPaths(); - foreach ( $extensions as $extension => $files) - { - foreach ( $files as $file => $status ) - { - echo "
                • $file $status
                • "; - } - } - echo '
                '; - - echo '

                '.JText::_( 'Untranslated strings' ).'

                '; - echo '
                ';
                -			$orphans = $lang->getOrphans();
                -			if (count( $orphans ))
                -			{
                -				ksort( $orphans, SORT_STRING );
                -				foreach ($orphans as $key => $occurance) {
                -					foreach ( $occurance as $i => $info) {
                -						$class	= $info['class'];
                -						$func	= $info['function'];
                -						$file	= $info['file'];
                -						$line	= $info['line'];
                -						echo strtoupper( $key )."\t$class::$func()\t[$file:$line]\n";
                -					}
                -				}
                -			}
                -			else {
                -				echo JText::_( 'None' );
                -			}
                -			echo '
                '; - } - echo '
                '; - - $debug = ob_get_clean(); - - $body = JResponse::getBody(); - $body = str_replace('', $debug.'', $body); - JResponse::setBody($body); - } -} \ No newline at end of file +loadLanguage( ); + parent::__construct($subject, $config); + } + + /** + * Converting the site URL to fit to the HTTP request + * + */ + function onAfterRender() + { + global $_PROFILER; + $mainframe = JFactory::getApplication(); + $database = JFactory::getDBO(); + + // Do not render if debugging is not enabled + if(!JDEBUG) { return; } + + $document =& JFactory::getDocument(); + $doctype = $document->getType(); + + // Only render for HTML output + if ( $doctype !== 'html' ) { return; } + + $profiler =& $_PROFILER; + + ob_start(); + echo '
                '; + $errors = JError::getErrors(); + if(!empty($errors)) { + echo '

                '.JText::_('Errors').'

                  '; + while($error = JError::getError(true)) { + echo '
                1. '.$error->getMessage().'

                  '.JText::_('Info').'

                  '.print_r($error->get('info'), true).'

                  '.JText::_('Backtrace').'

                  '.JError::renderBacktrace($error).'
                2. '; + } + echo '
                '; + } + if ($this->params->get('profile', 1)) { + echo '

                '.JText::_( 'Profile Information' ).'

                '; + foreach ( $profiler->getBuffer() as $mark ) { + echo '
                '.$mark.'
                '; + } + } + + if ($this->params->get('memory', 1)) { + echo '

                '.JText::_( 'Memory Usage' ).'

                '; + echo $profiler->getMemory(); + } + + if ($this->params->get('queries', 1)) + { + jimport('geshi.geshi'); + + $geshi = new GeSHi( '', 'sql' ); + $geshi->set_header_type(GESHI_HEADER_DIV); + //$geshi->enable_line_numbers( GESHI_FANCY_LINE_NONE ); + + $newlineKeywords = '/' + .'(FROM|LEFT|INNER|OUTER|WHERE|SET|VALUES|ORDER|GROUP|HAVING|LIMIT|ON|AND)' + .'<\\/span>/i' + ; + + $db =& JFactory::getDBO(); + + echo '

                '.JText::sprintf( 'Queries logged', $db->getTicker() ).'

                '; + + if ($log = $db->getLog()) + { + echo '
                  '; + foreach ($log as $k=>$sql) + { + $geshi->set_source($sql); + $text = $geshi->parse_code(); + $text = preg_replace($newlineKeywords, '
                    \\0', $text); + echo '
                1. '.$text.'
                2. '; + } + echo '
                '; + } + + if(isset($database)) + { + echo '

                '.JText::sprintf( 'Legacy Queries logged', $database->getTicker() ).'

                '; + echo '
                  '; + + foreach ($database->getLog() as $k=>$sql) + { + $geshi->set_source($sql); + $text = $geshi->parse_code(); + $text = preg_replace($newlineKeywords, '
                    \\0', $text); + echo '
                1. '.$text.'
                2. '; + } + + echo '
                '; + } + } + + $lang = &JFactory::getLanguage(); + if ($this->params->get('language_files', 1)) + { + echo '

                '.JText::_( 'Language Files Loaded' ).'

                '; + echo '
                  '; + $extensions = $lang->getPaths(); + foreach ( $extensions as $extension => $files) + { + foreach ( $files as $file => $status ) + { + echo "
                • $file $status
                • "; + } + } + echo '
                '; + } + + $langStrings = $this->params->get('language_strings', -1); + if ($langStrings < 0 OR $langStrings == 1) { + echo '

                '.JText::_( 'Untranslated Strings Diagnostic' ).'

                '; + echo '
                ';
                +			$orphans = $lang->getOrphans();
                +			if (count( $orphans ))
                +			{
                +				ksort( $orphans, SORT_STRING );
                +				foreach ($orphans as $key => $occurance) {
                +					foreach ( $occurance as $i => $info) {
                +						$class	= @$info['class'];
                +						$func	= @$info['function'];
                +						$file	= @$info['file'];
                +						$line	= @$info['line'];
                +						echo strtoupper( $key )."\t$class::$func()\t[$file:$line]\n";
                +					}
                +				}
                +			}
                +			else {
                +				echo JText::_( 'None' );
                +			}
                +			echo '
                '; + } + if ($langStrings < 0 OR $langStrings == 2) { + echo '

                '.JText::_( 'Untranslated Strings Designer' ).'

                '; + echo '
                ';
                +			$orphans = $lang->getOrphans();
                +			if (count( $orphans ))
                +			{
                +				ksort( $orphans, SORT_STRING );
                +				$guesses = array();
                +				foreach ($orphans as $key => $occurance) {
                +					if (is_array( $occurance ) AND isset( $occurance[0] )) {
                +						$info = &$occurance[0];
                +						$file = @$info['file'];
                +						if (!isset( $guesses[$file] )) {
                +							$guesses[$file] = array();
                +						}
                +
                +						$guess = str_replace( '_', ' ', $info['string'] );
                +						if ($strip = $this->params->get('language_prefix')) {
                +							$guess = trim( preg_replace( chr(1).'^'.$strip.chr(1), '', $guess ) );
                +						}
                +						$guesses[$file][] = trim( strtoupper( $key ) ).'='.$guess;
                +					}
                +				}
                +				foreach ($guesses as $file => $keys) {
                +					echo "\n\n# ".($file ? $file : JText::_( 'Unknown file' ))."\n\n";
                +					echo implode( "\n", $keys );
                +				}
                +			}
                +			else {
                +				echo JText::_( 'None' );
                +			}
                +			echo '
                '; + } + echo '
                '; + + $debug = ob_get_clean(); + + $body = JResponse::getBody(); + $body = str_replace('', $debug.'', $body); + JResponse::setBody($body); + } + +} diff --git a/plugins/system/debug.xml b/plugins/system/debug.xml index d33a71b1a03dd..cabd383de24c3 100644 --- a/plugins/system/debug.xml +++ b/plugins/system/debug.xml @@ -13,6 +13,10 @@ debug.php + + + + @@ -21,9 +25,16 @@ - + + + + + + + + \ No newline at end of file diff --git a/plugins/system/index.html b/plugins/system/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/system/index.html +++ b/plugins/system/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/system/legacy.php b/plugins/system/legacy.php index 4ca88e18276f4..d8b765934d37b 100644 --- a/plugins/system/legacy.php +++ b/plugins/system/legacy.php @@ -19,7 +19,6 @@ /** * Joomla! Debug plugin * - * @author Johan Janssens * @package Joomla * @subpackage System */ @@ -28,356 +27,19 @@ class plgSystemLegacy extends JPlugin /** * Constructor * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration + * @param array $config An array that holds the plugin configuration * @since 1.0 */ - function plgSystemLegacy(& $subject, $config) + function __construct($subject, $config) { - parent::__construct($subject, $config); - - global $mainframe; - - // Define the 1.0 legacy mode constant - define('_JLEGACY', '1.0'); + // Define the 1.5 legacy mode constant + define('_JLEGACY', '1.5'); // Set global configuration var for legacy mode - $config = &JFactory::getConfig(); - $config->setValue('config.legacy', 1); - - // Import library dependencies - require_once(dirname(__FILE__).DS.'legacy'.DS.'classes.php'); - require_once(dirname(__FILE__).DS.'legacy'.DS.'functions.php'); - - // Register legacy classes for autoloading - JLoader::register('mosAdminMenus' , dirname(__FILE__).DS.'legacy'.DS.'adminmenus.php'); - JLoader::register('mosCache' , dirname(__FILE__).DS.'legacy'.DS.'cache.php'); - JLoader::register('mosCategory' , dirname(__FILE__).DS.'legacy'.DS.'category.php'); - JLoader::register('mosCommonHTML' , dirname(__FILE__).DS.'legacy'.DS.'commonhtml.php'); - JLoader::register('mosComponent' , dirname(__FILE__).DS.'legacy'.DS.'component.php'); - JLoader::register('mosContent' , dirname(__FILE__).DS.'legacy'.DS.'content.php'); - JLoader::register('mosDBTable' , dirname(__FILE__).DS.'legacy'.DS.'dbtable.php'); - JLoader::register('mosHTML' , dirname(__FILE__).DS.'legacy'.DS.'html.php'); - JLoader::register('mosInstaller' , dirname(__FILE__).DS.'legacy'.DS.'installer.php'); - JLoader::register('mosMainFrame' , dirname(__FILE__).DS.'legacy'.DS.'mainframe.php'); - JLoader::register('mosMambot' , dirname(__FILE__).DS.'legacy'.DS.'mambot.php'); - JLoader::register('mosMambotHandler', dirname(__FILE__).DS.'legacy'.DS.'mambothandler.php'); - JLoader::register('mosMenu' , dirname(__FILE__).DS.'legacy'.DS.'menu.php'); - JLoader::register('mosMenuBar' , dirname(__FILE__).DS.'legacy'.DS.'menubar.php'); - JLoader::register('mosModule' , dirname(__FILE__).DS.'legacy'.DS.'module.php'); - //JLoader::register('mosPageNav' , dirname(__FILE__).DS.'legacy'.DS.'pagination.php'); - JLoader::register('mosParameters' , dirname(__FILE__).DS.'legacy'.DS.'parameters.php'); - JLoader::register('patFactory' , dirname(__FILE__).DS.'legacy'.DS.'patfactory.php'); - JLoader::register('mosProfiler' , dirname(__FILE__).DS.'legacy'.DS.'profiler.php'); - JLoader::register('mosSection' , dirname(__FILE__).DS.'legacy'.DS.'section.php'); - JLoader::register('mosSession' , dirname(__FILE__).DS.'legacy'.DS.'session.php'); - JLoader::register('mosToolbar' , dirname(__FILE__).DS.'legacy'.DS.'toolbar.php'); - JLoader::register('mosUser' , dirname(__FILE__).DS.'legacy'.DS.'user.php'); - - // Register class for the database, depends on which db type has been selected for use - $dbtype = $config->getValue('config.dbtype', 'mysql'); - JLoader::register('database' , dirname(__FILE__).DS.'legacy'.DS.$dbtype.'.php'); - - /** - * Legacy define, _ISO define not used anymore. All output is forced as utf-8. - * @deprecated As of version 1.5 - */ - define('_ISO','charset=utf-8'); - - /** - * Legacy constant, use _JEXEC instead - * @deprecated As of version 1.5 - */ - define( '_VALID_MOS', 1 ); - - /** - * Legacy constant, use _JEXEC instead - * @deprecated As of version 1.5 - */ - define( '_MOS_MAMBO_INCLUDED', 1 ); - - /** - * Legacy constant, use DATE_FORMAT_LC instead - * @deprecated As of version 1.5 - */ - DEFINE('_DATE_FORMAT_LC', JText::_('DATE_FORMAT_LC1') ); //Uses PHP's strftime Command Format - - /** - * Legacy constant, use DATE_FORMAT_LC2 instead - * @deprecated As of version 1.5 - */ - DEFINE('_DATE_FORMAT_LC2', JText::_('DATE_FORMAT_LC2')); - - /** - * Legacy constant, use JFilterInput instead - * @deprecated As of version 1.5 - */ - DEFINE( "_MOS_NOTRIM", 0x0001 ); - - /** - * Legacy constant, use JFilterInput instead - * @deprecated As of version 1.5 - */ - DEFINE( "_MOS_ALLOWHTML", 0x0002 ); - - /** - * Legacy constant, use JFilterInput instead - * @deprecated As of version 1.5 - */ - DEFINE( "_MOS_ALLOWRAW", 0x0004 ); - - /** - * Legacy global, use JVersion->getLongVersion() instead - * @name $_VERSION - * @deprecated As of version 1.5 - */ - $GLOBALS['_VERSION'] = new JVersion(); - $version = $GLOBALS['_VERSION']->getLongVersion(); - - /** - * Legacy global, use JFactory::getDBO() instead - * @name $database - * @deprecated As of version 1.5 - */ - $conf =& JFactory::getConfig(); - $GLOBALS['database'] = new database($conf->getValue('config.host'), $conf->getValue('config.user'), $conf->getValue('config.password'), $conf->getValue('config.db'), $conf->getValue('config.dbprefix')); - $GLOBALS['database']->debug($conf->getValue('config.debug')); - - /** - * Legacy global, use JFactory::getUser() [JUser object] instead - * @name $my - * @deprecated As of version 1.5 - */ - $user =& JFactory::getUser(); - - $GLOBALS['my'] = (object)$user->getProperties(); - $GLOBALS['my']->gid = $user->get('aid', 0); - - /** - * Insert configuration values into global scope (for backwards compatibility) - * @deprecated As of version 1.5 - */ - - $temp = new JConfig; - foreach (get_object_vars($temp) as $k => $v) { - $name = 'mosConfig_'.$k; - $GLOBALS[$name] = $v; - } - - $GLOBALS['mosConfig_live_site'] = substr_replace(JURI::root(), '', -1, 1); - $GLOBALS['mosConfig_absolute_path'] = JPATH_SITE; - $GLOBALS['mosConfig_cachepath'] = JPATH_BASE.DS.'cache'; - - $GLOBALS['mosConfig_offset_user'] = 0; - - $lang =& JFactory::getLanguage(); - $GLOBALS['mosConfig_lang'] = $lang->getBackwardLang(); - - $config->setValue('config.live_site', $GLOBALS['mosConfig_live_site']); - $config->setValue('config.absolute_path', $GLOBALS['mosConfig_absolute_path']); - $config->setValue('config.lang', $GLOBALS['mosConfig_lang']); - - /** - * Legacy global, use JFactory::getUser() instead - * @name $acl - * @deprecated As of version 1.5 - */ - $acl =& JFactory::getACL(); - - // Legacy ACL's for backward compat - $acl->addACL( 'administration', 'edit', 'users', 'super administrator', 'components', 'all' ); - $acl->addACL( 'administration', 'edit', 'users', 'administrator', 'components', 'all' ); - $acl->addACL( 'administration', 'edit', 'users', 'super administrator', 'user properties', 'block_user' ); - $acl->addACL( 'administration', 'manage', 'users', 'super administrator', 'components', 'com_users' ); - $acl->addACL( 'administration', 'manage', 'users', 'administrator', 'components', 'com_users' ); - $acl->addACL( 'administration', 'config', 'users', 'super administrator' ); - //$acl->addACL( 'administration', 'config', 'users', 'administrator' ); - - $acl->addACL( 'action', 'add', 'users', 'author', 'content', 'all' ); - $acl->addACL( 'action', 'add', 'users', 'editor', 'content', 'all' ); - $acl->addACL( 'action', 'add', 'users', 'publisher', 'content', 'all' ); - $acl->addACL( 'action', 'edit', 'users', 'author', 'content', 'own' ); - $acl->addACL( 'action', 'edit', 'users', 'editor', 'content', 'all' ); - $acl->addACL( 'action', 'edit', 'users', 'publisher', 'content', 'all' ); - $acl->addACL( 'action', 'publish', 'users', 'publisher', 'content', 'all' ); - - $acl->addACL( 'action', 'add', 'users', 'manager', 'content', 'all' ); - $acl->addACL( 'action', 'edit', 'users', 'manager', 'content', 'all' ); - $acl->addACL( 'action', 'publish', 'users', 'manager', 'content', 'all' ); - - $acl->addACL( 'action', 'add', 'users', 'administrator', 'content', 'all' ); - $acl->addACL( 'action', 'edit', 'users', 'administrator', 'content', 'all' ); - $acl->addACL( 'action', 'publish', 'users', 'administrator', 'content', 'all' ); - - $acl->addACL( 'action', 'add', 'users', 'super administrator', 'content', 'all' ); - $acl->addACL( 'action', 'edit', 'users', 'super administrator', 'content', 'all' ); - $acl->addACL( 'action', 'publish', 'users', 'super administrator', 'content', 'all' ); - - $acl->addACL( 'com_syndicate', 'manage', 'users', 'super administrator' ); - $acl->addACL( 'com_syndicate', 'manage', 'users', 'administrator' ); - $acl->addACL( 'com_syndicate', 'manage', 'users', 'manager' ); - - $GLOBALS['acl'] =& $acl; - - /** - * Legacy global - * @name $task - * @deprecated As of version 1.5 - */ - $GLOBALS['task'] = JRequest::getString('task'); - - /** - * Load the site language file (the old way - to be deprecated) - * @deprecated As of version 1.5 - */ - global $mosConfig_lang; - $mosConfig_lang = JFilterInput::clean($mosConfig_lang, 'cmd'); - $file = JPATH_SITE.DS.'language'.DS.$mosConfig_lang.'.php'; - if (file_exists( $file )) { - require_once( $file); - } else { - $file = JPATH_SITE.DS.'language'.DS.'english.php'; - if (file_exists( $file )) { - require_once( $file ); - } - } - - /** - * Legacy global - * use JApplicaiton->registerEvent and JApplication->triggerEvent for event handling - * use JPlugingHelper::importPlugin to load bot code - * @deprecated As of version 1.5 - */ - $GLOBALS['_MAMBOTS'] = new mosMambotHandler(); - } - - function onAfterRoute() - { - global $mainframe; - if ($mainframe->isAdmin()) { - return; - } - - switch(JRequest::getCmd('option')) - { - case 'com_content' : - $this->routeContent(); - break; - case 'com_newsfeeds' : - $this->routeNewsfeeds(); - break; - case 'com_weblinks' : - $this->routeWeblinks(); - break; - case 'com_frontpage' : - JRequest::setVar('option', 'com_content'); - JRequest::setVar('view', 'frontpage'); - break; - case 'com_login' : - JRequest::setVar('option', 'com_user'); - JRequest::setVar('view', 'login'); - break; - case 'com_registration' : - JRequest::setVar('option', 'com_user'); - JRequest::setVar('view', 'register'); - break; - } - - /** - * Legacy global, use JApplication::getTemplate() instead - * @name $cur_template - * @deprecated As of version 1.5 - */ - $GLOBALS['cur_template'] = $mainframe->getTemplate(); - } - - function routeContent() - { - $viewName = JRequest::getCmd( 'view', 'article' ); - $layout = JRequest::getCmd( 'layout', 'default' ); - - // interceptors to support legacy urls - switch( JRequest::getCmd('task')) - { - //index.php?option=com_content&task=x&id=x&Itemid=x - case 'blogsection': - $viewName = 'section'; - $layout = 'blog'; - break; - case 'section': - $viewName = 'section'; - break; - case 'category': - $viewName = 'category'; - break; - case 'blogcategory': - $viewName = 'category'; - $layout = 'blog'; - break; - case 'archivesection': - case 'archivecategory': - $viewName = 'archive'; - break; - case 'frontpage' : - $viewName = 'frontpage'; - break; - case 'view': - $viewName = 'article'; - break; - } - - JRequest::setVar('layout', $layout); - JRequest::setVar('view', $viewName); - } - - function routeNewsfeeds() - { - $viewName = JRequest::getCmd( 'view', 'categories' ); - - // interceptors to support legacy urls - switch( JRequest::getCmd('task')) - { - //index.php?option=com_newsfeeds&task=x&catid=xid=x&Itemid=x - case 'view': - $viewName = 'newsfeed'; - break; - - default: - { - if(JRequest::getInt('catid') && !JRequest::getCmd('view')) { - $viewName = 'category'; - } - } - } - - JRequest::setVar('view', $viewName); - } - - function routeWeblinks() - { - $viewName = JRequest::getCmd( 'view', 'categories' ); - - // interceptors to support legacy urls - switch( JRequest::getCmd('task')) - { - //index.php?option=com_weblinks&task=x&catid=xid=x - case 'view': - $viewName = 'weblink'; - break; - - default: - { - if(($catid = JRequest::getInt('catid')) && !JRequest::getCmd('view')) { - $viewName = 'category'; - JRequest::setVar('id', $catid); - } - } - } - - JRequest::setVar('view', $viewName); + $conf = &JFactory::getConfig(); + $conf->setValue('config.legacy', 1); + + parent::__construct($subject, $config); } } \ No newline at end of file diff --git a/plugins/system/legacy.xml b/plugins/system/legacy.xml index 39741db1177b5..daecece17f9b8 100644 --- a/plugins/system/legacy.xml +++ b/plugins/system/legacy.xml @@ -1,25 +1,18 @@ - - System - Legacy + + System - Legacy 1.5 Joomla! Project - January 2007 + May 2008 Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL admin@joomla.org www.joomla.org - 1.5 - Provides legacy support for older version of Joomla! + 1.6 + Provides legacy support for 1.5 version of Joomla! legacy.php - legacy/classes.php - legacy/functions.php - legacy/toolbar.php - legacy/index.html + legacy - - - - diff --git a/plugins/system/legacy/adminmenus.php b/plugins/system/legacy/adminmenus.php deleted file mode 100644 index 8e14e961b407e..0000000000000 --- a/plugins/system/legacy/adminmenus.php +++ /dev/null @@ -1,416 +0,0 @@ -published ); - return $published; - } - - /** - * Legacy function, use {@link JAdminMenus::MenuLinks()} instead - * - * @deprecated As of version 1.5 - */ - function MenuLinks( &$lookup, $all=NULL, $none=NULL, $unassigned=1 ) - { - $options = JHTML::_('menu.linkoptions', $lookup, $all, $none|$unassigned); - if (empty( $lookup )) { - $lookup = array( JHTML::_('select.option', -1 ) ); - } - $pages = JHTML::_('select.genericlist', $options, 'selections[]', 'class="inputbox" size="15" multiple="multiple"', 'value', 'text', $lookup, 'selections' ); - return $pages; - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function Category( &$menu, $id, $javascript='' ) - { - $db =& JFactory::getDBO(); - - $query = 'SELECT c.id AS `value`, c.section AS `id`, CONCAT_WS( " / ", s.title, c.title) AS `text`' - . ' FROM #__sections AS s' - . ' INNER JOIN #__categories AS c ON c.section = s.id' - . ' WHERE s.scope = "content"' - . ' ORDER BY s.name, c.name' - ; - $db->setQuery( $query ); - $rows = $db->loadObjectList(); - $category = ''; - - $category .= JHTML::_('select.genericlist', $rows, 'componentid', 'class="inputbox" size="10"'. $javascript, 'value', 'text', $menu->componentid ); - $category .= ''; - - return $category; - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function Section( &$menu, $id, $all=0 ) - { - $db =& JFactory::getDBO(); - - $query = 'SELECT s.id AS `value`, s.id AS `id`, s.title AS `text`' - . ' FROM #__sections AS s' - . ' WHERE s.scope = "content"' - . ' ORDER BY s.name' - ; - $db->setQuery( $query ); - if ( $all ) { - $rows[] = JHTML::_('select.option', 0, '- '. JText::_( 'All Sections' ) .' -' ); - $rows = array_merge( $rows, $db->loadObjectList() ); - } else { - $rows = $db->loadObjectList(); - } - - $section = JHTML::_('select.genericlist', $rows, 'componentid', 'class="inputbox" size="10"', 'value', 'text', $menu->componentid ); - $section .= ''; - - return $section; - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function Component( &$menu, $id ) - { - $db =& JFactory::getDBO(); - - $query = 'SELECT c.id AS value, c.name AS text, c.link' - . ' FROM #__components AS c' - . ' WHERE c.link <> ""' - . ' ORDER BY c.name' - ; - $db->setQuery( $query ); - $rows = $db->loadObjectList( ); - - $component = JHTML::_('select.genericlist', $rows, 'componentid', 'class="inputbox" size="10"', 'value', 'text', $menu->componentid, '', 1 ); - - return $component; - } - - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function ComponentName( &$menu, $id ) - { - $db =& JFactory::getDBO(); - - $query = 'SELECT c.id AS value, c.name AS text, c.link' - . ' FROM #__components AS c' - . ' WHERE c.link <> ""' - . ' ORDER BY c.name' - ; - $db->setQuery( $query ); - $rows = $db->loadObjectList( ); - - $component = 'Component'; - foreach ( $rows as $row ) { - if ( $row->value == $menu->componentid ) { - $component = JText::_( $row->text ); - } - } - - return $component; - } - - - /** - * Legacy function, use {@link JHTML::_('list.images', )} instead - * - * @deprecated As of version 1.5 - */ - function Images( $name, &$active, $javascript=NULL, $directory=NULL ) - { - return JHTML::_('list.images', $name, $active, $javascript, $directory); - } - - /** - * Legacy function, use {@link JHTML::_('list.specificordering', )} instead - * - * @deprecated As of version 1.5 - */ - function SpecificOrdering( &$row, $id, $query, $neworder=0 ) - { - return JHTML::_('list.specificordering', $row, $id, $query, $neworder); - } - - /** - * Legacy function, use {@link JHTML::_('list.users', )} instead - * - * @deprecated As of version 1.5 - */ - function UserSelect( $name, $active, $nouser=0, $javascript=NULL, $order='name', $reg=1 ) - { - return JHTML::_('list.users', $name, $active, $nouser, $javascript, $order, $reg); - } - - /** - * Legacy function, use {@link JHTML::_('list.positions', )} instead - * - * @deprecated As of version 1.5 - */ - function Positions( $name, $active=NULL, $javascript=NULL, $none=1, $center=1, $left=1, $right=1, $id=false ) - { - return JHTML::_('list.positions', $name, $active, $javascript, $none, $center, $left, $right, $id); - } - - /** - * Legacy function, use {@link JHTML::_('list.category', )} instead - * - * @deprecated As of version 1.5 - */ - function ComponentCategory( $name, $section, $active=NULL, $javascript=NULL, $order='ordering', $size=1, $sel_cat=1 ) - { - return JHTML::_('list.category', $name, $section, $active, $javascript, $order, $size, $sel_cat); - } - - /** - * Legacy function, use {@link JHTML::_('list.section', )} instead - * - * @deprecated As of version 1.5 - */ - function SelectSection( $name, $active=NULL, $javascript=NULL, $order='ordering' ) - { - return JHTML::_('list.section', $name, $active, $javascript, $order); - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function Links2Menu( $type, $and ) - { - $db =& JFactory::getDBO(); - - $query = 'SELECT * ' - . ' FROM #__menu ' - . ' WHERE type = '.$db->Quote($type) - . ' AND published = 1' - . $and - ; - $db->setQuery( $query ); - $menus = $db->loadObjectList(); - - return $menus; - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function MenuSelect( $name='menuselect', $javascript=NULL ) - { - $db =& JFactory::getDBO(); - - $query = 'SELECT params' - . ' FROM #__modules' - . ' WHERE module = "mod_mainmenu"' - ; - $db->setQuery( $query ); - $menus = $db->loadObjectList(); - $total = count( $menus ); - $menuselect = array(); - for( $i = 0; $i < $total; $i++ ) - { - $registry = new JRegistry(); - $registry->loadINI($menus[$i]->params); - $params = $registry->toObject( ); - - $menuselect[$i]->value = $params->menutype; - $menuselect[$i]->text = $params->menutype; - } - // sort array of objects - JArrayHelper::sortObjects( $menuselect, 'text', 1 ); - - $menus = JHTML::_('select.genericlist', $menuselect, $name, 'class="inputbox" size="10" '. $javascript, 'value', 'text' ); - - return $menus; - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function ReadImages( $imagePath, $folderPath, &$folders, &$images ) - { - jimport( 'joomla.filesystem.folder' ); - $imgFiles = JFolder::files( $imagePath ); - - foreach ($imgFiles as $file) - { - $ff_ = $folderPath.DS.$file; - $ff = $folderPath.DS.$file; - $i_f = $imagePath .'/'. $file; - - if ( is_dir( $i_f ) && $file <> 'CVS' && $file <> '.svn') { - $folders[] = JHTML::_('select.option', $ff_ ); - mosAdminMenus::ReadImages( $i_f, $ff_, $folders, $images ); - } else if ( eregi( "bmp|gif|jpg|png", $file ) && is_file( $i_f ) ) { - // leading / we don't need - $imageFile = substr( $ff, 1 ); - $images[$folderPath][] = JHTML::_('select.option', $imageFile, $file ); - } - } - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function GetImageFolders( &$folders, $path ) - { - $javascript = "onchange=\"changeDynaList( 'imagefiles', folderimages, document.adminForm.folders.options[document.adminForm.folders.selectedIndex].value, 0, 0); previewImage( 'imagefiles', 'view_imagefiles', '$path/' );\""; - $getfolders = JHTML::_('select.genericlist', $folders, 'folders', 'class="inputbox" size="1" '. $javascript, 'value', 'text', '/' ); - return $getfolders; - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function GetImages( &$images, $path ) - { - if ( !isset($images['/'] ) ) { - $images['/'][] = JHTML::_('select.option', '' ); - } - - //$javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\" onfocus=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\""; - $javascript = "onchange=\"previewImage( 'imagefiles', 'view_imagefiles', '$path/' )\""; - $getimages = JHTML::_('select.genericlist', $images['/'], 'imagefiles', 'class="inputbox" size="10" multiple="multiple" '. $javascript , 'value', 'text', null ); - - return $getimages; - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function GetSavedImages( &$row, $path ) - { - $images2 = array(); - foreach( $row->images as $file ) { - $temp = explode( '|', $file ); - if( strrchr($temp[0], '/') ) { - $filename = substr( strrchr($temp[0], '/' ), 1 ); - } else { - $filename = $temp[0]; - } - $images2[] = JHTML::_('select.option', $file, $filename ); - } - //$javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \" onfocus=\"previewImage( 'imagelist', 'view_imagelist', '$path/' )\""; - $javascript = "onchange=\"previewImage( 'imagelist', 'view_imagelist', '$path/' ); showImageProps( '$path/' ); \""; - $imagelist = JHTML::_('select.genericlist', $images2, 'imagelist', 'class="inputbox" size="10" '. $javascript, 'value', 'text' ); - - return $imagelist; - } - - /** - * Legacy function, use {@link JHTML::_('image.site')} instead - * - * @deprecated As of version 1.5 - */ - function ImageCheck( $file, $directory='/images/M_images/', $param=NULL, $param_directory='/images/M_images/', $alt=NULL, $name='image', $type=1, $align='top' ) - { - $attribs = array('align' => $align); - return JHTML::_('image.site', $file, $directory, $param, $param_directory, $alt, $attribs, $type); - } - - /** - * Legacy function, use {@link JHTML::_('image.administrator')} instead - * - * @deprecated As of version 1.5 - */ - function ImageCheckAdmin( $file, $directory='/images/', $param=NULL, $param_directory='/images/', $alt=NULL, $name=NULL, $type=1, $align='middle' ) - { - $attribs = array('align' => $align); - return JHTML::_('image.administrator', $file, $directory, $param, $param_directory, $alt, $attribs, $type); - } - - /** - * Legacy function, use {@link MenusHelper::getMenuTypes()} instead - * - * @deprecated As of version 1.5 - */ - function menutypes() - { - JError::raiseNotice( 0, 'mosAdminMenus::menutypes method deprecated' ); - } - - /** - * Legacy function, use {@link MenusHelper::menuItem()} instead - * - * @deprecated As of version 1.5 - */ - function menuItem( $item ) - { - JError::raiseNotice( 0, 'mosAdminMenus::menuItem method deprecated' ); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/cache.php b/plugins/system/legacy/cache.php deleted file mode 100644 index 8620c1a9c3e85..0000000000000 --- a/plugins/system/legacy/cache.php +++ /dev/null @@ -1,42 +0,0 @@ -clean($group); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/category.php b/plugins/system/legacy/category.php deleted file mode 100644 index d0997b04f580f..0000000000000 --- a/plugins/system/legacy/category.php +++ /dev/null @@ -1,60 +0,0 @@ -reorder( $where ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.0.3 - */ - function publish_array( $cid=null, $publish=1, $user_id=0 ) - { - $this->publish( $cid, $publish, $user_id ); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/classes.php b/plugins/system/legacy/classes.php deleted file mode 100644 index dc5596594307d..0000000000000 --- a/plugins/system/legacy/classes.php +++ /dev/null @@ -1,106 +0,0 @@ - $useCookies) ); - } - - function startTab( $tabText, $paneid ) { - echo $this->startPanel( $tabText, $paneid); - } - - function endTab() { - echo $this->endPanel(); - } - - function startPane( $tabText ){ - echo parent::startPane( $tabText ); - } - - function endPane(){ - echo parent::endPane(); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/commonhtml.php b/plugins/system/legacy/commonhtml.php deleted file mode 100644 index bba8b9c63662e..0000000000000 --- a/plugins/system/legacy/commonhtml.php +++ /dev/null @@ -1,270 +0,0 @@ - - - -
                - - - - - - - - - menutype; ?> - - - - - - - - - - name; ?> - - - - - - - - - published ) { - case -2: - echo ''. JText::_( 'Trashed' ) .''; - break; - case 0: - echo JText::_( 'UnPublished' ); - break; - case 1: - default: - echo ''. JText::_( 'Published' ) .''; - break; - } - ?> - - - - - - - - - - -
                - . - - - - - - - - - - - - - - - - - - -
                - - - - menutype; ?> -
                - - - type; ?> -
                - - - - - name; ?> - -
                - - - published ) { - case -2: - echo ''. JText::_( 'Trashed' ) .''; - break; - case 0: - echo JText::_( 'UnPublished' ); - break; - case 1: - default: - echo ''. JText::_( 'Published' ) .''; - break; - } - ?> -
                -
                - - - - reorder( $where ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.0.3 - */ - function publish_array( $cid=null, $publish=1, $user_id=0 ) - { - $this->publish( $cid, $publish, $user_id ); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/content.php b/plugins/system/legacy/content.php deleted file mode 100644 index e5a4fedbc5137..0000000000000 --- a/plugins/system/legacy/content.php +++ /dev/null @@ -1,60 +0,0 @@ -reorder( $where ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.0.3 - */ - function publish_array( $cid=null, $publish=1, $user_id=0 ) - { - $this->publish( $cid, $publish, $user_id ); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/dbtable.php b/plugins/system/legacy/dbtable.php deleted file mode 100644 index 60b06aced7a60..0000000000000 --- a/plugins/system/legacy/dbtable.php +++ /dev/null @@ -1,131 +0,0 @@ -reorder( $where ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.0.3 - */ - function publish_array( $cid=null, $publish=1, $user_id=0 ) - { - $this->publish( $cid, $publish, $user_id ); - } - - /** - * Legacy Method, make sure you use {@link JRequest::get()} or {@link JRequest::getVar()} instead - * @deprecated As of 1.5 - */ - function filter( $ignoreList=null ) - { - $ignore = is_array( $ignoreList ); - - $filter = & JFilterInput::getInstance(); - foreach ($this->getProperties() as $k => $v) - { - if ($ignore && in_array( $k, $ignoreList ) ) { - continue; - } - $this->$k = $filter->clean( $this->$k ); - } - } - - /** - * Legacy Method, use {@link JObject::getProperties()} instead - * @deprecated As of 1.5 - */ - function getPublicProperties() - { - $properties = $this->getProperties(); - return array_keys($properties); - } - - /** - * Legacy Method, use {@link JObject::getError()} instead - * @deprecated As of 1.5 - */ - function getError($i = null, $toString = true ) - { - return $this->_error; - } - - /** - * Legacy Method, use {@link JObject::setError()} instead - * @deprecated As of 1.5 - */ - function setErrorNum( $value ) - { - $this->_errorNum = $value; - } - - /** - * Legacy Method, use {@link JObject::getError()} instead - * @deprecated As of 1.5 - */ - function getErrorNum() - { - return $this->_errorNum; - } -} \ No newline at end of file diff --git a/plugins/system/legacy/functions.php b/plugins/system/legacy/functions.php deleted file mode 100644 index 3ee5d3219d4ba..0000000000000 --- a/plugins/system/legacy/functions.php +++ /dev/null @@ -1,910 +0,0 @@ - instead - * - * @deprecated As of version 1.5 - */ -function mosCountModules( $position='left' ) { - jimport('joomla.application.module.helper'); - return count(JModuleHelper::getModules($position)); -} - -/** - * Legacy function, use instead - * - * @deprecated As of version 1.5 - */ -function mosMainBody() { - ?> instead - * - * @deprecated As of version 1.5 - */ -function mosLoadModules( $position='left', $style=0 ) -{ - // Select the module chrome function - if (is_numeric($style)) - { - switch ( $style ) - { - case -3: - $style = 'rounded'; - break; - - case -2: - $style = 'xhtml'; - break; - - case -1: - $style = 'raw'; - break; - - case 0 : - default : - $style = 'table'; - break; - } - } - ?> instead - * - * @deprecated As of version 1.5 - */ -function mosLoadModule( $name, $style=-1 ) { - ?> instead - * - * @deprecated As of version 1.5 - */ -function mosShowHead() { - ?> instead - * - * @deprecated As of version 1.5 - */ -function mosCountAdminModules( $position='left' ) { - $document =& JFactory::getDocument(); - return count($document->getModules($position)); -} - -/** - * Legacy function, using instead - * - * @deprecated As of version 1.5 - */ -function mosMainBody_Admin() { - ?> instead - * - * @deprecated As of version 1.5 - */ - -function mosLoadAdminModules( $position='left', $style=0 ) { - - // Select the module chrome function - if (is_numeric($style)) - { - switch ( $style ) - { - case 2: - $style = 'xhtml'; - break; - - case 0 : - default : - $style = 'raw'; - break; - } - } - ?> instead - * - * @deprecated As of version 1.5 - */ -function mosLoadAdminModule( $name, $style=0 ) { - ?> instead - * - * @deprecated As of version 1.5 - */ -function mosShowHead_Admin() { - ?> $val) { - $ret[$key] = mosStripslashes( $val ); - } - } else { - $ret = $value; - } - } - return $ret; -} - -/** - * Legacy function, use {@link JArrayHelper JArrayHelper->toObject()} instead - * - * @deprecated As of version 1.5 - */ -function mosBindArrayToObject( $array, &$obj, $ignore='', $prefix=NULL, $checkSlashes=true ) -{ - if (!is_array( $array ) || !is_object( $obj )) { - return (false); - } - - foreach (get_object_vars($obj) as $k => $v) - { - if( substr( $k, 0, 1 ) != '_' ) - { - // internal attributes of an object are ignored - if (strpos( $ignore, $k) === false) - { - if ($prefix) { - $ak = $prefix . $k; - } else { - $ak = $k; - } - if (isset($array[$ak])) { - $obj->$k = ($checkSlashes && get_magic_quotes_gpc()) ? mosStripslashes( $array[$ak] ) : $array[$ak]; - } - } - } - } - - return true; -} - -/** - * Legacy function, use {@link JUtility::getHash()} instead - * - * @deprecated As of version 1.5 - */ -function mosHash( $seed ) { - return JUtility::getHash( $seed ); -} - -/** -* Legacy function - * - * @deprecated As of version 1.5 -*/ -function mosNotAuth() -{ - $user =& JFactory::getUser(); - echo JText::_('ALERTNOTAUTH'); - if ($user->get('id') < 1) { - echo "
                " . JText::_( 'You need to login.' ); - } -} - -/** - * Legacy function, use (@link JError} or {@link JApplication::redirect()} instead. - * - * @deprecated As of version 1.5 - */ -function mosErrorAlert( $text, $action='window.history.go(-1);', $mode=1 ) -{ - global $mainframe; - - $text = nl2br( $text ); - $text = addslashes( $text ); - $text = strip_tags( $text ); - - switch ( $mode ) { - case 2: - echo " \n"; - break; - - case 1: - default: - echo " \n"; - echo ''; - break; - } - - $mainframe->close(); -} - -/** - * Legacy function, use {@link JPath::clean()} instead - * - * @deprecated As of version 1.5 - */ -function mosPathName($p_path, $p_addtrailingslash = true) -{ - jimport('joomla.filesystem.path'); - $path = JPath::clean($p_path); - if ($p_addtrailingslash) { - $path = rtrim($path, DS) . DS; - } - return $path; -} - -/** - * Legacy function, use {@link JFolder::files()} or {@link JFolder::folders()} instead - * - * @deprecated As of version 1.5 - */ -function mosReadDirectory( $path, $filter='.', $recurse=false, $fullpath=false ) -{ - $arr = array(null); - - // Get the files and folders - jimport('joomla.filesystem.folder'); - $files = JFolder::files($path, $filter, $recurse, $fullpath); - $folders = JFolder::folders($path, $filter, $recurse, $fullpath); - // Merge files and folders into one array - $arr = array_merge($files, $folders); - // Sort them all - asort($arr); - return $arr; -} - -/** - * Legacy function, use {@link JFactory::getMailer()} instead - * - * @deprecated As of version 1.5 - */ -function mosCreateMail( $from='', $fromname='', $subject, $body ) { - - $mail =& JFactory::getMailer(); - - $mail->From = $from ? $from : $mail->From; - $mail->FromName = $fromname ? $fromname : $mail->FromName; - $mail->Subject = $subject; - $mail->Body = $body; - - return $mail; -} - -/** - * Legacy function, use {@link JUtility::sendMail()} instead - * - * @deprecated As of version 1.5 - */ -function mosMail($from, $fromname, $recipient, $subject, $body, $mode=0, $cc=NULL, $bcc=NULL, $attachment=NULL, $replyto=NULL, $replytoname=NULL ) { - return JUTility::sendMail($from, $fromname, $recipient, $subject, $body, $mode, $cc, $bcc, $attachment, $replyto, $replytoname ); -} - -/** - * Legacy function, use {@link JUtility::sendAdminMail()} instead - * - * @deprecated As of version 1.5 - */ -function mosSendAdminMail( $adminName, $adminEmail, $email, $type, $title, $author ) { - JUtility::sendAdminMail( $adminName, $adminEmail, $email, $type, $title, $author ); -} - -/** - * Legacy function, use {@link JUserHelper::genRandomPassword()} instead - * - * @deprecated As of version 1.5 - */ -function mosMakePassword() { - jimport('joomla.user.helper'); - return JUserHelper::genRandomPassword(); -} - -/** - * Legacy function, use {@link JApplication::redirect() JApplication->redirect()} instead - * - * @deprecated As of version 1.5 - */ -function mosRedirect( $url, $msg='' ) { - global $mainframe; - $mainframe->redirect( $url, $msg ); -} - -/** - * Legacy function, use {@link JFolder::create()} - * - * @deprecated As of version 1.5 - */ -function mosMakePath($base, $path='', $mode = NULL) { - - if ($mode===null) { - $mode = 0755; - } - - jimport('joomla.filesystem.folder'); - return JFolder::create($base.$path, $mode); -} - -/** - * Legacy function, use {@link JArrayHelper::toInteger()} instead - * - * @deprecated As of version 1.5 - */ -function mosArrayToInts( &$array, $default=null ) { - return JArrayHelper::toInteger( $array, $default ); -} - -/** - * Legacy function, use {@link JException::getTrace() JException->getTrace()} instead - * - * @deprecated As of version 1.5 - */ -function mosBackTrace( $message='' ) { - if (function_exists( 'debug_backtrace' )) { - echo '
                '; - if ($message) { - echo '

                ' . $message . '

                '; - } - foreach( debug_backtrace() as $back) { - if (@$back['file']) { - echo '
                ' . str_replace( JPATH_ROOT, '', $back['file'] ) . ':' . $back['line']; - } - } - echo '
                '; - } -} - -/** - * Legacy function, use {@link JPath::setPermissions()} instead - * - * @deprecated As of version 1.5 - */ -function mosChmod( $path ) { - jimport('joomla.filesystem.path'); - return JPath::setPermissions( $path ); -} - -/** - * Legacy function, use {@link JPath::setPermissions()} instead - * - * @deprecated As of version 1.5 - */ -function mosChmodRecursive( $path, $filemode=NULL, $dirmode=NULL ) { - jimport('joomla.filesystem.path'); - return JPath::setPermissions( $path, $filemode, $dirmode ); -} - -/** - * Legacy function, use {@link JPath::canChmod()} instead - * - * @deprecated As of version 1.5 - */ -function mosIsChmodable( $file ) { - jimport('joomla.filesystem.path'); - return JPath::canChmod( $file ); -} - -/** - * Legacy function, replaced by geshi bot - * - * @deprecated As of version 1.5 - */ -function mosShowSource( $filename, $withLineNums=false ) { - - ini_set('highlight.html', '000000'); - ini_set('highlight.default', '#800000'); - ini_set('highlight.keyword','#0000ff'); - ini_set('highlight.string', '#ff00ff'); - ini_set('highlight.comment','#008000'); - - if (!($source = @highlight_file( $filename, true ))) { - return JText::_( 'Operation Failed' ); - } - $source = explode("
                ", $source); - - $ln = 1; - - $txt = ''; - foreach( $source as $line ) { - $txt .= ""; - if ($withLineNums) { - $txt .= ""; - $txt .= str_replace( ' ', ' ', sprintf( "%4d:", $ln ) ); - $txt .= ""; - } - $txt .= "$line
                "; - $ln++; - } - return $txt; -} - -/** - * Legacy function, use mosLoadModule( 'breadcrumb', -1 ); instead - * - * @deprecated As of version 1.5 - */ -function mosPathWay() { - mosLoadModule('breadcrumb', -1); -} - -/** - * Legacy function, use {@link JBrowser::getInstance()} instead - * - * @deprecated As of version 1.5 - */ -function mosGetBrowser( $agent ) { - jimport('joomla.environment.browser'); - $instance =& JBrowser::getInstance(); - return $instance; -} - -/** - * Legacy function, use {@link JApplication::getBrowser()} instead - * - * @deprecated As of version 1.5 - */ -function mosGetOS( $agent ) { - jimport('joomla.environment.browser'); - $instance =& JBrowser::getInstance(); - return $instance->getPlatform(); -} - -/** - * Legacy function, use {@link JArrayHelper::getValue()} instead - * - * @deprecated As of version 1.5 - */ -function mosGetParam( &$arr, $name, $def=null, $mask=0 ) -{ - // Static input filters for specific settings - static $noHtmlFilter = null; - static $safeHtmlFilter = null; - - $var = JArrayHelper::getValue( $arr, $name, $def, '' ); - - // If the no trim flag is not set, trim the variable - if (!($mask & 1) && is_string($var)) { - $var = trim($var); - } - - // Now we handle input filtering - if ($mask & 2) { - // If the allow html flag is set, apply a safe html filter to the variable - if (is_null($safeHtmlFilter)) { - $safeHtmlFilter = & JFilterInput::getInstance(null, null, 1, 1); - } - $var = $safeHtmlFilter->clean($var, 'none'); - } elseif ($mask & 4) { - // If the allow raw flag is set, do not modify the variable - $var = $var; - } else { - // Since no allow flags were set, we will apply the most strict filter to the variable - if (is_null($noHtmlFilter)) { - $noHtmlFilter = & JFilterInput::getInstance(/* $tags, $attr, $tag_method, $attr_method, $xss_auto */); - } - $var = $noHtmlFilter->clean($var, 'none'); - } - return $var; -} - -/** - * Legacy function, use {@link JHTML::_('list.genericordering', )} instead - * - * @deprecated As of version 1.5 - */ -function mosGetOrderingList( $sql, $chop='30' ) -{ - return JHTML::_('list.genericordering', $sql, $chop); -} - -/** - * Legacy function, use {@link JRegistry} instead - * - * @deprecated As of version 1.5 - */ -function mosParseParams( $txt ) { - - $registry = new JRegistry(); - $registry->loadINI($txt); - return $registry->toObject( ); -} - -/** - * Legacy function, removed - * - * @deprecated As of version 1.5 - */ -function mosLoadComponent( $name ) -{ - // set up some global variables for use by the frontend component - global $mainframe, $database; - $name = JFilterInput::clean($name, 'cmd'); - $path = JPATH_SITE.DS.'components'.DS.'com_'.$name.DS.$name.'.php'; - if (file_exists($path)) { - include $path; - } -} - -/** - * Legacy function, use {@link JEditor::init()} instead - * - * @deprecated As of version 1.5 - */ -function initEditor() -{ - $editor =& JFactory::getEditor(); - echo $editor->initialise(); -} - -/** - * Legacy function, use {@link JEditor::save()} or {@link JEditor::getContent()} instead - * - * @deprecated As of version 1.5 - */ -function getEditorContents($editorArea, $hiddenField) -{ - jimport( 'joomla.html.editor' ); - $editor =& JFactory::getEditor(); - echo $editor->save( $hiddenField ); -} - -/** - * Legacy function, use {@link JEditor::display()} instead - * - * @deprecated As of version 1.5 - */ -function editorArea($name, $content, $hiddenField, $width, $height, $col, $row) -{ - jimport( 'joomla.html.editor' ); - $editor =& JFactory::getEditor(); - echo $editor->display($hiddenField, $content, $width, $height, $col, $row); -} - -/** - * Legacy function, use {@link JMenu::authorize()} instead - * - * @deprecated As of version 1.5 - */ -function mosMenuCheck( $Itemid, $menu_option, $task, $gid ) -{ - $user =& JFactory::getUser(); - $menus =& JSite::getMenu(); - $menus->authorize($Itemid, $user->get('aid')); -} - -/** - * Legacy function, use {@link JArrayHelper::fromObject()} instead - * - * @deprecated As of version 1.5 - */ -function mosObjectToArray( $p_obj, $recurse = true, $regex = null ) -{ - $result = JArrayHelper::fromObject( $p_obj, $recurse, $regex ); - return $result; -} - -/** - * Legacy function, use {@link JHTML::_('date', )} instead - * - * @deprecated As of version 1.5 - */ -function mosFormatDate( $date = 'now', $format = null, $offset = null ) { - - if ( ! $format ) - { - $format = JText::_('DATE_FORMAT_LC1'); - } - - return JHTML::_('date', $date, $format, $offset); -} - -/** - * Legacy function, use {@link JHTML::_('date', )} instead - * - * @deprecated As of version 1.5 - */ -function mosCurrentDate( $format="" ) -{ - if ($format=="") { - $format = JText::_( 'DATE_FORMAT_LC1' ); - } - - return JHTML::_('date', 'now', $format); -} - -/** - * Legacy function, use {@link JFilterOutput::objectHTMLSafe()} instead - * - * @deprecated As of version 1.5 - */ -function mosMakeHtmlSafe( &$mixed, $quote_style=ENT_QUOTES, $exclude_keys='' ) { - JFilterOutput::objectHTMLSafe( $mixed, $quote_style, $exclude_keys ); -} - -/** - * Legacy function, handled by {@link JDocument} Zlib outputfilter - * - * @deprecated As of version 1.5 - */ -function initGzip() -{ - global $mainframe, $do_gzip_compress; - - - // attempt to disable session.use_trans_sid - ini_set('session.use_trans_sid', false); - - $do_gzip_compress = FALSE; - if ($mainframe->getCfg('gzip') == 1) { - $phpver = phpversion(); - $useragent = mosGetParam( $_SERVER, 'HTTP_USER_AGENT', '' ); - $canZip = mosGetParam( $_SERVER, 'HTTP_ACCEPT_ENCODING', '' ); - - if ( $phpver >= '4.0.4pl1' && - ( strpos($useragent,'compatible') !== false || - strpos($useragent,'Gecko') !== false - ) - ) { - // Check for gzip header or northon internet securities - if ( isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) { - $encodings = explode(',', strtolower($_SERVER['HTTP_ACCEPT_ENCODING'])); - } - if ( (in_array('gzip', $encodings) || isset( $_SERVER['---------------']) ) && extension_loaded('zlib') && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression') && !ini_get('session.use_trans_sid') ) { - // You cannot specify additional output handlers if - // zlib.output_compression is activated here - ob_start( 'ob_gzhandler' ); - return; - } - } else if ( $phpver > '4.0' ) { - if ( strpos($canZip,'gzip') !== false ) { - if (extension_loaded( 'zlib' )) { - $do_gzip_compress = TRUE; - ob_start(); - ob_implicit_flush(0); - - header( 'Content-Encoding: gzip' ); - return; - } - } - } - } - ob_start(); -} - -/** - * Legacy function, use JFolder::delete($path) - * - * @deprecated As of version 1.5 - */ -function deldir( $dir ) -{ - $current_dir = opendir( $dir ); - $old_umask = umask(0); - while ($entryname = readdir( $current_dir )) { - if ($entryname != '.' and $entryname != '..') { - if (is_dir( $dir . $entryname )) { - deldir( mosPathName( $dir . $entryname ) ); - } else { - @chmod($dir . $entryname, 0777); - unlink( $dir . $entryname ); - } - } - } - umask($old_umask); - closedir( $current_dir ); - return rmdir( $dir ); -} - -/** - * Legacy function, handled by {@link JDocument} Zlib outputfilter - * - * @deprecated As of version 1.5 - */ -function doGzip() -{ - global $do_gzip_compress; - if ( $do_gzip_compress ) - { - $gzip_contents = ob_get_contents(); - ob_end_clean(); - - $gzip_size = strlen($gzip_contents); - $gzip_crc = crc32($gzip_contents); - - $gzip_contents = gzcompress($gzip_contents, 9); - $gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4); - - echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; - echo $gzip_contents; - echo pack('V', $gzip_crc); - echo pack('V', $gzip_size); - } else { - ob_end_flush(); - } -} - -/** - * Legacy function, use {@link JArrayHelper::sortObjects()} instead - * - * @deprecated As of version 1.5 - */ -function SortArrayObjects( &$a, $k, $sort_direction=1 ) -{ - JArrayHelper::sortObjects($a, $k, $sort_direction); -} - -/** - * Legacy function, {@link JRequest::getVar()} - * - * @deprecated As of version 1.5 - */ -function josGetArrayInts( $name, $type=NULL ) { - - $array = JRequest::getVar($name, array(), 'default', 'array' ); - - return $array; -} - -/** - * Legacy function, {@link JSession} transparently checks for spoofing attacks - * - * @deprecated As of version 1.5 - */ -function josSpoofCheck( $header=false, $alternate=false ) -{ - // Lets make sure they saw the html form - $check = true; - $hash = josSpoofValue(); - $valid = JRequest::getBool( $hash, 0, 'post' ); - if (!$valid) { - $check = false; - } - - // Make sure request came from a client with a user agent string. - if (!isset( $_SERVER['HTTP_USER_AGENT'] )) { - $check = false; - } - - // Check to make sure that the request was posted as well. - $requestMethod = JArrayHelper::getValue( $_SERVER, 'REQUEST_METHOD' ); - if ($requestMethod != 'POST') { - $check = false; - } - - if (!$check) - { - header( 'HTTP/1.0 403 Forbidden' ); - jexit( JText::_('E_SESSION_TIMEOUT') ); - } -} - -/** - * Legacy function, use {@link JUtility::getToken()} instead - * - * @deprecated As of version 1.5 - */ -function josSpoofValue($alt = NULL) -{ - global $mainframe; - - if ($alt) { - if ( $alt == 1 ) { - $random = date( 'Ymd' ); - } else { - $random = $alt . date( 'Ymd' ); - } - } else { - $random = date( 'dmY' ); - } - // the prefix ensures that the hash is non-numeric - // otherwise it will be intercepted by globals.php - $validate = 'j' . mosHash( $mainframe->getCfg( 'db' ) . $random ); - - return $validate; -} - -/** - * Legacy function to load the tooltip library. - * - * @deprecated As of version 1.5 - */ -function loadOverlib() { - JHTML::_('behavior.tooltip'); -} - -/** -* Legacy utility function to provide ToolTips -* -* @deprecated As of version 1.5 -*/ -function mosToolTip( $tooltip, $title='', $width='', $image='tooltip.png', $text='', $href='', $link=1 ) -{ - // Initialize the toolips if required - static $init; - if ( ! $init ) - { - JHTML::_('behavior.tooltip'); - $init = true; - } - - return JHTML::_('tooltip', $tooltip, $title, $image, $text, $href, $link); -} - -/** - * Legacy function to convert an internal Joomla URL to a humanly readible URL. - * - * @deprecated As of version 1.5 - */ -function sefRelToAbs($value) -{ - // Replace all & with & as the router doesn't understand & - $url = str_replace('&', '&', $value); - if(substr(strtolower($url),0,9) != "index.php") return $url; - $uri = JURI::getInstance(); - $prefix = $uri->toString(array('scheme', 'host', 'port')); - return $prefix.JRoute::_($url); -} - - -/** - * Legacy function to replaces & with & for xhtml compliance - * - * @deprecated As of version 1.5 - */ -function ampReplace( $text ) { - return JFilterOutput::ampReplace($text); -} - -/** - * Legacy function to replaces & with & for xhtml compliance - * - * @deprecated As of version 1.5 - */ -function mosTreeRecurse( $id, $indent, $list, &$children, $maxlevel=9999, $level=0, $type=1 ) -{ - jimport('joomla.html.html'); - return JHTML::_('menu.treerecurse', $id, $indent, $list, $children, $maxlevel, $level, $type); -} - -/** - * Legacy function, use {@link JHTML::tooltip()} instead - * - * @deprecated As of version 1.5 - */ -function mosWarning($warning, $title='Joomla! Warning') { - return JHTML::tooltip($warning, $title, 'warning.png', null, null, null); -} diff --git a/plugins/system/legacy/html.php b/plugins/system/legacy/html.php deleted file mode 100644 index 1bda0a35f887d..0000000000000 --- a/plugins/system/legacy/html.php +++ /dev/null @@ -1,346 +0,0 @@ -'. JText::_( 'Writable' ) .''; - $unwriteable = ''. JText::_( 'Unwritable' ) .''; - - echo ''; - echo ''; - echo $text; - if ( $visible ) { - echo $folder . '/'; - } - echo ''; - echo ''; - if ( $relative ) { - echo is_writable( "../$folder" ) ? $writeable : $unwriteable; - } else { - echo is_writable( "$folder" ) ? $writeable : $unwriteable; - } - echo ''; - echo ''; - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function monthSelectList( $tag_name, $tag_attribs, $selected ) - { - $arr = array( - mosHTML::makeOption( '01', JText::_( 'JANUARY_SHORT' ) ), - mosHTML::makeOption( '02', JText::_( 'FEBRUARY_SHORT' ) ), - mosHTML::makeOption( '03', JText::_( 'MARCH_SHORT' ) ), - mosHTML::makeOption( '04', JText::_( 'APRIL_SHORT' ) ), - mosHTML::makeOption( '05', JText::_( 'MAY_SHORT' ) ), - mosHTML::makeOption( '06', JText::_( 'JUNE_SHORT' ) ), - mosHTML::makeOption( '07', JText::_( 'JULY_SHORT' ) ), - mosHTML::makeOption( '08', JText::_( 'AUGUST_SHORT' ) ), - mosHTML::makeOption( '09', JText::_( 'SEPTEMBER_SHORT' ) ), - mosHTML::makeOption( '10', JText::_( 'OCTOBER_SHORT' ) ), - mosHTML::makeOption( '11', JText::_( 'NOVEMBER_SHORT' ) ), - mosHTML::makeOption( '12', JText::_( 'DECEMBER_SHORT' ) ) - ); - - return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected ); - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function treeSelectList( &$src_list, $src_id, $tgt_list, $tag_name, $tag_attribs, $key, $text, $selected ) - { - - // establish the hierarchy of the menu - $children = array(); - // first pass - collect children - foreach ($src_list as $v ) { - $pt = $v->parent; - $list = @$children[$pt] ? $children[$pt] : array(); - array_push( $list, $v ); - $children[$pt] = $list; - } - // second pass - get an indent list of the items - $ilist = JHTML::_('menu.treerecurse', 0, '', array(), $children ); - - // assemble menu items to the array - $this_treename = ''; - foreach ($ilist as $item) { - if ($this_treename) { - if ($item->id != $src_id && strpos( $item->treename, $this_treename ) === false) { - $tgt_list[] = mosHTML::makeOption( $item->id, $item->treename ); - } - } else { - if ($item->id != $src_id) { - $tgt_list[] = mosHTML::makeOption( $item->id, $item->treename ); - } else { - $this_treename = "$item->treename/"; - } - } - } - // build the html select list - return mosHTML::selectList( $tgt_list, $tag_name, $tag_attribs, $key, $text, $selected ); - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function yesnoSelectList( $tag_name, $tag_attribs, $selected, $yes='yes', $no='no' ) - { - $arr = array( - mosHTML::makeOption( 0, JText::_( $no ) ), - mosHTML::makeOption( 1, JText::_( $yes ) ), - ); - - return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', (int) $selected ); - } - - /** - * Legacy function, use {@link JHTML::_('grid.id')} instead - * - * @deprecated As of version 1.5 - */ - function idBox( $rowNum, $recId, $checkedOut=false, $name='cid' ) - { - return JHTML::_('grid.id', $rowNum, $recId, $checkedOut, $name); - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function sortIcon( $text, $base_href, $field, $state='none' ) - { - $alts = array( - 'none' => JText::_( 'No Sorting' ), - 'asc' => JText::_( 'Sort Ascending' ), - 'desc' => JText::_( 'Sort Descending' ), - ); - - $next_state = 'asc'; - if ($state == 'asc') { - $next_state = 'desc'; - } else if ($state == 'desc') { - $next_state = 'none'; - } - - if ($state == 'none') { - $img = ''; - } else { - $img = "\"{$alts[$next_state]}\""; - } - - $html = "" - . JText::_( $text ) - . '  ' - . $img - . ""; - - return $html; - } - - /** - * Legacy function, deprecated - * - * @deprecated As of version 1.5 - */ - function CloseButton ( &$params, $hide_js=NULL ) - { - - // displays close button in Pop-up window - if ( $params->get( 'popup' ) && !$hide_js ) { - ?> -
                - - '; - echo ''. JText::_( 'BACK' ) .''; - echo ''; - } - ?> -
                - get( 'back_button' ) && !$params->get( 'popup' ) && !$hide_js) { - ?> -
                - - -
                - get( 'print' ) && !$hide_js ) { - // use default settings if none declared - if ( !$status ) { - $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no'; - } - - // checks template image directory for image, if non found default are loaded - if ( $params->get( 'icons' ) ) { - $image = mosAdminMenus::ImageCheck( 'printButton.png', '/images/M_images/', NULL, NULL, JText::_( 'Print' ), JText::_( 'Print' ) ); - } else { - $image = JText::_( 'ICON_SEP' ) .' '. JText::_( 'Print' ) .' '. JText::_( 'ICON_SEP' ); - } - - if ( $params->get( 'popup' ) && !$hide_js ) { - // Print Preview button - used when viewing page - ?> - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/system/legacy/installer.php b/plugins/system/legacy/installer.php deleted file mode 100644 index 2f55da9a6fa4f..0000000000000 --- a/plugins/system/legacy/installer.php +++ /dev/null @@ -1,33 +0,0 @@ -setTitle()} instead or override in your application class - * - * @since 1.5 - * @deprecated As of version 1.5 - */ - function setPageTitle( $title=null ) - { - $document=& JFactory::getDocument(); - $document->setTitle($title); - } - - /** - * Deprecated, use {@link JDocument::getTitle() JDocument->getTitle()} instead or override in your application class - * @since 1.5 - * @deprecated As of version 1.5 - */ - function getPageTitle() - { - $document=& JFactory::getDocument(); - return $document->getTitle(); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/mambot.php b/plugins/system/legacy/mambot.php deleted file mode 100644 index dad3a69a38ce5..0000000000000 --- a/plugins/system/legacy/mambot.php +++ /dev/null @@ -1,60 +0,0 @@ -reorder( $where ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.0.3 - */ - function publish_array( $cid=null, $publish=1, $user_id=0 ) - { - $this->publish( $cid, $publish, $user_id ); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/mambothandler.php b/plugins/system/legacy/mambothandler.php deleted file mode 100644 index e3724edb9ed3d..0000000000000 --- a/plugins/system/legacy/mambothandler.php +++ /dev/null @@ -1,82 +0,0 @@ -trigger()} instead and handle return values - * in your code - * - * @param string The event name - * @since 1.5 - * @deprecated As of 1.5 - */ - function call($event) - { - $args = & func_get_args(); - array_shift($args); - - $retArray = $this->trigger( $event, $args ); - return $retArray[0]; - } -} \ No newline at end of file diff --git a/plugins/system/legacy/menu.php b/plugins/system/legacy/menu.php deleted file mode 100644 index 2b765d6780f7b..0000000000000 --- a/plugins/system/legacy/menu.php +++ /dev/null @@ -1,60 +0,0 @@ -reorder( $where ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.0.3 - */ - function publish_array( $cid=null, $publish=1, $user_id=0 ) - { - $this->publish( $cid, $publish, $user_id ); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/menubar.php b/plugins/system/legacy/menubar.php deleted file mode 100644 index 068f1c38fad31..0000000000000 --- a/plugins/system/legacy/menubar.php +++ /dev/null @@ -1,76 +0,0 @@ -reorder( $where ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.0.3 - */ - function publish_array( $cid=null, $publish=1, $user_id=0 ) - { - $this->publish( $cid, $publish, $user_id ); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/mysql.php b/plugins/system/legacy/mysql.php deleted file mode 100644 index b7d899b659145..0000000000000 --- a/plugins/system/legacy/mysql.php +++ /dev/null @@ -1,80 +0,0 @@ - $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix ); - parent::__construct( $options ); - } - - /** - * This global function loads the first row of a query into an object - * - * If an object is passed to this function, the returned row is bound to the existing elements of object. - * If object has a value of null, then all of the returned query fields returned in the object. - * - * @param object The address of variable - */ - function loadObject( &$object ) - { - if ($object != null) - { - if (!($cur = $this->query())) { - return false; - } - - if ($array = mysql_fetch_assoc( $cur )) - { - mysql_free_result( $cur ); - mosBindArrayToObject( $array, $object, null, null, false ); - return true; - } else { - return false; - } - - } - else - { - $object = parent::loadObject(); - return $object; - } - } - - /** - * Execute a batch query - * - * @abstract - * @access public - * @return mixed A database resource if successful, FALSE if not. - */ - function query_batch( $abort_on_error=true, $p_transaction_safe = false) - { - return parent::queryBatch( $abort_on_error, $p_transaction_safe); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/mysqli.php b/plugins/system/legacy/mysqli.php deleted file mode 100644 index 5c696ea252163..0000000000000 --- a/plugins/system/legacy/mysqli.php +++ /dev/null @@ -1,80 +0,0 @@ - $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix ); - parent::__construct( $options ); - } - - /** - * This global function loads the first row of a query into an object - * - * If an object is passed to this function, the returned row is bound to the existing elements of object. - * If object has a value of null, then all of the returned query fields returned in the object. - * - * @param object The address of variable - */ - function loadObject( &$object ) - { - if ($object != null) - { - if (!($cur = $this->query())) { - return false; - } - - if ($array = mysqli_fetch_assoc( $cur )) - { - mysqli_free_result( $cur ); - mosBindArrayToObject( $array, $object, null, null, false ); - return true; - } else { - return false; - } - - } - else - { - $object = parent::loadObject(); - return $object; - } - } - - /** - * Execute a batch query - * - * @abstract - * @access public - * @return mixed A database resource if successful, FALSE if not. - */ - function query_batch( $abort_on_error=true, $p_transaction_safe = false) - { - return parent::queryBatch( $abort_on_error, $p_transaction_safe); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/pagination.php b/plugins/system/legacy/pagination.php deleted file mode 100644 index 7d66271480101..0000000000000 --- a/plugins/system/legacy/pagination.php +++ /dev/null @@ -1,137 +0,0 @@ -getLimitBox(); - * - * @deprecated as of 1.5 - */ - function writeLimitBox($link = null) { - echo $this->getLimitBox(); - } - - /** - * Writes the counter string - * Use: print $pagination->getLimitBox(); - * - * @deprecated as of 1.5 - */ - function writePagesCounter() { - return $this->getPagesCounter(); - } - - /** - * Writes the page list string - * Use: print $pagination->getPagesLinks(); - * - * @deprecated as of 1.5 - */ - function writePagesLinks($link = null) { - return $this->getPagesLinks(); - } - - /** - * Writes the html for the leafs counter, eg, Page 1 of x - * Use: print $pagination->getPagesCounter(); - * - * @deprecated as of 1.5 - */ - function writeLeafsCounter() { - return $this->getPagesCounter(); - } - - /** - * Returns the pagination offset at an index - * Use: $pagination->getRowOffset($index); instead - * - * @deprecated as of 1.5 - */ - function rowNumber($index) { - return $index +1 + $this->limitstart; - } - - /** - * Return the icon to move an item UP - * - * @deprecated as of 1.5 - */ - function orderUpIcon2($id, $order, $condition = true, $task = 'orderup', $alt = '#') - { - // handling of default value - if ($alt = '#') { - $alt = JText::_('Move Up'); - } - - if ($order == 0) { - $img = 'uparrow0.png'; - } else { - if ($order < 0) { - $img = 'uparrow-1.png'; - } else { - $img = 'uparrow.png'; - } - } - $output = ''; - $output .= ''.$alt.''; - - return $output; - } - - /** - * Return the icon to move an item DOWN - * - * @deprecated as of 1.5 - */ - function orderDownIcon2($id, $order, $condition = true, $task = 'orderdown', $alt = '#') - { - // handling of default value - if ($alt = '#') { - $alt = JText::_('Move Down'); - } - - if ($order == 0) { - $img = 'downarrow0.png'; - } else { - if ($order < 0) { - $img = 'downarrow-1.png'; - } else { - $img = 'downarrow.png'; - } - } - $output = ''; - $output .= ''.$alt.''; - - return $output; - } -} -?> \ No newline at end of file diff --git a/plugins/system/legacy/parameters.php b/plugins/system/legacy/parameters.php deleted file mode 100644 index f387737373480..0000000000000 --- a/plugins/system/legacy/parameters.php +++ /dev/null @@ -1,94 +0,0 @@ -toObject()} instead - * - * @deprecated As of version 1.5 - */ - function toObject() - { - parent::toObject(); - } - - /** - * Legacy function, use {@link JParameter::toArray() JParameter->toArray()} instead - * - * @deprecated As of version 1.5 - */ - function toArray() - { - parent::toArray(); - } - - /** - * Parse an .ini string, based on phpDocumentor phpDocumentor_parse_ini_file function - * - * @access public - * @param mixed The ini string or array of lines - * @param boolean add an associative index for each section [in brackets] - * @return object - */ - function parse($txt, $process_sections = false, $asArray = false) - { - $this->loadINI($txt); - - if($asArray) { - return $this->toArray(); - } - - return $this->toObject( ); - } - - /** - * Special handling for textarea param - */ - function textareaHandling( &$txt ) - { - $total = count( $txt ); - for( $i=0; $i < $total; $i++ ) { - if ( strstr( $txt[$i], "\n" ) ) { - $txt[$i] = str_replace( "\n", '
                ', $txt[$i] ); - } - } - $txt = implode( "\n", $txt ); - - return $txt; - } -} \ No newline at end of file diff --git a/plugins/system/legacy/patfactory.php b/plugins/system/legacy/patfactory.php deleted file mode 100644 index 6e48fc143f116..0000000000000 --- a/plugins/system/legacy/patfactory.php +++ /dev/null @@ -1,61 +0,0 @@ -readTemplatesFromFile( 'page.html' ); - $tmpl->applyInputFilter('ShortModifiers'); - - // load the stock templates - if (is_array( $files )) { - foreach ($files as $file) - { - $tmpl->readTemplatesFromInput( $file ); - } - } - - // TODO: Do the protocol better - $tmpl->addVar( 'form', 'formAction', basename($_SERVER['PHP_SELF']) ); - $tmpl->addVar( 'form', 'formName', 'adminForm' ); - - $tmpl->setRoot( dirname( __FILE__ ) . '/tmpl'); - $tmpl->setNamespace( 'mos' ); - - if ($bodyHtml) { - $tmpl->setAttribute( 'body', 'src', $bodyHtml ); - } - return $tmpl; - } -} \ No newline at end of file diff --git a/plugins/system/legacy/section.php b/plugins/system/legacy/section.php deleted file mode 100644 index afdbe26b3482f..0000000000000 --- a/plugins/system/legacy/section.php +++ /dev/null @@ -1,60 +0,0 @@ -reorder( $where ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.0.3 - */ - function publish_array( $cid=null, $publish=1, $user_id=0 ) - { - $this->publish( $cid, $publish, $user_id ); - } -} \ No newline at end of file diff --git a/plugins/system/legacy/session.php b/plugins/system/legacy/session.php deleted file mode 100644 index 05353f50b0333..0000000000000 --- a/plugins/system/legacy/session.php +++ /dev/null @@ -1,105 +0,0 @@ -getCfg('secret') . $value . $_SERVER['REMOTE_ADDR'] ); - } - - /** - * Set the information to allow a session to persist - */ - function persist() - { - global $mainframe; - - $usercookie = mosGetParam( $_COOKIE, 'usercookie', null ); - if ($usercookie) { - // Remember me cookie exists. Login with usercookie info. - $mainframe->login( $usercookie['username'], $usercookie['password'] ); - } - } - - /** - * Legacy Method, use {@link JTable::reorder()} instead - * @deprecated As of 1.5 - */ - function updateOrder( $where='' ) - { - return $this->reorder( $where ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.0.3 - */ - function publish_array( $cid=null, $publish=1, $user_id=0 ) - { - $this->publish( $cid, $publish, $user_id ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.5 - */ - function setFromRequest( $key, $varName, $default=null ) - { - if (isset( $_REQUEST[$varName] )) { - return $_SESSION[$key] = $_REQUEST[$varName]; - } else if (isset( $_SESSION[$key] )) { - return $_SESSION[$key]; - } else { - return $_SESSION[$key] = $default; - } - } -} \ No newline at end of file diff --git a/plugins/system/legacy/template/index.html b/plugins/system/legacy/template/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/plugins/system/legacy/template/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/joomla/template/module/function/Sef.php b/plugins/system/legacy/template/module/function/Sef.php similarity index 100% rename from libraries/joomla/template/module/function/Sef.php rename to plugins/system/legacy/template/module/function/Sef.php diff --git a/libraries/joomla/template/module/function/Translate.php b/plugins/system/legacy/template/module/function/Translate.php similarity index 94% rename from libraries/joomla/template/module/function/Translate.php rename to plugins/system/legacy/template/module/function/Translate.php index ec6b839916ce0..b80a88478436b 100644 --- a/libraries/joomla/template/module/function/Translate.php +++ b/plugins/system/legacy/template/module/function/Translate.php @@ -38,7 +38,6 @@ class patTemplate_Function_Translate extends patTemplate_Function * @param array parameters of the function (= attributes of the tag) * @param string content of the tag * @return string content to insert into the template - * @author Andrew Eddie * Function modifed for Joomla! */ function call( $params, $content ) diff --git a/plugins/system/legacy/template/module/function/index.html b/plugins/system/legacy/template/module/function/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/plugins/system/legacy/template/module/function/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/plugins/system/legacy/template/module/index.html b/plugins/system/legacy/template/module/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/plugins/system/legacy/template/module/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/joomla/template/module/modifier/SEF.php b/plugins/system/legacy/template/module/modifier/SEF.php similarity index 100% rename from libraries/joomla/template/module/modifier/SEF.php rename to plugins/system/legacy/template/module/modifier/SEF.php diff --git a/libraries/joomla/template/module/modifier/Translate.php b/plugins/system/legacy/template/module/modifier/Translate.php similarity index 100% rename from libraries/joomla/template/module/modifier/Translate.php rename to plugins/system/legacy/template/module/modifier/Translate.php diff --git a/plugins/system/legacy/template/module/modifier/index.html b/plugins/system/legacy/template/module/modifier/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/plugins/system/legacy/template/module/modifier/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/joomla/template/template.php b/plugins/system/legacy/template/template.php similarity index 98% rename from libraries/joomla/template/template.php rename to plugins/system/legacy/template/template.php index 252c57f84d441..5fa82b3e8a3bb 100644 --- a/libraries/joomla/template/template.php +++ b/plugins/system/legacy/template/template.php @@ -20,7 +20,6 @@ /** * Template class, provides an easy interface to parse and display a template file * - * @author Johan Janssens * @package Joomla.Framework * @subpackage Template * @since 1.5 diff --git a/libraries/joomla/template/tmpl/adminfilters.html b/plugins/system/legacy/template/tmpl/adminfilters.html similarity index 100% rename from libraries/joomla/template/tmpl/adminfilters.html rename to plugins/system/legacy/template/tmpl/adminfilters.html diff --git a/libraries/joomla/template/tmpl/adminlists.html b/plugins/system/legacy/template/tmpl/adminlists.html similarity index 97% rename from libraries/joomla/template/tmpl/adminlists.html rename to plugins/system/legacy/template/tmpl/adminlists.html index 196ea50259f91..71f79ae80a74d 100644 --- a/libraries/joomla/template/tmpl/adminlists.html +++ b/plugins/system/legacy/template/tmpl/adminlists.html @@ -60,7 +60,7 @@ - + diff --git a/libraries/joomla/template/tmpl/breadcrumbs.html b/plugins/system/legacy/template/tmpl/breadcrumbs.html similarity index 100% rename from libraries/joomla/template/tmpl/breadcrumbs.html rename to plugins/system/legacy/template/tmpl/breadcrumbs.html diff --git a/libraries/joomla/template/tmpl/calendar.html b/plugins/system/legacy/template/tmpl/calendar.html similarity index 100% rename from libraries/joomla/template/tmpl/calendar.html rename to plugins/system/legacy/template/tmpl/calendar.html diff --git a/libraries/joomla/template/tmpl/dtree.html b/plugins/system/legacy/template/tmpl/dtree.html similarity index 100% rename from libraries/joomla/template/tmpl/dtree.html rename to plugins/system/legacy/template/tmpl/dtree.html diff --git a/libraries/joomla/template/tmpl/forms.html b/plugins/system/legacy/template/tmpl/forms.html similarity index 100% rename from libraries/joomla/template/tmpl/forms.html rename to plugins/system/legacy/template/tmpl/forms.html diff --git a/libraries/joomla/template/tmpl/help.html b/plugins/system/legacy/template/tmpl/help.html similarity index 100% rename from libraries/joomla/template/tmpl/help.html rename to plugins/system/legacy/template/tmpl/help.html diff --git a/plugins/system/legacy/template/tmpl/index.html b/plugins/system/legacy/template/tmpl/index.html new file mode 100644 index 0000000000000..42682b4746225 --- /dev/null +++ b/plugins/system/legacy/template/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libraries/joomla/template/tmpl/page.html b/plugins/system/legacy/template/tmpl/page.html similarity index 100% rename from libraries/joomla/template/tmpl/page.html rename to plugins/system/legacy/template/tmpl/page.html diff --git a/libraries/joomla/template/tmpl/tabs.html b/plugins/system/legacy/template/tmpl/tabs.html similarity index 100% rename from libraries/joomla/template/tmpl/tabs.html rename to plugins/system/legacy/template/tmpl/tabs.html diff --git a/plugins/system/legacy/toolbar.php b/plugins/system/legacy/toolbar.php deleted file mode 100644 index 04f97f2103d0e..0000000000000 --- a/plugins/system/legacy/toolbar.php +++ /dev/null @@ -1,318 +0,0 @@ -addStyleSheet( 'templates/system/css/toolbar.css' ); - ?> - - - - - setQuery( $sql ); - $cur_template = $db->loadResult(); - - $alt = JText::_( 'Preview' ); - $image = JHTML::_('image.site', 'preview_f2.png', 'images/', NULL, NULL, $alt ); - ?> - - - - - - - - - - - - - -
                - - - - - - - - - - - - - -   
                - diff --git a/plugins/system/legacy/user.php b/plugins/system/legacy/user.php deleted file mode 100644 index c8deffa738c96..0000000000000 --- a/plugins/system/legacy/user.php +++ /dev/null @@ -1,108 +0,0 @@ -reorder( $where ); - } - - /** - * Legacy Method, use {@link JTable::publish()} instead - * @deprecated As of 1.0.3 - */ - function publish_array( $cid=null, $publish=1, $user_id=0 ) - { - $this->publish( $cid, $publish, $user_id ); - } - - /** - * Returns a complete user list - * - * @return array - * @deprecated As of 1.5 - */ - function getUserList() - { - $this->_db->setQuery("SELECT username FROM #__users"); - return $this->_db->loadAssocList(); - } - - /** - * Gets the users from a group - * - * @param string The value for the group - * @param string The name for the group - * @param string If RECURSE, will drill into child groups - * @param string Ordering for the list - * @return array - * @deprecated As of 1.5 - */ - function getUserListFromGroup( $value, $name, $recurse='NO_RECURSE', $order='name' ) - { - $acl =& JFactory::getACL(); - - // Change back in - $group_id = $acl->get_group_id( $value, $name, 'ARO'); - $objects = $acl->get_group_objects( $group_id, 'ARO', 'RECURSE'); - - if (isset( $objects['users'] )) - { - $gWhere = '(id =' . implode( ' OR id =', $objects['users'] ) . ')'; - - $query = 'SELECT id AS value, name AS text' - . ' FROM #__users' - . ' WHERE block = "0"' - . ' AND ' . $gWhere - . ' ORDER BY '. $order - ; - $this->_db->setQuery( $query ); - $options = $this->_db->loadObjectList(); - return $options; - } else { - return array(); - } - } -} \ No newline at end of file diff --git a/plugins/system/log.php b/plugins/system/log.php index 0df10d05e0bee..e3b503afb0009 100644 --- a/plugins/system/log.php +++ b/plugins/system/log.php @@ -19,28 +19,11 @@ /** * Joomla! System Logging Plugin * - * @author Johan Janssens * @package Joomla * @subpackage System */ class plgSystemLog extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @access protected - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgSystemLog(& $subject, $config) { - parent::__construct($subject, $config); - } - function onLoginFailure($response) { jimport('joomla.error.log'); @@ -49,7 +32,7 @@ function onLoginFailure($response) $errorlog = array(); switch($response['status']) - { + { case JAUTHENTICATE_STATUS_CANCEL : { $errorlog['status'] = $response['type'] . " CANCELED: "; diff --git a/plugins/system/remember.php b/plugins/system/remember.php index 066d789b5d897..528c0d46f4968 100644 --- a/plugins/system/remember.php +++ b/plugins/system/remember.php @@ -19,34 +19,17 @@ /** * Joomla! System Remember Me Plugin * - * @author Louis Landry * @package Joomla * @subpackage System */ class plgSystemRemember extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @access protected - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.0 - */ - function plgSystemRemember(& $subject, $config) { - parent::__construct($subject, $config); - } - function onAfterInitialise() { - global $mainframe; + $appl = JFactory::getApplication(); // No remember me for admin - if ($mainframe->isAdmin()) { + if ($appl->isAdmin()) { return; } @@ -68,7 +51,7 @@ function onAfterInitialise() $options = array(); $options['silent'] = true; - if (!$mainframe->login(@unserialize($str), $options)) { + if (!$appl->login(@unserialize($str), $options)) { // Clear the remember me cookie setcookie( JUtility::getHash('JLOGIN_REMEMBER'), false, time() - 86400, '/' ); } diff --git a/plugins/system/sef.php b/plugins/system/sef.php index 690720fdb101f..6c6426fa6dfe1 100644 --- a/plugins/system/sef.php +++ b/plugins/system/sef.php @@ -25,23 +25,8 @@ class plgSystemSef extends JPlugin { /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.0 + * Converting the site URL to fit to the HTTP request */ - function plgSystemSef(&$subject, $config) { - parent::__construct($subject, $config); - } - - /** - * Converting the site URL to fit to the HTTP request - */ function onAfterRender() { $app =& JFactory::getApplication(); @@ -51,36 +36,36 @@ function onAfterRender() } //Replace src links - $base = JURI::base(true).'/'; + $base = JURI::base(true).'/'; $buffer = JResponse::getBody(); - $regex = '#href="index.php\?([^"]*)#m'; - $buffer = preg_replace_callback( $regex, array('plgSystemSEF', 'route'), $buffer ); + $regex = '#href="index.php\?([^"]*)#m'; + $buffer = preg_replace_callback( $regex, array('plgSystemSEF', 'route'), $buffer ); - $protocols = '[a-zA-Z0-9]+:'; //To check for all unknown protocals (a protocol must contain at least one alpahnumeric fillowed by : - $regex = '#(src|href)="(?!/|'.$protocols.'|\#)([^"]*)"#m'; - $buffer = preg_replace($regex, "$1=\"$base\$2\"", $buffer); - $regex = '#(onclick="window.open\(\')(?!/|'.$protocols.'|\#)([^/]+[^\']*?\')#m'; - $buffer = preg_replace($regex, '$1'.$base.'$2', $buffer); + $protocols = '[a-zA-Z0-9]+:'; //To check for all unknown protocals (a protocol must contain at least one alpahnumeric fillowed by : + $regex = '#(src|href)="(?!/|'.$protocols.'|\#)([^"]*)"#m'; + $buffer = preg_replace($regex, "$1=\"$base\$2\"", $buffer); + $regex = '#(onclick="window.open\(\')(?!/|'.$protocols.'|\#)([^/]+[^\']*?\')#m'; + $buffer = preg_replace($regex, '$1'.$base.'$2', $buffer); JResponse::setBody($buffer); return true; } /** - * Replaces the matched tags - * - * @param array An array of matches (see preg_match_all) - * @return string - */ + * Replaces the matched tags + * + * @param array An array of matches (see preg_match_all) + * @return string + */ function route( &$matches ) - { - $original = $matches[0]; - $url = $matches[1]; + { + $original = $matches[0]; + $url = $matches[1]; $url = str_replace('&','&',$url); - $route = JRoute::_('index.php?'.$url); - return 'href="'.$route; - } -} + $route = JRoute::_('index.php?'.$url); + return 'href="'.$route; + } +} \ No newline at end of file diff --git a/plugins/tmp/index.html b/plugins/tmp/index.html deleted file mode 100644 index fa6d84e8055f5..0000000000000 --- a/plugins/tmp/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/plugins/user/example.php b/plugins/user/example.php index 9f1a0b68a4a42..eb7ccb4d144bb 100644 --- a/plugins/user/example.php +++ b/plugins/user/example.php @@ -24,24 +24,8 @@ * @subpackage JFramework * @since 1.5 */ -class plgUserExample extends JPlugin { - - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgUserExample(& $subject, $config) - { - parent::__construct($subject, $config); - } - +class plgUserExample extends JPlugin +{ /** * Example store user method * @@ -126,7 +110,7 @@ function onAfterDeleteUser($user, $succes, $msg) * * @access public * @param array holds the user data - * @param array extra options + * @param array extra options * @return boolean True on success * @since 1.5 */ diff --git a/plugins/user/index.html b/plugins/user/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/user/index.html +++ b/plugins/user/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/user/joomla.php b/plugins/user/joomla.php index 0ff4237a571b5..ee5ef2dbc761e 100644 --- a/plugins/user/joomla.php +++ b/plugins/user/joomla.php @@ -20,34 +20,18 @@ /** * Joomla User plugin * - * @author Johan Janssens * @package Joomla * @subpackage JFramework * @since 1.5 */ class plgUserJoomla extends JPlugin { - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param array $config An array that holds the plugin configuration - * @since 1.5 - */ - function plgUserJoomla(& $subject, $config) { - parent::__construct($subject, $config); - } - /** * Remove all sessions for the user name * * Method is called after user data is deleted from the database * - * @param array holds the user data + * @param array holds the user data * @param boolean true if user was succesfully stored in the database * @param string message */ @@ -94,7 +78,7 @@ function onLoginUser($user, $options = array()) // Get the user group from the ACL if ($instance->get('tmp_user') == 1) { - $grp = new JObject; + $grp = new JStdClass; // This should be configurable at some point $grp->set('name', 'Registered'); } else { @@ -115,8 +99,8 @@ function onLoginUser($user, $options = array()) $instance->set('aid', 1); // Fudge Authors, Editors, Publishers and Super Administrators into the special access group - if ($acl->is_group_child_of($grp->name, 'Registered') || - $acl->is_group_child_of($grp->name, 'Public Backend')) { + if ($acl->is_group_child_of($grp->name, 'Registered') || + $acl->is_group_child_of($grp->name, 'Public Backend')) { $instance->set('aid', 2); } @@ -190,7 +174,7 @@ function onLogoutUser($user, $options = array()) */ function &_getUser($user, $options = array()) { - $instance = new JUser(); + $instance = JUser::getInstance(); if($id = intval(JUserHelper::getUserId($user['username']))) { $instance->load($id); return $instance; diff --git a/plugins/xmlrpc/blogger.php b/plugins/xmlrpc/blogger.php index 7a803c74a4283..6cd54ad4bff2d 100644 --- a/plugins/xmlrpc/blogger.php +++ b/plugins/xmlrpc/blogger.php @@ -18,10 +18,18 @@ class plgXMLRPCBlogger extends JPlugin { - function plgXMLRPCBlogger(&$subject, $config) + /** + * Constructor + * + * @access protected + * @param object $subject The object to observe + * @param array $config An array that holds the plugin configuration + * @since 1.6 + */ + function __construct($subject, $config) { + $this->loadLanguage( '', JPATH_ADMINISTRATOR ); parent::__construct($subject, $config); - $this->loadLanguage( '', JPATH_ADMINISTRATOR ); } /** @@ -493,7 +501,7 @@ function getUserAid( &$user ) { $user->set('aid', 1); // Fudge Authors, Editors, Publishers and Super Administrators into the special access group - if ($acl->is_group_child_of($grp->name, 'Registered') || + if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) { $user->set('aid', 2); } diff --git a/plugins/xmlrpc/index.html b/plugins/xmlrpc/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/plugins/xmlrpc/index.html +++ b/plugins/xmlrpc/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/plugins/xmlrpc/joomla.php b/plugins/xmlrpc/joomla.php index 31696d1af4086..9da8269b88346 100644 --- a/plugins/xmlrpc/joomla.php +++ b/plugins/xmlrpc/joomla.php @@ -24,23 +24,6 @@ */ class plgXMLRPCJoomla extends JPlugin { - - /** - * Constructor - * - * For php4 compatability we must not use the __constructor as a constructor for plugins - * because func_get_args ( void ) returns a copy of all passed arguments NOT references. - * This causes problems with cross-referencing necessary for the observer design pattern. - * - * @param object $subject The object to observe - * @param object $params The object that holds the plugin parameters - * @since 1.5 - */ - function plgXMLRPCJoomla(& $subject, $config) - { - parent::__construct($subject, $config); - } - /** * Get available web services for this plugin * @@ -97,7 +80,7 @@ function searchSite($searchword, $phrase='', $order='') $results = $mainframe->triggerEvent( 'onSearch', array( $searchword, $phrase, $ordering ) ); // Iterate through results building the return array - require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_search'.DS.'helpers'.DS.'search.php'); + require_once JPATH_ADMINISTRATOR.DS.'components'.DS.'com_search'.DS.'helpers'.DS.'search.php'; foreach ($results as $i=>$rows) { diff --git a/templates/beez/css/ie7only.css b/templates/beez/css/ie7only.css index 754a7d642d7f0..f66ac3856cc81 100644 --- a/templates/beez/css/ie7only.css +++ b/templates/beez/css/ie7only.css @@ -1,6 +1,5 @@ /** * @version $Id$ - * @author Design & Accessible Team ( Angie Radtke / Robert Deutz ) * @package Joomla * @subpackage Accessible-Template-Beez * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. diff --git a/templates/beez/css/ieonly.css b/templates/beez/css/ieonly.css index fb5d070e75a8f..636570d1188d9 100644 --- a/templates/beez/css/ieonly.css +++ b/templates/beez/css/ieonly.css @@ -1,6 +1,5 @@ /** * @version $Id$ - * @author Design & Accessible Team ( Angie Radtke / Robert Deutz ) * @package Joomla * @subpackage Accessible-Template-Beez * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. diff --git a/templates/beez/css/index.html b/templates/beez/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/css/index.html +++ b/templates/beez/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/css/layout.css b/templates/beez/css/layout.css index f4bb9fbafead3..258f62df1eda9 100644 --- a/templates/beez/css/layout.css +++ b/templates/beez/css/layout.css @@ -1,6 +1,5 @@ /** * @version $Id$ - * @author Design & Accessible Team ( Angie Radtke ) * @package Joomla * @subpackage Accessible-Template-Beez * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. diff --git a/templates/beez/css/position.css b/templates/beez/css/position.css index 1c18fcd79517c..5c50c7afe5467 100644 --- a/templates/beez/css/position.css +++ b/templates/beez/css/position.css @@ -1,6 +1,5 @@ /** * @version $Id$ - * @author Design & Accessible Team ( Angie Radtke / Robert Deutz ) * @package Joomla * @subpackage Accessible-Template-Beez * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. diff --git a/templates/beez/css/print.css b/templates/beez/css/print.css index a7cb8310f27cc..a127a9d983ade 100644 --- a/templates/beez/css/print.css +++ b/templates/beez/css/print.css @@ -1,6 +1,5 @@ /** * @version $Id$ - * @author Design & Accessible Team ( Angie Radtke / Robert Deutz ) * @package Joomla * @subpackage Accessible-Template-Beez * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. diff --git a/templates/beez/css/template.css b/templates/beez/css/template.css index 54a4b8e45b236..ad407c7f29215 100644 --- a/templates/beez/css/template.css +++ b/templates/beez/css/template.css @@ -1,6 +1,5 @@ /** * @version $Id$ - * @author Design & Accessible Team ( Angie Radtke / Robert Deutz ) * @package Joomla * @subpackage Accessible-Template-Beez * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. @@ -12,10 +11,6 @@ * details. */ - - - - body { background: #fff; @@ -26,8 +21,6 @@ body text-align: center; } - - body.contentpane { width : auto; diff --git a/templates/beez/css/template_rtl.css b/templates/beez/css/template_rtl.css index c9664d6d6f083..fee2593767bec 100644 --- a/templates/beez/css/template_rtl.css +++ b/templates/beez/css/template_rtl.css @@ -14,7 +14,6 @@ /** * Joomla! 1.5 Beez template RTL css file * - * @author Mati Kochen /Angie Radtke * @package Joomla * @since 1.5 * @version 1.0 diff --git a/templates/beez/html/com_contact/category/index.html b/templates/beez/html/com_contact/category/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_contact/category/index.html +++ b/templates/beez/html/com_contact/category/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_contact/contact/default.php b/templates/beez/html/com_contact/contact/default.php index 35f9ef9c52371..1a35c5d606c99 100644 --- a/templates/beez/html/com_contact/contact/default.php +++ b/templates/beez/html/com_contact/contact/default.php @@ -42,7 +42,7 @@ contact->params->get('allow_vcard')) : ?>

                - +

                diff --git a/templates/beez/html/com_contact/contact/index.html b/templates/beez/html/com_contact/contact/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_contact/contact/index.html +++ b/templates/beez/html/com_contact/contact/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_contact/index.html b/templates/beez/html/com_contact/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_contact/index.html +++ b/templates/beez/html/com_contact/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_content/article/default.php b/templates/beez/html/com_content/article/default.php index a8cbafb4ab223..6205ed08d32ad 100644 --- a/templates/beez/html/com_content/article/default.php +++ b/templates/beez/html/com_content/article/default.php @@ -12,7 +12,7 @@ params->get('show_page_title')) : ?>

                - escape($this->params->get('page_title')); ?> + escape($this->params->get('page_title')); ?>

                diff --git a/templates/beez/html/com_content/article/form.php b/templates/beez/html/com_content/article/form.php index 504141b08e9b8..4360803c72fd1 100644 --- a/templates/beez/html/com_content/article/form.php +++ b/templates/beez/html/com_content/article/form.php @@ -128,14 +128,14 @@ function submitbutton(pressbutton) { - article->publish_up, 'publish_up', 'publish_up', '%Y-%m-%d %H:%M:%S', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?> + article->publish_up, 'publish_up', 'publish_up', '%Y-%m-%d %H:%M:%S', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?>
               
              - article->publish_down, 'publish_down', 'publish_down', '%Y-%m-%d %H:%M:%S', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?> + article->publish_down, 'publish_down', 'publish_down', '%Y-%m-%d %H:%M:%S', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); ?>
               
              diff --git a/templates/beez/html/com_content/article/index.html b/templates/beez/html/com_content/article/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_content/article/index.html +++ b/templates/beez/html/com_content/article/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_content/category/blog_item.php b/templates/beez/html/com_content/category/blog_item.php index b4f3d07155844..7437672749830 100644 --- a/templates/beez/html/com_content/category/blog_item.php +++ b/templates/beez/html/com_content/category/blog_item.php @@ -40,30 +40,30 @@ item->params->get('show_section') && $this->item->sectionid) || ($this->item->params->get('show_category') && $this->item->catid)) : ?>

              - item->params->get('show_section') && $this->item->sectionid && isset($this->item->section)) : ?> - - item->params->get('link_section')) : ?> - item->sectionid)).'">'; ?> - - item->section; ?> - item->params->get('link_section')) : ?> - '; ?> - + item->params->get('show_section') && $this->item->sectionid && isset($this->item->section)) : ?> + + item->params->get('link_section')) : ?> + item->sectionid)).'">'; ?> + + item->section; ?> + item->params->get('link_section')) : ?> + '; ?> + item->params->get('show_category')) : ?> - - - - - item->params->get('show_category') && $this->item->catid) : ?> - - item->params->get('link_category')) : ?> - item->catslug, $this->item->sectionid)).'">'; ?> - - item->category; ?> - item->params->get('link_category')) : ?> - '; ?> - - + + + + + item->params->get('show_category') && $this->item->catid) : ?> + + item->params->get('link_category')) : ?> + item->catslug, $this->item->sectionid)).'">'; ?> + + item->category; ?> + item->params->get('link_category')) : ?> + '; ?> + +

              diff --git a/templates/beez/html/com_content/category/index.html b/templates/beez/html/com_content/category/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_content/category/index.html +++ b/templates/beez/html/com_content/category/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_content/frontpage/default_item.php b/templates/beez/html/com_content/frontpage/default_item.php index 48a846344fd96..a37a558b4a91f 100644 --- a/templates/beez/html/com_content/frontpage/default_item.php +++ b/templates/beez/html/com_content/frontpage/default_item.php @@ -40,7 +40,7 @@ item->params->get('show_section') && $this->item->sectionid) || ($this->item->params->get('show_category') && $this->item->catid)) : ?>

              - item->params->get('show_section') && $this->item->sectionid && isset($this->item->section)) : ?> + item->params->get('show_section') && $this->item->sectionid && isset($this->item->section)) : ?> item->params->get('link_section')) : ?> item->sectionid)).'">'; ?> diff --git a/templates/beez/html/com_content/frontpage/index.html b/templates/beez/html/com_content/frontpage/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_content/frontpage/index.html +++ b/templates/beez/html/com_content/frontpage/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_content/index.html b/templates/beez/html/com_content/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_content/index.html +++ b/templates/beez/html/com_content/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_content/section/blog_item.php b/templates/beez/html/com_content/section/blog_item.php index 62563dbf400a3..aa09c50c7ea77 100644 --- a/templates/beez/html/com_content/section/blog_item.php +++ b/templates/beez/html/com_content/section/blog_item.php @@ -40,31 +40,31 @@ item->params->get('show_section') && $this->item->sectionid) || ($this->item->params->get('show_category') && $this->item->catid)) : ?>

              - item->params->get('show_section') && $this->item->sectionid && isset($this->item->section)) : ?> - - item->params->get('link_section')) : ?> - item->sectionid)).'">'; ?> - - item->section; ?> - item->params->get('link_section')) : ?> - '; ?> - - item->params->get('show_category')) : ?> - - - - - item->params->get('show_category') && $this->item->catid) : ?> - - item->params->get('link_category')) : ?> - item->catslug, $this->item->sectionid)).'">'; ?> - - item->category; ?> - item->params->get('link_section')) : ?> - '; ?> - - - + item->params->get('show_section') && $this->item->sectionid && isset($this->item->section)) : ?> + + item->params->get('link_section')) : ?> + item->sectionid)).'">'; ?> + + item->section; ?> + item->params->get('link_section')) : ?> + '; ?> + + item->params->get('show_category')) : ?> + + + + + item->params->get('show_category') && $this->item->catid) : ?> + + item->params->get('link_category')) : ?> + item->catslug, $this->item->sectionid)).'">'; ?> + + item->category; ?> + item->params->get('link_section')) : ?> + '; ?> + + +

              diff --git a/templates/beez/html/com_content/section/index.html b/templates/beez/html/com_content/section/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_content/section/index.html +++ b/templates/beez/html/com_content/section/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_newsfeeds/categories/index.html b/templates/beez/html/com_newsfeeds/categories/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_newsfeeds/categories/index.html +++ b/templates/beez/html/com_newsfeeds/categories/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_newsfeeds/category/index.html b/templates/beez/html/com_newsfeeds/category/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_newsfeeds/category/index.html +++ b/templates/beez/html/com_newsfeeds/category/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_newsfeeds/index.html b/templates/beez/html/com_newsfeeds/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_newsfeeds/index.html +++ b/templates/beez/html/com_newsfeeds/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_newsfeeds/newsfeed/index.html b/templates/beez/html/com_newsfeeds/newsfeed/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_newsfeeds/newsfeed/index.html +++ b/templates/beez/html/com_newsfeeds/newsfeed/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_poll/index.html b/templates/beez/html/com_poll/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_poll/index.html +++ b/templates/beez/html/com_poll/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_poll/poll/index.html b/templates/beez/html/com_poll/poll/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_poll/poll/index.html +++ b/templates/beez/html/com_poll/poll/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_search/index.html b/templates/beez/html/com_search/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_search/index.html +++ b/templates/beez/html/com_search/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_search/search/index.html b/templates/beez/html/com_search/search/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_search/search/index.html +++ b/templates/beez/html/com_search/search/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_user/index.html b/templates/beez/html/com_user/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_user/index.html +++ b/templates/beez/html/com_user/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_user/login/index.html b/templates/beez/html/com_user/login/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_user/login/index.html +++ b/templates/beez/html/com_user/login/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_user/register/index.html b/templates/beez/html/com_user/register/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_user/register/index.html +++ b/templates/beez/html/com_user/register/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_user/remind/index.html b/templates/beez/html/com_user/remind/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_user/remind/index.html +++ b/templates/beez/html/com_user/remind/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_user/reset/index.html b/templates/beez/html/com_user/reset/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_user/reset/index.html +++ b/templates/beez/html/com_user/reset/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_user/user/index.html b/templates/beez/html/com_user/user/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_user/user/index.html +++ b/templates/beez/html/com_user/user/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_weblinks/categories/index.html b/templates/beez/html/com_weblinks/categories/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_weblinks/categories/index.html +++ b/templates/beez/html/com_weblinks/categories/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_weblinks/category/index.html b/templates/beez/html/com_weblinks/category/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_weblinks/category/index.html +++ b/templates/beez/html/com_weblinks/category/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_weblinks/index.html b/templates/beez/html/com_weblinks/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_weblinks/index.html +++ b/templates/beez/html/com_weblinks/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/com_weblinks/weblinks/index.html b/templates/beez/html/com_weblinks/weblinks/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/com_weblinks/weblinks/index.html +++ b/templates/beez/html/com_weblinks/weblinks/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/index.html b/templates/beez/html/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/index.html +++ b/templates/beez/html/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/mod_latestnews/index.html b/templates/beez/html/mod_latestnews/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/mod_latestnews/index.html +++ b/templates/beez/html/mod_latestnews/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/mod_login/index.html b/templates/beez/html/mod_login/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/mod_login/index.html +++ b/templates/beez/html/mod_login/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/mod_newsflash/index.html b/templates/beez/html/mod_newsflash/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/mod_newsflash/index.html +++ b/templates/beez/html/mod_newsflash/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/mod_poll/index.html b/templates/beez/html/mod_poll/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/mod_poll/index.html +++ b/templates/beez/html/mod_poll/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/html/mod_search/default.php b/templates/beez/html/mod_search/default.php index 3fb5a11df9ac0..650d27f4cb7b3 100644 --- a/templates/beez/html/mod_search/default.php +++ b/templates/beez/html/mod_search/default.php @@ -8,39 +8,39 @@ '; + $output = ''; if ($button) : - if ($imagebutton) : - $button = ''; - else : - $button = ''; - endif; + if ($imagebutton) : + $button = ''; + else : + $button = ''; + endif; endif; switch ($button_pos) : - case 'top' : - $button = $button.'
              '; - $output = $button.$output; - break; + case 'top' : + $button = $button.'
              '; + $output = $button.$output; + break; - case 'bottom' : - $button = '
              '.$button; - $output = $output.$button; - break; + case 'bottom' : + $button = '
              '.$button; + $output = $output.$button; + break; - case 'right' : - $output = $output.$button; - break; + case 'right' : + $output = $output.$button; + break; - case 'left' : - default : - $output = $button.$output; - break; + case 'left' : + default : + $output = $button.$output; + break; endswitch; echo $output; - ?> + ?> diff --git a/templates/beez/html/mod_search/index.html b/templates/beez/html/mod_search/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/html/mod_search/index.html +++ b/templates/beez/html/mod_search/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/images/index.html b/templates/beez/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/images/index.html +++ b/templates/beez/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/images_general/index.html b/templates/beez/images_general/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/images_general/index.html +++ b/templates/beez/images_general/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/index.html b/templates/beez/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/index.html +++ b/templates/beez/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/beez/javascript/index.html b/templates/beez/javascript/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/beez/javascript/index.html +++ b/templates/beez/javascript/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/rhuk_milkyway/css/index.html b/templates/rhuk_milkyway/css/index.html index fa6d84e8055f5..42682b4746225 100755 --- a/templates/rhuk_milkyway/css/index.html +++ b/templates/rhuk_milkyway/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/rhuk_milkyway/css/template.css b/templates/rhuk_milkyway/css/template.css index 23881eb10f2af..ab1776d036a90 100755 --- a/templates/rhuk_milkyway/css/template.css +++ b/templates/rhuk_milkyway/css/template.css @@ -300,7 +300,7 @@ td.pill_r { #maincolumn_full { margin-left: 0; - padding: 0; + padding: 0; width: 100%; } @@ -553,7 +553,7 @@ td.sectiontableentry2 { table.contentpaneopen, table.contentpane { margin: 0; padding: 0; - width: auto; + width: 100%; } table.contentpaneopen li { diff --git a/templates/rhuk_milkyway/css/template_rtl.css b/templates/rhuk_milkyway/css/template_rtl.css index 4b87963b8d76c..87fde9de47f95 100644 --- a/templates/rhuk_milkyway/css/template_rtl.css +++ b/templates/rhuk_milkyway/css/template_rtl.css @@ -14,7 +14,6 @@ /** * Joomla! 1.5 rhuk_milkway template RTL css file * - * @author Mati Kochen * @package Joomla * @since 1.5 * @version 1.0 diff --git a/templates/rhuk_milkyway/css/white.css b/templates/rhuk_milkyway/css/white.css index aa05fca77190e..7f840d3f89431 100644 --- a/templates/rhuk_milkyway/css/white.css +++ b/templates/rhuk_milkyway/css/white.css @@ -20,10 +20,6 @@ a:hover { color: #fff; } -h3, div.module_menu h3, .componentheading, table.moduletable th { - color: #135cae; -} - h3, .componentheading, table.moduletable th { color: #135cae; } diff --git a/templates/rhuk_milkyway/html/index.html b/templates/rhuk_milkyway/html/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/rhuk_milkyway/html/index.html +++ b/templates/rhuk_milkyway/html/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/rhuk_milkyway/images/black/index.html b/templates/rhuk_milkyway/images/black/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/rhuk_milkyway/images/black/index.html +++ b/templates/rhuk_milkyway/images/black/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/rhuk_milkyway/images/blue/index.html b/templates/rhuk_milkyway/images/blue/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/rhuk_milkyway/images/blue/index.html +++ b/templates/rhuk_milkyway/images/blue/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/rhuk_milkyway/images/green/index.html b/templates/rhuk_milkyway/images/green/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/rhuk_milkyway/images/green/index.html +++ b/templates/rhuk_milkyway/images/green/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/rhuk_milkyway/images/index.html b/templates/rhuk_milkyway/images/index.html index fa6d84e8055f5..42682b4746225 100755 --- a/templates/rhuk_milkyway/images/index.html +++ b/templates/rhuk_milkyway/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/rhuk_milkyway/images/orange/index.html b/templates/rhuk_milkyway/images/orange/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/rhuk_milkyway/images/orange/index.html +++ b/templates/rhuk_milkyway/images/orange/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/rhuk_milkyway/images/red/index.html b/templates/rhuk_milkyway/images/red/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/rhuk_milkyway/images/red/index.html +++ b/templates/rhuk_milkyway/images/red/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/rhuk_milkyway/images/white/index.html b/templates/rhuk_milkyway/images/white/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/rhuk_milkyway/images/white/index.html +++ b/templates/rhuk_milkyway/images/white/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/rhuk_milkyway/index.html b/templates/rhuk_milkyway/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/rhuk_milkyway/index.html +++ b/templates/rhuk_milkyway/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/system/css/general.css b/templates/system/css/general.css index be590f182cee5..c5e9a97a42922 100644 --- a/templates/system/css/general.css +++ b/templates/system/css/general.css @@ -85,10 +85,6 @@ label.invalid { color: #ff0000; } background: url(../images/j_button2_pagebreak.png) 100% 0 no-repeat; } -.button2-left .blank { - background: url(../images/j_button2_blank.png) 100% 0 no-repeat; -} - /* Tooltips */ div.tooltip { float: left; diff --git a/templates/system/css/index.html b/templates/system/css/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/system/css/index.html +++ b/templates/system/css/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/system/css/offline_rtl.css b/templates/system/css/offline_rtl.css index ad57e7c1e265e..00d7a8034bef8 100644 --- a/templates/system/css/offline_rtl.css +++ b/templates/system/css/offline_rtl.css @@ -14,7 +14,6 @@ /** * Joomla! 1.5 Offline RTL css file * - * @author Mati Kochen * @package Joomla * @since 1.5 * @version 1.0 diff --git a/templates/system/error.php b/templates/system/error.php index ef6e32faa0b6b..0410964ddfc20 100644 --- a/templates/system/error.php +++ b/templates/system/error.php @@ -15,14 +15,14 @@ - <?php echo $this->error->code ?> - <?php echo $this->title; ?> + <?php echo $this->error->get('code') ?> - <?php echo $this->title; ?>
              -
              error->code ?> - error->message ?>
              +
              error->get('code') ?> - error->get('message') ?>

                @@ -34,16 +34,16 @@

              -

              -

                -
              • -
              -

              +
                +
              • +

              -

              error->message; ?>

              +

              error->get('message'); ?>

              debug) : + print_r($this->error->get('info')); + echo '


              '; echo $this->renderBacktrace(); endif; ?>

              diff --git a/templates/system/html/index.html b/templates/system/html/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/system/html/index.html +++ b/templates/system/html/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/system/images/index.html b/templates/system/images/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/system/images/index.html +++ b/templates/system/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/system/images/report.png b/templates/system/images/report.png new file mode 100644 index 0000000000000000000000000000000000000000..4cefabd7e1f12ff74859e7dc8e88890098c72908 GIT binary patch literal 868 zcmcgqTWb?R6rNgzSS_r+SW3YJ+J_XaOQWjuMwr$sTu?O4@iORHitX0&M6dFpi;&AjD9lu+En2 z5KKcwl@(Q&B`SF!RAe|_lA#P0CIU@L6VWZpiY!A_N=mYfL@!GME9np=87DoWD4RY& zeL&mqhH)PQY@vJpHDC2eA>Px+cl$p9W>ZI(`Q7VB!iOaQYJOL;$~WCH!J7?*V1J=6 zcf2r~%4b0LvE0#&GnCC|Mss;la{Bw)CrGIBRkl^;{P|3(kj)J{6WJ3P5XxtrZSBte zCx@JEt*srLIz1ho+-z^<_>^lo&Ce}G0^Nza+v#_2!N&ee9~#f^?Vb0Q_s})XjTo#| z7I$`r&TfjiB1NHk_E~yxtm|4)nam}JCtSCL>n|sBr=oMaZV9g@(}NG6Z<#6H9}~|w zcgzTn9zH&Jq2Z=K@p5N0eCSPckA-Rm+B!oA(DrH$JUh*yf|rs2Ng z+|<fHgUVQaUPb<-( p=wkG5%=L4jT>e%L2=DUMHC5ngQ}6enzh2=_1Cd});EC_Zg@1X(<8uH2 literal 0 HcmV?d00001 diff --git a/templates/system/index.html b/templates/system/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/templates/system/index.html +++ b/templates/system/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/tmp/index.html b/tmp/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/tmp/index.html +++ b/tmp/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/xmlrpc/cache/index.html b/xmlrpc/cache/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/xmlrpc/cache/index.html +++ b/xmlrpc/cache/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/xmlrpc/includes/framework.php b/xmlrpc/includes/framework.php index a1086b032b0b7..6cbf9b3fd4a9e 100644 --- a/xmlrpc/includes/framework.php +++ b/xmlrpc/includes/framework.php @@ -33,10 +33,10 @@ */ // System includes -require_once( JPATH_LIBRARIES .DS.'joomla'.DS.'import.php'); +require_once JPATH_LIBRARIES .DS.'joomla'.DS.'import.php'; // Pre-Load configuration -require_once( JPATH_CONFIGURATION .DS.'configuration.php' ); +require_once JPATH_CONFIGURATION .DS.'configuration.php'; // System configuration $CONFIG = new JConfig(); diff --git a/xmlrpc/includes/index.html b/xmlrpc/includes/index.html index fa6d84e8055f5..42682b4746225 100644 --- a/xmlrpc/includes/index.html +++ b/xmlrpc/includes/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file