<?php
/*===================================================+ 
|| # HoloCMS - Website and Content Management System
|+===================================================+ 
|| # Copyright © 2012 DnT [Tutti i diritti riservati]
|| # http://dnt.webnet32.com/
|+===================================================+ 
|| # DnT HoloCMS v2 - Created By Donatello (DnT)
|| # http://code.google.com/p/dnt-project/downloads/list
|+===================================================*/ 

require_once('../core.php');
if($hkzone !== true){ header("Location: index.php?throwBack=true"); exit; }
if(!session_is_registered(acp)){ header("Location: index.php?p=login"); exit; }

$pagename = "Componi una news";

if($do == "save" && isset($_POST['topstory'])){

	$num = $key;

	$title = addslashes($_POST['title']);
	$category = addslashes($_POST['category']);
	$topstory = addslashes($_POST['topstory']);
	$short_story = addslashes($_POST['short_story']);
	$story = $_POST['story'];
	$name = addslashes($_POST['author']);
     

	mysql_query("INSERT INTO cms_news (title,category,topstory,short_story,story,author,date) VALUES ('".$title."','".$category."','".$topstory."','".$short_story."','".$story."','".$name."','".$date_reversed."')") or die(mysql_error());

	header("Location: index.php?p=news_manage&do=bounce");

}

@include('subheader.php');
@include('header.php');
?>
<table cellpadding='0' cellspacing='8' width='100%' id='tablewrap'>
<tr> <td width='22%' valign='top' id='leftblock'>
 <div>
 <!-- LEFT CONTEXT SENSITIVE MENU -->
<?php @include('sitemenu.php'); ?>
 <!-- / LEFT CONTEXT SENSITIVE MENU -->
 </div>
 </td>
 <td width='78%' valign='top' id='rightblock'>
 <div><!-- RIGHT CONTENT BLOCK -->

 
<form action='index.php?p=news_compose&do=save' method='post' name='theAdminForm' id='theAdminForm'>
<div class='tableborder'>
<div class='tableheaderalt'>Componi nuova news</div>

<table width='100%' cellspacing='0' cellpadding='5' align='center' border='0'>
<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Titolo</b><div class='graytext'>Il titolo della News.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><input type='text' name='title' value="<?php echo $article['title']; ?>" size='30' class='textinput'></td>
</tr>

<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Categoria</b></td>
<td class='tablerow2'  width='60%'  valign='middle'><select name='category' class='dropdown'> <option value='News' <?php if($article['category'] == "News"){ echo 'selected'; } ?>>News</option> </select> 
</td>
</tr>

<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Immagine</b><div class='graytext'>Per scegliere le immagini <a href="http://raikas77.webnet32.com/immagini_news/immagini_news.html">Clicca quì</A></div></td>
<td class='tablerow2'  width='60%'  valign='middle'><input type='text' name='topstory' value="" size='30' class='textinput'></td>
</tr>

<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Anteprima</b><div class='graytext'>L'HTML non è abilitato.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><textarea name='short_story' cols='60' rows='5' wrap='soft' id='sub_desc'   class='multitext'><?php echo stripslashes($article['short_story']); ?></textarea></td>
</tr>

<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>News completa</b><div class='graytext'>L'HTML è abilitato.</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><textarea id="story" name="story" cols='60' rows='8' style="width: 8%"><?php echo stripslashes($article['story']); ?></textarea></td>
</tr>
<script type="text/javascript" src="<?php echo $path; ?>/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		language : "es",
		// General options
		mode : "exact",
		elements : "story",
		theme : "advanced",
		plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

		// Theme options
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,|,insertdate,inserttime,preview",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
		width: "750px",

		// Example content CSS (should be your site CSS)
		content_css : "<?php echo $path; ?>/tiny_mce/css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "<?php echo $path; ?>/tiny_mce/lists/template_list.js",
		external_link_list_url : "<?php echo $path; ?>/>tiny_mce/lists/link_list.js",
		external_image_list_url : "<?php echo $path; ?>/tiny_mce/lists/image_list.js",
		media_external_list_url : "<?php echo $path; ?>/tiny_mce/lists/media_list.js",

		// Style formats
		style_formats : [
			{title : 'Bold text', inline : 'b'},
			{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
			{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
			{title : 'Example 1', inline : 'span', classes : 'example1'},
			{title : 'Example 2', inline : 'span', classes : 'example2'},
			{title : 'Table styles'},
			{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
		],

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
</script>
</tr>


<tr>
<td class='tablerow1'  width='40%'  valign='middle'><b>Autore</b><div class='graytext'>Chi è l'autore della news?</div></td>
<td class='tablerow2'  width='60%'  valign='middle'><input type='text' name='author' value="<?php echo $article['author']; ?>" size='30' class='textinput'></td>
</tr>


<tr>
<tr><td align='center' class='tablesubheader' colspan='2' ><input type='submit' value='Pubblica' class='realbutton' accesskey='s'></td></tr>
</form></table></div><br />
	 </div><!-- / RIGHT CONTENT BLOCK -->
	 </td></tr>
</table>
</div><!-- / OUTERDIV -->
<div align='center'><br />
<?php
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
printf('Ore: %.3f', $totaltime);
?>
</div>