ACC SHELL

Path : /srv/www/vhosts/unitedsolution/admin/page/
File Upload :
Current File : /srv/www/vhosts/unitedsolution/admin/page/add.php

<?php
$wysiwyg = new wysiwyg;

echo '<h1 class="page_show_h">Statické stránky</h1>';

if($_POST['wysiwyg'] == 'wysiwyg off' || $_POST['wysiwyg'] == 'wysiwyg on'){
	
	$wysiwyg->change();

}

$page = new page;

if($_POST['button'] == 'ulozit'){
	
	$page->add($_POST['name'],$_POST['page'],$_POST['footer'],$_POST['category'],$_POST['home'],
			   $_POST['title'],$_POST['keywords'],$_POST['description'],$_POST['lang'],$_POST['template']);

}

$status = $wysiwyg->check();

if($page->msg == PAGE_ADDED){
	
	echo	'<div class="page_msg2">'.$page->msg.'</div>'.
			'<script language="javascript">'.
				'function refresh(){'.
					'window.location.href = \'default.php?page=page/show\''.
				'}'.
				
				'setTimeout("refresh()", 500)'.
			'</script>';

}
else{
	
	$category = new category;
	
	if($category->pocet() == 0){
		
		echo	'<div class="page_msg2">'.CREATE_CATEGORY.'</div>';
	
	}
	else{

?>
<a id="page_bakc" href="default.php?page=page/show"><img border="0" src="img/Back.jpg" alt="Zpět" title="Zpět" /></a>
<form name="page_form" id="page_form" method="post" action="default.php?page=page/add">
	<input id="page_b_1" type="submit" name="button" value="ulozit" title="Uložit" />
	<input id="wysiwyg_b" name="wysiwyg" type="submit" value="<?= $status == 1 ? 'wysiwyg off' : 'wysiwyg on' ?>" title="wysiwyg" />
	<span class="page_msg1"><?= $page->msg ?></span>
	<div>
		<label for="home">Zobrazit na úvode:</label>
		<input id="home" type="checkbox" name="home" value="1" <?= $_POST['home'] == 1 ? 'checked="checked"' : '' ?> />
	</div>
	<div>
		<label for="footer">Zobrazit patičku:</label>
		<input id="footer" type="checkbox" name="footer" value="1" <?= $_POST['footer'] == 1 ? 'checked="checked"' : '' ?> />
	</div>
	<div>
		<label for="category">Kategorie:</label>
		<select name="category">
			<?php
			$category = new category;
			$category->show();
			
			for($i=0;$i<count($category->id);$i++){
				
				echo '<option value="'.$category->id[$i].'" '.($_POST['category'] == $category->id[$i] ? 'selected="selected"' : '').'>'.
						$category->name[$i].
					 '</option>'."\n";
			
			}			
			?>
		</select>
	</div>
	<div>
		<label for="template">Sablona:</label>
		<select name="template">
		<?php
			
			$page->select_templates();
			for($i=0;$i<count($page->template_id);$i++){
				
				echo
					'<option value="'.$page->template_id[$i].'" '.($_POST['template'] == $page->template_id[$i] ? 'selected="selected"' : '').'>'.
						$page->template_name[$i].
					'</option>'."\n";	
			}
			
		?>
		</select>
	</div>
	<div>
		<label for="name"><strong>Jméno:</strong></label>
		<input type="text" name="name" id="name" <?= !empty($_POST['name']) ? 'value="'.$_POST['name'].'"' : '' ?> />
	</div>
	<div>
		<label for="lang">Jazyk:</label>
		<input type="text" name="lang" id="lang" <?= !empty($_POST['lang']) ? 'value="'.$_POST['lang'].'"' : '' ?>  />
	</div>
	<div>
		<label for="title">Title:</label>
		<input type="text" name="title" id="title" <?= !empty($_POST['title']) ? 'value="'.$_POST['title'].'"' : '' ?> />
	</div>
	<div>
		<label for="keywords">Keywords:</label>
		<textarea name="keywords" id="keywords"><?= !empty($_POST['keywords']) ? stripslashes($_POST['keywords']) : '' ?></textarea>
	</div>
	<div>
		<label for="description">Description:</label>
		<textarea name="description" id="description"><?= !empty($_POST['description']) ? stripslashes($_POST['description']) : '' ?></textarea>
	</div>
	<div>
		<label for="text_page"><strong>Obsah:</strong></label>
		<div class="wysiwyg_box">
			<textarea name="page" id="text_page"><?= stripslashes($_POST['page']) ?></textarea>
			<?php
			
				if($status == 1){
				
					echo	'<script language="javascript" type="text/javascript" src="wysiwyg/tiny_mce.js"></script>'.
							'<script language="javascript" type="text/javascript" src="wysiwyg/config.js"></script>';
					
				}
				
			?>
		</div>
	</div>
	
  <div class="clear"></div>	
</form>
<?

	}

}

?>

ACC SHELL 2018