Changeset 2765122
- Timestamp:
- 08/02/2022 11:25:01 AM (3 years ago)
- Location:
- ts-comfort-database
- Files:
-
- 40 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ts-comfort-database/trunk/classes/tsinf_comfort_db.class.php
r2764341 r2765122 96 96 97 97 add_filter('admin_body_class', array('TS_INF_COMFORT_DB', 'modify_admin_body_classes')); 98 add_filter('admin_title', array('TS_INF_COMFORT_DB', 'modify_admin_title'), 10, 2); 98 99 99 100 if(!file_exists(TS_INF_COMFORT_DB_UPLOAD_DIR)) … … 178 179 return "$classes tscdb_skin_" . self::$skin; 179 180 } 181 182 /** 183 * Change Admin Page Title 184 * 185 * @param String $page_title Modified Page Title 186 * @param String $title Original Page Title 187 * @return String Modified Page Title 188 */ 189 public static function modify_admin_title($page_title, $title) 190 { 191 if(isset($_GET['page']) && $_GET['page'] === 'tscomfortdb-mainpage') 192 { 193 if(isset($_GET['table'])) 194 { 195 $tablename = htmlentities(strip_tags($_GET['table']), ENT_QUOTES); 196 197 if(isset($_GET['action']) && $_GET['action'] === 'search') { 198 // SEARCH 199 if(isset($_GET['identifier'])) 200 { 201 $prepend_table = __("Search Results for Table:", "tsinf_comfortdb_plugin_textdomain") . " " . htmlentities(strip_tags($_GET['table']), ENT_QUOTES); 202 $new_title = $prepend_table . " - " . $page_title; 203 $page_title = $new_title; 204 } else { 205 $prepend_table = htmlentities(strip_tags($_GET['table']), ENT_QUOTES); 206 $new_title = $prepend_table . " - " . $page_title; 207 $page_title = $new_title; 208 } 209 } else if(isset($_GET['identifier'])) 210 { 211 $prepend_table = __("Edit Table:", "tsinf_comfortdb_plugin_textdomain") . " " . htmlentities(strip_tags($_GET['table']), ENT_QUOTES); 212 $new_title = $prepend_table . " - " . $page_title; 213 $page_title = $new_title; 214 } else if(isset($_GET['action']) && $_GET['action'] === 'new') { 215 // CREATE NEW DATASET 216 $prepend_table = __("New Dataset:", "tsinf_comfortdb_plugin_textdomain"); 217 $new_title = $prepend_table . " - " . $page_title; 218 $page_title = $new_title; 219 } else { 220 // TABLE CONTENT 221 $prepend_table = htmlentities(strip_tags($_GET['table']), ENT_QUOTES); 222 $new_title = $prepend_table . " - " . $page_title; 223 $page_title = $new_title; 224 } 225 } else if(isset($_GET['tsinf_comfortdb_full_text_search']) && isset($_GET['table_identifier'])) { 226 $prepend_table = __("Full Text Search Results for Table:", "tsinf_comfortdb_plugin_textdomain") . " " . htmlentities(strip_tags($_GET['table_identifier']), ENT_QUOTES); 227 $new_title = $prepend_table . " - " . $page_title; 228 $page_title = $new_title; 229 } else if(isset($_GET['tsinf_comfortdb_full_text_search'])) { 230 if(check_admin_referer( 'action_tsinf_comfortdb_plugin_full_text_search_submit', '_wpnonce' )) 231 { 232 $prepend_table = __("Full Text Search Results", "tsinf_comfortdb_plugin_textdomain"); 233 $new_title = $prepend_table . " - " . $page_title; 234 $page_title = $new_title; 235 } 236 } else { 237 $prepend_table = __("Table Overview", "tsinf_comfortdb_plugin_textdomain"); 238 $new_title = $prepend_table . " - " . $page_title; 239 $page_title = $new_title; 240 } 241 } 242 243 return $page_title; 244 } 180 245 181 246 /** … … 441 506 } 442 507 508 $sql_error_returned = (bool) false; 443 509 if(isset($result_array['sql'])) 444 510 { … … 448 514 if(isset($result_array['success']) && $result_array['success'] === true) 449 515 { 516 $sql_error_returned = (bool) false; 517 450 518 $result_message_class = 'success'; 451 519 $result_message_success_additional_information = '<span class="tsinf_comfortdb_plugin_result_additional_information">' . __('Affected Rows','tsinf_comfortdb_plugin_textdomain') . ': ' . $result_array['affected_rows'] . '</span>'; 452 520 } else { 521 $sql_error_returned = (bool) true; 522 453 523 $result_message_class = 'fail'; 454 524 if(isset($result_array['error_message']) && strlen($result_array['error_message']) > 0) … … 473 543 474 544 $html .= $error_message; 475 545 476 546 $identifier_string = self::helper_decode_identifier_string($identifiers); 477 547 … … 522 592 } 523 593 594 $col_value = ""; 595 if($sql_error_returned === true && isset($_POST['tsinf_comfortdb_plugin_edit_dataset'][$col_name]) && is_string($_POST['tsinf_comfortdb_plugin_edit_dataset'][$col_name]) && strlen($_POST['tsinf_comfortdb_plugin_edit_dataset'][$col_name]) > 0) 596 { 597 $col_value = $_POST['tsinf_comfortdb_plugin_edit_dataset'][$col_name]; 598 } else { 599 $col_value = $col_val; 600 } 601 524 602 $render_val = '<textarea class="tsinf_comfortdb_plugin_edit_dataset_edit_field" ' . $readonly . ' name="tsinf_comfortdb_plugin_edit_dataset[' . $col_name . ']" id="" class="">' . $col_val . '</textarea>'; 525 603 if(is_null($col_val)) … … 601 679 } 602 680 603 604 $render_val = '<textarea class="tsinf_comfortdb_plugin_edit_dataset_edit_field" ' . $readonly . ' name="tsinf_comfortdb_plugin_edit_dataset[' . $col_name . ']" id="" class=""></textarea>'; 681 $col_value = ""; 682 if($sql_error_returned === true && isset($_POST['tsinf_comfortdb_plugin_edit_dataset'][$col_name]) && is_string($_POST['tsinf_comfortdb_plugin_edit_dataset'][$col_name]) && strlen($_POST['tsinf_comfortdb_plugin_edit_dataset'][$col_name]) > 0) 683 { 684 $col_value = $_POST['tsinf_comfortdb_plugin_edit_dataset'][$col_name]; 685 } 686 687 $render_val = '<textarea class="tsinf_comfortdb_plugin_edit_dataset_edit_field" ' . $readonly . ' name="tsinf_comfortdb_plugin_edit_dataset[' . $col_name . ']" id="" class="">' . $col_value . '</textarea>'; 605 688 606 689 $html .= '<div class="tsinf_comfortdb_plugin_edit_dataset_row ' . $even_odd . '"> … … 726 809 $wpdb->query("START TRANSACTION"); 727 810 $return = $wpdb->query($sql); 811 if(is_wp_error($return)) 812 { 813 $return_array['error_message'] = $return->get_error_message(); 814 } else if($wpdb->last_error) 815 { 816 $return_array['error_message'] = $wpdb->last_error; 817 } 818 728 819 if($return !== FALSE) 729 820 { … … 735 826 $wpdb->query("ROLLBACK"); 736 827 $return_array['success'] = (bool) false; 737 if(is_wp_error($return))738 {739 $return_array['error_message'] = $return->get_error_message();740 }741 828 } 742 829 } … … 820 907 821 908 $wpdb->query("START TRANSACTION"); 822 909 823 910 $return = $wpdb->query($sql); 911 if(is_wp_error($return)) 912 { 913 $return_array['error_message'] = $return->get_error_message(); 914 } else if($wpdb->last_error) 915 { 916 $return_array['error_message'] = $wpdb->last_error; 917 } 824 918 825 919 if($return !== FALSE) … … 829 923 $return_array['affected_rows'] = $return; 830 924 } else { 925 831 926 $wpdb->query("ROLLBACK"); 832 $return_array['success'] = (bool) false; 833 if(is_wp_error($return)) 834 { 835 $return_array['error_message'] = $return->get_error_message(); 836 } 927 $return_array['success'] = (bool) false; 837 928 } 838 929 } -
ts-comfort-database/trunk/plugin.php
r2764346 r2765122 7 7 Author: Tobias Spiess 8 8 Author URI: https://www.spiess-informatik.de 9 Version: 2.0. 69 Version: 2.0.7 10 10 Text-Domain: tsinf_comfortdb_plugin_textdomain 11 11 Domain Path: /languages -
ts-comfort-database/trunk/readme.txt
r2764346 r2765122 40 40 41 41 == Changelog == 42 * 2.0.7 43 Fix "no error message" when submit fails dataset editor 44 Remember input data when submit fails dataset editor 45 Add different Page Titles on different locations 46 42 47 * 2.0.6 43 48 Fix wrong download url in file manager again
Note: See TracChangeset
for help on using the changeset viewer.