<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[10468] sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2: WordPress.tv: Split the big Category section into Date Recorded, Location, and Category.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/10468">10468</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/10468","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dd32</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-11-25 07:28:26 +0000 (Wed, 25 Nov 2020)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WordPress.tv: Split the big Category section into Date Recorded, Location, and Category.

The category section now excludes the Year & Location categories, which makes it easier to grok and select categories.

The year category is now not visible on the submit page, but set on the backend based on the date recorded option.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2anonuploadtemplatephp">sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php</a></li>
<li><a href="#sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2pluginswordpresstvanonuploadanonuploadphp">sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-anon-upload/anon-upload.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2anonuploadtemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php     2020-11-25 05:27:18 UTC (rev 10467)
+++ sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/anon-upload-template.php       2020-11-25 07:28:26 UTC (rev 10468)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -109,6 +109,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                .video-upload-left ul.cats-checkboxes {
</span><span class="cx" style="display: block; padding: 0 10px">                        height: 150px;
</span><span class="cx" style="display: block; padding: 0 10px">                        overflow: auto;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        margin-top: 4px;
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                .video-upload-left ul.cats-checkboxes ul.children {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -210,6 +211,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                case 14:
</span><span class="cx" style="display: block; padding: 0 10px">                        $message = "Error: please enter a valid WordPress.org username for the producer, or leave the field empty.";
</span><span class="cx" style="display: block; padding: 0 10px">                        break;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                case 15:
+                       $message = 'Error: form nonce was missing or invalid.';
+                       break;
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px">        $message = '<div class="error"><p>' . $message . '</p></div>';
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( !empty($_REQUEST['success']) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -216,6 +220,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $message = '<div class="success"> <p>Thank you for submitting a video; it was uploaded successfully.</p> <p>Submit another?</p> </div>';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+$selected_cats = [];
+if ( isset( $_GET['post_category'] ) ) {
+       // [ selected Id => 0.. ]
+       $selected_cats = array_flip( array_map( 'intval', $_GET['post_category'] ) );
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        <div class="wptv-hero">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -303,16 +313,45 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                <input type="date" id="wptv_date" name="wptv_date" value="<?php echo esc_attr( wp_unslash( $_GET['wptv_date'] ?? '' ) ); ?>" />
</span><span class="cx" style="display: block; padding: 0 10px">                                        </p>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        <div class="location">
+                                               <label for="wptv_location"><?php esc_html_e( 'Location' ); ?></label>
+                                               <ul class="cats-checkboxes">
+                                                       <?php
+
+                                                       foreach ( get_categories( [
+                                                               'parent'     => get_term_by( 'slug', 'location', 'category' )->term_id,
+                                                               'hide_empty' => false,
+                                                       ] ) as $term ) {
+                                                               printf(
+                                                                       '<li id="category-%1$d"><label class="selectit"><input value="%1$d" type="checkbox" name="post_category[]" id="in-category-%1$d" %2$s> %3$s</label></li>',
+                                                                       $term->term_id,
+                                                                       isset( $selected_cats[ $term->term_id ] ) ? 'checked="checked" ' : '',
+                                                                       $term->name,
+                                                               );
+                                                       }
+                                                       ?>
+                                               </ul>
+                                       </div>
+
</ins><span class="cx" style="display: block; padding: 0 10px">                                         <div class="cats">
</span><span class="cx" style="display: block; padding: 0 10px">                                                <label for="post_category"><?php esc_html_e( 'Category' ); ?></label>
</span><span class="cx" style="display: block; padding: 0 10px">                                                <ul class="cats-checkboxes">
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        include_once( ABSPATH . '/wp-admin/includes/template.php' );
-                                                       $selected_cats = false;
-                                                       if ( isset( $_GET['post_category'] ) ) {
-                                                               $selected_cats = array_map( 'intval', $_GET['post_category'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                 foreach ( get_categories( [
+                                                               'exclude_tree' => [
+                                                                       get_term_by( 'slug', 'location', 'category' )->term_id,
+                                                                       get_term_by( 'slug', 'year', 'category' )->term_id,
+                                                               ],
+                                                               'parent'       => 0,
+                                                               'hide_empty'   => false,
+                                                       ] ) as $term ) {
+                                                               printf(
+                                                                       '<li id="category-%1$d"><label class="selectit"><input value="%1$d" type="checkbox" name="post_category[]" id="in-category-%1$d" %2$s> %3$s</label></li>',
+                                                                       $term->term_id,
+                                                                       isset( $selected_cats[ $term->term_id ] ) ? 'checked="checked" ' : '',
+                                                                       $term->name,
+                                                               );
</ins><span class="cx" style="display: block; padding: 0 10px">                                                         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                        wp_category_checklist( 0, 0, $selected_cats, false, null, false );
</del><span class="cx" style="display: block; padding: 0 10px">                                                         ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                                </ul>
</span><span class="cx" style="display: block; padding: 0 10px">                                        </div>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -372,7 +411,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $( '#video-upload-form input[type="text"]#wptv_slides_url' ).prop( 'maxlength', 200 );
</span><span class="cx" style="display: block; padding: 0 10px">                        $( 'ul.cats-checkboxes input' ).prop( 'disabled', false );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $( '#wptv_video_wordcamp, ul.cats-checkboxes input' ).on( 'change', function() {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // Float selected items to the start.
+                       $( '.location ul.cats-checkboxes, .cats ul.cats-checkboxes' ).each( function() {
+                               var list = $(this),
+                                       selected = list.find( 'input:checked, #in-category-2648' ); // checked & World-Wide-Web
+
+                               selected.each( function() {
+                                       var li = $(this).parents( 'li' );
+                                       li.remove();
+                                       list.prepend( li );
+                               } );
+                       } );
+
+                       // Generate the Event Name
+                       $( '#wptv_video_wordcamp, .location ul.cats-checkboxes input, .cats ul.cats-checkboxes input, #wptv_date' ).on( 'change', function() {
</ins><span class="cx" style="display: block; padding: 0 10px">                                 if ( $( '#wptv_event' ).data('user-altered') ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        return;
</span><span class="cx" style="display: block; padding: 0 10px">                                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -379,10 +431,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                var title = '';
</span><span class="cx" style="display: block; padding: 0 10px">                                // Get the Location
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                title += $( '#category-6418 ul.children input:checked' ).parent().text().trim() + " ";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         title += $( '.location input:checked' ).parent().text().trim() + " ";
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                // .. and the Year
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                title += $( '#category-91093 ul.children input:checked' ).parent().text().trim();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         title += $( '#wptv_date' ).value.substring( 0, 4 );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                // If a location or year has been selected, build the Event Name.
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( $.trim( title ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -409,19 +461,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                $this.val( $this.val().replace( /\s(and|&|\+)\s/g, ', ' ).replace( /[ ]{2,}/g, ' ' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        });
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Pre-select the date category.
-                       $( '#wptv_date' ).on( 'change', function() {
-                               var year = parseInt( this.value.substring( 0, 4 ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $( '#wptv_video_wordcamp' ).on( 'change', function() {
+                               // WordCampTV cat
+                               $( '#in-category-12784353' ).prop( 'checked', $( this ).prop( 'checked' ) );
+                       });
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                // Blank the year selections.
-                               $( '#category-91093 ul.children input' ).prop( 'checked', false );
-
-                               // Check the year
-                               $( '#category-91093 ul.children input' ).filter( function() {
-                                       return parseInt( $(this).parent().text() ) === year;
-                               } ).prop( 'checked', true )
-                       } );
-
</del><span class="cx" style="display: block; padding: 0 10px">                         $( '#video-upload-form' ).submit( function( e ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                var scroll = false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="sitestrunkwordpresstvpublic_htmlwpcontentthemeswptv2pluginswordpresstvanonuploadanonuploadphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-anon-upload/anon-upload.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-anon-upload/anon-upload.php      2020-11-25 05:27:18 UTC (rev 10467)
+++ sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/plugins/wordpresstv-anon-upload/anon-upload.php        2020-11-25 07:28:26 UTC (rev 10468)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,68 +10,72 @@
</span><span class="cx" style="display: block; padding: 0 10px">        function __construct() {
</span><span class="cx" style="display: block; padding: 0 10px">                $this->drafts_author = apply_filters( 'wptv_drafts_author_id', $this->drafts_author );  // this is filterable in order to support local development
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                add_action( 'admin_post_wptv_video_upload', array( &$this, 'init' ) );
-               add_action( 'admin_post_nopriv_wptv_video_upload', array( &$this, 'init' ) );
-               add_action( 'dbx_post_sidebar', array( &$this, 'display' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         add_action( 'admin_post_wptv_video_upload', array( $this, 'init' ) );
+               add_action( 'admin_post_nopriv_wptv_video_upload', array( $this, 'init' ) );
+               add_action( 'dbx_post_sidebar', array( $this, 'display' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        function init() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( ! empty( $_POST['wptvvideon'] ) && wp_verify_nonce( $_POST['wptvvideon'], 'wptv-upload-video' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $redir = home_url( '/submit-video/' );
+
+               if (
+                       empty( $_POST['wptvvideon'] ) ||
+                       (
+                               empty( $_POST['wptv_uploaded_by'] ) &&
+                               ! wp_verify_nonce( $_POST['wptvvideon'], 'wptv-upload-video' )
+                       )
+               ) {
+                       $this->errors = 15; /* no-nonce / invalid nonce */
+               } else {
</ins><span class="cx" style="display: block; padding: 0 10px">                         $this->validate();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        if ( ! $this->errors ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                $this->success = $this->save();
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                }
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $redir = home_url( '/submit-video/' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         // Fields to prefill
+               $keep_fields = array(
+                       'wptv_video_wordcamp',
+                       'wptv_uploaded_by',
+                       'wptv_email',
+                       'wptv_language',
+                       'wptv_date',
+                       'post_category', // 'wptv_categories',
+                       'wptv_producer_username',
+                       'wptv_event',
+               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // Fields to prefill
-                       $keep_fields = array(
-                               'wptv_video_wordcamp',
-                               'wptv_uploaded_by',
-                               'wptv_email',
-                               'wptv_language',
-                               'wptv_date',
-                               'post_category', // 'wptv_categories',
-                               'wptv_producer_username',
-                               'wptv_event',
-                       );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( $this->success ) {
+                       $redir = add_query_arg( array( 'success' => 1 ), $redir );
+               } elseif ( $this->errors ) {
+                       $redir = add_query_arg( array( 'error' => $this->errors ), $redir );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( $this->success ) {
-                               $redir = add_query_arg( array( 'success' => 1 ), $redir );
-                       } elseif ( $this->errors ) {
-                               $redir = add_query_arg( array( 'error' => $this->errors ), $redir );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 // Video upload failed, include the video-specific fields in pre-fill.
+                       $keep_fields[] = 'wptv_video_title';
+                       $keep_fields[] = 'wptv_speakers';
+                       $keep_fields[] = 'wptv_video_description';
+                       $keep_fields[] = 'wptv_slides_url';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                // Video upload failed, include the video-specific fields in pre-fill.
-                               $keep_fields[] = 'wptv_video_title';
-                               $keep_fields[] = 'wptv_speakers';
-                               $keep_fields[] = 'wptv_video_description';
-                               $keep_fields[] = 'wptv_slides_url';
-
-                       } else {
-                               $keep_fields = array();
-                               $redir = add_query_arg( array( 'error' => 5 ), $redir );
-                       }
-
-                       // Keep some fields.
-                       if ( $keep_fields ) {
-                               $redir = add_query_arg(
-                                       urlencode_deep(
-                                               array_intersect_key(
-                                                       $_POST,
-                                                       array_flip( $keep_fields )
-                                               )
-                                       ),
-                                       $redir
-                               );
-                       }
-
-                       wp_redirect( $redir );
</del><span class="cx" style="display: block; padding: 0 10px">                 } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        // no nonce, send them "home"?
-                       wp_redirect( home_url() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $keep_fields = array();
+                       $redir = add_query_arg( array( 'error' => 5 ), $redir );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // Keep some fields.
+               if ( $keep_fields ) {
+                       $redir = add_query_arg(
+                               urlencode_deep(
+                                       array_intersect_key(
+                                               $_POST,
+                                               array_flip( $keep_fields )
+                                       )
+                               ),
+                               $redir
+                       );
+               }
+
+               wp_redirect( $redir );
</ins><span class="cx" style="display: block; padding: 0 10px">                 exit;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -304,7 +308,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $description       = $this->sanitize_text( $_posted['wptv_video_description'], false );
</span><span class="cx" style="display: block; padding: 0 10px">                $language          = $this->sanitize_text( $_posted['wptv_language'] );
</span><span class="cx" style="display: block; padding: 0 10px">                $slides            = $this->sanitize_text( $_posted['wptv_slides_url'] );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $recorded          = $this->sanitize_tett( $_posted['wptv_date'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $recorded          = $this->sanitize_text( $_posted['wptv_date'] ); // yyyy-mm-dd
</ins><span class="cx" style="display: block; padding: 0 10px">                 $ip                = $_SERVER['REMOTE_ADDR'];
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $categories = '';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -317,6 +321,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                // Add the year category.
+               if ( $recorded ) {
+                       $year = substr( $recorded, 0, 4 );
+                       if ( $term = get_term_by( 'name', $year, 'category' ) ) {
+                               $categories .= $term->term_id;
+                       }
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $post_meta = array(
</span><span class="cx" style="display: block; padding: 0 10px">                        'attachment_id'     => $attachment_id,
</span><span class="cx" style="display: block; padding: 0 10px">                        'submitted_by'      => $anon_author,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -480,6 +492,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                <p class="label">Date Recorded:</p>
</span><span class="cx" style="display: block; padding: 0 10px">                                                <p class="data">
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <input type="text" value="<?php echo esc_attr( $meta['recorded'] ); ?>"/>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                        <?php
+                                                               // Find the year cat
+                                                               $cat = get_term_by( 'name', substr( $meta['recorded'], 0, 4 ), 'category' );
+                                                               if ( $cat ) {
+                                                                       echo '<a href="#in-category-' . $cat->term_id . '" class="button-secondary anon-approve anon-cat-link" title="Click to approve">Approve</a>';
+                                                               }
+                                                       ?>
+                                                       
</ins><span class="cx" style="display: block; padding: 0 10px">                                                 </p>
</span><span class="cx" style="display: block; padding: 0 10px">                                        </div>
</span><span class="cx" style="display: block; padding: 0 10px">                                        <?php endif; ?>
</span></span></pre>
</div>
</div>

</body>
</html>