Advertisement
Guest User

Kevin Banet

a guest
Mar 20th, 2010
541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.27 KB | None | 0 0
  1. <?php
  2. require_once dirname( __FILE__ ) . '/form_process.php';
  3. get_header( );
  4. include_classified_form();
  5. ?>
  6.  
  7.     <?php
  8.     $gmaps_key = get_option('cp_gmaps_key');
  9.     if (!empty($gmaps_key)) {?>
  10.     <script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=<?php echo $gmaps_key; ?>" type="text/javascript"></script>
  11.     <?php  }?>
  12.  
  13.     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  14.     <div class="content">
  15.    
  16.         <div class="breadcrumb">
  17.             <?php if(function_exists('bcn_display')) { bcn_display(); } ?>
  18.         </div>
  19.        
  20. <div class="alignright" style="margin-top:-19px;"><?php previous_post_link('&laquo; %link', __('Previous','cp'), TRUE) ?>&nbsp;&nbsp;<?php next_post_link('%link &raquo;', __('Next','cp'), TRUE) ?></div>
  21.  
  22.         <div class="main ins">
  23.             <div class="left">
  24.                 <div class="title">
  25.                     <h2><?php the_title(); ?></h2>
  26.                     <div class="prices"><?php echo get_option('currency'); ?><?php echo get_post_meta($post->ID, "price", true); ?></div>
  27.                     <div class="clear"></div>
  28.                 </div>
  29.                 <div class="product">
  30.  
  31.                     <h3><?php _e('Description','cp'); ?></h3>
  32.                    
  33.                         <?php the_content(); ?>
  34.                    
  35.                     <br />
  36.                    
  37.                     <p class="prdetails">
  38.                     <?php if (get_post_meta($post->ID, "cp_adURL", true) != "") { ?>
  39.                     <strong><?php _e('URL:','cp'); ?></strong> <a target="_blank" rel="nofollow" href="<?php echo get_post_meta($post->ID, "cp_adURL", true); ?>"><?php echo get_post_meta($post->ID, "cp_adURL", true); ?></a><br />
  40.                     <?php } ?>
  41.                     <strong><?php _e('Tags','cp'); ?>:</strong> <?php the_tags( '', ', ', ''); ?><br />
  42.                     <strong><?php _e('Stats','cp'); ?>:</strong> <?php if (function_exists('todays_overall_count')) { todays_overall_count($post->ID, '', __('total views','cp'), __('so far today','cp'), '1', 'show'); } ?>   <br /><br />
  43.                    
  44.                     <?php if(function_exists('wp_email')) { email_link(); } ?>  
  45.                     <?php if(function_exists('wp_print')) { print_link(); } ?>  
  46.                     <?php edit_post_link(__('Edit Ad','cp'), '<br />', '<br />'); ?>   
  47.                     </p>   
  48.  
  49.                 <?php
  50.                 if (get_option('cp_gmaps') != "no") { ?>   
  51.                     <h3><?php _e('Item Location','cp'); ?></h3>
  52.                     <div id="gmap" style="padding:10px 0 40px 0;">
  53.                     <div id="map" style="height:300px;"></div>
  54.                    
  55.                     <script type="text/javascript">var address = "<?php echo get_post_meta($post->ID, "location", true); ?>";</script>
  56.                     <?php gmaps_js(); ?>  
  57.  
  58.                     </div>
  59.                 <?php  } ?>
  60.                
  61.                    
  62.                     <h3><?php _e('Images','cp'); ?></h3>
  63.                     <p class="prdetails">
  64.                     <?php if(function_exists('classi_lightbox')) {classi_lightbox(get_post_meta($post->ID, 'images', true)); } ?>
  65.                     </p>
  66.                
  67.  
  68.                    
  69.                         <?php cp_single_ad_336x280(); ?>           
  70.                    
  71.  
  72.                
  73.                
  74.                     <?php comments_template('',true); ?>
  75.            
  76.                 </div>
  77.             </div>
  78.             <div class="right">
  79.  
  80. <?php if (get_option('report_button') == "yes" || get_option('report_button') == "") {
  81.  
  82. if (isset($_POST['action']) && $_POST['action'] == 'report') {
  83.     $subject2 = __('URL reported for:') . get_the_title();
  84.     $condiment = strip_tags($_POST['condiment']);
  85.     $report_url = strip_tags($_POST['page_url']);
  86.  
  87.     if ( $condiment != "") {
  88.         exit;
  89.     }
  90.  
  91.     $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  92.     $ip = getenv("REMOTE_ADDR");
  93.  
  94.     $body = __('Someone has reported the following classified ad on your site: ','cp') . $report_url . "\n\n IP Address: " . $ip . "\n Server: " . $hostname ;
  95.     $admin_email = get_bloginfo('admin_email');
  96.     $email2 = $admin_email;
  97.     // $admin_email = "tester2@localhost";  // uncomment this for local testing
  98.     mail($admin_email,$subject2,$body,"From: $email2");
  99.     $email_ok = "ok";
  100.     unset($admin_email, $email2, $body, $subject2);
  101.     echo "<span style='float: left;color: red;'><b>" . __('The report has been sent!','cp') . "</b></span>";
  102. }
  103. ?>
  104.         <form action="<?php echo selfURL(); ?>" method="post">
  105.             <input type="text" class="condiment" name="condiment" value="" />
  106.             <input type="hidden" name="page_url" value="<?php echo selfURL(); ?>" />
  107.             <input type="submit" class="report" name="submit" value="" />
  108.             <input type="hidden" name="action" value="report" />
  109.         </form>
  110. <?php } ?>
  111.  
  112.  
  113.  
  114.         <span><?php _e('Posted By:','cp');?></span>
  115.    
  116.             <h1>
  117.             <?php if (get_the_author() != "") { ?>
  118.                 <a href="<?php bloginfo('url'); ?>/author/<?php echo strtolower(the_author_login()); ?>"><?php echo get_post_meta($post->ID, "name", true); ?></a>
  119.             <?php } else {
  120.                 echo get_post_meta($post->ID, "name", true);
  121.             } ?>
  122.             </h1>
  123.    
  124.         <div style="padding-left:15px;padding-top:10px;padding-bottom:5px;">
  125.             <div id="location"><?php echo get_post_meta($post->ID, "location", true); ?></div><br /><br />
  126.             <div id="listed"><?php the_time(get_option('date_format') . ' ' . get_option('time_format')) ?></div><br /><br />
  127.             <div id="phone"><?php echo get_post_meta($post->ID, "phone", true); ?></div><br /><br />
  128.            
  129.             <?php if (get_option('post_prun') == "yes" && get_post_meta($post->ID, "expires", true) != "") { ?>        
  130.             <div id="expires"><?php $get_expires = strtotime(get_post_meta($post->ID, "expires", true)); echo cp_timeleft($get_expires); ?>
  131.             </div><br /><br />
  132.             <?php } ?>     
  133.  
  134.            
  135.         </div>
  136.  
  137.                    
  138.            
  139.        
  140. <?php if (get_option('email_form') == "yes" || get_option('email_form') == "") { ?>
  141.     <div class="email_form">
  142.         <h3><a href="#" id="email-toggle"><?php _e('Contact Ad Owner','cp'); ?></a></h3><br />
  143. <?php
  144.     $email_err = "";
  145.     $email_ok = "";
  146. if (isset($_POST['action']) && $_POST['action'] == 'email') {
  147.     $subject2 = "Re: ".get_the_title();
  148.     $name2 = strip_tags($_POST['name2']);
  149.     $email2 = strip_tags($_POST['email2']);
  150.     $receiver_email = strip_tags($_POST['receiver_email']);
  151.     $receiver_email = str_replace("gd6j83ksl", "@", $receiver_email);
  152.     $receiver_email = str_replace("m3gd0374h", ".", $receiver_email);
  153.     $message2 = strip_tags($_POST['message2']);
  154.  
  155.     if ( $name2 == "") {
  156.         $email_err .= __('Enter your name','cp') . "<br />";
  157.     }
  158.  
  159.     if ( $email2 == "") {
  160.         $email_err .= __('Enter your email address','cp') . "<br />";
  161.     } else {
  162.         if ( !cp_check_email($email2) ) {
  163.             $email_err .= __('Email format is incorrect','cp') . "<br />";
  164.         }
  165.     }
  166.  
  167.     if ( $message2 == "") {
  168.         $email_err .= __('Enter a message','cp') . "<br />";
  169.     }
  170.  
  171.     $email_total = (int)$_POST['email_total'];
  172.     $email_nr1 = (int)$_POST['email_nr1']; $email_nr1 = str_replace("60293", "", $email_nr1);
  173.     $email_nr2 = (int)$_POST['email_nr2']; $email_nr2 = str_replace("36202", "", $email_nr2);
  174.     $email_nr1nr2 = $email_nr1 + $email_nr2;
  175.  
  176.     if ( $email_total != $email_nr1nr2 ) {
  177.         $email_err .= __('The spam field is incorrect','cp') . "<br />";
  178.     }
  179.  
  180.     if ( $email_err == "" ) {
  181.         $body = __('Someone is interested in your classified ad! They sent you a message from the following page:','cp') . "\n\n" . selfURL()."
  182.     \n
  183.     Name: $name2
  184.     Email: $email2
  185.     Message: $message2
  186.     ";
  187.     // $receiver_email = "tester@localhost"; //uncomment this line to test locally
  188.     // ini_set('sendmail_from', 'me@domain.com'); //this line might need to be enabled for some people using Windows hosted sites
  189.         mail($receiver_email,$subject2,$body,"From: $email2");
  190.         $email_ok = "ok";
  191.         unset($receiver_email, $name2, $email2, $message2, $subject2);
  192.     }
  193. }
  194. ?>
  195. <a name="email-form"></a>
  196. <?php
  197. if ( $email_err != "" ) {
  198.     echo "<div class=\"email_err\">$email_err</div>";
  199. }
  200. ?>
  201. <?php
  202. if ( $email_ok == "ok" ) {
  203.     echo "<div class=\"email_ok\">" . __('Your email has been sent.','cp') . "</div>";
  204. }
  205. ?>
  206.  
  207. <?php if (get_option('expand_email_form') == "yes" ) { ?>      
  208.                     <div id="email_form_data">
  209.                     <?php } else { ?>
  210.                     <div id="email_form_data" <?php if ($email_err == "") { echo "style=\"display: none;\""; } ?>>
  211.                     <?php } ?>
  212.  
  213.                    
  214.  
  215.                     <form action="<?php the_permalink(); ?>#email-form" method="post">
  216.                         <?php _e('Name','cp'); ?>:<br /><input type="text" name="name2" value="<?php echo $name2;?>" /><br />
  217.                         <?php _e('Email','cp'); ?>:<br /><input type="text" name="email2" value="<?php echo $email2;?>" /><br />
  218.                         <?php _e('Subject','cp'); ?>:<br />
  219.                         <div class="like_input"><?php _e('Re:','cp'); ?> <?php the_title(); ?></div><br />
  220.                         <?php _e('Message','cp'); ?>:<br /><textarea name="message2" rows="1" cols="2"><?php echo $message2;?></textarea>
  221.                         <input type="hidden" name="action" value="email" />
  222.                         <input type="hidden" name="receiver_email" value="<?php email_spam(get_post_meta($post->ID, "email", true)); ?>" />
  223.             <div class="capcha" style="text-align: center;">
  224.                             <?php
  225.                             $email_nr1 = rand("0", "9");
  226.                             $email_nr2 = rand("0", "9");
  227.                             ?>
  228.                 <?php echo $email_nr1; ?> + <?php echo $email_nr2; ?> = <input type="text" name="email_total" class="email_captcha" maxlength="2" value="" /> &nbsp;
  229.                 <input type="hidden" name="email_nr1" value="60293<?php echo $email_nr1; ?>" />
  230.                 <input type="hidden" name="email_nr2" value="36202<?php echo $email_nr2; ?>" />
  231.             </div><br />
  232.                         <input type="submit" style="width:240px;" name="send" value="<?php _e('Send Email','cp'); ?>" />
  233.                     </form>
  234.                     </div>
  235.                 </div>
  236. <?php } ?>             
  237.                            
  238.  
  239.                 <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Ads Sidebar')) : else : ?>
  240.                 <!-- no dynamic sidebar so don't do anything -->
  241.                 <?php endif; ?>
  242.             </div>
  243.             <div class="clear"></div>
  244.         </div>
  245.     </div>
  246.     <?php endwhile; endif; ?>
  247.    
  248.  
  249. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement