/var/www/wordpress/wp-admin/includes/admin.php
/var/www/wordpress/wp-admin/includes/bookmark.php
/var/www/wordpress/wp-admin/includes/class-ftp-pure.php
/var/www/wordpress/wp-admin/includes/class-ftp-sockets.php
/var/www/wordpress/wp-admin/includes/class-ftp.php
/var/www/wordpress/wp-admin/includes/class-pclzip.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-base.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-direct.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ftpsockets.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ssh2.php
/var/www/wordpress/wp-admin/includes/class-wp-importer.php
/var/www/wordpress/wp-admin/includes/class-wp-upgrader.php
/var/www/wordpress/wp-admin/includes/comment.php
/var/www/wordpress/wp-admin/includes/continents-cities.php
/var/www/wordpress/wp-admin/includes/dashboard.php
/var/www/wordpress/wp-admin/includes/deprecated.php
/var/www/wordpress/wp-admin/includes/export.php
/var/www/wordpress/wp-admin/includes/file.php
/var/www/wordpress/wp-admin/includes/image-edit.php
/var/www/wordpress/wp-admin/includes/image.php
/var/www/wordpress/wp-admin/includes/import.php
/var/www/wordpress/wp-admin/includes/manifest.php
/var/www/wordpress/wp-admin/includes/media.php
/var/www/wordpress/wp-admin/includes/meta-boxes.php
/var/www/wordpress/wp-admin/includes/misc.php
/var/www/wordpress/wp-admin/includes/ms-deprecated.php
/var/www/wordpress/wp-admin/includes/ms.php
/var/www/wordpress/wp-admin/includes/nav-menu.php
/var/www/wordpress/wp-admin/includes/plugin-install.php
/var/www/wordpress/wp-admin/includes/plugin.php
/var/www/wordpress/wp-admin/includes/post.php
/var/www/wordpress/wp-admin/includes/schema.php
/var/www/wordpress/wp-admin/includes/taxonomy.php
/var/www/wordpress/wp-admin/includes/template.php
/var/www/wordpress/wp-admin/includes/theme-install.php
/var/www/wordpress/wp-admin/includes/theme.php
/var/www/wordpress/wp-admin/includes/update-core.php
/var/www/wordpress/wp-admin/includes/update.php
/var/www/wordpress/wp-admin/includes/upgrade.php
/var/www/wordpress/wp-admin/includes/user.php
/var/www/wordpress/wp-admin/includes/widgets.php
/var/www/wordpress/wp-admin/js/revisions-js.php
/var/www/wordpress/wp-admin/maint/repair.php
/var/www/wordpress/wp-admin/admin-ajax.php
/var/www/wordpress/wp-admin/admin-footer.php
/var/www/wordpress/wp-admin/admin-functions.php
/var/www/wordpress/wp-admin/admin-header.php
/var/www/wordpress/wp-admin/admin-post.php
/var/www/wordpress/wp-admin/admin.php
/var/www/wordpress/wp-admin/async-upload.php
/var/www/wordpress/wp-admin/comment.php
/var/www/wordpress/wp-admin/custom-background.php
/var/www/wordpress/wp-admin/custom-header.php
/var/www/wordpress/wp-admin/edit-attachment-rows.php
/var/www/wordpress/wp-admin/edit-comments.php
/var/www/wordpress/wp-admin/edit-form-advanced.php
/var/www/wordpress/wp-admin/edit-form-comment.php
/var/www/wordpress/wp-admin/edit-link-categories.php
/var/www/wordpress/wp-admin/edit-link-category-form.php
/var/www/wordpress/wp-admin/edit-link-form.php
/var/www/wordpress/wp-admin/edit-post-rows.php
/var/www/wordpress/wp-admin/edit-tag-form.php
/var/www/wordpress/wp-admin/edit-tags.php
/var/www/wordpress/wp-admin/edit.php
/var/www/wordpress/wp-admin/export.php
/var/www/wordpress/wp-admin/gears-manifest.php
/var/www/wordpress/wp-admin/import.php
/var/www/wordpress/wp-admin/index-extra.php
/var/www/wordpress/wp-admin/index.php
/var/www/wordpress/wp-admin/install-helper.php
/var/www/wordpress/wp-admin/install.php
/var/www/wordpress/wp-admin/link-add.php
/var/www/wordpress/wp-admin/link-category.php
/var/www/wordpress/wp-admin/link-manager.php
/var/www/wordpress/wp-admin/link-parse-opml.php
/var/www/wordpress/wp-admin/link.php
/var/www/wordpress/wp-admin/load-scripts.php
/var/www/wordpress/wp-admin/load-styles.php
/var/www/wordpress/wp-admin/media-new.php
/var/www/wordpress/wp-admin/media-upload.php
/var/www/wordpress/wp-admin/media.php
/var/www/wordpress/wp-admin/menu-header.php
/var/www/wordpress/wp-admin/menu.php
/var/www/wordpress/wp-admin/moderation.php
/var/www/wordpress/wp-admin/ms-admin.php
/var/www/wordpress/wp-admin/ms-delete-site.php
/var/www/wordpress/wp-admin/ms-edit.php
/var/www/wordpress/wp-admin/ms-options.php
/var/www/wordpress/wp-admin/ms-sites.php
/var/www/wordpress/wp-admin/ms-themes.php
/var/www/wordpress/wp-admin/ms-upgrade-network.php
/var/www/wordpress/wp-admin/ms-users.php
/var/www/wordpress/wp-admin/my-sites.php
/var/www/wordpress/wp-admin/nav-menus.php
/var/www/wordpress/wp-admin/network.php
/var/www/wordpress/wp-admin/options-discussion.php
/var/www/wordpress/wp-admin/options-general.php
/var/www/wordpress/wp-admin/options-head.php
/var/www/wordpress/wp-admin/options-media.php
/var/www/wordpress/wp-admin/options-permalink.php
/var/www/wordpress/wp-admin/options-privacy.php
/var/www/wordpress/wp-admin/options-reading.php
/var/www/wordpress/wp-admin/options-writing.php
/var/www/wordpress/wp-admin/options.php
/var/www/wordpress/wp-admin/plugin-editor.php
/var/www/wordpress/wp-admin/plugin-install.php
/var/www/wordpress/wp-admin/plugins.php
/var/www/wordpress/wp-admin/post-new.php
/var/www/wordpress/wp-admin/post.php
/var/www/wordpress/wp-admin/press-this.php
/var/www/wordpress/wp-admin/profile.php
/var/www/wordpress/wp-admin/revision.php
/var/www/wordpress/wp-admin/setup-config.php
/var/www/wordpress/wp-admin/sidebar.php
/var/www/wordpress/wp-admin/theme-editor.php
/var/www/wordpress/wp-admin/theme-install.php
/var/www/wordpress/wp-admin/themes.php
/var/www/wordpress/wp-admin/tools.php
/var/www/wordpress/wp-admin/update-core.php
/var/www/wordpress/wp-admin/update.php
/var/www/wordpress/wp-admin/upgrade-functions.php
/var/www/wordpress/wp-admin/upgrade.php
/var/www/wordpress/wp-admin/upload.php
/var/www/wordpress/wp-admin/user-edit.php
/var/www/wordpress/wp-admin/user-new.php
/var/www/wordpress/wp-admin/users.php
/var/www/wordpress/wp-admin/widgets.php
/var/www/wordpress/wp-content/languages/ru_RU.php
/var/www/wordpress/wp-content/plugins/akismet/akismet.php
/var/www/wordpress/wp-content/plugins/rh/rh.php
/var/www/wordpress/wp-content/plugins/hello.php
/var/www/wordpress/wp-content/plugins/index.php
/var/www/wordpress/wp-content/themes/twentyten/404.php
/var/www/wordpress/wp-content/themes/twentyten/archive.php
/var/www/wordpress/wp-content/themes/twentyten/attachment.php
/var/www/wordpress/wp-content/themes/twentyten/author.php
/var/www/wordpress/wp-content/themes/twentyten/category.php
/var/www/wordpress/wp-content/themes/twentyten/comments.php
/var/www/wordpress/wp-content/themes/twentyten/footer.php
/var/www/wordpress/wp-content/themes/twentyten/functions.php
/var/www/wordpress/wp-content/themes/twentyten/header.php
/var/www/wordpress/wp-content/themes/twentyten/index.php
/var/www/wordpress/wp-content/themes/twentyten/loop.php
/var/www/wordpress/wp-content/themes/twentyten/onecolumn-page.php
/var/www/wordpress/wp-content/themes/twentyten/page.php
/var/www/wordpress/wp-content/themes/twentyten/search.php
/var/www/wordpress/wp-content/themes/twentyten/sidebar-footer.php
/var/www/wordpress/wp-content/themes/twentyten/sidebar.php
/var/www/wordpress/wp-content/themes/twentyten/single.php
/var/www/wordpress/wp-content/themes/twentyten/tag.php
/var/www/wordpress/wp-content/themes/index.php
/var/www/wordpress/wp-content/index.php
/var/www/wordpress/wp-includes/js/tinymce/langs/wp-langs.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/config.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/rpc.php
/var/www/wordpress/wp-includes/js/tinymce/wp-mce-help.php
/var/www/wordpress/wp-includes/js/tinymce/wp-tinymce.php
/var/www/wordpress/wp-includes/pomo/entry.php
/var/www/wordpress/wp-includes/pomo/mo.php
/var/www/wordpress/wp-includes/pomo/po.php
/var/www/wordpress/wp-includes/pomo/streams.php
/var/www/wordpress/wp-includes/pomo/translations.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/native.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/shell.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/string.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/xdiff.php
/var/www/wordpress/wp-includes/Text/Diff/Renderer/inline.php
/var/www/wordpress/wp-includes/Text/Diff/Renderer.php
/var/www/wordpress/wp-includes/Text/Diff.php
/var/www/wordpress/wp-includes/theme-compat/comments-popup.php
/var/www/wordpress/wp-includes/theme-compat/comments.php
/var/www/wordpress/wp-includes/theme-compat/footer.php
/var/www/wordpress/wp-includes/theme-compat/header.php
/var/www/wordpress/wp-includes/theme-compat/sidebar.php
/var/www/wordpress/wp-includes/atomlib.php
/var/www/wordpress/wp-includes/author-template.php
/var/www/wordpress/wp-includes/bookmark-template.php
/var/www/wordpress/wp-includes/bookmark.php
/var/www/wordpress/wp-includes/cache.php
/var/www/wordpress/wp-includes/canonical.php
/var/www/wordpress/wp-includes/capabilities.php
/var/www/wordpress/wp-includes/category-template.php
/var/www/wordpress/wp-includes/category.php
/var/www/wordpress/wp-includes/class-feed.php
/var/www/wordpress/wp-includes/class-http.php
/var/www/wordpress/wp-includes/class-IXR.php
/var/www/wordpress/wp-includes/class-json.php
/var/www/wordpress/wp-includes/class-oembed.php
/var/www/wordpress/wp-includes/class-phpass.php
/var/www/wordpress/wp-includes/class-phpmailer.php
/var/www/wordpress/wp-includes/class-pop3.php
/var/www/wordpress/wp-includes/class-simplepie.php
/var/www/wordpress/wp-includes/class-smtp.php
/var/www/wordpress/wp-includes/class-snoopy.php
/var/www/wordpress/wp-includes/class.wp-dependencies.php
/var/www/wordpress/wp-includes/class.wp-scripts.php
/var/www/wordpress/wp-includes/class.wp-styles.php
/var/www/wordpress/wp-includes/classes.php
/var/www/wordpress/wp-includes/comment-template.php
/var/www/wordpress/wp-includes/comment.php
/var/www/wordpress/wp-includes/compat.php
/var/www/wordpress/wp-includes/cron.php
/var/www/wordpress/wp-includes/default-constants.php
/var/www/wordpress/wp-includes/default-embeds.php
/var/www/wordpress/wp-includes/default-filters.php
/var/www/wordpress/wp-includes/default-widgets.php
/var/www/wordpress/wp-includes/deprecated.php
/var/www/wordpress/wp-includes/feed-atom-comments.php
/var/www/wordpress/wp-includes/feed-atom.php
/var/www/wordpress/wp-includes/feed-rdf.php
/var/www/wordpress/wp-includes/feed-rss.php
/var/www/wordpress/wp-includes/feed-rss2-comments.php
/var/www/wordpress/wp-includes/feed-rss2.php
/var/www/wordpress/wp-includes/feed.php
/var/www/wordpress/wp-includes/formatting.php
/var/www/wordpress/wp-includes/functions.php
/var/www/wordpress/wp-includes/functions.wp-scripts.php
/var/www/wordpress/wp-includes/functions.wp-styles.php
/var/www/wordpress/wp-includes/general-template.php
/var/www/wordpress/wp-includes/http.php
/var/www/wordpress/wp-includes/kses.php
/var/www/wordpress/wp-includes/l10n.php
/var/www/wordpress/wp-includes/link-template.php
/var/www/wordpress/wp-includes/load.php
/var/www/wordpress/wp-includes/locale.php
/var/www/wordpress/wp-includes/media.php
/var/www/wordpress/wp-includes/meta.php
/var/www/wordpress/wp-includes/ms-blogs.php
/var/www/wordpress/wp-includes/ms-default-constants.php
/var/www/wordpress/wp-includes/ms-default-filters.php
/var/www/wordpress/wp-includes/ms-deprecated.php
/var/www/wordpress/wp-includes/ms-files.php
/var/www/wordpress/wp-includes/ms-functions.php
/var/www/wordpress/wp-includes/ms-load.php
/var/www/wordpress/wp-includes/ms-settings.php
/var/www/wordpress/wp-includes/nav-menu-template.php
/var/www/wordpress/wp-includes/nav-menu.php
/var/www/wordpress/wp-includes/pluggable-deprecated.php
/var/www/wordpress/wp-includes/pluggable.php
/var/www/wordpress/wp-includes/plugin.php
/var/www/wordpress/wp-includes/post-template.php
/var/www/wordpress/wp-includes/post-thumbnail-template.php
/var/www/wordpress/wp-includes/post.php
/var/www/wordpress/wp-includes/query.php
/var/www/wordpress/wp-includes/registration-functions.php
/var/www/wordpress/wp-includes/registration.php
/var/www/wordpress/wp-includes/rewrite.php
/var/www/wordpress/wp-includes/rss-functions.php
/var/www/wordpress/wp-includes/rss.php
/var/www/wordpress/wp-includes/script-loader.php
/var/www/wordpress/wp-includes/shortcodes.php
/var/www/wordpress/wp-includes/taxonomy.php
/var/www/wordpress/wp-includes/template-loader.php
/var/www/wordpress/wp-includes/theme.php
/var/www/wordpress/wp-includes/update.php
#CodeDescriptions
1<?php
2/**
3 * A simple set of functions to check our version 1.0 update service.
4 *
5 * @package WordPress
6 * @since 2.3.0
7 */
8
9/**
10 * Check WordPress version against the newest version.
11 *
12 * The WordPress version, PHP version, and Locale is sent. Checks against the
13 * WordPress server at api.wordpress.org server. Will only check if WordPress
14 * isn't installing.
15 *
16 * @package WordPress
17 * @since 2.3.0
18 * @uses $wp_version Used to check against the newest WordPress version.
19 *
20 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
21 */
22function wp_version_check() {
23 if ( defined('WP_INSTALLING') )
24 return;
25
26 global $wp_version, $wpdb, $wp_local_package;
27 $php_version = phpversion();
28
29 $current = get_site_transient( 'update_core' );
30 if ( ! is_object($current) ) {
31 $current = new stdClass;
32 $current->updates = array();
33 $current->version_checked = $wp_version;
34 }
35
36 $locale = apply_filters( 'core_version_check_locale', get_locale() );
37
38 // Update last_checked for current to prevent multiple blocking requests if request hangs
39 $current->last_checked = time();
40 set_site_transient( 'update_core', $current );
41
42 if ( method_exists( $wpdb, 'db_version' ) )
43 $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version());
44 else
45 $mysql_version = 'N/A';
46
47 $num_blogs = 1;
48 $wp_install = home_url( '/' );
49 $multisite_enabled = 0;
50 $user_count = count_users( );
51 if ( is_multisite( ) ) {
52 $num_blogs = get_blog_count( );
53 $wp_install = network_site_url( );
54 $multisite_enabled = 1;
55 }
56
57 $local_package = isset( $wp_local_package )? $wp_local_package : '';
58 $url = "http://api.wordpress.org/core/version-check/1.5/?version=$wp_version&php=$php_version&locale=$locale&mysql=$mysql_version&local_package=$local_package&blogs=$num_blogs&users={$user_count['total_users']}&multisite_enabled=$multisite_enabled";
59
60 $options = array(
61 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
62 'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
63 'headers' => array(
64 'wp_install' => $wp_install,
65 'wp_blog' => home_url( '/' )
66 )
67 );
68
69 $response = wp_remote_get($url, $options);
70
71 if ( is_wp_error( $response ) )
72 return false;
73
74 if ( 200 != $response['response']['code'] )
75 return false;
76
77 $body = trim( $response['body'] );
78 $body = str_replace(array("\r\n", "\r"), "\n", $body);
79 $new_options = array();
80 foreach ( explode( "\n\n", $body ) as $entry ) {
81 $returns = explode("\n", $entry);
82 $new_option = new stdClass();
83 $new_option->response = esc_attr( $returns[0] );
84 if ( isset( $returns[1] ) )
85 $new_option->url = esc_url( $returns[1] );
86 if ( isset( $returns[2] ) )
87 $new_option->package = esc_url( $returns[2] );
88 if ( isset( $returns[3] ) )
89 $new_option->current = esc_attr( $returns[3] );
90 if ( isset( $returns[4] ) )
91 $new_option->locale = esc_attr( $returns[4] );
92 if ( isset( $returns[5] ) )
93 $new_option->php_version = esc_attr( $returns[5] );
94 if ( isset( $returns[6] ) )
95 $new_option->mysql_version = esc_attr( $returns[6] );
96 $new_options[] = $new_option;
97 }
98
99 $updates = new stdClass();
100 $updates->updates = $new_options;
101 $updates->last_checked = time();
102 $updates->version_checked = $wp_version;
103 set_site_transient( 'update_core', $updates);
104}
105
106/**
107 * Check plugin versions against the latest versions hosted on WordPress.org.
108 *
109 * The WordPress version, PHP version, and Locale is sent along with a list of
110 * all plugins installed. Checks against the WordPress server at
111 * api.wordpress.org. Will only check if WordPress isn't installing.
112 *
113 * @package WordPress
114 * @since 2.3.0
115 * @uses $wp_version Used to notidy the WordPress version.
116 *
117 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
118 */
119function wp_update_plugins() {
120 global $wp_version;
121
122 if ( defined('WP_INSTALLING') )
123 return false;
124
125 // If running blog-side, bail unless we've not checked in the last 12 hours
126 if ( !function_exists( 'get_plugins' ) )
127 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
128
129 $plugins = get_plugins();
130 $active = get_option( 'active_plugins', array() );
131 $current = get_site_transient( 'update_plugins' );
132 if ( ! is_object($current) )
133 $current = new stdClass;
134
135 $new_option = new stdClass;
136 $new_option->last_checked = time();
137 $timeout = 'load-plugins.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
138 $time_not_changed = isset( $current->last_checked ) && $timeout > ( time() - $current->last_checked );
139
140 $plugin_changed = false;
141 foreach ( $plugins as $file => $p ) {
142 $new_option->checked[ $file ] = $p['Version'];//Arbitrary file disclosing
143
144 if ( !isset( $current->checked[ $file ] ) || strval($current->checked[ $file ]) !== strval($p['Version']) )
145 $plugin_changed = true;
146 }
147
148 if ( isset ( $current->response ) && is_array( $current->response ) ) {
149 foreach ( $current->response as $plugin_file => $update_details ) {
150 if ( ! isset($plugins[ $plugin_file ]) ) {
151 $plugin_changed = true;
152 break;
153 }
154 }
155 }
156
157 // Bail if we've checked in the last 12 hours and if nothing has changed
158 if ( $time_not_changed && !$plugin_changed )
159 return false;
160
161 // Update last_checked for current to prevent multiple blocking requests if request hangs
162 $current->last_checked = time();
163 set_site_transient( 'update_plugins', $current );
164
165 $to_send = (object) compact('plugins', 'active');
166
167 $options = array(
168 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
169 'body' => array( 'plugins' => serialize( $to_send ) ),
170 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
171 );
172
173 $raw_response = wp_remote_post('http://api.wordpress.org/plugins/update-check/1.0/', $options);
174
175 if ( is_wp_error( $raw_response ) )
176 return false;
177
178 if ( 200 != $raw_response['response']['code'] )
179 return false;
180
181 $response = unserialize( $raw_response['body'] );//Possible Control Flow
182
183 if ( false !== $response )
184 $new_option->response = $response;
185 else
186 $new_option->response = array();
187
188 set_site_transient( 'update_plugins', $new_option );
189}
190
191/**
192 * Check theme versions against the latest versions hosted on WordPress.org.
193 *
194 * A list of all themes installed in sent to WP. Checks against the
195 * WordPress server at api.wordpress.org. Will only check if WordPress isn't
196 * installing.
197 *
198 * @package WordPress
199 * @since 2.7.0
200 * @uses $wp_version Used to notidy the WordPress version.
201 *
202 * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
203 */
204function wp_update_themes( ) {
205 global $wp_version;
206
207 if ( defined( 'WP_INSTALLING' ) )
208 return false;
209
210 if ( !function_exists( 'get_themes' ) )
211 require_once( ABSPATH . 'wp-includes/theme.php' );
212
213 $installed_themes = get_themes( );
214 $last_update = get_site_transient( 'update_themes' );
215 if ( ! is_object($last_update) )
216 $last_update = new stdClass;
217
218 $timeout = 'load-themes.php' == current_filter() ? 3600 : 43200; //Check for updated every 60 minutes if hitting the themes page, Else, check every 12 hours
219 $time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time( ) - $last_update->last_checked );
220
221 $themes = array();
222 $checked = array();
223 $exclude_fields = array('Template Files', 'Stylesheet Files', 'Status', 'Theme Root', 'Theme Root URI', 'Template Dir', 'Stylesheet Dir', 'Description', 'Tags', 'Screenshot');
224
225 // Put slug of current theme into request.
226 $themes['current_theme'] = get_option( 'stylesheet' );
227
228 foreach ( (array) $installed_themes as $theme_title => $theme ) {
229 $themes[$theme['Stylesheet']] = array();
230 $checked[$theme['Stylesheet']] = $theme['Version'];
231
232 $themes[$theme['Stylesheet']]['Name'] = $theme['Name'];
233 $themes[$theme['Stylesheet']]['Version'] = $theme['Version'];
234
235 foreach ( (array) $theme as $key => $value ) {
236 if ( !in_array($key, $exclude_fields) )
237 $themes[$theme['Stylesheet']][$key] = $value;
238 }
239 }
240
241 $theme_changed = false;
242 foreach ( $checked as $slug => $v ) {
243 $update_request->checked[ $slug ] = $v;
244
245 if ( !isset( $last_update->checked[ $slug ] ) || strval($last_update->checked[ $slug ]) !== strval($v) )
246 $theme_changed = true;
247 }
248
249 if ( isset ( $last_update->response ) && is_array( $last_update->response ) ) {
250 foreach ( $last_update->response as $slug => $update_details ) {
251 if ( ! isset($checked[ $slug ]) ) {
252 $theme_changed = true;
253 break;
254 }
255 }
256 }
257
258 if ( $time_not_changed && !$theme_changed )
259 return false;
260
261 // Update last_checked for current to prevent multiple blocking requests if request hangs
262 $last_update->last_checked = time();
263 set_site_transient( 'update_themes', $last_update );
264
265 $options = array(
266 'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3),
267 'body' => array( 'themes' => serialize( $themes ) ),
268 'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo( 'url' )
269 );
270
271 $raw_response = wp_remote_post( 'http://api.wordpress.org/themes/update-check/1.0/', $options );
272
273 if ( is_wp_error( $raw_response ) )
274 return false;
275
276 if ( 200 != $raw_response['response']['code'] )
277 return false;
278
279 $new_update = new stdClass;
280 $new_update->last_checked = time( );
281 $response = unserialize( $raw_response['body'] );//Possible Control Flow
282 if ( $response ) {
283 $new_update->checked = $checked;
284 $new_update->response = $response;
285 }
286
287 set_site_transient( 'update_themes', $new_update );
288}
289
290function _maybe_update_core() {
291 global $wp_version;
292
293 $current = get_site_transient( 'update_core' );
294
295 if ( isset( $current->last_checked ) &&
296 43200 > ( time() - $current->last_checked ) &&
297 isset( $current->version_checked ) &&
298 $current->version_checked == $wp_version )
299 return;
300
301 wp_version_check();
302}
303/**
304 * Check the last time plugins were run before checking plugin versions.
305 *
306 * This might have been backported to WordPress 2.6.1 for performance reasons.
307 * This is used for the wp-admin to check only so often instead of every page
308 * load.
309 *
310 * @since 2.7.0
311 * @access private
312 */
313function _maybe_update_plugins() {
314 $current = get_site_transient( 'update_plugins' );
315 if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) )
316 return;
317 wp_update_plugins();
318}
319
320/**
321 * Check themes versions only after a duration of time.
322 *
323 * This is for performance reasons to make sure that on the theme version
324 * checker is not run on every page load.
325 *
326 * @since 2.7.0
327 * @access private
328 */
329function _maybe_update_themes( ) {
330 $current = get_site_transient( 'update_themes' );
331 if ( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) )
332 return;
333
334 wp_update_themes();
335}
336
337add_action( 'admin_init', '_maybe_update_core' );
338add_action( 'wp_version_check', 'wp_version_check' );
339
340add_action( 'load-plugins.php', 'wp_update_plugins' );
341add_action( 'load-update.php', 'wp_update_plugins' );
342add_action( 'load-update-core.php', 'wp_update_plugins' );
343add_action( 'admin_init', '_maybe_update_plugins' );
344add_action( 'wp_update_plugins', 'wp_update_plugins' );
345
346add_action( 'load-themes.php', 'wp_update_themes' );
347add_action( 'load-update.php', 'wp_update_themes' );
348add_action( 'load-update-core.php', 'wp_update_themes' );
349add_action( 'admin_init', '_maybe_update_themes' );
350add_action( 'wp_update_themes', 'wp_update_themes' );
351
352if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') )
353 wp_schedule_event(time(), 'twicedaily', 'wp_version_check');
354
355if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )
356 wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins');
357
358if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
359 wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
360
361?>
362
/var/www/wordpress/wp-includes/user.php
/var/www/wordpress/wp-includes/vars.php
/var/www/wordpress/wp-includes/version.php
/var/www/wordpress/wp-includes/widgets.php
/var/www/wordpress/wp-includes/wp-db.php
/var/www/wordpress/wp-includes/wp-diff.php
/var/www/wordpress/index.php
/var/www/wordpress/wp-activate.php
/var/www/wordpress/wp-app.php
/var/www/wordpress/wp-atom.php
/var/www/wordpress/wp-blog-header.php
/var/www/wordpress/wp-comments-post.php
/var/www/wordpress/wp-commentsrss2.php
/var/www/wordpress/wp-config-sample.php
/var/www/wordpress/wp-cron.php
/var/www/wordpress/wp-feed.php
/var/www/wordpress/wp-links-opml.php
/var/www/wordpress/wp-load.php
/var/www/wordpress/wp-login.php
/var/www/wordpress/wp-mail.php
/var/www/wordpress/wp-pass.php
/var/www/wordpress/wp-rdf.php
/var/www/wordpress/wp-register.php
/var/www/wordpress/wp-rss.php
/var/www/wordpress/wp-rss2.php
/var/www/wordpress/wp-settings.php
/var/www/wordpress/wp-signup.php
/var/www/wordpress/wp-trackback.php
/var/www/wordpress/xmlrpc.php