root/branches/athena/plugins/TemplateRefresh/TemplateRefresh.pl @ 1092

Revision 1092, 56.4 kB (checked in by hachi, 2 years ago)

Merging release-15 to athena branch. svn merge -r59987:60375 http://svn.sixapart.com/repos/eng/movabletype/branches/release-15 .

  • Property svn:executable set to *
  • Property svn:keywords set to Id Revision
Line 
1# TemplateRefresh plugin for Movable Type
2# Author: Nick O'Neill and Brad Choate, Six Apart (http://www.sixapart.com)
3# Released under the Artistic License
4#
5# $Id$
6
7package MT::Plugin::TemplateRefresh;
8
9use strict;
10use MT;
11use base qw(MT::Plugin);
12
13my $plugin;
14BEGIN {
15    MT->add_plugin($plugin =
16        new MT::Plugin::TemplateRefresh({
17            name => "Template Backup and Refresh",
18            description => q(<MT_TRANS phrase="Backup and refresh existing templates to Movable Type's default templates.">),
19            version => 1.2,
20            registry => {
21                applications => {
22                    cms => {
23                        list_actions => {
24                            blog => {
25                                refresh_blog_templates => {
26                                    label => "Refresh Template(s)",
27                                    code => sub { $plugin->refresh_blog_templates(@_) },
28                                },
29                            },
30                            template => {
31                                refresh_tmpl_templates => {
32                                    label => "Refresh Template(s)",
33                                    code => sub { $plugin->refresh_individual_templates(@_) },
34                                    permissions => 'can_edit_templates',
35                                },
36                            },
37                        },
38                    },
39                },
40            },
41        }),
42    );
43}
44
45sub instance { $plugin }
46
47sub default_dictionary {
48
49    # sha1 signatures for all default templates
50    # we use these to determine if user has altered their templates;
51    # if so, we backup the original, if not, we overwrite it
52    my $dict = {};
53
54    eval q[
55    # 1.1
56    $dict->{'index'}{'Main Index'}{'407110d0415eb2124fa1aa7fcec4a5cc0bebba82'} = 1;
57    $dict->{'index'}{'XML RSS Index'}{'59f5ecc2753251c43340b82213c7e16623c0410f'} = 1;
58    $dict->{'index'}{'Master Archive Index'}{'5770ee182268b0cfb12ef9b1e66caa7d6406e4d8'} = 1;
59    $dict->{'archive'}{'Date-Based Archive Template'}{'c01c93248e62619772298ccaf99fd4310bc11ea8'} = 1;
60    $dict->{'category'}{'Category Archive Template'}{'c01c93248e62619772298ccaf99fd4310bc11ea8'} = 1;
61    $dict->{'individual'}{'Individual Entry Archive Template'}{'c32c51426c660fc865929ab6a043869b8a3d3e85'} = 1;
62    $dict->{'comment_preview'}{'Comment Preview Template'}{'e6377a7ad2f550a94ca36b9bc09dd7204783a37e'} = 1;
63    $dict->{'comments'}{'Comment Listing Template'}{'d4c0d0290912320805f04ff15832ac1a6fc80af6'} = 1;
64
65    # 1.2
66    $dict->{'index'}{'Main Index'}{'4dc91ae495205f70d87ee3b6f2162e86fb5731a8'} = 1;
67    $dict->{'index'}{'XML RSS Index'}{'59f5ecc2753251c43340b82213c7e16623c0410f'} = 1;
68    $dict->{'index'}{'Master Archive Index'}{'5770ee182268b0cfb12ef9b1e66caa7d6406e4d8'} = 1;
69    $dict->{'archive'}{'Date-Based Archive Template'}{'c01c93248e62619772298ccaf99fd4310bc11ea8'} = 1;
70    $dict->{'category'}{'Category Archive Template'}{'c01c93248e62619772298ccaf99fd4310bc11ea8'} = 1;
71    $dict->{'individual'}{'Individual Entry Archive Template'}{'c32c51426c660fc865929ab6a043869b8a3d3e85'} = 1;
72    $dict->{'comment_preview'}{'Comment Preview Template'}{'e6377a7ad2f550a94ca36b9bc09dd7204783a37e'} = 1;
73    $dict->{'comments'}{'Comment Listing Template'}{'d4c0d0290912320805f04ff15832ac1a6fc80af6'} = 1;
74    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'71b0a469d94db802f03aa69965415dea137ace06'} = 1;
75
76    # 1.31
77    $dict->{'index'}{'Main Index'}{'816f80828d83fcc7ef6170459929f7cccc999c61'} = 1;
78    $dict->{'index'}{'XML RSS Index'}{'6743a150c8eb9f90a44df7c45920a1cd4693b80d'} = 1;
79    $dict->{'index'}{'Master Archive Index'}{'5e1279912e02f5c20d58d50f5b47dc3c08e02c43'} = 1;
80    $dict->{'archive'}{'Date-Based Archive Template'}{'c01c93248e62619772298ccaf99fd4310bc11ea8'} = 1;
81    $dict->{'category'}{'Category Archive Template'}{'c01c93248e62619772298ccaf99fd4310bc11ea8'} = 1;
82    $dict->{'individual'}{'Individual Entry Archive Template'}{'1edf13dc974b75c9f0580e6f298a9046fd536dd3'} = 1;
83    $dict->{'comment_preview'}{'Comment Preview Template'}{'e6377a7ad2f550a94ca36b9bc09dd7204783a37e'} = 1;
84    $dict->{'comments'}{'Comment Listing Template'}{'d5bd507c47d953167cc949c914b2e708af414474'} = 1;
85    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'71b0a469d94db802f03aa69965415dea137ace06'} = 1;
86
87    # 1.4
88    $dict->{'index'}{'Main Index'}{'879245bcd891fe2ce9d69d97e7f2892b3011e45a'} = 1;
89    $dict->{'index'}{'XML RSS Index'}{'6743a150c8eb9f90a44df7c45920a1cd4693b80d'} = 1;
90    $dict->{'index'}{'Master Archive Index'}{'ed2babcbd627bae187b72e8a7ca7de1b63c6c6c5'} = 1;
91    $dict->{'comment_error'}{'Comment Error Template'}{'ce6914e66298009da5dc1275f9e7f3792f39eedb'} = 1;
92    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'71b0a469d94db802f03aa69965415dea137ace06'} = 1;
93    $dict->{'index'}{'Stylesheet'}{'846a2bc52a437dbd7424fed900ccf0abd42c1c33'} = 1;
94    $dict->{'archive'}{'Date-Based Archive Template'}{'2b8698c7260f48fc9e0c06fa1400756eff6430fc'} = 1;
95    $dict->{'category'}{'Category Archive Template'}{'d4e902c451f53966b067d118ed2883e697fdc02a'} = 1;
96    $dict->{'individual'}{'Individual Entry Archive Template'}{'a2957010ed5c5b8e11e98f1e463860063d8fc7eb'} = 1;
97    $dict->{'comment_preview'}{'Comment Preview Template'}{'a1980ad808894996c7b50e88ca29a66f969e8870'} = 1;
98    $dict->{'comments'}{'Comment Listing Template'}{'7e7807d1400f569593c7abeba423f3be3357f826'} = 1;
99
100    # 2.0
101    $dict->{'index'}{'Main Index'}{'76f902f398a10f3728a76027f962bb9f2ce84ff4'} = 1;
102    $dict->{'index'}{'RSS 0.91 Index'}{'6743a150c8eb9f90a44df7c45920a1cd4693b80d'} = 1;
103    $dict->{'index'}{'Master Archive Index'}{'29987f5f7ba64bf30f5b36ea3ad3bc1b66f028f8'} = 1;
104    $dict->{'comment_preview'}{'Comment Preview Template'}{'a1980ad808894996c7b50e88ca29a66f969e8870'} = 1;
105    $dict->{'comment_error'}{'Comment Error Template'}{'ce6914e66298009da5dc1275f9e7f3792f39eedb'} = 1;
106    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'71b0a469d94db802f03aa69965415dea137ace06'} = 1;
107    $dict->{'comments'}{'Comment Listing Template'}{'7e7807d1400f569593c7abeba423f3be3357f826'} = 1;
108    $dict->{'index'}{'RSS 1.0 Index'}{'108ae4976884ad68fb85042c63b101e8d6b67068'} = 1;
109    $dict->{'index'}{'Stylesheet'}{'846a2bc52a437dbd7424fed900ccf0abd42c1c33'} = 1;
110    $dict->{'archive'}{'Date-Based Archive'}{'92ed95ad9e80e25c977b95cc161468d736a8dfc2'} = 1;
111    $dict->{'category'}{'Category Archive'}{'b1833e03af47af1e8648186098584152d49e18df'} = 1;
112    $dict->{'individual'}{'Individual Entry Archive'}{'0d50f720a92bad17746bddaf945ac3023c5b97f6'} = 1;
113
114    # 2.11
115    $dict->{'index'}{'Main Index'}{'317217b27900666d12d1abf9dc74fb8c8e2bebf0'} = 1;
116    $dict->{'index'}{'RSS 0.91 Index'}{'5429e642862a459adc0d6520f610c7113faa211f'} = 1;
117    $dict->{'index'}{'Master Archive Index'}{'c257052cf28bfc3ddf9f2ee6ad89a1b83e754906'} = 1;
118    $dict->{'comment_preview'}{'Comment Preview Template'}{'55ae4e949428a927c7f48ba013e49a565bb57880'} = 1;
119    $dict->{'comment_error'}{'Comment Error Template'}{'b154c876d3b629103a21add608201b9a9595772e'} = 1;
120    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'71b0a469d94db802f03aa69965415dea137ace06'} = 1;
121    $dict->{'comments'}{'Comment Listing Template'}{'a5c451d553f7736f4cafb6c61bf1ad0170727721'} = 1;
122    $dict->{'index'}{'RSS 1.0 Index'}{'678c192ee6cddfdf8b13b1c30cb3ef5e2bbf7ca6'} = 1;
123    $dict->{'index'}{'Stylesheet'}{'4d62b1ecdea486e234a1fba1bceeb777713c467a'} = 1;
124    $dict->{'archive'}{'Date-Based Archive'}{'92332c5acbd58a5e2c67418252c6922a7e412792'} = 1;
125    $dict->{'category'}{'Category Archive'}{'f58abd34ef257d693f70d12c4b3bbdf102c943b6'} = 1;
126    $dict->{'individual'}{'Individual Entry Archive'}{'b201aa4eeaf2c113d033753e3db9f37ea1096c04'} = 1;
127
128    # 2.21
129    $dict->{'index'}{'Main Index'}{'ba7bce3d5ea6e7f247c4e88c32465c85bd02242d'} = 1;
130    $dict->{'index'}{'RSS 0.91 Index'}{'19abb8489f1703226e2081ce47818151fc1e1533'} = 1;
131    $dict->{'index'}{'Master Archive Index'}{'07234b049e1a319f76c0099724a18cedb7af7a82'} = 1;
132    $dict->{'comment_preview'}{'Comment Preview Template'}{'55ae4e949428a927c7f48ba013e49a565bb57880'} = 1;
133    $dict->{'comment_error'}{'Comment Error Template'}{'b154c876d3b629103a21add608201b9a9595772e'} = 1;
134    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'71b0a469d94db802f03aa69965415dea137ace06'} = 1;
135    $dict->{'comments'}{'Comment Listing Template'}{'a5c451d553f7736f4cafb6c61bf1ad0170727721'} = 1;
136    $dict->{'index'}{'RSS 1.0 Index'}{'72afff93eb20e4ee9ac68342e265e5b2eea043a9'} = 1;
137    $dict->{'index'}{'Stylesheet'}{'3ed7a660665db0fdfd34223fa7677b4268fe5eee'} = 1;
138    $dict->{'archive'}{'Date-Based Archive'}{'6c505b012093710d942ad45da55456407f063ecb'} = 1;
139    $dict->{'category'}{'Category Archive'}{'d3d2e9c7767ed0e5443f92fde96679486da26968'} = 1;
140    $dict->{'individual'}{'Individual Entry Archive'}{'ab71eb8782a242ff74fe0d73a5122bf74c3b6ccc'} = 1;
141    $dict->{'pings'}{'TrackBack Listing Template'}{'091fa8912983f9f83adea54089cd3ec69e44f335'} = 1;
142
143    # 2.51
144    $dict->{'index'}{'Main Index'}{'f650d9b711be71f4986834c23033e52ae3f134e1'} = 1;
145    $dict->{'index'}{'RSS 0.91 Index'}{'26faba6fe7b65b57a8bd8e99679407dc06c301ff'} = 1;
146    $dict->{'index'}{'Master Archive Index'}{'b523cd4f0e588abaf869694f5e9f4a08394d79dd'} = 1;
147    $dict->{'comment_preview'}{'Comment Preview Template'}{'e80238e281bb77b4891baf2bdd1934fd275b002a'} = 1;
148    $dict->{'comment_error'}{'Comment Error Template'}{'b4262b19482af08373b92979abf6e5b1e963e6d8'} = 1;
149    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'71b0a469d94db802f03aa69965415dea137ace06'} = 1;
150    $dict->{'comments'}{'Comment Listing Template'}{'7305e3b33b834ae6aa64b22dd18cb55f1e091cbd'} = 1;
151    $dict->{'index'}{'RSS 1.0 Index'}{'c4e641a020ba037307e473976974db94ca0058e9'} = 1;
152    $dict->{'index'}{'Stylesheet'}{'d8264261da0fb212c8e2e20d34c8f8dc6ce25422'} = 1;
153    $dict->{'archive'}{'Date-Based Archive'}{'7875e9fc58524dfe2d5e1fd94182b3f721f7d3e6'} = 1;
154    $dict->{'category'}{'Category Archive'}{'e0a6ae9184ef388988d92c1aa86125cc0ab31550'} = 1;
155    $dict->{'individual'}{'Individual Entry Archive'}{'ad2a6232d8db895c994a91b19da844def6a5680b'} = 1;
156    $dict->{'pings'}{'TrackBack Listing Template'}{'46eb8b1c552d783d3ef7941b38be0899571147db'} = 1;
157
158    # 2.661
159    $dict->{'index'}{'Main Index'}{'cff7cd6b841e5784d931c87c93f3c428626f67e6'} = 1;
160    $dict->{'index'}{'RSD'}{'287880a4c3840625053077b6334d91c345acd2e4'} = 1;
161    $dict->{'index'}{'Atom Index'}{'ecdfb3afb486e634d9438bf0af2e9db47e3a8cf5'} = 1;
162    $dict->{'index'}{'RSS 2.0 Index'}{'b2ebbc25310c57b0cf85ae1d2566193fc7ba72c3'} = 1;
163    $dict->{'index'}{'Master Archive Index'}{'31f1cd87d6590215dc6babc66809ad6c5ed19a28'} = 1;
164    $dict->{'comment_preview'}{'Comment Preview Template'}{'e1c70ed21317c97c8c951ed3bf3279f888635e19'} = 1;
165    $dict->{'comment_error'}{'Comment Error Template'}{'cfc5d39862e2cb625596f9e0fb0add633fd3fc7a'} = 1;
166    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'71b0a469d94db802f03aa69965415dea137ace06'} = 1;
167    $dict->{'comments'}{'Comment Listing Template'}{'5ab05a3b442ffd5e1d98766e7f1eb7bc0dd89cc3'} = 1;
168    $dict->{'index'}{'RSS 1.0 Index'}{'587c576c4df2053bdade147c2eed06676fb57373'} = 1;
169    $dict->{'index'}{'Stylesheet'}{'d47f2fc739944385d1f2486d0d34ee129d47c746'} = 1;
170    $dict->{'archive'}{'Date-Based Archive'}{'0f4007fe393b99633d5948927f53033eefd4a0f2'} = 1;
171    $dict->{'category'}{'Category Archive'}{'908855e015ad1934353550ecd2c640aa9192a53d'} = 1;
172    $dict->{'individual'}{'Individual Entry Archive'}{'968646f67c9afda99ac0e0b4e7e85c63fe088ed0'} = 1;
173    $dict->{'pings'}{'TrackBack Listing Template'}{'7383112b177902906236e8943890104a9c77344a'} = 1;
174
175    # 3.16
176    $dict->{'index'}{'Main Index'}{'257e3d22a3682e9e86aa2d9be53af1e4c9abbbc7'} = 1;
177    $dict->{'index'}{'Main Index'}{'4b2e54a6cc5917428b3fb48fb36414a42a5920a6'} = 1;
178    $dict->{'index'}{'Main Index'}{'505f1d363a314ef2da488c157a374d6e00c58d57'} = 1;
179    $dict->{'index'}{'Main Index'}{'654bcea62270e62de2a28ecc0dd899c8887a69f2'} = 1;
180    $dict->{'index'}{'Main Index'}{'78a47d6748c87ad110ef0bead8838a09f26e81a4'} = 1;
181    $dict->{'index'}{'Main Index'}{'e7a7a2c704f18d87e723bfffaf5bef04a1dc91dd'} = 1;
182    $dict->{'index'}{'Dynamic Site Bootstrapper'}{'2143a746f4f73d9515ca9ab94f3241ca12d17306'} = 1;
183    $dict->{'index'}{'RSD'}{'287880a4c3840625053077b6334d91c345acd2e4'} = 1;
184    $dict->{'index'}{'Atom Index'}{'b72c5bbb48d9129ea39383e14b98286128952ade'} = 1;
185    $dict->{'index'}{'RSS 2.0 Index'}{'81c3335d388f2f69d6311ad4eb6ec344b654684f'} = 1;
186    $dict->{'index'}{'Master Archive Index'}{'2214c531eb49879641f1756311e0892f0399a702'} = 1;
187    $dict->{'index'}{'Master Archive Index'}{'4fbea20e8866041a59473c23968165499ca58263'} = 1;
188    $dict->{'index'}{'Master Archive Index'}{'9c6505c0f818e0f3347797939745f645414b3f47'} = 1;
189    $dict->{'index'}{'Master Archive Index'}{'a7851e7e1df743e7697ce987050c6cefe6757295'} = 1;
190    $dict->{'index'}{'Master Archive Index'}{'bcb285fdb914d77d1f64f9bdfd93440f3a32720a'} = 1;
191    $dict->{'comment_preview'}{'Comment Preview Template'}{'24a9f9c9aa0ba6d6741dc68e10ed5be406d67df8'} = 1;
192    $dict->{'comment_preview'}{'Comment Preview Template'}{'785529e76220b7ff2028ba216f5845f981ca7d7d'} = 1;
193    $dict->{'comment_preview'}{'Comment Preview Template'}{'82caa3186da19bcea245f653618a0187e2634137'} = 1;
194    $dict->{'comment_preview'}{'Comment Preview Template'}{'94a7cb5c4fe76bdae83d3757b4cf2c3e702df34e'} = 1;
195    $dict->{'comment_preview'}{'Comment Preview Template'}{'ea173dfc883944776432dd24a103cb7b68e097b4'} = 1;
196    $dict->{'comment_preview'}{'Comment Preview Template'}{'fc4cb69b72fbeb8e9cd83886a5ced4f258b8693b'} = 1;
197    $dict->{'comment_pending'}{'Comment Pending Message'}{'26eeb357eb88eaf0f750a345b850d59f3f604556'} = 1;
198    $dict->{'comment_pending'}{'Comment Pending Message'}{'5c43581ac1a2ce853f4196ba08c6a31b662cd1d1'} = 1;
199    $dict->{'comment_pending'}{'Comment Pending Message'}{'8665ead2344f283b1cb7418b9a68dca75876c27b'} = 1;
200    $dict->{'comment_pending'}{'Comment Pending Message'}{'951151dc04e6b9ccfdddb9897b3f8c02f3545c6c'} = 1;
201    $dict->{'comment_pending'}{'Comment Pending Message'}{'aadde51bddbb40aba343fb9582d4d2cad87fa3e8'} = 1;
202    $dict->{'comment_pending'}{'Comment Pending Message'}{'ee85c8685ac1da0841ba3e8a3bf48f6f9665800a'} = 1;
203    $dict->{'comment_error'}{'Comment Error Template'}{'30653dc0cb616ae26770cdbd866883ffb2fc0ec9'} = 1;
204    $dict->{'comment_error'}{'Comment Error Template'}{'42558b4feda5735b6e9d483fa6765ba094ed6d5e'} = 1;
205    $dict->{'comment_error'}{'Comment Error Template'}{'957ca0607d478f8caba7a3e1ba2397d9cd37885f'} = 1;
206    $dict->{'comment_error'}{'Comment Error Template'}{'a9d7ebf9d0acd5f2fc8a393591b6b38f09c6b740'} = 1;
207    $dict->{'comment_error'}{'Comment Error Template'}{'af1975d66189367b15cec61e342a2b0e23cc9cbd'} = 1;
208    $dict->{'comment_error'}{'Comment Error Template'}{'b99d721f630aa2728bea73de47f6cdd87e95ad6c'} = 1;
209    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'f159c35e14a46fe206bf8907bffbb16447cad15c'} = 1;
210    $dict->{'comments'}{'Comment Listing Template'}{'64da0621324294f6c9c3341c31c0c941f35e3b57'} = 1;
211    $dict->{'comments'}{'Comment Listing Template'}{'92ed4e477d08086e5efc2ded4502c08ff98b9f64'} = 1;
212    $dict->{'comments'}{'Comment Listing Template'}{'9d687512b3b2bfc9cb976c903046a579ab887374'} = 1;
213    $dict->{'comments'}{'Comment Listing Template'}{'c41bf5b92366ce227689953f1cae14824cdd54ef'} = 1;
214    $dict->{'comments'}{'Comment Listing Template'}{'e71b31aebef0475e8c6a8e8de0fd47baec1445d9'} = 1;
215    $dict->{'comments'}{'Comment Listing Template'}{'ef9e2dfdf5e99522068456c1871a1d01aaacd2d3'} = 1;
216    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'ff3a52b390df5ec6aacdec43112bd047413b4c8c'} = 1;
217    $dict->{'index'}{'RSS 1.0 Index'}{'2ff7ed6dc4f509ead2407b6ea3e3f350f28b25bd'} = 1;
218    $dict->{'index'}{'Stylesheet'}{'e37a1b39e4c974bf0f3e79dddbf1e855edd0bdca'} = 1;
219    $dict->{'archive'}{'Date-Based Archive'}{'1bd4a4984845a41ad3b8a7303b5b4560daa84752'} = 1;
220    $dict->{'archive'}{'Date-Based Archive'}{'445a90339da5320f442ecc40d7271b574797677a'} = 1;
221    $dict->{'archive'}{'Date-Based Archive'}{'484a36f54c0968b2dbe336845e04307b5e20aa85'} = 1;
222    $dict->{'archive'}{'Date-Based Archive'}{'75936096e7d46e0e3f7c06c9df86f69a12b94768'} = 1;
223    $dict->{'archive'}{'Date-Based Archive'}{'edeed36ce2b0d6d0ff8052f6cf7f4116f39ac1ab'} = 1;
224    $dict->{'archive'}{'Date-Based Archive'}{'f3ef091689d36fc9826200bd55ed21d85a8c53ed'} = 1;
225    $dict->{'category'}{'Category Archive'}{'26e7859c15812790454b99de1d3887d0a8e8e6ff'} = 1;
226    $dict->{'category'}{'Category Archive'}{'3454326c2552bc1b5bfd1b542ec3ab6c87fb2c43'} = 1;
227    $dict->{'category'}{'Category Archive'}{'39096f7db2d393ed66df7de855b9841a90c95485'} = 1;
228    $dict->{'category'}{'Category Archive'}{'c0358a683783d625249e9b57075d4d0e6c04cfa7'} = 1;
229    $dict->{'category'}{'Category Archive'}{'d178ce949a06690f5c83aa519d801a674430c15c'} = 1;
230    $dict->{'category'}{'Category Archive'}{'e81f09062b54027bcd316594c3b945378f0f1347'} = 1;
231    $dict->{'individual'}{'Individual Entry Archive'}{'4fcff69ba6afdbcf734ee7c4542cd706a6afdc35'} = 1;
232    $dict->{'individual'}{'Individual Entry Archive'}{'551c79d951c8b31a24993a2d9e82fe8b00c2cb3f'} = 1;
233    $dict->{'individual'}{'Individual Entry Archive'}{'5a07a70562ecee1aacfb2c2edfd77d1cc7cbf2c6'} = 1;
234    $dict->{'individual'}{'Individual Entry Archive'}{'61b03a841e5bb5d2dad7794c068edcaa375853fd'} = 1;
235    $dict->{'individual'}{'Individual Entry Archive'}{'855be3df1a0ea28b93bcfc859ed4a9ad723169cc'} = 1;
236    $dict->{'individual'}{'Individual Entry Archive'}{'9d01472a423315728d78fcf7e356dbb818ed9ad5'} = 1;
237    $dict->{'pings'}{'TrackBack Listing Template'}{'0eef136c91c29bb85a2e3679b6edb5cbcdad843d'} = 1;
238    $dict->{'pings'}{'TrackBack Listing Template'}{'5e894b4ee8fcda2023c7fd38af6d26227f00c59a'} = 1;
239    $dict->{'pings'}{'TrackBack Listing Template'}{'6a00c296985925588567d31029ad3bb6e018f6ed'} = 1;
240    $dict->{'pings'}{'TrackBack Listing Template'}{'7a9681c99d268c7c191c373e7e5e7ff7634e7dd3'} = 1;
241    $dict->{'pings'}{'TrackBack Listing Template'}{'cef4ada361d56ab4387be0c890d0be861ee9bf66'} = 1;
242    $dict->{'pings'}{'TrackBack Listing Template'}{'fba39a64ad0d8b65344eba4e7f9ca48c8cdb2e3c'} = 1;
243    $dict->{'custom'}{'Remember Me'}{'7a644226fb29adec3d541a88d52d792e5672710d'} = 1;
244
245    # 3.17
246    $dict->{'index'}{'Main Index'}{'257e3d22a3682e9e86aa2d9be53af1e4c9abbbc7'} = 1;
247    $dict->{'index'}{'Main Index'}{'4b2e54a6cc5917428b3fb48fb36414a42a5920a6'} = 1;
248    $dict->{'index'}{'Main Index'}{'505f1d363a314ef2da488c157a374d6e00c58d57'} = 1;
249    $dict->{'index'}{'Main Index'}{'654bcea62270e62de2a28ecc0dd899c8887a69f2'} = 1;
250    $dict->{'index'}{'Main Index'}{'78a47d6748c87ad110ef0bead8838a09f26e81a4'} = 1;
251    $dict->{'index'}{'Main Index'}{'e7a7a2c704f18d87e723bfffaf5bef04a1dc91dd'} = 1;
252    $dict->{'index'}{'Dynamic Site Bootstrapper'}{'2143a746f4f73d9515ca9ab94f3241ca12d17306'} = 1;
253    $dict->{'index'}{'RSD'}{'287880a4c3840625053077b6334d91c345acd2e4'} = 1;
254    $dict->{'index'}{'Atom Index'}{'b72c5bbb48d9129ea39383e14b98286128952ade'} = 1;
255    $dict->{'index'}{'RSS 2.0 Index'}{'81c3335d388f2f69d6311ad4eb6ec344b654684f'} = 1;
256    $dict->{'index'}{'Master Archive Index'}{'2214c531eb49879641f1756311e0892f0399a702'} = 1;
257    $dict->{'index'}{'Master Archive Index'}{'4fbea20e8866041a59473c23968165499ca58263'} = 1;
258    $dict->{'index'}{'Master Archive Index'}{'9c6505c0f818e0f3347797939745f645414b3f47'} = 1;
259    $dict->{'index'}{'Master Archive Index'}{'a7851e7e1df743e7697ce987050c6cefe6757295'} = 1;
260    $dict->{'index'}{'Master Archive Index'}{'bcb285fdb914d77d1f64f9bdfd93440f3a32720a'} = 1;
261    $dict->{'comment_preview'}{'Comment Preview Template'}{'24a9f9c9aa0ba6d6741dc68e10ed5be406d67df8'} = 1;
262    $dict->{'comment_preview'}{'Comment Preview Template'}{'785529e76220b7ff2028ba216f5845f981ca7d7d'} = 1;
263    $dict->{'comment_preview'}{'Comment Preview Template'}{'82caa3186da19bcea245f653618a0187e2634137'} = 1;
264    $dict->{'comment_preview'}{'Comment Preview Template'}{'94a7cb5c4fe76bdae83d3757b4cf2c3e702df34e'} = 1;
265    $dict->{'comment_preview'}{'Comment Preview Template'}{'ea173dfc883944776432dd24a103cb7b68e097b4'} = 1;
266    $dict->{'comment_preview'}{'Comment Preview Template'}{'fc4cb69b72fbeb8e9cd83886a5ced4f258b8693b'} = 1;
267    $dict->{'comment_pending'}{'Comment Pending Message'}{'26eeb357eb88eaf0f750a345b850d59f3f604556'} = 1;
268    $dict->{'comment_pending'}{'Comment Pending Message'}{'5c43581ac1a2ce853f4196ba08c6a31b662cd1d1'} = 1;
269    $dict->{'comment_pending'}{'Comment Pending Message'}{'8665ead2344f283b1cb7418b9a68dca75876c27b'} = 1;
270    $dict->{'comment_pending'}{'Comment Pending Message'}{'951151dc04e6b9ccfdddb9897b3f8c02f3545c6c'} = 1;
271    $dict->{'comment_pending'}{'Comment Pending Message'}{'aadde51bddbb40aba343fb9582d4d2cad87fa3e8'} = 1;
272    $dict->{'comment_pending'}{'Comment Pending Message'}{'ee85c8685ac1da0841ba3e8a3bf48f6f9665800a'} = 1;
273    $dict->{'comment_error'}{'Comment Error Template'}{'30653dc0cb616ae26770cdbd866883ffb2fc0ec9'} = 1;
274    $dict->{'comment_error'}{'Comment Error Template'}{'42558b4feda5735b6e9d483fa6765ba094ed6d5e'} = 1;
275    $dict->{'comment_error'}{'Comment Error Template'}{'957ca0607d478f8caba7a3e1ba2397d9cd37885f'} = 1;
276    $dict->{'comment_error'}{'Comment Error Template'}{'a9d7ebf9d0acd5f2fc8a393591b6b38f09c6b740'} = 1;
277    $dict->{'comment_error'}{'Comment Error Template'}{'af1975d66189367b15cec61e342a2b0e23cc9cbd'} = 1;
278    $dict->{'comment_error'}{'Comment Error Template'}{'b99d721f630aa2728bea73de47f6cdd87e95ad6c'} = 1;
279    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'f159c35e14a46fe206bf8907bffbb16447cad15c'} = 1;
280    $dict->{'comments'}{'Comment Listing Template'}{'64da0621324294f6c9c3341c31c0c941f35e3b57'} = 1;
281    $dict->{'comments'}{'Comment Listing Template'}{'92ed4e477d08086e5efc2ded4502c08ff98b9f64'} = 1;
282    $dict->{'comments'}{'Comment Listing Template'}{'9d687512b3b2bfc9cb976c903046a579ab887374'} = 1;
283    $dict->{'comments'}{'Comment Listing Template'}{'c41bf5b92366ce227689953f1cae14824cdd54ef'} = 1;
284    $dict->{'comments'}{'Comment Listing Template'}{'e71b31aebef0475e8c6a8e8de0fd47baec1445d9'} = 1;
285    $dict->{'comments'}{'Comment Listing Template'}{'ef9e2dfdf5e99522068456c1871a1d01aaacd2d3'} = 1;
286    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'ff3a52b390df5ec6aacdec43112bd047413b4c8c'} = 1;
287    $dict->{'index'}{'RSS 1.0 Index'}{'2ff7ed6dc4f509ead2407b6ea3e3f350f28b25bd'} = 1;
288    $dict->{'index'}{'Stylesheet'}{'e37a1b39e4c974bf0f3e79dddbf1e855edd0bdca'} = 1;
289    $dict->{'archive'}{'Date-Based Archive'}{'1bd4a4984845a41ad3b8a7303b5b4560daa84752'} = 1;
290    $dict->{'archive'}{'Date-Based Archive'}{'445a90339da5320f442ecc40d7271b574797677a'} = 1;
291    $dict->{'archive'}{'Date-Based Archive'}{'484a36f54c0968b2dbe336845e04307b5e20aa85'} = 1;
292    $dict->{'archive'}{'Date-Based Archive'}{'75936096e7d46e0e3f7c06c9df86f69a12b94768'} = 1;
293    $dict->{'archive'}{'Date-Based Archive'}{'edeed36ce2b0d6d0ff8052f6cf7f4116f39ac1ab'} = 1;
294    $dict->{'archive'}{'Date-Based Archive'}{'f3ef091689d36fc9826200bd55ed21d85a8c53ed'} = 1;
295    $dict->{'category'}{'Category Archive'}{'26e7859c15812790454b99de1d3887d0a8e8e6ff'} = 1;
296    $dict->{'category'}{'Category Archive'}{'3454326c2552bc1b5bfd1b542ec3ab6c87fb2c43'} = 1;
297    $dict->{'category'}{'Category Archive'}{'39096f7db2d393ed66df7de855b9841a90c95485'} = 1;
298    $dict->{'category'}{'Category Archive'}{'c0358a683783d625249e9b57075d4d0e6c04cfa7'} = 1;
299    $dict->{'category'}{'Category Archive'}{'d178ce949a06690f5c83aa519d801a674430c15c'} = 1;
300    $dict->{'category'}{'Category Archive'}{'e81f09062b54027bcd316594c3b945378f0f1347'} = 1;
301    $dict->{'individual'}{'Individual Entry Archive'}{'4fcff69ba6afdbcf734ee7c4542cd706a6afdc35'} = 1;
302    $dict->{'individual'}{'Individual Entry Archive'}{'551c79d951c8b31a24993a2d9e82fe8b00c2cb3f'} = 1;
303    $dict->{'individual'}{'Individual Entry Archive'}{'5a07a70562ecee1aacfb2c2edfd77d1cc7cbf2c6'} = 1;
304    $dict->{'individual'}{'Individual Entry Archive'}{'61b03a841e5bb5d2dad7794c068edcaa375853fd'} = 1;
305    $dict->{'individual'}{'Individual Entry Archive'}{'855be3df1a0ea28b93bcfc859ed4a9ad723169cc'} = 1;
306    $dict->{'individual'}{'Individual Entry Archive'}{'9d01472a423315728d78fcf7e356dbb818ed9ad5'} = 1;
307    $dict->{'pings'}{'TrackBack Listing Template'}{'0eef136c91c29bb85a2e3679b6edb5cbcdad843d'} = 1;
308    $dict->{'pings'}{'TrackBack Listing Template'}{'5e894b4ee8fcda2023c7fd38af6d26227f00c59a'} = 1;
309    $dict->{'pings'}{'TrackBack Listing Template'}{'6a00c296985925588567d31029ad3bb6e018f6ed'} = 1;
310    $dict->{'pings'}{'TrackBack Listing Template'}{'7a9681c99d268c7c191c373e7e5e7ff7634e7dd3'} = 1;
311    $dict->{'pings'}{'TrackBack Listing Template'}{'cef4ada361d56ab4387be0c890d0be861ee9bf66'} = 1;
312    $dict->{'pings'}{'TrackBack Listing Template'}{'fba39a64ad0d8b65344eba4e7f9ca48c8cdb2e3c'} = 1;
313    $dict->{'custom'}{'Remember Me'}{'7a644226fb29adec3d541a88d52d792e5672710d'} = 1;
314
315    # 3.2
316    $dict->{'index'}{'Main Index'}{'50c83d4f945489528298570a92f2b4ad1afdb1f6'} = 1;
317    $dict->{'index'}{'Main Index'}{'c57f03abae67d14e4163535d6e811e274087a4e4'} = 1;
318    $dict->{'index'}{'Main Index'}{'6c70ae96c27376919b21bd0e2605cc2aaf3a84b8'} = 1;
319    $dict->{'index'}{'Main Index'}{'31ad7c7ebc035652b77e9987fd2d6f203e5fcc8d'} = 1;
320    $dict->{'index'}{'Main Index'}{'d03205618f10d0843d61cd664599c2c4c2a85627'} = 1;
321    $dict->{'index'}{'Main Index'}{'289070a23482e6e04fbb3f8020c697269ee167cd'} = 1;
322    $dict->{'index'}{'Dynamic Site Bootstrapper'}{'e9b325331bd4fce9ca9b544b2a09fa9e01fbd541'} = 1;
323    $dict->{'index'}{'RSD'}{'57543f1fd2c6bcb1ed16eaa7d928730a837149d0'} = 1;
324    $dict->{'index'}{'Atom Index'}{'5fa1a4c059ce2dcddb526cfa12eae1003be2583b'} = 1;
325    $dict->{'index'}{'RSS 2.0 Index'}{'c8b422769d99f8fd21442642d2b79e5a0ee1a85a'} = 1;
326    $dict->{'index'}{'Master Archive Index'}{'e9db4c670ff9aff2baea7f609b6db77935ac4282'} = 1;
327    $dict->{'index'}{'Master Archive Index'}{'792372eb3c7d207818cea314290369b05c392c3b'} = 1;
328    $dict->{'index'}{'Master Archive Index'}{'bff8a874202697b68f9227b71c35ceb11e39a436'} = 1;
329    $dict->{'index'}{'Master Archive Index'}{'315b7a74963f553bbd4bd5141052c90520fe6e41'} = 1;
330    $dict->{'index'}{'Master Archive Index'}{'653bd8afe0c2763320e7a5f12ceef732a61ed009'} = 1;
331    $dict->{'index'}{'Master Archive Index'}{'c95c904e8ee5fd1d7031fe53696c150d7de88956'} = 1;
332    $dict->{'comment_preview'}{'Comment Preview Template'}{'4c46ae1ad45f314b47a5bc6216c36bd91f83a932'} = 1;
333    $dict->{'comment_preview'}{'Comment Preview Template'}{'1a008e9944ae68ecca38581650ab1e877e131755'} = 1;
334    $dict->{'comment_preview'}{'Comment Preview Template'}{'c47383d88a3496506a2c5096933e46f3a95caacc'} = 1;
335    $dict->{'comment_preview'}{'Comment Preview Template'}{'2ced278066ee02eb3f247fb8219af43aad049b1b'} = 1;
336    $dict->{'comment_preview'}{'Comment Preview Template'}{'08d99a3752549f3d03b4a6265f4c9aaa17724e4e'} = 1;
337    $dict->{'comment_preview'}{'Comment Preview Template'}{'bb4801361a4d93826641b184cb9bf2514fb4ca95'} = 1;
338    $dict->{'comment_pending'}{'Comment Pending Template'}{'ebd77c22cad2162e95fe9c9e68a1c03aac2aadca'} = 1;
339    $dict->{'comment_pending'}{'Comment Pending Template'}{'8cfcdc8a96ec36a8b05851d292f6fba5eb2b4a0d'} = 1;
340    $dict->{'comment_pending'}{'Comment Pending Template'}{'19d72988852a13874e6f44ed070b2e1195ceba5d'} = 1;
341    $dict->{'comment_pending'}{'Comment Pending Template'}{'3d8028a0374adb4832d828bc729bacc6c2ea2847'} = 1;
342    $dict->{'comment_pending'}{'Comment Pending Template'}{'3d08a028a703672bffeadbd914cb2cb1a2e230a8'} = 1;
343    $dict->{'comment_pending'}{'Comment Pending Template'}{'b9baeb21b2d210d2e3ef21792a5924b5697b0dde'} = 1;
344    $dict->{'comment_error'}{'Comment Error Template'}{'249ed8a29c6a907d952c99b8eb7ce8ff985ede81'} = 1;
345    $dict->{'comment_error'}{'Comment Error Template'}{'643bcfa881c379c964423eec1d7d684e75d499e8'} = 1;
346    $dict->{'comment_error'}{'Comment Error Template'}{'02f0b905002fe592a0cf112d37564e276b0faa2d'} = 1;
347    $dict->{'comment_error'}{'Comment Error Template'}{'b4f20dae1728aa1fe16dd69ea4be6b9e781f502a'} = 1;
348    $dict->{'comment_error'}{'Comment Error Template'}{'65b5906a68d564a801c39887e1fee0d2e5f49e2a'} = 1;
349    $dict->{'comment_error'}{'Comment Error Template'}{'8f6bcc9c90a8ee868e5968e9a6bd2c32a986b14d'} = 1;
350    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'f159c35e14a46fe206bf8907bffbb16447cad15c'} = 1;
351    $dict->{'comments'}{'Comment Listing Template'}{'1a438795836b35184d43c07071fcb40cf3d8464d'} = 1;
352    $dict->{'comments'}{'Comment Listing Template'}{'9e7b74ac71a7b0dc52b2c0cd90ec79df06ec3f98'} = 1;
353    $dict->{'comments'}{'Comment Listing Template'}{'e8486e7aa71b9421f2d9c344bf10bbdad97f7685'} = 1;
354    $dict->{'comments'}{'Comment Listing Template'}{'8d85f97157a0614e0311ba37f1f2f6873bad21b2'} = 1;
355    $dict->{'comments'}{'Comment Listing Template'}{'eaaa98262408c5fc639d137b59d90948393532f1'} = 1;
356    $dict->{'comments'}{'Comment Listing Template'}{'a38c1b53de303a6d170ef1a5e0cbccccbd2e409a'} = 1;
357    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'a966eff35cf5ba521b3cf65b3a864e7928ce545e'} = 1;
358    $dict->{'index'}{'Stylesheet'}{'c5fcd0645c518f20229845ae6d1d5f87705561dc'} = 1;
359    $dict->{'archive'}{'Date-Based Archive'}{'56045fcb3935d936148a2885f38b6a78404b4744'} = 1;
360    $dict->{'archive'}{'Date-Based Archive'}{'12bcfe8fbe9d111156791b8c8f3c8749f83dd424'} = 1;
361    $dict->{'archive'}{'Date-Based Archive'}{'a8a589ba1331776f44ed3bec77a786071dd5dc1e'} = 1;
362    $dict->{'archive'}{'Date-Based Archive'}{'77799d5e65d5d122112ac8b88457fa03fe082aec'} = 1;
363    $dict->{'archive'}{'Date-Based Archive'}{'f4b51a67552dbe21883b49225de20ade4ae32796'} = 1;
364    $dict->{'archive'}{'Date-Based Archive'}{'5136216dedc36b2c09c5f8af50ce882500691ec8'} = 1;
365    $dict->{'category'}{'Category Archive'}{'224baa825cd0aabad7103d63e658445b8a526832'} = 1;
366    $dict->{'category'}{'Category Archive'}{'75bdfb699a3ffed81a694c28a4546eb69a63b048'} = 1;
367    $dict->{'category'}{'Category Archive'}{'a7dbf80b657fbb0aa60a7921d4afb28f5e3deab5'} = 1;
368    $dict->{'category'}{'Category Archive'}{'151218ebde34c7b519d545b2599cdd7710f94581'} = 1;
369    $dict->{'category'}{'Category Archive'}{'8228cc33b01dfc9e56d54ef9244050b5fb4b5edb'} = 1;
370    $dict->{'category'}{'Category Archive'}{'2477eaa407ceedf22a5cfd45a712ecfa679bb239'} = 1;
371    $dict->{'individual'}{'Individual Entry Archive'}{'2478a6d2a8e2263e08e186c16e628c3308537f7e'} = 1;
372    $dict->{'individual'}{'Individual Entry Archive'}{'4481d3e46f181fc48f20deb04cefee32e10b93df'} = 1;
373    $dict->{'individual'}{'Individual Entry Archive'}{'5450a02da684d62ce641def899ce2fb1552bd4df'} = 1;
374    $dict->{'individual'}{'Individual Entry Archive'}{'12a44b921edd2c334f080d12e12165667ba32bec'} = 1;
375    $dict->{'individual'}{'Individual Entry Archive'}{'e9bb249680f91f4ae47dc7f378549dbe96be449b'} = 1;
376    $dict->{'individual'}{'Individual Entry Archive'}{'45ff13684d97060048bc6713a998cefc969c8a73'} = 1;
377    $dict->{'pings'}{'TrackBack Listing Template'}{'804336c28aa4889bf1db400d104ba4ae96c8268b'} = 1;
378    $dict->{'pings'}{'TrackBack Listing Template'}{'26640fe63e03f3bfc5b7352816f7f1da45a64105'} = 1;
379    $dict->{'pings'}{'TrackBack Listing Template'}{'c3d91a9921bdab4ea7ce0861add698bdc626fdd2'} = 1;
380    $dict->{'pings'}{'TrackBack Listing Template'}{'4056479095700a138b9496e8ec213fc98a2d3757'} = 1;
381    $dict->{'pings'}{'TrackBack Listing Template'}{'be7d64c95bc35412fb2849c66b4c98a00a354302'} = 1;
382    $dict->{'pings'}{'TrackBack Listing Template'}{'c141038bad4434a325f2addca28d70cd3fc52601'} = 1;
383    $dict->{'index'}{'Site JavaScript'}{'353deac26b1e36413f04e168334673cf4ceb0d6e'} = 1;
384    $dict->{'index'}{'Site JavaScript'}{'f434f656daffa9d38f2aead9afff9479c3f02370'} = 1;
385    $dict->{'index'}{'Site JavaScript'}{'e1d1b06e1d5ea59074ce4c6a3d1d97de5d66fbbc'} = 1;
386    $dict->{'index'}{'Site JavaScript'}{'5eda24da316fc1d2fe419b27f0f9271da1a01b04'} = 1;
387    $dict->{'index'}{'Site JavaScript'}{'c791e4ff1f6ff8219fe9164f5abfe99caedc097e'} = 1;
388    $dict->{'index'}{'Site JavaScript'}{'7d7fee169eff2197beb2d402a760f3983ed215b5'} = 1;
389
390    # 3.3
391    $dict->{'index'}{'Main Index'}{'5c40d95bb5dfd4ad1925eab9f09dcdb2f4e4667e'} = 1;
392    $dict->{'index'}{'Main Index'}{'6183febd21fd0ee9b401ca55b69318785498da95'} = 1;
393    $dict->{'index'}{'Main Index'}{'6e5c86d10ed330c9823d993d316c5253d6cf7675'} = 1;
394    $dict->{'index'}{'Main Index'}{'b449bb77af595dad6be852b94f0e4b9405b8dc21'} = 1;
395    $dict->{'index'}{'Main Index'}{'bee2ede21b56818fb509437325d083b7812f0355'} = 1;
396    $dict->{'index'}{'Main Index'}{'dd5394ca9d1883a9a0addba0a872f7c333fbf72c'} = 1;
397    $dict->{'index'}{'Dynamic Site Bootstrapper'}{'e9b325331bd4fce9ca9b544b2a09fa9e01fbd541'} = 1;
398    $dict->{'index'}{'RSD'}{'ff390cfb6e179278ed90ed19c46980046cc6ca98'} = 1;
399    $dict->{'index'}{'Atom Index'}{'fba75a39812b73ed25b178c6d54a0d88ded749c6'} = 1;
400    $dict->{'index'}{'RSS 2.0 Index'}{'28308bc499f2d583cc16451fdee9b4fd0afe7535'} = 1;
401    $dict->{'index'}{'Master Archive Index'}{'43fc316f6cbd036a454105a4650633256a7848d2'} = 1;
402    $dict->{'index'}{'Master Archive Index'}{'4e7986a28b29f3f9c71b83611c9d7fa801e712f5'} = 1;
403    $dict->{'index'}{'Master Archive Index'}{'6967e2b3a874721e415a14974d07bf8d98bb7313'} = 1;
404    $dict->{'index'}{'Master Archive Index'}{'6b5420d20e98b218729532bf4cd6f3a1e854b63d'} = 1;
405    $dict->{'index'}{'Master Archive Index'}{'aa78a22812234cfedac73007f3174c11e97f5ca7'} = 1;
406    $dict->{'index'}{'Master Archive Index'}{'f24a0cd05ce723f528a0cf5b5bdd9fd8e7b122a3'} = 1;
407    $dict->{'comment_preview'}{'Comment Preview Template'}{'02a7238b5cf47492a25346c12403bf4619dde421'} = 1;
408    $dict->{'comment_preview'}{'Comment Preview Template'}{'0d4d33131d2619c282a772a6612ced7b1b756e74'} = 1;
409    $dict->{'comment_preview'}{'Comment Preview Template'}{'1c9ed4be426132a92234b931d08dc293f8821c74'} = 1;
410    $dict->{'comment_preview'}{'Comment Preview Template'}{'39b252fd0d7be06928c0c85f27db9d782a7ad8cc'} = 1;
411    $dict->{'comment_preview'}{'Comment Preview Template'}{'78ade98c2c2c1c302003b75704271edcd9a1a553'} = 1;
412    $dict->{'comment_preview'}{'Comment Preview Template'}{'de1b72e1f90d18c8f4d53fc20b058a415229cb34'} = 1;
413    $dict->{'search_template'}{'Search Results Template'}{'486ef66c812aff3cea76e0139a119741f378c03e'} = 1;
414    $dict->{'search_template'}{'Search Results Template'}{'5c61bb51b5009064ac5d0714c45872e90f962ec7'} = 1;
415    $dict->{'search_template'}{'Search Results Template'}{'6083abaa94bc6124d7c81b0e6eb2edece1e2b6e6'} = 1;
416    $dict->{'search_template'}{'Search Results Template'}{'7ea885c35f4babd5e5d27dbd29de4883d90b7ad5'} = 1;
417    $dict->{'search_template'}{'Search Results Template'}{'a0ae181a5da00e05fecd2da63a93707a60cdf46a'} = 1;
418    $dict->{'search_template'}{'Search Results Template'}{'fc747caff630fc6ce954c2167fd76291b32442ee'} = 1;
419    $dict->{'comment_pending'}{'Comment Pending Template'}{'203c19dc815ee2a569e999ffe45c9d181938c7e8'} = 1;
420    $dict->{'comment_pending'}{'Comment Pending Template'}{'45623af81ada62e96da3a0250677a2a9eb89165a'} = 1;
421    $dict->{'comment_pending'}{'Comment Pending Template'}{'af1b078b411608c1624479f9fef21bf23e7035aa'} = 1;
422    $dict->{'comment_pending'}{'Comment Pending Template'}{'b0a9c1e1fdb222415252334fc806b1e9cd1e9cd4'} = 1;
423    $dict->{'comment_pending'}{'Comment Pending Template'}{'bc45c2305e3dd8980369e30d9b26a6a04a01e439'} = 1;
424    $dict->{'comment_pending'}{'Comment Pending Template'}{'e7489716f8a2b0a3858337a37ae8836394f690fd'} = 1;
425    $dict->{'comment_error'}{'Comment Error Template'}{'15d7ebb7000b738ac3afd9666874772165962f90'} = 1;
426    $dict->{'comment_error'}{'Comment Error Template'}{'a8d3a908dca1d038a2dc8904628d76aa94a289a1'} = 1;
427    $dict->{'comment_error'}{'Comment Error Template'}{'b836e718fa1241b2ef68b7da8cfa2fa3918f2dae'} = 1;
428    $dict->{'comment_error'}{'Comment Error Template'}{'d742280800194d70a9dc5dc72c774183e5566e32'} = 1;
429    $dict->{'comment_error'}{'Comment Error Template'}{'ed3c39c66bb65883520844671d17ba19d408e28c'} = 1;
430    $dict->{'comment_error'}{'Comment Error Template'}{'f11e4ab182d6f9d0a0ddeb002e7d84a3296ad9f8'} = 1;
431    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'f159c35e14a46fe206bf8907bffbb16447cad15c'} = 1;
432    $dict->{'comments'}{'Comment Listing Template'}{'da39a3ee5e6b4b0d3255bfef95601890afd80709'} = 1;
433    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'67f321198052295b9c7090a843a7dd39e1856b5c'} = 1;
434    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'74f785030fee43e54aec17495a0d668b32d04400'} = 1;
435    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'8263c276766334f5ade678c814c7bc2705e60094'} = 1;
436    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'9cf7a4087e15af2c97513d96bc0645c50bb7988c'} = 1;
437    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'be2e380cc8806fe7d28722f2edab1b01c5a2e7eb'} = 1;
438    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'beb0de4c18f4ccb7c96d0fa8a20443b89fd561e5'} = 1;
439    $dict->{'index'}{'Stylesheet'}{'f56b73a0ee479d80cd828351cd0e44d28f1b408c'} = 1;
440    $dict->{'archive'}{'Date-Based Archive'}{'40741d060c976c434bce68f04ba67a3a0ec00b0e'} = 1;
441    $dict->{'archive'}{'Date-Based Archive'}{'49fa2e5810477aca64084689aa424993bc5b6e22'} = 1;
442    $dict->{'archive'}{'Date-Based Archive'}{'7bde4f815ccb8657b0680b10ecda21dc7e48123b'} = 1;
443    $dict->{'archive'}{'Date-Based Archive'}{'89ef8a786feea9b3071c0c0ae4aff3fd6f3882be'} = 1;
444    $dict->{'archive'}{'Date-Based Archive'}{'b2702df25d1b570009bd0a55d2fb9a645343a92c'} = 1;
445    $dict->{'archive'}{'Date-Based Archive'}{'b99e0a5026a5863bbaea907cbc11cd51fbd336d5'} = 1;
446    $dict->{'category'}{'Category Archive'}{'a1b4c5cbada8123d978bff41286f1703be686cfd'} = 1;
447    $dict->{'category'}{'Category Archive'}{'b2d98dbefdd32ff4d4f9d1368dbca4b6518cca2f'} = 1;
448    $dict->{'category'}{'Category Archive'}{'c22c57d60ad210ae743c8e427c441a07fd3ab2b7'} = 1;
449    $dict->{'category'}{'Category Archive'}{'c274c9b03542f5dfb765ea8540c7185da09fdeac'} = 1;
450    $dict->{'category'}{'Category Archive'}{'e3dcd193e33875d0982a28f2c443a27126c10cf1'} = 1;
451    $dict->{'category'}{'Category Archive'}{'f6771cefb5e3d8ae7d1bb6bb264171ac843a5df3'} = 1;
452    $dict->{'individual'}{'Individual Entry Archive'}{'0a84e63531a74dd4a4ef6b24ea8c2b91ee271e4f'} = 1;
453    $dict->{'individual'}{'Individual Entry Archive'}{'2af8713ded4763c22fa49b675d7c46823e860522'} = 1;
454    $dict->{'individual'}{'Individual Entry Archive'}{'4f109310012f04b90b5fcf3f3989f573e105da07'} = 1;
455    $dict->{'individual'}{'Individual Entry Archive'}{'cd34a24be876fcb4d3791a007fffbb860f719ab1'} = 1;
456    $dict->{'individual'}{'Individual Entry Archive'}{'e5997b7781fac409e8b0c5291e62d7110f9f70f2'} = 1;
457    $dict->{'individual'}{'Individual Entry Archive'}{'ea8ff046d33b13e184a6554913b1a1ca9f511caf'} = 1;
458    $dict->{'pings'}{'TrackBack Listing Template'}{'2413900dd7bab6a9f343b3928e87b0e9a002e51f'} = 1;
459    $dict->{'pings'}{'TrackBack Listing Template'}{'37447d36ad1b21412dbbca4e65e1ab9dd3fc568d'} = 1;
460    $dict->{'pings'}{'TrackBack Listing Template'}{'467445a45144ab4693afe5dfb9afd2227d030096'} = 1;
461    $dict->{'pings'}{'TrackBack Listing Template'}{'6091982a5937c8f195fa9f7a088257422b541401'} = 1;
462    $dict->{'pings'}{'TrackBack Listing Template'}{'976b0a3ab1150ea819179e2142cfa26f04ddeef6'} = 1;
463    $dict->{'pings'}{'TrackBack Listing Template'}{'ed00503cfdad65bc0dc6052dcec65156c28e70f5'} = 1;
464    $dict->{'index'}{'Site JavaScript'}{'54bca4e2bc0f5dbb60597510fbe61ff4ed003411'} = 1;
465    $dict->{'index'}{'Site JavaScript'}{'5f3eed652dcf68046f9b97d3fdce37c775f342d8'} = 1;
466    $dict->{'index'}{'Site JavaScript'}{'6f0f45ab3722ceb61975b6f6dd8a520f928764a6'} = 1;
467    $dict->{'index'}{'Site JavaScript'}{'c09cf11cc201c9f496d288c70b04ece48e6538b9'} = 1;
468    $dict->{'index'}{'Site JavaScript'}{'cb63919ca27db43fb53d8a276330173f38b1711a'} = 1;
469    $dict->{'index'}{'Site JavaScript'}{'d9fde44333056883277185fc507eb162d5334bcf'} = 1;
470
471    # MTE 1.51
472    $dict->{'index'}{'Main Index'}{'313ff96167d85dc564e8b577be4cb0f21a57ff36'} = 1;
473    $dict->{'index'}{'Main Index'}{'34b9a84fd904fa243ce5bff1f7bb570eab37cd8e'} = 1;
474    $dict->{'index'}{'Main Index'}{'392cd1eaad29457abe09876f4215e53482ab0932'} = 1;
475    $dict->{'index'}{'Main Index'}{'57bb52200d69dbe3aa3790bd29def3264244a0fc'} = 1;
476    $dict->{'index'}{'Main Index'}{'c59ca450273e6315e6416276c2f57bb4ced8f53b'} = 1;
477    $dict->{'index'}{'Main Index'}{'d35f6145a1fed70c6b48d6ca82308a578e95343b'} = 1;
478    $dict->{'index'}{'Dynamic Site Bootstrapper'}{'e9b325331bd4fce9ca9b544b2a09fa9e01fbd541'} = 1;
479    $dict->{'index'}{'RSD'}{'ff390cfb6e179278ed90ed19c46980046cc6ca98'} = 1;
480    $dict->{'index'}{'Atom Index'}{'4ca4dd94a6ec56e2a2a506bd1039cf886cc07b04'} = 1;
481    $dict->{'index'}{'RSS 2.0 Index'}{'b432c8fef71ec8ff3826bb870bdcb435eb34a7e8'} = 1;
482    $dict->{'index'}{'Master Archive Index'}{'6237ff54b2a7b71f5d55e68ff70da40ca6421486'} = 1;
483    $dict->{'index'}{'Master Archive Index'}{'985a3f84fe24aaead9a28d7fb90933d661a72d12'} = 1;
484    $dict->{'index'}{'Master Archive Index'}{'a83c2bfe580562c77f42a2ac61bf0d42278c980a'} = 1;
485    $dict->{'index'}{'Master Archive Index'}{'c3b9ce80a837629c92ad9cb31ee18393bc06c6f4'} = 1;
486    $dict->{'index'}{'Master Archive Index'}{'d1ca7959fb5e8edf6648e6474bb3f4feafdcd61f'} = 1;
487    $dict->{'index'}{'Master Archive Index'}{'f361fec0148d58238e9558c20117f2a7bf1fb552'} = 1;
488    $dict->{'comment_preview'}{'Comment Preview Template'}{'485adc13e97ac8156f40a4502b20072e2f08629a'} = 1;
489    $dict->{'comment_preview'}{'Comment Preview Template'}{'516a58045dca00e539dc57c7f553b9bec5657154'} = 1;
490    $dict->{'comment_preview'}{'Comment Preview Template'}{'647698177249dea2b8e4b930259b1a30e5d1d86b'} = 1;
491    $dict->{'comment_preview'}{'Comment Preview Template'}{'a293a6806509221435c304084d3bb0013cab589c'} = 1;
492    $dict->{'comment_preview'}{'Comment Preview Template'}{'ae5851eab2018c2ae8e63083d58e9200316ca03c'} = 1;
493    $dict->{'comment_preview'}{'Comment Preview Template'}{'f192a8d0a920e78f43558754b4d81249e51b8863'} = 1;
494    $dict->{'search_template'}{'Search Results Template'}{'16808308a12156eb48e09d6c784c0b1f64310945'} = 1;
495    $dict->{'search_template'}{'Search Results Template'}{'4ddc46ef33b2a2e6f2020c3785401a40074fe19b'} = 1;
496    $dict->{'search_template'}{'Search Results Template'}{'565687178c2da3ece1c921c7a34abb4f1733e711'} = 1;
497    $dict->{'search_template'}{'Search Results Template'}{'a7cac531ea2b495f387e66ac05ca0ea767318f4b'} = 1;
498    $dict->{'search_template'}{'Search Results Template'}{'bae89f413f82176ef9af7e2de4035aae197d2fe6'} = 1;
499    $dict->{'search_template'}{'Search Results Template'}{'bc37bab9d99f67c53526897784b51c0fdcace5e5'} = 1;
500    $dict->{'comment_pending'}{'Comment Pending Template'}{'203c19dc815ee2a569e999ffe45c9d181938c7e8'} = 1;
501    $dict->{'comment_pending'}{'Comment Pending Template'}{'45623af81ada62e96da3a0250677a2a9eb89165a'} = 1;
502    $dict->{'comment_pending'}{'Comment Pending Template'}{'af1b078b411608c1624479f9fef21bf23e7035aa'} = 1;
503    $dict->{'comment_pending'}{'Comment Pending Template'}{'b0a9c1e1fdb222415252334fc806b1e9cd1e9cd4'} = 1;
504    $dict->{'comment_pending'}{'Comment Pending Template'}{'bc45c2305e3dd8980369e30d9b26a6a04a01e439'} = 1;
505    $dict->{'comment_pending'}{'Comment Pending Template'}{'e7489716f8a2b0a3858337a37ae8836394f690fd'} = 1;
506    $dict->{'comment_error'}{'Comment Error Template'}{'5b5ded6c4513c91cd7cd864c7a652a4dc2a87558'} = 1;
507    $dict->{'comment_error'}{'Comment Error Template'}{'a8d3a908dca1d038a2dc8904628d76aa94a289a1'} = 1;
508    $dict->{'comment_error'}{'Comment Error Template'}{'b836e718fa1241b2ef68b7da8cfa2fa3918f2dae'} = 1;
509    $dict->{'comment_error'}{'Comment Error Template'}{'d742280800194d70a9dc5dc72c774183e5566e32'} = 1;
510    $dict->{'comment_error'}{'Comment Error Template'}{'ed3c39c66bb65883520844671d17ba19d408e28c'} = 1;
511    $dict->{'comment_error'}{'Comment Error Template'}{'f11e4ab182d6f9d0a0ddeb002e7d84a3296ad9f8'} = 1;
512    $dict->{'popup_image'}{'Uploaded Image Popup Template'}{'f159c35e14a46fe206bf8907bffbb16447cad15c'} = 1;
513    $dict->{'comments'}{'Comment Listing Template'}{'da39a3ee5e6b4b0d3255bfef95601890afd80709'} = 1;
514    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'67f321198052295b9c7090a843a7dd39e1856b5c'} = 1;
515    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'74f785030fee43e54aec17495a0d668b32d04400'} = 1;
516    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'8263c276766334f5ade678c814c7bc2705e60094'} = 1;
517    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'9cf7a4087e15af2c97513d96bc0645c50bb7988c'} = 1;
518    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'be2e380cc8806fe7d28722f2edab1b01c5a2e7eb'} = 1;
519    $dict->{'dynamic_error'}{'Dynamic Pages Error Template'}{'beb0de4c18f4ccb7c96d0fa8a20443b89fd561e5'} = 1;
520    $dict->{'index'}{'Stylesheet'}{'d27b1454b8300141315d1151fce877b305c39c84'} = 1;
521    $dict->{'archive'}{'Date-Based Archive'}{'2143b314f58124bf77244ebf84091a3ce6af2139'} = 1;
522    $dict->{'archive'}{'Date-Based Archive'}{'4ee5fcb51a26ce600a01a5a03c7d186669ee77db'} = 1;
523    $dict->{'archive'}{'Date-Based Archive'}{'a80b7f056ad684dd58f43b4b48118384ba02e282'} = 1;
524    $dict->{'archive'}{'Date-Based Archive'}{'bd160389f58d0ecac3cf1ead0f512a69fa7ea866'} = 1;
525    $dict->{'archive'}{'Date-Based Archive'}{'e3914933ce528c588bc901932a02738e87fb7d7e'} = 1;
526    $dict->{'archive'}{'Date-Based Archive'}{'fb0ce9af3f9918dcab128e346a0fbb6771550d07'} = 1;
527    $dict->{'category'}{'Category Archive'}{'6f4f50d8c86a7dfb2e00866b0ccc0bd6a70d3c6b'} = 1;
528    $dict->{'category'}{'Category Archive'}{'72d2be988cab822e955568810b7157d20eacb03a'} = 1;
529    $dict->{'category'}{'Category Archive'}{'9487ba109bb2371a2d99fe5c8a0c53e1f61dc34f'} = 1;
530    $dict->{'category'}{'Category Archive'}{'d2a476d700d3cdee1b810e47f99202cf84b6fa57'} = 1;
531    $dict->{'category'}{'Category Archive'}{'dc923b61b77bf3f18a0cf459fc32bdc00be50e14'} = 1;
532    $dict->{'category'}{'Category Archive'}{'f6c9ad614f4e7ffd17e4e23477e2cfbd77ca190c'} = 1;
533    $dict->{'individual'}{'Individual Entry Archive'}{'123c98313ae62f3f343c4b12fe1e715ad0296c58'} = 1;
534    $dict->{'individual'}{'Individual Entry Archive'}{'5925f800791fcdd03e99f20af1e557ab8ce849fa'} = 1;
535    $dict->{'individual'}{'Individual Entry Archive'}{'6cec4aa05733f0ea3b3f5e91fa15c98d65b62622'} = 1;
536    $dict->{'individual'}{'Individual Entry Archive'}{'db77b0d9164a007170995b7970312fa587518ba5'} = 1;
537    $dict->{'individual'}{'Individual Entry Archive'}{'e357cef68ef7f0e7453bc89aaa35a6d2bea5de4a'} = 1;
538    $dict->{'individual'}{'Individual Entry Archive'}{'edd4a1b58f6ff9ad6a545e5990cb4c63c20c2d51'} = 1;
539    $dict->{'pings'}{'TrackBack Listing Template'}{'2413900dd7bab6a9f343b3928e87b0e9a002e51f'} = 1;
540    $dict->{'pings'}{'TrackBack Listing Template'}{'37447d36ad1b21412dbbca4e65e1ab9dd3fc568d'} = 1;
541    $dict->{'pings'}{'TrackBack Listing Template'}{'467445a45144ab4693afe5dfb9afd2227d030096'} = 1;
542    $dict->{'pings'}{'TrackBack Listing Template'}{'6091982a5937c8f195fa9f7a088257422b541401'} = 1;
543    $dict->{'pings'}{'TrackBack Listing Template'}{'976b0a3ab1150ea819179e2142cfa26f04ddeef6'} = 1;
544    $dict->{'pings'}{'TrackBack Listing Template'}{'ed00503cfdad65bc0dc6052dcec65156c28e70f5'} = 1;
545    $dict->{'index'}{'Site JavaScript'}{'1c376f4fd213e5434ac8a604535817a338f4ce51'} = 1;
546    $dict->{'index'}{'Site JavaScript'}{'50afbfdef7823ab5b79f10c0127b18b995b8b07c'} = 1;
547    $dict->{'index'}{'Site JavaScript'}{'690680f572521bf47d1e25295c23b05f4212de5c'} = 1;
548    $dict->{'index'}{'Site JavaScript'}{'b2292561b588e527260b82939b52b19ede801632'} = 1;
549    $dict->{'index'}{'Site JavaScript'}{'bf4420283b317eb92f7a9e2118c6ee6838bfc8ab'} = 1;
550    $dict->{'index'}{'Site JavaScript'}{'cf6e064a86b907f1baef6ec5880feb1617e64390'} = 1;
551    ];
552
553    $dict;
554}
555
556sub default_templates {
557    my $app = shift;
558
559    require MT::DefaultTemplates;
560    my $tmpl_list = MT::DefaultTemplates->templates;
561    return $app->error( $app->translate("Error loading default templates.") )
562      unless $tmpl_list;
563    $tmpl_list;
564}
565
566sub refresh_blog_templates {
567    my $plugin = shift;
568    my ($app) = @_;
569
570    my $t = time;
571
572    my @id = $app->param('id');
573    require MT::Template;
574
575
576    # logic:
577    #    process scope of templates...
578
579    #    load default templates:
580    my $tmpl_list = default_templates($app) or return;
581
582    my $dict = default_dictionary();
583
584    my @msg;
585    require MT::Blog;
586    require MT::Permission;
587    require MT::Util;
588
589    foreach my $blog_id (@id) {
590        my $blog = MT::Blog->load($blog_id);
591        next unless $blog;
592        if ( !$app->{author}->is_superuser() ) {
593            my $perms = MT::Permission->load(
594                { blog_id => $blog_id, author_id => $app->{author}->id } );
595            if (
596                !$perms
597                || (   !$perms->can_edit_templates()
598                    && !$perms->can_administer_blog() )
599              )
600            {
601                push @msg,
602                  $app->translate(
603"Insufficient permissions to modify templates for weblog '[_1]'",
604                    $blog->name()
605                  );
606                next;
607            }
608        }
609
610        push @msg,
611          $app->translate( "Processing templates for weblog '[_1]'",
612            $blog->name );
613
614        foreach my $val (@$tmpl_list) {
615            if ( !$val->{orig_name} ) {
616                $val->{orig_name} = $val->{name};
617                $val->{name}      = $app->translate( $val->{name} );
618                $val->{text}      = $app->translate_templatized( $val->{text} );
619            }
620            my $orig_name = $val->{orig_name};
621
622            my @ts = MT::Util::offset_time_list( $t, $blog_id );
623            my $ts = sprintf "%04d-%02d-%02d %02d:%02d:%02d", $ts[5] + 1900,
624              $ts[4] + 1, @ts[ 3, 2, 1, 0 ];
625
626            my $terms = {};
627            $terms->{blog_id} = $blog_id;
628            if ( $val->{type} =~
629                m/^(archive|individual|page|category|index|custom)$/ )
630            {
631                $terms->{name} = $val->{name};
632            }
633            else {
634                $terms->{type} = $val->{type};
635            }
636
637            # this should only return 1 template; we're searching
638            # within a given blog for a specific type of template (for
639            # "system" templates; or for a type + name, which should be
640            # unique for that blog.
641            my $tmpl = MT::Template->load($terms);
642            if ($tmpl) {
643
644                # check for default template text...
645                # if it is a default template, then outright replace it
646                my $text = $tmpl->text;
647                $text =~ s/\s+//g;
648
649                # generate sha1 of $text
650                my $digest = MT::Util::perl_sha1_digest_hex($text);
651                if ( !$dict->{ $val->{type} }{$orig_name}{$digest} ) {
652
653                    # if it has been customized, back it up to a new tmpl record
654                    my $backup = $tmpl->clone;
655                    delete $backup->{column_values}
656                      ->{id};    # make sure we don't overwrite original
657                    delete $backup->{changed_cols}->{id};
658                    $backup->name(
659                        $backup->name . ' (Backup from ' . $ts . ')' );
660                    if ( $backup->type !~
661                        m/^(archive|individual|page|category|index|custom)$/ )
662                    {
663                        $backup->type('custom')
664                          ;      # system templates can't be created
665                    }
666                    $backup->outfile('');
667                    $backup->linked_file( $tmpl->linked_file );
668                    $backup->identifier(undef);
669                    $backup->rebuild_me(0);
670                    $backup->build_dynamic(0);
671                    $backup->save;
672                    push @msg,
673                      $app->translate(
674'Refreshing template <strong>[_3]</strong> with <a href="?__mode=view&amp;blog_id=[_1]&amp;_type=template&amp;id=[_2]">backup</a>',
675                        $blog_id, $backup->id, $tmpl->name );
676                }
677                else {
678                    push @msg,
679                      $app->translate( "Refreshing template '[_1]'.",
680                        $tmpl->name );
681                }
682
683                # we found that the previous template had not been
684                # altered, so replace it with new default template...
685                $tmpl->text( $val->{text} );
686                $tmpl->identifier( $val->{identifier} );
687                $tmpl->type( $val->{type} )
688                  ; # fixes mismatch of types for cases like "archive" => "individual"
689                $tmpl->linked_file('');
690                $tmpl->save;
691            }
692            else {
693
694                # create this one...
695                my $tmpl = new MT::Template;
696                $tmpl->build_dynamic(0);
697                $tmpl->set_values(
698                    {
699                        text       => $val->{text},
700                        name       => $val->{name},
701                        type       => $val->{type},
702                        identifier => $val->{identifier},
703                        outfile    => $val->{outfile},
704                        rebuild_me => $val->{rebuild_me}
705                    }
706                );
707                $tmpl->blog_id($blog_id);
708                $tmpl->save
709                  or return $app->error(
710                        $app->translate("Error creating new template: ")
711                      . $tmpl->errstr );
712                push @msg,
713                  $app->translate( "Created template '[_1]'.", $tmpl->name );
714            }
715        }
716    }
717    my @msg_loop;
718    push @msg_loop, { message => $_ } foreach @msg;
719
720    $app->param('__mode', '');
721    $app->mode('');
722    $app->build_page( $plugin->load_tmpl('results.tmpl'),
723        { message_loop => \@msg_loop, return_url => $app->return_uri, plugin_name => $plugin->name } );
724}
725
726sub refresh_individual_templates {
727    my $plugin = shift;
728    my ($app) = @_;
729
730    require MT::Util;
731
732    my $perms = $app->{perms};
733    return $app->error(
734        $app->translate(
735            "Insufficient permissions for modifying templates for this weblog.")
736      )
737      unless $perms->can_edit_templates()
738      || $perms->can_administer_blog
739      || $app->{author}->is_superuser();
740
741    my $dict = default_dictionary();
742
743    my $tmpl_list = default_templates($app) or return;
744
745    my $trnames    = {};
746    my $tmpl_types = {};
747    my $tmpls      = {};
748    foreach my $tmpl (@$tmpl_list) {
749        $tmpl->{text} = $app->translate_templatized( $tmpl->{text} );
750        $trnames->{ $app->translate( $tmpl->{name} ) } = $tmpl->{name};
751        if ( $tmpl->{type} !~ m/^(archive|individual|page|category|index|custom)$/ )
752        {
753            $tmpl_types->{ $tmpl->{type} } = $tmpl;
754        }
755        else {
756            $tmpls->{ $tmpl->{type} }{ $tmpl->{name} } = $tmpl;
757        }
758    }
759
760    my $t = time;
761
762    my @msg;
763    my @id = $app->param('id');
764    require MT::Template;
765    foreach my $tmpl_id (@id) {
766        my $tmpl = MT::Template->load($tmpl_id);
767        next unless $tmpl;
768        my $blog_id = $tmpl->blog_id;
769
770        # FIXME: permission check -- for this blog_id
771
772        my @ts = MT::Util::offset_time_list( $t, $blog_id );
773        my $ts = sprintf "%04d-%02d-%02d %02d:%02d:%02d", $ts[5] + 1900,
774          $ts[4] + 1, @ts[ 3, 2, 1, 0 ];
775
776        my $orig_name = $trnames->{ $tmpl->name } || $tmpl->name;
777        my $val = $tmpl_types->{ $tmpl->type() }
778          || $tmpls->{ $tmpl->type() }{$orig_name};
779        if ( !$val ) {
780            push @msg,
781              $app->translate(
782"Skipping template '[_1]' since it appears to be a custom template.",
783                $tmpl->name
784              );
785            next;
786        }
787
788        my $text = $tmpl->text;
789        $text =~ s/\s+//g;
790
791        # generate sha1 of $text
792        my $digest = MT::Util::perl_sha1_digest_hex($text);
793        if ( !$dict->{ $tmpl->type }{$orig_name}{$digest} ) {
794
795            # if it has been customized, back it up to a new tmpl record
796            my $backup = $tmpl->clone;
797            delete $backup->{column_values}
798              ->{id};    # make sure we don't overwrite original
799            delete $backup->{changed_cols}->{id};
800            $backup->name( $backup->name . ' (Backup from ' . $ts . ')' );
801            if ( $backup->type !~
802                m/^(archive|individual|page|category|index|custom)$/ )
803            {
804                $backup->type('custom');    # system templates can't be created
805            }
806            $backup->outfile('');
807            $backup->linked_file( $tmpl->linked_file );
808            $backup->rebuild_me(0);
809            $backup->build_dynamic(0);
810            $backup->identifier(undef);
811            $backup->save;
812            push @msg,
813              $app->translate(
814'Refreshing template <strong>[_3]</strong> with <a href="?__mode=view&amp;blog_id=[_1]&amp;_type=template&amp;id=[_2]">backup</a>',
815                  $blog_id, $backup->id, $tmpl->name );
816        }
817        else {
818            push @msg,
819              $app->translate( "Refreshing template '[_1]'.", $tmpl->name );
820        }
821
822        # we found that the previous template had not been
823        # altered, so replace it with new default template...
824        $tmpl->text( $val->{text} );
825        $tmpl->identifier( $val->{identifier} );
826        $tmpl->linked_file('');
827        $tmpl->save;
828    }
829    my @msg_loop;
830    push @msg_loop, { message => $_ } foreach @msg;
831
832    $app->build_page( $plugin->load_tmpl('results.tmpl'),
833        { message_loop => \@msg_loop, return_url => $app->return_uri, plugin_name => $plugin->name } );
834}
835
8361;
Note: See TracBrowser for help on using the browser.