- Timestamp:
- 12/03/08 07:58:25 (12 months ago)
- Location:
- trunk
- Files:
-
- 70 modified
-
default_templates/about_this_page.mtml (modified) (2 diffs)
-
default_templates/commenter_confirm.mtml (modified) (1 diff)
-
default_templates/current_author_monthly_archive_list.mtml (modified) (1 diff)
-
lib/MT.pm (modified) (14 diffs)
-
lib/MT/App.pm (modified) (6 diffs)
-
lib/MT/App/ActivityFeeds.pm (modified) (2 diffs)
-
lib/MT/App/Comments.pm (modified) (6 diffs)
-
lib/MT/App/Search.pm (modified) (1 diff)
-
lib/MT/ArchiveType/Author.pm (modified) (2 diffs)
-
lib/MT/ArchiveType/Category.pm (modified) (2 diffs)
-
lib/MT/ArchiveType/Individual.pm (modified) (2 diffs)
-
lib/MT/Bootstrap.pm (modified) (2 diffs)
-
lib/MT/CMS/Blog.pm (modified) (1 diff)
-
lib/MT/CMS/Dashboard.pm (modified) (2 diffs)
-
lib/MT/CMS/Entry.pm (modified) (2 diffs)
-
lib/MT/CMS/Search.pm (modified) (1 diff)
-
lib/MT/CMS/Tools.pm (modified) (1 diff)
-
lib/MT/CMS/User.pm (modified) (3 diffs)
-
lib/MT/DefaultTemplates.pm (modified) (3 diffs)
-
lib/MT/ImportExport.pm (modified) (7 diffs)
-
lib/MT/L10N/ja.pm (modified) (1 diff)
-
lib/MT/Sanitize.pm (modified) (1 diff)
-
lib/MT/Template/ContextHandlers.pm (modified) (12 diffs)
-
lib/MT/Util.pm (modified) (1 diff)
-
php/lib/MTUtil.php (modified) (1 diff)
-
php/lib/archive_lib.php (modified) (19 diffs)
-
php/lib/function.mtcommentauthorlink.php (modified) (4 diffs)
-
php/lib/function.mtcommentreplytolink.php (modified) (1 diff)
-
php/lib/function.mtentryauthorlink.php (modified) (4 diffs)
-
php/lib/modifier.sanitize.php (modified) (1 diff)
-
php/lib/sanitize_lib.php (modified) (1 prop)
-
php/mt.php (modified) (2 diffs)
-
plugins/Cloner/cloner.pl (modified) (2 diffs)
-
search_templates/comments.tmpl (modified) (2 diffs)
-
search_templates/default.tmpl (modified) (7 diffs)
-
search_templates/results_feed.tmpl (modified) (1 diff)
-
search_templates/results_feed_rss2.tmpl (modified) (1 diff)
-
t/08-util.t (modified) (3 diffs)
-
t/11-sanitize.t (modified) (2 diffs)
-
t/driver-tests.pl (modified) (18 diffs)
-
tmpl/cms/dialog/comment_reply.tmpl (modified) (1 diff)
-
tmpl/cms/edit_asset.tmpl (modified) (1 diff)
-
tmpl/cms/edit_author.tmpl (modified) (1 diff)
-
tmpl/cms/edit_commenter.tmpl (modified) (1 diff)
-
tmpl/cms/edit_entry.tmpl (modified) (2 diffs)
-
tmpl/cms/edit_role.tmpl (modified) (1 diff)
-
tmpl/cms/include/asset_table.tmpl (modified) (1 diff)
-
tmpl/cms/include/comment_detail.tmpl (modified) (1 diff)
-
tmpl/cms/include/entry_table.tmpl (modified) (1 diff)
-
tmpl/cms/include/header.tmpl (modified) (1 diff)
-
tmpl/cms/include/import_start.tmpl (modified) (1 diff)
-
tmpl/cms/include/list_associations/page_title.tmpl (modified) (1 diff)
-
tmpl/cms/include/list_associations/table_role_view.tmpl (modified) (2 diffs)
-
tmpl/cms/include/list_associations/table_user_view.tmpl (modified) (1 diff)
-
tmpl/cms/include/listing_panel.tmpl (modified) (1 diff)
-
tmpl/cms/include/log_table.tmpl (modified) (1 diff)
-
tmpl/cms/include/template_table.tmpl (modified) (3 diffs)
-
tmpl/cms/include/users_content_nav.tmpl (modified) (3 diffs)
-
tmpl/cms/list_comment.tmpl (modified) (1 diff)
-
tmpl/cms/list_ping.tmpl (modified) (1 diff)
-
tmpl/cms/list_role.tmpl (modified) (1 diff)
-
tmpl/cms/list_template.tmpl (modified) (1 diff)
-
tmpl/cms/popup/rebuild_confirm.tmpl (modified) (1 diff)
-
tmpl/cms/popup/rebuilt.tmpl (modified) (1 diff)
-
tmpl/cms/rebuilding.tmpl (modified) (1 diff)
-
tmpl/cms/widget/blog_stats_entry.tmpl (modified) (2 diffs)
-
tmpl/cms/widget/blog_stats_recent_entries.tmpl (modified) (1 diff)
-
tmpl/cms/widget/blog_stats_tag_cloud.tmpl (modified) (1 diff)
-
tmpl/cms/widget/this_is_you.tmpl (modified) (1 diff)
-
tmpl/comment/profile.tmpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/default_templates/about_this_page.mtml
r2706 r3219 46 46 <mt:If name="author_archive"> 47 47 <mt:If name="datebased_archive"> 48 <p class="first"><__trans phrase="This page is an archive of recent entries written by <strong>[_1]</strong> in <strong>[_2]</strong>." params="<$mt:AuthorDisplayName $>%%<$mt:ArchiveDate format="%B %Y"$>"></p>48 <p class="first"><__trans phrase="This page is an archive of recent entries written by <strong>[_1]</strong> in <strong>[_2]</strong>." params="<$mt:AuthorDisplayName encode_html="1"$>%%<$mt:ArchiveDate format="%B %Y"$>"></p> 49 49 <mt:ArchivePrevious> 50 50 <p><__trans phrase="<a href="[_1]">[_2]</a> is the previous archive." params="<$mt:ArchiveLink$>%%<$mt:ArchiveTitle$>"></p> … … 54 54 </mt:ArchiveNext> 55 55 <mt:Else> 56 <p class="first"><__trans phrase="This page is an archive of recent entries written by <strong>[_1]</strong>." params="<$mt:AuthorDisplayName $>"></p>56 <p class="first"><__trans phrase="This page is an archive of recent entries written by <strong>[_1]</strong>." params="<$mt:AuthorDisplayName encode_html="1"$>"></p> 57 57 </mt:If> 58 58 </mt:If> -
trunk/default_templates/commenter_confirm.mtml
r2604 r3219 12 12 13 13 <__trans phrase="Sincerely,"> 14 <mt:If tag="AuthorDisplayName"><$mt:AuthorDisplayName $><mt:Else>Movable Type</mt:If>14 <mt:If tag="AuthorDisplayName"><$mt:AuthorDisplayName encode_html="1"$><mt:Else>Movable Type</mt:If> 15 15 16 16 <$mt:Include module="<__trans phrase="Mail Footer">"$> -
trunk/default_templates/current_author_monthly_archive_list.mtml
r2648 r3219 3 3 <mt:ArchiveListHeader> 4 4 <div class="widget-archive-current-author-monthly widget-archive widget"> 5 <h3 class="widget-header"><__trans phrase="[_1]: Monthly Archives" params="<$mt:AuthorDisplayName $>"></h3>5 <h3 class="widget-header"><__trans phrase="[_1]: Monthly Archives" params="<$mt:AuthorDisplayName encode_html="1"$>"></h3> 6 6 <div class="widget-content"> 7 7 <ul> -
trunk/lib/MT.pm
r3085 r3219 30 30 $plugins_installed = 0; 31 31 32 ( $VERSION, $SCHEMA_VERSION ) = ( '4.2 1', '4.0068' );32 ( $VERSION, $SCHEMA_VERSION ) = ( '4.23', '4.0068' ); 33 33 ( $PRODUCT_NAME, $PRODUCT_CODE, $PRODUCT_VERSION, $VERSION_ID, $PORTAL_URL ) = ( 34 34 '__PRODUCT_NAME__', 'MT', 35 '4.2 1', '4.21',35 '4.23', '4.23', 36 36 '__PORTAL_URL__' 37 37 ); … … 2159 2159 my $label = $c->label || $pack->{label}; 2160 2160 $label = $label->() if ref($label) eq 'CODE'; 2161 # if the component did not declare a label, 2162 # it isn't wanting to be visible on the app footer. 2163 next if $label eq $c->{plugin_sig}; 2161 2164 push @packs_installed, { 2162 2165 label => $label, … … 2873 2876 =back 2874 2877 2875 =head2 $mt->init 2878 =head2 $mt->init(%params) 2876 2879 2877 2880 Initializes the Movable Type instance, including registration of basic … … 2879 2882 and C<init_plugins> methods. 2880 2883 2884 =head2 $mt->init_core() 2885 2886 A method that the base MT class uses to initialize all the 'core' 2887 functionality of Movable Type. If you want to subclass MT and extensively 2888 modify it's core behavior, this method can be overridden to do that. 2889 The L<MT::Core> module is a L<MT::Component> that defines the core 2890 features of MT, and this method loads that component. Non-core components 2891 are loaded by the L<init_addons> method. 2892 2893 =head2 $mt->init_paths() 2894 2895 Establishes some key file paths for the MT environment. Assigns 2896 C<$MT_DIR>, C<$APP_DIR> and C<$CFG_FILE> package variables. 2897 2898 =head2 $mt->init_permissions() 2899 2900 Loads the L<MT::Permission> class and runs the 2901 MT::Permission->init_permissions method to establish system permissions. 2902 2903 =head2 $mt->init_schema() 2904 2905 Completes the initialization of the Movable Type schema following the 2906 loading of plugins. After this method runs, any MT object class may 2907 safely be used. 2908 2881 2909 =head2 MT->instance 2882 2910 … … 2885 2913 MT->new() is now an alias to instance_of. 2886 2914 2915 =head2 MT->app 2916 2917 An alias for the 'instance' method. 2918 2887 2919 =head2 $class->instance_of 2888 2920 … … 2897 2929 Assigns the active MT instance object. This value is returned when 2898 2930 C<MT-E<gt>instance> is invoked. 2931 2932 =head2 MT->run_app( $pkg, $params ) 2933 2934 Instantiates and runs a MT application (identified by C<$pkg>), passing 2935 the C<$params> hashref as the parameters to the constructor method. This 2936 method is a self-contained version found in L<MT::Bootstrap> and will 2937 eventually be the manner in which MT applications are run (eliminating 2938 the need for the bootstrap module). The MT::import module calls this 2939 method when the MT module is used with an 'App' parameter. So, you can 2940 write a mt.cgi script that looks like this: 2941 2942 #!/usr/bin/perl 2943 use strict; 2944 use lib $ENV{MT_HOME} ? "$ENV{MT_HOME}/lib" : 'lib'; 2945 use MT App => 'MT::App::CMS'; 2899 2946 2900 2947 =head2 $mt->find_config($params) … … 2907 2954 =head2 $mt->init_config($params) 2908 2955 2909 Reads the MT configuration settingss from the MT configuration file 2910 and settings from database (L<MT::Config>). 2956 Reads the MT configuration settingss from the MT configuration file. 2911 2957 2912 2958 The C<$params> parameter is a reference to the hash of settings passed to 2913 2959 the MT constructor. 2914 2960 2915 =head2 $mt->init_plugins 2961 =head2 $mt->init_config_from_db($param) 2962 2963 Reads any MT configuration settings from the MT database (L<MT::Config>). 2964 2965 The C<$params> parameter is a reference to the hash of settings passed to 2966 the MT constructor. 2967 2968 =head2 $mt->init_addons(%param) 2969 2970 Loads any discoverable addons that are available. This is called from 2971 the C<init> method, after C<init_config> method has loaded the 2972 configuration settings, but prior to making a database connection. 2973 2974 =head2 $mt->init_plugins(%param) 2916 2975 2917 2976 Loads any discoverable plugins that are available. This is called from … … 2919 2978 configuration settings. 2920 2979 2921 =head2 $mt->init_tasks 2980 =head2 $mt->init_callbacks() 2981 2982 Installs any MT callbacks. This is called from the C<init> method very, 2983 early; prior to loading any addons or plugins. 2984 2985 =head2 $mt->init_tasks() 2922 2986 2923 2987 Registers the standard set of periodic tasks that Movable Type provides … … 2929 2993 through L<MT::TaskMgr> to run any registered tasks that are pending 2930 2994 execution. See L<MT::TaskMgr> for further documentation. 2995 2996 =head2 MT->find_addons( $type ) 2997 2998 Returns an array of all 'addons' that are found within the MT 'addons' 2999 directory of the given C<$type>. What is returned is an array reference 3000 of hash data. Each hash will contain these elements: 'label' (the name 3001 of the addon), 'id' (the unique identifier of the addon), 'envelope' 3002 (the subpath of the addon, relative to the MT home directory), and 'path' 3003 (the full path to the addon subdirectory). 2931 3004 2932 3005 =head2 MT->unplug … … 3242 3315 C<callback_error> routine. 3243 3316 3317 =head2 MT->handler_to_coderef($handler[, $delayed]) 3318 3319 Translates a registry handler signature into a Perl coderef. Handlers 3320 are in one of the following forms: 3321 3322 $<COMPONENTID>::<PERL_PACKAGE>::<SUBROUTINE> 3323 3324 <PERL_PACKAGE>::<SUBROUTINE> 3325 3326 <PERL_PACKAGE>-><SUBROUTINE> 3327 3328 sub { ... } 3329 3330 When invoked with a '-E<gt>' operator, the subroutine is invoked as 3331 a package method. 3332 3333 When the handler is a string that starts with 'sub {', it is eval'd 3334 to compile it, and the resulting coderef is returned. 3335 3336 The coderef that is returned can be passed any parameters you wish. 3337 3338 When the coderef is invoked, any component that was identified in 3339 the handler signature becomes the active component when running the 3340 code (this affects how strings are translated, and the search paths 3341 for templates that are loaded). 3342 3343 If the C<$delayed> parameter is given, a special coderef is constructed 3344 that will delay the 'require' of the identified Perl package until 3345 the coderef is actually invoked. 3346 3347 =head2 MT->registry( @path ) 3348 3349 Queries the Movable Type registry data structure for a given resource 3350 path. The MT registry is a collection of hash structures that contain 3351 resources MT and/or plugins can utilize. 3352 3353 When this method is invoked, it actually issues a registry request 3354 against each component registered with MT, then merges the resulting 3355 hashes and returns them. See L<MT::Component> for further details. 3356 3357 =head2 MT->component( $id ) 3358 3359 Returns a loaded L<MT::Component> based on the requested C<$id> parameter. 3360 For example: 3361 3362 # Returns the MT 'core' component 3363 MT->component('core'); 3364 3365 =head2 MT->model( $id ) 3366 3367 Returns a Perl package name for the MT object type identified by C<$id>. 3368 For example: 3369 3370 # Assigns (by default) 'MT::Blog' to $blog_class 3371 my $blog_class = MT->model('blog'); 3372 3373 It is a recommended practice to utilize the model method to derive the 3374 implementation package name, instead of hardcoding Perl package names. 3375 3376 =head2 MT->models( $id ) 3377 3378 Returns a list of object types that are registered as sub-types. For 3379 instance, the MT 'asset' object type has several sub-types associated 3380 with it: 3381 3382 my @types = MT->models('asset'); 3383 # @types now contains ('asset', 'asset.image', 'asset.video', etc.) 3384 3244 3385 =head2 MT->product_code 3245 3386 … … 3258 3399 and C<version_number> methods as they report the API version information. 3259 3400 3401 =head2 MT->VERSION 3402 3403 Returns the API version of MT. When using the MT module with the version 3404 requirement, this method will also load the suitable API 'compatibility' 3405 module, if available. For instance, if your plugin declares: 3406 3407 use MT 4; 3408 3409 Then, once MT 5 is available, that statement will cause the C<VERSION> method 3410 to attempt to load a module named "MT::Compat::v4". This module would contain 3411 compatibility support for MT 4-based plugins. 3412 3260 3413 =head2 MT->version_id 3261 3414 … … 3272 3425 Returns the version of the MT database schema. 3273 3426 3427 =head2 $mt->id 3428 3429 Provides an identifier for the application, one that relates to the 3430 'application' paths of the MT registry. This method may be overridden 3431 for any subclass of MT to provide the appropriate identifier. By 3432 default, the base 'id' method will return an id taken from the 3433 Perl package name, by stripping off any 'MT::App::' prefix, and lowercasing 3434 the remaining string. 3435 3274 3436 =head2 MT->version_slug 3275 3437 … … 3296 3458 An alias to L<MT::WeblogPublisher::rebuild_indexes>. See 3297 3459 L<MT::WeblogPublisher> for documentation of this method. 3460 3461 =head2 $mt->rebuild_archives 3462 3463 An alias to L<MT::WeblogPublisher::rebuild_archives>. See 3464 L<MT::WeblogPublisher> for documentation of this method. 3465 3466 =head2 $app->template_paths 3467 3468 Returns an array of directory paths where application templates exist. 3469 3470 =head2 $app->find_file(\@paths, $filename) 3471 3472 Returns the path and filename for a file found in any of the given paths. 3473 If the file cannot be found, it returns undef. 3474 3475 =head2 $app->load_tmpl($file[, @params]) 3476 3477 Loads a L<MT::Template> template using the filename specified. See the 3478 documentation for the C<build_page> method to learn about how templates 3479 are located. The optional C<@params> are passed to the L<MT::Template> 3480 constructor. 3481 3482 =head2 $app->set_default_tmpl_params($tmpl) 3483 3484 Assigns standard parameters to the given L<MT::Template> C<$tmpl> object. 3485 Refer to the L<STANDARD APPLICATION TEMPLATE PARAMETERS> section for a 3486 complete list of these parameters. 3487 3488 =head2 $app->charset( [$charset] ) 3489 3490 Gets or sets the application's character set based on the "PublishCharset" 3491 configuration setting or the encoding of the active language 3492 (C<$app-E<gt>current_language>). 3493 3494 =head2 $app->build_page($tmpl_name, \%param) 3495 3496 Builds an application page to be sent to the client; the page name is specified 3497 in C<$tmpl_name>, which should be the name of a template containing valid 3498 L<MT::Template> markup. C<\%param> is a hash ref whose keys and values will 3499 be passed to L<MT::Template::param> for use in the template. 3500 3501 On success, returns a scalar containing the page to be sent to the client. On 3502 failure, returns C<undef>, and the error message can be obtained from 3503 C<$app-E<gt>errstr>. 3504 3505 =head3 How does build_page find a template? 3506 3507 The C<build_page> function looks in several places for an app 3508 template. Two configuration directives can modify these search paths, 3509 and application and plugin code can also affect them. 3510 3511 The I<TemplatePath> config directive is an absolute path to the directory 3512 where MT's core application templates live. It defaults to the I<mt_dir> 3513 plus an additional path segment of 'tmpl'. 3514 3515 The optional I<AltTemplatePath> config directive is a path (absolute 3516 or relative) to a directory where some 'override templates' may 3517 live. An override template takes the place of one of MT's core 3518 application templates, and is used interchangeably with the core 3519 template. This allows power users to customize the look and feel of 3520 the MT application. If I<AltTemplatePath> is relative, its base path 3521 is the value of the Movable Type configuration file. 3522 3523 Next, any application built on the C<MT::App> foundation can define 3524 its own I<template_dir> parameter, which identifies a subdirectory of 3525 TemplatePath (or AltTemplatePath) where that application's templates 3526 can be found. I<template_dir> defaults to C<cms>. Most templates will 3527 be found in this directory, but sometimes the template search will 3528 fall through to the parent directory, where a default error template 3529 is found, for example. I<template_dir> should rightly have been named 3530 I<application_template_dir>, since it is application-specific. 3531 3532 Finally, a plugin can specify its I<plugin_template_path>, which 3533 locates a directory where the templates for that plugin's own 3534 interface are found. If the I<plugin_template_path> is relative, it 3535 may be relative to either the I<app_dir>, or the I<mt_dir>; the former 3536 takes precedence if it exists. (for a definition of I<app_dir> and 3537 I<mt_dir>, see L<MT>) 3538 3539 Given these values, the order of search is as follows: 3540 3541 =over 4 3542 3543 =item * I<plugin_template_path> 3544 3545 =item * I<AltTemplatePath> 3546 3547 =item * I<AltTemplatePath>F</>I<template_dir> 3548 3549 =item * I<TemplatePath>/I<template_dir> 3550 3551 =item * I<TemplatePath> 3552 3553 =back 3554 3555 If a template with the given name is not found in any of these 3556 locations, an ugly error is thrown to the user. 3557 3558 =head2 $app->build_page_in_mem($tmpl, \%param) 3559 3560 Used internally by the L<build_page> method to render the output 3561 of a L<MT::Template> object (the first parameter) using the parameter 3562 data (the second parameter). It additionally calls the L<process_mt_template> 3563 method (to process any E<lt>MT_ACTIONE<gt> and E<lt>MT_X:YE<gt> marker tags) 3564 and then L<translate_templatized> (to process any E<lt>MT_TRANSE<gt> tags). 3565 3566 =head2 $app->process_mt_template($str) 3567 3568 Processes the E<lt>__action<gt> tags that are present in C<$str>. These tags 3569 are in the following format: 3570 3571 <__action mode="mode_name" parameter="value"> 3572 3573 The mode parameter is required (and must be the first attribute). The 3574 following attributes are appended as regular query parameters. 3575 3576 The MT_ACTION tag is a preferred way to specify application links rather 3577 than using this syntax: 3578 3579 <mt:var name="script_url">?__mode=mode_name¶meter=value 3580 3581 C<process_mt_templates> also strips the C<$str> variable of any tags in 3582 the format of C<E<lt>MT_\w+:\w+E<gt>>. These are 'marker' tags that are 3583 used to identify specific portions of the template page and used in 3584 conjunction with the transformer callback helper methods C<tmpl_prepend>, 3585 C<tmpl_append>, C<tmpl_replace>, C<tmpl_select>. 3298 3586 3299 3587 =head2 $mt->build_email($file, $param) … … 3310 3598 entry that is scheduled for publishing. The return value is the timestamp 3311 3599 in UTC time in the format "YYYY-MM-DDTHH:MM:SSZ". 3600 3601 =head2 $mt->commenter_authenticator($id) 3602 3603 Returns a specific comment authenication option using the identifier 3604 C<$id> parameter. 3605 3606 =head2 $mt->commenter_authenticators() 3607 3608 Returns the available comment authentication identifiers that are 3609 installed in the MT registry. 3610 3611 =head2 $mt->core_commenter_authenticators() 3612 3613 A method that returns the MT-supplied comment authentication registry 3614 data. 3615 3616 =head2 $mt->init_commenter_authenticators() 3617 3618 Initializes the list of installed MT comment authentication options, 3619 drawing from the MT registry. 3620 3621 =head2 $mt->captcha_provider($id) 3622 3623 Returns a specific CAPTCHA provider configuration using the identifier 3624 C<$id> parameter. This is a convenience method that accesses the CAPTCHA 3625 providers installed into the MT registry. 3626 3627 =head2 $mt->captcha_providers() 3628 3629 Returns the available CAPTCHA providers. This is a convenience method 3630 that accesses the MT registry for available CAPTCHA providers (it also 3631 invokes the 'condition' key for each provider to filter the list). 3632 3633 =head2 $mt->core_captcha_providers() 3634 3635 A method that returns the MT-supplied CAPTCHA provider registry data. 3636 3637 =head2 $mt->init_captcha_providers() 3638 3639 Initializes the list of installed CAPTCHA providers, drawing from 3640 the MT registry. 3641 3642 =head2 $mt->effective_captcha_provider() 3643 3644 Returns the Perl package name for the configured CAPTCHA provider. 3645 3646 =head2 $app->static_path() 3647 3648 Returns the application's static web path. 3649 3650 =head2 $app->static_file_path() 3651 3652 Returns the application's static file path. 3653 3654 =head2 MT::core_upload_file_to_sync 3655 3656 A MT callback handler routine that forwards to the L<upload_file_to_sync> 3657 method. 3658 3659 =head2 MT->upload_file_to_sync(%param) 3660 3661 A routine that will make record of a file that is to be transmitted 3662 to one or more servers (typically via rsync). This method runs when 3663 the C<SyncTarget> MT configuration setting is configured. Normally 3664 published files are automatically processed for syncing operations, 3665 but this routine is used for files that are created through other 3666 means, such as uploading an asset. 3667 3668 =head2 MT->help_url( [ $suffix ] ) 3669 3670 Returns a help URL for the application. This method is used to construct 3671 the URL directing users to online documentation. If called without any 3672 parameters, it returns the base URL for providing help. If a parameter is 3673 given, the URL is appended with the given subpath. The base URL by default 3674 is 'http://www.movabletype.org/documentation/'. This string is passed 3675 through MT's localization modules, so it can be changed on a per-language 3676 basis. The C<$suffix> parameter, however, is always appended to this base URL. 3677 3678 =head2 MT->get_timer 3679 3680 Returns an instance of L<MT::Util::ReqTimer> for use in timing MT's 3681 operations. 3682 3683 =head2 MT->log_times 3684 3685 Used as part of Movable Type's performance logging framework. This method 3686 is called internally, once at the startup of Movable Type, and once as it 3687 is shutting down. 3688 3689 =head2 MT->time_this($string, $code) 3690 3691 Utility method to time a particular routine. This will log the execution 3692 time of the C<$code> coderef with the identifying phrase C<$string> using 3693 MT's performance logging framework. 3694 3695 =head2 MT::refresh_cache($cb) 3696 3697 A callback handler that invalidates the cache of MT's caching driver. 3698 See L<MT::Cache::Negotiate>. 3699 3700 =head2 MT->register_refresh_cache_event($callback) 3701 3702 Registers a callback that will cause the MT cache to invalidate itself. 3703 See L<MT::Cache::Negotiate>. 3312 3704 3313 3705 =head1 ERROR HANDLING -
trunk/lib/MT/App.pm
r3082 r3219 1974 1974 1975 1975 $url = $q->param('url'); 1976 if ( $url && !is_url($url) ) {1976 if ( $url && (!is_url($url) || ($url =~ m/[<>]/)) ) { 1977 1977 return $app->error( $app->translate("URL is invalid.") ); 1978 1978 } … … 1987 1987 return $app->error( $app->translate("User requires username.") ); 1988 1988 } 1989 if ( $name =~ m/([<>])/) { 1990 return $app->error( $app->translate("[_1] contains an invalid character: [_2]", $app->translate("Username"), encode_html( $1 ) ) ); 1991 } 1989 1992 1990 1993 my $existing = MT::Author->exist( { name => $name } ); … … 1996 1999 unless ($nickname) { 1997 2000 return $app->error( $app->translate("User requires display name.") ); 2001 } 2002 if ( $nickname =~ m/([<>])/) { 2003 return $app->error( $app->translate("[_1] contains an invalid character: [_2]", $app->translate("Display Name"), encode_html( $1 ) ) ); 1998 2004 } 1999 2005 … … 2004 2010 return $app->error( 2005 2011 $app->translate("Email Address is invalid.") ); 2012 } 2013 2014 if ( $email =~ m/([<>])/) { 2015 return $app->error( $app->translate("[_1] contains an invalid character: [_2]", $app->translate("Email Address"), encode_html( $1 ) ) ); 2006 2016 } 2007 2017 } … … 2399 2409 my $url = $app->uri; 2400 2410 my $blog_id = $app->param('blog_id'); 2411 2401 2412 if ( ref $param ne 'HASH' ) { 2402 2403 2413 # old scalar signature 2404 2414 $param = { error => $param }; 2405 2415 } 2406 2416 2407 if ( $MT::DebugMode && $@ ) { 2408 $param->{error} = '<pre>' . encode_html( $param->{error} ) . '</pre>'; 2417 my $error = $param->{error}; 2418 2419 if ( $MT::DebugMode ) { 2420 if ( $@ ) { 2421 # Use 'pre' tag to wrap Perl error 2422 $error = '<pre>' . encode_html( $error ) . '</pre>'; 2423 } 2409 2424 } 2410 2425 else { 2411 $param->{error} = encode_html( $param->{error} ); 2412 $param->{error} 2426 if ($error =~ m/^(.+?)( at .+? line \d+)(.*)$/s) { 2427 # Hide any module path info from perl error message 2428 # Information could be revealing info about where MT app 2429 # resides on server, and what version is being used, which 2430 # may be helpful forensics to an attacker. 2431 $error = $1; 2432 } 2433 $error = encode_html( $error ); 2434 $error 2413 2435 =~ s!(https?://\S+)!<a href="$1" target="_blank">$1</a>!g; 2414 2436 } 2415 $tmpl = $app->load_tmpl('error.tmpl') 2416 or return "Can't load error template; got error '" 2417 . encode_html( $app->errstr ) 2418 . "'. Giving up. Original error was <pre>$param->{error}</pre>"; 2437 2438 $tmpl = $app->load_tmpl('error.tmpl'); 2439 if (!$tmpl) { 2440 $error = '<pre>' . $error . '</pre>' unless $error =~ m/<pre>/; 2441 return "Can't load error template; got error '" 2442 . encode_html( $app->errstr ) 2443 . "'. Giving up. Original error was: $error"; 2444 } 2419 2445 my $type = $app->param('__type') || ''; 2420 2446 if ( $type eq 'dialog' ) { … … 2428 2454 $param->{value} ||= $app->{value} || $app->translate("Go Back"); 2429 2455 } 2456 local $param->{error} = $error; 2430 2457 $tmpl->param($param); 2431 2458 my $out = $tmpl->output; 2432 2459 if ( !defined $out ) { 2460 $error = '<pre>' . $error . '</pre>' unless $error =~ m/<pre>/; 2433 2461 return 2434 2462 "Can't build error template; got error '" 2435 2463 . encode_html( $tmpl->errstr ) 2436 . "'. Giving up. Original error was <pre>$param->{error}</pre>";2464 . "'. Giving up. Original error was: $error"; 2437 2465 } 2438 2466 return $app->l10n_filter($out); -
trunk/lib/MT/App/ActivityFeeds.pm
r2986 r3219 11 11 use MT::Author qw(AUTHOR); 12 12 use MT::Util qw(perl_sha1_digest_hex ts2epoch epoch2ts ts2iso iso2ts 13 encode_html );13 encode_html encode_url); 14 14 use HTTP::Date qw(time2isoz str2time time2str); 15 15 … … 260 260 my $str = qq(); 261 261 for my $key ( $app->param ) { 262 $str .= "& $key=" . $app->param($key);262 $str .= "&" . encode_url($key) . "=" . encode_url($app->param($key)); 263 263 } 264 264 $str =~ s/^&(.+)$/?$1/; -
trunk/lib/MT/App/Comments.pm
r3098 r3219 1750 1750 my ( $sess_obj, $commenter ) = $app->get_commenter_session(); 1751 1751 if ($commenter) { 1752 $app->user($commenter); 1752 1753 $app->{session} = $sess_obj; 1753 1754 … … 1776 1777 hint => $commenter->hint, 1777 1778 url => $commenter->url, 1779 blog_id => $blog_id, 1778 1780 $entry_id ? ( entry_url => $url ) : ( return_url => $url ), 1779 1781 }; … … 1799 1801 my %param 1800 1802 = map { $_ => scalar( $q->param($_) ) } 1801 qw( name nickname email password pass_verify hint url entry_url return_url external_auth); 1803 qw( name nickname email password pass_verify hint url entry_url return_url external_auth blog_id ); 1804 $param{blog_id} =~ s/\D//g if defined $param{blog_id}; 1802 1805 1803 1806 $param{ 'auth_mode_' . $cmntr->auth_type } = 1; … … 1805 1808 $app->user($cmntr); 1806 1809 $app->{session} = $sess_obj; 1810 1807 1811 my $original = $cmntr->clone(); 1808 1812 … … 1811 1815 1812 1816 unless ( $param{external_auth} ) { 1813 unless ( $param{nickname} && $param{email} && $param{hint} ) { 1817 my $nickname = $param{nickname}; 1818 unless ( $nickname && $param{email} && $param{hint} ) { 1814 1819 $param{error} = $app->translate( 1815 1820 'All required fields must have valid values.'); 1816 1821 return $app->build_page( 'profile.tmpl', \%param ); 1817 1822 } 1823 if ( $nickname =~ m/([<>])/) { 1824 $param{error} = $app->translate("[_1] contains an invalid character: [_2]", $app->translate("Display Name"), encode_html( $1 ) ); 1825 return $app->build_page( 'profile.tmpl', \%param ); 1826 } 1818 1827 if ( $param{password} ne $param{pass_verify} ) { 1819 1828 $param{error} = $app->translate('Passwords do not match.'); … … 1821 1830 } 1822 1831 } 1823 if ( $param{email} && !is_valid_email( $param{email} ) ) { 1832 my $email = $param{email}; 1833 if ( $email && !is_valid_email( $email ) ) { 1824 1834 $param{error} = $app->translate('Email Address is invalid.'); 1825 1835 return $app->build_page( 'profile.tmpl', \%param ); 1826 1836 } 1827 if ( $param{url} && !is_url( $param{url} ) ) { 1837 if ( $email && $email =~ m/([<>])/) { 1838 $param{error} = $app->translate("[_1] contains an invalid character: [_2]", $app->translate("Email Address"), encode_html( $1 ) ); 1839 return $app->build_page( 'profile.tmpl', \%param ); 1840 } 1841 if ( $param{url} && (!is_url( $param{url} ) || ($param{url} =~ m/[<>]/) ) ) { 1828 1842 $param{error} = $app->translate('URL is invalid.'); 1829 1843 return $app->build_page( 'profile.tmpl', \%param ); -
trunk/lib/MT/App/Search.pm
r3082 r3219 84 84 85 85 my $q = $app->param; 86 87 # These parameters are strictly numeric; invalid request if they 88 # are given and are not 89 foreach my $param ( qw( blog_id limit offset SearchMaxResults ) ) { 90 my $val = $q->param($param); 91 next unless defined $val && ($val ne ''); 92 return $app->errtrans( 'Invalid [_1] parameter.', $param ) 93 if $val !~ m/^\d+$/; 94 } 95 foreach my $param ( qw( IncludeBlogs ExcludeBlogs ) ) { 96 my $val = $q->param($param); 97 next unless defined $val && ($val ne ''); 98 return $app->errtrans( 'Invalid [_1] parameter.', $param ) 99 if $val !~ m/^(\d+,?)+$/; 100 } 86 101 87 102 my $params = $app->registry( $app->mode, 'params' ); -
trunk/lib/MT/ArchiveType/Author.pm
r2227 r3219 9 9 use strict; 10 10 use base qw( MT::ArchiveType ); 11 12 use MT::Util qw( remove_html encode_html ); 11 13 12 14 sub name { … … 50 52 my ($ctx) = @_; 51 53 my $a = $ctx->stash('author'); 52 $a ? $a->nickname || MT->translate( '(Display Name not set)' ) : '';54 encode_html( remove_html( $a ? $a->nickname || MT->translate( '(Display Name not set)' ) : '' ) ); 53 55 } 54 56 -
trunk/lib/MT/ArchiveType/Category.pm
r2737 r3219 9 9 use strict; 10 10 use base qw( MT::ArchiveType ); 11 12 use MT::Util qw( remove_html encode_html ); 11 13 12 14 sub name { … … 50 52 my ($ctx) = @_; 51 53 my $c = $ctx->stash('category'); 52 $c ? $c->label : '';54 encode_html( remove_html( $c ? $c->label : '' ) ); 53 55 } 54 56 -
trunk/lib/MT/ArchiveType/Individual.pm
r1741 r3219 9 9 use strict; 10 10 use base qw( MT::ArchiveType ); 11 12 use MT::Util qw( remove_html encode_html ); 11 13 12 14 sub name { … … 53 55 sub archive_title { 54 56 my $obj = shift; 55 $_[1]->title;57 encode_html( remove_html( $_[1]->title ) ); 56 58 } 57 59 -
trunk/lib/MT/Bootstrap.pm
r1833 r3219 90 90 eval { 91 91 # line __LINE__ __FILE__ 92 if (!$MT::DebugMode && ($err =~ m/^(.+?)( at .+? line \d+)(.*)$/s)) { 93 $err = $1; 94 } 92 95 my %param = ( error => $err ); 93 96 if ($err =~ m/Bad ObjectDriver/) { … … 130 133 } 131 134 } 132 print "Content-Type: text/plain; charset=$charset\n\n";133 print $app ? $app->translate("Got an error: [_1]", $app->translate($err)) : "Got an error: $err\n";134 135 } 136 if (!$MT::DebugMode && ($err =~ m/^(.+?)( at .+? line \d+)(.*)$/s)) { 137 $err = $1; 138 } 139 print "Content-Type: text/plain; charset=$charset\n\n"; 140 print $app 141 ? $app->translate( "Got an error: [_1]", $err ) 142 : "Got an error: $err"; 135 143 } 136 144 } -
trunk/lib/MT/CMS/Blog.pm
r3098 r3219 1008 1008 or return $app->error($app->translate('Can\'t load entry #[_1].', $entry_id)); 1009 1009 $param{build_type_name} = 1010 $app->translate( "[_1] '[_2]'", $entry->class_label, $entry->title);1010 $app->translate( "[_1] '[_2]'", $entry->class_label, MT::Util::encode_html($entry->title) ); 1011 1011 $param{is_entry} = 1; 1012 1012 $param{entry_id} = $entry_id; -
trunk/lib/MT/CMS/Dashboard.pm
r3082 r3219 2 2 3 3 use strict; 4 use MT::Util qw( epoch2ts );4 use MT::Util qw( epoch2ts encode_html ); 5 5 6 6 sub dashboard { … … 137 137 $param->{last_post_id} = $last_post->id; 138 138 $param->{last_post_blog_id} = $last_post->blog_id; 139 $param->{last_post_blog_name} = $last_post->blog->name;139 $param->{last_post_blog_name} = encode_html($last_post->blog->name); 140 140 $param->{last_post_ts} = $last_post->authored_on; 141 141 } -
trunk/lib/MT/CMS/Entry.pm
r3098 r3219 189 189 my $cats = $q->param('category_ids'); 190 190 if ( defined $cats ) { 191 if ( my @cats = split /,/, $cats ) {191 if ( my @cats = grep { $_ =~ /^\d+/ } split /,/, $cats ) { 192 192 $cat_id = $cats[0]; 193 193 %places = map { $_ => 1 } @cats; … … 1930 1930 my $script = qq!javascript:d=document;w=window;t='';if(d.selection)t=d.selection.createRange().text;else{if(d.getSelection)t=d.getSelection();else{if(w.getSelection)t=w.getSelection()}}void(w.open('$uri&title='+encodeURIComponent(d.title)+'&text='+encodeURIComponent(d.location.href)+encodeURIComponent('<br/><br/>')+encodeURIComponent(t),'_blank','scrollbars=yes,status=yes,resizable=yes,location=yes'))!; 1931 1931 # Translate the phrase here to avoid ActivePerl DLL bug. 1932 $app->translate('<a href="[_1]">QuickPost to [_2]</a> - Drag this link to your browser\'s toolbar then click it when you are on a site you want to blog about.', encode_html($script), $blog->name);1932 $app->translate('<a href="[_1]">QuickPost to [_2]</a> - Drag this link to your browser\'s toolbar then click it when you are on a site you want to blog about.', encode_html($script), encode_html($blog->name)); 1933 1933 } 1934 1934 -
trunk/lib/MT/CMS/Search.pm
r2890 r3219 394 394 my %param = %$list_pref; 395 395 my $limit = $q->param('limit') || 125; # FIXME: mt.cfg setting? 396 $limit =~ s/\D//g; 396 397 my $matches; 397 398 $date_col = $api->{date_column} || 'created_on'; -
trunk/lib/MT/CMS/Tools.pm
r3098 r3219 622 622 my @tsnow = gmtime(time); 623 623 my $metadata = { 624 backup_by => $app->user->name. '(ID: ' . $app->user->id . ')',624 backup_by => MT::Util::encode_xml($app->user->name, 1) . '(ID: ' . $app->user->id . ')', 625 625 backup_on => sprintf( 626 626 "%04d-%02d-%02dT%02d:%02d:%02d", -
trunk/lib/MT/CMS/User.pm
r3039 r3219 1566 1566 return $eh->error( $app->translate("User requires username") ) 1567 1567 if ( !$name ); 1568 1569 if ( $name =~ m/([<>])/) { 1570 return $eh->error( $app->translate("[_1] contains an invalid character: [_2]", $app->translate("Username"), encode_html( $1 ) ) ); 1571 } 1568 1572 } 1569 1573 … … 1576 1580 return $eh->error( $app->translate("User requires display name") ) 1577 1581 if ( !length( $nickname ) ); 1582 1583 if ( $nickname =~ m/([<>])/) { 1584 return $eh->error( $app->translate("[_1] contains an invalid character: [_2]", $app->translate("Display Name"), encode_html( $1 ) ) ); 1585 } 1578 1586 } 1579 1587 … … 1614 1622 if ( !$app->param('hint') ); 1615 1623 } 1624 my $email = $app->param('email'); 1616 1625 return $eh->error( 1617 1626 MT->translate("Email Address is required for password recovery") ) 1618 unless $app->param('email'); 1627 unless $email; 1628 if ( $email =~ m/([<>])/) { 1629 return $eh->error( $app->translate("[_1] contains an invalid character: [_2]", $app->translate("Email Address"), encode_html( $1 ) ) ); 1630 } 1631 1619 1632 if ( $app->param('url') ) { 1620 1633 my $url = $app->param('url'); 1621 return $eh->error( MT->translate(" Website URL is invalid") )1622 unless is_url($url);1634 return $eh->error( MT->translate("URL is invalid.") ) 1635 if !is_url($url) || ($url =~ m/[<>]/); 1623 1636 } 1624 1637 1; -
trunk/lib/MT/DefaultTemplates.pm
r2755 r3219 332 332 foreach my $tmpl_id (keys %{ $tmpl_hash->{$tmpl_set} }) { 333 333 next if $tmpl_id eq 'plugin'; 334 335 334 my $p = $tmpl_hash->{plugin} || $tmpl_hash->{$tmpl_set}{plugin}; 336 335 my $base_path = $def_tmpl->{base_path} || $tmpl_hash->{$tmpl_set}{base_path}; … … 359 358 $tmpl->{key} = $tmpl_id; 360 359 $tmpl->{identifier} = $tmpl_id; 361 362 # load template if it hasn't been loaded already363 if (!exists $tmpl->{text}) {364 local (*FIN, $/);365 my $filename = $tmpl->{filename} || ($tmpl_id . '.mtml');366 my $file = File::Spec->catfile($base_path, $filename);367 if ((-e $file) && (-r $file)) {368 open FIN, "<$file"; my $data = <FIN>; close FIN;369 $tmpl->{text} = $data;370 } else {371 $tmpl->{text} = '';372 }373 }374 360 375 361 if ( exists $tmpl->{widgets} ) { … … 385 371 } 386 372 $tmpl->{widgets} = \@widgets if @widgets; 373 } else { 374 # load template if it hasn't been loaded already 375 if (!exists $tmpl->{text}) { 376 local (*FIN, $/); 377 my $filename = $tmpl->{filename} || ($tmpl_id . '.mtml'); 378 my $file = File::Spec->catfile($base_path, $filename); 379 if ((-e $file) && (-r $file)) { 380 open FIN, "<$file"; my $data = <FIN>; close FIN; 381 $tmpl->{text} = $data; 382 } else { 383 $tmpl->{text} = ''; 384 } 385 } 387 386 } 388 387 389 388 my $local_global_tmpls = $tmpl->{global} ? \%global_tmpls : \%tmpls; 390 if (exists $local_global_tmpls->{$tmpl_id}) { 389 my $tmpl_key = $type . ":" . $tmpl_id; 390 if (exists $local_global_tmpls->{$tmpl_key}) { 391 391 # allow components/plugins to override core 392 392 # templates 393 $local_global_tmpls->{$tmpl_ id} = $tmpl if $p && ($p->id ne 'core');393 $local_global_tmpls->{$tmpl_key} = $tmpl if $p && ($p->id ne 'core'); 394 394 } 395 395 else { 396 $local_global_tmpls->{$tmpl_ id} = $tmpl;396 $local_global_tmpls->{$tmpl_key} = $tmpl; 397 397 } 398 398 } -
trunk/lib/MT/ImportExport.pm
r1174 r3219 14 14 use base qw( MT::ErrorHandler ); 15 15 use MT::I18N qw( first_n_text const encode_text ); 16 use MT::Util qw( encode_html ); 16 17 17 18 use vars qw( $SEP $SUB_SEP ); … … 136 137 $author->password('(none)'); 137 138 } 138 $cb->(MT->translate("Creating new user ('[_1]')...", $val));139 $cb->(MT->translate("Creating new user ('[_1]')...", encode_html($val))); 139 140 if ($author->save) { 140 141 $cb->(MT->translate("ok") . "\n"); … … 173 174 $cat->author_id($entry->author_id); 174 175 $cat->parent(0); 175 $cb->(MT->translate("Creating new category ('[_1]')...", $val));176 $cb->(MT->translate("Creating new category ('[_1]')...", encode_html($val))); 176 177 if ($cat->save) { 177 178 $cb->(MT->translate("ok") . "\n"); … … 239 240 next ENTRY_BLOCK; 240 241 } else { 241 $cb->(MT->translate("Importing into existing entry [_1] ('[_2]')", $entry->id, $entry->title) . "\n");242 $cb->(MT->translate("Importing into existing entry [_1] ('[_2]')", $entry->id, encode_html($entry->title)) . "\n"); 242 243 } 243 244 } … … 371 372 ## Save entry. 372 373 unless ($no_save) { 373 $cb->(MT->translate("Saving entry ('[_1]')...", $entry->title));374 $cb->(MT->translate("Saving entry ('[_1]')...", encode_html($entry->title))); 374 375 if ($entry->save) { 375 376 $cb->(MT->translate("ok (ID [_1])", $entry->id) . "\n"); … … 427 428 for my $comment (@comments) { 428 429 $comment->entry_id($entry->id); 429 $cb->(MT->translate("Creating new comment (from '[_1]')...", $comment->author));430 $cb->(MT->translate("Creating new comment (from '[_1]')...", encode_html($comment->author))); 430 431 if ($comment->save) { 431 432 $cb->(MT->translate("ok (ID [_1])", $comment->id) . "\n"); … … 444 445 for my $ping (@pings) { 445 446 $ping->tb_id($tb->id); 446 $cb->(MT->translate("Creating new ping ('[_1]')...", $ping->title));447 $cb->(MT->translate("Creating new ping ('[_1]')...", encode_html($ping->title))); 447 448 if ($ping->save) { 448 449 $cb->(MT->translate("ok (ID [_1])", $ping->id) . "\n"); -
trunk/lib/MT/L10N/ja.pm
r3082 r3219 815 815 'User requires username.' => 'ãŠãŒã¶ãŒåã¯å¿ 816 816 é ã§ãã', 817 '[_1] contains an invalid character: [_2]' => '[_1]ã«äžæ£ãªæå( [_2] )ãå«ãŸããŠããŸãã', 817 818 'A user with the same name already exists.' => 'ååã®ãŠãŒã¶ãŒããã§ã«ååšããŸãã', 818 819 'User requires display name.' => '衚瀺åã¯å¿ -
trunk/lib/MT/Sanitize.pm
r1174 r3219 107 107 $dec_val =~ s/�*3[Aa](?:=;|[^a-fA-F0-9])/:/; 108 108 109 if ((my $prot) = $dec_val =~ m/^( .+?):/) {109 if ((my $prot) = $dec_val =~ m/^([\s\S]+?):/) { 110 110 next if $prot =~ m/[\r\n\t]/; 111 111 $prot =~ s/\s+//gs; -
trunk/lib/MT/Template/ContextHandlers.pm
r3094 r3219 1703 1703 my $show_actions = exists $args->{show_actions} ? $args->{show_actions} : 1; 1704 1704 my $return_args = $ctx->var('return_args') || ''; 1705 $return_args = encode_html( $return_args ); 1705 1706 $return_args = qq{\n <input type="hidden" name="return_args" value="$return_args" />} if $return_args; 1706 1707 my $blog_id = $ctx->var('blog_id') || ''; … … 1987 1988 my $header_class = $tabbed ? 'widget-header-tabs' : ''; 1988 1989 my $return_args = $app->make_return_args; 1990 $return_args = encode_html( $return_args ); 1989 1991 my $cgi = $app->uri; 1990 1992 if ($hosted_widget && (!$insides !~ m/<form\s/i)) { … … 9163 9165 my $type = $args->{type} || ''; 9164 9166 9165 my $displayname = $a->nickname || '';9167 my $displayname = encode_html( remove_html( $a->nickname || '' ) ); 9166 9168 my $show_email = $args->{show_email} ? 1 : 0; 9167 9169 my $show_url = 1 unless exists $args->{show_url} && !$args->{show_url}; … … 9179 9181 # Add vcard properties to link if requested (with hcard="1") 9180 9182 my $hcard = $args->{show_hcard} ? ' class="fn url"' : ''; 9181 return sprintf qq(<a%s href="%s"%s>%s</a>), $hcard, $a->url, $target, $displayname;9183 return sprintf qq(<a%s href="%s"%s>%s</a>), $hcard, encode_html( $a->url ), $target, $displayname; 9182 9184 } 9183 9185 } elsif ($type eq 'email') { … … 9185 9187 # Add vcard properties to email if requested (with hcard="1") 9186 9188 my $hcard = $args->{show_hcard} ? ' class="fn email"' : ''; 9187 my $str = "mailto:" . $a->email;9189 my $str = "mailto:" . encode_html( $a->email ); 9188 9190 $str = spam_protect($str) if $args->{'spam_protect'}; 9189 9191 return sprintf qq(<a%s href="%s">%s</a>), $hcard, $str, $displayname; … … 10808 10810 $name ||= $args->{default_name}; 10809 10811 $name ||= MT->translate("Anonymous"); 10812 $name = encode_html( remove_html( $name ) ); 10810 10813 my $show_email = $args->{show_email} ? 1 : 0; 10811 10814 my $show_url = 1 unless exists $args->{show_url} && !$args->{show_url}; … … 10818 10821 10819 10822 if ( $cmntr ) { 10823 $name = encode_html( remove_html( $cmntr->nickname ) ) if $cmntr->nickname; 10820 10824 if ($cmntr->url) { 10821 10825 return sprintf(qq(<a title="%s" href="%s"%s>%s</a>), 10822 $cmntr->url, $cmntr->url, $target, $name);10826 encode_html( $cmntr->url ), encode_html( $cmntr->url ), $target, $name); 10823 10827 } 10824 10828 return $name; … … 10829 10833 $name = remove_html($name); 10830 10834 my $url = remove_html($c->url); 10831 $url =~ s/>/>/g;10832 10835 if ($c->id && !$args->{no_redirect} && !$args->{nofollowfy}) { 10833 10836 return sprintf(qq(<a title="%s" href="%s%s?__mode=red;id=%d"%s>%s</a>), 10834 $url, $cgi_path, $comment_script, $c->id, $target, $name);10837 encode_html( $url ), $cgi_path, $comment_script, $c->id, $target, $name); 10835 10838 } else { 10836 10839 # In the case of preview, show URL directly without a redirect … … 10840 10843 } elsif ($show_email && $c->email && MT::Util::is_valid_email($c->email)) { 10841 10844 my $email = remove_html($c->email); 10842 my $str = "mailto:" . $email;10845 my $str = "mailto:" . encode_html( $email ); 10843 10846 $str = spam_protect($str) if $args->{'spam_protect'}; 10844 10847 return sprintf qq(<a href="%s">%s</a>), $str, $name; … … 11239 11242 11240 11243 my $label = $args->{label} || $args->{text} || MT->translate('Reply'); 11241 my $comment_author = MT::Util::encode_ js($comment->author);11244 my $comment_author = MT::Util::encode_html( MT::Util::encode_js($comment->author) ); 11242 11245 my $onclick = sprintf( $args->{onclick} || "mtReplyCommentOnClick(%d, '%s')", $comment->id, $comment_author); 11243 11246 … … 12580 12583 =item * Category 12581 12584 12582 The label of the category. 12585 The label of the category. Note that any HTML tags present in the label 12586 will be removed. 12583 12587 12584 12588 =item * Daily … … 12596 12600 =item * Individual 12597 12601 12598 The title of the entry. 12602 The title of the entry. Note that any HTML tags present in the label will 12603 be removed. 12604 12605 = item * Author 12606 12607 The display name of the author. Note that any HTML tags present in the 12608 display name will be removed. 12599 12609 12600 12610 =back -
trunk/lib/MT/Util.pm
r2929 r3219 641 641 sub remove_html { 642 642 my($text) = @_; 643 return $text if !defined $text; # suppress warnings 644 return $text if $text =~ m/^<\!\[CDATA\[/i; 645 $text =~ s!<[^>]+>!!gs; 646 $text =~ s!<!<!gs; 647 $text; 643 return '' if !defined $text; # suppress warnings 644 $text =~ s/(<\!\[CDATA\[(.*?)\]\]>)|(<[^>]+>)/ 645 defined $1 ? $1 : '' 646 /geisx; 647 $text =~ s/<(?!\!\[CDATA\[)/</gis; 648 return $text; 648 649 } 649 650 -
trunk/php/lib/MTUtil.php
r3082 r3219 1530 1530 if ($filter == '__default__') { 1531 1531 $filter = 'convert_breaks'; 1532 } elseif ($filter == '__sanitize__') { 1533 $filter = 'sanitize'; 1532 1534 } 1533 1535 if ($filter == 'convert_breaks') { -
trunk/php/lib/archive_lib.php
r2304 r3219 97 97 98 98 function get_title($args, $ctx) { 99 return $ctx->tag('EntryTitle', $args);99 return encode_html( strip_tags( $ctx->tag('EntryTitle', $args) ) ); 100 100 } 101 101 … … 113 113 return 'Individual'; 114 114 } 115 115 116 116 function &get_archive_list($ctx, $args) { 117 117 return $ctx->mt->db->get_archive_list($args); … … 291 291 $format or $format = "%Y"; 292 292 } 293 293 294 294 return $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 295 295 } … … 486 486 } 487 487 } 488 return $author_name;489 } 490 488 return encode_html( strip_tags( $author_name ) ); 489 } 490 491 491 function get_archive_name() { 492 492 return 'Author'; … … 793 793 } 794 794 795 return $author_name.$ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 796 } 797 795 return encode_html( strip_tags( $author_name ) ) 796 . $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 797 } 798 798 799 function get_archive_name() { 799 800 return 'Author-Yearly'; … … 877 878 $format = $args['format']; 878 879 $format or $format = "%B %Y"; 879 return $author_name.$ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 880 } 881 880 return encode_html( strip_tags( $author_name ) ) 881 . $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 882 } 883 882 884 function get_archive_name() { 883 885 return 'Author-Monthly'; … … 902 904 $year_ext = $mt->db->apply_extract_date('year', 'entry_authored_on'); 903 905 $month_ext = $mt->db->apply_extract_date('month', 'entry_authored_on'); 904 $ctx = $mt->context(); 906 $ctx = $mt->context(); 905 907 $index = $ctx->stash('index_archive'); 906 908 … … 981 983 $format = $args['format']; 982 984 $format or $format = "%x"; 983 return $author_name.$ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 984 } 985 985 return encode_html( strip_tags( $author_name ) ) 986 . $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 987 } 988 986 989 function get_archive_name() { 987 990 return 'Author-Daily'; … … 1088 1091 $format = $args['format']; 1089 1092 $format or $format = "%x"; 1090 return $author_name1091 . $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx)1092 . ' - '.$ctx->_hdlr_date(array('ts' => $end, 'format' => $format), $ctx);1093 } 1094 1093 return encode_html( strip_tags( $author_name ) ) 1094 . $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx) 1095 . ' - ' . $ctx->_hdlr_date(array('ts' => $end, 'format' => $format), $ctx); 1096 } 1097 1095 1098 function get_archive_name() { 1096 1099 return 'Author-Weekly'; … … 1191 1194 function &get_archive_list($ctx, $args) { 1192 1195 global $mt; 1193 list($results, $hi, $low) = 1196 list($results, $hi, $low) = 1194 1197 $this->get_archive_list_data($args); 1195 1198 if(is_array($results)) { … … 1355 1358 function get_title($args, $ctx) { 1356 1359 $cat_name = parent::get_category_name($ctx); 1357 $stamp = $ctx->stash('current_timestamp'); 1360 $stamp = $ctx->stash('current_timestamp'); 1358 1361 list($start) = start_end_year($stamp, $ctx->stash('blog')); 1359 1362 $format = $args['format']; … … 1367 1370 $format or $format = "%Y"; 1368 1371 } 1369 return $cat_name.$ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 1372 return encode_html( strip_tags( $cat_name ) ) 1373 . $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 1370 1374 } 1371 1375 … … 1410 1414 if (isset($cat)){ 1411 1415 $cat_filter = " and placement_category_id=".$cat['category_id']; 1412 1416 1413 1417 } 1414 1418 #} … … 1464 1468 $format = $args['format']; 1465 1469 $format or $format = "%B %Y"; 1466 return $cat_name.$ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 1470 return encode_html( strip_tags( $cat_name ) ) 1471 . $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 1467 1472 } 1468 1473 … … 1508 1513 if(isset($cat)) { 1509 1514 $cat_filter = " and placement_category_id=".$cat['category_id']; 1510 1515 1511 1516 } 1512 1517 #} … … 1566 1571 $format = $args['format']; 1567 1572 $format or $format = "%x"; 1568 return $cat_name.$ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 1573 return encode_html( strip_tags( $cat_name ) ) 1574 . $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx); 1569 1575 } 1570 1576 … … 1611 1617 if(isset($cat)) { 1612 1618 $cat_filter = " and placement_category_id=".$cat['category_id']; 1613 1619 1614 1620 } 1615 1621 #} … … 1671 1677 $format = $args['format']; 1672 1678 $format or $format = "%x"; 1673 return $cat_name1674 . $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx)1675 . " - ".$ctx->_hdlr_date(array('ts' => $end, 'format' => $format), $ctx);1679 return encode_html( strip_tags( $cat_name ) ) 1680 . $ctx->_hdlr_date(array('ts' => $start, 'format' => $format), $ctx) 1681 . " - " . $ctx->_hdlr_date(array('ts' => $end, 'format' => $format), $ctx); 1676 1682 } 1677 1683 … … 1719 1725 if(isset($cat)) { 1720 1726 $cat_filter = " and placement_category_id=".$cat['category_id']; 1721 1727 1722 1728 } 1723 1729 #} -
trunk/php/lib/function.mtcommentauthorlink.php
r2630 r3219 13 13 $name = $args['default_name']; 14 14 $name or $name = $mt->translate("Anonymous"); 15 require_once "MTUtil.php"; 16 $name = encode_html( $name ); 15 17 $email = $comment['comment_email']; 16 18 $url = $comment['comment_url']; … … 33 35 34 36 if ( $cmntr ) { 35 $name = isset($cmntr['author_nickname']) ? $cmntr['author_nickname']: $name;37 $name = isset($cmntr['author_nickname']) ? encode_html( $cmntr['author_nickname'] ) : $name; 36 38 if ($cmntr['author_url']) 37 return sprintf('<a title="%s" href="%s"%s>%s</a>', $cmntr['author_url'], $cmntr['author_url'], $target, $name);39 return sprintf('<a title="%s" href="%s"%s>%s</a>', encode_html( $cmntr['author_url'] ), encode_html( $cmntr['author_url'] ), $target, $name); 38 40 return $name; 39 41 } elseif ($show_url && $url) { … … 42 44 $comment_script = $ctx->mt->config('CommentScript'); 43 45 $name = strip_tags($name); 44 $url = strip_tags($url); 45 $url = preg_replace('/>/', '>', $url); 46 $url = encode_html( strip_tags($url) ); 46 47 if ($comment['comment_id'] && !isset($args['no_redirect']) && !isset($args['nofollowfy'])) 47 48 return sprintf('<a title="%s" href="%s%s?__mode=red;id=%d"%s>%s</a>', $url, $cgi_path, $comment_script, $comment['comment_id'], $target, $name); … … 49 50 return sprintf('<a title="%s" href="%s"%s>%s</a>', $url, $url, $target, $name); 50 51 } elseif ($show_email && $email && is_valid_email($email)) { 51 $email = strip_tags($email);52 $email = encode_html( strip_tags($email) ); 52 53 $str = 'mailto:' . $email; 53 54 if ($args['spam_protect']) { -
trunk/php/lib/function.mtcommentreplytolink.php
r2613 r3219 20 20 $comment_author = $comment['comment_author']; 21 21 require_once("MTUtil.php"); 22 $comment_author = encode_ js($comment_author);22 $comment_author = encode_html(encode_js($comment_author)); 23 23 24 24 $onclick = sprintf($onclick, $comment['comment_id'], $comment_author); -
trunk/php/lib/function.mtentryauthorlink.php
r1174 r3219 11 11 12 12 $type = $args['type']; 13 $displayname = $entry['author_nickname'];13 $displayname = encode_html( $entry['author_nickname'] ); 14 14 if (isset($args['show_email'])) 15 15 $show_email = $args['show_email']; … … 21 21 $show_url = 1; 22 22 23 require_once("MTUtil.php"); 23 24 # Open the link in a new window if requested (with new_window="1"). 24 25 $target = $args['new_window'] ? ' target="_blank"' : ''; … … 32 33 if ($type == 'url') { 33 34 if ($entry['author_url'] && ($displayname != '')) { 34 return sprintf('<a href="%s"%s>%s</a>', $entry['author_url'], $target, $displayname);35 return sprintf('<a href="%s"%s>%s</a>', encode_html( $entry['author_url'] ), $target, $displayname); 35 36 } 36 37 } elseif ($type == 'email') { 37 38 if ($entry['author_email'] && ($displayname != '')) { 38 $str = "mailto:" . $entry['author_email'];39 $str = "mailto:" . encode_html( $entry['author_email'] ); 39 40 if ($args['spam_protect']) 40 41 $str = spam_protect($str); … … 50 51 return $displayname; 51 52 } 52 ?> -
trunk/php/lib/modifier.sanitize.php
r1174 r3219 6 6 # $Id$ 7 7 8 function smarty_modifier_sanitize($text, $spec ) {8 function smarty_modifier_sanitize($text, $spec = '1') { 9 9 if ($spec == '1') { 10 10 global $mt; -
trunk/php/lib/sanitize_lib.php
- Property svk:merge deleted
-
trunk/php/mt.php
r3085 r3219 6 6 # $Id: mt.php 2703 2008-07-03 22:19:49Z bchoate $ 7 7 8 define('VERSION', '4.2 1');9 define('VERSION_ID', '4.2 1');10 define('PRODUCT_VERSION', '4.2 1');8 define('VERSION', '4.23'); 9 define('VERSION_ID', '4.23'); 10 define('PRODUCT_VERSION', '4.23'); 11 11 12 12 $PRODUCT_NAME = '__PRODUCT_NAME__'; … … 107 107 108 108 foreach ($plugin_paths as $path) { 109 if ($dh = opendir($path)) {109 if ($dh = @opendir($path)) { 110 110 while (($file = readdir($dh)) !== false) { 111 111 if ($file == "." || $file == "..") -
trunk/plugins/Cloner/cloner.pl
r1174 r3219 14 14 use MT 4; 15 15 use base 'MT::Plugin'; 16 use MT::Util qw( encode_html ); 16 17 our $VERSION = '2.0'; 17 18 … … 63 64 my $blog = MT::Blog->load($blog_id) 64 65 or return $app->error($plugin->translate("Invalid blog_id")); 65 require MT::Util;66 my $blog_name = MT::Util::encode_html($blog->name);66 # double escape to survive decode_html in translate_templatized 67 my $blog_name = encode_html(encode_html($blog->name, 1), 1); 67 68 68 69 # Set up and commence app output -
trunk/search_templates/comments.tmpl
r2384 r3219 24 24 25 25 <div id="banner"> 26 <h1><a href="<$MTBlogURL$>" accesskey="1"><$MTBlogName $></a></h1>27 <h2><$MTBlogDescription $></h2>26 <h1><a href="<$MTBlogURL$>" accesskey="1"><$MTBlogName encode_html="1"$></a></h1> 27 <h2><$MTBlogDescription encode_html="1"$></h2> 28 28 </div> 29 29 … … 55 55 56 56 <MTSearchResults> 57 <h3><a href="<$MTEntryPermalink$>"><$MTEntryTitle $></a></h3>58 <p><$MTEntryExcerpt $> <$MTEntryEditLink$></p>59 <p class="posted"><MT_TRANS phrase="Posted in [_1] on [_2]" params="<$MTBlogName $>%%<$MTEntryDate$>"></p>57 <h3><a href="<$MTEntryPermalink$>"><$MTEntryTitle encode_html="1"$></a></h3> 58 <p><$MTEntryExcerpt encode_html="1"$> <$MTEntryEditLink$></p> 59 <p class="posted"><MT_TRANS phrase="Posted in [_1] on [_2]" params="<$MTBlogName encode_html="1" encode_html="1"$>%%<$MTEntryDate$>"></p> 60 60 </MTSearchResults> 61 61 -
trunk/search_templates/default.tmpl
r2384 r3219 57 57 <h3 class="search-results-header"> 58 58 <MTIfStraightSearch> 59 <MT_TRANS phrase="Matching entries from [_1]" params="<$MTBlogName $>">59 <MT_TRANS phrase="Matching entries from [_1]" params="<$MTBlogName encode_html="1" encode_html="1"$>"> 60 60 </MTIfStraightSearch> 61 61 <MTIfTagSearch> 62 <MT_TRANS phrase="Entries from [_1] tagged with '[_2]'" params="<$MTBlogName $>%%<$MTSearchString$>">62 <MT_TRANS phrase="Entries from [_1] tagged with '[_2]'" params="<$MTBlogName encode_html="1" encode_html="1"$>%%<$MTSearchString encode_html="1"$>"> 63 63 </MTIfTagSearch> 64 64 </h3> … … 66 66 </MTBlogResultHeader> 67 67 68 <h3><a href="<$MTEntryPermalink$>"><$MTEntryTitle $></a></h3>69 <p><$MTEntryExcerpt $> <$MTEntryEditLink$></p>68 <h3><a href="<$MTEntryPermalink$>"><$MTEntryTitle encode_html="1"$></a></h3> 69 <p><$MTEntryExcerpt encode_html="1"$> <$MTEntryEditLink$></p> 70 70 <MTIfTagSearch> 71 71 <div class="entry-tags"> … … 73 73 <ul class="entry-tags-list"> 74 74 <MTEntryTags> 75 <li class="entry-tag"><a href="<$MTTagSearchLink$>&IncludeBlogs=<$MTSearchIncludeBlogs$>" rel="tag"><$MTTagName $></a></li>75 <li class="entry-tag"><a href="<$MTTagSearchLink$>&IncludeBlogs=<$MTSearchIncludeBlogs$>" rel="tag"><$MTTagName encode_html="1"$></a></li> 76 76 </MTEntryTags> 77 77 </ul> … … 80 80 81 81 <p class="entry-footer"> 82 <span class="post-footers"><MT_TRANS phrase="Posted <MTIfNonEmpty tag="EntryAuthorDisplayName">by [_1] </MTIfNonEmpty>on [_2]" params="<$MTEntryAuthorDisplayName $>%%<$MTEntryDate$>"></span>82 <span class="post-footers"><MT_TRANS phrase="Posted <MTIfNonEmpty tag="EntryAuthorDisplayName">by [_1] </MTIfNonEmpty>on [_2]" params="<$MTEntryAuthorDisplayName encode_html="1"$>%%<$MTEntryDate$>"></span> 83 83 </p> 84 84 … … 97 97 <h3 class="search-results-header"> 98 98 <MTIfStraightSearch> 99 <MT_TRANS phrase="Entries matching '[_1]'" params="<$MTSearchString $>">99 <MT_TRANS phrase="Entries matching '[_1]'" params="<$MTSearchString encode_html="1"$>"> 100 100 </MTIfStraightSearch> 101 101 <MTIfTagSearch> 102 <MT_TRANS phrase="Entries tagged with '[_1]'" params="<$MTSearchString $>">102 <MT_TRANS phrase="Entries tagged with '[_1]'" params="<$MTSearchString encode_html="1"$>"> 103 103 </MTIfTagSearch> 104 104 </h3> 105 <p><MT_TRANS phrase="No pages were found containing '[_1]'." params="<$MTSearchString $>"></p>105 <p><MT_TRANS phrase="No pages were found containing '[_1]'." params="<$MTSearchString encode_html="1"$>"></p> 106 106 </MTNoSearchResults> 107 107 … … 133 133 <MTIfTagSearch> 134 134 <MTSetVar name="search_feed_param" value="tag"> 135 <MTSetVarBlock name="search_feed_description"><MT_TRANS phrase="If you use an RSS reader, you can subscribe to a feed of all future entries tagged '[_1]'." params="<$MTSearchString $>"></MTSetVarBlock>135 <MTSetVarBlock name="search_feed_description"><MT_TRANS phrase="If you use an RSS reader, you can subscribe to a feed of all future entries tagged '[_1]'." params="<$MTSearchString encode_html="1"$>"></MTSetVarBlock> 136 136 <MTElse> 137 137 <MTSetVar name="search_feed_param" value="search"> 138 <MTSetVarBlock name="search_feed_description"><MT_TRANS phrase="If you use an RSS reader, you can subscribe to a feed of all future entries matching '[_1]'." params="<$MTSearchString $>"></MTSetVarBlock>138 <MTSetVarBlock name="search_feed_description"><MT_TRANS phrase="If you use an RSS reader, you can subscribe to a feed of all future entries matching '[_1]'." params="<$MTSearchString encode_html="1"$>"></MTSetVarBlock> 139 139 </MTElse> 140 140 </MTIfTagSearch> … … 166 166 <ul class="module-list"> 167 167 <MTTags> 168 <li class="module-list-item taglevel<$MTTagRank$>"><a href="<$MTTagSearchLink$>" title="<$MTTagCount$>"><$MTTagName $></a></li>168 <li class="module-list-item taglevel<$MTTagRank$>"><a href="<$MTTagSearchLink$>" title="<$MTTagCount$>"><$MTTagName encode_html="1"$></a></li> 169 169 </MTTags> 170 170 </ul> -
trunk/search_templates/results_feed.tmpl
r1098 r3219 3 3 xmlns="http://www.w3.org/2005/Atom" 4 4 xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"> 5 <title><MT_TRANS phrase="Search Results for [_1]" params="<$MTSearchString remove_html="1" encode_ xml="1"$>"></title>5 <title><MT_TRANS phrase="Search Results for [_1]" params="<$MTSearchString remove_html="1" encode_html="1" encode_xml="1"$>"></title> 6 6 <id>tag:<$MTCGIHost exclude_port="1" encode_xml="1"$>,<$MTDate format="%Y"$>:<$MTCGIRelativeURL encode_xml="1"$>/feed/<$MTSearchString remove_html="1" encode_xml="1"$></id> 7 7 <link rel="self" type="application/atom+xml" href="<$MTCGIPath$><$MTSearchScript$>?search=<$MTSearchString$>&Template=<$MTSearchTemplateID$>&IncludeBlogs=<$MTSearchIncludeBlogs$>" /> -
trunk/search_templates/results_feed_rss2.tmpl
r1098 r3219 2 2 <rss version="2.0" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"> 3 3 <channel> 4 <title><MT_TRANS phrase="Search Results for [_1]" params="<$MTSearchString remove_html="1" encode_ xml="1"$>"></title>4 <title><MT_TRANS phrase="Search Results for [_1]" params="<$MTSearchString remove_html="1" encode_html="1" encode_xml="1"$>"></title> 5 5 <link><$MTCGIPath$><$MTSearchScript$>?search=<$MTSearchString$>&Template=<$MTSearchTemplateID$>&IncludeBlogs=<$MTSearchIncludeBlogs$></link> 6 6 <language>en-us</language> -
trunk/t/08-util.t
r2562 r3219 7 7 use MT::Util qw( encode_html decode_html wday_from_ts format_ts dirify 8 8 convert_high_ascii encode_xml decode_xml substr_wref 9 trim ltrim rtrim );9 trim ltrim rtrim remove_html ); 10 10 use MT::I18N qw( encode_text ); 11 11 use strict; … … 14 14 $mt->config('NoHTMLEntities', 1); 15 15 16 BEGIN { plan tests => 9 2};16 BEGIN { plan tests => 96 }; 17 17 18 18 ok(substr_wref("Sabado", 0, 3), "Sab"); #1 … … 134 134 ok(trim(' sunday monday '), 'sunday monday'); #92 135 135 136 ok(remove_html('<![CDATA[foo]]>'), '<![CDATA[foo]]>', "remove html preserves CDATA"); 137 ok(remove_html('<![CDATA[]]><script>alert("foo")</script><![CDATA[]]>'), '<![CDATA[]]>alert("foo")<![CDATA[]]>', "remove html prevents abuse"); 138 ok(remove_html('<![CDATA[one]]><script>alert("foo")</script><![CDATA[two]]>'), '<![CDATA[one]]>alert("foo")<![CDATA[two]]>', "remove html prevents abuse, saves plain text"); 139 ok(remove_html('<![CDATA[<foo>]]><script>alert("foo")</script><![CDATA[two]]>'), '<![CDATA[<foo>]]>alert("foo")<![CDATA[two]]>', "remove html prevents abuse, saves plain text, escapes inner < characters"); 136 140 137 141 =pod -
trunk/t/11-sanitize.t
r2562 r3219 7 7 use lib 'extlib'; 8 8 9 use Test::More tests => 5 3;9 use Test::More tests => 54; 10 10 11 11 use MT; … … 106 106 ### this one breaks... 107 107 is(MT::Sanitize->sanitize('<? /* ?> */ readfile("/etc/passwd") ?>'), ' */ readfile("/etc/passwd") ?>', 'php cloaking attempt'); 108 109 is(MT::Sanitize->sanitize("<a href=' 110 javascript:alert(123)'>boo</a>", 'a href'), '<a>boo</a>', '<a>boo</a>'); -
trunk/t/driver-tests.pl
r2601 r3219 67 67 status => 1, }, 68 68 { class => 'Bar', 69 __wait => 1, 69 70 id => 1, 70 71 foo_id => 2, … … 72 73 status => 0, }, 73 74 { class => 'Bar', 75 __wait => 1, 74 76 id => 2, 75 77 foo_id => 2, … … 77 79 status => 1, }, 78 80 { class => 'Bar', 81 __wait => 1, 79 82 id => 3, 80 83 foo_id => 1, … … 85 88 for my $data (@obj_data) { 86 89 my $class = delete $data->{class}; 90 my $wait = delete $data->{__wait}; 87 91 my $obj = $class->new; 88 92 $obj->set_values($data); 93 sleep($wait) if $wait; 89 94 $obj->save(); 90 95 } … … 194 199 ($status, $id) = $agb->(); 195 200 ok(!$status, 'avg_group_by only had two results'); 201 } 202 203 sub max_group_by : Tests(7) { 204 my $mgb = Bar->max_group_by(undef, { 205 join => Foo->join_on(undef, 206 { 207 'id' => \'=bar_foo_id', 208 }), 209 group => ['foo_id'], 210 max => 'created_on', 211 }); 212 my ($created_on, $foo_id) = $mgb->(); 213 my $f1 = Foo->load(1); 214 my $b3 = Bar->load(3); 215 is($foo_id, $f1->id, 'max_group_by had a second result'); 216 #is($created_on, $b3->created_on, 'max_group_by had a second result'); 217 218 my $f2 = Foo->load(2); 219 my $b2 = Bar->load(2); 220 ($created_on, $foo_id) = $mgb->(); 221 is($foo_id, $f2->id, 'max_group_by had a first result'); 222 #is($created_on, $b2->created_on, 'max_group_by had a first result'); 223 224 ($created_on, $foo_id) = $mgb->(); 225 ok(!$created_on, 'max_group_by only had two results'); 226 227 my $mgb2 = Bar->max_group_by(undef, { 228 join => Foo->join_on(undef, 229 { 'id' => \'=bar_foo_id' }, 230 { limit => 1 }, 231 ), 232 group => ['foo_id'], 233 max => 'created_on', 234 }); 235 ($created_on, $foo_id) = $mgb2->(); 236 is($foo_id, $f1->id, 'max_group_by with limit had a first result'); 237 #is($created_on, $b3->created_on, 'max_group_by with limit had a first result'); 238 239 ($created_on, $foo_id) = $mgb2->(); 240 ok(!$created_on, 'max_group_by with limit only had one result'); 241 242 my $mgb3 = Bar->max_group_by(undef, { 243 join => Foo->join_on(undef, 244 { 'id' => \'=bar_foo_id' }, 245 { limit => 1, offset => 1 }, 246 ), 247 group => ['foo_id'], 248 max => 'created_on', 249 }); 250 ($created_on, $foo_id) = $mgb3->(); 251 is($foo_id, $f2->id, 'max_group_by with limit and offset had a first result'); 252 #is($created_on, $b2->created_on, 'max_group_by with limit and offset had a first result'); 253 254 ($created_on, $foo_id) = $mgb3->(); 255 ok(!$created_on, 'max_group_by with limit and offset only had one result'); 196 256 } 197 257 … … 253 313 254 314 { __class => 'Bar', 315 __wait => 1, 255 316 name => 'Silverlight', 256 317 status => 2, 257 318 foo_id => 3, }, 258 319 { __class => 'Bar', 320 __wait => 1, 259 321 name => 'IronPython', 260 322 status => 3, 261 323 foo_id => 3, }, 262 324 { __class => 'Bar', 325 __wait => 1, 263 326 name => 'IronRuby', 264 327 status => 0, … … 415 478 ); 416 479 is_deeply(\@a_foos, [], 'No Foo has Bars with status=2 and status=0 (alias)'); 417 } 480 } 418 481 419 482 sub conjunctions : Tests(4) { … … 454 517 } 455 518 519 sub early_ending_iterators: Tests(4) { 520 my $self = shift; 521 $self->make_pc_data(); 522 523 my ($iter, $tmp, @tmp); 524 my @foo = map { Foo->load($_) } (1..5); 525 526 ## Load using descending sort (newest) 527 $iter = Foo->load_iter(undef, 528 { join => [ 'Bar', 'foo_id', 529 undef, 530 { sort => 'created_on', 531 direction => 'descend', 532 unique => 1 } ] }); 533 $tmp = $iter->(); 534 is_object($tmp, $foo[0], '(early ending iterator) Foo associated with the newest Bar is Foo #1'); 535 eval { $iter->end(); }; 536 is($@, q(), 'Iterator can be ended #1'); 537 538 ## Load using ascending sort (oldest) 539 $iter = Foo->load_iter(undef, 540 { join => [ 'Bar', 'foo_id', 541 undef, 542 { sort => 'created_on', 543 direction => 'ascend', 544 unique => 1 } ] }); 545 $tmp = $iter->(); 546 is_object($tmp, $foo[2], '(early ending iterator) Foo associated with the oldest Bar is Foo #3'); 547 eval { $iter->end(); }; 548 is($@, q(), 'Iterator can be ended #2'); 549 } 550 456 551 sub clean_db : Test(teardown) { 457 552 MT::Test->reset_table_for(qw( Foo Bar )); … … 462 557 use MT::Test; 463 558 464 Test::Class->runtests('Test::GroupBy', 'Test::Search', +1 26);559 Test::Class->runtests('Test::GroupBy', 'Test::Search', +137); 465 560 466 561 my($foo, @foo, @bar); … … 647 742 is_object($tmp, $foo[0], 'Second oldest Foo is Foo #1'); 648 743 744 ## This should load only the first Foo object (because limit is 1). 745 @tmp = Foo->load(undef, { 746 direction => 'descend', 747 sort => 'created_on', 748 fetchonly => ['id'], 749 limit => 1 }); 750 is($tmp[0]->id, $foo[0]->id, 'The newest Foo is Foo #1 (fetchonly)'); 751 752 ## Should load the first Foo object (ascend with offset of 1). 753 @tmp = Foo->load(undef, { 754 direction => 'ascend', 755 sort => 'created_on', 756 fetchonly => ['id'], 757 limit => 1, 758 offset => 1 }); 759 is($tmp[0]->id, $foo[0]->id, 'Second oldest Foo is Foo #1 (fetchonly)'); 760 649 761 ## Now test join loads. 650 762 ## First we need to create a couple of Bar objects. … … 691 803 are_objects(\@tmp, \@foo, 'unique Foos associated with Bars, oldest first'); 692 804 805 ## Use load_iter and do the same thing. 806 @tmp = (); 807 $iter = Foo->load_iter(undef, 808 { join => [ 'Bar', 'foo_id', 809 undef, 810 { sort => 'created_on', 811 direction => 'descend', 812 unique => 1 } ] }); 813 while ( my $obj = $iter->() ) { 814 push @tmp, $obj; 815 } 816 are_objects(\@tmp, \@foo, 'unique Foos associated with Bars, oldest first, by load_iter'); 817 693 818 ## Load all Foo objects in order of most recently 694 819 ## created Bar object. No uniqueness requirement. … … 699 824 direction => 'descend', } ] }); 700 825 are_objects(\@tmp, [ @foo, $foo[1] ], 'Foos associated with Bars, oldest first'); 826 827 ## Use load_iter and do the same thing. 828 @tmp = (); 829 $iter = Foo->load_iter(undef, 830 { join => [ 'Bar', 'foo_id', 831 undef, 832 { sort => 'created_on', 833 direction => 'descend', } ] }); 834 while ( my $obj = $iter->() ) { 835 push @tmp, $obj; 836 } 837 are_objects(\@tmp, [ @foo, $foo[1] ], 'Foos associated with Bars, oldest first, by load_iter'); 701 838 702 839 ## Load last 1 Foo object in order of most recently … … 711 848 are_objects(\@tmp, [ $foo[0] ], 'Foos associated with oldest Bar'); 712 849 850 ## Use load_iter to do the same thing. 851 @tmp = (); 852 $iter = Foo->load_iter(undef, 853 { join => [ 'Bar', 'foo_id', 854 undef, 855 { sort => 'created_on', 856 direction => 'descend', 857 unique => 1, 858 limit => 1, } ] }); 859 while ( my $obj = $iter->() ) { 860 push @tmp, $obj; 861 } 862 are_objects(\@tmp, [ $foo[0] ], 'Foos associated with oldest Bar, by load_iter'); 863 713 864 ## Load all Foo objects where Bar.name = 'bar0' 714 865 @tmp = Foo->load(undef, … … 720 871 are_objects(\@tmp, [ $foo[1] ], 'Foos associated with Bars named bar0'); 721 872 873 ## Use load_iter and do the same thing. 874 @tmp = (); 875 $iter = Foo->load_iter(undef, 876 { join => [ 'Bar', 'foo_id', 877 { name => 'bar0' }, 878 { sort => 'created_on', 879 direction => 'descend', 880 unique => 1, } ] }); 881 while ( my $obj = $iter->() ) { 882 push @tmp, $obj; 883 } 884 are_objects(\@tmp, [ $foo[1] ], 'Foos associated with Bars named bar0, by load_iter'); 885 722 886 ## foo[1] is older than foo[0] because we overrode the timestamp, 723 887 ## so this should load foo[0] … … 727 891 are_objects(\@tmp, [ $foo[0] ], 'One Foo associated with Bars of status=0'); 728 892 893 ## and load_iter 894 @tmp = (); 895 $iter = Foo->load_iter(undef, 896 { sort => 'created_on', direction => 'descend', limit => 1, 897 join => [ 'Bar', 'foo_id', { status => 0 }, { unique => 1 } ] }); 898 while ( my $obj = $iter->() ) { 899 push @tmp, $obj; 900 } 901 are_objects(\@tmp, [ $foo[0] ], 'One Foo associated with Bars of status=0, by load_iter'); 902 729 903 ## This is the same join as the last one, but without the limit--so 730 904 ## we should get both Foo objects this time, in descending order. … … 734 908 are_objects(\@tmp, \@foo, 'All Foos associated with Bars of status=0'); 735 909 910 ## and load_iter. 911 @tmp = (); 912 $iter = Foo->load_iter(undef, 913 { sort => 'created_on', direction => 'descend', 914 join => [ 'Bar', 'foo_id', { status => 0 }, { unique => 1 } ] }); 915 while ( my $obj = $iter->() ) { 916 push @tmp, $obj; 917 } 918 are_objects(\@tmp, \@foo, 'All Foos associated with Bars of status=0, by load_iter'); 919 736 920 ## Filter join results by providing a value for 'status'; only Foo[0] 737 921 ## has a 'status' == 2, so only that record should be returned. … … 741 925 are_objects(\@tmp, [ $foo[0] ], 'Foos of status=2 associated with Bars of status=0'); 742 926 927 ## and load_iter. 928 @tmp = (); 929 $iter = Foo->load_iter({ status => 2 }, 930 { sort => 'created_on', direction => 'descend', 931 join => [ 'Bar', 'foo_id', { status => 0 }, { unique => 1 } ] }); 932 while ( my $obj = $iter->() ) { 933 push @tmp, $obj; 934 } 935 are_objects(\@tmp, [ $foo[0] ], 'Foos of status=2 associated with Bars of status=0, by load_iter'); 936 743 937 # Join across a column. 744 938 @tmp = Foo->load({}, … … 751 945 join => [ 'Bar', undef, { foo_id => \'= foo_id', status => 0 }, { unique => 1 } ] }); 752 946 are_objects(\@tmp, [ $foo[0] ], 'Foos of status=2 loaded by explicit join across columns'); 947 948 # and load_iter. 949 @tmp = (); 950 $iter = Foo->load_iter({}, 951 { sort => 'created_on', direction => 'descend', 952 join => [ 'Bar', undef, { foo_id => \'= foo_id', status => 0 }, { unique => 1 } ] }); 953 while ( my $obj = $iter->() ) { 954 push @tmp, $obj; 955 } 956 are_objects(\@tmp, \@foo, 'Foos loaded by explicit join across columns, by load_iter'); 957 958 @tmp = (); 959 $iter = Foo->load_iter({ status => 2 }, 960 { sort => 'created_on', direction => 'descend', 961 join => [ 'Bar', undef, { foo_id => \'= foo_id', status => 0 }, { unique => 1 } ] }); 962 while ( my $obj = $iter->() ) { 963 push @tmp, $obj; 964 } 965 are_objects(\@tmp, [ $foo[0] ], 'Foos of status=2 loaded by explicit join across columns, by load_iter'); 753 966 754 967 ## TEST EXISTS METHOD -
trunk/tmpl/cms/dialog/comment_reply.tmpl
r2784 r3219 22 22 <input type="hidden" name="return_url" value="<mt:if name="return_url"><mt:var name="return_url" escape="html"><mt:else><mt:var name="mt_url">?__mode=list_comments&blog_id=<mt:var name="blog_id" escape="url"></mt:if>" /> 23 23 <div id="comment"> 24 <p class="comment-meta"><__trans phrase="On [_1], [_2] commented on [_3]" params="<span class="comment-date"><$mt:var name="comment_created_on"$></span>%%<span class="commenter-name"><$mt:var name="commenter_name" escape="html"$></span>%%<span class="entry-title"><$mt:var name="entry_title" escape="html" $></span>"></p>24 <p class="comment-meta"><__trans phrase="On [_1], [_2] commented on [_3]" params="<span class="comment-date"><$mt:var name="comment_created_on"$></span>%%<span class="commenter-name"><$mt:var name="commenter_name" escape="html"$></span>%%<span class="entry-title"><$mt:var name="entry_title" escape="html" escape="html"$></span>"></p> 25 25 <div class="comment-body"> 26 26 <$mt:var name="comment_text"$> -
trunk/tmpl/cms/edit_asset.tmpl
r2784 r3219 24 24 label="<__trans phrase="Stats">"> 25 25 <ul class="object-stats"> 26 <li><__trans phrase="[_1] - Created by [_2]" params="<$mt:date ts="$created_on_ts" relative="1" _default="$created_on_formatted"$>%%<$mt:var name="created_by" escape="html" $>"></li>26 <li><__trans phrase="[_1] - Created by [_2]" params="<$mt:date ts="$created_on_ts" relative="1" _default="$created_on_formatted"$>%%<$mt:var name="created_by" escape="html" escape="html"$>"></li> 27 27 <mt:if name="modified_by"> 28 <li><__trans phrase="[_1] - Modified by [_2]" params="<$mt:date ts="$modified_on_ts" relative="1" _default="$modified_on_formatted"$>%%<$mt:var name="modified_by" escape="html" $>"></li>28 <li><__trans phrase="[_1] - Modified by [_2]" params="<$mt:date ts="$modified_on_ts" relative="1" _default="$modified_on_formatted"$>%%<$mt:var name="modified_by" escape="html" escape="html"$>"></li> 29 29 </mt:if> 30 30 </ul> -
trunk/tmpl/cms/edit_author.tmpl
r2784 r3219 78 78 } 79 79 function passwordResetConfirm() { 80 if (confirm('<__trans phrase="_WARNING_PASSWORD_RESET_SINGLE" params="<mt:var name="name" escape="js">%%<mt:var name="email" escape="js">">')) { 80 var username = '<mt:var name="name" escape="js">'; 81 var email = '<mt:var name="email" escape="js">'; 82 if (confirm('<__trans phrase="_WARNING_PASSWORD_RESET_SINGLE" params="'+username+'%%'+email+'">')) { 81 83 document.forms['recover'].submit(); 82 84 } -
trunk/tmpl/cms/edit_commenter.tmpl
r2784 r3219 29 29 label="<__trans phrase="Useful links">"> 30 30 <ul> 31 <li><a href="<mt:var name="script_url">?__mode=list_comments&blog_id=<mt:var name="blog_id" escape="url">&filter_key=_comments_by_user&filter_val=<mt:var name="id" escape="url">"><__trans phrase="Comments from [_1]" params="<mt:var name="nickname" escape="html" >"></a></li>31 <li><a href="<mt:var name="script_url">?__mode=list_comments&blog_id=<mt:var name="blog_id" escape="url">&filter_key=_comments_by_user&filter_val=<mt:var name="id" escape="url">"><__trans phrase="Comments from [_1]" params="<mt:var name="nickname" escape="html" escape="html">"></a></li> 32 32 </ul> 33 33 </mtapp:widget> -
trunk/tmpl/cms/edit_entry.tmpl
r3098 r3219 353 353 <mt:unless name="new_object"> 354 354 <ul> 355 <li><__trans phrase="[_1] - Created by [_2]" params="<$mt:date ts="$created_on_ts" relative="1" _default="$created_on_formatted"$>%%<$mt:var name="created_by" escape="html" $>"></li>355 <li><__trans phrase="[_1] - Created by [_2]" params="<$mt:date ts="$created_on_ts" relative="1" _default="$created_on_formatted"$>%%<$mt:var name="created_by" escape="html" escape="html"$>"></li> 356 356 <mt:if name="status_publish"> 357 <li><__trans phrase="[_1] - Published by [_2]" params="<$MTDate ts="$authored_on_ts" relative="1" _default="$authored_on_formatted"$>%%<$mt:var name="author_name" escape="html" $>"></li>357 <li><__trans phrase="[_1] - Published by [_2]" params="<$MTDate ts="$authored_on_ts" relative="1" _default="$authored_on_formatted"$>%%<$mt:var name="author_name" escape="html" escape="html"$>"></li> 358 358 </mt:if> 359 359 <mt:if name="modified_by"> 360 <li><__trans phrase="[_1] - Edited by [_2]" params="<$MTDate ts="$modified_on_ts" relative="1" _default="$modified_on_formatted"$>%%<$mt:var name="modified_by" escape="html" $>"></li>360 <li><__trans phrase="[_1] - Edited by [_2]" params="<$MTDate ts="$modified_on_ts" relative="1" _default="$modified_on_formatted"$>%%<$mt:var name="modified_by" escape="html" escape="html"$>"></li> 361 361 </mt:if> 362 362 </ul> … … 898 898 899 899 function listPreviousPings () { 900 window.open('< TMPL_VAR NAME=SCRIPT_URL>?__mode=pinged_urls&entry_id=<TMPL_VAR NAME=ID>&blog_id=<TMPL_VAR NAME=BLOG_ID>', 'urls', 'width=400,height=400,resizable=yes,scrollbars=yes');900 window.open('<mt:var name="script_url">?__mode=pinged_urls&entry_id=<mt:var name="id" escape="html">&blog_id=<mt:var name="blog_id" escape="html">', 'urls', 'width=400,height=400,resizable=yes,scrollbars=yes'); 901 901 } 902 902 /* ]]> */ -
trunk/tmpl/cms/edit_role.tmpl
r2784 r3219 257 257 label="<__trans phrase="Created by">" 258 258 hint=""> 259 <p><mt:if name="created_by"><mt:var name="created_by" ><mt:else><em><__trans phrase="System"></em></mt:if></p>259 <p><mt:if name="created_by"><mt:var name="created_by" escape="html"><mt:else><em><__trans phrase="System"></em></mt:if></p> 260 260 </mtapp:setting> 261 261 </mt:if> -
trunk/tmpl/cms/include/asset_table.tmpl
r1226 r3219 72 72 </mt:if> 73 73 </td> 74 <td class="as-created-by"><mt:if name="created_by"><mt:var name="created_by" ><mt:else><em><__trans phrase="System"></em></mt:if></td>74 <td class="as-created-by"><mt:if name="created_by"><mt:var name="created_by" escape="html"><mt:else><em><__trans phrase="System"></em></mt:if></td> 75 75 <td><span title="<mt:var name="created_on_formatted">"><mt:if name="created_on_relative"><mt:if name="dates_relative"><mt:var name="created_on_relative"><mt:else><mt:var name="created_on_formatted"></mt:if><mt:else><mt:var name="created_on_formatted"></mt:if></span></td> 76 76 <td class="si status-view"><mt:if name="url"><a href="<mt:var name="url">" target="view_uploaded" title="<__trans phrase="View">"><img src="<mt:var name="static_uri">images/spacer.gif" alt="<__trans phrase="View">" width="13" height="9" /></a><mt:else> </mt:if></td> -
trunk/tmpl/cms/include/comment_detail.tmpl
r2692 r3219 6 6 <$mt:CommentAuthorIdentity$> 7 7 <mt:IfCommentParent> 8 <__trans phrase="[_1] replied to <a href="[_2]">comment from [_3]</a>" params="<span class="vcard author"><$mt:CommentAuthorLink $></span>%%<mt:CommentParent><$mt:CommentLink$></mt:CommentParent>%%<mt:CommentParent><$mt:CommentAuthor$></mt:CommentParent>">8 <__trans phrase="[_1] replied to <a href="[_2]">comment from [_3]</a>" params="<span class="vcard author"><$mt:CommentAuthorLink escape="html"$></span>%%<mt:CommentParent><$mt:CommentLink$></mt:CommentParent>%%<mt:CommentParent><$mt:CommentAuthor escape="html"$></mt:CommentParent>"> 9 9 <mt:Else> 10 <span class="vcard author"><$mt:CommentAuthorLink $></span>10 <span class="vcard author"><$mt:CommentAuthorLink escape="html"$></span> 11 11 </mt:IfCommentParent> 12 12 | <a href="<$mt:CommentLink$>"><abbr class="published" title="<$mt:CommentDate format_name="iso8601"$>"><$mt:CommentDate$></abbr></a> -
trunk/tmpl/cms/include/entry_table.tmpl
r3063 r3219 169 169 <mt:if name="is_editable"> 170 170 <input type="hidden" name="author_id_<$mt:var name="id"$>" value="<$mt:var name="row_author_id"$>" id="entry_author_id_<$mt:var name="id"$>"> 171 <a href="javascript:void(0)" onclick="return openDialog(this.form, 'dialog_select_author', 'blog_id=<$mt:var name="blog_id"$>&multi=0&idfield=entry_author_id_<$mt:var name="id"$>&namefield=entry_author_name_<$mt:var name="id"$>')"><span id="entry_author_name_<$mt:var name="id"$>"><$mt:var name="row_author_name" $></span></a>172 <mt:else> 173 <$mt:var name="author_name" $>171 <a href="javascript:void(0)" onclick="return openDialog(this.form, 'dialog_select_author', 'blog_id=<$mt:var name="blog_id"$>&multi=0&idfield=entry_author_id_<$mt:var name="id"$>&namefield=entry_author_name_<$mt:var name="id"$>')"><span id="entry_author_name_<$mt:var name="id"$>"><$mt:var name="row_author_name" escape="html"$></span></a> 172 <mt:else> 173 <$mt:var name="author_name" escape="html"$> 174 174 </mt:if> 175 175 </td> -
trunk/tmpl/cms/include/header.tmpl
r2977 r3219 92 92 </mt:unless> 93 93 <li id="help" class="help"><a href="javascript:void(0)" onclick="openManual('<mt:var name="template_filename" escape="js">')"><__trans phrase="Help"></a></li> 94 <li id="user"><a href="<$mt:var name="mt_url"$>?__mode=view&_type=author&id=<$mt:var name="author_id" $>"><__trans phrase="Hi [_1]," params="<$mt:var name="author_name"$>"></a></li>94 <li id="user"><a href="<$mt:var name="mt_url"$>?__mode=view&_type=author&id=<$mt:var name="author_id" escape="html" escape="html"$>"><__trans phrase="Hi [_1]," params="<$mt:var name="author_name" escape="html" escape="html"$>"></a></li> 95 95 <mt:if name="can_logout"> 96 96 <li id="logout"><a href="<$mt:var name="mt_url"$>?__mode=logout"><__trans phrase="Logout"></a></li> -
trunk/tmpl/cms/include/import_start.tmpl
r1098 r3219 12 12 13 13 <pre><__trans phrase="Importing entries into blog" params="<mt:var name="blog_name" escape="html">"> 14 <mt:if name="import_as_me"><__trans phrase="Importing entries as user '[_1]'" params="<mt:var name="author_name" >"><mt:else><__trans phrase="Creating new users for each user found in the blog"></mt:if>14 <mt:if name="import_as_me"><__trans phrase="Importing entries as user '[_1]'" params="<mt:var name="author_name" escape="html" escape="html">"><mt:else><__trans phrase="Creating new users for each user found in the blog"></mt:if> 15 15 -
trunk/tmpl/cms/include/list_associations/page_title.tmpl
r1098 r3219 1 1 <mt:if name="user_view"> 2 <mt:setvarblock name="page_title"><__trans phrase="Permissions for [_1]" params="<mt:var name="edit_name" escape="html" >"></mt:setvarblock>2 <mt:setvarblock name="page_title"><__trans phrase="Permissions for [_1]" params="<mt:var name="edit_name" escape="html" escape="html">"></mt:setvarblock> 3 3 </mt:if> 4 4 <mt:if name="usergroup_view"> -
trunk/tmpl/cms/include/list_associations/table_role_view.tmpl
r1098 r3219 2 2 <td> 3 3 <mt:if name="is_administrator"> 4 <a href="<$mt:var name="script_url"$>?__mode=list_associations&role_id=<$mt:var name="role_id" $>"><$mt:var name="role_name" escape="html"$>4 <a href="<$mt:var name="script_url"$>?__mode=list_associations&role_id=<$mt:var name="role_id" escape="html"$>"><$mt:var name="role_name" escape="html"$> 5 5 <mt:else> 6 6 <$mt:var name="role_name" escape="html"$> … … 11 11 <td> 12 12 <mt:if name="is_administrator"> 13 <a href="<mt:var name="script_url">?__mode=list_associations&author_id=<mt:var name="user_id" >" class="icon-right icon-user"><$mt:var name="user_name" escape="html"$></a>13 <a href="<mt:var name="script_url">?__mode=list_associations&author_id=<mt:var name="user_id" escape="html">" class="icon-right icon-user"><$mt:var name="user_name" escape="html"$></a> 14 14 <mt:else> 15 15 <span class="icon-right icon-user"><$mt:var name="user_name" escape="html"$></span> -
trunk/tmpl/cms/include/list_associations/table_user_view.tmpl
r1098 r3219 1 1 <mt:if name="user_id"> 2 2 <mt:if name="is_administrator"> 3 <a href="<mt:var name="script_url">?__mode=list_associations&author_id=<mt:var name="user_id" >" class="icon-right icon-user"><$mt:var name="user_name" escape="html"$></a>3 <a href="<mt:var name="script_url">?__mode=list_associations&author_id=<mt:var name="user_id" escape="html">" class="icon-right icon-user"><$mt:var name="user_name" escape="html"$></a> 4 4 <mt:else> 5 5 <span class="icon-right icon-user"><$mt:var name="user_name" escape="html"$></span> -
trunk/tmpl/cms/include/listing_panel.tmpl
r1098 r3219 62 62 <tr id="<mt:var name="panel_type">-<mt:var name="id">" class="<mt:if name="__odd__">odd<mt:else>even</mt:if>"> 63 63 <td class="cb"><input type="<mt:if name="panel_multi">checkbox<mt:else>radio</mt:if>" class="select" name="<mt:var name="panel_type">-cb" value="<mt:var name="id">" <mt:if name="disabled">disabled="disabled"</mt:if> /></td> 64 <td class="panel-label"><label><mt:var name="label" ></label></td>64 <td class="panel-label"><label><mt:var name="label" escape="html"></label></td> 65 65 <td class="panel-description"> 66 <mt:if name="link"><span class="view-site-link"><a href="<mt:var name="link" escape="html">" target="_blank"><img src="<mt:var name="static_uri">images/spacer.gif" title="<__trans phrase="Go to [_1]" params="<mt:var name="label" escape="html">">" width="13" height="9" alt="" /></a></span></mt:if> 67 <mt:if name="link"><span class="float_desc"></mt:if><mt:var name="description"><mt:if name="link"></span></mt:if> 66 <mt:Ignore><!-- No, the duplicate escape modifiers below is not a typo. --></mt:Ignore> 67 <mt:if name="link"><span class="view-site-link"><a href="<mt:var name="link" escape="html">" target="_blank"><img src="<mt:var name="static_uri">images/spacer.gif" title="<__trans phrase="Go to [_1]" params="<mt:var name="label" escape="html" escape="html">">" width="13" height="9" alt="" /></a></span></mt:if> 68 <mt:if name="link"><span class="float_desc"></mt:if><mt:var name="description" escape="html"><mt:if name="link"></span></mt:if> 68 69 </td> 69 70 </tr> -
trunk/tmpl/cms/include/log_table.tmpl
r1100 r3219 23 23 <td class="weblog"><a href="<$mt:var name="script_url"$>?__mode=view_log&blog_id=<$mt:var name="blog_id"$>"><$mt:var name="weblog_name" escape="html"$></a></td> 24 24 </mt:if> 25 <td class="action-by"><mt:if name="username"><$mt:var name="username" $><mt:else><__trans phrase="[_1]" params="<$mt:var name="log_ip"$>"></mt:if></td>25 <td class="action-by"><mt:if name="username"><$mt:var name="username" escape="html"$><mt:else><__trans phrase="[_1]" params="<$mt:var name="log_ip"$>"></mt:if></td> 26 26 <td class="date"><mt:if name="is_last"><a name="last"></a></mt:if><span title="<$mt:var name="created_on_formatted"$>"><mt:if name="created_on_relative"><mt:if name="dates_relative"><$mt:var name="created_on_relative"$><mt:else><$mt:var name="created_on_formatted"$></mt:if><mt:else><$mt:var name="created_on_formatted"$></mt:if></span></td> 27 27 </tr> -
trunk/tmpl/cms/include/template_table.tmpl
r3082 r3219 31 31 <mt:else if name="template_type" eq="archive"> 32 32 <a href="javascript:void(0)" 33 onclick="doForMarkedInThisWindow(getByID('<$mt:var name="template_type" default="template" $>-listing-form'), '<__trans phrase="template" escape="js">', '<__trans phrase="templates" escape="js">', 'id', 'publish_archive_templates', {}, '<__trans phrase="to publish" escape="js">'); return false;"33 onclick="doForMarkedInThisWindow(getByID('<$mt:var name="template_type" default="template" escape="html"$>-listing-form'), '<__trans phrase="template" escape="js">', '<__trans phrase="templates" escape="js">', 'id', 'publish_archive_templates', {}, '<__trans phrase="to publish" escape="js">'); return false;" 34 34 accesskey="a" 35 35 title="<__trans phrase="Publish selected templates (a)">" … … 74 74 <tbody> 75 75 </mt:if> 76 <tr class="<mt:if name="__odd__">odd<mt:else>even</mt:if> template-<$mt:var name="template_type" default="template" $>">76 <tr class="<mt:if name="__odd__">odd<mt:else>even</mt:if> template-<$mt:var name="template_type" default="template" escape="html"$>"> 77 77 <td class="cb"><input type="checkbox" name="id" class="select" value="<mt:var name="id">" /></td> 78 78 <td class="template-name"><a href="<mt:var name="script_url">?__mode=view&_type=template&id=<mt:var name="id">&blog_id=<mt:var name="blog_id">"><mt:var name="name" escape="html"></a></td> … … 139 139 <mt:else> 140 140 <mt:if name="blog_id"> 141 <div id="<$mt:var name="template_type" default="template" $>-listing" class="listing zero-state-listing zero-state">141 <div id="<$mt:var name="template_type" default="template" escape="html"$>-listing" class="listing zero-state-listing zero-state"> 142 142 <div class="listing-header"> 143 143 <$mt:var name="listing_header"$> -
trunk/tmpl/cms/include/users_content_nav.tmpl
r1501 r3219 2 2 <mt:if name="USER_VIEW"> 3 3 <mt:unless name="EDIT_AUTHOR_ID" eq="PSEUDO"> 4 <li><a href="<mt:var name="SCRIPT_URL">?__mode=view&_type=author&id=<mt:var name="EDIT_AUTHOR_ID" >"><b><__trans phrase="Profile"></b></a></li>4 <li><a href="<mt:var name="SCRIPT_URL">?__mode=view&_type=author&id=<mt:var name="EDIT_AUTHOR_ID" escape="html">"><b><__trans phrase="Profile"></b></a></li> 5 5 </mt:unless> 6 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&author_id=<mt:var name="EDIT_AUTHOR_ID" >"><b><__trans phrase="Permissions"></b></a></li>6 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&author_id=<mt:var name="EDIT_AUTHOR_ID" escape="html">"><b><__trans phrase="Permissions"></b></a></li> 7 7 </mt:if> 8 8 9 9 <mt:if name="edit_author"> 10 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=view&_type=author<mt:if name="id">&id=<mt:var name="id" ></mt:if>"><b><__trans phrase="Profile"></b></a></li>10 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=view&_type=author<mt:if name="id">&id=<mt:var name="id" escape="html"></mt:if>"><b><__trans phrase="Profile"></b></a></li> 11 11 <mt:unless name="new_object"> 12 <li><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&author_id=<mt:var name="id" >"><b><__trans phrase="Permissions"></b></a></li>12 <li><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&author_id=<mt:var name="id" escape="html">"><b><__trans phrase="Permissions"></b></a></li> 13 13 </mt:unless> 14 14 </mt:if> 15 15 16 16 <mt:if name="ROLE_VIEW"> 17 <li><a href="<mt:var name="SCRIPT_URL">?__mode=edit_role&id=<mt:var name="ROLE_ID" >"><b><__trans phrase="Details"></b></a></li>18 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&role_id=<mt:var name="ROLE_ID" >"><b><__trans phrase="Users"></b></a></li>17 <li><a href="<mt:var name="SCRIPT_URL">?__mode=edit_role&id=<mt:var name="ROLE_ID" escape="html">"><b><__trans phrase="Details"></b></a></li> 18 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&role_id=<mt:var name="ROLE_ID" escape="html">"><b><__trans phrase="Users"></b></a></li> 19 19 </mt:if> 20 20 21 21 <mt:if name="edit_role"> 22 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=edit_role&id=<mt:var name="ID" >"><b><__trans phrase="Details"></b></a></li>23 <li><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&role_id=<mt:var name="ID" >"><b><__trans phrase="Users"></b></a></li>22 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=edit_role&id=<mt:var name="ID" escape="html">"><b><__trans phrase="Details"></b></a></li> 23 <li><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&role_id=<mt:var name="ID" escape="html">"><b><__trans phrase="Users"></b></a></li> 24 24 </mt:if> 25 25 … … 27 27 <li><a href="<mt:var name="SCRIPT_URL">?__mode=list_authors"><b><__trans phrase="Users"></b></a></li> 28 28 <li><a href="<mt:var name="SCRIPT_URL">?__mode=list_roles"><b><__trans phrase="Roles"></b></a></li> 29 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&blog_id=<mt:var name="BLOG_ID" >"><b><__trans phrase="Permissions"></b></a></li>29 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&blog_id=<mt:var name="BLOG_ID" escape="html">"><b><__trans phrase="Permissions"></b></a></li> 30 30 </mt:if> 31 31 … … 34 34 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=list_authors"><b><__trans phrase="Users"></b></a></li> 35 35 <li><a href="<mt:var name="SCRIPT_URL">?__mode=list_roles"><b><__trans phrase="Roles"></b></a></li> 36 <li><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&blog_id=<mt:var name="BLOG_ID" >"><b><__trans phrase="Permissions"></b></a></li>36 <li><a href="<mt:var name="SCRIPT_URL">?__mode=list_associations&blog_id=<mt:var name="BLOG_ID" escape="html">"><b><__trans phrase="Permissions"></b></a></li> 37 37 </mt:if> 38 38 39 39 <mt:if name="list_role"> 40 40 <mt:if name="EDIT_AUTHOR_ID"> 41 <li><a href="<mt:var name="SCRIPT_URL">?__mode=view&_type=author&id=<mt:var name="EDIT_AUTHOR_ID" >"><b><__trans phrase="Profile"></b></a></li>42 <li class="active"><a href="<mt:var name="SCRIPT_URL">?__mode=list_roles&author_id=<mt:var name="EDIT_AUTHOR_ID" >"><b><__trans phrase="Roles"></b></a></li>41 <li><a href="<mt:var name="SCRIPT_URL">?__mode=view&_type=author&id=<mt:var name="EDIT_AUTHOR_ID" escape="html">"><b><__trans phrase
