<?php $GLOBALS['SEP_DISABLED'] = 1;?>
<?php 
// blank img code is on line 458

// Prints out all entrant notification information for manual emailing of entry acceptance emails
// If email is working, this form also sends all emails to gkornbluth@jkwebdesigns.com


  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
 $dirsToCheck = array('/hsphere/local/home/apbcweb/artistsofpalmbeachcounty.org/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
  if (!$CURRENT_USER) { websiteLogin_redirectToLogin(); }
  list($common_informationRecords, $common_informationMetaData) = getRecords(array(
    'tableName'   => 'common_information',
    'allowSearch' => '0',
    'limit'       => '1',
	// 'debugSql' => true, 
  ));
  $common_informationRecord = @$common_informationRecords[0]; // get first record

  ?>
<?php         
list($master_exhibition_listRecords, $master_exhibition_listMetaData) = getRecords(array(
'tableName' => 'master_exhibition_list',

));
list($e_blast_events_noticeRecords, $e_blast_events_noticeMetaData) = getRecords(array(
    'tableName'   => 'e_blast_events_notice',
 
  ));
  
  
?>
<?php   
$numToName = array(); 
foreach ($master_exhibition_listRecords as $record){ 
  $numToName[$record['num']] = $record['title']; 


}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>Welcome to the Artists of Palm Beach County -  Exhibition Acceptance/Rejection Emails</title>
<link href="css/apbc900.css" type="text/css" rel="stylesheet" media="all" />
<link rel="stylesheet" type="text/css" href="css/anylinkcssmenu.css" />
<script type="text/javascript" src="Scripts/anylinkcssmenu.js">

/***********************************************
* AnyLink CSS Menu script v2.0- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Project Page at http://www.dynamicdrive.com/dynamicindex1/anylinkcss.htm for full source code
***********************************************/

</script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body bgcolor="#9b97ad">
<?php
    function mobile_detection ()
{
	if (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE']))
		return true;
 if (isset ($_SERVER['HTTP_ACCEPT']))
	{
		$accept = strtolower($_SERVER['HTTP_ACCEPT']);
		if (strpos($accept, 'wap') !== false)
			return true;
	}

	if (isset ($_SERVER['HTTP_USER_AGENT']))
	{
			if (strpos ($_SERVER['HTTP_USER_AGENT'], 'Android') !== false)
			return true;
			
			if (strpos ($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false)
			return true;
			
			if (strpos ($_SERVER['HTTP_USER_AGENT'], 'iPhone') !== false)
			return true;
			if (strpos ($_SERVER['HTTP_USER_AGENT'], 'ipad') !== false)
			return true;
			if (strpos ($_SERVER['HTTP_USER_AGENT'], 'iPod') !== false)
			return true;


		if (strpos ($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false)
			return true;
	}

	return false;
}
    ?>
<table bgcolor="#7C7164" align="center" width="1085" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left"><?php if (mobile_detection()) : ?>
      <img src="images/APBC-LOGO.png" width="800" height="183" />
      <?PHP else: ?>
      <script type='text/javascript'>
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0','height','180','width','100%','pluginspage','http://www.macromedia.com/go/getflashplayer','src','images/masthead','wmode','transparent','quality','best','play','true','movie','images/masthead' );
</script>
      <noscript>
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" height="180" width="100%">
        <param name="movie" value="images/masthead.swf" />
        <param name="quality" value="best" />
        <param name="play" value="true" />
        <param name="wmode" value="transparent" />
        <embed height="188" pluginspage="http://www.macromedia.com/go/getflashplayer" src="images/masthead.swf" type="application/x-shockwave-flash" width="100%" wmode="transparent" quality="best" play="true"></embed>
      </object>
      </noscript>
      <?PHP endif ?></td>
  </tr>
</table>
<table align="center" width="1085" border="0" cellspacing="0" cellpadding="20">
  <tr>
    <td valign="top" rowspan="3" width="107" bgcolor="#66594b" ><!-- #BeginLibraryItem "/Library/LeftNav.lbi" -->
      <table  width="107"  border="0" cellspacing="0"  cellpadding="4" height="600" >
        <tr>
          <td align="left" valign="top"><p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p class="special-non-link">
              <?php if (mobile_detection()) : ?>
              Tap To<br />
              Expand<br />
              Menus
              <?PHP else: ?>
              Rollover<br />
              To Expand<br />
              Menus
              <?PHP endif ?>
            </p>
            <p><a href="http://www.artistsofpalmbeachcounty.org/index.php">Home </a></p>
            <p><a href="#" class="anchorclass" rel="submenu1<?php if (mobile_detection()) : ?>[click]<?PHP endif ?>" rev="lr">About&nbsp;&nbsp;&nbsp;<img src="http://www.artistsofpalmbeachcounty.org/images/pointer2.gif" style="border-width:0;  position:relative; left: 0px; top:2px" /><br />
              APBC</a></p>
            <div id="submenu1" class="anylinkcss">
              <ul>
                <li><a href="http://www.artistsofpalmbeachcounty.org/whoweare.php">Who We Are</a></li>
                <li><a href="http://www.artistsofpalmbeachcounty.org/boardofdirectors.php">Board of<br />
                  &nbsp;Directors</a></li>
                <li><a href="http://www.artistsofpalmbeachcounty.org/committees.php">Committees</a></li>
                <li><a href="http://www.artistsofpalmbeachcounty.org/bylaws.php">By-Laws</a></li>
                <li><a href="http://www.artistsofpalmbeachcounty.org/pdf/2007-bylaws.pdf">By-Laws (PDF)</a></li>
                <li><a href="http://www.artistsofpalmbeachcounty.org/ourmission.php">Mission<br />
                  &nbsp;Statement</a></li>
                <li><a href="http://www.artistsofpalmbeachcounty.org/history.php">History</a></li>
                <li><a href="http://www.artistsofpalmbeachcounty.org/webterms.php">Terms of<br />
                  &nbsp;Service</a></li>
              </ul>
            </div>
            <p> <a  href="http://www.artistsofpalmbeachcounty.org/artists.php">APBC Artists</a></p>
            <p><a href="#" class="anchorclass" rel="submenu2<?php if (mobile_detection()) : ?>[click]<?PHP endif ?>" rev="lr">Meetings&nbsp;&nbsp;&nbsp;<img src="http://www.artistsofpalmbeachcounty.org/images/pointer2.gif" style="border-width:0;  position:relative; left: 0px; top:2px" /></a></p>
            <div id="submenu2" class="anylinkcss">
              <ul>
                <li><a href="http://www.artistsofpalmbeachcounty.org/meetings.php"><?php echo $common_informationRecord['member_meetings'] ?></a></li>
                <li><a href="http://www.artistsofpalmbeachcounty.org/boardmeetings.php">Board Meetings</a></li>
              </ul>
            </div>
            <p><a href="http://www.artistsofpalmbeachcounty.org/events.php">What's Happening Now!</a></p>
            <?php if ($common_informationRecord['lake_park_ledger']==1):?>
            <p><a href="http://www.artistsofpalmbeachcounty.org/lakepark.php">Lake Park Ledger</a></p>
            <?PHP endif ?>
            <p><a href="http://www.artistsofpalmbeachcounty.org/special-events.php"  >Special Events</a></p>
            <p><a href="http://www.artistsofpalmbeachcounty.org/photographerscorner.php" >Photographer's Corner</a></p>
            <p><a href="http://www.artistsofpalmbeachcounty.org/writerscorner.php"  >Writer's Corner</a></p>
            <p><a href="http://www.artistsofpalmbeachcounty.org/becomeamember.php"  >Become a<br />
              member</a></p>
            <p><a href="#" class="anchorclass" rel="submenu3<?php if (mobile_detection()) : ?>[click]<?PHP endif ?>" rev="lr">Members&nbsp;&nbsp;&nbsp;<img src="http://www.artistsofpalmbeachcounty.org/images/pointer2.gif" style="border-width:0;  position:relative; left: 0px; top:2px" /><br />
              Only</a></p>
            <div id="submenu3" class="anylinkcss">
              <ul>
                <li><a href="http://www.artistsofpalmbeachcounty.org/access_menu.php">Access to Members Only Pages</a></li>
                <li><a href="http://www.artistsofpalmbeachcounty.org/member_reminder.php">Forget Your Login Info?</a></li>
                <li><a href="http://www.artistsofpalmbeachcounty.org/specialwebpage.php">Get a Personal<br />
                  &nbsp;Web Page</a></li>
              </ul>
            </div>
            <p><a href="http://www.artistsofpalmbeachcounty.org/membersblogs.php"  >Member's<br />
              Blogs</a></p>
            <p><a href="http://www.artistsofpalmbeachcounty.org/pastevents.php">Past Event<br />
              Image Galleries</a></p>
            <p><a href="http://www.artistsofpalmbeachcounty.org/artavox.php">Artavox 2009<br />
              &nbsp;Presentation</a></p>
            <p><a href="http://www.artistsofpalmbeachcounty.org/contributors.php"  >Supporters</a></p>
            <p><a href="http://www.artistsofpalmbeachcounty.org/resources.php"  >Resources</a></p>
            <p><a href="http://www.artistsofpalmbeachcounty.org/contact.php"  >Contact Us</a></p>
            <p><a href="http://www.artistsofpalmbeachcounty.org/faq.php"  >FAQ</a></p>
            <p><a href="http://www.facebook.com/pages/Artists-of-Palm-Beach-County/124543357559891" target="_blank" > <img src="http://www.artistsofpalmbeachcounty.org/images/facebook.gif" width="92"  alt="Facebook" /></a></p></td>
        </tr>
      </table>
      <table width="107"  border="0" cellspacing="0"  cellpadding="4" >
        <tr>
          <td valign="bottom"><br />
            <div align="left" >&nbsp;</div></td>
        </tr>
      </table>
      <!-- #EndLibraryItem --><br />
      <br /></td>
    <td valign="top" align="center" bgcolor="#7C7164"  ><div align="center">
        <h2 class="heading-text-bold">FIRST EXHIBITION ACCEPTANCE EMAIL TEST<br />
          PRINTS OUT ALL ENTRANT NOTIFICATION INFORMATION FOR MANUAL EMAILING OF ACCEPTANCE EMAILS<br />
          NOTE: If email is working, this form also sends all emails to gkornbluth@jkwebdesigns.com</h2>
      </div>
      <?php if (@$CURRENT_USER['isAdmin'] || strpos(@$CURRENT_USER['allowedFolders'], 'exhibition_manager')): ?>
      
      <!--<div align="left"><span class="heading-text-bold">You can only send acceptance/rejection emails to exhibition entrants after that <br />
exhibition's jurying has ended, and on or before before the Artists Notification date.<br /></span></div><br />--><br />
      <br />
      <div align="left">
      <?php if(@isset($_REQUEST['submit_count'])){ 
	$count = $_REQUEST['submit_count'] + 1; 
}else{ 
	$count = 0; 
} 
 
?>
      <form method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>">
        <input name="submit_count" type="hidden" value="<?php echo $count; ?>" />
        <select name="where">
          <option value="">Select an Exhibition</option>
          <?php foreach($numToName as $num => $name): ?>
          <option value="<?php echo $num;?>"><?php echo $name;?></option>
          <?php endforeach?>
        </select>
        <br />
        <br />
        <input type = "checkbox" id="send_this" name="send_this" value = "1" <?php checkedIf(1, @$_REQUEST['send_this']);?> />
        <label for='send_this'> <span class="body-text-bold">Check This Box When You're Ready To Send Emails</span>&nbsp; </label>
        <br />
        <br />
        
        <!--<input type="submit" name="submitForm" value="<After You've Select An Exhibition And Checked The Box Above, Click Here To Send E-mails To All Applicants">-->
        <input type="submit" name="submitForm" value="Click Here To Send Individual E-mails To Each Applicant">
      </form>
      <?php $agree = $CURRENT_USER['allowedFolders'] ?>
      <?php 
 $where = ""; 
  ?>
      <?php foreach ($master_exhibition_listRecords as $record): ?>
      <?php if (strpos($agree, 'exhibition_manager')|| @$CURRENT_USER['isAdmin']): ?>
      <?php if ($FORM['where'] == $record['num']) { $where = $record['title'];}?>
      <?php endif ?>
      <?php endforeach; ?>
      <?php
 list($client_uploadsRecords, $client_uploadsMetaData) = getRecords(array(  
    'tableName'   => 'client_uploads',  
    'where'       => " project_title = '$where'",  
	
  ));

?>
      <?php //Title formatting works on both first and last word.
function RemoveShouting($instruction)
{
 $lower_exceptions = array(
        "to" => "1", "a" => "1", "the" => "1", "and" => "1", "but" => "1", "or" => "1", "for" => "1", "nor" => "1", "of" => "1"
 );
                                     
 $higher_exceptions = array(
        "I" => "1", "II" => "1", "III" => "1", "IV" => "1",
        "V" => "1", "VI" => "1", "VII" => "1", "VIII" => "1",
        "IX" => "1", "X" => "1"
 );

 $words = split(" ", $instruction);
 $newwords = array();

 foreach ($words as $word)
 {
       $firstElement = ($word == reset($words));
	   $lastElement = ($word == end($words));
	    
		if (!$higher_exceptions[$word]) {$word = strtolower($word);}
        if ((!$lower_exceptions[$word]) || ($word == $firstElement) || ($word == $lastElement) ) {$word = ucfirst($word);}
         array_push($newwords, $word);
 
 }
       
 return join(" ", $newwords); 
}
?>
      <?php // Capitalize both parts of a hyphenated name 
	    function ucwordsHyphen($last_name){
    return str_replace('- ','-',ucwords(str_replace('-','- ',$last_name)));
}
?>
      <?php // Capitalize both parts of an instruction with an ' (conflicts with RemoveShouting)
	    function ucwordsApostrophe1($instruction){
    return str_replace("' ","'",ucwords(str_replace("'","' ",$instruction)));
}
?>
      <?php // Capitalize both parts of a last_name with an ' 
	    function ucwordsApostrophe($last_name){
    return str_replace("' ","'",ucwords(str_replace("'","' ",$last_name)));
}
?>
      <br />
      <?php foreach ($e_blast_events_noticeRecords as $record): ?>
      <?php if (@$where == @$record['master_exhibition_title:label']):?>
      <?php $start_date_for_jurying = @$record['start_date_for_jurying'] ?>
      <?php $end_date_for_jurying = @$record['end_date_for_jurying'] ?>
      <?php $artist_notification_date = @$record['artist_notification_date'] ?>
      <?php $art_drop_off_date= @date("l F jS, Y", strtotime($record['art_drop_off_date_and_start_time'])) ?>
      <?php $art_drop_off_start_time = @date("g:i a", strtotime($record['art_drop_off_date_and_start_time'])) ?>
      <?php $art_drop_off_time_end = @$record['art_drop_off_time_end'] ?>
      <?php $exhib_recnum = @$record['num'] ?>
      <?php $acceptance_email_message_1 = @$record['acceptance_email_message_1'] ?>
      <?php $acceptance_email_message_2 = @$record['acceptance_email_message_2'] ?>
      <?php endif ?>
      <?php endforeach; ?>
      <?php
$endDate = date("M jS, Y", strtotime($end_date_for_jurying))
;// end date

// echo "The End Date: ".$endDate."<br>";

//Add one day to endt date
$dateplus1 = strtotime(date("M jS, Y", strtotime($endDate)) . " +1 day");
// echo date('M jS, Y', $dateplus1);

?>
      <br />
      <?php if ($where &&(@$CURRENT_USER  && strtotime($start_date_for_jurying) >= time())):?>
      <?php $allow_send = '0' ?>
      <span class="error-text-yellow-italic">Jurying for this exhibition begins on <?php echo date("M jS, Y", strtotime($start_date_for_jurying)) ?> and ends on <?php echo date("M jS, Y", strtotime($end_date_for_jurying)) ?>.<!--<br />You can send acceptance emails after jurying ends, on <?php echo date("M jS, Y", strtotime($end_date_for_jurying)) ?>.--><br />
      Send acceptance/rejection emails on or before the Artists Notification date, which is <?php echo date("M jS, Y", strtotime($artist_notification_date)) ?>.<br />
      <br />
      </span>
      <?php elseif ($where && (@$CURRENT_USER  && (strtotime($start_date_for_jurying) <= time() && strtotime(date('M jS, Y', $dateplus1)) >= time()))):?>
      <?php $allow_send = '0' ?>
      <span class="error-text-yellow-italic">Jurying for this exhibition began on <?php echo date("M jS, Y", strtotime($start_date_for_jurying)) ?> and will end at midnight (Eastern Time) on <?php echo date("M jS, Y", strtotime($end_date_for_jurying)) ?>.<!--<br />You can send acceptance emails after jurying ends, on <?php echo date("M jS, Y", strtotime($end_date_for_jurying)) ?>.--><br />
      Send acceptance/rejection emails on or before the Artists Notification date, which is <?php echo date("M jS, Y", strtotime($artist_notification_date)) ?>.<br />
      <br />
      </span>
      <?php elseif ($where && (@$CURRENT_USER &&  strtotime(date('M jS, Y', $dateplus1)) <= time())):?>
      <?php $allow_send = '1' ?>
      <span class="error-text-yellow-italic">Jurying for this exhibition ended at midnight (Eastern Time) on <?php echo date("M jS, Y", strtotime($end_date_for_jurying)) ?>.<!--<br />You can now send out acceptance emails.--><br />
      Send acceptance/rejection emails on or before the Artists Notification date, which is <?php echo date("M jS, Y", strtotime($artist_notification_date)) ?>.<br />
      <br />
      </span>
      <?PHP endif ?>
      <div  align="left">
      <?php if($where && !$allow_send == '1'):?>
      <span class=" heading-text-red">*** </span><span class="error-text-yellow-italic">You can not send acceptance emails for this exhibition until the jurying has ended. </span><span class=" heading-text-red">***</span><br />
      <?php elseif ($where && $allow_send == '1' && !$_REQUEST['send_this'] == '1') :?>
      <span class=" heading-text-red">*** </span><span class=" heading-text">YOU MUST CHECK THE BOX ABOVE TO SEND ACCEPTANCE EMAILS</span><span class=" heading-text-red"> ***</span>
      <?php elseif (@$_REQUEST['submitForm'] && @!$FORM['where'] && @$_REQUEST['send_this'] == '1') :?>
      <span class=" heading-text-red">*** </span><span class=" heading-text">YOU MUST CHOOSE AN EXHIBITION TO SEND ACCEPTANCE EMAILS</span><span class=" heading-text-red"> ***</span>
      <?php elseif (@!$where ) :?>
      <span class=" heading-text-red">*** </span><span class=" heading-text">YOU MUST CHOOSE AN EXHIBITION <u>AND</u> CHECK THE BOX</span><span class=" heading-text-red"> ***</span>
      <?php endif; ?>
      <?php //reset counter so emails sent can be counted
$email_count = '' ?>
      <?php foreach($client_uploadsRecords as $record) : ?>
      <?php $the_to = $record['email']; ?>
      <?php $first_name = $record['first_name'] ; ?>
      <?php $last_name = $record['last_name'] ; ?>
      <?php ob_start(); // start capturing output ?>
      <?php $instructionInformation = array(); ?>
      <?php foreach ($client_uploadsRecords as $record): ?>
      <?php if($the_to == $record['email']) : ?>
      <?php foreach ($record['uploads'] as $upload): ?>
      <?php if($upload['info5'] == 0) : ?>
      <?php if(@$record['uploads']): ?>
      <span class='heading-text-yellow'>CONGRATULATIONS, THE FOLLOWING WORK(S) WAS/WERE ACCEPTED FOR INCLUSION IN THE <?php echo strtoupper($where) ?> EXHIBITION BY THE JURORS.</span>
      <?php endif; ?>
      <br />
      <br />
      <?php break ?>
      <?php endif; ?>
      <?php endforeach ?>
      <?php endif; ?>
      <?php endforeach ?>
      <?php foreach ($client_uploadsRecords as $record): ?>
      <?php if($the_to == $record['email']) : ?>
      <?php $recnum = $record['num'] ?>
      <?php foreach ($record['uploads'] as $upload): ?>
      <?php if($upload['info5'] == 0 || !$upload['info5']) : ?>
      <img src="http://www.artistsofpalmbeachcounty.org<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>"  /> <br />
      <?php // get the instructions for this particular image
        $instructions = mysql_get("image_instructions",null,"file_name = '".$upload['filename']."' AND project_title = '".$record['project_title']."'");
		?>
      <?php if($instructions):?>
      <?php  // Get only the instructions we want to show - in this case, the fields we want start with 'complete_'
        foreach ( $instructions as $field => $value ) {
          
          if ( preg_match("/^complete_/",$field) ) {
            
            // Replace all the underscores with spaces and remove 'complete_' from the field name
            // then capitalize all the individual words so we can use this as a proper label
            $field = str_replace("complete_","",$field);
            $field = str_replace("_"," ",$field);
            $field = ucwords($field);
            
            // Add this extra info to the appropriate upload in the client_uploadsRecords array
            // in it's own array called 'image_instructions'
            $client_uploadsRecord['uploads'][$key]['image_instructions'][$field] = $value;
	    $instructionInformation[$field] = $value;
	    
      } }
  ?>
      <?php foreach ( $instructionInformation as $field => $instruction ) : ?>
      <?php if ( @$instruction && $field == 'Title') : ?>
      <?php // Replace all double quotes with single quotes
					   $instruction = preg_replace("[\"]", "''", $instruction); ?>
      <?php // Replace all underscores with dashes
					   $instruction = preg_replace("/[_]/", " - ", $instruction); ?>
      <div ><?php echo RemoveShouting($instruction) ?>
        <?php // echo $field.': '.$instruction; ?>
      </div>
      <?php endif; ?>
      <?php if ( @$instruction && $field == 'Medium' && ($upload['info5'] == '0' || !$upload['info5'] )) : ?>
      <?php // Replace all double quotes with single quotes
					   $instruction = preg_replace("[\"]", "''", $instruction); ?>
      <?php // Replace all underscores with dashes
					   $instruction = preg_replace("/[_]/", " - ", $instruction); ?>
      <?php // Replace all commas with nothing
					   $instruction = preg_replace("[,]", "", $instruction); ?>
      <?php echo RemoveShouting($instruction) ?><br />
      <?php endif; ?>
      <?php if ( @$instruction && $field == 'Dimensions' && ($upload['info5'] == '0' || !$upload['info5'] )) : ?>
      <?php // Replace all double quotes with single quotes
					 //  $instruction = preg_replace("[\"]", "''", $instruction); ?>
      <?php // Replace all underscores with dashes
					   $instruction = preg_replace("/[_]/", " - ", $instruction); ?>
      <?php // Replace all commas with nothing
					   $instruction = preg_replace("[,]", "", $instruction); ?>
      <?php echo ucwords(strtolower($instruction)) ?><br />
      <?php endif; ?>
      <?php if (@$instruction && $field == 'Price' && ($upload['info5'] == '0' || !$upload['info5'] )) : ?>
      <?php // Replace all commas with periods
					   $instruction = preg_replace("[,]", ".", $instruction); ?>
      <?php 
	   // Only allow 0-9 and . 
	   $instruction = preg_replace("/[^0-9.]/i", "", $instruction);?>
      <?php if (!$instruction ==""):?>
      $<?php echo $instruction ?><br />
      <?php endif; ?>
      <?php endif; ?>
      <?php if ( @!$instruction && $field == 'Price' && ($upload['info5'] == '0' || !$upload['info5'] )) : ?>
      NFS,
      <?php endif; ?>
      <?php endforeach; ?>
      <?php if (!$upload['info5'] == 1):?>
      <span class='body-text-yellow'>Congratulations, this work has been accepted.</span>
      <?php endif; ?>
      <br />
      <br />
      <?php endif; ?>
      <?php endif; ?>
      <?php endforeach ?>
      <?php endif; ?>
      <?php endforeach ?>
      <br />
      <?php $acceptance_email_message_2 = wordwrap($acceptance_email_message_2, 70); ?>
      <?php echo$acceptance_email_message_2 ?>
      <?php $output = ob_get_clean(); // stop capturing output  ?>
      <?php ob_start(); // start capturing output2 ?>
      <?php $instructionInformation = array(); ?>
      <?php foreach ($client_uploadsRecords as $record): ?>
      <?php if($the_to == $record['email']) : ?>
      <?php foreach ($record['uploads'] as $upload): ?>
      <?php if($upload['info5'] == 1) : ?>
      <?php if(@$record['uploads']): ?>
      <span class='heading-text-yellow'>UNFORTUNATELY, THE FOLLOWING WORK(S) WAS/WERE NOT ACCEPTED FOR INCLUSION IN THE <?php echo strtoupper($where) ?> EXHIBITION BY THE JURORS.</span>
      <?php endif; ?>
      <br />
      <br />
      <?php break ?>
      <?php endif; ?>
      <?php endforeach ?>
      <?php endif; ?>
      <?php endforeach ?>
      <?php foreach ($client_uploadsRecords as $record): ?>
      <?php if($the_to == $record['email']) : ?>
      <?php foreach ($record['uploads'] as $upload): ?>
      <?php if($upload['info5'] == 1) : ?>
      <img src="http://www.artistsofpalmbeachcounty.org<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>"  /> <br />
      <?php // get the instructions for this particular image
        $instructions = mysql_get("image_instructions",null,"file_name = '".$upload['filename']."' AND project_title = '".$record['project_title']."'");
?>
      <?php if($instructions):?>
      <?php // Get only the instructions we want to show - in this case, the fields we want start with 'complete_'
        foreach ( $instructions as $field => $value ) {
          
          if ( preg_match("/^complete_/",$field) ) {
            
            // Replace all the underscores with spaces and remove 'complete_' from the field name
            // then capitalize all the individual words so we can use this as a proper label
            $field = str_replace("complete_","",$field);
            $field = str_replace("_"," ",$field);
            $field = ucwords($field);
            
            // Add this extra info to the appropriate upload in the client_uploadsRecords array
            // in it's own array called 'image_instructions'
            $client_uploadsRecord['uploads'][$key]['image_instructions'][$field] = $value;
	    $instructionInformation[$field] = $value;
	    
      } }
  ?>
      <?php foreach ( $instructionInformation as $field => $instruction ) : ?>
      <?php if ( @$instruction && $field == 'Title') : ?>
      <?php // Replace all double quotes with single quotes
					   $instruction = preg_replace("[\"]", "''", $instruction); ?>
      <div ><?php echo $field.': '.$instruction; ?></div>
      <?php endif; ?>
      <?php endforeach; ?>
      <?php if ($upload['info5'] == 1):?>
      <span class='body-text-yellow'>Sorry, this work has not been accepted.</span>
      <?php endif; ?>
      <br />
      <br />
      <?php endif; ?>
      <?php endif; ?>
      <?php endforeach ?>
      <?php endif; ?>
      <?php endforeach ?>
      <?php $output2 = ob_get_clean(); // stop capturing output  ?>
      <?php $disclaimer= "" ?>
      <?php $acceptance_email_message_1 = wordwrap($acceptance_email_message_1, 70); ?>
      <?php 
if ($FORM['where'] && $_REQUEST['send_this'] == '1' && $allow_send == '1'):?>
      <?php $email_count++ ; ?>
      <?php 
 
 $message = <<<EOF
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type content='text/html; charset=utf-8" />
<style type="text/css">
.special {font-family:Arial; color:  rgb(227,224,219); font-size: 1.0em; font-weight: bold; text-decoration: underline;}
.body-text {font-family:Arial; font-size: 1.0em;}
.body-text-yellow {font-family:Arial; color: rgb(255,255,0); font-size: 1.0em;}
.heading-text-yellow {font-family:Arial; color: rgb(255,255,0); font-size: 1.3em;}
</style>
</head>
<body bgcolor="#7C7164">
<table style='background-color: #7C7164;' width='100%' align='center' border='0' >
			  <tr>
    <td align='left' >
	<table style='background-color: #7C7164;' width='70%' align='center' border='0' >
			  <tr>
    <td align='left' >
 <div align='left'><img src='http://www.artistsofpalmbeachcounty.org/exhibition_email_open.php?num=$recnum' height='1' width='1' alt='' /><img src='http://www.artistsofpalmbeachcounty.org/images/APBC-LOGO.png' width='800' height='183' style='border:hidden'/></div><br /><br />
 <div align='left' class='body-text-yellow'>
  Hello $first_name $last_name,
  <br /><br />
 $acceptance_email_message_1
  <br /><br />
 $output \r\n<br /><br />$output2 \r\n

    <br /><br />
Any artwork that has been accepted into the $where exhibition can only be delivered to the exhibition site on $art_drop_off_date between $art_drop_off_start_time and $art_drop_off_time_end.\r\n
<br /><br />You can review the submission specifics for this exhibition <a href='http://www.artistsofpalmbeachcounty.org/exhibitionsubmissiondetail_1.php?num=$exhib_recnum' /><span class='body-text-yellow'><u>Here</u></span></a>.\r\n<br /><br />
  Thank you for submitting your work to this exhibition,
  <br /><br />
 The Exhibition Committee<br />
  Artists of Palm Beach County\r\n</div>
  </td>
    </tr>
	</table>
	</td>
    </tr>
	</table>
  </body>
</html>
EOF;

$the_subject = "Your submission to the $where Exhibition has been Juried";

$mailArray = array( 
'to' => 'gkornbluth@jkwebdesigns.com',
'from' => 'exhibition-submissions@artistsofpalmbeachcounty.org',
'subject' => "$the_subject",
'html'         => $message 
); 
$errors =  sendMessage($mailArray);
// delay execution by .2 sec before next loop
usleep(200000);
// reset max_execution_time to 30 sec before next loop
set_time_limit(30);
?>
<?php  showme($mailArray) ?>  <br /><br />
      <?php echo $the_to ?><br />
      <?php echo $the_subject ?> <br />
      <?php echo $message ?>
      <?php endif; ?>
      <?php break // prevents more than one email to be sent while testing ?>
      <?php endforeach ?>
      <?php if (@$_REQUEST['submitForm'] && @$FORM['where'] && @$_REQUEST['send_this'] == '1' && @!$allow_send == '1'):?>
      <?php foreach ($client_uploadsRecords as $record): ?>
      <span class="error-text-yellow-italic"><br />
      <br />
      Sorry, You can not send acceptance e-mails for this exhibition at this time. Make sure that the jurying has ended and the notification date has not passed.</span>
      <?php break ?>
      <?php endforeach ?>
      <?php endif; ?>
      <br />
      <br />
      <span class="error-text-yellow-italic">
      <?php if ($count == '0'):?>
      &nbsp;
      <?php endif; ?>
      <?php if ($count =='1'):?>
      This form has been submitted once.<br />
      <?php if ($where):?>
      The last attempt was for the exhibition: <?php echo $where ?>.
      <?php endif; ?>
      <?php if (@$_REQUEST['submitForm'] && @$FORM['where'] && @$_REQUEST['send_this'] == '1' && @$allow_send == '1'):?>
      <br />
      <br />
      <span class=" heading-text-red">*** </span>You have
      <?php if ($email_count =='0' || @!$email_count ):?>
      sent no
      <?php else: ?>
      successfully sent <?php echo $email_count ?>
      <?php endif; ?>
      emails to entrants of <?php echo $where ?>.
      <?php endif; ?>
      <?php if(@$where && @!$email_count):?>
      <br />
      <br />
      <span class=" heading-text-red">*** </span>You have sent no emails.
      <?php endif; ?>
      <?php if (!$where):?>
      <br />
      <br />
      <span class=" heading-text-red">*** </span>You have sent no emails.
      <?php endif; ?>
      <span class=" heading-text-red"> ***</span>
      <?php endif; ?>
      <?php if ($count > '1'):?>
      This form has been submitted <?php echo $count ?> times.<br />
      <?php if ($where):?>
      The last attempt was for <?php echo $where ?>.
      <?php endif; ?>
      <?php if (@$_REQUEST['submitForm'] &&($email_count =='0' || @!$email_count )):?>
      <br />
      <br />
      <span class=" heading-text-red">*** </span>You have sent no emails.
      <?php endif; ?>
      <?php if (@$_REQUEST['submitForm'] && @$FORM['where'] && @$_REQUEST['send_this'] == '1' && @$allow_send == '1'):?>
      <br />
      <br />
      <span class=" heading-text-red">*** </span>You have
      <?php if ($email_count =='0' || @!$email_count ):?>
      sent no
      <?php else:?>
      successfully sent <?php echo $email_count ?>
      <?php endif; ?>
      email(s) to entrants of <?php echo $where ?>.
      <?php endif; ?>
      <span class=" heading-text-red"> ***</span>
      <?php endif; ?>
      </span><br />
      <br />
      <a class="special" href='?action=logoff'>WHEN YOU'RE DONE, CLICK HERE TO LOG OFF</a>
      <?php else:?>
      <br />
      <span class="heading-text-yellow">Please log in as an administrator or manager and then return to this page.</span>
      <?php endif; ?></td>
  </tr>
</table>
<p></p>
<script type="text/javascript">

//anylinkcssmenu.init("menu_anchors_class") //call this function at the very *end* of the document!
anylinkcssmenu.init("anchorclass")

</script>
</body>
</html>