downloader/template-digital-download.php

84 lines
2.8 KiB
PHP
Raw Permalink Normal View History

<?php
/*
Template Name: Digital Download
*/
if ( isset( $_POST['c'] )) {
/*
if (
! isset( $_POST['dl_start'] )
|| ! wp_verify_nonce( $_POST['dl_start'], ABSPATH . '/digital-download' )
) {
print 'Sorry, your nonce did not verify.';
exit;
} else {
*/
// process form data
require_once( ABSPATH. 'wp-content/plugins/vinyl-download/VinylDownload.class.php');
$d = new VinylDownload;
error_log( "Hello, errors!" , 0 );
$c = $_POST['c'];
$f = $_POST['sel_format'];
$d->code = $c;
$d->database = ( ABSPATH . 'db/vinyl-dl-codes.sqlite' );
$d->wav_file = ( ABSPATH . 'wp-content/uploads/Rainer von Vielen - Ueberall Chaos (WAV-24bit).zip');
$d->mp3_file = ( ABSPATH . 'wp-content/uploads/Rainer von Vielen - Ueberall Chaos (mp3-320kbps).zip');
if ( $row = $d->query_code($d->code)) {
// max count not reached
if ( false === $d->reached_max_dl( $row['count'] ) )
$d->dl_trigger($f);
}
}
// }
get_header();
global $wp_query, $post;
$page_layout = get_post_meta($wp_query->post->ID, '_page_layout', true);
$custom_sidebar = get_post_meta($wp_query->post->ID, '_custom_sidebar', true);
$page_layout = isset($page_layout) && $page_layout != '' ? $page_layout = $page_layout : $page_layout = 'sidebar_right';
// Include page header
if (isset($post)) include_once(THEME . '/includes/page_header.php');
?>
<section id="main-content" class="container clearfix">
<!-- main -->
<section <?php if ($page_layout != 'wide') echo 'id="main"'; ?> class="clearfix">
<style scoped>input {border: 1px solid grey !important;} </style>
<p>Der Code funktioniert 3 mal. Nach Eingabe erscheint ein „Start”-Button der den Download startet. <br />Probleme? Email: <a href="mailto:dan@rainervonvielen.de">dan@rainervonvielen.de</a>
<form method="post" id="code_form">
<p>
<label for="format">Format wählen :</label>
<select name="format">
<option value="mp3" selected > mp3 ( 116 MB )</option>
<option value="wav" > wav ( 661 MB )</option>
</select>
<p><input width= "8" placeholder="Code eingeben" required pattern="[A-Za-z0-9]{8}" maxlength=8 minlength=8 type="text" id="code" name="code"></input>
<p><input type="submit" value="Einlösen" class ="btn middle"></input>
</form>
<div id="resp"></div>
</section>
<!-- /main -->
<?php if ($page_layout == 'sidebar_right') : ?>
<!-- sidebar -->
<aside class="sidebar">
<?php if ($custom_sidebar == '' || $custom_sidebar == '_default') : ?>
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Default')) ?>
<?php else : ?>
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar($custom_sidebar)) ?>
<?php endif; ?>
</aside>
<?php endif; ?>
</section>
<?php get_footer(); ?>