<?php header('Content-type: text/html; charset=utf-8'); ?>
  <?php require_once "C:/Inetpub/charlotteparent/cmsAdmin/lib/viewer_functions.php";

  list($menu_newRecords, $menu_newMetaData) = getRecords(array(
    'tableName'   => 'menu_new',
    'allowSearch' => '0',
    'limit'       => '1',
  ));
  $menu_newRecord = @$menu_newRecords[0]; // get first record
  
  list($directories_menuRecords, $directories_menuMetaData) = getRecords(array(
    'tableName'   => 'directories_menu',
  ));
  
  list($publicationsmenuRecords, $publicationsmenuMetaData) = getRecords(array(
    'tableName'   => 'publicationsmenu',
  ));
  
 list($photocontests_newRecords, $photocontests_newMetaData) = getRecords(array(
    'tableName'   => 'photocontests_new',
    ));
  
   list($photocontests_mainRecords, $photocontests_mainMetaData) = getRecords(array(
    'tableName'   => 'photocontests_main',
    'allowSearch' => '0',
    'limit'       => '1',
  ));
  $photocontests_mainRecord = @$photocontests_mainRecords[0]; // get first record

 
 list($photocontests_catRecords, $photocontests_catMetaData) = getRecords(array(
    'tableName'   => 'photocontests_cat',
     ));
   
 list($photocontests_listRecords, $photocontests_listMetaData) = getRecords(array(
    'tableName'   => 'photocontests_list',
  
  ));
  
  list($linkRecords, $linkMetaData) = getRecords(array(
    'tableName'   => 'photocontests_new',
	));
  $linkRecord = @$linkRecords[0]; // get first record 

  
 list($ros_adsRecords, $ros_adsMetaData) = getRecords(array(
    'tableName'   => 'ros_ads',
    'allowSearch' => '0',
    'limit'       => '1',
  ));
  $ros_adsRecord = @$ros_adsRecords[0]; // get first record
     
list($globalRecords, $globalMetaData) = getRecords(array(
    'tableName'   => 'global',
    'allowSearch' => '0',
    'limit'       => '1',
  ));
  $globalRecord = @$globalRecords[0]; // get first record
  
    // This form requires: CMSB v2.04 Build 1
 require_once "C:/Inetpub/charlotteparent/cmsAdmin/lib/viewer_functions.php";
  $tableName       = 'photocontests_new';
  $recordNum       = null; // you must set either $recordNum or $preSaveTempId to null
  $preSaveTempId   = @$_REQUEST['preSaveTempId'] ? $_REQUEST['preSaveTempId'] : uniqid('x');
  $errorsAndAlerts = '';

  ### upload actions
  if (@$_REQUEST['submitForm'] && !preg_match("/multipart\/form-data/", @$_SERVER['CONTENT_TYPE'])) { die("Upload Error: &lt;form&gt; tag must have enctype=\"multipart/form-data\""); }
    foreach (getUploadInfoArrays() as $uploadInfo) { // add uploads
    $errorsAndAlerts .= saveUpload($tableName, $uploadInfo['_fieldname'], $recordNum, $preSaveTempId, $uploadInfo, $newUploadNums);
  }
  if (@$_REQUEST['removeUpload']) { // delete upload
    $uploadNum = @$_REQUEST['removeUpload'];
    removeUpload($uploadNum, $recordNum, $preSaveTempId);
  }

  ### insert record
  $onlyUploadAction = @$_REQUEST['submitUpload'] || @$_REQUEST['removeUpload']; // don't save the record when the user uploads a file
  if (@$_REQUEST['submitForm'] && !$onlyUploadAction) {

    // error checking
	if (!@$_REQUEST['name'])    { $errorsAndAlerts .= "*Required: Please specify a name!<br/>\n"; }
	if (!@$_REQUEST['title'])    { $errorsAndAlerts .= "*Required: Please specify a title!<br/>\n"; }
	if (!@$_REQUEST['email'])    { $errorsAndAlerts .= "*Required: Please specify an e-mail address!<br/>\n"; }
	

    // update record
    if (!@$errorsAndAlerts) {
      mysqlStrictMode(false); // disable Mysql strict errors for when a field isn't defined below (can be caused when fields are added later)
      $query = "INSERT INTO `{$TABLE_PREFIX}$tableName` SET
                    createdDate      = NOW(),
                    createdByUserNum = '" .intval( @$CURRENT_USER['num'] ). "',
                    updatedDate      = NOW(),
                    updatedByUserNum = '" .intval( @$CURRENT_USER['num'] ). "',
					date      = NOW(),
					hidden = '1',
					
					name         = '".mysql_escape(@$_REQUEST['name'])."',
					content         = '".mysql_escape(@$_REQUEST['content'])."',
					email         = '".mysql_escape(@$_REQUEST['email'])."',
					category	 = '" .mysql_escape( @$_REQUEST['category'] ). "',
					title            = '".mysql_escape( $_REQUEST['title'] )."'";
					
					
					mysql_query($query) or die("MySQL Error:<br/>\n". htmlspecialchars(mysql_error()) . "\n");
      $recordNum = mysql_insert_id();

      // adopt temp uploads
      adoptUploads($tableName, $preSaveTempId, $recordNum);
      removeExpiredUploads(); // erase old expired uploads

      // display thanks message and clear form
      $errorsAndAlerts = "Thanks, we've added your record!";
      $_REQUEST      = array();
      $preSaveTempId = uniqid('x');
      $recordNum     = null;
	  

    // send message

      $placeholders = array(
	'user.email'       => $_REQUEST['email'],
	'user.fullname'    => $_REQUEST['name'],
	'content'          => $_REQUEST['content'],
	'contestAdminUrl'  => $GLOBALS['SETTINGS']['adminUrl'] . "?menu=calendar&action=edit&num=" . mysql_insert_id(),

      );

       // email admin

      $errors = sendMessage(wsc_emailTemplate_loadFromDB(array(
	'template_id'      => 'ADMIN-ENTRY-ADDED',
	'placeholders'     => $placeholders,

      )));

      if ($errors) { die("Error sending message: $errors\n\nPlease let us know about this error!"); }

  }

  }  

?>

  
<!doctype html>
<!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->
<!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->
<!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="">
<!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title><?php echo $photocontests_mainRecord['page_title'] ?></title>
<meta name="description" content="<?php echo $photocontests_mainRecord['page_description'] ?>" />
<meta name="keywords" content="<?php echo $photocontests_mainRecord['page_keywords'] ?>" />
<link href="../css/boilerplate.css" rel="stylesheet" type="text/css">
<link href="../css/main.css" rel="stylesheet" type="text/css">
<link href="../css/new.css" rel="stylesheet" type="text/css">
<link href="../css/meganizr.css" rel="stylesheet" type="text/css">
<!--[if lt IE 9]><link href="responsive/meganizr-ie.css" rel="stylesheet" type="text/css"><![endif]-->

<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<script src="../jsnew/respond.min.js"></script>
<script type="text/javascript" src="//use.typekit.net/lzt6wua.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
<script src="../js/google.js" type="text/javascript"></script>

<script language="JavaScript">
function loadPage(list) {
  location.href=list.options[list.selectedIndex].value
}
</script>
</head>
<body>
<div class="gridContainer clearfix">
  <div id="headertop">
  <div id="news"><? include "C:/Inetpub/charlotteparent/templates/headernews.php"; ?> <!--End news--></div>
    <div id="info-social"><? include "C:/Inetpub/charlotteparent/templates/headerinfo-social.php"; ?><!--End info-social--></div>
    <div id="search"> <form action="http://www.charlotteparent.com/search/results.php" id="cse-search-box">
    
	<input type="text"  size="25" value="Search Charlotte Parent" onfocus="this.value=''" style="font-family: Arial; font-size:11px;" name="q"> 
    <input type="image" src="../imagesnew/searchiconfinal.png" name="sa" />
    <input type="hidden" name="cx" value="partner-pub-1130980330851222:omewr4pzse6" />
    <input type="hidden" name="cof" value="FORID:9" />
    <input type="hidden" name="ie" value="ISO-8859-1" />
 
</form>
<script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script><!--End search--></div>
  <!--End headertop--></div>
  
  <div id="header">
    <div id="adres"><? include "C:/Inetpub/charlotteparent/templates/headeradres.php"; ?><!--End adres--></div>
    <div id="logo"><? include "C:/Inetpub/charlotteparent/templates/headerlogo.php"; ?><!--End logo--></div>
    <div id="ad"><?php echo $photocontests_mainRecord['banner_ad'] ?><!--End ad--></div>
  <!--End header--></div>
    <div id="logo-res"><? include "C:/Inetpub/charlotteparent/templates/headerlogores.php"; ?><!--End logo-res--></div>
  
 <div id="nav"><? include "C:/Inetpub/charlotteparent/templates/newnavigation.php"; ?> <!--End nav--></div>
 <div id="tablet-nav"><? include "C:/Inetpub/charlotteparent/templates/tabletnav.php"; ?> <!--End res-nav--></div>
  <div id="responsive-nav"><? include "C:/Inetpub/charlotteparent/templates/resnav.php"; ?> <!--End res-nav--></div>
  
<div id="article">
<div id="breadcrumb"><script type="text/javascript" src="../js/MPBackLinks.js"></script></div>
<div id="page-header"><h1><?php echo $photocontests_mainRecord['title'] ?></h1></div>
<div id="divider"><img src="../imagesnew/newdivider1.jpg" alt="divider"></div>


<div id="directory-maincontent">
<?php foreach ($photocontests_listRecords as $record): ?>
<h3><?php echo ($record['form_title']) ?></h3><br>
<?php echo $record['form_content']; ?>
  <?php endforeach ?></div>

<div class="photo-container"><br>
<div class="photo-content-left"><a href="index.php">All Contests</a>
</div>

  <div class="photo-content-right"> <a href='categories.php?category=<?php echo $linkRecord['category']; ?>'>Back</a>
  </div>
  </div>
<div id="photo-sep">&nbsp;</div>

    <div id="photos-form">
     <?php if (@$errorsAndAlerts): ?>
  <div style="color: red; font-weight: bold; font-size: 16px;"><br/>
    <?php echo $errorsAndAlerts; ?>
  </div>
<?php endif ?><br />

<span class="red">* = Required</span><br />
<br />

<form method="post" name="uploadForm" action="?preSaveTempId=<?php echo $preSaveTempId ?>" enctype="multipart/form-data">
<p>
  <input type="hidden" name="submitForm" value="1" />
  <input type="hidden" name="num" value="<?php echo $recordNum ?>" />
  <input type="hidden" name="preSaveTempId" value="<?php echo $preSaveTempId ?>" />
  <input type="hidden" name="removeUpload" id="removeUpload" value="0" />
  

<div class="form-label"><span class="red">*</span>Photo Posted by:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="name" value="<?php echo htmlspecialchars(@$_REQUEST['name']) ?>" size="50" /></div>

<div class="form-label"><span class="red">*</span>Photo Title:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="title" value="<?php echo htmlspecialchars(@$_REQUEST['title']) ?>" size="50" /></div>

<div class="form-label">Brief Description:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="content" value="<?php echo htmlspecialchars(@$_REQUEST['content']) ?>" size="50" /></div>

<div class="form-label"><span class="red">*</span>Email:</div>
<div class="form-field"><input class="text-input medium-input" type="text" name="email" value="<?php echo htmlspecialchars(@$_REQUEST['email']) ?>" size="50" /></div>

<div class="form-label"><span class="red">*</span>Category:</div>
<div class="form-field">
<select name="category">
<option value = "">-Select-</option>
<?php foreach (getListOptions($tableName, 'category') as $value => $label): ?>
<option value = "<?php echo htmlspecialchars($value);?>" <?php selectedIf($value, @$_REQUEST['category']);?>> <?php echo htmlspecialchars($label);?> </option>
<?php endforeach ?>
</select> </div>

<div class="form-label">Uploads:</div>
<div class="form-field">
  <?php // load uploads
      $fieldName     = 'uploads';
      $tempUploads   = getUploadRecords($tableName, $fieldName, $recordNum, $preSaveTempId);
    ?>

    <?php foreach ($tempUploads as $upload): ?>
      <?php if ($upload['hasThumbnail']): ?>
        <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>
      <?php endif ?>

      <?php echo $upload['filename'] ?>
      <a href="#" onclick="document.uploadForm.removeUpload.value='<?php echo $upload['num'] ?>';document.uploadForm.submit();">remove</a><br/><br/>

    <?php endforeach ?>

    <?php if (!$tempUploads): ?>
      <span class="bodytext">There are no uploads yet.</span><br/><br/>
    <?php endif ?>


    <h5>Upload Files</h5>
    <input type="file" name="<?php echo $fieldName ?>[]"/><br/><br>
  
    <input type="submit" name="submitUpload" value="Upload" />
</div>

  <div class="form-label">&nbsp;</div>
<div class="form-divider"><input class="button" type="submit" name="submitForm" value="Add Photo" /> </div>
</form>
    
    <!--End photos-form--></div>
     
  <!--End article--></div>
  
   <div id="aside">

 <div id="sponsor-adres"><?php echo $ros_adsRecord['ros_mobilead_1'] ?>
   <?php echo $ros_adsRecord['ros_mobilead_2'] ?>
   <?php echo $ros_adsRecord['ros_mobilead_3'] ?></div>
   
  <div id="toggle">
	  <h3><a href="#"><?php echo $menu_newRecord['sidebar_directoriestext'] ?></a></h3>
		<div><ul class="toggle-list">
                        <?php foreach ($directories_menuRecords as $record): ?>
                            <li><a href="<?php echo $record['dirurl'] ?>"><?php echo $record['title'] ?></a></li>
                          <?php endforeach; ?>                           
                        </ul></div></div>
    <div id="toggle">
		<h3><a href="#"><?php echo $menu_newRecord['sidebar_publicationstext'] ?></a></h3>
		<div><ul class="toggle-list">
                       <?php foreach ($publicationsmenuRecords as $record): ?>
                            <li><a href="<?php echo $record['puburl'] ?>"><?php echo $record['title'] ?></a></li>
                            <?php endforeach; ?>                            
                        </ul></div></div>
                        
  <!----Ads---->                       
 <div class="aside-ads">
<?php echo $ros_adsRecord['tower_ad'] ?></div>

 <!----Global Text Area---->
<div class="container">
 <h3 class="green"><?php echo $globalRecord['title_text'] ?></h3>
<div class="container-content">
		<?php foreach ($globalRecord['photo'] as $upload): ?>
          <?php if ($upload['isImage']): ?> 
            <div class="center"><img src="<?php echo $upload['urlPath'] ?>" title="<?php echo $upload['info1'] ?>" /></div><br/><br />

          <?php endif ?>
        <?php endforeach ?>
        <p><?php echo $globalRecord['content_text'] ?></p>
       
</div></div> 

<!----Tip---->
 <div class="container">
	 <h3 class="blue"><?php echo $globalRecord['title'] ?></h3>
      <div id="quote-container">
        <blockquote>
         <img class="leftquote" src="../images/leftquote.png"><?php echo $globalRecord['content'] ?><img class="rightquote" src="../images/rightquote.png">
        </blockquote>
 
        <p><a href="<?php echo $globalRecord['link_url'] ?>"><?php echo $globalRecord['link_title'] ?></a></p>

</div></div>

 <!----Open---->
  <?php if ($photocontests_mainRecord['box_content']): ?>
<div class="container">
 <h3 class="green"><?php echo $photocontests_mainRecord['box_title'] ?></h3>
<div class="container-content">
		<?php foreach ($photocontests_mainRecord['box_photo'] as $upload): ?>
          <?php if ($upload['isImage']): ?> 
            <div class="center"><img src="<?php echo $upload['urlPath'] ?>" title="<?php echo $upload['info1'] ?>" /></div><br/><br />

          <?php endif ?>
        <?php endforeach ?>
        <p><?php echo $photocontests_mainRecord['box_content'] ?></p>
      
       
</div></div>   <?php endif ?>

<div id="newsres"><? include "C:/Inetpub/charlotteparent/templates/headernewsressec.php"; ?> <!--End newsres--></div>
 <div id="info-socialres">
<a  href="https://www.facebook.com/cltparent"><img src="../imagesnew/facebook-icon.png" class="info-icon"></a>
<a href="https://twitter.com/CharlotteParent"><img src="../imagesnew/twitter-icon.png" class="info-icon" ></a>
<a  href="http://pinterest.com/charlotteparent/"><img src="../imagesnew/pinterest-icon.png" class="info-icon"></a>

<!--End info-social--></div>  <!--End aside--></div>
    <!--End grid--></div>
    
 <div id="footerwrapper">
<div class="gridContainer clearfix">
    <div id="footer">
    	<div id="footerlft"><? include "C:/Inetpub/charlotteparent/templates/footerlft.php"; ?></div>
     	<div id="footerrgt"><? include "C:/Inetpub/charlotteparent/templates/footerrgt.php"; ?></div>
     	<div id="footerrgttab"><? include "C:/Inetpub/charlotteparent/templates/footerrgttab.php"; ?></div>
    <!--End footer--></div>
    <div id="responsive-footer"><? include "C:/Inetpub/charlotteparent/templates/resfooter.php"; ?> <!--End res-footer--></div>
    
    <div id="copyright"><?php echo $globalRecord['copyright'] ?> <!--End copyright--></div>
    
 <!--End grid--></div>
<!--End footerwrapper--></div>

<!-- Share This Scripts -->
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "19f48c6c-364e-4e0a-9e27-f4b71609270b", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>

<!-- Meganizr Scripts -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="../jsnew/meganizr.js"></script>
<!-- end Meganizr Scripts -->

<!-- jquery -->	
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="../jsnew/jquery.ui-custom.js"></script>
<script src="../jsnew/jquery.easing.1.3.js"></script>
<script src="../jsnew/scripts.js"></script>

	<!-- easing plugin ( optional ) -->
	<script src="../jsnew/easing.js" type="text/javascript"></script>
	<!-- UItoTop plugin -->
	<script src="../jsnew/jquery.ui.totop.js" type="text/javascript"></script>
	<!-- Starting the plugin -->
	<script type="text/javascript">
		$(document).ready(function() {
			/*
			var defaults = {
	  			containerID: 'toTop', // fading element id
				containerHoverID: 'toTopHover', // fading element hover id
				scrollSpeed: 1200,
				easingType: 'linear' 
	 		};
			*/
			
			$().UItoTop({ easingType: 'easeOutQuart' });
			
		});
	</script>


 <script type="text/javascript"> 
var $buoop = {} 
$buoop.ol = window.onload; 
window.onload=function(){ 
 try {if ($buoop.ol) $buoop.ol();}catch (e) {} 
 var e = document.createElement("script"); 
 e.setAttribute("type", "text/javascript"); 
 e.setAttribute("src", "http://browser-update.org/update.js"); 
 document.body.appendChild(e); 
} 
</script> 

</body>
</html>