<?php if(!defined('CONST_VAL')) {
 die('You cannot access this file directly!');
}
if($editortrue == '1') {
?>
<script src="scripts/ckeditor/ckeditor.js"></script>
<script src="scripts/ckeditor/config.js"></script>
<?php
}
if(isset($_POST['incname'])) {
 if(get_magic_quotes_gpc()) {
  $url = stripslashes(htmlspecialchars($_POST['incname']));
 } else {
  $url = htmlspecialchars($_POST['incname']);
 }
 if(!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i",$url)) {
  echo "<div class='errors'>$lang[187]&nbsp;<a href='auth.php?auth=6'>$lang[135]</a></div></div></div></div></div></div>";
  $smarty->display('footer.php');
  die();
 }
 $result = enterUrlData($url);
 if($result['title'] == "") {
  $title = $lang['223'];
 } else {
  $title = $result['title'];
 }
 if(@$result['metaTags']['description']['value'] == "") {
  $description = $lang['223'];
 } else {
  $description = $result['metaTags']['description']['value'];
 }
 if(@$result['metaTags']['keywords']['value'] == "") {
  $keywords = $lang['223'];
 } else {
  $keywords = $result['metaTags']['keywords']['value'];
 }
}
?>
<form action="post.php" id="incformer" enctype="multipart/form-data" method="post">
<div class="ten column marginTop">
<h2><?php echo $lang['233']; ?></h2>
</div>
<input type="hidden" name="address"<?php if(@$url == true) { ?> value="<?php echo @$url; ?>"<?php } else { ?> value="0"<?php } ?> />
<input type="hidden" name="token" value="<?php echo $token; ?>" />
<div class="ten marginTop">
<div class="five column">
<label><?php echo $lang['224']; ?></label>
<input type="text" class="input" name="title"<?php if(@$url == true) { ?> value="<?php echo $title; ?>"<?php } ?> data-validation="length" data-validation-length="5-160" />
</div>
<div class="five column">
<label><?php echo $lang['225']; ?></label>
<?php $smarty->display('submit_tree.php'); ?>
</div>
</div>
<div class="ten column marginTop">
<label><?php echo $lang['226']; ?></label>
<input type="text" name="brief" class="input" data-validation="length" data-validation-length="max500" data-validation-optional="true" />
</div>
<div class="ten">
<div class="five column">
<label><?php echo $lang['227']; ?></label>
<input type="file" name="image" />
</div>
<div class="five column">
<label><?php echo $lang['233']; ?></label>
<input type="radio" class="radios" name="main" id="0" value="0" checked="checked" />&nbsp;<?php echo $lang['228']; ?>
&nbsp;&nbsp;<input type="radio" class="radios" name="main" id="4" value="4" />&nbsp;<?php echo $lang['229']; ?>
</div>
</div>
<div class="ten column marginTop">
<label><?php echo $lang['230']; ?>&nbsp;&nbsp;<font class="ckarea" style="display:none;"><?php echo $lang['231']; ?></font></label>
<?php if(@$description == true) { ?>
<textarea name="longdesc" id="longdesc" class="postarea" required="required"><?php echo @$description; ?></textarea>
<?php } else { ?>
<textarea name="longdesc" id="longdesc" class="postarea" required="required"></textarea>
<?php }
if($editortrue == '1') { ?>
<script>
CKEDITOR.replace( 'longdesc' );
</script>
<?php } ?>
</div>
<div class="ten column marginTop">
<input class="blue medium button" type="submit" value="<?php echo $lang['130']; ?>" name="query" />
</div>
</form>
<script src="<?php echo $sitepath; ?>/scripts/jquery.form-validator.min.js"></script>
<script src="<?php echo $sitepath; ?>/scripts/jquery.are-you-sure.js"></script>
<script src="<?php echo $sitepath; ?>/scripts/ays-beforeunload-shim.js"></script>
<script>$(function() {$('#incformer').areYouSure({message: "The changes you made will be lost. Are you sure you want to leave this page?"});});</script>
<script>$.validate();</script>
<?php if($editortrue == '1') { ?>
<script>
$("form").submit(function(e) {
    var description = CKEDITOR.instances['longdesc'].getData().replace(/<[^>]*>/gi, '').length;
    if (!description) {
        $(".ckarea").show();
        return false;
    }
});
</script>
<?php } ?>