Changeset 2821633
- Timestamp:
- 11/21/2022 04:11:15 PM (3 years ago)
- Location:
- verowa-connect
- Files:
-
- 113 added
- 20 edited
-
tags/2.11.3 (added)
-
tags/2.11.3/admin (added)
-
tags/2.11.3/admin/admin_notices.php (added)
-
tags/2.11.3/admin/admin_pages.php (added)
-
tags/2.11.3/admin/save_post_action.php (added)
-
tags/2.11.3/admin/subscriptions_admin_page.php (added)
-
tags/2.11.3/admin/templates_edit.php (added)
-
tags/2.11.3/css (added)
-
tags/2.11.3/css/backend_style.css (added)
-
tags/2.11.3/css/jquery-ui.structure.css (added)
-
tags/2.11.3/css/jquery-ui.structure.min.css (added)
-
tags/2.11.3/css/jquery-ui.theme.css (added)
-
tags/2.11.3/css/jquery-ui.theme.min.css (added)
-
tags/2.11.3/css/jquery_ui.css (added)
-
tags/2.11.3/css/jquery_ui.min.css (added)
-
tags/2.11.3/css/verowa_agenda.css (added)
-
tags/2.11.3/css/verowa_agenda.min.css (added)
-
tags/2.11.3/css/verowa_connect.css (added)
-
tags/2.11.3/events (added)
-
tags/2.11.3/events/agenda_dropdowns.php (added)
-
tags/2.11.3/events/assign_list.php (added)
-
tags/2.11.3/events/event_filter.php (added)
-
tags/2.11.3/events/event_filter_widget.php (added)
-
tags/2.11.3/events/event_list_widget.php (added)
-
tags/2.11.3/events/shortcode (added)
-
tags/2.11.3/events/shortcode/verowa_agenda.php (added)
-
tags/2.11.3/events/shortcode/verowa_event_details_json.php (added)
-
tags/2.11.3/events/shortcode/verowa_event_list.php (added)
-
tags/2.11.3/functions (added)
-
tags/2.11.3/functions/cache.php (added)
-
tags/2.11.3/functions/event.php (added)
-
tags/2.11.3/functions/general.php (added)
-
tags/2.11.3/functions/layer.php (added)
-
tags/2.11.3/functions/lite_speed.php (added)
-
tags/2.11.3/functions/person.php (added)
-
tags/2.11.3/functions/roster.php (added)
-
tags/2.11.3/functions/subscription.php (added)
-
tags/2.11.3/functions/user_data.php (added)
-
tags/2.11.3/functions/validation.php (added)
-
tags/2.11.3/general (added)
-
tags/2.11.3/general/activate_config.php (added)
-
tags/2.11.3/general/api_calls.php (added)
-
tags/2.11.3/general/back_link.php (added)
-
tags/2.11.3/general/class_verowa_formfields_rendering.php (added)
-
tags/2.11.3/general/class_verowa_update_controller.php (added)
-
tags/2.11.3/general/custom_post_action_filters.php (added)
-
tags/2.11.3/general/register_post_type.php (added)
-
tags/2.11.3/general/rest_routes.php (added)
-
tags/2.11.3/general/shortcode (added)
-
tags/2.11.3/general/shortcode/verowa_image.php (added)
-
tags/2.11.3/general/update_cron.php (added)
-
tags/2.11.3/general/verowa_templates_list.php (added)
-
tags/2.11.3/general/wp_filter.php (added)
-
tags/2.11.3/images (added)
-
tags/2.11.3/images/ajax-loader.gif (added)
-
tags/2.11.3/images/datepicker (added)
-
tags/2.11.3/images/datepicker/ui-bg_glass_55_fbf9ee_1x400.png (added)
-
tags/2.11.3/images/datepicker/ui-bg_glass_65_ffffff_1x400.png (added)
-
tags/2.11.3/images/datepicker/ui-bg_glass_75_d0e5f5_1x400.png (added)
-
tags/2.11.3/images/datepicker/ui-bg_glass_75_dadada_1x400.png (added)
-
tags/2.11.3/images/datepicker/ui-bg_glass_75_e6e6e6_1x400.png (added)
-
tags/2.11.3/images/datepicker/ui-bg_glass_85_dfeffc_1x400.png (added)
-
tags/2.11.3/images/datepicker/ui-bg_glass_95_fef1ec_1x400.png (added)
-
tags/2.11.3/images/datepicker/ui-bg_gloss-wave_55_5c9ccc_500x100.png (added)
-
tags/2.11.3/images/datepicker/ui-bg_highlight-soft_75_cccccc_1x100.png (added)
-
tags/2.11.3/images/datepicker/ui-bg_inset-hard_100_f5f8f9_1x100.png (added)
-
tags/2.11.3/images/datepicker/ui-bg_inset-hard_100_fcfdfd_1x100.png (added)
-
tags/2.11.3/images/datepicker/ui-icons_217bc0_256x240.png (added)
-
tags/2.11.3/images/datepicker/ui-icons_222222_256x240.png (added)
-
tags/2.11.3/images/datepicker/ui-icons_2e83ff_256x240.png (added)
-
tags/2.11.3/images/datepicker/ui-icons_454545_256x240.png (added)
-
tags/2.11.3/images/datepicker/ui-icons_469bdd_256x240.png (added)
-
tags/2.11.3/images/datepicker/ui-icons_6da8d5_256x240.png (added)
-
tags/2.11.3/images/datepicker/ui-icons_888888_256x240.png (added)
-
tags/2.11.3/images/datepicker/ui-icons_cd0a0a_256x240.png (added)
-
tags/2.11.3/images/datepicker/ui-icons_d8e7f3_256x240.png (added)
-
tags/2.11.3/images/datepicker/ui-icons_f9bd01_256x240.png (added)
-
tags/2.11.3/images/icon.png (added)
-
tags/2.11.3/images/settings-panel.JPG (added)
-
tags/2.11.3/images/verowa.png (added)
-
tags/2.11.3/includes (added)
-
tags/2.11.3/includes/presets.php (added)
-
tags/2.11.3/js (added)
-
tags/2.11.3/js/external (added)
-
tags/2.11.3/js/external/jquery (added)
-
tags/2.11.3/js/external/jquery/jquery.js (added)
-
tags/2.11.3/js/functions.js (added)
-
tags/2.11.3/js/functions.min.js (added)
-
tags/2.11.3/js/jquery_ui.js (added)
-
tags/2.11.3/js/jquery_ui.min.js (added)
-
tags/2.11.3/js/verowa_admin_script.js (added)
-
tags/2.11.3/js/verowa_agenda.js (added)
-
tags/2.11.3/js/verowa_agenda.min.js (added)
-
tags/2.11.3/log (added)
-
tags/2.11.3/log/verowa_connect_debugger.php (added)
-
tags/2.11.3/persons (added)
-
tags/2.11.3/persons/assign_persons.php (added)
-
tags/2.11.3/persons/show_persons_shortcode.php (added)
-
tags/2.11.3/persons/show_persons_widget.php (added)
-
tags/2.11.3/persons/single_person_page.php (added)
-
tags/2.11.3/readme.txt (added)
-
tags/2.11.3/renting (added)
-
tags/2.11.3/renting/verowa_renting_form.php (added)
-
tags/2.11.3/renting/verowa_renting_response.php (added)
-
tags/2.11.3/renting/verowa_renting_validate.php (added)
-
tags/2.11.3/rosters (added)
-
tags/2.11.3/rosters/verowa_roster_entries.php (added)
-
tags/2.11.3/subscriptions (added)
-
tags/2.11.3/subscriptions/verowa_subscription_confirmation.php (added)
-
tags/2.11.3/subscriptions/verowa_subscription_form.php (added)
-
tags/2.11.3/subscriptions/verowa_subscription_overview.php (added)
-
tags/2.11.3/subscriptions/verowa_subscription_validation.php (added)
-
tags/2.11.3/verowa-connect.php (added)
-
trunk/admin/admin_notices.php (modified) (1 diff)
-
trunk/admin/admin_pages.php (modified) (5 diffs)
-
trunk/admin/save_post_action.php (modified) (1 diff)
-
trunk/admin/subscriptions_admin_page.php (modified) (4 diffs)
-
trunk/admin/templates_edit.php (modified) (3 diffs)
-
trunk/events/shortcode/verowa_event_details_json.php (modified) (1 diff)
-
trunk/functions/event.php (modified) (26 diffs)
-
trunk/functions/general.php (modified) (7 diffs)
-
trunk/functions/person.php (modified) (13 diffs)
-
trunk/functions/roster.php (modified) (2 diffs)
-
trunk/functions/user_data.php (modified) (1 diff)
-
trunk/general/activate_config.php (modified) (2 diffs)
-
trunk/general/class_verowa_formfields_rendering.php (modified) (1 diff)
-
trunk/general/class_verowa_update_controller.php (modified) (9 diffs)
-
trunk/general/custom_post_action_filters.php (modified) (5 diffs)
-
trunk/general/rest_routes.php (modified) (1 diff)
-
trunk/general/update_cron.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/subscriptions/verowa_subscription_form.php (modified) (1 diff)
-
trunk/verowa-connect.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
verowa-connect/trunk/admin/admin_notices.php
r2745654 r2821633 12 12 13 13 /** 14 * If the verowa_instance or verowa_api_key is not set, it gene erate an admin notices14 * If the verowa_instance or verowa_api_key is not set, it generate an admin notices 15 15 */ 16 16 function verowa_api_member_error() { -
verowa-connect/trunk/admin/admin_pages.php
r2797642 r2821633 35 35 36 36 // Option block "Events" 37 update_option( 'verowa_keep_outdated_events_days', $_POST['verowa_keep_outdated_events_days'] ?? 0);37 update_option( 'verowa_keep_outdated_events_days', intval($_POST['verowa_keep_outdated_events_days'] ?? 0) ); 38 38 39 39 update_option( 'show-to-time', isset( $_POST['show-to-time'] ) ? 'on' : false); … … 182 182 echo '<b>' . _x( 'Settings for detail pages', 'Persons', 'verowa-connect' ) . '</strong></b><br />'; 183 183 184 // verowa_db_update_person_group();185 184 186 185 echo verowa_checkbox_html( … … 226 225 227 226 228 // sollte nicht mehr benötigt werden229 //function verowa_db_update_person_group() {230 // global $wpdb;231 232 // $select_groups_query = 'SELECT `post_id` FROM `' . $wpdb->prefix . 'postmeta` ' .233 // 'WHERE `meta_key` = "_verowa_person_assign" AND `meta_value` = "persongroup";';234 // $arr_person_groups = $wpdb->get_results( $select_groups_query, ARRAY_A );235 236 // // post ids mit gruppen 612, 604, 156, 2086, 2114, 2116, 2118, 2120, 2122, 2124, 2126237 // foreach ( $arr_person_groups as $single_group ) {238 // $int_group_id = get_post_meta( intval( $single_group['post_id'] ), '_verowa_person_group', true );239 240 // update_post_meta( intval( $single_group['post_id'] ), '_person_singles',241 // array( 0 => 'group-' . $int_group_id ) );242 243 // }244 //}245 246 247 248 227 /* 249 228 * New Admin Page (Proof of concept) … … 251 230 252 231 function verowa_register_admin_menu() { 232 $user = wp_get_current_user(); 233 if ( in_array( 'administrator', (array)$user->roles ) ) { 253 234 add_menu_page( 'Verowa', 'Verowa', 'manage_options', 'verowa/main_options_menu.php', 254 235 'verowa_main_options_menu', plugins_url( 'verowa-connect/images/icon.png' ), 80 ); … … 257 238 __( 'Verowa templates', 'verowa-connect' ) , 'switch_themes', 'verowa-options-templates', 258 239 'verowa_templates_configuration_page' ); 240 } 259 241 } 260 242 -
verowa-connect/trunk/admin/save_post_action.php
r2787679 r2821633 27 27 $bool_update = false; 28 28 29 // If an Id is not found, the update is executed.29 // If an id is not found, the update is executed. 30 30 if ( is_array( $arr_new_list_ids ) && count( $arr_new_list_ids ) > 0 ) 31 31 { -
verowa-connect/trunk/admin/subscriptions_admin_page.php
r2787679 r2821633 13 13 14 14 /* 15 * Description: Admin -Page zum Eintragen von Projekten, URLs und Key Codes zum Monitoring15 * Description: Admin page for entering projects, URLs and key codes for monitoring purposes 16 16 */ 17 17 … … 32 32 33 33 34 // Anzeige in der Admin-Page34 // Display in the admin page 35 35 function render_subscriptions_options_page() { 36 36 ?> … … 154 154 155 155 156 /** 157 * Set selected for dropdown-menu 158 * 159 * @param string $field_name 160 * @param array $arr_options 161 * @param string $value 162 * @return string 163 */ 156 164 function pp_set_dd_selected( $field_name, $arr_options, $value ) { 157 165 $ret = ''; … … 166 174 167 175 176 /** 177 * Set checked for checkboxes 178 * 179 * @param string $fild_name 180 * @param array $arr_options 181 * @return string 182 */ 168 183 function pp_set_cb_checked( $fild_name, $arr_options ) { 169 184 $ret = ''; -
verowa-connect/trunk/admin/templates_edit.php
r2797642 r2821633 212 212 213 213 case 'persondetails': 214 verowa_ persons_set_deprecated();215 verowa_ events_db_set_to_deprecated();214 verowa_general_set_deprecated_content( 'verowa_person' ); 215 verowa_general_set_deprecated_content( 'verowa_events' ); 216 216 break; 217 217 … … 230 230 231 231 case 'eventdetails': 232 verowa_ events_db_set_to_deprecated();232 verowa_general_set_deprecated_content( 'verowa_events' ); 233 233 break; 234 234 } … … 299 299 <?php echo _x( 'add new', 'In Template Editor', 'verowa-connect' ); ?> 300 300 </a> 301 <div class="meta-box-sortables ui-sortable ">301 <div class="meta-box-sortables ui-sortable verowa-template-overview"> 302 302 <form method="post"> 303 303 <?php -
verowa-connect/trunk/events/shortcode/verowa_event_details_json.php
r2809632 r2821633 31 31 $arr_event_details = verowa_event_db_get_content( $atts['id'] ); 32 32 33 $subs_person_id = intval($arr_event_d ata['subs_person_id'] ?? 0);33 $subs_person_id = intval($arr_event_details['subs_person_id'] ?? 0); 34 34 35 35 // Is it a subscription, we get the current date from the API 36 36 if ( $subs_person_id > 0) { 37 $arr_ret_api_call = verowa_api_call( 'geteventdetails', $ event_id, true );37 $arr_ret_api_call = verowa_api_call( 'geteventdetails', $int_id, true ); 38 38 $arr_event_details = $arr_ret_api_call['data'][0]; 39 39 $int_request_status_code = $arr_ret_api_call['code']; -
verowa-connect/trunk/functions/event.php
r2809632 r2821633 27 27 global $wpdb; 28 28 29 if ( 0 == count($arr_event_data) ) { 29 if ( true === is_array($arr_event_data) && count($arr_event_data) > 0 ) { 30 $id = $arr_event_data['event_id']; 31 } elseif ( 0 == $id ) { 30 32 $arr_event_data = verowa_event_db_get_content( $id ); 31 } elseif ( 0 == $id ) {32 $id = $arr_event_data['event_id'];33 33 } 34 34 … … 48 48 $arr_placeholder['EVENT_ID'] = $id; 49 49 50 // Event title51 50 $arr_placeholder['TITLE'] = $arr_event_data['title']; 52 51 $arr_placeholder['EVENT_TITLE'] = $arr_event_data['title']; /** @deprecated v 2.4.0 */ 53 52 54 // Topic55 53 if ( key_exists('topic', $arr_event_data ?? array() ) && $arr_event_data['topic'] != '' ) { 56 54 $arr_placeholder['TOPIC'] = $arr_event_data['topic']; … … 120 118 } 121 119 122 // Add short description123 120 if ( '' != $arr_event_data['short_desc'] ) { 124 121 $arr_placeholder['SHORT_DESC'] = $arr_event_data['short_desc']; 125 122 } 126 123 127 // Add detail description128 124 if ( '' != $arr_event_data['long_desc'] ) { 129 125 $arr_placeholder['LONG_DESC'] = $arr_event_data['long_desc']; … … 255 251 $arr_event_data['subs_date'] . $arr_event_data['subs_time'] . '59' > $str_datetime_now ) { 256 252 257 switch ($arr_event_data['subs_state'] ?? 'none') 258 { 253 switch ($arr_event_data['subs_state'] ?? 'none') { 259 254 case 'waiting_list': 260 255 // no fallback is required, the api set a default value … … 320 315 } 321 316 322 $arr_placeholder['SUBS_FORM'] = 323 do_shortcode('[verowa_subscription_form event_id=' . $id . ' show_event_info=0]'); 317 $arr_placeholder['SUBS_FORM'] = '[verowa_subscription_form event_id=' . $id . ' show_event_info=0]'; 324 318 $arr_placeholder['SUBS_STATE'] = $arr_event_data['subs_state'] ?? 'none'; 325 319 … … 578 572 } 579 573 580 // Location581 574 if ( !empty( $arr_content['rooms'] ) ) { 582 575 $arr_placeholder['LOCATION'] = $arr_content['rooms'][0]['location_name']; … … 601 594 } 602 595 603 // Anmeldebutton setzen wenn ein Formular ausgewählt wurde596 // Set registration button when a form has been selected 604 597 $arr_placeholder['SUPSCRIPTION_BUTTON'] = ''; 605 598 $arr_placeholder['SUPS_BUTTON'] = ''; … … 653 646 $arr_placeholder['SUBS_STATE'] = $arr_content['subs_state'] ?? 'none'; 654 647 655 // Detailbutton ändern wenn kein Formular ausgewählt wurde aber es trotzdem eine Anmeldezeit hat648 // Change detail button if no form is selected but it still has a login time 656 649 if ( 0 != $arr_content['subs_date'] && 0 != $arr_content['subs_person_id'] 657 650 && $arr_content['subs_date'] . $arr_content['subs_time'] . '59' > $str_datetime_now ) { … … 686 679 687 680 /** 688 * 689 * 690 * @param mixed$event681 * Get date HTML for e.g. placeholder DATE_FROM_LONG 682 * 683 * @param array $event 691 684 * @return string 692 685 */ … … 746 739 747 740 /** 748 * 741 * Get event date and time 749 742 * 750 743 * @param array $event … … 797 790 798 791 /** 799 * Return a String with the event location 792 * Return a string with the event location 793 * 800 794 * @param array $arr_event_loc 801 795 * … … 820 814 821 815 /** 822 * 823 * 816 * Assembling an address block 817 * 818 824 819 * @param array $arr_event_loc 825 820 * @return string … … 858 853 859 854 $wpdb->query( 'START TRANSACTION' ); 860 try 861 { 862 863 $str_events_tablename = $wpdb->prefix . 'verowa_events'; 864 $arr_event_insert_formats = array( '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%s', '%d' ); 855 try { 865 856 $str_content = json_encode( $arr_event, JSON_UNESCAPED_UNICODE ); 866 857 867 // Alles hashen. Mit dem Hash kann einfach geprüft werden ob etwas geändert wurde858 // Hash everything. With the hash it is easy to check whether something has been changed. 868 859 $str_hash = verowa_event_generate_hash( $arr_event, $arr_ids, $bool_has_subscription, $str_content ); 869 860 … … 873 864 $arr_event['short_desc'] : $arr_event['long_desc']; 874 865 875 // Create post object876 866 $arr_post = [ 877 867 'post_title' => wp_strip_all_tags( $arr_event['title'] ), … … 888 878 if ( !is_wp_error( $int_post_id ) ) { 889 879 $wpdb->insert( 890 $ str_events_tablename,880 $wpdb->prefix . 'verowa_events', 891 881 array( 892 882 'event_id' => intval( $arr_event['event_id'] ), … … 900 890 'content' => $str_content, 901 891 'hash' => strval( $str_hash ), 902 'deprecated' => 0 892 'deprecated_content' => 0, 893 'deprecated' => 0, 903 894 ), 904 $arr_event_insert_formats895 array( '%d', '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%s', '%d', '%d' ) 905 896 ); 906 897 $wpdb->query('COMMIT'); … … 908 899 throw new Exception( $int_post_id->get_error_message() ); 909 900 } 910 } 911 catch (Exception $exception) 912 { 901 } catch (Exception $exception) { 913 902 $obj_debug = new Verowa_Connect_Debugger(); 914 903 $obj_debug->wirte_to_file( 'Fehler einfügen eines Events: ' . $exception->getMessage() ); 915 // I m Fehlerfall werde die Daten gelöscht904 // In the event of an error, the data is deleted 916 905 $wpdb->query('ROLLBACK'); 917 906 } … … 922 911 923 912 /** 924 * Updatet an event in der DB 925 * 913 * Updates an event in the DB 914 * 915 * @param array $arr_event 916 * @param bool $bool_has_subscription 917 * @param string $str_hash 918 * @param array $arr_ids 926 919 */ 927 920 function verowa_event_db_update( $arr_event, $bool_has_subscription, $str_hash, $arr_ids ) { … … 949 942 950 943 if( 0 == $current_post_id ) { 951 // Create post object 944 952 945 $post = array( 953 946 'post_title' => wp_strip_all_tags( $arr_event['title'] ), … … 974 967 } 975 968 976 $arr_event_data_formats = array( '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%s', '%d' );977 $arr_event_where_formats = array( '%d' );978 979 969 if ( $int_post_id > 0 ) { 970 980 971 $arr_event_data = array( 981 972 'post_id' => intval($int_post_id), … … 988 979 'content' => json_encode( $arr_event, JSON_UNESCAPED_UNICODE ), 989 980 'hash' => $str_hash, 981 'deprecated_content' => 0, 990 982 'deprecated' => 0, 991 983 ); … … 997 989 'event_id' => $arr_event['event_id'] 998 990 ), 999 $arr_event_data_formats,1000 $arr_event_where_formats991 array( '%d', '%s', '%s', '%s', '%s', '%s', '%d', '%s', '%s', '%d', '%d' ), 992 array( '%d' ) 1001 993 ); 1002 994 … … 1036 1028 try { 1037 1029 $wpdb->query( 'START TRANSACTION' ); 1038 $ret_delete_post = wp_delete_post( $int_post_id, true ); 1039 1030 $ret_delete_post = verowa_delete_post( $int_post_id, 'verowa_event' ); 1040 1031 $ret_wp_delete = $wpdb->delete( 1041 1032 $str_events_tablename, … … 1115 1106 1116 1107 // Insert the post into the database 1117 $int_post_id = verowa_general_insert_custom_post( $post, 'verowa_events', 'event_id', $arr_ret['script']);1108 verowa_general_insert_custom_post( $post, 'verowa_events', 'event_id', $arr_ret['script'] ); 1118 1109 1119 1110 } … … 1296 1287 $arr_restrictions = array(); 1297 1288 1289 // CWe,MPf: Prevent display event in the past 1290 $obj_date_now = new DateTime(); 1291 $arr_restrictions[] = '`datetime_to` >= "' . $obj_date_now->format( 'Y-m-d H:i:s' ) . '"'; 1292 1298 1293 if ( 'now' === $obj_date ) { 1299 1294 $obj_date = new DateTime(); … … 1408 1403 1409 1404 /** 1410 * 1411 * 1405 * Return classes for the Weekend 1406 * 1407 1412 1408 * @param array $event 1413 1409 * @return string -
verowa-connect/trunk/functions/general.php
r2809632 r2821633 504 504 if ( $wpdb->prefix . 'verowa_person' == $str_table_name || 505 505 $wpdb->prefix . 'verowa_events' == $str_table_name ) { 506 $post_type = ''; 507 if( $wpdb->prefix . 'verowa_person' == $str_table_name ) { 508 $post_type = 'verowa_person'; 509 } else if( $wpdb->prefix . 'verowa_events' == $str_table_name) { 510 $post_type = 'verowa_event'; 511 } 506 512 507 513 try { … … 516 522 foreach ( $arr_post_ids as $arr_row ) { 517 523 // delete related Posts 518 verowa_delete_post( $arr_row['post_id'] );524 verowa_delete_post( $arr_row['post_id'], $post_type ); 519 525 } 520 526 } … … 539 545 } 540 546 } 547 548 549 550 551 /** 552 * Set content of verowa post deprecated. Force content update on request. 553 * 554 * @param string $str_table_name 555 */ 556 function verowa_general_set_deprecated_content( $str_table_name ) { 557 global $wpdb; 558 $wpdb->query( 559 'UPDATE `' . $wpdb->prefix . $str_table_name . '` SET `deprecated_content` = 1' . 560 ' WHERE `deprecated_content` = 0;' 561 ); 562 } 563 564 541 565 542 566 … … 593 617 if ( !is_wp_error( $int_post_id ) ) { 594 618 // Ensures that the verowa_event is correctly linked to the post 595 $ ret_update = $wpdb->update(619 $wpdb->update( 596 620 $wpdb->prefix . $str_verowa_table_name, 597 621 array( … … 622 646 */ 623 647 function verowa_general_update_custom_post( $arr_post, $str_script = '' ) { 624 648 $ret_update_post = ''; 625 649 $int_post_id = $arr_post['ID'] ?? 0; 626 650 if ( $int_post_id > 0 ) { … … 640 664 } 641 665 642 /** 643 * 644 * @param int $post_id 645 * @return void 646 */ 647 function verowa_delete_post( $post_id ) { 648 $post_id = $post_id ?? 0; 666 667 668 669 /** 670 * @param int $post_id 671 * @param string $str_type post type 672 * 673 * @return bool|null|WP_Post 674 */ 675 function verowa_delete_post( $post_id, $str_type ) { 676 global $wpdb; 677 $ret = null; 678 679 $post_id = intval( $post_id ?? 0 ); 649 680 if ( $post_id > 0) { 650 wp_delete_post( $post_id, true ); 651 } 681 $query = 'SELECT `post_type` FROM `' . $wpdb->posts . '` WHERE `ID` = ' . $post_id; 682 $str_post_type = $wpdb->get_var( $query ) ?? ''; 683 if($str_post_type == $str_type) { 684 $ret = wp_delete_post( $post_id, true ); 685 } 686 } 687 return $ret; 652 688 } 653 689 … … 873 909 return $arr_formfield_options; 874 910 } 911 912 913 914 915 /** 916 * The passed nodes are compiled into a tree 917 * Each node required id, parent id and a children array 918 * 919 * @param array $arr_nodes 920 * @param string $str_id id name 921 * @param string $str_parent parent key name 922 * @return array return the tree 923 * 924 */ 925 function verowa_get_tree( $arr_pgroups, $str_id, $str_parent ) { 926 $arr_tree = array(); 927 928 $k = 0; 929 do { 930 foreach($arr_pgroups as $str_key => $arr_node) 931 { 932 // If the node does not have a parent node, it is added to the root node. 933 if( 0 === intval( $arr_node[$str_parent] ) ) { 934 $arr_tree[intval($arr_node[$str_id])] = $arr_node; 935 unset($arr_pgroups[$str_key]); 936 } else { 937 // The parent node must be determined, in the first pass it could be that the node does not exist. 938 $are_added = verowa_add_node_to_tree( $arr_tree, $arr_pgroups[$str_key], $str_id, $str_parent ); 939 if($are_added) { 940 unset($arr_pgroups[$str_key]); 941 } 942 } 943 } 944 $k++; 945 } while( count( $arr_pgroups ) > 0 && $k <= 10 ); 946 947 return $arr_tree; 948 } 949 950 951 952 953 /** 954 * Add a node to its parent node 955 * 956 * @param array $arr_tree 957 * @param array $arr_node 958 * @param string $str_id 959 * @param string $str_parent 960 * @return bool 961 */ 962 function verowa_add_node_to_tree( &$arr_tree, $arr_node, $str_id, $str_parent ) { 963 // If the parent node is in the first node level, it can be added directly. 964 if( key_exists(intval($arr_node[$str_parent]), $arr_tree) ) { 965 $arr_tree[intval($arr_node[$str_parent])]['children'][intval($arr_node[$str_id])] = $arr_node; 966 return true; 967 } else { 968 // Parent node must be searched for in the tree 969 $are_added = false; 970 foreach($arr_tree as $ele) { 971 $are_added = verowa_add_node_to_tree( $ele['children'], $arr_node, $str_id, $str_parent ); 972 if($are_added) { 973 $arr_tree[intval($ele[$str_id])]['children'] = $ele['children']; 974 break; 975 } 976 } 977 978 return $are_added; 979 } 980 } 981 982 983 984 985 /** 986 * Clean variables using sanitize_text_field. Arrays are cleaned recursively. 987 * Non-scalar values are ignored. 988 * 989 * @param string|array $var Data to sanitize. 990 * @return string|array 991 */ 992 function verowa_clean( $var ) { 993 if ( is_array( $var ) ) { 994 return array_map( 'verowa_clean', $var ); 995 } else { 996 return is_scalar( $var ) ? sanitize_text_field( $var ) : $var; 997 } 998 } -
verowa-connect/trunk/functions/person.php
r2809632 r2821633 102 102 'hash' => $str_hash, 103 103 'web_visibility' => $str_web_visibility, 104 'deprecated_content' => 0, 104 105 'deprecated' => 0, 105 106 ), 106 array( '%d', '%d', '%s', '%s', '%s', '%d')107 array( '%d', '%d', '%s', '%s', '%s', '%d', '%d' ) 107 108 ); 108 109 … … 140 141 'hash' => $str_hash, 141 142 'deprecated' => 0, 143 'deprecated_content' => 0, 142 144 'web_visibility' => $str_web_visibility, 143 145 ), 144 array( '%d', '%d', '%s', '%s', '%d', '%s')146 array( '%d', '%d', '%s', '%s', '%d', '%d', '%s' ) 145 147 ); 146 148 } catch (Exception $exception) { … … 170 172 'hash' => $str_hash, 171 173 'deprecated' => 0, 174 'deprecated_content' => 0, 172 175 'web_visibility' => $str_web_visibility, 173 176 ), … … 175 178 'person_id' => $arr_person['person_id'] 176 179 ), 177 array( '%d', '%s', '%s', '%d', '%s'),180 array( '%d', '%s', '%s', '%d', '%d', '%s' ), 178 181 array('%d') 179 182 ); … … 208 211 209 212 $wpdb->insert( 210 $ str_persongroups_tablename,213 $wpdb->prefix . 'verowa_person_groups', 211 214 array( 212 215 'pgroup_id' => intval($arr_person_group['group_id']), … … 216 219 'deprecated' => 0, 217 220 ), 218 $arr_pgroup_insert_formats221 array( '%d', '%d', '%s', '%s', '%s', '%s', '%d' ) 219 222 ); 220 223 } … … 233 236 $bool_persons_without_detail_page = get_option('verowa_persons_without_detail_page', false) == 'on' ? 234 237 true : false; 235 236 $obj_debug = new Verowa_Connect_Debugger();237 $obj_debug->wirte_to_file('Person Update');238 238 239 239 $wpdb->query('START TRANSACTION'); … … 307 307 $wpdb->query('COMMIT'); 308 308 } catch (Exception $exception) { 309 $obj_debug->wirte_to_file('Fehler Update persons: ' . $exception->getMessage());309 // $obj_debug->wirte_to_file( 'Fehler Update persons: ' . $exception->getMessage() ); 310 310 // In the event of an error, the modifications are reversed 311 311 $wpdb->query('ROLLBACK'); … … 399 399 400 400 if (null != $int_post_id) { 401 verowa_delete_post( $int_post_id);401 verowa_delete_post( $int_post_id, 'verowa_person'); 402 402 403 403 $wpdb->delete( … … 424 424 try { 425 425 $int_post_id = intval($arr_single_pers_ids['post_id']); 426 wp_delete_post($int_post_id, true);426 verowa_delete_post( $int_post_id, 'verowa_person' ); 427 427 428 428 // remove post id from verowa person … … 455 455 456 456 foreach ($all_person as $single_post) { 457 verowa_delete_post( $single_post->ID);457 verowa_delete_post( $single_post->ID, 'verowa_person' ); 458 458 } 459 459 } … … 517 517 * 518 518 */ 519 function verowa_person_group_set_deprecated($int_group_id) 520 { 519 function verowa_person_group_set_deprecated( $int_group_id ) { 521 520 global $wpdb; 522 521 … … 702 701 if (null != $int_post_id && !is_wp_error( $int_post_id )) { 703 702 704 $ ret_update = $wpdb->update(703 $wpdb->update( 705 704 $str_table_name, 706 705 array( -
verowa-connect/trunk/functions/roster.php
r2801798 r2821633 72 72 73 73 // Alles hashen. Mit dem Hash kann einfach geprüft werden ob etwas geändert wurde 74 $str_hash = verowa_roster_duty_generate_hash( $roster_id, $arr_roster_duty , $str_content);74 $str_hash = verowa_roster_duty_generate_hash( $roster_id, $arr_roster_duty ); 75 75 76 76 $obj_ret->content = $wpdb->insert( … … 195 195 * @return string md5 hash 196 196 */ 197 function verowa_roster_duty_generate_hash( $roster_id, $arr_roster_duty , $str_content) {197 function verowa_roster_duty_generate_hash( $roster_id, $arr_roster_duty) { 198 198 $str_content = json_encode( $arr_roster_duty['content'][0] ?? [], JSON_UNESCAPED_UNICODE ); 199 199 return md5( strval( $roster_id ) . ';df=' . $arr_roster_duty['datetime_from'] . -
verowa-connect/trunk/functions/user_data.php
r2745654 r2821633 156 156 function verowa_set_connect_cookie($str_key) { 157 157 $str_name = 'verowa-connect-session'; 158 $expireTime = strtotime('+3 day'); 158 159 // CWe/MPf: Das Cookie läuft am Ende der Sitzung ab, um Filterfehler zu vermeiden. 160 $expireTime = 0; 159 161 $path = '/'; 160 162 return setcookie($str_name, $str_key, $expireTime, $path, $_SERVER["SERVER_NAME"] ); -
verowa-connect/trunk/general/activate_config.php
r2800460 r2821633 173 173 `modified_when` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 174 174 `created_when` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, 175 `deprecated_content` TINYINT NOT NULL DEFAULT 0 COMMENT "Post content is deprecated after template update", 175 176 `deprecated` TINYINT NOT NULL DEFAULT 0, 176 177 PRIMARY KEY (event_id)) … … 186 187 `modified_when` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 187 188 `created_when` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, 189 `deprecated_content` TINYINT NOT NULL DEFAULT 0 COMMENT "Post content is deprecated after template update", 188 190 `deprecated` TINYINT NOT NULL DEFAULT 0, 189 191 PRIMARY KEY (person_id)) ' . $str_charset . ';'; -
verowa-connect/trunk/general/class_verowa_formfields_rendering.php
r2787679 r2821633 666 666 667 667 $str_html = '<div class="multiple-choice-block' . $str_div_class . '" ' . 668 'data-id="' . $this->str_field_id . '" >' .668 'data-id="' . $this->str_field_id . '"' . $str_affected .'>' . 669 669 '<input type="hidden" name="' . $this->str_field_name . '" value="" />' . 670 670 '<h4>' . $this->arr_single_formfield['label'] . ' ' . -
verowa-connect/trunk/general/class_verowa_update_controller.php
r2809632 r2821633 38 38 $this->obj_debug = new Verowa_Connect_Debugger(); 39 39 verowa_delete_duplicate_custom_post(); 40 set_time_limit( 300 ); 40 41 } 41 42 … … 76 77 $str_list_ids = is_array( $this->arr_list_ids ) ? implode( ',', $this->arr_list_ids ) : ''; 77 78 $arr_ret_api_call = verowa_api_call( 'geteventslistmap', $str_list_ids . '/0', true ); 78 $this->arr_list_ids_for_event = $arr_ret_api_call['data'];79 $this->arr_list_ids_for_event = is_array ($arr_ret_api_call['data']) ? $arr_ret_api_call['data'] : []; 79 80 break; 80 81 … … 83 84 $arr_ret_api_call = verowa_api_call( 'geteventslistmap', implode( ',', $this->arr_list_ids ) . 84 85 '/0', true ); 85 $this->arr_list_ids_for_event = $arr_ret_api_call['data'];86 $this->arr_list_ids_for_event = is_array ($arr_ret_api_call['data']) ? $arr_ret_api_call['data'] : []; 86 87 break; 87 88 } … … 304 305 } 305 306 } 307 308 // Update all event with deprecated_content 309 $query = 'SELECT `post_id`, `content` FROM `' . $wpdb->prefix . 'verowa_events` ' . 310 'WHERE `deprecated_content` = 1'; 311 312 $arr_events = $wpdb->get_results( $query, ARRAY_N ); 313 foreach ( $arr_events as $single_dc_event ) { 314 $arr_event = json_decode( $single_dc_event['content'], true ); 315 $arr_new_content = get_verowa_event_single_content( 0, $arr_event ); 316 317 $arr_post = array( 318 'ID' => intval( $single_dc_event['post_id'] ?? 0 ), 319 'post_content' => $arr_new_content['html'], 320 ); 321 322 verowa_general_update_custom_post( $arr_post, $arr_new_content['script'] ); 323 } 324 325 $wpdb->update( 326 $wpdb->prefix . 'verowa_events', 327 array( 328 'deprecated_content' => 0, 329 ), 330 array( 331 'deprecated_content' => 1, 332 ), 333 array( '%d' ), 334 array( '%d' ), 335 ); 306 336 } 307 337 … … 371 401 ); 372 402 373 // prevent the event from being deleted 374 $wpdb->update( 375 $this->str_events_tablename, 376 array( 377 'deprecated' => 0, 378 ), 379 array( 380 'event_id' => $single_event['event_id'], 381 ), 382 null, 383 array( '%d' ), 384 ); 403 $query = 'UPDATE `' . $this->str_events_tablename . '` SET `deprecated` = 0 ' . 404 'WHERE `event_id` = ' . $single_event['event_id'] . ';'; 405 $wpdb->query($query); 385 406 } 386 407 } else { … … 475 496 $obj_person_ids_in_db = $wpdb->get_results( 476 497 'SELECT GROUP_CONCAT(person_id SEPARATOR ",") AS `person_ids`' . 477 ' FROM `' . $wpdb->prefix . 'verowa_person` WHERE (web_visibility IS NULL OR web_visibility = "" OR web_visibility = "FULL");' );498 ' FROM `' . $wpdb->prefix . 'verowa_person`;' ); 478 499 $arr_person_ids_in_db = explode( ',', $obj_person_ids_in_db[0]->person_ids ); 479 500 … … 486 507 verowa_persons_set_deprecated(); 487 508 509 $query = 'SELECT `person_id`, `hash`, `deprecated` FROM `' . $wpdb->prefix . 'verowa_person`' . 510 ' WHERE `person_id` IN (' . implode( ', ', $arr_person_ids_from_verowa ) . ');'; 511 $arr_persons_hash = $wpdb->get_results( $query, OBJECT_K ); 512 488 513 foreach ( $arr_all_persons as $single_person ) { 489 514 $arr_all_person_data = array(); … … 508 533 // If this person already exists we update it 509 534 if ( in_array( $arr_all_person_data['person_id'], $arr_person_ids_in_db ) ) { 510 $get_person_hash = 'SELECT `hash`, `deprecated` FROM `' . $wpdb->prefix . 'verowa_person`' . 511 ' WHERE `person_id` = ' . $arr_all_person_data['person_id'] . ';'; 512 $arr_person_hash = $wpdb->get_results( $get_person_hash, ARRAY_A ); 513 $is_deprecated = filter_var( $arr_person_hash[0]['deprecated'] ?? false, FILTER_VALIDATE_BOOLEAN ); 514 535 $is_deprecated = filter_var( $arr_persons_hash[$arr_all_person_data['person_id']]->deprecated ?? false, FILTER_VALIDATE_BOOLEAN ); 515 536 // deprecated entries will also be updated until the new update function is available 516 if ( $arr_person_hash[0]['hash'] !== $str_person_hash || true === $is_deprecated ) { 537 if ($arr_persons_hash[$arr_all_person_data['person_id']]->hash !== $str_person_hash 538 || true === $is_deprecated ) { 517 539 verowa_person_db_update( $arr_all_person_data, 'FULL', $str_person_hash ); 518 540 } else if( false == $bool_persons_without_detail_page ) { … … 529 551 array('%d') 530 552 ); 553 } else { 554 // prevent delte post 555 $wpdb->update( 556 $wpdb->prefix . 'verowa_person', 557 array( 558 'deprecated' => 0, 559 ), 560 array( 561 'person_id' => $arr_all_person_data['person_id'], 562 ), 563 array('%d'), 564 array('%d') 565 ); 531 566 } 532 567 } else { -
verowa-connect/trunk/general/custom_post_action_filters.php
r2809632 r2821633 27 27 add_filter('pre_get_posts', 'verowa_events_exclude_from_search' ); 28 28 29 30 add_action('wp_head', 'verowa_hook_add_metatags'); 31 add_action('parse_request', 'verowa_parse_request_update_custom_post_if_deprecated'); 29 32 30 33 /** … … 211 214 if ( true === $show_unavailable_after_tag && strlen( $str_datetime_end ) > 0 ) { 212 215 echo '<meta name="robots" content="unavailable_after: ' . $str_datetime_end . '">' . PHP_EOL; 213 } 214 215 } 216 217 add_action('wp_head', 'verowa_hook_add_metatags'); 218 219 220 221 222 223 add_action('parse_request', 'verowa_parse_request_update_custom_post_if_deprecated'); 216 217 } 218 219 220 221 } 222 223 224 224 225 225 226 /** … … 228 229 * @param WP $query 229 230 */ 230 function verowa_parse_request_update_custom_post_if_deprecated($query) 231 { 231 function verowa_parse_request_update_custom_post_if_deprecated($query) { 232 232 global $wpdb; 233 233 … … 235 235 if ( 236 236 key_exists('post_type', $query->query_vars ?? []) && 237 'verowa_event' === $query->query_vars['post_type'] ?? '' 238 ) { 237 'verowa_event' === $query->query_vars['post_type'] ?? '' ) { 239 238 $int_event_id = intval($query->query_vars['verowa_event'] ?? 0); 240 239 if ($int_event_id > 0) { 241 $str_query = 'SELECT `deprecated`FROM `' . $wpdb->prefix . 'verowa_events` ' .240 $str_query = 'SELECT * FROM `' . $wpdb->prefix . 'verowa_events` ' . 242 241 'WHERE `event_id` = ' . $int_event_id; 243 $is_deprecated = filter_var($wpdb->get_var($str_query), FILTER_VALIDATE_BOOLEAN); 244 if (true === $is_deprecated) { 245 $obj_update = new Verowa_Update_Controller(); 246 $obj_update->init('all'); 247 $obj_update->update_verowa_events_in_db($int_event_id); 242 $arr_ret = $wpdb->get_results( $str_query, ARRAY_A )[0] ?? array(); 243 $int_post_id = $arr_ret['post_id'] ?? 0; 244 $is_deprecated = filter_var( $arr_ret['deprecated_content'] ?? false, FILTER_VALIDATE_BOOLEAN ); 245 246 if ( true === $is_deprecated && $int_post_id > 0 ) { 247 $arr_event = json_decode( $arr_ret['content'], true ); 248 $arr_new_content = get_verowa_event_single_content( 0, $arr_event ); 249 250 $arr_post = array( 251 'ID' => intval( $int_post_id ?? 0 ), 252 'post_title' => wp_strip_all_tags( $arr_event['title'] ), 253 'post_content' => $arr_new_content['html'], 254 ); 255 256 verowa_general_update_custom_post( $arr_post, $arr_new_content['script'] ); 257 $wpdb->update( 258 $wpdb->prefix . 'verowa_events', 259 array( 260 'deprecated_content' => 0, 261 ), 262 array( 263 'event_id' => $int_event_id, 264 ), 265 array( '%d' ), 266 array( '%d' ) 267 ); 248 268 } 249 269 } … … 253 273 $int_person_id = intval($query->query_vars['verowa_person'] ?? 0); 254 274 if ($int_person_id > 0) { 255 $str_query = 'SELECT `deprecated`FROM `' . $wpdb->prefix . 'verowa_person` ' .275 $str_query = 'SELECT * FROM `' . $wpdb->prefix . 'verowa_person` ' . 256 276 'WHERE `person_id` = ' . $int_person_id; 257 $is_deprecated = filter_var($wpdb->get_var($str_query), FILTER_VALIDATE_BOOLEAN); 258 if (true === $is_deprecated) { 259 $obj_update = new Verowa_Update_Controller(); 260 $obj_update->init('all'); 261 $obj_update->update_or_insert_single_verowa_person($int_person_id); 277 $arr_ret = $wpdb->get_results($str_query, ARRAY_A)[0] ?? array(); 278 $int_post_id = $arr_ret['post_id'] ?? 0; 279 $is_deprecated = filter_var( $arr_ret['deprecated_content'] ?? false, FILTER_VALIDATE_BOOLEAN ); 280 if ( true === $is_deprecated && $int_post_id > 0) { 281 $arr_person = json_decode( $arr_ret['content'], true ); 282 $str_new_content = show_a_person_from_verowa_detail( $arr_person ); 283 284 $arr_title = []; 285 if('' != ($arr_person['firstname'] ?? '') ) { 286 $arr_title [] = $arr_person['firstname']; 262 287 } 288 289 // if there is the first name AND the surname, separate with a space 290 if ( '' != ($arr_person['lastname'] ?? '') ) { 291 $arr_title [] = $arr_person['lastname']; 292 } 293 294 $str_title = implode( ' ', $arr_title ); 295 296 $arr_post = array( 297 'ID' => intval( $int_post_id ?? 0 ), 298 'post_title' => $str_title, 299 'post_content' => $str_new_content, 300 ); 301 302 verowa_general_update_custom_post( $arr_post, '' ); 303 $wpdb->update( 304 $wpdb->prefix . 'verowa_person', 305 array( 306 'deprecated_content' => 0, 307 ), 308 array( 309 'person_id' => $int_person_id, 310 ), 311 array( '%d' ), 312 array( '%d' ) 313 ); 314 315 } 316 263 317 } 264 318 } 265 319 } 266 } 320 321 } -
verowa-connect/trunk/general/rest_routes.php
r2797642 r2821633 287 287 return array( 288 288 'version' => $plugin_data['Version'], 289 'php_version' => phpversion(),290 'str_dir' => $str_dir,291 289 'member' => get_option( 'verowa_instance', true ), 292 290 'culture' => get_locale(), -
verowa-connect/trunk/general/update_cron.php
r2797642 r2821633 24 24 25 25 /** 26 * Summary of deactivate_verowa_data_hooks26 * 27 27 */ 28 28 function deactivate_verowa_data_hooks() { … … 35 35 36 36 /** 37 * Activate Config.also use this function37 * Activate configuration also use this function 38 38 * 39 39 * @return bool -
verowa-connect/trunk/readme.txt
r2809632 r2821633 4 4 Requires at least: 5.0 5 5 Tested up to: 6.0.3 6 Stable tag: 2.11. 26 Stable tag: 2.11.3 7 7 Requires PHP: 7.3 8 8 License: GPLv2 or later … … 67 67 68 68 == Changelog == 69 70 = 2.11.3 = 71 * Update post content when the template is updated 72 * Reduce API CAlls 69 73 70 74 = 2.11.2 = -
verowa-connect/trunk/subscriptions/verowa_subscription_form.php
r2809632 r2821633 47 47 if ( 0 != $event_id ) { 48 48 $arr_ret_api_call = verowa_api_call( 'geteventdetails', $event_id, true ); 49 $arr_event_details = $arr_ret_api_call['data'][0] ;49 $arr_event_details = $arr_ret_api_call['data'][0] ?? []; 50 50 $int_request_status_code = $arr_ret_api_call['code']; 51 51 -
verowa-connect/trunk/verowa-connect.php
r2809632 r2821633 5 5 * Description: Include your Verowa data seamlessly into your WordPress project! 6 6 * Author: Picture-Planet GmbH 7 * Version: 2.11. 27 * Version: 2.11.3 8 8 * Requires at least: 5.2 9 9 * Requires PHP: 7.3
Note: See TracChangeset
for help on using the changeset viewer.