Changeset 3082
- Timestamp:
- 10/03/08 01:07:01 (9 months ago)
- Location:
- trunk
- Files:
-
- 36 modified
-
build/Build.pm (modified) (1 diff)
-
lib/MT.pm (modified) (2 diffs)
-
lib/MT/App.pm (modified) (1 diff)
-
lib/MT/App/CMS.pm (modified) (3 diffs)
-
lib/MT/App/Search.pm (modified) (1 diff)
-
lib/MT/Asset/Image.pm (modified) (5 diffs)
-
lib/MT/Blog.pm (modified) (1 diff)
-
lib/MT/CMS/Asset.pm (modified) (1 diff)
-
lib/MT/CMS/Blog.pm (modified) (3 diffs)
-
lib/MT/CMS/Common.pm (modified) (1 diff)
-
lib/MT/CMS/Dashboard.pm (modified) (1 diff)
-
lib/MT/CMS/Entry.pm (modified) (2 diffs)
-
lib/MT/L10N/ja.pm (modified) (8 diffs)
-
lib/MT/ObjectDriver/Driver/DBI.pm (modified) (1 diff)
-
lib/MT/Permission.pm (modified) (2 diffs)
-
lib/MT/Tag.pm (modified) (2 diffs)
-
lib/MT/Template.pm (modified) (1 diff)
-
lib/MT/Template/Context.pm (modified) (1 diff)
-
lib/MT/Template/ContextHandlers.pm (modified) (5 diffs)
-
lib/MT/TemplateMap.pm (modified) (1 diff)
-
lib/MT/Upgrade.pm (modified) (6 diffs)
-
lib/MT/Upgrade/v4.pm (modified) (4 diffs)
-
lib/MT/WeblogPublisher.pm (modified) (2 diffs)
-
mt-static/js/archetype_editor.js (modified) (1 diff)
-
php/lib/MTUtil.php (modified) (6 diffs)
-
php/lib/function.mtvar.php (modified) (2 diffs)
-
php/lib/modifier.setvar.php (modified) (1 diff)
-
php/lib/sanitize_lib.php (modified) (2 diffs, 1 prop)
-
php/lib/thumbnail_lib.php (modified) (4 diffs)
-
php/mt.php (modified) (1 diff)
-
t/35-tags.dat (modified) (1 diff)
-
tmpl/cms/cfg_archives.tmpl (modified) (2 diffs)
-
tmpl/cms/error.tmpl (modified) (1 diff)
-
tmpl/cms/include/template_table.tmpl (modified) (5 diffs)
-
tmpl/cms/list_template.tmpl (modified) (1 diff)
-
tmpl/cms/widget/blog_stats_tag_cloud.tmpl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/build/Build.pm
r1681 r3082 152 152 ($self->{'short-lang=s'} = $self->{'lang=s'}) =~ s/([a-z]{2})_[A-Z]{2}$/$1/o; 153 153 154 $self->{'pack=s'} ||= 'MT ';154 $self->{'pack=s'} ||= 'MTOS'; 155 155 $ENV{BUILD_PACKAGE} = $self->{'pack=s'}; 156 156 $ENV{BUILD_LANGUAGE} = $self->{'lang=s'}; -
trunk/lib/MT.pm
r3019 r3082 32 32 ( $VERSION, $SCHEMA_VERSION ) = ( '4.21', '4.0068' ); 33 33 ( $PRODUCT_NAME, $PRODUCT_CODE, $PRODUCT_VERSION, $VERSION_ID, $PORTAL_URL ) = ( 34 ' __PRODUCT_NAME__', 'MT',34 'Movable Type Pro', 'MT', 35 35 '4.21', '4.21', 36 ' __PORTAL_URL__'36 'http://www.sixapart.com/movabletype/' 37 37 ); 38 38 … … 108 108 109 109 sub build_id { 110 my $build_id = ' __BUILD_ID__';110 my $build_id = '-en-trunk-r3063-20081002'; 111 111 $build_id = '' if $build_id eq '__BUILD_' . 'ID__'; 112 112 return $build_id; -
trunk/lib/MT/App.pm
r3017 r3082 2420 2420 if ( $type eq 'dialog' ) { 2421 2421 $param->{name} ||= $app->{name} || 'dialog'; 2422 $param->{goback} ||= $app->{goback}|| 'closeDialog()';2422 $param->{goback} ||= "window.location='" . $app->{goback} . "'" || 'closeDialog()'; 2423 2423 $param->{value} ||= $app->{value} || $app->translate("Close"); 2424 2424 $param->{dialog} = 1; 2425 2425 } 2426 2426 else { 2427 $param->{goback} ||= $app->{goback}|| 'history.back()';2427 $param->{goback} ||= "window.location='" . $app->{goback} . "'" || 'history.back()'; 2428 2428 $param->{value} ||= $app->{value} || $app->translate("Go Back"); 2429 2429 } -
trunk/lib/MT/App/CMS.pm
r3039 r3082 748 748 handler => sub { 749 749 my ( $terms, $args ) = @_; 750 my $ts = time - 10* 24 * 60 * 60;750 my $ts = time - 7 * 24 * 60 * 60; 751 751 $ts = epoch2ts( MT->app->blog, $ts ); 752 752 $args->{join} = MT::Comment->join_on( … … 1050 1050 $terms->{created_on} = [ $from, $to ]; 1051 1051 $args->{range_incl}{created_on} = 1; 1052 },1053 },1054 },1055 template => {1056 index_templates => {1057 label => "Index Templates",1058 order => 100,1059 handler => sub {1060 my ( $terms, $args ) = @_;1061 1062 # FIXME: enumeration of types1063 $terms->{type} = 'index';1064 },1065 condition => sub {1066 $app->param('blog_id');1067 },1068 },1069 archive_templates => {1070 label => "Archive Templates",1071 order => 200,1072 handler => sub {1073 my ( $terms, $args ) = @_;1074 $terms->{type}1075 = [ 'individual', 'page', 'archive', 'category' ];1076 },1077 condition => sub {1078 $app->param('blog_id');1079 },1080 },1081 module_templates => {1082 label => "Template Modules",1083 order => 400,1084 handler => sub {1085 my ($terms) = @_;1086 $terms->{type} = 'custom';1087 },1088 },1089 email_templates => {1090 label => "E-mail Templates",1091 order => 300,1092 handler => sub {1093 my ($terms) = @_;1094 $terms->{type} = 'email';1095 },1096 condition => sub {1097 !$app->param('blog_id');1098 },1099 },1100 system_templates => {1101 label => "System Templates",1102 order => 200,1103 handler => sub {1104 my ($terms) = @_;1105 my $scope;1106 my $set;1107 if ( my $blog_id = $app->param('blog_id') ) {1108 my $blog = $app->model('blog')->load($blog_id);1109 $set = $blog->template_set;1110 $scope .= 'system';1111 }1112 else {1113 $terms->{blog_id} = 0;1114 $scope = 'global:system';1115 }1116 my @tmpl_path1117 = ( $set && ( $set ne 'mt_blog' ) )1118 ? ( "template_sets", $set, 'templates', $scope )1119 : ( "default_templates", $scope );1120 my $sys_tmpl = MT->registry(@tmpl_path) || {};1121 $terms->{type} = [ keys %$sys_tmpl ];1122 },1123 condition => sub {1124 $app->param('blog_id');1125 1052 }, 1126 1053 }, … … 2438 2365 2439 2366 # this is the template that likely caused the rebuild error 2440 push @{ $param->{button_loop} ||= [] }, 2441 { 2442 link => $app->uri( 2443 mode => 'view', 2444 args => { 2445 blog_id => $tmpl->blog_id, 2446 '_type' => 'template', 2447 id => $tmpl->id 2367 my $tmpl_edit_link = $app->uri( 2368 mode => 'view', 2369 args => { 2370 blog_id => $tmpl->blog_id, 2371 '_type' => 'template', 2372 id => $tmpl->id 2373 } 2374 ); 2375 2376 if ( $app->param('fs') ) { 2377 $param->{fs} = 1; 2378 if ( exists $app->{goback} ) { 2379 $param->{goback} = "window.location='" . $app->{goback} . "'"; 2380 if ( $tmpl_edit_link ne $app->{goback} ) { 2381 push @{ $param->{button_loop} ||= [] }, 2382 { 2383 link => $tmpl_edit_link, 2384 label => $app->translate("Edit Template"), 2385 }; 2448 2386 } 2449 ), 2450 label => $app->translate("Edit Template"), 2451 }; 2452 } 2453 2454 my $blog_id = $app->param('blog_id'); 2455 my $url = $app->uri( 2456 mode => 'rebuild_confirm', 2457 args => { blog_id => $blog_id } 2458 ); 2459 $param->{goback} ||= qq{window.location='$url'}; 2460 $param->{value} ||= $app->translate('Go Back'); 2387 } 2388 else { 2389 $param->{goback} = "window.location='$tmpl_edit_link'"; 2390 } 2391 } 2392 else { 2393 push @{ $param->{button_loop} ||= [] }, 2394 { 2395 link => $tmpl_edit_link, 2396 label => $app->translate("Edit Template"), 2397 }; 2398 } 2399 } 2400 2401 if ( !exists( $param->{goback} ) && exists( $app->{goback} ) ) { 2402 $param->{goback} = "window.location='" . $app->{goback} . "'"; 2403 } 2404 else { 2405 my $blog_id = $app->param('blog_id'); 2406 my $url = $app->uri( 2407 mode => 'rebuild_confirm', 2408 args => { blog_id => $blog_id } 2409 ); 2410 $param->{goback} ||= qq{window.location='$url'}; 2411 } 2412 $param->{value} ||= $app->{value} || $app->translate('Go Back'); 2461 2413 } 2462 2414 -
trunk/lib/MT/App/Search.pm
r2991 r3082 227 227 else { 228 228 $blog_id =~ s/\D+//g; # only numeric values. 229 $blog_list{$type}{$blog_id} = 1 ;229 $blog_list{$type}{$blog_id} = 1 if $blog_id; 230 230 } 231 231 } -
trunk/lib/MT/Asset/Image.pm
r2635 r3082 231 231 232 232 require MT::Util; 233 my $format = $param{Format} || MT->translate('%f-thumb-%wx%h %x');233 my $format = $param{Format} || MT->translate('%f-thumb-%wx%h-%i%x'); 234 234 my $width = $param{Width} || 'auto'; 235 235 my $height = $param{Height} || 'auto'; … … 550 550 $app->translate( "Invalid basename '[_1]'", $rel_path ) ); 551 551 } 552 $rel_path .= '-' . $asset->id; 552 553 my $ext = $blog->file_extension || ''; 553 554 $ext = '.' . $ext if $ext ne ''; … … 567 568 File::Spec->catfile( $root_path, $rel_path . $ext ); 568 569 569 ## If the popup filename already exists, we don't want to overwrite570 ## it, because it could contain valuable data; so we'll just make571 ## sure to generate the name uniquely.572 570 my ( $i, $rel_path_ext ) = ( 0, $rel_path . $ext ); 573 while ( $fmgr->exists($abs_file_path) ) {574 $rel_path_ext = $rel_path . ++$i . $ext;575 $abs_file_path =576 File::Spec->catfile( $root_path, $rel_path_ext );577 }578 571 $pseudo_path = File::Spec->catfile( $pseudo_path, $rel_path_ext ); 579 572 my ( $vol, $dirs, $basename ) = … … 600 593 $original = $asset_html->clone; 601 594 $asset_html->blog_id($blog_id); 602 $asset_html->url($pseudo_path); 595 my $pseudo_url = $pseudo_path; 596 $pseudo_url =~ s!\\!/!g; 597 $asset_html->url($pseudo_url); 603 598 $asset_html->label($app->translate("Popup Page for [_1]", $asset->label || $asset->file_name)); 604 599 $asset_html->file_path($pseudo_path); … … 610 605 } else { 611 606 $original = $asset_html->clone; 612 } 607 } 613 608 614 609 # Select back the real URL for callbacks -
trunk/lib/MT/Blog.pm
r2606 r3082 870 870 ); 871 871 while (my $tmpl = $iter->()) { 872 my @old_widgets = split /,/, $tmpl->modulesets; 872 873 $tmpl_processor->($new_blog_id, \$counter, $tmpl, \%tmpl_map); 873 my @old_widgets = split /,/, $tmpl->modulesets;874 874 my @new_widgets; 875 875 push @new_widgets, $tmpl_map{$_} -
trunk/lib/MT/CMS/Asset.pm
r2802 r3082 151 151 push @blog_ids, $_->blog_id 152 152 foreach grep { $_->can_edit_assets } @perms; 153 $terms{blog_id} = \@blog_ids;153 $terms{blog_id} = @blog_ids ? \@blog_ids : 0; 154 154 } 155 155 } -
trunk/lib/MT/CMS/Blog.pm
r3001 r3082 532 532 my $type = $app->param('_type') || 'entry'; 533 533 my @ids = $app->param('id'); 534 $app->{goback} = "window.location='" . $app->return_uri . "'";534 $app->{goback} = $app->return_uri; 535 535 $app->{value} ||= $app->translate('Go Back'); 536 536 if ( $type eq 'entry' ) { … … 611 611 $edit_type = $entry ? $entry->class : 'entry'; 612 612 } 613 $app->{goback} = 614 "window.location='" 615 . $app->object_edit_uri( $edit_type, $obj_id ) . "'"; 613 $app->{goback} = $app->object_edit_uri( $edit_type, $obj_id ); 616 614 $app->{value} ||= $app->translate('Go Back'); 617 615 } … … 691 689 elsif ($type) { 692 690 my $special = 0; 693 my @options = $app->{rebuild_options} ||= {}; 691 my @options; 692 my $opts = $app->registry("rebuild_options") || {}; 693 if ($opts) { 694 foreach my $opt ( keys %$opts ) { 695 $opts->{$opt}{key} ||= $opt; 696 push @options, $opts->{$opt}; 697 } 698 } 694 699 $app->run_callbacks( 'rebuild_options', $app, \@options ); 695 700 for my $optn (@options) { 696 701 if ( ( $optn->{key} || '' ) eq $type ) { 702 my $code = $optn->{code}; 703 unless ( ref($code) eq 'CODE' ) { 704 $code = MT->handler_to_coderef($code); 705 $optn->{code} = $code; 706 } 697 707 $optn->{code}->(); 698 708 $special = 1; -
trunk/lib/MT/CMS/Common.pm
r3039 r3082 961 961 } 962 962 elsif ( $type eq 'category' ) { 963 my @kids = MT::Category->load( { parent => $id } );964 return $app->errtrans(965 "You can't delete that category because it has sub-categories. Move or delete the sub-categories first if you want to delete this one."966 ) if @kids;967 963 if ( $app->config('DeleteFilesAtRebuild') ) { 968 964 require MT::Blog; -
trunk/lib/MT/CMS/Dashboard.pm
r2812 r3082 404 404 405 405 my $terms = {}; 406 my $args = {}; 406 407 $terms->{blog_id} = $blog_id if $blog_id; 407 408 $terms->{object_datasource} = 'entry'; 408 my $args = {};409 409 $args->{group} = [ 'tag_id' ]; 410 410 $args->{sort} = '1'; # sort by count(*) 411 411 $args->{direction} = 'descend'; 412 412 $args->{limit} = 100; 413 $args->{join} = MT::Tag->join_on(undef, { id => \'= objecttag_tag_id', is_private => 1 }, 414 { not => { is_private => 1 } } ); 413 415 414 416 my $iter = $app->model('objecttag')->count_group_by($terms, $args); 415 417 my @tag_loop; 418 my @tag_ids; 416 419 my $ntags = 0; 417 420 my $min = undef; 418 421 my $max = undef; 419 422 while (my ($count, $tag_id) = $iter->()) { 420 my $tag = MT::Tag->load($tag_id) or next;421 next if $tag->is_private; # weed these from the dashboard422 423 $ntags += $count; 423 424 $min = defined $min ? ($count < $min ? $count : $min) : $count; 424 425 $max = defined $max ? ($count > $max ? $count : $max) : $count; 425 push @tag_loop, { name => $tag->name, count => $count }; 426 push @tag_loop, { id => $tag_id, count => $count }; 427 push @tag_ids, $tag_id; 428 } 429 430 if ( @tag_ids ) { 431 my $iter = MT::Tag->load_iter( { id => \@tag_ids } ); 432 my %tags; 433 while ( my $t = $iter->() ) { 434 $tags{ $t->id } = $t->name; 435 } 436 $_->{name} = $tags{$_->{id}} for @tag_loop; 426 437 } 427 438 -
trunk/lib/MT/CMS/Entry.pm
r2994 r3082 676 676 $param{list_filters} = $app->list_filters('entry'); 677 677 $param{can_power_edit} = $blog_id && !$is_power_edit; 678 $param{can_republish} = $blog_id ? $perms->can_rebuild : 1; 678 $param{can_republish} = $blog_id 679 ? $perms->can_rebuild 680 : $app->user->is_superuser 681 ? 1 682 : 0; 679 683 $param{is_power_edit} = $is_power_edit; 680 684 $param{saved_deleted} = $q->param('saved_deleted'); … … 1058 1062 1059 1063 my $class = $app->model($type) 1060 or ret run $app->errtrans("Invalid parameter");1064 or return $app->errtrans("Invalid parameter"); 1061 1065 1062 1066 my $cat_class = $app->model( $class->container_type ); -
trunk/lib/MT/L10N/ja.pm
r2923 r3082 730 730 'Error converting image: [_1]' => 'ç»åã倿ã§ããŸããã§ãã: [_1]', 731 731 'Error creating thumbnail file: [_1]' => 'ãµã ããŒã«ãäœæã§ããŸããã§ãã: [_1]', 732 '%f-thumb-%wx%h %x' => '%f-thumb-%wx%h%x',732 '%f-thumb-%wx%h-%i%x' => '%f-thumb-%wx%h-%i%x', 733 733 'Can\'t load image #[_1]' => 'ID:[_1]ã®ç»åãããŒãã§ããŸããã§ããã', 734 734 'View image' => '衚瀺', … … 852 852 'Writing to \'[_1]\' failed: [_2]' => '\'[_1]\'ã«æžã蟌ããŸããã§ãã: [_2]', 853 853 'Renaming tempfile \'[_1]\' failed: [_2]' => 'ãã³ãã©ãªãã¡ã€ã«\'[_1]\'ã®ååã倿Žã§ããŸããã§ãã: [_2]', 854 'Blog, BlogID or Template param must be specified.' => 'Blog, BlogID, ãŸãã¯Templateã®ãããããæå®ããŠãã ããã', 854 855 'Template \'[_1]\' does not have an Output File.' => 'ãã³ãã¬ãŒã\'[_1]\'ã«ã¯åºåãã¡ã€ã«ã®èšå®ããããŸããã', 855 856 'An error occurred while publishing scheduled entries: [_1]' => 'æ¥ææå®ãããããã°èšäºã®åæ§ç¯äžã«ãšã©ãŒãçºçããŸãã: [_1]', … … 1139 1140 'IP Banning' => 'IPçŠæ¢ãªã¹ã', 1140 1141 'Removing tag failed: [_1]' => 'ã¿ã°ãåé€ã§ããŸããã§ãã: [_1]', 1141 'You can\'t delete that category because it has sub-categories. Move or delete the sub-categories first if you want to delete this one.' => 'ãµãã«ããŽãªã®ããã«ããŽãªã¯åé€ã§ããŸããããµãã«ããŽãªãå1142 ã«åé€ããããç§»åããŠãã ããã',1143 1142 'Loading MT::LDAP failed: [_1].' => 'MT::LDAPã®èªã¿èŸŒã¿ã«å€±æããŸãã: [_1]', 1144 1143 'System templates can not be deleted.' => 'ã·ã¹ãã ãã³ãã¬ãŒãã¯åé€ã§ããŸããã', … … 1874 1873 'Mapping template ID [_1] to [_2].' => 'ãã³ãã¬ãŒã(ID:[_1])ã[_2]ã«ãããã³ã°ããŠããŸã...', 1875 1874 'Error loading class: [_1].' => 'ã¯ã©ã¹ãããŒãã§ããŸããã§ãã: [_1]', 1876 'Error saving [_1] record # [_3]: [_2]... [_4].' => '[_1](ID: [_3])ã®ä¿åäžã«ãšã©ãŒãçºçããŸãã: [_2]... [_4]', 1875 'Assigning entry comment and TrackBack counts...' => 'ã³ã¡ã³ããšãã©ãã¯ããã¯ã®ä»¶æ°ãèšå®ããŠããŸã....', 1876 'Error saving [_1] record # [_3]: [_2]...' => '[_1]ã®ã¬ã³ãŒã(ID:[_3])ãä¿åã§ããŸããã§ãã: [_2]', 1877 1877 'Creating entry category placements...' => 'ããã°èšäºãšã«ããŽãªã®é¢é£ä»ããäœæããŠããŸã...', 1878 1878 'Updating category placements...' => 'ã«ããŽãªã®é¢é£ä»ããæŽæ°ããŠããŸã...', … … 1926 1926 'Assigning blog page layout...' => 'ããã°ã«ããŒãžã¬ã€ã¢ãŠããèšå®ããŠããŸã...', 1927 1927 'Assigning author basename...' => 'ãŠãŒã¶ãŒã«ããŒã¹ããŒã ãèšå®ããŠããŸã...', 1928 'Assigning entry comment and TrackBack counts...' => 'ã³ã¡ã³ããšãã©ãã¯ããã¯ã®ä»¶æ°ãèšå®ããŠããŸã....',1929 1928 'Assigning embedded flag to asset placements...' => 'ã¢ã€ãã ã®é¢é£ä»ãã®æç¡ãèšå®ããŠããŸã...', 1930 1929 'Updating template build types...' => 'ãã³ãã¬ãŒãã®ãã«ããªãã·ã§ã³ãèšå®ããŠããŸã...', … … 2105 2104 ¥å', 2106 2105 'Batch Edit Entries' => 'ããã°èšäºã®äžæ¬ç·šé', 2107 'Publish Pages' => 'ãŠã§ãããŒãžãå2108 ¬é',2109 2106 'Unpublish Pages' => 'ãŠã§ãããŒãžã®å 2110 2107 ¬éãåãæ¶ã', … … 2152 2149 'Comments in the last 7 days' => 'æè¿7æ¥é以å 2153 2150 ã®ã³ã¡ã³ã', 2154 'E-mail Templates' => 'ã¡ãŒã«ãã³ãã¬ãŒã',2155 2151 'Tags with entries' => 'ããã°èšäºã®ã¿ã°', 2156 2152 'Tags with pages' => 'ãŠã§ãããŒãžã®ã¿ã°', … … 3794 3790 'You must set a valid Site URL.' => 'æå¹ãªãµã€ãURLãæå®ããŠãã ããã', 3795 3791 'You must set a valid Local Site Path.' => 'æå¹ãªãµã€ããã¹ãæå®ããŠãã ããã', 3792 'You must set Local Archive Path.' => 'ã¢ãŒã«ã€ããã¹ãæå®ããå¿ 3793 èŠããããŸãã', 3794 'You must set a valid Archive URL.' => 'æå¹ãªã¢ãŒã«ã€ãURLãæå®ããŠãã ããã', 3795 'You must set a valid Local Archive Path.' => 'æå¹ãªã¢ãŒã«ã€ããã¹ãæå®ããŠãã ããã', 3796 3796 'Publishing Paths' => 'å 3797 3797 ¬éãã¹', -
trunk/lib/MT/ObjectDriver/Driver/DBI.pm
r2664 r3082 580 580 =item * post_group_by 581 581 582 callback($class, \$value, \@ret runvals)582 callback($class, \$value, \@returnvals) 583 583 584 584 Callback issued prior to returning the number and additional return -
trunk/lib/MT/Permission.pm
r2099 r3082 85 85 } 86 86 87 sub global_perms { 88 my $perm = shift; 89 90 return undef unless $perm->author_id; 91 return $perm unless $perm->blog_id; 92 93 $perm->cache_property( 94 'global_perms', 95 sub { 96 __PACKAGE__->load( { author_id => $perm->author_id, blog_id => 0 }); 97 } 98 ); 99 } 100 87 101 # Legend: 88 102 # author_id || blog_id || permissions … … 289 303 && $author->is_superuser ); 290 304 return 1 291 if ( ( $ set eq 'blog')305 if ( ( $_[0]->blog_id ) 292 306 && $_[0]->has('administer_blog') ); 293 307 } 294 308 } 309 # return negative if a restriction is present 295 310 return undef 296 311 if $_[0]->restrictions && $_[0]->restrictions =~ /'$perm'/i; 297 ( defined($cur_perm) && $cur_perm =~ /'$perm'/i ) ? 1 : undef; 312 # return positive if permission is set in this permission set 313 return 1 if defined($cur_perm) && $cur_perm =~ /'$perm'/i; 314 # test for global-level permission 315 return 1 316 if $_[0]->author_id 317 && $_[0]->blog_id 318 && $_[0]->global_perms 319 && $_[0]->global_perms->has($perm); 320 return undef; 298 321 }; 299 322 } -
trunk/lib/MT/Tag.pm
r2632 r3082 176 176 object_datasource => $datasource 177 177 }, { unique => 1, %jargs }); 178 my @tags = MT::Tag->load($terms, $args); 178 my @tags; 179 my $iter = MT::Tag->load_iter($terms, $args); 180 while ( my $tag = $iter->() ) { 181 push @tags, $tag; 182 } 179 183 @tags; 180 184 } … … 335 339 } else { 336 340 require MT::ObjectTag; 337 @tags = MT::Tag->search(undef, {341 my $iter = MT::Tag->load_iter(undef, { 338 342 sort => 'name', 339 343 join => [ 'MT::ObjectTag', 'tag_id', { object_id => $obj->id, 340 344 object_datasource => $obj->datasource }, { unique => 1 } ], 341 345 }); 346 while ( my $tag = $iter->() ) { 347 push @tags, $tag; 348 } 342 349 $cache->set($memkey, [ map { $_->id } @tags ], TAG_CACHE_TIME); 343 350 } -
trunk/lib/MT/Template.pm
r2973 r3082 335 335 $obj->modulesets( join ',', @ids ) 336 336 if scalar @ids != scalar @inst; 337 $obj->text($text) if $text;337 $obj->text($text); 338 338 return $obj->SUPER::save; 339 339 } -
trunk/lib/MT/Template/Context.pm
r3035 r3082 321 321 # If no blog IDs specified, use the current blog 322 322 if ( ! $blog_ids ) { 323 $terms->{$col} = $blog_id if $ col eq 'blog_id';323 $terms->{$col} = $blog_id if $blog_id && $col eq 'blog_id'; 324 324 } 325 325 # If exclude blogs, set the terms and the NOT arg for load -
trunk/lib/MT/Template/ContextHandlers.pm
r3062 r3082 721 721 sub _fltr_setvar { 722 722 my ($str, $arg, $ctx) = @_; 723 $ctx->var($arg, $str); 723 if ( my $hash = $ctx->{__inside_set_hashvar} ) { 724 $hash->{$arg} = $str; 725 } 726 else { 727 $ctx->var($arg, $str); 728 } 724 729 return ''; 725 730 } … … 10144 10149 unless (ref $blog) { 10145 10150 my $blog_id = $blog || $args->{offset_blog_id}; 10146 if ($blog ) {10151 if ($blog_id) { 10147 10152 $blog = MT->model('blog')->load($blog_id); 10148 10153 return $ctx->error( MT->translate( 'Can\'t load blog #[_1].', $blog_id ) ) … … 10155 10160 my($y, $mo, $d, $h, $m, $s) = $ts =~ /(\d\d\d\d)[^\d]?(\d\d)[^\d]?(\d\d)[^\d]?(\d\d)[^\d]?(\d\d)[^\d]?(\d\d)/; 10156 10161 $mo--; 10157 my $server_offset = $blog->server_offset;10162 my $server_offset = ($blog && $blog->server_offset) || MT->config->TimeOffset; 10158 10163 if ((localtime (timelocal ($s, $m, $h, $d, $mo, $y )))[8]) { 10159 10164 $server_offset += 1; … … 10173 10178 my $tz = 'Z'; 10174 10179 unless ($args->{utc}) { 10175 my $so = $blog->server_offset;10180 my $so = ($blog && $blog->server_offset) || MT->config->TimeOffset; 10176 10181 my $partial_hour_offset = 60 * abs($so - int($so)); 10177 10182 if ($format eq 'rfc822') { … … 15948 15953 if (my $ext = $args->{file_ext}) { 15949 15954 my @exts = split(',', $args->{file_ext}); 15950 if ( !$assets) {15955 if ($assets) { 15951 15956 push @filters, sub { my $a = $_[0]->file_ext; grep(m/$a/, @exts) }; 15952 15957 } else { -
trunk/lib/MT/TemplateMap.pm
r2966 r3082 107 107 } 108 108 } 109 elsif ( $_[0] && $_[0]->{blog_id} ) { 110 # for cases where we remove with a blog_id parameter 111 $blog_id = $_[0]->{blog_id}; 112 } 109 113 110 114 my $maps_iter = MT::TemplateMap->count_group_by( -
trunk/lib/MT/Upgrade.pm
r3013 r3082 166 166 $code = MT->handler_to_coderef($code); 167 167 my $result = $code->($self, %param, %update_params, step => $name); 168 if ((defined $result) && ($result > 1)) { 168 if (ref $result eq 'HASH') { 169 $param{$_} = $result->{$_} for keys %$result; 170 $result = 1; 171 $self->add_step($name, %param); 172 } 173 elsif ((defined $result) && ($result > 1)) { 169 174 $param{offset} = $result; $result = 1; 170 175 $self->add_step($name, %param); … … 216 221 my $fn = \%MT::Upgrade::functions; 217 222 my @these_steps = @steps; 223 218 224 while (@these_steps) { 219 225 my $step = shift @these_steps; … … 225 231 $fn->{$b->[0]}->{priority} } @these_steps; 226 232 } 233 234 # Reset the request to eliminate any caching that may be 235 # happening there (objects tend to cache into the request 236 # with the 'cache_property' method) 237 MT->request->reset; 227 238 } 228 239 return 1; … … 838 849 } 839 850 851 sub core_update_entry_counts { 852 my $self = shift; 853 my (%param) = @_; 854 855 my $class = MT->model('entry'); 856 return $self->error($self->translate_escape("Error loading class: [_1].", $param{type})) 857 unless $class; 858 859 my $msg = $self->translate_escape("Assigning entry comment and TrackBack counts..."); 860 my $offset = $param{offset} || 0; 861 my $count = $param{count}; 862 if (!$count) { 863 $count = $class->count({ class => '*' }); 864 } 865 return unless $count; 866 if ($offset) { 867 $self->progress(sprintf("$msg (%d%%)", ($offset/$count*100)), $param{step}); 868 } else { 869 $self->progress($msg, $param{step}); 870 } 871 872 my $continue = 0; 873 my $driver = $class->driver; 874 875 my $iter = $class->load_iter({ class => '*' }, { offset => $offset, limit => $MAX_ROWS+1 }); 876 my $start = time; 877 my ( %touched, %c, %tb ); 878 my $rows = 0; 879 while (my $e = $iter->()) { 880 $rows++; 881 $c{$e->id} = $e; 882 if (my $tb = $e->trackback) { 883 $tb{$tb->id} = $e; 884 } 885 $continue = 1, last if scalar $rows == $MAX_ROWS; 886 } 887 if ( $continue ) { 888 $iter->end; 889 $offset += $rows; 890 } 891 892 # now gather counts -- comments 893 if (my $grp_iter = MT::Comment->count_group_by({ 894 visible => 1, 895 entry_id => [ keys %c ], 896 }, { 897 group => ['entry_id'], 898 })) { 899 while (my ($count, $id) = $grp_iter->()) { 900 my $e = $c{$id} or next; 901 if ((!defined $e->comment_count) || (($e->comment_count || 0) != $count)) { 902 $e->comment_count($count); 903 $touched{$e->id} = $e; 904 } 905 } 906 } 907 908 # pings 909 if ( %tb ) { 910 if (my $grp_iter = MT::TBPing->count_group_by({ 911 visible => 1, 912 tb_id => [ keys %tb ], 913 }, { 914 group => ['tb_id'], 915 })) { 916 while (my ($count, $id) = $grp_iter->()) { 917 my $e = $tb{$id} or next; 918 if ((!defined $e->ping_count) || (($e->ping_count || 0) != $count)) { 919 $e->ping_count($count); 920 $touched{$e->id} = $e; 921 } 922 } 923 } 924 } 925 926 foreach my $e (values %touched) { 927 $e->save; 928 } 929 930 if ($continue) { 931 return { offset => $offset, count => $count }; 932 } else { 933 $self->progress("$msg (100%)", $param{step}); 934 } 935 1; 936 } 937 840 938 sub core_update_records { 841 939 my $self = shift; … … 858 956 } 859 957 my $offset = $param{offset}; 958 my $count = $param{count}; 959 if (!$count) { 960 $count = $class->count; 961 } 962 return unless $count; 860 963 if ($offset) { 861 my $count = $class->count;862 return unless $count;863 964 $self->progress(sprintf("$msg (%d%%)", ($offset/$count*100)), $param{step}); 864 965 } else { … … 893 994 } 894 995 $code->($obj); 895 use Data::Dumper;896 996 $obj->save() 897 or return $self->error($self->translate_escape("Error saving [_1] record # [_3]: [_2]... [_4].", $class_label, $obj->errstr, $obj->id, Dumper($obj)));997 or return $self->error($self->translate_escape("Error saving [_1] record # [_3]: [_2]...", $class_label, $obj->errstr, $obj->id)); 898 998 $continue = 1, last if time > $start + $MAX_TIME; 899 999 } 900 1000 } 901 1001 if ($continue) { 902 return $offset;1002 return { offset => $offset, count => $count }; 903 1003 } else { 904 1004 $self->progress("$msg (100%)", $param{step}); -
trunk/lib/MT/Upgrade/v4.pm
r3014 r3082 350 350 version_limit => 4.0047, 351 351 priority => 3.2, 352 updater => { 353 type => 'entry', 354 label => 'Assigning entry comment and TrackBack counts...', 355 condition => sub { 356 require MT::Comment; 357 my $comment_count = MT::Comment->count( 358 { 359 entry_id => $_[0]->id, 360 visible => 1, 361 } 362 ); 363 $_[0]->comment_count($comment_count); 364 require MT::Trackback; 365 require MT::TBPing; 366 my $tb = MT::Trackback->load( { entry_id => $_[0]->id } ); 367 my $ping_count; 368 if ($tb) { 369 my $ping_count = MT::TBPing->count( 370 { 371 tb_id => $tb->id, 372 visible => 1, 373 } 374 ); 375 $_[0]->ping_count($ping_count); 376 } 377 ( $comment_count || $ping_count ); 378 }, 379 # only count once and set it, so code do nothing. 380 # it doesn't have the unnecessary save. 381 code => sub { 1; }, 382 }, 352 code => \&core_update_entry_counts, 383 353 }, 384 354 'core_assign_object_embedded' => { … … 490 460 $file_template =~ s/%-C/<MTCategoryLabel dirify="-">/g; 491 461 $map->file_template($file_template); 492 },493 },494 },495 'core_assign_all_permisssions_blog_admin' => {496 version_limit => 4.0063,497 priority => 3.4,498 updater => {499 type => 'permission',500 label => 'Assigning all permissions to blog administrator...',501 condition => sub {502 $_[0]->can_administer_blog && $_[0]->blog_id;503 },504 code => sub {505 my ($perm) = shift;506 $perm->set_full_permissions;507 },508 },509 },510 'core_recover_sysadmin_permissions' => {511 version_limit => 4.0066,512 priority => 3.5,513 updater => {514 type => 'permission',515 label => 'Recover permissions of system administrators...',516 condition => sub {517 !$_[0]->blog_id && !$_[0]->has('administer') && $_[0]->can_administer_blog;518 },519 code => sub {520 my ($perm) = shift;521 $perm->set_permissions('system');522 462 }, 523 463 }, … … 1062 1002 'limit' => 101, 1063 1003 'fetchonly' => [ 'id' ], # meta is added to the select list separately 1004 'sort' => 'id', 1005 'direction' => 'ascend', 1064 1006 $offset ? ( 'offset' => $offset ) : () 1065 1007 }; … … 1188 1130 } 1189 1131 1132 sub core_update_entry_counts { 1133 my $self = shift; 1134 my (%param) = @_; 1135 1136 my $class = MT->model('entry'); 1137 return $self->error($self->translate_escape("Error loading class: [_1].", $param{type})) 1138 unless $class; 1139 1140 my $msg = $self->translate_escape("Assigning entry comment and TrackBack counts..."); 1141 my $offset = $param{offset} || 0; 1142 my $count = $param{count}; 1143 if (!$count) { 1144 $count = $class->count({ class => '*' }); 1145 } 1146 return unless $count; 1147 if ($offset) { 1148 $self->progress(sprintf("$msg (%d%%)", ($offset/$count*100)), $param{step}); 1149 } else { 1150 $self->progress($msg, $param{step}); 1151 } 1152 1153 my $continue = 0; 1154 my $driver = $class->driver; 1155 1156 my $iter = $class->load_iter({ class => '*' }, { offset => $offset, limit => $MAX_ROWS+1 }); 1157 my $start = time; 1158 my ( %touched, %c, %tb ); 1159 my $rows = 0; 1160 while (my $e = $iter->()) { 1161 $rows++; 1162 $c{$e->id} = $e; 1163 if (my $tb = $e->trackback) { 1164 $tb{$tb->id} = $e; 1165 } 1166 $continue = 1, last if scalar $rows == $MAX_ROWS; 1167 } 1168 if ( $continue ) { 1169 $iter->end; 1170 $offset += $rows; 1171 } 1172 1173 # now gather counts -- comments 1174 if (my $grp_iter = MT::Comment->count_group_by({ 1175 visible => 1, 1176 entry_id => [ keys %c ], 1177 }, { 1178 group => ['entry_id'], 1179 })) { 1180 while (my ($count, $id) = $grp_iter->()) { 1181 my $e = $c{$id} or next; 1182 if ((!defined $e->comment_count) || (($e->comment_count || 0) != $count)) { 1183 $e->comment_count($count); 1184 $touched{$e->id} = $e; 1185 } 1186 } 1187 } 1188 1189 # pings 1190 if ( %tb ) { 1191 if (my $grp_iter = MT::TBPing->count_group_by({ 1192 visible => 1, 1193 tb_id => [ keys %tb ], 1194 }, { 1195 group => ['tb_id'], 1196 })) { 1197 while (my ($count, $id) = $grp_iter->()) { 1198 my $e = $tb{$id} or next; 1199 if ((!defined $e->ping_count) || (($e->ping_count || 0) != $count)) { 1200 $e->ping_count($count); 1201 $touched{$e->id} = $e; 1202 } 1203 } 1204 } 1205 } 1206 1207 foreach my $e (values %touched) { 1208 $e->save; 1209 } 1210 1211 if ($continue) { 1212 return { offset => $offset, count => $count }; 1213 } else { 1214 $self->progress("$msg (100%)", $param{step}); 1215 } 1216 1; 1217 } 1218 1190 1219 1; -
trunk/lib/MT/WeblogPublisher.pm
r3001 r3082 1416 1416 require MT::Template::Context; 1417 1417 require MT::Entry; 1418 1418 1419 my $blog; 1419 unless ( $blog = $param{Blog} ) { 1420 $blog = $param{Blog} 1421 if defined $param{Blog}; 1422 if (!$blog && defined $param{BlogID}) { 1420 1423 my $blog_id = $param{BlogID}; 1421 1424 $blog = MT::Blog->load($blog_id) … … 1428 1431 } 1429 1432 my $tmpl = $param{Template}; 1430 unless ($blog) {1433 if ($tmpl && (!$blog || $blog->id != $tmpl->blog_id)) { 1431 1434 $blog = MT::Blog->load( $tmpl->blog_id ); 1432 1435 } 1436 1437 return $mt->error( 1438 MT->translate( 1439 "Blog, BlogID or Template param must be specified.") 1440 ) unless $blog; 1441 1433 1442 return 1 if $blog->is_dynamic; 1434 1443 my $iter; -
trunk/mt-static/js/archetype_editor.js
r2560 r3082 427 427 html = html.replace(/<(br|img|input|param)([^>]+)?([^\/])?>/g, "<$1$2$3 />"); 428 428 429 // #4 - get absolute path and delete from converted URL 430 var d = this.document.createElement('div'); 431 d.innerHTML = '<a href="dummy.html"></a>'; 432 var path = d.innerHTML; 433 path = path.toLowerCase(); 434 path = path.replace(/<a href="(.*)dummy.html"><\/a>/, "$1"); 429 // #4 - get absolute path and delete from converted URL 430 var path = this.document.URL; 431 path = path.replace(/(.*)editor-content.html.*/, "$1"); 435 432 var regex = new RegExp(path, "g"); 433 html = html.replace(regex, ""); 434 /* XXX for save on ff */ 435 regex = new RegExp(path.replace(/~/, "%7E"), "g"); 436 436 html = html.replace(regex, ""); 437 437 -
trunk/php/lib/MTUtil.php
r3034 r3082 1301 1301 $dest; 1302 1302 $thumb_name = $static_file_path.DIRECTORY_SEPARATOR.$image_path.DIRECTORY_SEPARATOR.$format; 1303 if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $ scale, $thumb_name, 'png')) {1303 if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $asset['asset_id'], $scale, $thumb_name, 'png')) { 1304 1304 return ''; 1305 1305 } … … 1314 1314 1315 1315 # for compatibility... 1316 function make_thumbnail_file($src, $dest, $width, $height, $scale = 0, $dest_type = 'auto' ) {1316 function make_thumbnail_file($src, $dest, $width, $height, $scale = 0, $dest_type = 'auto', $id = 0) { 1317 1317 require_once('thumbnail_lib.php'); 1318 1318 $thumb = new Thumbnail($src); … … 1320 1320 $thumb_w = $width; 1321 1321 $thumb_h = $height; 1322 $thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $ scale, null, $dest_type);1322 $thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $id, $scale, null, $dest_type); 1323 1323 1324 1324 return array($thumb_w, $thumb_h); 1325 1325 } 1326 1326 1327 function get_thumbnail_file($asset, $blog, $width = 0, $height = 0, $scale = 0, $format = '%f-thumb-%wx%h %x') {1327 function get_thumbnail_file($asset, $blog, $width = 0, $height = 0, $scale = 0, $format = '%f-thumb-%wx%h-%i%x') { 1328 1328 # Get parameter 1329 1329 $site_path = $blog['blog_site_path']; … … 1338 1338 $ts = preg_replace('![^0-9]!', '', $asset['asset_created_on']); 1339 1339 $date_stamp = format_ts('%Y/%m', $ts, $blog); 1340 $cache_dir = $site_path . DIRECTORY_SEPARATOR . $cache_path . DIRECTORY_SEPARATOR . $date_stamp . DIRECTORY_SEPARATOR; 1340 $base_path = $site_path; 1341 if (preg_match('/^%a/', $asset['asset_file_path']) && !empty($blog['blog_archive_path'])) { 1342 $base_path = $blog['blog_archive_path']; 1343 $base_path = preg_replace('/\/$/', '', $base_path); 1344 } 1345 1346 $cache_dir = $base_path . DIRECTORY_SEPARATOR . $cache_path . DIRECTORY_SEPARATOR . $date_stamp . DIRECTORY_SEPARATOR; 1341 1347 $thumb_name = $cache_dir . $format; 1342 1348 1343 1349 # generate thumbnail 1344 1350 require_once('thumbnail_lib.php'); … … 1347 1353 $thumb_h = $height; 1348 1354 $dest; 1349 if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $ scale, $thumb_name)) {1355 if (!$thumb->get_thumbnail($dest, $thumb_w, $thumb_h, $asset['asset_id'], $scale, $thumb_name)) { 1350 1356 return ''; 1351 1357 } … … 1353 1359 # make url 1354 1360 $basename = basename($dest); 1355 $site_url = $blog['blog_site_url']; 1356 if (!preg_match('!/$!', $site_url)) 1357 $site_url .= '/'; 1358 1359 $thumb_url = $site_url . $cache_path . '/' . $date_stamp . '/' . $basename; 1361 $base_url = $blog['blog_site_url']; 1362 if (preg_match('/^%a/', $asset['asset_file_path']) && !empty($blog['blog_archive_url'])) 1363 $base_url = $blog['blog_archive_url']; 1364 if (!preg_match('!/$!', $base_url)) 1365 $base_url .= '/'; 1366 1367 $thumb_url = $base_url . $cache_path . '/' . $date_stamp . '/' . $basename; 1360 1368 1361 1369 return array($thumb_url, $thumb_w, $thumb_h, $thumb_name); -
trunk/php/lib/function.mtvar.php
r2873 r3082 111 111 } 112 112 } 113 else { 114 if (array_key_exists('to_json', $args) && $args['to_json']) { 115 if (function_exists('json_encode')) { 116 $return_val = json_encode($value); 117 } else { 118 $return_val = ''; 119 } 120 } 121 } 113 122 } 114 123 elseif (is_array($value)) { … … 140 149 } 141 150 else { 142 if (!array_key_exists('to_json', $args) && $args['to_json']) { 143 $glue = $args['glue']; 144 if (!isset($glue)) 145 $glue = ''; 146 $return_val = implode($glue, $value); 151 if (array_key_exists('to_json', $args) && $args['to_json']) { 152 if (function_exists('json_encode')) { 153 $return_val = json_encode($value); 154 } else { 155 $return_val = ''; 156 } 147 157 } 148 158 } -
trunk/php/lib/modifier.setvar.php
r1174 r3082 9 9 global $mt; 10 10 $ctx =& $mt->context(); 11 $vars =& $ctx->__stash['vars']; 11 if (array_key_exists('__inside_set_hashvar', $ctx->__stash)) { 12 $vars =& $ctx->__stash['__inside_set_hashvar']; 13 } else { 14 $vars =& $ctx->__stash['vars']; 15 } 12 16 $vars[$name] = $text; 13 17 return ''; 14 18 } 15 ?> -
trunk/php/lib/sanitize_lib.php
r1098 r3082 38 38 $inside = preg_replace('!/?>$!', '', $inside); 39 39 $attrs = ''; 40 if (preg_match_all('/\s*(\w+)\s*=(?:([\'"])(.*?)\2|([^\s]+))\s*/ ', $inside, $matches, PREG_SET_ORDER)) {40 if (preg_match_all('/\s*(\w+)\s*=(?:([\'"])(.*?)\2|([^\s]+))\s*/s', $inside, $matches, PREG_SET_ORDER)) { 41 41 foreach ($matches as $match) { 42 42 $attr = strtolower($match[1]); … … 55 55 $dec_val = preg_replace('/�*58(?:=;|[^0-9])/', ':', $dec_val); 56 56 $dec_val = preg_replace('/�*3[Aa](?:=;|[^a-fA-F0-9])/', ':', $dec_val); 57 if (preg_match('/^( .+?):/', $dec_val, $proto_match)) {57 if (preg_match('/^([\s\S]+?):/', $dec_val, $proto_match)) { 58 58 $proto = $proto_match[1]; 59 59 if (preg_match('/[\r\n\t]/', $proto)) { -
trunk/php/lib/thumbnail_lib.php
r2691 r3082 56 56 } 57 57 58 function _make_dest_name ($w, $h, $format, $dest_type ) {58 function _make_dest_name ($w, $h, $format, $dest_type, $id) { 59 59 $output = $this->src_type; 60 60 if ($dest_type != 'auto') { … … 82 82 $patterns[1] = '/%h/'; 83 83 $patterns[2] = '/%f/'; 84 $patterns[3] = '/%x/'; 84 $patterns[3] = '/%i/'; 85 $patterns[4] = '/%x/'; 85 86 $replacement[0] = $w; 86 87 $replacement[1] = $h; 87 88 $replacement[2] = $basename; 88 $replacement[3] = $ext; 89 $replacement[3] = $id; 90 $replacement[4] = $ext; 89 91 90 92 return preg_replace($patterns, $replacement, $format); … … 92 94 93 95 # Load or generate a thumbnail. 94 function get_thumbnail (&$dest, &$width, &$height, $ scale = 0, $format = '%f-thumb-%wx%h%x', $dest_type = 'auto') {96 function get_thumbnail (&$dest, &$width, &$height, $id, $scale = 0, $format = '%f-thumb-%wx%h-%i%x', $dest_type = 'auto') { 95 97 if (empty($this->src_file)) return false; 96 98 if (!file_exists($this->src_file)) return false; … … 130 132 # Decide a destination file name 131 133 if (empty($dest)) { 132 $dest = $this->_make_dest_name($thumb_w_name, $thumb_h_name, $format, $dest_type );134 $dest = $this->_make_dest_name($thumb_w_name, $thumb_h_name, $format, $dest_type, $id); 133 135 } 134 136 -
trunk/php/mt.php
r3019 r3082 10 10 define('PRODUCT_VERSION', '4.21'); 11 11 12 $PRODUCT_NAME = ' __PRODUCT_NAME__';12 $PRODUCT_NAME = 'Movable Type Pro'; 13 13 if($PRODUCT_NAME == '__PRODUCT' . '_NAME__') 14 14 $PRODUCT_NAME = 'Movable Type'; -
trunk/t/35-tags.dat
r2696 r3082 323 323 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetProperty property='description'$></MTAssets>", "e" : "This is a test photo."}, #271 324 324 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetFileExt$></MTAssets>", "e" : "jpg"}, #272 325 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailURL width='160'$></MTAssets>", "e" : "http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-160xauto .jpg"}, #273326 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailURL height='240'$></MTAssets>", "e" : "http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-autox240 .jpg"}, #274327 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailURL scale='75'$></MTAssets>", "e" : "http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-480x360 .jpg"}, #275325 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailURL width='160'$></MTAssets>", "e" : "http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-160xauto-1.jpg"}, #273 326 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailURL height='240'$></MTAssets>", "e" : "http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-autox240-1.jpg"}, #274 327 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailURL scale='75'$></MTAssets>", "e" : "http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-480x360-1.jpg"}, #275 328 328 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetLink$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\">test.jpg</a>"}, #276 329 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-640x480 .jpg\" width=\"640\" height=\"480\" alt=\"\" /></a>"}, #277330 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink width='160'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-160xauto .jpg\" width=\"160\" height=\"120\" alt=\"\" /></a>"}, #278331 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink height='240'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-autox240 .jpg\" width=\"320\" height=\"240\" alt=\"\" /></a>"}, #279332 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink scale='100'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-640x480 .jpg\" width=\"640\" height=\"480\" alt=\"\" /></a>"}, #280329 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-640x480-1.jpg\" width=\"640\" height=\"480\" alt=\"\" /></a>"}, #277 330 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink width='160'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-160xauto-1.jpg\" width=\"160\" height=\"120\" alt=\"\" /></a>"}, #278 331 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink height='240'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-autox240-1.jpg\" width=\"320\" height=\"240\" alt=\"\" /></a>"}, #279 332 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink scale='100'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-640x480-1.jpg\" width=\"640\" height=\"480\" alt=\"\" /></a>"}, #280 333 333 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetLink new_window='1'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\" target=\"_blank\">test.jpg</a>"}, #281 334 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink new_window='1'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\" target=\"_blank\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-640x480 .jpg\" width=\"640\" height=\"480\" alt=\"\" /></a>"}, #282335 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink new_window='1' width='160'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\" target=\"_blank\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-160xauto .jpg\" width=\"160\" height=\"120\" alt=\"\" /></a>"}, #283336 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink new_window='1' scale='100'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\" target=\"_blank\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-640x480 .jpg\" width=\"640\" height=\"480\" alt=\"\" /></a>"}, #284337 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink new_window='1' scale='100'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\" target=\"_blank\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-640x480 .jpg\" width=\"640\" height=\"480\" alt=\"\" /></a>"}, #285334 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink new_window='1'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\" target=\"_blank\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-640x480-1.jpg\" width=\"640\" height=\"480\" alt=\"\" /></a>"}, #282 335 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink new_window='1' width='160'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\" target=\"_blank\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-160xauto-1.jpg\" width=\"160\" height=\"120\" alt=\"\" /></a>"}, #283 336 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink new_window='1' scale='100'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\" target=\"_blank\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-640x480-1.jpg\" width=\"640\" height=\"480\" alt=\"\" /></a>"}, #284 337 { "r" : "1", "t" : "<MTAssets lastn='1'><$MTAssetThumbnailLink new_window='1' scale='100'$></MTAssets>", "e" : "<a href=\"http://narnia.na/nana/images/test.jpg\" target=\"_blank\"><img src=\"http://narnia.na/nana/assets_c/CURRENT_YEAR/CURRENT_MONTH/test-thumb-640x480-1.jpg\" width=\"640\" height=\"480\" alt=\"\" /></a>"}, #285 338 338 { "r" : "1", "t" : "<$MTAssetCount$>", "e" : "2"}, #286 339 339 { "r" : "1", "t" : "<MTAssets lastn='1'><MTAssetTags><$MTTagName$>; </MTAssetTags></MTAssets>", "e" : "alpha; beta; gamma; "}, #287 -
trunk/tmpl/cms/cfg_archives.tmpl
r2213 r3082 116 116 return false; 117 117 } 118 if (f.enable_archive_paths.checked) { 119 if (!f.archive_path.value) { 120 alert('<__trans phrase="You must set Local Archive Path." escape="singlequotes">'); 121 return false; 122 } else if (!is_valid_url(f.archive_url.value)){ 123 alert('<__trans phrase="You must set a valid Archive URL." escape="singlequotes">'); 124 return false; 125 } else if (!is_valid_path(f.archive_path.value)){ 126 alert('<__trans phrase="You must set a valid Local Archive Path." escape="singlequotes">'); 127 return false; 128 } 129 } 118 130 f.site_url.disabled = false; 119 131 f.site_path.disabled = false; … … 126 138 } 127 139 function is_valid_path(path_){ 128 for(i = 0; i < path_.length; i++){ 129 var buf = escape(path_.substr(i, 1)); 130 if (buf.match(/^%u.*/)){ 131 return false; 132 } 133 if (buf.match(/(%.{2}){2}?/)){ 134 return false; 135 } 140 var str = path_.replace(/[ "%<>\[\\\]\^`{\|}~]/g, ""); 141 str = encodeURI(str); 142 if (str.indexOf('%') != -1) { 143 return false; 144 } 145 if (str.match(/\.\./)) { 146 return false; 136 147 } 137 148 return true; -
trunk/tmpl/cms/error.tmpl
r2784 r3082 24 24 <mt:if name="dialog"> 25 25 onclick="if ( window.opener ) { window.close(); } else { window.parent.closeDialog('<mt:var name="link" escape="js">'); }; return false;" 26 <mt:elseif name="fs"> 27 onclick="window.location='<mt:var name="link" escape="js">'; return false;" 26 28 <mt:else> 27 29 onclick="if ( window.opener ) { window.opener.location.href='<mt:var name="link" escape="js">'; window.close(); } else { window.open('<mt:var name="link" escape="js">') }; return false;" -
trunk/tmpl/cms/include/template_table.tmpl
r2934 r3082 25 25 <mt:if name="template_type" eq="index"> 26 26 <a href="javascript:void(0)" 27 onclick="doForMarkedInThisWindow(getByID('<$mt:var name="template_type" $>-listing-form'), '<__trans phrase="template" escape="js">', '<__trans phrase="templates" escape="js">', 'id', 'publish_index_templates', {}, '<__trans phrase="to publish" escape="js">'); return false;"27 onclick="doForMarkedInThisWindow(getByID('<$mt:var name="template_type" default="template"$>-listing-form'), '<__trans phrase="template" escape="js">', '<__trans phrase="templates" escape="js">', 'id', 'publish_index_templates', {}, '<__trans phrase="to publish" escape="js">'); return false;" 28 28 accesskey="a" 29 29 title="<__trans phrase="Publish selected templates (a)">" … … 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" $>-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"$>-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)">" … … 37 37 </mt:if> 38 38 <a href="javascript:void(0)" 39 onclick="doRemoveItems(getByID('<$mt:var name="template_type" $>-listing-form'), '<__trans phrase="template" escape="js">', '<__trans phrase="templates" escape="js">'); return false;"39 onclick="doRemoveItems(getByID('<$mt:var name="template_type" default="template"$>-listing-form'), '<__trans phrase="template" escape="js">', '<__trans phrase="templates" escape="js">'); return false;" 40 40 accesskey="x" 41 41 title="<__trans phrase="Delete selected [_1] (x)" params="<$mt:var name="object_label_plural"$>">" … … 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" $>">76 <tr class="<mt:if name="__odd__">odd<mt:else>even</mt:if> template-<$mt:var name="template_type" default="template"$>"> 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" $>-listing" class="listing zero-state-listing zero-state">141 <div id="<$mt:var name="template_type" default="template"$>-listing" class="listing zero-state-listing zero-state"> 142 142 <div class="listing-header"> 143 143 <$mt:var name="listing_header"$> -
trunk/tmpl/cms/list_template.tmpl
r2622 r3082 21 21 </mt:if> 22 22 </ul> 23 <$mtapp:ListFilters$> 23 24 </mtapp:widget> 24 25 <mtapp:widget -
trunk/tmpl/cms/widget/blog_stats_tag_cloud.tmpl
r1857 r3082 5 5 6 6 <div id="tag-panel" class="<mt:unless name="tab" eq="tag">hidden</mt:unless>" mt:tab-content="tag"> 7 <mt:Section cache_prefix="tagcloud" period="3600" by_blog="1" by_user="1"> 7 8 <div id="tag-cloud"> 8 9 <ul id="tag-cloud-list"> … … 12 13 </ul> 13 14 </div> 15 </mt:Section> 14 16 <div id="tag-cloud-recent-entries"></div> 15 17 </div>
