Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: Jobs
- *
- * A custom page template without sidebar.
- *
- * The "Template Name:" bit above allows this to be selectable
- * from a dropdown menu on the edit page screen.
- *
- * @package WordPress
- * @subpackage Twenty_Ten
- * @since Twenty Ten 1.0
- */
- /* Mailer with Attachments */
- $action = "";
- $action = $_REQUEST['action'];
- global $action;
- function showForm() {
- echo '<form enctype="multipart/form-data" name="send" method="post">
- <input type="hidden" name="action" value="send" />
- <input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
- <p>Name: <input name="from_name" size="40" /></p>
- <p>Email: <input name="from_email" size="40" /></p>
- <p>Subject: <input name="subject" size="40" /></p>
- <p>Message: <textarea name="body" rows="5" cols="31"></textarea></p>
- <p>Attachment: <input type="file" name="attachment" size="30" /></p>
- <p><input type="submit" value="Send Your CV" /></p>';
- }
- function sendMail() {
- $from_name = stripslashes($_POST['from_name']);
- $subject = stripslashes($_POST['subject']);
- $body = stripslashes($_POST['body']);
- $attachment = $_FILES['attachment']['tmp_name'];
- $attachment_name = $_FILES['attachment']['name'];
- // check for valid file types
- if (is_uploaded_file($attachment)) { //Do we have a file uploaded?
- $allowedExtensions = array("doc","docx","txt");
- foreach ($_FILES as $file) {
- if ($file['tmp_name'] > '') {
- if (!in_array(end(explode(".",
- strtolower($file['name']))),
- $allowedExtensions)) {
- die($file['name'].' is an invalid file type!
- '.
- ''.
- '<< Go Back');
- }else{
- $fp = fopen($attachment, "rb"); //Open it
- $data = fread($fp, filesize($attachment)); //Read it
- $data = chunk_split(base64_encode($data)); //Chunk it up and encode it as base64 so it can emailed
- fclose($fp);
- }
- }
- }
- }
- //Let's start our headers
- $headers = "From: $from_name<" . $_POST['from_email'] . ">\n";
- $headers .= "Reply-To: <" . $_POST['from_email'] . ">\n";
- $headers .= "MIME-Version: 1.0\n";
- $headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n";
- $headers .= "X-Sender: $from_name<" . $_POST['from_email'] . ">\n";
- $headers .= "X-Mailer: PHP4\n";
- $headers .= "X-Priority: 3\n"; //1 = Urgent, 3 = Normal
- $headers .= "Return-Path: <" . $_POST['from_email'] . ">\n";
- $headers .= "This is a multi-part message in MIME format.\n";
- $headers .= "------=MIME_BOUNDRY_main_message \n";
- $headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n";
- $message = "------=MIME_BOUNDRY_message_parts\n";
- $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
- $message .= "Content-Transfer-Encoding: quoted-printable\n";
- $message .= "\n";
- /* Add our message, in this case it's plain text. You could also add HTML by changing the Content-Type to text/html */
- $message .= "$body\n";
- $message .= "\n";
- $message .= "------=MIME_BOUNDRY_message_parts--\n";
- $message .= "\n";
- $message .= "------=MIME_BOUNDRY_main_message\n";
- $message .= "Content-Type: application/octet-stream;\n\tname=\"" . $attachment_name . "\"\n";
- $message .= "Content-Transfer-Encoding: base64\n";
- $message .= "Content-Disposition: attachment;\n\tfilename=\"" . $attachment_name . "\"\n\n";
- $message .= $data; //The base64 encoded message
- $message .= "\n";
- $message .= "------=MIME_BOUNDRY_main_message--\n";
- // send the message
- mail("admin@primarycarecommunity.net", $subject, $message, $headers);
- print "Mail sent. Thank you for using the Mailer.";
- }
- ?>
- <!DOCTYPE html>
- <html <?php language_attributes(); ?>>
- <head>
- <meta charset="<?php bloginfo( 'charset' ); ?>" />
- <title><?php
- /*
- * Print the <title> tag based on what is being viewed.
- */
- global $page, $paged;
- wp_title( '|', true, 'right' );
- // Add the blog name.
- bloginfo( 'name' );
- // Add the blog description for the home/front page.
- $site_description = get_bloginfo( 'description', 'display' );
- if ( $site_description && ( is_home() || is_front_page() ) )
- echo " | $site_description";
- // Add a page number if necessary:
- if ( $paged >= 2 || $page >= 2 )
- echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
- ?></title>
- <link rel="profile" href="http://gmpg.org/xfn/11" />
- <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
- <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
- <?php
- /* We add some JavaScript to pages with the comment form
- * to support sites with threaded comments (when in use).
- */
- if ( is_singular() && get_option( 'thread_comments' ) )
- wp_enqueue_script( 'comment-reply' );
- /* Always have wp_head() just before the closing </head>
- * tag of your theme, or you will break many plugins, which
- * generally use this hook to add elements to <head> such
- * as styles, scripts, and meta tags.
- */
- wp_head();
- ?>
- </head>
- <body <?php body_class(); ?>>
- <div id="wrap">
- <div id="header">
- <img class="sitename" src="<?php bloginfo('template_directory'); ?>/images/logo.gif"/>
- <div id="topnav">
- <ul>
- <li id="hom"><a href="http://www.primarycarecommunity.net">Home</a></li>
- <li id="new"><a href="../news">News</a></li>
- <li id="eve"><a href="../events">Events Calendar</a></li>
- <li id="ser"><a href="../services">Services</a></li>
- <li id="abo"><a href="../about">About Us</a></li>
- <li id="con"><a href="../contact">Contact Us</a></li>
- <li id="vac"><a href="../vacancies">Vacancies</a></li>
- <li id="for"><a href="../forum">Forum</a></li>
- <li id="mem"><a href="../members">Members Zone</a></li>
- </ul>
- </div>
- <div class="clear"></div>
- <div id="headercolumn1">
- <p class="description">There are approximately 8900 GP practices in England, each with one or two practice managers and assistant/deputy managers. Some are new to the industry and others have been within primary care management for many years. We are here to help you share your knowledge and experiences in order to help others progress in their career. <a href="about.html" title="About Us">Read more...</a></p>
- </div>
- <div id="headercolumn2">
- <div id="search_top">
- <form action="/search/search.php" method="get">
- <p><input type="text" name="query" id="query" class="keyword"/> </p>
- <p class="button"><input name="" type="image" src="<?php bloginfo('template_directory'); ?>/images/searchbutton.gif" alt="Search" /></p>
- <p class="hide"> <input type="hidden" name="search" value="1" /> </p>
- </form>
- </div>
- </div>
- <div class="clear"></div>
- </div> <!-- End of Header -->
- <div id="contents">
- <div id="left">
- <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
- <div id="post-<?php the_ID(); ?>" class="post">
- <div class="entry-content">
- <?php the_content(); ?>
- <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
- </div><!-- .entry-content -->
- </div><!-- #post-## -->
- <?php endwhile; ?>
- <div class="post">
- <?php query_posts('cat=4');
- if (have_posts()) : while (have_posts()) : the_post(); ?>
- <li>
- <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
- <p class="listtitle"><?php the_title_attribute(); ?></p></a>
- <p class="listmeta">Published on: <?php the_time('F jS, Y'); ?></p>
- <div class="entry-content">
- <?php the_excerpt(); ?>
- </div><!-- .entry-content -->
- </li>
- <?php endwhile; ?>
- <?php else : ?>
- <h2>Nothing Found</h2>
- <?php endif; ?>
- </div>
- </div>
- <div id="right">
- <?php
- switch ($action) {
- case "send":
- sendMail();
- showForm();
- break;
- default:
- showForm();
- }
- ?>
- </div>
- <div class="clear"></div>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement