PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Verständnisproblem bei Anpassung eines php-Skripts


ezzemm
2007-08-03, 09:04:35
Hallo zusammen!

Ich bin gerade dabei ein neues Design für unsere Clanhomepage zu machen,
und in diesem Zusammenhang baue ich das table-basierte Layout unseres
CMS "Webspell" in ein CSS-basiertes Layout um.

Das Gerüst habe ich nun fertig, und mit dem News-Template auch das erste
der CMS-Templates. Dabei ist mir aufgefallen, daß ich nicht alle Änderungen,
die ich mir vorgenommen habe, auch in den Templates vornehmen kann.

Damit ihr seht worum es geht, hier der Link zur Testumgebung:
http://www.sixbitunder.com/pagedev/
Ihr seht über den einzelnen News, deren Optik ich im Template ändern
konnte, die Überschrift "News", dann einen Button "News Archive", dann eine
horizontale Linie und dann fangen die News an.
Wenn man die entsprechenden Rechte hat, sieht man außer dem
Button "News Archive" noch einen Button "Post News" sowie, falls welche
vorhanden, "x unpublished News".

Ich möchte nun die Überschrift "News" und die horizontale Linie raus haben,
die drei Buttons im Idealfall in die Navigation rechts packen, ansonsten am
unteren Ende der Seite unter die letzte News.
Nur leider verstehe ich die PHP-Syntax hinten und vorne nicht; kann mir
jemand helfen und sagen wo ich in dem File anfangen muß und wo ich welche
Zeile löschen oder hinkopieren muß?

<?php

$action = $_GET['action'];
if($action=="new") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isnewsadmin($userID)) die('No access.');

echo '<html><head>';
echo'<script src="js/bbcode.js" language="jscript" type="text/javascript"></script>
<link href="_stylesheet.css" rel="stylesheet" type="text/css"></head><body>';

if(isnewsadmin($userID)) {
safe_query("DELETE FROM ".PREFIX."news WHERE headline1='' AND lang1='' AND lang2='' AND headline2=''");
safe_query("INSERT INTO ".PREFIX."news (date, poster, saved) VALUES ('".time()."', '$userID', '0')");
$newsID=mysql_insert_id();

$newsrubrics=safe_query("SELECT rubricID, rubric FROM ".PREFIX."news_rubrics ORDER BY rubric");
while($dr=mysql_fetch_array($newsrubrics)) {
$rubrics.='<option value="'.$dr[rubricID].'">'.$dr[rubric].'</option>';
}

if($_POST['topnews']) safe_query("UPDATE ".PREFIX."settings SET topnewsID='$newsID'");

$lang=safe_query("SELECT lang, language FROM ".PREFIX."news_languages ORDER BY language");
while($dl=mysql_fetch_array($lang)) {
if($dl[lang]=="de") $langs1.='<option value="'.$dl[lang].'" selected>'.$dl[language].'</option>';
else $langs1.='<option value="'.$dl[lang].'">'.$dl[language].'</option>';

if($dl[lang]=="uk") $langs2.='<option value="'.$dl[lang].'" selected>'.$dl[language].'</option>';
else $langs2.='<option value="'.$dl[lang].'">'.$dl[language].'</option>';
}
$url1="http://";
$url2="http://";
$url3="http://";
$url4="http://";

$bg1=BG_1;
eval ("\$addbbcode = \"".gettemplate("addbbcode")."\";");
eval ("\$addflags = \"".gettemplate("flags")."\";");

eval ("\$news_post = \"".gettemplate("news_post")."\";");
echo $news_post;
}
else redirect('index.php?site=news', 'no access!');
}
elseif($action=="save") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isnewsadmin($userID)) die('No access.');

$newsID = $_POST['newsID'];
$save = $_POST['save'];
$preview = $_POST['preview'];

$rubric = $_POST['rubric'];

$lang1 = $_POST['lang1'];
$headline1 = $_POST['headline1'];
$message = $_POST['message'];

$lang2 = $_POST['lang2'];
$headline2 = $_POST['headline2'];
$content2 = $_POST['content2'];

$link1 = $_POST['link1'];
$url1 = $_POST['url1'];
$window1 = $_POST['window1'];

$link2 = $_POST['link2'];
$url2 = $_POST['url2'];
$window2 = $_POST['window2'];

$link3 = $_POST['link3'];
$url3 = $_POST['url3'];
$window3 = $_POST['window3'];

$link4 = $_POST['link4'];
$url4 = $_POST['url4'];
$window4 = $_POST['window4'];

$intern = $_POST['intern'];
$comments = $_POST['comments'];

safe_query("UPDATE ".PREFIX."news SET rubric='$rubric',
lang1='$lang1',
headline1='".mysql_escape_string($headline1)."',
content1='".mysql_escape_string($message)."',
lang2='$lang2',
headline2='".mysql_escape_string($headline2)."',
content2='".mysql_escape_string($content2)."',
link1='$link1',
url1='$url1',
window1='$window1',
link2='$link2',
url2='$url2',
window2='$window2',
link3='$link3',
url3='$url3',
window3='$window3',
link4='$link4',
url4='$url4',
window4='$window4',
saved='1',
intern='$intern',
comments='$comments' WHERE newsID='$newsID'");

// löschen der einträge die älter als 1 stunde sind und keinen text enthalten
$ergebnis=safe_query("SELECT * FROM ".PREFIX."news WHERE headline1='' OR content1=''");
while($ds=mysql_fetch_array($ergebnis)) {
if((time()-$ds[date]) > (60*60)) safe_query("DELETE FROM ".PREFIX."news WHERE newsID='$ds[newsID]'");
}


if($_POST['topnews']) safe_query("UPDATE ".PREFIX."settings SET topnewsID='$newsID'");

if($save) echo'<body onLoad="window.close()"></body>';
if($preview) header("Location: news.php?action=preview&newsID=$newsID");


}
elseif($action=="preview") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isnewsadmin($userID)) die('No access.');


$newsID = $_GET['newsID'];

echo'<script src="js/bbcode.js" language="jscript" type="text/javascript"></script>
<link href="_stylesheet.css" rel="stylesheet" type="text/css">';

$bg1=BG_1;

eval ("\$title_news = \"".gettemplate("title_news")."\";");
echo $title_news;

$result=safe_query("SELECT * FROM ".PREFIX."news WHERE newsID='$newsID'");
$ds=mysql_fetch_array($result);
$bgcolor=BG_1;
$date = date("d.m.Y", $ds[date]);
$time = date("H:i", $ds[date]);
$rubrikname=getrubricname($ds[rubric]);
$rubricpic='<img src="images/news-rubrics/'.getrubricpic($ds[rubric]).'">';
if(!file_exists($rubricpic)) $rubricpic = '';

$lang=$ds[lang1];
$language1="".$ds[lang1]."";
$language2="".$ds[lang2]."";

if($lang==$ds[lang1]) {
if($ds[headline1]) $headline = $ds[headline1];
else $headline = $ds[headline2];

if($ds[content1]) $content = $ds[content1];
else $content='no version in selected language available!.[br][br]'.$ds[content2];

$langs='';
if($ds[headline2]) {
$langs='<a href="news.php?action=preview&newsID='.$ds[newsID].'&lang='.$ds[lang2].'">'.flags($language2).'</a>';
$language=getlanguage($ds[lang2]);
$langs = eregi_replace ('(alt=")(.*)(")',"\\1 news in $language\\3",$langs);
}
}
else {
if($ds[headline2]) $headline = $ds[headline2];
else $headline = $ds[headline1];

if($ds[content2]) $content = $ds[content2];
else $content='no version in selected language available!.[br][br]'.$ds[content1];

$langs='';
if($ds[headline1]) {
$langs='<a href="news.php?action=preview&newsID='.$ds[newsID].'&lang='.$ds[lang1].'">'.flags($language1).'</a>';
$language=getlanguage($ds[lang1]);
$langs = eregi_replace ('(alt=")(.*)(")',"\\1 news in $language\\3",$langs);
}
}

$content = htmloutput($content);
$content = toggle($content, $ds[newsID]);
$poster='<a href="index.php?site=profile&id='.$ds[poster].'"><b>'.getnickname($ds[poster]).'</b></a>';
if($ds[link1] && $ds[url1]!="http://" && $ds[window1]) $related.='• <a href="'.$ds[url1].'" target="_blank">'.$ds[link1].'</a> ';
if($ds[link1] && $ds[url1]!="http://" && !$ds[window1]) $related.='• <a href="'.$ds[url1].'">'.$ds[link1].'</a> ';

if($ds[link2] && $ds[url2]!="http://" && $ds[window2]) $related.='• <a href="'.$ds[url2].'" target="_blank">'.$ds[link2].'</a> ';
if($ds[link2] && $ds[url2]!="http://" && !$ds[window2]) $related.='• <a href="'.$ds[url2].'">'.$ds[link2].'</a> ';

if($ds[link3] && $ds[url3]!="http://" && $ds[window3]) $related.='• <a href="'.$ds[url3].'" target="_blank">'.$ds[link3].'</a> ';
if($ds[link3] && $ds[url3]!="http://" && !$ds[window3]) $related.='• <a href="'.$ds[url3].'">'.$ds[link3].'</a> ';

if($ds[link4] && $ds[url4]!="http://" && $ds[window4]) $related.='• <a href="'.$ds[url4].'" target="_blank">'.$ds[link4].'</a> ';
if($ds[link4] && $ds[url4]!="http://" && !$ds[window4]) $related.='• <a href="'.$ds[url4].'">'.$ds[link4].'</a> ';

eval ("\$news = \"".gettemplate("news")."\";");
echo $news;

echo'<hr noshade size="1" color="'.BORDER.'">
<input type="button" class="button" onClick="MM_goToURL(\'parent\',\'news.php?action=edit&newsID='.$newsID.'\');return document.MM_returnValue" value="edit news">
<input type="button" class="button" onClick="javascript:self.close()" value="save news">
<input type="button" class="button" onClick="MM_confirm(\'really delete this entry?\', \'news.php?action=delete&id=$newsID&close=true\')" value="cancel">';
}
elseif($_POST['quickactiontype']=="publish" OR $_GET['quickactiontype']=="publish") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isnewsadmin($userID)) die('No access.');

$newsID = $_POST['newsID'];

if(is_array($newsID)) {
foreach($newsID as $id) {
safe_query("UPDATE ".PREFIX."news SET published='1' WHERE newsID='$id'");
}
}
header("Location: index.php?site=news");
}
elseif($_POST['quickactiontype']=="unpublish" OR $_GET['quickactiontype']=="unpublish") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isnewsadmin($userID)) die('No access.');

$newsID = $_POST['newsID'];
if(!$newsID) $newsID[] = $_GET['newsID'];

foreach($newsID as $id) {
safe_query("UPDATE ".PREFIX."news SET published='0' WHERE newsID='$id'");
}
header("Location: index.php?site=news");
}
elseif($_POST['quickactiontype']=="delete") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isnewsadmin($userID)) die('No access.');

$newsID = $_POST['newsID'];

foreach($newsID as $id) {
$ds=mysql_fetch_array(safe_query("SELECT screens FROM ".PREFIX."news WHERE newsID='$id'"));
if($ds[screens]) {
$screens=explode("|", $ds[screens]);
if(is_array($screens)) {
$filepath = "./images/news-pics/";
foreach($screens as $screen) {
if(file_exists($filepath.$screen)) @unlink($filepath.$screen);
}
}
}
safe_query("DELETE FROM ".PREFIX."news WHERE newsID='$id'");
safe_query("DELETE FROM ".PREFIX."comments WHERE parentID='$id' AND type='ne'");
}
header("Location: index.php?site=news");
}
elseif($action=="delete") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isnewsadmin($userID)) die('No access.');

$id = $_GET['id'];

$ds=mysql_fetch_array(safe_query("SELECT screens FROM ".PREFIX."news WHERE newsID='$id'"));
if($ds[screens]) {
$screens=explode("|", $ds[screens]);
if(is_array($screens)) {
$filepath = "./images/news-pics/";
foreach($screens as $screen) {
if(file_exists($filepath.$screen)) @unlink($filepath.$screen);
}
}
}

safe_query("DELETE FROM ".PREFIX."news WHERE newsID='$id'");
safe_query("DELETE FROM ".PREFIX."comments WHERE parentID='$id' AND type='ne'");

if($close) echo'<body onLoad="window.close()"></body>';
else header("Location: index.php?site=news");
}
elseif($action=="edit") {
include("_mysql.php");
include("_settings.php");
include("_functions.php");
if(!isnewsadmin($userID)) die('No access.');

$newsID = $_GET['newsID'];

echo'<script src="js/bbcode.js" language="jscript" type="text/javascript"></script>
<link href="_stylesheet.css" rel="stylesheet" type="text/css">';

$ds=mysql_fetch_array(safe_query("SELECT * FROM ".PREFIX."news WHERE newsID='$newsID'"));
$lang=safe_query("SELECT lang, language FROM ".PREFIX."news_languages ORDER BY language");
while($dl=mysql_fetch_array($lang)) {
if($dl[lang]==$ds[lang1]) $langs1.='<option value="'.$dl[lang].'" selected>'.$dl[language].'</option>';
else $langs1.='<option value="'.$dl[lang].'">'.$dl[language].'</option>';

if($dl[lang]==$ds[lang2]) $langs2.='<option value="'.$dl[lang].'" selected>'.$dl[language].'</option>';
else $langs2.='<option value="'.$dl[lang].'">'.$dl[language].'</option>';
}

$headline1=getinput($ds[headline1]);
$message=getinput($ds[content1]);
$headline2=getinput($ds[headline2]);
$content2=getinput($ds[content2]);

$newsrubrics=safe_query("SELECT * FROM ".PREFIX."news_rubrics ORDER BY rubric");
while($dr=mysql_fetch_array($newsrubrics)) {
if($ds[rubric]==$dr[rubricID]) $rubrics.='<option value="'.$dr[rubricID].'" selected>'.$dr[rubric].'</option>';
else $rubrics.='<option value="'.$dr[rubricID].'">'.$dr[rubric].'</option>';
}

if($ds[intern]) $intern = '<option value="0">No</option><option value="1" selected>Yes</option>';
else $intern = '<option value="0" selected>No</option><option value="1">Yes</option>';

$link1=$ds[link1];
$link2=$ds[link2];
$link3=$ds[link3];
$link4=$ds[link4];

$url1="http://";
$url2="http://";
$url3="http://";
$url4="http://";

if($ds[url1]!="http://") $url1=$ds[url1];
if($ds[url2]!="http://") $url2=$ds[url2];
if($ds[url3]!="http://") $url3=$ds[url3];
if($ds[url4]!="http://") $url4=$ds[url4];

if($ds[window1]) $window1='<input class="input" name="window1" type="radio" value="1" checked> new window <input class="input" type="radio" name="window1" value="0"> _self';
else $window1='<input class="input" name="window1" type="radio" value="1"> new window <input class="input" type="radio" name="window1" value="0" checked> _self';

if($ds[window2]) $window2='<input class="input" name="window2" type="radio" value="1" checked> new window <input class="input" type="radio" name="window2" value="0"> _self';
else $window2='<input class="input" name="window2" type="radio" value="1"> new window <input class="input" type="radio" name="window2" value="0" checked> _self';

if($ds[window3]) $window3='<input class="input" name="window3" type="radio" value="1" checked> new window <input class="input" type="radio" name="window3" value="0"> _self';
else $window3='<input class="input" name="window3" type="radio" value="1"> new window <input class="input" type="radio" name="window3" value="0" checked> _self';

if($ds[window4]) $window4='<input class="input" name="window4" type="radio" value="1" checked> new window <input class="input" type="radio" name="window4" value="0"> _self';
else $window4='<input class="input" name="window4" type="radio" value="1"> new window <input class="input" type="radio" name="window4" value="0" checked> _self';

if($ds[picalign]=="left") $align='<input class="input" type="radio" name="align" value="left" checked> left
<input class="input" type="radio" name="align" value="right"> right';
else $align='<input class="input" type="radio" name="align" value="left"> left
<input class="input" type="radio" name="align" value="right" checked> right';

$comments='<option value="0">disable comments</option><option value="1">enable user comments</option><option value="2">enable visitor comments</option>';
$comments=str_replace('value="'.$ds[comments].'"', 'value="'.$ds[comments].'" selected', $comments);

$bg1=BG_1;

eval ("\$addbbcode = \"".gettemplate("addbbcode")."\";");
eval ("\$addflags = \"".gettemplate("flags")."\";");

eval ("\$news_edit = \"".gettemplate("news_edit")."\";");
echo $news_edit;
}
elseif($action=="unpublished") {
eval ("\$title_news = \"".gettemplate("title_news")."\";");
echo $title_news;

if(isnewsadmin($userID)) $post='<input type="button" class="button" onClick="MM_openBrWindow(\'news.php?action=new\',\'News\',\'toolbar=no,status=no,scrollba rs=yes,width=800,height=600\')" value="post News">';

echo $post.' <input type="button" class="button" onClick="MM_goToURL(\'parent\',\'index.php?site=news\');return document.MM_returnValue" value="show News"><hr noshade size="1" color="'.BORDER.'">';

// Not published News
if(isnewsadmin($userID)) {
$ergebnis=safe_query("SELECT * FROM ".PREFIX."news WHERE published='0' AND saved='1' ORDER BY date ASC");
if(mysql_num_rows($ergebnis)) {
echo'<h2>NOT PUBLISHED NEWS:</h2>';

echo'<form method="post" name="form" action="news.php">';
eval ("\$news_archive_head = \"".gettemplate("news_archive_head")."\";");
echo $news_archive_head;

$i=1;
while($ds=mysql_fetch_array($ergebnis)) {
if($i%2) {
$bg1=BG_1;
$bg2=BG_2;
}
else {
$bg1=BG_3;
$bg2=BG_4;
}

$date=date("d.m.Y", $ds[date]);
$rubric=getrubricname($ds[rubric]);
$language1="".$ds[lang1]."";
$language2="".$ds[lang2]."";

if($ds[headline1]) {
$langs='<a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang1].'">'.flags($language1).'</a>';
$language=getlanguage($ds[lang1]);
$langs = eregi_replace ('(alt=")(.*)(")',"\\1 news in $language\\3",$langs);
$headline='<a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang1].'">'.clearfromtags($ds[headline1]).'</a>';
}
if($ds[headline2]) {
$lang2=' <a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang2].'">'.flags($language2).'</a>';
$language=getlanguage($ds[lang2]);
$lang2 = eregi_replace ('(alt=")(.*)(")',"\\1 news in $language\\3",$lang2);
$langs.=$lang2;
$headline.=' - <a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang2].'">'.clearfromtags($ds[headline2]).'</a>';
}

$poster='<a href="index.php?site=profile&id='.$ds[poster].'">'.getnickname($ds[poster]).'</a>';

$multiple='';
$admdel='';
if(isnewsadmin($userID)) {
$multiple='<input class="input" type="checkbox" name="newsID[]" value="'.$ds[newsID].'">';
$admdel='<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td><input class="input" type="checkbox" name="ALL" value="ALL" onClick="SelectAll(this.form);"> select all</td>
<td align="right"><select name="quickactiontype">
<option value="publish">publish selected</option>
<option value="delete">delete selected</option>
</select>
<input type="submit" name="quickaction" value="go"></td>
</tr>
</table></form>';

}
eval ("\$news_archive_content = \"".gettemplate("news_archive_content")."\";");
echo $news_archive_content;
$i++;
}
eval ("\$news_archive_foot = \"".gettemplate("news_archive_foot")."\";");
echo $news_archive_foot;

unset($ds);
}
}
}
elseif($action=="archive") {
eval ("\$title_news = \"".gettemplate("title_news")."\";");
echo $title_news;

$page=$_GET['page'];
$sort=$_GET['sort'];
$type=$_GET['type'];
$post='';
$publish='';
if(isnewsadmin($userID)) {
$post='<input type="button" class="button" onClick="MM_openBrWindow(\'news.php?action=new\',\'News\',\'toolbar=no,status=no,scrollba rs=yes,width=800,height=600\')" value="post News">';
$unpublished=safe_query("SELECT newsID FROM ".PREFIX."news WHERE published='0' AND saved='1'");
$unpublished=mysql_num_rows($unpublished);
if($unpublished) $publish='<input type="button" class="button" onClick="MM_goToURL(\'parent\',\'index.php?site=news&action=unpublished\');return document.MM_returnValue" value="'.$unpublished.' unpublished News"> ';
}
echo $post.' '.$publish.' <input type="button" class="button" onClick="MM_goToURL(\'parent\',\'index.php?site=news\');return document.MM_returnValue" value="show News"><hr noshade size="1" color="'.BORDER.'">';

$all=safe_query("SELECT newsID FROM ".PREFIX."news WHERE published='1' AND intern<=".isclanmember($userID));
$all=mysql_num_rows($all);
$pages=1;
if(!isset($page)) $page = 1;
if(!isset($sort)) $sort = "date";
if(!isset($type)) $type = "DESC";

$max = empty($maxnewsarchiv) ? 20 : $maxnewsarchiv;


for ($n=$max; $n<=$all; $n+=$max) {
if($all>$n) $pages++;
}

if($pages>1) $page_link = makepagelink("index.php?site=news&action=archive&sort=$sort&type=$type", $page, $pages);

if ($page == "1") {
$ergebnis = safe_query("SELECT * FROM ".PREFIX."news WHERE published='1' AND intern<=".isclanmember($userID)." ORDER BY $sort $type LIMIT 0,$max");
if($type=="DESC") $n=$gesamt;
else $n=1;
}
else {
$start=$page*$max-$max;
$ergebnis = safe_query("SELECT * FROM ".PREFIX."news WHERE published='1' AND intern<=".isclanmember($userID)." ORDER BY $sort $type LIMIT $start,$max");
if($type=="DESC") $n = ($gesamt)-$page*$max+$max;
else $n = ($gesamt+1)-$page*$max+$max;
}
if($all) {
if($type=="ASC")
echo'<a href="index.php?site=news&action=archive&page='.$page.'&sort='.$sort.'&type=DESC">Sort:</a> <img src="images/icons/asc.gif" width="9" height="7" border="0">&nbsp;&nbsp;&nbsp;';
else
echo'<a href="index.php?site=news&action=archive&page='.$page.'&sort='.$sort.'&type=ASC">Sort:</a> <img src="images/icons/desc.gif" width="9" height="7" border="0">&nbsp;&nbsp;&nbsp;';


if($pages>1) echo $page_link;
if(isnewsadmin($userID)) echo'<form method="post" name="form" action="news.php">';
eval ("\$news_archive_head = \"".gettemplate("news_archive_head")."\";");
echo $news_archive_head;
$i=1;
while($ds=mysql_fetch_array($ergebnis)) {
if($i%2) {
$bg1=BG_1;
$bg2=BG_2;
}
else {
$bg1=BG_3;
$bg2=BG_4;
}

$date=date("d.m.Y", $ds[date]);
$rubric=getrubricname($ds[rubric]);
$language1="".$ds[lang1]."";
$language2="".$ds[lang2]."";

$comms = getanzcomments($ds[newsID], 'ne');

if($ds[headline1]) {
$langs='<a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang1].'">'.flags($language1).'</a>';
$language=getlanguage($ds[lang1]);
$langs = eregi_replace ('(alt=")(.*)(")',"\\1 news in $language\\3",$langs);

$headline='<a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang1].'"><b>'.getinput($ds[headline1]).'</b></a>';
}
if($ds[headline2]) {
$lang2=' <a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang2].'">'.flags($language2).'</a>';
$language=getlanguage($ds[lang2]);
$lang2 = eregi_replace ('(alt=")(.*)(")',"\\1 news in $language\\3",$lang2);
$langs.=$lang2;

$headline.=' - <a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang2].'"><b>'.getinput($ds[headline2]).'</b></a>';
}

$poster='<a href="index.php?site=profile&id='.$ds[poster].'">'.getnickname($ds[poster]).'</a>';

$multiple='';
$admdel='';
if(isnewsadmin($userID)) $multiple='<input class="input" type="checkbox" name="newsID[]" value="'.$ds[newsID].'">';

eval ("\$news_archive_content = \"".gettemplate("news_archive_content")."\";");
echo $news_archive_content;
$i++;
}
if(isnewsadmin($userID)) $admdel='<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td><input class="input" type="checkbox" name="ALL" value="ALL" onClick="SelectAll(this.form);"> select all</td>
<td align="right"><select name="quickactiontype">
<option value="delete">delete selected</option>
<option value="unpublish">unpublish selected</option>
</select>
<input type="submit" name="quickaction" value="go"></td>
</tr>
</table></form>';

eval ("\$news_archive_foot = \"".gettemplate("news_archive_foot")."\";");
echo $news_archive_foot;
unset($ds);

}
else echo'no entries';
}
else {
eval ("\$title_news = \"".gettemplate("title_news")."\";");
echo $title_news;

$post='';
$publish='';
if(isnewsadmin($userID)) {
$post='<input type="button" class="button" onClick="MM_openBrWindow(\'news.php?action=new\',\'News\',\'toolbar=no,status=no,scrollba rs=yes,width=800,height=600\')" value="post News">';
$unpublished=safe_query("SELECT newsID FROM ".PREFIX."news WHERE published='0' AND saved='1'");
$unpublished=mysql_num_rows($unpublished);
if($unpublished) $publish='<input type="button" class="button" onClick="MM_goToURL(\'parent\',\'index.php?site=news&action=unpublished\');return document.MM_returnValue" value="'.$unpublished.' unpublished News"> ';
}
echo $post.' '.$publish.'<input type="button" class="button" onClick="MM_goToURL(\'parent\',\'index.php?site=news&action=archive\');return document.MM_returnValue" value="News-Archive"><hr noshade size="1" color="'.BORDER.'">';

if($_GET['show']) {
$result=safe_query("SELECT rubricID FROM ".PREFIX."news_rubrics WHERE rubric='".$_GET['show']."' LIMIT 0,1");
$dv=mysql_fetch_array($result);
$showonly = "AND rubric='".$dv[rubricID]."'";
}

$result=safe_query("SELECT * FROM ".PREFIX."news WHERE published='1' AND intern<=".isclanmember($userID)." $showonly ORDER BY date DESC LIMIT 0,$maxshownnews");
$i=1;
while($ds=mysql_fetch_array($result)) {
if($i%2) $bg1=BG_1;
else $bg1=BG_2;

$date = date("d.m.Y", $ds[date]);
$time = date("H:i", $ds[date]);
$rubrikname=getrubricname($ds[rubric]);
$rubricpic_path = "images/news-rubrics/".getrubricpic($ds[rubric]);
$rubricpic='<img src="'.$rubricpic_path.'" border="0">';
echo $rubripic;
if(!is_file($rubricpic_path)) $rubricpic='';

$lang=$ds[lang1];
$language1="".$ds[lang1]."";
$language2="".$ds[lang2]."";

if($lang==$ds[lang1]) {
if($ds[headline1]) $headline = $ds[headline1];
else $headline = $ds[headline2];

if($ds[content1]) $content = $ds[content1];
else $content='no version in selected language available!.[br][br]'.$ds[content2];

if($ds[headline2]) {
$langs='<a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang2].'">'.flags($language2).'</a>';
$language=getlanguage($ds[lang2]);
$langs = eregi_replace ('(alt=")(.*)(")',"\\1 news in $language\\3",$langs);
}
else $langs='';
}
else {
if($ds[headline2]) $headline = $ds[headline2];
else $headline = $ds[headline1];

if($ds[content2]) $content = $ds[content2];
else $content='no version in selected language available!.[br][br]'.$ds[content1];

if($ds[headline1]) {
$langs='<a href="index.php?site=news_comments&newsID='.$ds[newsID].'&lang='.$ds[lang1].'">'.flags($language1).'</a>';
$language=getlanguage($ds[lang1]);
$langs = eregi_replace ('(alt=")(.*)(")',"\\1 news in $language\\3",$langs);
}
else $langs='';
}

$content = htmloutput($content);
$content = toggle($content, $ds[newsID]);
$headline = clearfromtags($headline);
$poster='<a href="index.php?site=profile&id='.$ds[poster].'"><b>'.getnickname($ds[poster]).'</b></a>';
if($ds[link1] && $ds[url1]!="http://" && $ds[window1]) $related.='• <a href="'.$ds[url1].'" target="_blank">'.$ds[link1].'</a> ';
if($ds[link1] && $ds[url1]!="http://" && !$ds[window1]) $related.='• <a href="'.$ds[url1].'">'.$ds[link1].'</a> ';

if($ds[link2] && $ds[url2]!="http://" && $ds[window2]) $related.='• <a href="'.$ds[url2].'" target="_blank">'.$ds[link2].'</a> ';
if($ds[link2] && $ds[url2]!="http://" && !$ds[window2]) $related.='• <a href="'.$ds[url2].'">'.$ds[link2].'</a> ';

if($ds[link3] && $ds[url3]!="http://" && $ds[window3]) $related.='• <a href="'.$ds[url3].'" target="_blank">'.$ds[link3].'</a> ';
if($ds[link3] && $ds[url3]!="http://" && !$ds[window3]) $related.='• <a href="'.$ds[url3].'">'.$ds[link3].'</a> ';

if($ds[link4] && $ds[url4]!="http://" && $ds[window4]) $related.='• <a href="'.$ds[url4].'" target="_blank">'.$ds[link4].'</a> ';
if($ds[link4] && $ds[url4]!="http://" && !$ds[window4]) $related.='• <a href="'.$ds[url4].'">'.$ds[link4].'</a> ';

if(empty($related)) $related="n/a";

if($ds[comments]) {
if($ds[cwID]) { // CLANWAR-NEWS
$anzcomments = getanzcomments($ds[cwID], 'cw');
if($anzcomments) $comments='<a href="index.php?site=clanwars_details&cwID='.$ds[cwID].'">['.$anzcomments.'] comments</a> latest by '.getlastcommentposter($ds[cwID], 'cw').' - '.date("d.m.Y - H:i", getlastcommentdate($ds[cwID], 'cw'));
else $comments='<a href="index.php?site=clanwars_details&cwID='.$ds[cwID].'">[0] comments</a>';
}
else {
$anzcomments = getanzcomments($ds[newsID], 'ne');
if($anzcomments) $comments='<a href="index.php?site=news_comments&newsID='.$ds[newsID].'">['.$anzcomments.'] comments</a> latest by '.getlastcommentposter($ds[newsID], 'ne').' - '.date("d.m.Y - H:i", getlastcommentdate($ds[newsID], 'ne'));
else $comments='<a href="index.php?site=news_comments&newsID='.$ds[newsID].'">[0] comments</a>';
}
}
else $comments='';

if(isnewsadmin($userID)) $adminaction='<input type="button" class="button" onClick="MM_goToURL(\'parent\',\'news.php?quickactiontype=unpublish&newsID='.$ds[newsID].'\');return document.MM_returnValue" value="unpublish">
<input type="button" class="button" onClick="MM_openBrWindow(\'news.php?action=edit&newsID='.$ds[newsID].'\',\'News\',\'toolbar=no,status=no,scrollbars=yes,width=800,height=600\')" value="edit">
<input type="button" class="button" onClick="MM_confirm(\'really delete this entry?\', \'news.php?action=delete&id='.$ds[newsID].'\')" value="delete">';
else $adminaction='';

eval ("\$news = \"".gettemplate("news")."\";");
echo $news;

$i++;

unset($related);
unset($comments);
unset($lang);
unset($ds);
}
}

?>

ezzemm
2007-08-03, 09:10:55
Ich habe einen Screenshot gemacht damit man sieht, wieviele Buttons insgesamt dargestellt werden, wenn man die entsprechenden Rechte hat.
Vielleicht hilfts ja :)

Flipper
2007-08-03, 10:57:46
Ist dir klar dass du die Änderung jedes Mal machen musst wenn eine neue Version rauskommt? Und sich da aber Teile des Quelltextes ändern können?

ezzemm
2007-08-03, 11:12:09
Ist dir klar dass du die Änderung jedes Mal machen musst wenn eine neue Version rauskommt? Und sich da aber Teile des Quelltextes ändern können?

Ja, natürlich. Aber es ist ja nicht so daß das CMS ein Auto-Updater hätte oder so.