• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Gesior AAC] WYSIWYG for your Latest News

Kavvson

Gdy boli cie glowa wez
Joined
Jun 25, 2008
Messages
1,177
Reaction score
72
Location
Poland
Greetings. This time i would like to release a WYSIWYG writer for your Latest News. As we know the incoming modern aac have the feature and more so i can paste my for Gesior. This is really simple and might help you :p. You can add fonts etc. Just u need to have some html/js basics.



This is the image of how it looks. The whole news writer is changed.
http://www14.speedy*****malware.localhost/files/21995117/download/new-news%20system.JPG

How to add?

######
If a css styles sheet is needed use this. Create a folder docs/style.css

PHP:
body {
	font-family: Arial;
	color: #000000;
	font-weight: normal;
	font-size: 13px;	
	background-color: #EEEEEE;
}

td {
	font-family: Arial;
	color: #000000;
	font-weight: normal;
	font-size: 13px;		
}

h1 {
	font-family: Tahoma;
	color: #444444;
	font-weight: bold;
	font-size: 16px;	
	margin: 0px;
}

h2 {
	font-family: Tahoma;
	color: #444444;
	font-weight: bold;
	font-size: 14px;	
	margin: 0px;
	text-decoration: underline;	
}

h3 {
	font-family: Tahoma;
	color: #444444;
	font-weight: bold;
	font-size: 12px;	
	margin: 0px;
	text-decoration: underline;	
}

.headline {
	border-bottom: 1px solid #FF3300;
	font-weight: bold;
}

.naviblock {
	width:280px;
	text-align:center;
	border: 1px solid #AAAAAA;
	padding:5px; 
	background-color:#FFFFFF;	
}

a.navi {
	font-family: Tahoma;
	color: #444444;
	font-weight: bold;
	font-size: 13px;
	text-decoration: none;		
}

a.navi:hover {
	text-decoration: underline;	
}

a {
	color: #333333;	
}

.codeblock {
	background-color: #FFFFEE; 
	font-family: courier new; 
	font-size: 12px; 
	padding: 5px; 
	width: 90%; 
	border: 1px solid #AAAAAA; 
	margin-left: 10px;
	margin-top: 5px;
}

 .codeblock td {
 	font-family: courier new; 
	font-size: 12px; 
	vertical-align: top;
	color: #000088;
 }

.list {
	line-height: 20px;	
}

.red {
	color: #FF3300;	
}

.blue {
	color: #0000FF;	
}

.green {
	color: #008080;
}

.darkblue {
	color: #000088;
}

.info {
	color: #EE0000;
	font-size:10px;
}

Find
PHP:
$main_content .= '<a href="?subtopic=archive"><h4>News Archives</h4></a><hr /><br />';
Or if you cant find the upper
PHP:
//show "BIG" news here

Now paste under it

PHP:
if($group_id_of_acc_logged >= $config['site']['access_news'])
{
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson

//////////////// Configuration Slot //
// Needed // dont delete // or edit //
	echo '<link rel="stylesheet" href="docs/style.css" type="text/css">';
	echo '<script type="text/javascript" src="scripts/wysiwyg.js"></script>';
	echo '<script type="text/javascript" src="scripts/wysiwyg-settings.js"></script>';
    echo '
		<script type="text/javascript">
			WYSIWYG.attach('textarea1', full); // default setup
		</script>';
		
// Needed // dont delete // or edit //
//////////////// Configuration Slot //

$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR CLASS="vdarkBorder" >
<TD COLSPAN=2 CLASS=white><B><span style="color:white;"><center>Add a News</center></span></B></TD></TR>


<form action="?subtopic=latestnews&action=newnews" method="post" >
<tr><td class="darkBorder" align="center">
<b>Select icon:</b>
</tr></td>
</table>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100% >
    <tr>
      <td style="width:20%;" CLASS="lightBorder"><img src="images/news/icon_0.gif" width="20"><div style="margin-left:75px; margin-top:-17px"><nobr><input type="radio" name="icon_id" value="0" checked="checked"></div></td>
      <td style="width:20%;" CLASS="lightBorder"><img src="images/news/icon_1.gif" width="20"><div style="margin-left:75px; margin-top:-17px"><nobr><input type="radio" name="icon_id" value="1"></div></td>
      <td style="width:20%;" CLASS="lightBorder"><img src="images/news/icon_2.gif" width="20"><div style="margin-left:75px; margin-top:-17px"><nobr><input type="radio" name="icon_id" value="2"></div></td>
      <td style="width:20%;" CLASS="lightBorder"><img src="images/news/icon_3.gif" width="20"><div style="margin-left:75px; margin-top:-17px"><nobr><input type="radio" name="icon_id" value="3"></div></td>
      <td style="width:20%;" CLASS="lightBorder"><img src="images/news/icon_4.gif" width="20"><div style="margin-left:75px; margin-top:-17px"><nobr><input type="radio" name="icon_id" value="4"></div></td>
	</tr>
</table>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100% >
    <tr class="darkBorder">
	<td><center><b>Topic:</b></center></td>
	<td><input type="text" name="news_topic" maxlenght="50" style="width: 100%" ></td>
      </tr>
</table>
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%> <TR class="lightBorder" align="center">
<td><b>Content of the News</b></td>
</tr></table>
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%> <TR class="darkBorder" align="center"><TD width="150" valign="top">
<textarea id="textarea1" name="news_text" style="width:560px;height:200px;"></textarea>
</tr></td>
</table>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100% >
    <tr class="darkBorder">
	<td><center><b>Your nick:</b></center></td>
	<td><input type="text" name="news_name" maxlenght="40" style="width: 200px" ></td>
      </tr>
</table>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100% >
    <tr class="vdarkBorder">
	<td><center><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
<div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" >
</div>
<input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" >
</div>
</div>
</form></center></td>
	<td><center><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
<div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" >
</div><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="showNewNewsForm()" alt="CancelAddNews" /></center></td>
      </tr>
</table>
<br>
<br>';
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson
}

Note if you want this script working you will have to download the attach file.. There are the needed js scripts for the editor. The plug in is very simple paste and copy the files and it all will work!

Please note also :]
Im using a other system of filling the table content.
For having the same effect you will have to follow this


http://otland.net/803349-post22.html

Here is the whole Latest News.php someone might use it but im not sure if all functions that you need are here since it was a bit edited

PHP:
<?PHP
//######################## SHOW TICKERS AND NEWS #######################
$time = time();
$main_content .= '<div class="NewsHeadline">
	<div class="NewsHeadlineBackground" style="background-image:url(' . $layout_name . '/images/news/newsheadline_background.gif)">
		<table border="0">
			<tr>
				<td style="text-align: center; font-weight: bold;">
					<font color="white">Most powerfull guilds</font>
				</td>
			</tr>
		</table>
	</div>
</div>
<table border="0" cellspacing="3" cellpadding="4" width="100%">
	<tr>';

foreach($SQL->query('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`,
	`g`.`logo_gfx_name` AS `logo`, COUNT(`g`.`name`) as `frags`
FROM `killers` k
	LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id`
	LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id`
	LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id`
	LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id`
WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1
	GROUP BY `name`
	ORDER BY `frags` DESC, `name` ASC
	LIMIT 0, 4;') as $guild)
	$main_content .= '		<td style="width: 25%; text-align: center;">
			<a href="?subtopic=guilds&action=show&guild=' . $guild['id'] . '"><img src="guilds/' . ((!empty($guild['logo']) && file_exists('guilds/' . $guild['logo'])) ? $guild['logo'] : 'default_logo.gif') . '" width="64" height="64" border="0"/><br />' . $guild['name'] . '</a><br />' . $guild['frags'] . ' kills
		</td>';

$main_content .= '	</tr>
</table>';
if($action == "") {

if(!empty($tickers_to_add)) {
//show table with tickers
$news_content .= '<div id="newsticker" class="Box">
    <div class="Corner-tl" style="background-image: url('.$layout_name.'/images/content/corner-tl.gif);"></div>
    <div class="Corner-tr" style="background-image: url('.$layout_name.'/images/content/corner-tr.gif);"></div>
    <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
    <div class="BorderTitleText" style="background-image: url('.$layout_name.'/images/content/title-background-green.gif);"></div>
    <img class="Title" src="'.$layout_name.'/images/header/headline-newsticker.gif" alt="Contentbox headline">
    <div class="Border_2">
      <div class="Border_3">
        <div class="BoxContent" style="background-image: url('.$layout_name.'/images/content/scroll.gif);">';
if($group_id_of_acc_logged >= $config['site']['access_tickers'])
$news_content .= '<script type="text/javascript">
var showednewticker_state = "0";
function showNewTickerForm()
{
if(showednewticker_state == "0") {
document.getElementById("newtickerform").innerHTML = \'<form action="?subtopic=latestnews&action=newticker" method="post" ><table border="0"><tr><td bgcolor="D4C0A1" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="F1E0C6"><tr><td><img src="images/news/icon_0.gif" width="20"></td><td><img src="images/news/icon_1.gif" width="20"></td><td><img src="images/news/icon_2.gif" width="20"></td><td><img src="images/news/icon_3.gif" width="20"></td><td><img src="images/news/icon_4.gif" width="20"></td></tr><tr><td><input type="radio" name="icon_id" value="0" checked="checked"></td><td><input type="radio" name="icon_id" value="1"></td><td><input type="radio" name="icon_id" value="2"></td><td><input type="radio" name="icon_id" value="3"></td><td><input type="radio" name="icon_id" value="4"></td></tr></table></td></tr><tr><td align="center" bgcolor="D4C0A1"><b>New<br>ticker<br>text:</b></td><td bgcolor="F1E0C6"><textarea id="textarea1" name="new_ticker" style="width:560px;height:200px;"></textarea></td></tr><tr><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></form><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div></td></tr></table>\';
document.getElementById("jajo").innerHTML = \'\';
showednewticker_state = "1";
}
else {
document.getElementById("newtickerform").innerHTML = \'\';
document.getElementById("jajo").innerHTML = \'<div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/addticker.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div>\';
showednewticker_state = "0";
}
}
</script><div id="newtickerform"></div><div id="jajo"><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="AddTicker" src="'.$layout_name.'/images/buttons/addticker.gif" onClick="showNewTickerForm()" alt="AddTicker" /></div></div></div><hr/>';
//add tickers list
$news_content .= $tickers_to_add;
//koniec
$news_content .= '</div>
      </div>
    </div>
    <div class="Border_1" style="background-image: url('.$layout_name.'/images/content/border-1.gif);"></div>
    <div class="CornerWrapper-b"><div class="Corner-bl" style="background-image: url('.$layout_name.'/images/content/corner-bl.gif);"></div></div>
    <div class="CornerWrapper-b"><div class="Corner-br" style="background-image: url('.$layout_name.'/images/content/corner-br.gif);"></div></div>
  </div>';
}
//show "BIG" news here
$news_DB = $SQL->query('SELECT * FROM '.$SQL->tableName('z_news_big').' WHERE hide_news != 1 ORDER BY date DESC LIMIT '.$config['site']['news_big_limit'].';');
//dla kazdego duzego newsa
if(!empty($news_DB)) {
$main_content .= '<a href="?subtopic=archive"><h4>News Archives</h4></a><hr /><br />';
if($group_id_of_acc_logged >= $config['site']['access_news'])
{
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson

//////////////// Configuration Slot //
// Needed // dont delete // or edit //
	echo '<link rel="stylesheet" href="docs/style.css" type="text/css">';
	echo '<script type="text/javascript" src="scripts/wysiwyg.js"></script>';
	echo '<script type="text/javascript" src="scripts/wysiwyg-settings.js"></script>';
    echo '
		<script type="text/javascript">
			WYSIWYG.attach(\'textarea1\', full); // default setup
		</script>';
		
// Needed // dont delete // or edit //
//////////////// Configuration Slot //

$main_content .= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR CLASS="vdarkBorder" >
<TD COLSPAN=2 CLASS=white><B><span style="color:white;"><center>Add a News</center></span></B></TD></TR>


<form action="?subtopic=latestnews&action=newnews" method="post" >
<tr><td class="darkBorder" align="center">
<b>Select icon:</b>
</tr></td>
</table>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100% >
    <tr>
      <td style="width:20%;" CLASS="lightBorder"><img src="images/news/icon_0.gif" width="20"><div style="margin-left:75px; margin-top:-17px"><nobr><input type="radio" name="icon_id" value="0" checked="checked"></div></td>
      <td style="width:20%;" CLASS="lightBorder"><img src="images/news/icon_1.gif" width="20"><div style="margin-left:75px; margin-top:-17px"><nobr><input type="radio" name="icon_id" value="1"></div></td>
      <td style="width:20%;" CLASS="lightBorder"><img src="images/news/icon_2.gif" width="20"><div style="margin-left:75px; margin-top:-17px"><nobr><input type="radio" name="icon_id" value="2"></div></td>
      <td style="width:20%;" CLASS="lightBorder"><img src="images/news/icon_3.gif" width="20"><div style="margin-left:75px; margin-top:-17px"><nobr><input type="radio" name="icon_id" value="3"></div></td>
      <td style="width:20%;" CLASS="lightBorder"><img src="images/news/icon_4.gif" width="20"><div style="margin-left:75px; margin-top:-17px"><nobr><input type="radio" name="icon_id" value="4"></div></td>
	</tr>
</table>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100% >
    <tr class="darkBorder">
	<td><center><b>Topic:</b></center></td>
	<td><input type="text" name="news_topic" maxlenght="50" style="width: 100%" ></td>
      </tr>
</table>
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%> <TR class="lightBorder" align="center">
<td><b>Content of the News</b></td>
</tr></table>
<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%> <TR class="darkBorder" align="center"><TD width="150" valign="top">
<textarea id="textarea1" name="news_text" style="width:560px;height:200px;"></textarea>
</tr></td>
</table>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100% >
    <tr class="darkBorder">
	<td><center><b>Your nick:</b></center></td>
	<td><input type="text" name="news_name" maxlenght="40" style="width: 200px" ></td>
      </tr>
</table>
<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100% >
    <tr class="vdarkBorder">
	<td><center><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
<div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" >
</div>
<input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" >
</div>
</div>
</form></center></td>
	<td><center><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" >
<div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" >
<div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" >
</div><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="showNewNewsForm()" alt="CancelAddNews" /></center></td>
      </tr>
</table>
<br>
<br>';
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson
// New News System by Kavvson
}
foreach($news_DB as $news) {
$main_content .= '
<div class=\'NewsHeadline\'>
 <div class=\'NewsHeadlineBackground\' style=\'background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)\'>
    <table border=0><tr><td><img src="'.$layout_name.'/images/news/icon_'.$news['image_id'].'.gif" class=\'NewsHeadlineIcon\'  alt=\'\' />
    </td><td><font color="'.$layout_ini['news_title_color'].'">'.date("j M Y", $news['date']).' - <b>'.stripslashes($news['topic']).'</b></font></td></tr></table>
  </div>
</div>
<table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'><tr>
<td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
<td width="100%">'.stripslashes($news['text']).'<br><h6><i>Posted by </i><font color="green">'.stripslashes($news['author']).'</font>';
if($group_id_of_acc_logged >= $config['site']['access_news']) {
$main_content .= '&nbsp;<a href="?subtopic=latestnews&action=editnews&edit_date='.$news['date'].'&edit_author='.urlencode(stripslashes($news['author'])).'">Edit News</a>&nbsp;<a href="?subtopic=latestnews&action=deletenews&id='.$news['date'].'">Delete News</a>';
}
$main_content .= '</h6></td>
<td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
</tr></table>';
}
}
}
//##################### ADD NEW TICKER #####################
if($action == "newticker") {
if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
$ticker_text = stripslashes(trim($_POST['new_ticker']));
$ticker_icon = (int) $_POST['icon_id'];
if(empty($ticker_text)) {
$main_content .= 'You can\'t add empty ticker.';
}
else
{
if(empty($ticker_icon)) {
$ticker_icon = 0;
}
$SQL->query('INSERT INTO '.$SQL->tableName('z_news_tickers').' (date, author, image_id, text, hide_ticker) VALUES ('.$SQL->quote($time).', '.$account_logged->getId().', '.$ticker_icon.', '.$SQL->quote($ticker_text).', 0)');
$main_content .= '<center><h2><font color="red">Added new ticker:</font></h2></center><hr/><div id="newsticker" class="Box"><div id="TickerEntry-1" class="Row" onclick=\'TickerAction("TickerEntry-1")\'>
  <div class="Odd">
    <div class="NewsTickerIcon" style="background-image: url('.$layout_name.'/images/news/icon_'.$ticker['image_id'].'.gif);"></div>
    <div id="TickerEntry-1-Button" class="NewsTickerExtend" style="background-image: url('.$layout_name.'/images/general/plus.gif);"></div>
    <div class="NewsTickerText">
      <span class="NewsTickerDate">'.date("j M Y", $time).' -</span>
      <div id="TickerEntry-1-ShortText" class="NewsTickerShortText">';
$main_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
$main_content .= short_text($ticker_text, 60).'</div>
      <div id="TickerEntry-1-FullText" class="NewsTickerFullText">';
$main_content .= '<a href="?subtopic=latestnews&action=deleteticker&id='.$time.'"><img src="'.$layout_name.'/images/news/delete.png" border="0"></a>';
$main_content .= $ticker_text.'</div>
    </div>
  </div>
</div></div><hr/>';
}
}
else
{
$main_content .= 'You don\'t have admin rights. You can\'t add new ticker.';
}
$main_content .= '<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>';
}
//#################### DELETE (HIDE only!) TICKER ############################
if($action == "deleteticker") {
if($group_id_of_acc_logged >= $config['site']['access_tickers']) {
header("Location: ");
$date = (int) $_REQUEST['id'];
$SQL->query('UPDATE '.$SQL->tableName('z_news_tickers').' SET hide_ticker = 1 WHERE '.$SQL->fieldName('date').' = '.$date.';');
$main_content .= '<center>News tickets with <b>date '.date("j F Y, g:i a", $date).'</b> has been deleted.<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
}
else
{
$main_content .= '<center>You don\'t have admin rights. You can\'t delete tickers.<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
}
}
//################## ADD NEW NEWS ##################
if($action == "newnews") {
if($group_id_of_acc_logged >= $config['site']['access_news']) {
$news_text = stripslashes(trim($_POST['news_text']));
$news_icon = (int) $_POST['icon_id'];
$news_topic = stripslashes(trim($_POST['news_topic']));
$news_name = stripslashes(trim($_POST['news_name']));
if(empty($news_icon)) {
$news_icon = 0;
}
if(empty($news_topic)) {
$an_errors[] .= 'You can\'t add news without topic.';
}
if(empty($news_text)) {
$an_errors[] .= 'You can\'t add empty news.';
}
if(empty($news_name)) {
$an_errors[] .= 'You can\'t add news without author.';
}
if(empty($an_errors)) {
$SQL->query('INSERT INTO '.$SQL->tableName('z_news_big').' (hide_news, date, author, author_id, image_id, topic, text) VALUES (0, '.$time.', '.$SQL->quote($news_name).', '.$account_logged->getId().', '.$news_icon.', '.$SQL->quote($news_topic).', '.$SQL->quote($news_text).')');
//show added data
$main_content .= '<center><h2><font color="red">Added to news:</font></h2></center><hr/><div class=\'NewsHeadline\'>
 <div class=\'NewsHeadlineBackground\' style=\'background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)\'>
    <table border=0><tr><td><img src="'.$layout_name.'/images/news/icon_'.$news_icon.'.gif" class=\'NewsHeadlineIcon\'  alt=\'\' />
    </td><td><font color="'.$layout_ini['news_title_color'].'">'.date("j M Y", $time).' - <b>'.$news_topic.'</b></font></td></tr></table>
  </div>
</div>
<table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'><tr>
<td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
<td width="100%">'.$news_text.'<br><h6><i>Posted by </i><font color="green">'.$news_name.'</font>&nbsp;
<a href="?subtopic=latestnews&action=editnews&edit_date='.$time.'&edit_author='.urlencode($news_name).'"><img src="'.$layout_name.'/images/news/edit_news.png" border="0"></a>&nbsp;<a href="?subtopic=latestnews&action=deletenews&id='.$time.'"><img src="'.$layout_name.'/images/news/delete_news.png" border="0"></a></h6></td>
<td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
</tr></table><br/><hr/>';
//back button
$main_content .= '<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>';
}
else
{
//show errors
$main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
foreach($an_errors as $an_error) {
	$main_content .= '<li>'.$an_error;
}
$main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
//okno edycji newsa z wpisanymi danymi przeslanymi wczesniej
$main_content .= '<form action="?subtopic=latestnews&action=newnews" method="post" ><table border="0"><tr><td bgcolor="'.$config['site']['darkborder'].'" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="'.$config['site']['lightborder'].'"><tr><td><img src="'.$layout_name.'/images/news/icon_0.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_4.gif" width="20"></td></tr><tr><td><input type="radio" name="icon_id" value="0" checked="checked"></td><td><input type="radio" name="icon_id" value="1"></td><td><input type="radio" name="icon_id" value="2"></td><td><input type="radio" name="icon_id" value="3"></td><td><input type="radio" name="icon_id" value="4"></td></tr></table></td></tr><tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><b>Topic:</b></td><td><input type="text" name="news_topic" maxlenght="50" style="width: 300px" value="'.$news_topic.'" /></td></tr><tr><td align="center" bgcolor="'.$config['site']['darkborder'].'"><b>News<br>text:</b></td><td bgcolor="'.$config['site']['lightborder'].'"><textarea name="news_text" rows="6" cols="60">'.$news_text.'</textarea></td></tr><tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><b>Your nick:</b></td><td><input type="text" name="news_name" maxlenght="40" style="width: 200px" value="'.$news_nick.'" /></td></tr><tr><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></form></td><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="window.location =\'?subtopic=latestnews\'" alt="CancelAddNews" /></div></div></td></tr></table>';
}
}
else
{
$main_content .= 'You don\'t have site-admin rights. You can\'t add news.';
//back button
$main_content .= '<br><form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>';
}
}
//################## EDIT NEWS ##################
if($action == "editnews") {
if(!empty($_REQUEST['edit_date'])) {
if(!empty($_REQUEST['edit_author'])) {
if($group_id_of_acc_logged >= $config['site']['access_news']) {
$news_date = (int) $_REQUEST['edit_date'];
$news_old_name = stripslashes(trim($_REQUEST['edit_author']));
if($_POST['saveedit'] == 1) {
$news_text = stripslashes(trim($_POST['news_text']));
$news_icon = (int) $_POST['icon_id'];
$news_topic = stripslashes(trim($_POST['news_topic']));
$news_name = stripslashes(trim($_POST['news_name']));
if(empty($news_icon)) {
$news_icon = 0;
}
if(empty($news_topic)) {
$an_errors[] .= 'You can\'t save news without topic.';
}
if(empty($news_text)) {
$an_errors[] .= 'You can\'t save empty news.';
}
if(empty($news_name)) {
$an_errors[] .= 'You can\'t save news without author.';
}
if(empty($an_errors)) {
$SQL->query('UPDATE '.$SQL->tableName('z_news_big').' SET hide_news = "0", author = '.$SQL->quote($news_name).', author_id = '.$account_logged->getId().', image_id = '.$news_icon.', topic = '.$SQL->quote($news_topic).', text = '.$SQL->quote($news_text).' WHERE author = '.$SQL->quote($news_old_name).' AND date = '.$news_date.';');
//show added data
$main_content .= '<center><h2><font color="red">After edit:</font></h2></center><hr/><div class=\'NewsHeadline\'>
 <div class=\'NewsHeadlineBackground\' style=\'background-image:url('.$layout_name.'/images/news/newsheadline_background.gif)\'>
    <table border=0><tr><td><img src="'.$layout_name.'/images/news/icon_'.$news_icon.'.gif" class=\'NewsHeadlineIcon\'  alt=\'\' />
    </td><td><font color="'.$layout_ini['news_title_color'].'">'.date("j M Y", $time).' - <b>'.$news_topic.'</b></font></td></tr></table>
  </div>
</div>
<table style=\'clear:both\' border=0 cellpadding=0 cellspacing=0 width=\'100%\'><tr>
<td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
<td width="100%">'.$news_text.'<br><h6><i>Posted by </i><font color="green">'.$news_name.'</font>&nbsp;
<a href="?subtopic=latestnews&action=editnews&edit_date='.htmlspecialchars($news_date).'&edit_author='.htmlspecialchars($news_name).'"><img src="'.$layout_name.'/images/news/edit_news.png" border="0"></a>&nbsp;<a href="?subtopic=latestnews&action=deletenews&id='.$news_date.'"><img src="'.$layout_name.'/images/news/delete_news.png" border="0"></a></h6></td>
<td><img src="'.$layout_name.'/images/global/general/blank.gif" width=10 height=1 border=0 alt=\'\' /></td>
</tr></table><br/><hr/>';
//back button
$main_content .= '<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>';
}
else
{
//show errors
$main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
foreach($an_errors as $an_error) {
	$main_content .= '<li>'.$an_error;
}
$main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
//okno edycji newsa z wpisanymi danymi przeslanymi wczesniej
$main_content .= '<form action="?subtopic=latestnews&action=editnews" method="post" ><input type="hidden" name="saveedit" value="1"><input type="hidden" name="edit_date" value="'.$_REQUEST['edit_date'].'"><input type="hidden" name="edit_author" value="'.$_REQUEST['edit_author'].'"><table border="0"><tr><td bgcolor="'.$config['site']['darkborder'].'" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="'.$config['site']['lightborder'].'"><tr><td><img src="'.$layout_name.'/images/news/icon_0.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_4.gif" width="20"></td></tr><tr><td><input type="radio" name="icon_id" value="0" checked="checked"></td><td><input type="radio" name="icon_id" value="1"></td><td><input type="radio" name="icon_id" value="2"></td><td><input type="radio" name="icon_id" value="3"></td><td><input type="radio" name="icon_id" value="4"></td></tr></table></td></tr><tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><b>Topic:</b></td><td><input type="text" name="news_topic" maxlenght="50" style="width: 300px" value="'.$news_topic.'" /></td></tr><tr><td align="center" bgcolor="'.$config['site']['darkborder'].'"><b>News<br>text:</b></td><td bgcolor="'.$config['site']['lightborder'].'"><textarea name="news_text" rows="6" cols="60">'.$news_text.'</textarea></td></tr><tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><b>Your nick:</b></td><td><input type="text" name="news_name" maxlenght="40" style="width: 200px" value="'.$news_nick.'" /></td></tr><tr><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></form></td><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="window.location =\'?subtopic=latestnews\'" alt="CancelAddNews" /></div></div></td></tr></table>';
}
}
else
{
//wyswietlic zaladowany z bazy news do edycji wedlug ID
$edited = $SQL->query('SELECT * FROM '.$SQL->tableName('z_news_big').' WHERE '.$SQL->fieldName('date').' = "'.$news_date.'" AND '.$SQL->fieldName('author').' = '.$SQL->quote($news_old_name).';')->fetch();
$main_content .= '<form action="?subtopic=latestnews&action=editnews" method="post" ><input type="hidden" name="edit_date" value="'.$_REQUEST['edit_date'].'"><input type="hidden" name="edit_author" value="'.htmlspecialchars(stripslashes($_REQUEST['edit_author'])).'"><input type="hidden" name="saveedit" value="1"><table border="0"><tr><td bgcolor="'.$config['site']['darkborder'].'" align="center"><b>Select icon:</b></td><td><table border="0" bgcolor="'.$config['site']['lightborder'].'"><tr><td><img src="'.$layout_name.'/images/news/icon_0.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_1.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_2.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_3.gif" width="20"></td><td><img src="'.$layout_name.'/images/news/icon_4.gif" width="20"></td></tr><tr><td><input type="radio" name="icon_id" value="0" checked="checked"></td><td><input type="radio" name="icon_id" value="1"></td><td><input type="radio" name="icon_id" value="2"></td><td><input type="radio" name="icon_id" value="3"></td><td><input type="radio" name="icon_id" value="4"></td></tr></table></td></tr><tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><b>Topic:</b></td><td><input type="text" name="news_topic" maxlenght="50" style="width: 300px" value="'.htmlspecialchars(stripslashes($edited['topic'])).'"></td></tr><tr><td align="center" bgcolor="'.$config['site']['darkborder'].'"><b>News<br>text:</b></td><td bgcolor="'.$config['site']['lightborder'].'"><textarea name="news_text" rows="6" cols="60">'.stripslashes($edited['text']).'</textarea></td></tr><tr><td align="center" bgcolor="'.$config['site']['lightborder'].'"><b>Your nick:</b></td><td><input type="text" name="news_name" maxlenght="40" style="width: 200px" value="'.htmlspecialchars(stripslashes($edited['author'])).'"></td></tr><tr><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Submit" alt="Submit" src="'.$layout_name.'/images/buttons/_sbutton_submit.gif" ></div></div></form></td><td><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><img class="ButtonText" id="CancelAddNews" src="'.$layout_name.'/images/buttons/_sbutton_cancel.gif" onClick="window.location = \'?subtopic=latestnews\'" alt="CancelEditNews" /></div></div></td></tr></table>';
}
}
else
{
$main_content .= 'You don\'t have site-admin rights. You can\'t edit news.';
//back button
$main_content .= '<br><form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form>';
}
}
}
}
//################## DELETE (hide only!) NEWS ##################
if($action == "deletenews") {
if($group_id_of_acc_logged >= $config['site']['access_news']) {
header("Location: ");
$date = (int) $_REQUEST['id'];
$SQL->query('UPDATE '.$SQL->tableName('z_news_big').' SET hide_news = "1" WHERE date = '.$date);
$main_content .= '<center>News with <b>date '.date("j F Y, g:i a", $date).'</b> has been deleted.<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
}
else
{
$main_content .= '<center>You don\'t have admin rights. You can\'t delete news.<form action="?subtopic=latestnews" METHOD=post><div class="BigButton" style="background-image:url('.$layout_name.'/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url('.$layout_name.'/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="'.$layout_name.'/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
}
}
?>

Dont forget to rep me++

Regards.
Kavvson
 

Attachments

Code:
// New News System by Kavvson 
// New News System by Kavvson 
// New News System by Kavvson 
// New News System by Kavvson 
// New News System by Kavvson

Problems with ego?
 
This is the image of how it looks. The whole news writer is changed.
...........................
Can you add image that shows how it looks? Cause picture is not displaying
 
super, but from what i can see, there's no part about actual textarea1 (dafuq? why not a id or even class?) :/
 
Back
Top