--- admin/install.php	Tue Jan 20 07:26:36 1970
+++ admin/install.php	Tue Jan 20 07:26:36 1970
@@ -20,7 +20,7 @@
 		return;
 	}
 	$charset_collate = '';
-	if ( $wpdb->supports_collation() ) {
+	if ( $wpdb->has_cap( 'collation' ) ) {
 		if ( ! empty($wpdb->charset) )
 			$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
 		if ( ! empty($wpdb->collate) )
--- config/panel.php	Tue Jan 20 07:26:36 1970
+++ config/panel.php	Tue Jan 20 07:26:36 1970
@@ -17,7 +17,7 @@
 	add_action('admin_menu',  array($this, 'add_menu'));
 	add_action('admin_init', array($this, 'add_comment_meta'));
 	add_filter('plugin_action_links', array($this, 'add_link'), 10, 2);
-	if ( $_GET['page'] == self::THEME_OPTIONS ) {
+	if ( @$_GET['page'] == self::THEME_OPTIONS ) {
 		remove_action('setup_theme', 'preview_theme');
 		add_action('setup_theme', array('KtaiThemes', 'preview_theme'));
 	}
@@ -263,8 +263,9 @@
 	$author = $theme_data['Author'];
 	$screenshot = $theme_data['Screenshot'];
 	$template_dir = $t->get('template_dir');
-	$theme_root =$theme_data['Theme Root'];
-	$theme_root_uri = $$theme_data['Theme Root URI'];
+	$stylesheet_dir = @$t->get('stylesheet_dir');
+	$theme_root = @$theme_data['Theme Root'];
+	$theme_root_uri = @$theme_data['Theme Root URI'];
 	$preview_link = esc_attr(get_option('home') . '/');
 	if ( is_ssl() ) {
 		$preview_link = str_replace( 'http://', 'https://', $preview_link );
--- inc/kses.php	Tue Jan 20 07:26:36 1970
+++ inc/kses.php	Tue Jan 20 07:26:36 1970
@@ -294,8 +294,8 @@
 
 		else {
 			# sanitize string from bad protocols 
-			if ('y' != $arreach['vless'] && 'uri' == $current['type']) { 
-				$arreach['value'] = self::kses_bad_protocol($arreach['value'], $allowed_protocols); 
+			if ('y' != $arreach['vless'] && 'uri' == @$current['type']) { 
+				$arreach['value'] = self::kses_bad_protocol($arreach['value'] /*, $allowed_protocols*/); 
 				$arreach['whole'] = sprintf('%s="%s"', $arreach['name'], $arreach['value']); 
 			} 
 
--- inc/redir.php	Tue Jan 20 07:26:36 1970
+++ inc/redir.php	Tue Jan 20 07:26:36 1970
@@ -44,7 +44,7 @@
 	if (! $this->base->verify_anon_nonce($nonce, 'redir_' . md5($this->url) . md5($_SERVER['HTTP_USER_AGENT']))) {
 		return;
 	}
-	$this->full_url = $this->url = clean_url($this->url);
+	$this->full_url = $this->url = esc_url($this->url);
 	if (preg_match('|^/|', $this->url)) {
 		$this->full_url = preg_replace('|^(https?://[^/]*)/.*$|', '$1', get_bloginfo('url')) . $this->url;
 	}
--- inc/shrinkage.php	Tue Jan 20 07:26:36 1970
+++ inc/shrinkage.php	Tue Jan 20 07:26:36 1970
@@ -93,7 +93,7 @@
 	}
 	$url_parts = parse_url($this->url);
 	$wpurl_parts = parse_url($this->wpurl);
-	$this->url_host = $url_parts['scheme'] . '://' . $url_parts['host'] . ($url_parts['port'] ? ':' . $url_parts['port'] : '');
+	$this->url_host = $url_parts['scheme'] . '://' . $url_parts['host'] . (@$url_parts['port'] ? ':' . @$url_parts['port'] : '');
 	if ( !$this->is_multisite ) { // single site
 		$uploads = wp_upload_dir();
 		$uploads_url = trailingslashit($uploads['baseurl']);
@@ -587,7 +587,7 @@
 		}
 		$replace .= ']';
 	} else {
-		$path = $thum_path = $thum_url = NULL;
+		$path = $thumb_path = $thumb_url = NULL;
 		foreach ( $this->self_regex as $index => $regex) {
 			$dir = $this->self_dir[$index];
 			if ( !preg_match($regex, $src) ) {
@@ -1080,7 +1080,7 @@
 			$footer = substr_replace($buffer, '', 0, $s[0][1]);
 			$buffer = substr_replace($buffer, '', $s[0][1]);
 		} else {
-			list($buffer, $footer) = preg_split('@</body@', $buffer, 2);
+			@list($buffer, $footer) = preg_split('@</body@', $buffer, 2);
 			$footer = '</body' . $footer;
 		}
 	}
--- inc/template-tags.php	Tue Jan 20 07:26:36 1970
+++ inc/template-tags.php	Tue Jan 20 07:26:36 1970
@@ -14,7 +14,7 @@
 	return attribute_escape($text);
 }
 function esc_url( $url, $protocols = null ) {
-	return clean_url( $url, $protocols, 'display' );
+	return esc_url( $url, $protocols, 'display' );
 }
 endif;
 
@@ -28,7 +28,7 @@
  */
 function _ks_parse_arg($func_get_args, $defaults = '') {
 	$r = array();
-	$arg = $func_get_args[0];
+	$arg = @$func_get_args[0];
 	if ( is_object($arg) ) {
 		$r = get_object_vars($arg);
 		if ( is_array($defaults) ) {
@@ -1192,7 +1192,7 @@
 	$output = '';
 	if ($paged > 1) {
 		$output = '<a href="' . 
-		KtaiStyle::strip_host(clean_url(_ks_quoted_remove_query_arg('kp', get_previous_posts_page_link()))) . 
+		KtaiStyle::strip_host(esc_url(_ks_quoted_remove_query_arg('kp', get_previous_posts_page_link()))) . 
 		'"' . ks_accesskey_html($r['accesskey']) . '>' .
 		 preg_replace('/&([^#])(?![a-z]{1,8};)/', '&amp;$1', $r['anchor']) .'</a>';
 	}
@@ -1232,7 +1232,7 @@
 	$output = '';
 	if (empty($paged) || $nextpage <= $r['max_pages']) {
 		$output = '<a href="' . 
-		KtaiStyle::strip_host(clean_url(_ks_quoted_remove_query_arg('kp', get_next_posts_page_link($r['max_pages'])))) . 
+		KtaiStyle::strip_host(esc_url(_ks_quoted_remove_query_arg('kp', get_next_posts_page_link($r['max_pages'])))) . 
 		'"' . ks_accesskey_html($r['accesskey']) . '>' . 
 		preg_replace('/&([^#])(?![a-z]{1,8};)/', '&amp;$1', $r['anchor']) .'</a>';
 	}
@@ -1345,7 +1345,7 @@
 	}
 	$output = '';
 	if ($paged - $r['num'] > 1) {
-		$output .= '<a href="' . KtaiStyle::strip_host(clean_url(get_pagenum_link(1))) . '">';
+		$output .= '<a href="' . KtaiStyle::strip_host(esc_url(get_pagenum_link(1))) . '">';
 		$output .= preg_replace('/&([^#])(?![a-z]{1,8};)/', '&amp;$1', $r['first']) .'</a>...';
 	}
 	for ($count = $paged - $r['num'] ; $count <= $paged + $r['num'] ; $count++) {
@@ -1354,17 +1354,17 @@
 		} elseif ($count > $max_pages) {
 			break;
 		} elseif ($count == $paged -1) {
-			$output .= ' <a href="' . KtaiStyle::strip_host(clean_url(get_pagenum_link($count))) . '"' . ks_accesskey_html($r['prev_key']) . '>'. $count .'</a>';
+			$output .= ' <a href="' . KtaiStyle::strip_host(esc_url(get_pagenum_link($count))) . '"' . ks_accesskey_html($r['prev_key']) . '>'. $count .'</a>';
 		} elseif ($count == $paged) {
 			$output .= " [$count]";
 		} elseif ($count == $paged +1) {
-			$output .= ' <a href="' . KtaiStyle::strip_host(clean_url(get_pagenum_link($count))) . '"' . ks_accesskey_html($r['next_key']) . '>'. $count .'</a>';
+			$output .= ' <a href="' . KtaiStyle::strip_host(esc_url(get_pagenum_link($count))) . '"' . ks_accesskey_html($r['next_key']) . '>'. $count .'</a>';
 		} else {
-			$output .= ' <a href="' . KtaiStyle::strip_host(clean_url(get_pagenum_link($count))) . '">'. $count .'</a>';
+			$output .= ' <a href="' . KtaiStyle::strip_host(esc_url(get_pagenum_link($count))) . '">'. $count .'</a>';
 		}
 	}
 	if ($paged + $r['num'] < $max_pages) {
-		$output .= '...<a href="' . KtaiStyle::strip_host(clean_url(get_pagenum_link($max_pages))) . '">';
+		$output .= '...<a href="' . KtaiStyle::strip_host(esc_url(get_pagenum_link($max_pages))) . '">';
 		$output .= preg_replace('/&([^#])(?![a-z]{1,8};)/', '&amp;$1', $r['last']) .'</a>';
 	}
 	if ($r['echo']) {
@@ -1968,7 +1968,7 @@
 	$color = $r['color'] ? (' color="' . $r['color'] . '"') : '';
 	foreach ($counts as $tag => $count) {
 		$tag_id = $tag_ids[$tag];
-		$tag_link = clean_url($tag_links[$tag]);
+		$tag_link = esc_url($tag_links[$tag]);
 		$tag = str_replace(' ', '&nbsp;', esc_attr( $tag ));
 		$a[] = '<a href="' . $tag_link . '"><font size="' . ($smallest + (($count - $min_count) * $font_step)) . '"' . $color . '>' . $tag . '</font></a>';
 	}
--- inc/theme.php	Tue Jan 20 07:26:36 1970
+++ inc/theme.php	Tue Jan 20 07:26:36 1970
@@ -168,7 +168,7 @@
 	}
 	$this->template_uri = $this->theme_root_uri . $this->theme_base . '/'; // trailing slash
 	
-	$this->theme_data = get_theme_data($this->template_dir . 'style.css');
+	$this->theme_data = @get_theme_data($this->template_dir . 'style.css');
 	foreach ( array('png', 'jpg', 'gif') as $ext) {
 		if (file_exists($this->template_dir . self::SCREENSHOT_BASENAME . '.' . $ext)) {
 			$this->theme_data['Screenshot'] = $this->template_uri . self::SCREENSHOT_BASENAME . '.' . $ext;
@@ -253,7 +253,7 @@
 	} elseif (is_attachment() && $template = $this->get_attachment_template()) {
 		remove_filter('the_content', 'prepend_attachment');
 		return $template;
-	} elseif (is_single() && $template = $this->query_template('single')) {
+	} elseif (is_single() && $template = $this->get_single_template()) {
 		return $template;
 	} elseif (is_page() && $template = $this->get_page_template()) {
 		return $template;
@@ -265,7 +265,7 @@
 		return $template;
 	} elseif (is_date() && $template = $this->query_template('date')) {
 		return $template;
-	} elseif (is_archive() && $template = $this->query_template('archive')) {
+	} elseif (is_archive() && $template = $this->get_archive_template()) {
 		return $template;
 	} elseif (is_paged() && $template = $this->query_template('paged')) {
 		return $template;
@@ -380,6 +380,23 @@
 /* ==================================================
  * @param	none
  * @return	string  $template
+ */
+private function get_archive_template() {
+	$post_type = get_post_type();
+	$templates = array();
+
+	if ( $post_type ) {
+		$templates[] = "archive-{$post_type}.php";
+	}
+	$templates[] = "archive.php";
+
+	$template = $this->locate_template($templates);
+	return apply_filters('archive_template', $template);
+}
+
+/* ==================================================
+ * @param	none
+ * @return	string  $template
  * based on get_tag_template() at wp-includes/theme.php of WP 2.3.1
  */
 private function get_tag_template() {
@@ -440,6 +457,24 @@
 
 /* ==================================================
  * @param	none
+ * @return	string
+ */
+private function get_single_template() {
+
+	$post_type = get_post_type();
+	$templates = array();
+
+	if ( $post_type ) {
+		$templates[] = "single-{$post_type}.php";
+	}
+	$templates[] = "single.php";
+
+	$template = $this->locate_template($templates);
+	return apply_filters('single_template', $template);
+}
+
+/* ==================================================
+ * @param	none
  * @return	string  $template
  * @since	0.70
  * based on get_attachment_template() at wp-includes/theme.php of WP 2.2.3
@@ -490,7 +525,7 @@
  */
 public static function installed() {
 	self::set_variables();
-	$theme_data = get_theme_data(self::$built_in_theme_root . self::DEFAULT_THEME . '/style.css');
+	$theme_data = @get_theme_data(self::$built_in_theme_root . self::DEFAULT_THEME . '/style.css');
 	$themes = array();
 	if (isset($theme_data['Name'])) {
 		$themes[self::DEFAULT_THEME] = $theme_data['Name'] . ' (' . $theme_data['Version'] . ')';
@@ -502,7 +537,7 @@
 			continue;
 		}
 		if (preg_match('!/([-_.+a-zA-Z0-9]+)/?$!', $d, $filename) && $filename[1] != self::DEFAULT_THEME) {
-			$theme_data = get_theme_data($d . '/style.css');
+			$theme_data = @get_theme_data($d . '/style.css');
 			$themes[$filename[1]] = $theme_data['Name'] . ' (' . $theme_data['Version'] . ')';
 		}
 	}
@@ -514,7 +549,7 @@
 			continue;
 		}
 		if ( preg_match('!/([-_.+a-zA-Z0-9]+)/?$!', $d, $filename) && !in_array($filename[1], $themes) ) {
-			$theme_data = get_theme_data($d . '/style.css');
+			$theme_data = @get_theme_data($d . '/style.css');
 			$themes[self::USER_THEMES_DIR . '/' . $filename[1]] = $theme_data['Name'] . ' (' . $theme_data['Version'] . ')';
 		}
 	}
--- ktai_style.php	Tue Jan 20 07:26:36 1970
+++ ktai_style.php	Tue Jan 20 07:26:36 1970
@@ -1,17 +1,16 @@
 <?php
 /*
-Plugin Name: Ktai Style
-Plugin URI: http://wordpress.org/extend/plugins/ktai-style/
+Plugin Name: Ktai Style Patched
 Version: 2.0.5
-Description: Provides lightweight pages and simple admin interfaces for mobile phones.
-Author: IKEDA Yuriko
+Description: Provides lightweight pages and simple admin interfaces for mobile phones. Temporal patched version.
+Author: IKEDA Yuriko, et al.
 Author URI: http://en.yuriko.net/
 Text Domain: ktai_style
 Domain Path: /lang
 */
 define ('KTAI_STYLE_VERSION', '2.0.5');
 
-/*  Copyright (c) 2007-2011 IKEDA Yuriko
+/*  Copyright (c) 2007-2011 IKEDA Yuriko, et al.
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; version 2 of the License.
