function atw_posts_restore_filter() { if (!(isset($_POST['uploadit']) && $_POST['uploadit'] == 'yes')) { return; } // upload theme from users computer // they've supplied and uploaded a file // echo '<pre>'; print_r($_FILES); echo '</pre>'; $ok = true; // no errors so far if (isset($_FILES['post_uploaded']['name'])) { $filename = $_FILES['post_uploaded']['name']; } else { $filename = ""; } if (isset($_FILES['post_uploaded']['tmp_name'])) { $openname = $_FILES['post_uploaded']['tmp_name']; } else { $openname = ""; } //Check the file extension $check_file = strtolower($filename); $pat = '.'; // PHP version strict checking bug... $end = explode($pat, $check_file); $ext_check = end($end); if ($filename == "") { $errors[] = 'You didn\'t select a file to upload.' . "<br />"; $ok = false; } if (!$ok) { echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">' . 'ERROR' . '</em></strong></p><p>'; foreach ($errors as $error) { echo $error . '<br />'; } echo '</p></div>'; } else { // OK - read file and save to My Saved Theme // $handle has file handle to temp file.// $contents = file_get_contents($openname); if (!atw_posts_set_to_serialized_values($contents)) { echo '<div id="message" class="updated fade"><p><strong><em style="color:red;">' . 'Sorry, there was a problem uploading your file. The file you picked was not a valid Weaver Show Posts settings file.' . '</em></strong></p></div>'; } else { atw_posts_save_msg('Weaver Show Posts set to uploaded Filter.'); } } }
function atw_posts_save_showposts_opts() { if (atw_posts_get_POST('textWidgetShortcodes') != '') { atw_posts_setopt('textWidgetShortcodes', true); } else { atw_posts_setopt('textWidgetShortcodes', false); } atw_posts_save_all_options(); // and save them to db atw_posts_save_msg('Show Posts Options saved'); }