Changeset 3275878
- Timestamp:
- 04/17/2025 01:41:36 PM (10 months ago)
- Location:
- theme-changer
- Files:
-
- 3 added
- 2 edited
-
tags/1.4 (added)
-
tags/1.4/readme.txt (added)
-
tags/1.4/theme-changer.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/theme-changer.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
theme-changer/trunk/readme.txt
r1688120 r3275878 3 3 Tags: theme,change,get,parameter,demo 4 4 Requires at least: 3.0 5 Tested up to: 4.86 Stable tag: 1. 35 Tested up to: 6.8 6 Stable tag: 1.4 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 39 39 = 1.3 = 40 40 * Fixed a problem where the theme returns to the original when transitioning to the lower page. Once the password matched, the modified theme was applied even to the lower page. 41 42 = 1.4 = 43 * Cross-site scripting vulnerability response. -
theme-changer/trunk/theme-changer.php
r1688120 r3275878 4 4 Plugin URI: http://www.elegants.biz/theme-changer.php 5 5 Description: Easy theme change in the get parameter. this to be a per-session only change, and one that everyone (all visitors) can use. I just enter the following URL. It's easy. e.g. http://wordpress_install_domain/?theme_changer=theme_folder_name 6 Version: 1. 36 Version: 1.4 7 7 Author: momen2009 8 Author URI: http://www.elegants.biz/9 8 License: GPLv2 or later 10 9 */ 11 10 12 /* Copyright 20 17 木綿の優雅な一日(email : [email protected])11 /* Copyright 2025 momen2009 (email : [email protected]) 13 12 14 13 This program is free software; you can redistribute it and/or modify … … 43 42 global $theme_changer_theme; 44 43 $theme_changer_password = get_option("theme_changer_password"); 44 45 $theme_changer = ""; 45 46 if($theme_changer_password != false){ 46 47 $now_theme = wp_get_theme(); … … 50 51 if($_SESSION["theme_changer_password"] != $theme_changer_password) return; 51 52 }else{ 52 if($theme_changer_password != $wpdb->escape($_GET["theme_changer_password"])){ 53 if(!isset($_GET["theme_changer_password"])) return; 54 if($theme_changer_password != sanitize_text_field(wp_unslash($_GET["theme_changer_password"]))){ 53 55 return; 54 56 }else{ … … 58 60 } 59 61 60 $theme_changer = $wpdb->escape($_GET["theme_changer"]); 62 if(isset($_GET["theme_changer"])){ 63 $theme_changer = sanitize_text_field(wp_unslash($wpdb->escape($_GET["theme_changer"]))); 64 } 61 65 if(isset($theme_changer) && $theme_changer != ""){ 62 $theme_changer = $wpdb->escape($_GET["theme_changer"]); 66 63 67 }elseif(isset($_SESSION["theme_changer"])){ 64 $theme_changer = $_SESSION["theme_changer"];68 $theme_changer = sanitize_text_field($_SESSION["theme_changer"]); 65 69 } 66 70 if($value = exist_search_theme($theme_changer)){ … … 71 75 72 76 function exist_search_theme($stylesheet){ 73 foreach( get_themes() as $value){77 foreach(wp_get_themes() as $value){ 74 78 if($value->get_stylesheet() == $stylesheet) return $value; 75 79 } … … 108 112 function theme_changer_footer() { 109 113 global $theme_changer_theme; 110 $output .= "<style>\r\n#theme_changer{z-index:1000 !important;position:fixed;padding:10px;bottom:10px;left:10px;opacity:0.2;}#theme_changer label {color: #333 !important;display: block !important;font-weight: 800 !important;margin-bottom: 0.5em !important;font-family: 'Hiragino Kaku Gothic Pro', Meiryo, sans-serif !important;font-size: 16px !important;}#theme_changer select {font-weight:normal !important;font-size: 16px !important;color: #333 !important;border: 1px solid #bbb !important;-webkit-border-radius: 3px !important;border-radius: 3px !important;height: 3em !important;max-width: 100% !important;}#theme_changer p {font-size: 9px;}</style><script>jQuery(document).ready(function(){jQuery('#theme_changer select').change(function() {if (jQuery(this).val() != '') {"; 114 115 $output = "<style>\r\n#theme_changer{z-index:1000 !important;position:fixed;padding:10px;bottom:10px;left:10px;opacity:0.2;}#theme_changer label {color: #333 !important;display: block !important;font-weight: 800 !important;margin-bottom: 0.5em !important;font-family: 'Hiragino Kaku Gothic Pro', Meiryo, sans-serif !important;font-size: 16px !important;}#theme_changer select {font-weight:normal !important;font-size: 16px !important;color: #333 !important;border: 1px solid #bbb !important;-webkit-border-radius: 3px !important;border-radius: 3px !important;height: 3em !important;max-width: 100% !important;}#theme_changer p {font-size: 9px;}</style><script>jQuery(document).ready(function(){jQuery('#theme_changer select').change(function() {if (jQuery(this).val() != '') {"; 111 116 $output .= "var kvp2; kvp2 = insertParameter(document.location.search.substr(1).split('&'),'theme_changer',jQuery(this).val());"; 112 $theme_changer_password = get_option("theme_changer_password");117 $theme_changer_password = sanitize_text_field(wp_unslash(get_option("theme_changer_password"))); 113 118 if($theme_changer_password != false){ 114 119 $output .= "kvp2 = insertParameter(kvp2.split('&'),'theme_changer_password','" . $theme_changer_password . "');"; … … 121 126 foreach(wp_get_themes() as $value){ 122 127 $output .= "<option value=\""; 123 $output .= $value -> get_stylesheet();128 $output .= sanitize_text_field(wp_unslash($value -> get_stylesheet())); 124 129 $output .= "\""; 125 130 if($value -> get_stylesheet() == $theme_changer_theme){ … … 127 132 } 128 133 $output .= ">"; 129 $output .= $value -> Name;134 $output .= sanitize_text_field(wp_unslash($value -> Name)); 130 135 $output .= "</option>"; 131 136 } 132 137 $output .= "<select><p>This will only be displayed if you are logged in.</p></div>');</script>"; 133 echo $output;138 _e($output); 134 139 } 135 140 … … 142 147 function theme_changer_options() { 143 148 if ( !current_user_can( 'manage_options' ) ) { 144 wp_die( __( 'You do not have sufficient permissions to access this page.') );149 wp_die( esc_html(__( 'You do not have sufficient permissions to access this page.' )) ); 145 150 } 146 151 147 152 if (isset($_POST['theme_changer_password'])) { 148 update_option('theme_changer_password', wp_unslash($_POST['theme_changer_password']));153 update_option('theme_changer_password', sanitize_text_field(wp_unslash($_POST['theme_changer_password']))); 149 154 } 150 155 ?> … … 168 173 <?php 169 174 } 175 176 function theme_changer_files() { 177 wp_enqueue_script('jquery'); 178 } 179 add_action( 'wp_enqueue_scripts', 'theme_changer_files' ); 170 180 ?>
Note: See TracChangeset
for help on using the changeset viewer.