ilch Forum » Ilch Clan 1.1 » Module und Modifikationen » [ERLEDIGT] News ansicht Modifizieren

Geschlossen
  1. #1
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    News Extended 1.4c News ansicht Modifizieren.

    Hallo alle,

    Bin an ein Projekt und komm nicht mehr weiter.
    Ich möchte die News ansicht mit der Mod News Extended 1.4c Modifizieren,
    so das es wie bei ilch anschaulich ist.

    gesperrtes Bild

    Das habe ich hin bekommen.
    gesperrtes Bild

    von News Extended 1.4c.
    include/contents/news/news.php:
    <?php
    // Copyright by: Manuel Staechele
    // Support: www.ilch.de
    // Modded by Mairu für News Extended
    defined ('main') or die ('no direct access');
    
    $title = $allgAr['title'] . ' :: News';
    $hmenu = 'News';
    $design = new design ($title , $hmenu);
    $design->addheader('<link rel="alternate" type="application/atom+xml" title="News (Atom)" href="index.php?news-atom" />
    <link rel="alternate" type="application/rss+xml" title="News (RSS)" href="index.php?news-rss" />');
    
    function news_find_kat ($kat) {
        $katpfad = 'include/images/news/';
        $katjpg = $katpfad . $kat . '.jpg';
        $katgif = $katpfad . $kat . '.gif';
        $katpng = $katpfad . $kat . '.png';
    
        if (file_exists($katjpg)) {
            $pfadzumBild = $katjpg;
        } elseif (file_exists ($katgif)) {
            $pfadzumBild = $katgif;
        } elseif (file_exists ($katpng)) {
            $pfadzumBild = $katpng;
        }
    
        if (!empty($pfadzumBild)) {
            $kategorie = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
        } else {
            $kategorie = '<b>' . $kat . '</b><br /><br />';
        }
    
        return ($kategorie);
    }
    // Schaut ob ein Name so oder ähnlich in der Datenbank vorhanden ist
    // gibt true zurück falls der Name noch nicht verwendet ist
    function checkName($name) {
        if (db_count_query("SELECT COUNT(name) FROM prefix_user WHERE name LIKE '$name'")) {
            return false;
        } else {
            return true;
        }
    }
    
    function checkKomName($name) {
        $resp = new xajaxResponse();
        if (checkName($name) OR loggedin()) {
            $resp->script('document.forms["komform"].submit();');
        } else {
            $resp->assign('komname', 'value' , '');
            $resp->alert('Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.');
            $resp->script("document.getElementById('komname').focus();");
        }
        return $resp;
    }
    // xajax für namencheck
    $xajax = new xajax();
    $xajax->configureMany(array('decodeUTF8Input' => true ,'characterEncoding' => 'ISO-8859-1', 'requestURI' => 'admin.php?news-ajax'));
    $xajax->register(XAJAX_FUNCTION, 'checkKomName');
    $xajax->processRequest();
    
    if ($menu->get(1) == 'ajax') {
        exit();
    }
    
    if (!is_numeric($menu->get(1))) {
        if ($menu->get(1) == 'rss' || $menu->get(1) == 'atom') {
            // ob_clean();
            $feed_type = $menu->get(1);
    
            $abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
            $erg = db_query($abf);
            $row = db_fetch_assoc($erg);
            $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
    
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
    
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,";
            $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
            $abf .= "a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          a.html
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE (a.news_recht | 1) = a.news_recht AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND a.news_id != $tn_id AND a.`archiv` != 1 AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY news_time DESC LIMIT 15";
            $erg = db_query($abf);
            $tpl = new tpl('news_' . $menu->get(1) . '.htm');
    
            header('Content-type: application/' . $menu->get(1) . '+xml');
    
            $tpl->set_ar_out(array(
    				'FEEDTITLE' => $allgAr['title'],
                    'UPDATED' => $last_update,
                    'SITEURL' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])
    				), 0);
            while ($row = db_fetch_assoc($erg)) {
                if ($feed_type == 'atom') {
                    $Z = (date('Z') > 0 ? '+' : '') . date('H:i:s', date('Z') + 23 * 3600);
                    $row['datum'] = str_replace(' ', 'T', $row['datum']) . $Z;
                }
    
                $a = explode('[PREVIEWENDE]', $row['text']);
                $tpl->set_ar_out(array(
    					'TITLE' => $row['title'],
                        'TXT' => $row['html'] ? $a[0] : bbcode($a[0]),
                        'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?news-' . $row['id'],
                        'AUTHOR' => $row['username'],
                        'DATE' => $row['datum']
                        ), 1);
            }
            $tpl->out(2);
            exit;
        } else {
            $design->header();
            $limit = $allgAr['Nlimit'];
            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
    
            // Topnews ausgeben
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1, v2 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0, 0));
            $tn_koms = @db_result($news_opts, 0, 1);
            $tn_sql = db_query("SELECT 
    				a.news_title as title, a.news_text, 
    				a.news_kat, a.news_recht, a.html,
                    DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
                    DATE_FORMAT(a.news_time,'%W') as dayofweek,
                    b.name as username,
                    c.name as editorname,
                    a.html,
                    a.edit_time,
                    a.klicks,
                    b.id as uid
                FROM prefix_news a
                LEFT JOIN prefix_user as b ON a.user_id = b.id
                LEFT JOIN prefix_user as c ON a.editor_id = c.id
                WHERE a.news_id = $tn_id AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP()) AND
                (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht))");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_assoc($tn_sql);
    
                            $dontShow = false;
                            if ((pow(2, abs($_SESSION['authright'])) | $tn_r['news_recht']) != $tn_r['news_recht']) {
                                    $dontShow = true;
                            }
                    if (!$dontShow) {
                                    $tn_tpl = new tpl ('news/top');
                    if ($tn_koms) {
                        $tn_r['kom'] = db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'");
                    }
                        $tn_r['showkom'] = $tn_koms;
                    if (strpos ($tn_r['news_text'], '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $tn_r['news_text']);
                        $tn_r['news_text']= $a[0];
                        $tn_r['readwholenews'] = '<a href="index.php?news-' . $tn_id . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                    } else {
                         $tn_r['readwholenews'] = '';
                    }
                    $tn_r['id'] = $tn_id;
                        $tn_r['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $tn_r['klicks']. ' mal gelesen" title="' . $tn_r['klicks']. ' mal gelesen" border="0">';
                    $tn_r['datum']  = $lang[$tn_r['dayofweek']] . ' ' . $tn_r['datum'];
                        $tn_r['edit']   = is_null($tn_r['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($tn_r['edit_time'])) . '&nbsp;Uhr';
                        if (!empty($tn_r['edit']) and $tn_r['editorname'] != $tn_r['username']) {
                            $tn_r['edit'].= ' von ' . $tn_r['editorname']. '</i>';
                        } elseif (!empty($tn_r['edit'])) {
                            $tn_r['edit'].= '</i>';
                        }
    
                    $tn_r['kate'] = news_find_kat($tn_r['news_kat']);
                        $tn_r['text'] = $tn_r['html']? $tn_r['news_text']: bbcode($tn_r['news_text']);
                    $tn_tpl->set_ar_out($tn_r, 0);
                                    unset($tn_tpl);
                    }
            }
    
                    //Kategorie einschränken
                    if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                            $kats = $katssql = array();  #collect given kats
                            $i = 1;
                            while($kat = escape($menu->get($i), 'string')){
                                    $kats[] = $kat;
                                    $katssql[] = '"' . $kat . '"';
                                    $i++;
                            }
                            $news_kat = 'news_kat IN ('.implode(',', $katssql).') AND';
                            $katmpl = '-'.implode('-', $kats);
                            $page = $menu->getE('p');
                            if ($page < 1) {
                                    $page = 1;
                            }
                            $katmpl = str_replace('-p'.$page, '', $katmpl);
                    } else {
                            $news_kat = $katmpl = '';
                            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
                    }
    
            $anfang = ($page - 1) * $limit;
    
                    $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht)) AND $news_kat `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND archiv != 1 AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())" , $limit , '?news'.$katmpl , 'news');
            // Normale News
            $tpl = new tpl ('news/news.htm');
    
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,
          DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
          DATE_FORMAT(a.news_time,'%W') as dayofweek,
          a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          c.name as editorname,
          a.html,
          a.edit_time,
          a.klicks,
          b.id as uid
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        LEFT JOIN prefix_user as c ON a.editor_id = c.id
        WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht)) AND $news_kat
                    a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
                    (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY a.news_time DESC
        LIMIT " . $anfang . "," . $limit;
    
            // echo '<pre>'.$abf.'</pre>';
            $erg = db_query($abf);
                if (db_num_rows($erg) == 0 and !empty($news_kat)) {
                        echo 'Keine News in dieser Kategorie gefunden.<br />
                                <a href="index.php?news">News&uuml;bersichtsseite aufrufen</a>';
                        $design->footer(1);
                }
            while ($row = db_fetch_assoc($erg)) {
                $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
                $row['kom'] = db_result($k0m, 0);
    
                $row['kate'] = news_find_kat($row['kate']);
                $row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
                if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
                    $a = explode('[PREVIEWENDE]' , $row['text']);
                    $row['text'] = $a[0];
                    $row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                } else {
                    $row['readwholenews'] = '';
                }
                $row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
                if (!$row['html']) {
                    $row['text'] = bbcode($row['text']);
                }
                $row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . '&nbsp;Uhr';
                if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
                    $row['edit'] .= ' von ' . $row['editorname'] . '</i>';
                } elseif (!empty($row['edit'])) {
                    $row['edit'] .= '</i>';
                }
                $tpl->set_ar_out($row, 0);
            }
            $tpl->set_out('SITELINK', $MPL, 1);
            unset($tpl);
        }
    } else {
        $design->header();
        $xajax->printJavascript();
    
        $nid = escape($menu->get(1), 'integer');
        $erg = db_query("SELECT * FROM `prefix_news` WHERE `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id = '" . $nid . "'");
        if (db_num_rows($erg) == 0) {
            $dontShow = true;
            } else {
                    $dontShow = false;
                    $row = db_fetch_object($erg);
                    if ((pow(2, abs($_SESSION['authright'])) | $row->news_recht) != $row->news_recht) {
                            $dontShow = true;
                    }
            }
    
            if ($dontShow) {
                    echo 'News existiert nicht oder Sie haben keine Rechte sie zu sehen.  <a href="javascript:history.back();">zur&uuml;ck</a>';
                    $design->footer(1);
            }
    
        $komsOK = true;
        if ($allgAr['Ngkoms'] == 0) {
            if (loggedin()) {
                $komsOK = true;
            } else {
                $komsOK = false;
            }
        }
        if ($allgAr['Nukoms'] == 0) {
            $komsOK = false;
        }
    
        $kom_info = '';
        // kommentar add
        if ((loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt'])) {
            $_POST['txt'] = escape($_POST['txt'], 'string');
            $_POST['name'] = escape($_POST['name'], 'string');
            if (checkName($_POST['name']) or loggedin()) {
                if (loggedin()) {
                    $_POST['name'] = $_SESSION['authname'];
                }
                db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (" . $nid . ",'NEWS','" . $_POST['name'] . "','" . $_POST['txt'] . "')");
            } else {
                $kom_info = '<span style="color:red;">Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.</span><br />';
            }
        }
        // kommentar add
        // kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(- 7, 'news')) {
            $kommentar_id = escape($menu->getE(2), 'integer');
            db_query("DELETE FROM prefix_koms WHERE uid = " . $nid . " AND cat = 'NEWS' AND id = " . $kommentar_id);
        }
        // kommentar loeschen
        $kategorie = news_find_kat($row->news_kat);
    
        $textToShow = $row->html ? $row->news_text : bbcode($row->news_text);
        $textToShow = str_replace('[PREVIEWENDE]', '', $textToShow);
        if (!empty($such)) {
            $textToShow = markword($textToShow, $such);
        }
        // klicks zaehlen
        db_query("UPDATE prefix_news SET klicks = klicks + 1 WHERE news_id = " . $nid);
    
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
            );
        $tpl->set_ar_out($ar, 2);
    
        if ($komsOK) {
            $tpl->set_ar_out (array ('NAME' => $row->news_title , 'NID' => $nid, 'style' => loggedin() ? 'style="display:none;"' : ''), 3);
        }
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = " . $nid . " AND cat = 'NEWS' ORDER BY id DESC");
        $ergAnz1 = db_num_rows($erg1);
        if ($ergAnz1 == 0) {
            echo '<b>' . $lang['nocomments'] . '</b>';
        } else {
            $zahl = $ergAnz1;
            while ($row1 = db_fetch_assoc($erg1)) {
                $row1['text'] = bbcode(trim($row1['text']));
                if (has_right(- 7, 'news')) {
                    $row1['text'] .= '<a href="javascript:delkom(' . $nid . ',' . $row1['id'] . ')"><img src="include/images/icons/del.png" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
    
    $abf2 = 'SELECT id, name, avatar FROM prefix_user WHERE name = "'.$row1['name'].'" ';
    $erg2 = db_query($abf2);
    $row2 = db_fetch_object($erg2);
    
    
    if ( file_exists($row2->avatar) ) {
      $ava = '<img src="'.$row2->avatar.'" border="0" width="55" height="55">';
    }elseif ($row2->id != 0){
    $ava = '<img src="ich bin ein user ohne avatar" border="0" width="55" height="55">';
    }elseif ($row2->id == 0){
    $ava = '<img src="include/images/avatars/wurstegal.jpg border="0" width="55" height="55">';
    }
    
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'AVATA' => $ava, 'ZAHL' => $zahl) , 4);
                $zahl--;
            }
        }
    
        $tpl->out(5);
    }
    
    $design->footer();
    
    ?>



    MFG Benny zwinker


    verwendete ilch Version: 1.1 P
    0 Mitglieder finden den Beitrag gut.
  2. #2
    User Pic
    holz Hall Of Fame
    Registriert seit
    17.11.2005
    Beiträge
    4.606
    Beitragswertungen
    117 Beitragspunkte
    ggib mal die include/templates/news/news.htm dazu
    0 Mitglieder finden den Beitrag gut.
  3. #3
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    ZitatZitat geschrieben von holz
    ggib mal die include/templates/news/news.htm dazu


    Ja Hallo Da ist sie:

    <table align="center" width="100%" border="0" cellpadding="0" cellspacing="0" class="newsbg">
     <tr>
      <td>
        <table align="center" width="100%" border="0" cellpadding="1" cellspacing="0" class="cbg1">
    	<tr>
    	 <td>
    			<hr style="height: 0px; border: dotted #000000 0px; border-top-width: 1px; " />
    	 </td>
        </tr>
         <tr>
    	  <td>
    		<th align="left" width="60%">
    			<a href="index.php?news-{id}">
    				{title}
    			</a>
    		</th>
    		<th align="center" width="30%" class="smalfont">
    				{datum}
    		</th>
    		<th align="right" width="10%">
    			<a href="index.php?news-send-{id}" alt="Diese News einen Freund senden" title="Diese News einen Freund senden"><img width="17px" height="17px" src="include/images/icons/admin/newsletter.png" alt="Diese News einen Freund senden" border="0"></a>
    				
    			<a href="index.php?news-print-{id}" alt="Druckoptimierte Version" title="Druckoptimierte Version"><img src="include/images/icons/print_k.gif" alt="Druckoptimierte Version" border="0"></a>
    				
    			<a href="index.php?news-{id}" alt="Kommentare ({kom})" title="Kommentare ({kom})"><img src="include/images/icons/comment.png" alt="Kommentare ({kom})" border="0">&nbsp;{kom}</a>
    		</th>
    	  </td>
         </tr>
        </table>
    
    
      <table width="100%" border="0" cellspacing="1" cellpadding="2">
    	<tr>
          <td><hr style="height: 0px; border: dotted #FFFFFF 0px; border-top-width: 1px; " /></td>
        </tr>
        <tr>
         <td>{text}</td>
        </tr>
    	<tr>
    	  <td><hr style="height: 0px; border: dotted #FFFFFF 0px; border-top-width: 1px; " /></td>
    	</tr>
     </table>
    
     <table width="100%" border="0" cellspacing="0" cellpadding="1">
      <tr>
       <td align="right" class="smalfont">
    		<a class="btn read-more-btn bold" href="index.php?news-{id}">Weiterlesen</a>
       </td>
        </tr>
      </table>
    </td></tr></table>
    
    {EXPLODE}
    <br />
    <br /><center>{SITELINK}</center>
    
    
    {EXPLODE}
    <script language="JavaScript" type="text/javascript">
    function delkom (NID, ID) {
    var Check = confirm("Kommentar wirklich löschen?")
    if (Check == true) window.open("index.php?news-"+NID+"-d"+ID,"_self");
    }</script>
    
    <!-- News Kommentare und Mehr lesen -->
    
    <!-- News Beitrag -->
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
    	<tr>
    		<td>
    	  <br />
    			<table align="center" width="100%" border="0" cellpadding="1" cellspacing="0" class="cbg1">
    				<tr>
    					<td align="left" >
    						<h4><b><u>{NAME}</u></b></h4>
    					</td>
    					<td align="right" >
    						<h4><b><u>{datum}</u></b></h4>
    					</td>
    				</tr>
    
    			</table
    	</tr>
    	<tr>
    		<td>
    				<br />
    			<div style="float:center; padding-left: 10px; ">{TEXT}</div>
    				<br />
    			<a href="javascript:history.back(1)"><b>&laquo;</b>{_lang_back}</a> 
    				<br />
    				<br />
    			<div><hr style="height: 0px; border: dotted #FFFFFF 0px; border-top-width: 1px; " /></div>
    		</td>
    	</tr>
    <!-- /ENDE/ News Beitrag -->
            
    <!-- Kommentare -->  
    	<tr>
    		<td height="25"><b>{_lang_comments}: ( {kom} )</b></td>
    	</tr>
    <!-- /ENDE/ Kommentare --> 
     
    <!-- Kommentar schreiben -->
    	<tr align="left">
    		<td>
    			{EXPLODE}
    			<form action="index.php?news-{NID}" method="POST">
    				<textarea style="width:100%; height:100px" cols="50" rows="2" name="txt"></textarea>
    					
    					<div align="right">
    						<input type="text" name="name" value="{uname}" />
    						<input type="submit" value="{_lang_enter}">
    					</div>		   
    					&nbsp; {ANTISPAM} &nbsp;
    				<br />
    
    			</form>
    <!-- /ENDE/ Kommentar schreiben -->
    
    <!-- Kommentarliste -->	  
    		<br />
    			{EXPLODE}
    			
    				<div class="comment">
                        <div class="comment-avatar">{AVATA}</b></div>
                        <div class="comment-content">
                        <p class="name"><a href="index.php?user-details-{ID}">{NAME}</a></p>
                        <p>{TEXT}</p>
                        </div>
                        <br class="clear" />
                    </div>					
    			{EXPLODE}
    <!-- /ENDE/ Kommentarliste -->
    
    <!-- /ENDE/ Kommentare -->
    		<br />
    			<a href="index.php?news"><b>&laquo;</b> {_lang_back}</a>
    
    
      </td>
     </tr>
    </table>
    
    {EXPLODE}
    
    <table width="100%" border="0" cellspacing="0" cellpadding="5" class="rand">
      <tr class="mite"> 
        <td width="65%"><b>{NAME}</b></td>
        <td width="15%">{FUER}</td>
        <td width="20%" align="right">{DATE}</td>
      </tr><tr class="norm"> 
        <td valign="top" colspan="2">{TEXT}{MEHR}</td>
        <td valign="top" rowspan="2" align="center">{KATE}</td>
      </tr><tr class="norm"> 
        <td valign="bottom" height="20" colspan="2" align="center"> 
          <b>{_lang_from} {UNAME}</b> &nbsp; &nbsp; &nbsp; [ {KOM} <a href="index.php?news-1&amp;nid={ID}">{_lang_comments}</a> ] 
        </td>
      </tr>
    </table>


    MFG
    0 Mitglieder finden den Beitrag gut.
  4. #4
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    Hallo Hilfe Bitte genervt
    0 Mitglieder finden den Beitrag gut.
  5. #5
    User Pic
    Mairu Coder
    Registriert seit
    16.06.2006
    Beiträge
    15.334
    Beitragswertungen
    386 Beitragspunkte
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
            'koms' => db_count_query('SELECT COUNT(*) FROM `prefix_koms` WHERE `uid` = ' . $nid . ' AND `cat` = "NEWS"');
            );
        $tpl->set_ar_out($ar, 2);
    Und auch immer mal ein Blick auf die FAQ werfen. | Mairus Ilchseite
    0 Mitglieder finden den Beitrag gut.
  6. #6
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    ZitatZitat geschrieben von Mairu
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
            'koms' => db_count_query('SELECT COUNT(*) FROM `prefix_koms` WHERE `uid` = ' . $nid . ' AND `cat` = "NEWS"');
            );
        $tpl->set_ar_out($ar, 2);


    Hallo Mairu,

    danke für deine Antwort.

    Ich habe das jetzt mal eingschrieben aber jetzt kommt der Fehler

    Parse error: syntax error, unexpected ';', expecting ')' in C:\Programme\Xampp\xampp\htdocs\include\contents\news\news.php on line 335

    und das ist die news.php

    <?php
    // Copyright by: Manuel Staechele
    // Support: www.ilch.de
    // Modded by Mairu für News Extended
    defined ('main') or die ('no direct access');
    
    $title = $allgAr['title'] . ' :: News';
    $hmenu = 'News';
    $design = new design ($title , $hmenu);
    $design->addheader('<link rel="alternate" type="application/atom+xml" title="News (Atom)" href="index.php?news-atom" />
    <link rel="alternate" type="application/rss+xml" title="News (RSS)" href="index.php?news-rss" />');
    
    function news_find_kat ($kat) {
        $katpfad = 'include/images/news/';
        $katjpg = $katpfad . $kat . '.jpg';
        $katgif = $katpfad . $kat . '.gif';
        $katpng = $katpfad . $kat . '.png';
    
        if (file_exists($katjpg)) {
            $pfadzumBild = $katjpg;
        } elseif (file_exists ($katgif)) {
            $pfadzumBild = $katgif;
        } elseif (file_exists ($katpng)) {
            $pfadzumBild = $katpng;
        }
    
        if (!empty($pfadzumBild)) {
            $kategorie = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
        } else {
            $kategorie = '<b>' . $kat . '</b><br /><br />';
        }
    
        return ($kategorie);
    }
    // Schaut ob ein Name so oder ähnlich in der Datenbank vorhanden ist
    // gibt true zurück falls der Name noch nicht verwendet ist
    function checkName($name) {
        if (db_count_query("SELECT COUNT(name) FROM prefix_user WHERE name LIKE '$name'")) {
            return false;
        } else {
            return true;
        }
    }
    
    function checkKomName($name) {
        $resp = new xajaxResponse();
        if (checkName($name) OR loggedin()) {
            $resp->script('document.forms["komform"].submit();');
        } else {
            $resp->assign('komname', 'value' , '');
            $resp->alert('Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.');
            $resp->script("document.getElementById('komname').focus();");
        }
        return $resp;
    }
    // xajax für namencheck
    $xajax = new xajax();
    $xajax->configureMany(array('decodeUTF8Input' => true ,'characterEncoding' => 'ISO-8859-1', 'requestURI' => 'admin.php?news-ajax'));
    $xajax->register(XAJAX_FUNCTION, 'checkKomName');
    $xajax->processRequest();
    
    if ($menu->get(1) == 'ajax') {
        exit();
    }
    
    if (!is_numeric($menu->get(1))) {
        if ($menu->get(1) == 'rss' || $menu->get(1) == 'atom') {
            // ob_clean();
            $feed_type = $menu->get(1);
    
            $abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
            $erg = db_query($abf);
            $row = db_fetch_assoc($erg);
            $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
    
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
    
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,";
            $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
            $abf .= "a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          a.html
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE (a.news_recht | 1) = a.news_recht AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND a.news_id != $tn_id AND a.`archiv` != 1 AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY news_time DESC LIMIT 15";
            $erg = db_query($abf);
            $tpl = new tpl('news_' . $menu->get(1) . '.htm');
    
            header('Content-type: application/' . $menu->get(1) . '+xml');
    
            $tpl->set_ar_out(array(
    				'FEEDTITLE' => $allgAr['title'],
                    'UPDATED' => $last_update,
                    'SITEURL' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])
    				), 0);
            while ($row = db_fetch_assoc($erg)) {
                if ($feed_type == 'atom') {
                    $Z = (date('Z') > 0 ? '+' : '') . date('H:i:s', date('Z') + 23 * 3600);
                    $row['datum'] = str_replace(' ', 'T', $row['datum']) . $Z;
                }
    
                $a = explode('[PREVIEWENDE]', $row['text']);
                $tpl->set_ar_out(array(
    					'TITLE' => $row['title'],
                        'TXT' => $row['html'] ? $a[0] : bbcode($a[0]),
                        'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?news-' . $row['id'],
                        'AUTHOR' => $row['username'],
                        'DATE' => $row['datum']
                        ), 1);
            }
            $tpl->out(2);
            exit;
        } else {
            $design->header();
            $limit = $allgAr['Nlimit'];
            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
    
            // Topnews ausgeben
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1, v2 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0, 0));
            $tn_koms = @db_result($news_opts, 0, 1);
            $tn_sql = db_query("SELECT 
    				a.news_title as title, a.news_text, 
    				a.news_kat, a.news_recht, a.html,
                    DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
                    DATE_FORMAT(a.news_time,'%W') as dayofweek,
                    b.name as username,
                    c.name as editorname,
                    a.html,
                    a.edit_time,
                    a.klicks,
                    b.id as uid
                FROM prefix_news a
                LEFT JOIN prefix_user as b ON a.user_id = b.id
                LEFT JOIN prefix_user as c ON a.editor_id = c.id
                WHERE a.news_id = $tn_id AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP()) AND
                (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht))");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_assoc($tn_sql);
    
                            $dontShow = false;
                            if ((pow(2, abs($_SESSION['authright'])) | $tn_r['news_recht']) != $tn_r['news_recht']) {
                                    $dontShow = true;
                            }
                    if (!$dontShow) {
                                    $tn_tpl = new tpl ('news/top');
                    if ($tn_koms) {
                        $tn_r['kom'] = db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'");
                    }
                        $tn_r['showkom'] = $tn_koms;
                    if (strpos ($tn_r['news_text'], '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $tn_r['news_text']);
                        $tn_r['news_text']= $a[0];
                        $tn_r['readwholenews'] = '<a href="index.php?news-' . $tn_id . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                    } else {
                         $tn_r['readwholenews'] = '';
                    }
                    $tn_r['id'] = $tn_id;
                        $tn_r['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $tn_r['klicks']. ' mal gelesen" title="' . $tn_r['klicks']. ' mal gelesen" border="0">';
                    $tn_r['datum']  = $lang[$tn_r['dayofweek']] . ' ' . $tn_r['datum'];
                        $tn_r['edit']   = is_null($tn_r['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($tn_r['edit_time'])) . '&nbsp;Uhr';
                        if (!empty($tn_r['edit']) and $tn_r['editorname'] != $tn_r['username']) {
                            $tn_r['edit'].= ' von ' . $tn_r['editorname']. '</i>';
                        } elseif (!empty($tn_r['edit'])) {
                            $tn_r['edit'].= '</i>';
                        }
    
                    $tn_r['kate'] = news_find_kat($tn_r['news_kat']);
                        $tn_r['text'] = $tn_r['html']? $tn_r['news_text']: bbcode($tn_r['news_text']);
                    $tn_tpl->set_ar_out($tn_r, 0);
                                    unset($tn_tpl);
                    }
            }
    
                    //Kategorie einschränken
                    if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                            $kats = $katssql = array();  #collect given kats
                            $i = 1;
                            while($kat = escape($menu->get($i), 'string')){
                                    $kats[] = $kat;
                                    $katssql[] = '"' . $kat . '"';
                                    $i++;
                            }
                            $news_kat = 'news_kat IN ('.implode(',', $katssql).') AND';
                            $katmpl = '-'.implode('-', $kats);
                            $page = $menu->getE('p');
                            if ($page < 1) {
                                    $page = 1;
                            }
                            $katmpl = str_replace('-p'.$page, '', $katmpl);
                    } else {
                            $news_kat = $katmpl = '';
                            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
                    }
    
            $anfang = ($page - 1) * $limit;
    
                    $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht)) AND $news_kat `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND archiv != 1 AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())" , $limit , '?news'.$katmpl , 'news');
            // Normale News
            $tpl = new tpl ('news/news.htm');
    
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,
          DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
          DATE_FORMAT(a.news_time,'%W') as dayofweek,
          a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          c.name as editorname,
          a.html,
          a.edit_time,
          a.klicks,
          b.id as uid
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        LEFT JOIN prefix_user as c ON a.editor_id = c.id
        WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht)) AND $news_kat
                    a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
                    (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY a.news_time DESC
        LIMIT " . $anfang . "," . $limit;
    
            // echo '<pre>'.$abf.'</pre>';
            $erg = db_query($abf);
                if (db_num_rows($erg) == 0 and !empty($news_kat)) {
                        echo 'Keine News in dieser Kategorie gefunden.<br />
                                <a href="index.php?news">News&uuml;bersichtsseite aufrufen</a>';
                        $design->footer(1);
                }
            while ($row = db_fetch_assoc($erg)) {
                $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
                $row['kom'] = db_result($k0m, 0);
    
                $row['kate'] = news_find_kat($row['kate']);
                $row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
                if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
                    $a = explode('[PREVIEWENDE]' , $row['text']);
                    $row['text'] = $a[0];
                    $row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                } else {
                    $row['readwholenews'] = '';
                }
                $row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
                if (!$row['html']) {
                    $row['text'] = bbcode($row['text']);
                }
                $row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . '&nbsp;Uhr';
                if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
                    $row['edit'] .= ' von ' . $row['editorname'] . '</i>';
                } elseif (!empty($row['edit'])) {
                    $row['edit'] .= '</i>';
                }
                $tpl->set_ar_out($row, 0);
            }
            $tpl->set_out('SITELINK', $MPL, 1);
            unset($tpl);
        }
    } else {
        $design->header();
        $xajax->printJavascript();
    
        $nid = escape($menu->get(1), 'integer');
        $erg = db_query("SELECT * FROM `prefix_news` WHERE `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id = '" . $nid . "'");
        if (db_num_rows($erg) == 0) {
            $dontShow = true;
            } else {
                    $dontShow = false;
                    $row = db_fetch_object($erg);
                    if ((pow(2, abs($_SESSION['authright'])) | $row->news_recht) != $row->news_recht) {
                            $dontShow = true;
                    }
            }
    
            if ($dontShow) {
                    echo 'News existiert nicht oder Sie haben keine Rechte sie zu sehen.  <a href="javascript:history.back();">zur&uuml;ck</a>';
                    $design->footer(1);
            }
    
        $komsOK = true;
        if ($allgAr['Ngkoms'] == 0) {
            if (loggedin()) {
                $komsOK = true;
            } else {
                $komsOK = false;
            }
        }
        if ($allgAr['Nukoms'] == 0) {
            $komsOK = false;
        }
    
        $kom_info = '';
        // kommentar add
        if ((loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt'])) {
            $_POST['txt'] = escape($_POST['txt'], 'string');
            $_POST['name'] = escape($_POST['name'], 'string');
            if (checkName($_POST['name']) or loggedin()) {
                if (loggedin()) {
                    $_POST['name'] = $_SESSION['authname'];
                }
                db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (" . $nid . ",'NEWS','" . $_POST['name'] . "','" . $_POST['txt'] . "')");
            } else {
                $kom_info = '<span style="color:red;">Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.</span><br />';
            }
        }
        // kommentar add
        // kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(- 7, 'news')) {
            $kommentar_id = escape($menu->getE(2), 'integer');
            db_query("DELETE FROM prefix_koms WHERE uid = " . $nid . " AND cat = 'NEWS' AND id = " . $kommentar_id);
        }
        // kommentar loeschen
        $kategorie = news_find_kat($row->news_kat);
    
        $textToShow = $row->html ? $row->news_text : bbcode($row->news_text);
        $textToShow = str_replace('[PREVIEWENDE]', '', $textToShow);
        if (!empty($such)) {
            $textToShow = markword($textToShow, $such);
        }
        // klicks zaehlen
        db_query("UPDATE prefix_news SET klicks = klicks + 1 WHERE news_id = " . $nid);
    
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
    		'koms' => db_count_query('SELECT COUNT(*) FROM `prefix_koms` WHERE `uid` = ' . $nid . ' AND `cat` = "NEWS"');
            );
        $tpl->set_ar_out($ar, 2);
    
        if ($komsOK) {
            $tpl->set_ar_out (array ('NAME' => $row->news_title , 'NID' => $nid, 'style' => loggedin() ? 'style="display:none;"' : ''), 3);
        }
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = " . $nid . " AND cat = 'NEWS' ORDER BY id DESC");
        $ergAnz1 = db_num_rows($erg1);
        if ($ergAnz1 == 0) {
            echo '<b>' . $lang['nocomments'] . '</b>';
        } else {
            $zahl = $ergAnz1;
            while ($row1 = db_fetch_assoc($erg1)) {
                $row1['text'] = bbcode(trim($row1['text']));
                if (has_right(- 7, 'news')) {
                    $row1['text'] .= '<a href="javascript:delkom(' . $nid . ',' . $row1['id'] . ')"><img src="include/images/icons/del.png" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
    
    $abf2 = 'SELECT id, name, avatar FROM prefix_user WHERE name = "'.$row1['name'].'" ';
    $erg2 = db_query($abf2);
    $row2 = db_fetch_object($erg2);
    
    
    if ( file_exists($row2->avatar) ) {
      $ava = '<img src="'.$row2->avatar.'" border="0" width="55" height="55">';
    }elseif ($row2->id != 0){
    $ava = '<img src="ich bin ein user ohne avatar" border="0" width="55" height="55">';
    }elseif ($row2->id == 0){
    $ava = '<img src="include/images/avatars/wurstegal.jpg border="0" width="55" height="55">';
    }
    
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'AVATA' => $ava, 'ZAHL' => $zahl) , 4);
                $zahl--;
            }
        }
    
        $tpl->out(5);
    }
    
    $design->footer();
    
    ?>


    MFG
    0 Mitglieder finden den Beitrag gut.
  7. #7
    User Pic
    Saarlonz Hall Of Fame
    Registriert seit
    07.08.2008
    Beiträge
    3.003
    Beitragswertungen
    235 Beitragspunkte
    <?php
    // Copyright by: Manuel Staechele
    // Support: www.ilch.de
    // Modded by Mairu für News Extended
    defined ('main') or die ('no direct access');
     
    $title = $allgAr['title'] . ' :: News';
    $hmenu = 'News';
    $design = new design ($title , $hmenu);
    $design->addheader('<link rel="alternate" type="application/atom+xml" title="News (Atom)" href="index.php?news-atom" />
    <link rel="alternate" type="application/rss+xml" title="News (RSS)" href="index.php?news-rss" />');
     
    function news_find_kat ($kat) {
        $katpfad = 'include/images/news/';
        $katjpg = $katpfad . $kat . '.jpg';
        $katgif = $katpfad . $kat . '.gif';
        $katpng = $katpfad . $kat . '.png';
     
        if (file_exists($katjpg)) {
            $pfadzumBild = $katjpg;
        } elseif (file_exists ($katgif)) {
            $pfadzumBild = $katgif;
        } elseif (file_exists ($katpng)) {
            $pfadzumBild = $katpng;
        }
     
        if (!empty($pfadzumBild)) {
            $kategorie = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
        } else {
            $kategorie = '<b>' . $kat . '</b><br /><br />';
        }
     
        return ($kategorie);
    }
    // Schaut ob ein Name so oder ähnlich in der Datenbank vorhanden ist
    // gibt true zurück falls der Name noch nicht verwendet ist
    function checkName($name) {
        if (db_count_query("SELECT COUNT(name) FROM prefix_user WHERE name LIKE '$name'")) {
            return false;
        } else {
            return true;
        }
    }
     
    function checkKomName($name) {
        $resp = new xajaxResponse();
        if (checkName($name) OR loggedin()) {
            $resp->script('document.forms["komform"].submit();');
        } else {
            $resp->assign('komname', 'value' , '');
            $resp->alert('Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.');
            $resp->script("document.getElementById('komname').focus();");
        }
        return $resp;
    }
    // xajax für namencheck
    $xajax = new xajax();
    $xajax->configureMany(array('decodeUTF8Input' => true ,'characterEncoding' => 'ISO-8859-1', 'requestURI' => 'admin.php?news-ajax'));
    $xajax->register(XAJAX_FUNCTION, 'checkKomName');
    $xajax->processRequest();
     
    if ($menu->get(1) == 'ajax') {
        exit();
    }
     
    if (!is_numeric($menu->get(1))) {
        if ($menu->get(1) == 'rss' || $menu->get(1) == 'atom') {
            // ob_clean();
            $feed_type = $menu->get(1);
     
            $abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
            $erg = db_query($abf);
            $row = db_fetch_assoc($erg);
            $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
     
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
     
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,";
            $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
            $abf .= "a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          a.html
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE (a.news_recht | 1) = a.news_recht AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND a.news_id != $tn_id AND a.`archiv` != 1 AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY news_time DESC LIMIT 15";
            $erg = db_query($abf);
            $tpl = new tpl('news_' . $menu->get(1) . '.htm');
     
            header('Content-type: application/' . $menu->get(1) . '+xml');
     
            $tpl->set_ar_out(array(
                    'FEEDTITLE' => $allgAr['title'],
                    'UPDATED' => $last_update,
                    'SITEURL' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])
                    ), 0);
            while ($row = db_fetch_assoc($erg)) {
                if ($feed_type == 'atom') {
                    $Z = (date('Z') > 0 ? '+' : '') . date('H:i:s', date('Z') + 23 * 3600);
                    $row['datum'] = str_replace(' ', 'T', $row['datum']) . $Z;
                }
     
                $a = explode('[PREVIEWENDE]', $row['text']);
                $tpl->set_ar_out(array(
                        'TITLE' => $row['title'],
                        'TXT' => $row['html'] ? $a[0] : bbcode($a[0]),
                        'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?news-' . $row['id'],
                        'AUTHOR' => $row['username'],
                        'DATE' => $row['datum']
                        ), 1);
            }
            $tpl->out(2);
            exit;
        } else {
            $design->header();
            $limit = $allgAr['Nlimit'];
            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
     
            // Topnews ausgeben
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1, v2 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0, 0));
            $tn_koms = @db_result($news_opts, 0, 1);
            $tn_sql = db_query("SELECT 
                    a.news_title as title, a.news_text, 
                    a.news_kat, a.news_recht, a.html,
                    DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
                    DATE_FORMAT(a.news_time,'%W') as dayofweek,
                    b.name as username,
                    c.name as editorname,
                    a.html,
                    a.edit_time,
                    a.klicks,
                    b.id as uid
                FROM prefix_news a
                LEFT JOIN prefix_user as b ON a.user_id = b.id
                LEFT JOIN prefix_user as c ON a.editor_id = c.id
                WHERE a.news_id = $tn_id AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP()) AND
                (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht))");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_assoc($tn_sql);
     
                            $dontShow = false;
                            if ((pow(2, abs($_SESSION['authright'])) | $tn_r['news_recht']) != $tn_r['news_recht']) {
                                    $dontShow = true;
                            }
                    if (!$dontShow) {
                                    $tn_tpl = new tpl ('news/top');
                    if ($tn_koms) {
                        $tn_r['kom'] = db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'");
                    }
                        $tn_r['showkom'] = $tn_koms;
                    if (strpos ($tn_r['news_text'], '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $tn_r['news_text']);
                        $tn_r['news_text']= $a[0];
                        $tn_r['readwholenews'] = '<a href="index.php?news-' . $tn_id . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                    } else {
                         $tn_r['readwholenews'] = '';
                    }
                    $tn_r['id'] = $tn_id;
                        $tn_r['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $tn_r['klicks']. ' mal gelesen" title="' . $tn_r['klicks']. ' mal gelesen" border="0">';
                    $tn_r['datum']  = $lang[$tn_r['dayofweek']] . ' ' . $tn_r['datum'];
                        $tn_r['edit']   = is_null($tn_r['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($tn_r['edit_time'])) . '&nbsp;Uhr';
                        if (!empty($tn_r['edit']) and $tn_r['editorname'] != $tn_r['username']) {
                            $tn_r['edit'].= ' von ' . $tn_r['editorname']. '</i>';
                        } elseif (!empty($tn_r['edit'])) {
                            $tn_r['edit'].= '</i>';
                        }
     
                    $tn_r['kate'] = news_find_kat($tn_r['news_kat']);
                        $tn_r['text'] = $tn_r['html']? $tn_r['news_text']: bbcode($tn_r['news_text']);
                    $tn_tpl->set_ar_out($tn_r, 0);
                                    unset($tn_tpl);
                    }
            }
     
                    //Kategorie einschränken
                    if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                            $kats = $katssql = array();  #collect given kats
                            $i = 1;
                            while($kat = escape($menu->get($i), 'string')){
                                    $kats[] = $kat;
                                    $katssql[] = '"' . $kat . '"';
                                    $i++;
                            }
                            $news_kat = 'news_kat IN ('.implode(',', $katssql).') AND';
                            $katmpl = '-'.implode('-', $kats);
                            $page = $menu->getE('p');
                            if ($page < 1) {
                                    $page = 1;
                            }
                            $katmpl = str_replace('-p'.$page, '', $katmpl);
                    } else {
                            $news_kat = $katmpl = '';
                            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
                    }
     
            $anfang = ($page - 1) * $limit;
     
                    $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht)) AND $news_kat `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND archiv != 1 AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())" , $limit , '?news'.$katmpl , 'news');
            // Normale News
            $tpl = new tpl ('news/news.htm');
     
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,
          DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
          DATE_FORMAT(a.news_time,'%W') as dayofweek,
          a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          c.name as editorname,
          a.html,
          a.edit_time,
          a.klicks,
          b.id as uid
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        LEFT JOIN prefix_user as c ON a.editor_id = c.id
        WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht)) AND $news_kat
                    a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
                    (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY a.news_time DESC
        LIMIT " . $anfang . "," . $limit;
     
            // echo '<pre>'.$abf.'</pre>';
            $erg = db_query($abf);
                if (db_num_rows($erg) == 0 and !empty($news_kat)) {
                        echo 'Keine News in dieser Kategorie gefunden.<br />
                                <a href="index.php?news">News&uuml;bersichtsseite aufrufen</a>';
                        $design->footer(1);
                }
            while ($row = db_fetch_assoc($erg)) {
                $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
                $row['kom'] = db_result($k0m, 0);
     
                $row['kate'] = news_find_kat($row['kate']);
                $row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
                if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
                    $a = explode('[PREVIEWENDE]' , $row['text']);
                    $row['text'] = $a[0];
                    $row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                } else {
                    $row['readwholenews'] = '';
                }
                $row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
                if (!$row['html']) {
                    $row['text'] = bbcode($row['text']);
                }
                $row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . '&nbsp;Uhr';
                if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
                    $row['edit'] .= ' von ' . $row['editorname'] . '</i>';
                } elseif (!empty($row['edit'])) {
                    $row['edit'] .= '</i>';
                }
                $tpl->set_ar_out($row, 0);
            }
            $tpl->set_out('SITELINK', $MPL, 1);
            unset($tpl);
        }
    } else {
        $design->header();
        $xajax->printJavascript();
     
        $nid = escape($menu->get(1), 'integer');
        $erg = db_query("SELECT * FROM `prefix_news` WHERE `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id = '" . $nid . "'");
        if (db_num_rows($erg) == 0) {
            $dontShow = true;
            } else {
                    $dontShow = false;
                    $row = db_fetch_object($erg);
                    if ((pow(2, abs($_SESSION['authright'])) | $row->news_recht) != $row->news_recht) {
                            $dontShow = true;
                    }
            }
     
            if ($dontShow) {
                    echo 'News existiert nicht oder Sie haben keine Rechte sie zu sehen.  <a href="javascript:history.back();">zur&uuml;ck</a>';
                    $design->footer(1);
            }
     
        $komsOK = true;
        if ($allgAr['Ngkoms'] == 0) {
            if (loggedin()) {
                $komsOK = true;
            } else {
                $komsOK = false;
            }
        }
        if ($allgAr['Nukoms'] == 0) {
            $komsOK = false;
        }
     
        $kom_info = '';
        // kommentar add
        if ((loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt'])) {
            $_POST['txt'] = escape($_POST['txt'], 'string');
            $_POST['name'] = escape($_POST['name'], 'string');
            if (checkName($_POST['name']) or loggedin()) {
                if (loggedin()) {
                    $_POST['name'] = $_SESSION['authname'];
                }
                db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (" . $nid . ",'NEWS','" . $_POST['name'] . "','" . $_POST['txt'] . "')");
            } else {
                $kom_info = '<span style="color:red;">Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.</span><br />';
            }
        }
        // kommentar add
        // kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(- 7, 'news')) {
            $kommentar_id = escape($menu->getE(2), 'integer');
            db_query("DELETE FROM prefix_koms WHERE uid = " . $nid . " AND cat = 'NEWS' AND id = " . $kommentar_id);
        }
        // kommentar loeschen
        $kategorie = news_find_kat($row->news_kat);
     
        $textToShow = $row->html ? $row->news_text : bbcode($row->news_text);
        $textToShow = str_replace('[PREVIEWENDE]', '', $textToShow);
        if (!empty($such)) {
            $textToShow = markword($textToShow, $such);
        }
        // klicks zaehlen
        db_query("UPDATE prefix_news SET klicks = klicks + 1 WHERE news_id = " . $nid);
     
     
        $koms = db_count_query('SELECT COUNT(*) FROM `prefix_koms` WHERE `uid` = ' . $nid . ' AND `cat` = "NEWS"');
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
            'koms' => $koms
            );
        $tpl->set_ar_out($ar, 2);
     
        if ($komsOK) {
            $tpl->set_ar_out (array ('NAME' => $row->news_title , 'NID' => $nid, 'style' => loggedin() ? 'style="display:none;"' : ''), 3);
        }
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = " . $nid . " AND cat = 'NEWS' ORDER BY id DESC");
        $ergAnz1 = db_num_rows($erg1);
        if ($ergAnz1 == 0) {
            echo '<b>' . $lang['nocomments'] . '</b>';
        } else {
            $zahl = $ergAnz1;
            while ($row1 = db_fetch_assoc($erg1)) {
                $row1['text'] = bbcode(trim($row1['text']));
                if (has_right(- 7, 'news')) {
                    $row1['text'] .= '<a href="javascript:delkom(' . $nid . ',' . $row1['id'] . ')"><img src="include/images/icons/del.png" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
     
    $abf2 = 'SELECT id, name, avatar FROM prefix_user WHERE name = "'.$row1['name'].'" ';
    $erg2 = db_query($abf2);
    $row2 = db_fetch_object($erg2);
     
     
    if ( file_exists($row2->avatar) ) {
      $ava = '<img src="'.$row2->avatar.'" border="0" width="55" height="55">';
    }elseif ($row2->id != 0){
    $ava = '<img src="ich bin ein user ohne avatar" border="0" width="55" height="55">';
    }elseif ($row2->id == 0){
    $ava = '<img src="include/images/avatars/wurstegal.jpg border="0" width="55" height="55">';
    }
     
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'AVATA' => $ava, 'ZAHL' => $zahl) , 4);
                $zahl--;
            }
        }
     
        $tpl->out(5);
    }
     
    $design->footer();
     
    ?>
    0 Mitglieder finden den Beitrag gut.
  8. #8
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    ZitatZitat geschrieben von -saarlonz-
    <?php
    // Copyright by: Manuel Staechele
    // Support: www.ilch.de
    // Modded by Mairu für News Extended
    defined ('main') or die ('no direct access');
     
    $title = $allgAr['title'] . ' :: News';
    $hmenu = 'News';
    $design = new design ($title , $hmenu);
    $design->addheader('<link rel="alternate" type="application/atom+xml" title="News (Atom)" href="index.php?news-atom" />
    <link rel="alternate" type="application/rss+xml" title="News (RSS)" href="index.php?news-rss" />');
     
    function news_find_kat ($kat) {
        $katpfad = 'include/images/news/';
        $katjpg = $katpfad . $kat . '.jpg';
        $katgif = $katpfad . $kat . '.gif';
        $katpng = $katpfad . $kat . '.png';
     
        if (file_exists($katjpg)) {
            $pfadzumBild = $katjpg;
        } elseif (file_exists ($katgif)) {
            $pfadzumBild = $katgif;
        } elseif (file_exists ($katpng)) {
            $pfadzumBild = $katpng;
        }
     
        if (!empty($pfadzumBild)) {
            $kategorie = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
        } else {
            $kategorie = '<b>' . $kat . '</b><br /><br />';
        }
     
        return ($kategorie);
    }
    // Schaut ob ein Name so oder ähnlich in der Datenbank vorhanden ist
    // gibt true zurück falls der Name noch nicht verwendet ist
    function checkName($name) {
        if (db_count_query("SELECT COUNT(name) FROM prefix_user WHERE name LIKE '$name'")) {
            return false;
        } else {
            return true;
        }
    }
     
    function checkKomName($name) {
        $resp = new xajaxResponse();
        if (checkName($name) OR loggedin()) {
            $resp->script('document.forms["komform"].submit();');
        } else {
            $resp->assign('komname', 'value' , '');
            $resp->alert('Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.');
            $resp->script("document.getElementById('komname').focus();");
        }
        return $resp;
    }
    // xajax für namencheck
    $xajax = new xajax();
    $xajax->configureMany(array('decodeUTF8Input' => true ,'characterEncoding' => 'ISO-8859-1', 'requestURI' => 'admin.php?news-ajax'));
    $xajax->register(XAJAX_FUNCTION, 'checkKomName');
    $xajax->processRequest();
     
    if ($menu->get(1) == 'ajax') {
        exit();
    }
     
    if (!is_numeric($menu->get(1))) {
        if ($menu->get(1) == 'rss' || $menu->get(1) == 'atom') {
            // ob_clean();
            $feed_type = $menu->get(1);
     
            $abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
            $erg = db_query($abf);
            $row = db_fetch_assoc($erg);
            $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
     
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
     
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,";
            $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
            $abf .= "a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          a.html
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE (a.news_recht | 1) = a.news_recht AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND a.news_id != $tn_id AND a.`archiv` != 1 AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY news_time DESC LIMIT 15";
            $erg = db_query($abf);
            $tpl = new tpl('news_' . $menu->get(1) . '.htm');
     
            header('Content-type: application/' . $menu->get(1) . '+xml');
     
            $tpl->set_ar_out(array(
                    'FEEDTITLE' => $allgAr['title'],
                    'UPDATED' => $last_update,
                    'SITEURL' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])
                    ), 0);
            while ($row = db_fetch_assoc($erg)) {
                if ($feed_type == 'atom') {
                    $Z = (date('Z') > 0 ? '+' : '') . date('H:i:s', date('Z') + 23 * 3600);
                    $row['datum'] = str_replace(' ', 'T', $row['datum']) . $Z;
                }
     
                $a = explode('[PREVIEWENDE]', $row['text']);
                $tpl->set_ar_out(array(
                        'TITLE' => $row['title'],
                        'TXT' => $row['html'] ? $a[0] : bbcode($a[0]),
                        'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?news-' . $row['id'],
                        'AUTHOR' => $row['username'],
                        'DATE' => $row['datum']
                        ), 1);
            }
            $tpl->out(2);
            exit;
        } else {
            $design->header();
            $limit = $allgAr['Nlimit'];
            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
     
            // Topnews ausgeben
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1, v2 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0, 0));
            $tn_koms = @db_result($news_opts, 0, 1);
            $tn_sql = db_query("SELECT 
                    a.news_title as title, a.news_text, 
                    a.news_kat, a.news_recht, a.html,
                    DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
                    DATE_FORMAT(a.news_time,'%W') as dayofweek,
                    b.name as username,
                    c.name as editorname,
                    a.html,
                    a.edit_time,
                    a.klicks,
                    b.id as uid
                FROM prefix_news a
                LEFT JOIN prefix_user as b ON a.user_id = b.id
                LEFT JOIN prefix_user as c ON a.editor_id = c.id
                WHERE a.news_id = $tn_id AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP()) AND
                (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht))");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_assoc($tn_sql);
     
                            $dontShow = false;
                            if ((pow(2, abs($_SESSION['authright'])) | $tn_r['news_recht']) != $tn_r['news_recht']) {
                                    $dontShow = true;
                            }
                    if (!$dontShow) {
                                    $tn_tpl = new tpl ('news/top');
                    if ($tn_koms) {
                        $tn_r['kom'] = db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'");
                    }
                        $tn_r['showkom'] = $tn_koms;
                    if (strpos ($tn_r['news_text'], '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $tn_r['news_text']);
                        $tn_r['news_text']= $a[0];
                        $tn_r['readwholenews'] = '<a href="index.php?news-' . $tn_id . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                    } else {
                         $tn_r['readwholenews'] = '';
                    }
                    $tn_r['id'] = $tn_id;
                        $tn_r['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $tn_r['klicks']. ' mal gelesen" title="' . $tn_r['klicks']. ' mal gelesen" border="0">';
                    $tn_r['datum']  = $lang[$tn_r['dayofweek']] . ' ' . $tn_r['datum'];
                        $tn_r['edit']   = is_null($tn_r['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($tn_r['edit_time'])) . '&nbsp;Uhr';
                        if (!empty($tn_r['edit']) and $tn_r['editorname'] != $tn_r['username']) {
                            $tn_r['edit'].= ' von ' . $tn_r['editorname']. '</i>';
                        } elseif (!empty($tn_r['edit'])) {
                            $tn_r['edit'].= '</i>';
                        }
     
                    $tn_r['kate'] = news_find_kat($tn_r['news_kat']);
                        $tn_r['text'] = $tn_r['html']? $tn_r['news_text']: bbcode($tn_r['news_text']);
                    $tn_tpl->set_ar_out($tn_r, 0);
                                    unset($tn_tpl);
                    }
            }
     
                    //Kategorie einschränken
                    if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                            $kats = $katssql = array();  #collect given kats
                            $i = 1;
                            while($kat = escape($menu->get($i), 'string')){
                                    $kats[] = $kat;
                                    $katssql[] = '"' . $kat . '"';
                                    $i++;
                            }
                            $news_kat = 'news_kat IN ('.implode(',', $katssql).') AND';
                            $katmpl = '-'.implode('-', $kats);
                            $page = $menu->getE('p');
                            if ($page < 1) {
                                    $page = 1;
                            }
                            $katmpl = str_replace('-p'.$page, '', $katmpl);
                    } else {
                            $news_kat = $katmpl = '';
                            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
                    }
     
            $anfang = ($page - 1) * $limit;
     
                    $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht)) AND $news_kat `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND archiv != 1 AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())" , $limit , '?news'.$katmpl , 'news');
            // Normale News
            $tpl = new tpl ('news/news.htm');
     
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,
          DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
          DATE_FORMAT(a.news_time,'%W') as dayofweek,
          a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          c.name as editorname,
          a.html,
          a.edit_time,
          a.klicks,
          b.id as uid
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        LEFT JOIN prefix_user as c ON a.editor_id = c.id
        WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht)) AND $news_kat
                    a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
                    (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY a.news_time DESC
        LIMIT " . $anfang . "," . $limit;
     
            // echo '<pre>'.$abf.'</pre>';
            $erg = db_query($abf);
                if (db_num_rows($erg) == 0 and !empty($news_kat)) {
                        echo 'Keine News in dieser Kategorie gefunden.<br />
                                <a href="index.php?news">News&uuml;bersichtsseite aufrufen</a>';
                        $design->footer(1);
                }
            while ($row = db_fetch_assoc($erg)) {
                $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
                $row['kom'] = db_result($k0m, 0);
     
                $row['kate'] = news_find_kat($row['kate']);
                $row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
                if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
                    $a = explode('[PREVIEWENDE]' , $row['text']);
                    $row['text'] = $a[0];
                    $row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                } else {
                    $row['readwholenews'] = '';
                }
                $row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
                if (!$row['html']) {
                    $row['text'] = bbcode($row['text']);
                }
                $row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . '&nbsp;Uhr';
                if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
                    $row['edit'] .= ' von ' . $row['editorname'] . '</i>';
                } elseif (!empty($row['edit'])) {
                    $row['edit'] .= '</i>';
                }
                $tpl->set_ar_out($row, 0);
            }
            $tpl->set_out('SITELINK', $MPL, 1);
            unset($tpl);
        }
    } else {
        $design->header();
        $xajax->printJavascript();
     
        $nid = escape($menu->get(1), 'integer');
        $erg = db_query("SELECT * FROM `prefix_news` WHERE `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id = '" . $nid . "'");
        if (db_num_rows($erg) == 0) {
            $dontShow = true;
            } else {
                    $dontShow = false;
                    $row = db_fetch_object($erg);
                    if ((pow(2, abs($_SESSION['authright'])) | $row->news_recht) != $row->news_recht) {
                            $dontShow = true;
                    }
            }
     
            if ($dontShow) {
                    echo 'News existiert nicht oder Sie haben keine Rechte sie zu sehen.  <a href="javascript:history.back();">zur&uuml;ck</a>';
                    $design->footer(1);
            }
     
        $komsOK = true;
        if ($allgAr['Ngkoms'] == 0) {
            if (loggedin()) {
                $komsOK = true;
            } else {
                $komsOK = false;
            }
        }
        if ($allgAr['Nukoms'] == 0) {
            $komsOK = false;
        }
     
        $kom_info = '';
        // kommentar add
        if ((loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt'])) {
            $_POST['txt'] = escape($_POST['txt'], 'string');
            $_POST['name'] = escape($_POST['name'], 'string');
            if (checkName($_POST['name']) or loggedin()) {
                if (loggedin()) {
                    $_POST['name'] = $_SESSION['authname'];
                }
                db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (" . $nid . ",'NEWS','" . $_POST['name'] . "','" . $_POST['txt'] . "')");
            } else {
                $kom_info = '<span style="color:red;">Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.</span><br />';
            }
        }
        // kommentar add
        // kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(- 7, 'news')) {
            $kommentar_id = escape($menu->getE(2), 'integer');
            db_query("DELETE FROM prefix_koms WHERE uid = " . $nid . " AND cat = 'NEWS' AND id = " . $kommentar_id);
        }
        // kommentar loeschen
        $kategorie = news_find_kat($row->news_kat);
     
        $textToShow = $row->html ? $row->news_text : bbcode($row->news_text);
        $textToShow = str_replace('[PREVIEWENDE]', '', $textToShow);
        if (!empty($such)) {
            $textToShow = markword($textToShow, $such);
        }
        // klicks zaehlen
        db_query("UPDATE prefix_news SET klicks = klicks + 1 WHERE news_id = " . $nid);
     
     
        $koms = db_count_query('SELECT COUNT(*) FROM `prefix_koms` WHERE `uid` = ' . $nid . ' AND `cat` = "NEWS"');
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
            'koms' => $koms
            );
        $tpl->set_ar_out($ar, 2);
     
        if ($komsOK) {
            $tpl->set_ar_out (array ('NAME' => $row->news_title , 'NID' => $nid, 'style' => loggedin() ? 'style="display:none;"' : ''), 3);
        }
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = " . $nid . " AND cat = 'NEWS' ORDER BY id DESC");
        $ergAnz1 = db_num_rows($erg1);
        if ($ergAnz1 == 0) {
            echo '<b>' . $lang['nocomments'] . '</b>';
        } else {
            $zahl = $ergAnz1;
            while ($row1 = db_fetch_assoc($erg1)) {
                $row1['text'] = bbcode(trim($row1['text']));
                if (has_right(- 7, 'news')) {
                    $row1['text'] .= '<a href="javascript:delkom(' . $nid . ',' . $row1['id'] . ')"><img src="include/images/icons/del.png" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
     
    $abf2 = 'SELECT id, name, avatar FROM prefix_user WHERE name = "'.$row1['name'].'" ';
    $erg2 = db_query($abf2);
    $row2 = db_fetch_object($erg2);
     
     
    if ( file_exists($row2->avatar) ) {
      $ava = '<img src="'.$row2->avatar.'" border="0" width="55" height="55">';
    }elseif ($row2->id != 0){
    $ava = '<img src="ich bin ein user ohne avatar" border="0" width="55" height="55">';
    }elseif ($row2->id == 0){
    $ava = '<img src="include/images/avatars/wurstegal.jpg border="0" width="55" height="55">';
    }
     
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'AVATA' => $ava, 'ZAHL' => $zahl) , 4);
                $zahl--;
            }
        }
     
        $tpl->out(5);
    }
     
    $design->footer();
     
    ?>


    Hallo Saarlonz,

    danke für deine Antwort.

    Kommentare: (2) ist Jetzt ok


    es nur noch das datum und ich denke mal das muss so aber wo?
    'DATE' => $row['datum']


    und der Name link das ist der Fehler:
    Der Benutzer wurde nicht gefunden bzw. die Seite wurde nicht richtig aufgerufen.

    und das habe ich in der news.htm
    <p class="name"><a href="index.php?user-details-{ID}">{NAME}</a></p>


    MFG
    0 Mitglieder finden den Beitrag gut.
  9. #9
    User Pic
    Saarlonz Hall Of Fame
    Registriert seit
    07.08.2008
    Beiträge
    3.003
    Beitragswertungen
    235 Beitragspunkte
    Versuch es mal so:

    <?php
    // Copyright by: Manuel Staechele
    // Support: www.ilch.de
    // Modded by Mairu für News Extended
    defined ('main') or die ('no direct access');
      
    $title = $allgAr['title'] . ' :: News';
    $hmenu = 'News';
    $design = new design ($title , $hmenu);
    $design->addheader('<link rel="alternate" type="application/atom+xml" title="News (Atom)" href="index.php?news-atom" />
    <link rel="alternate" type="application/rss+xml" title="News (RSS)" href="index.php?news-rss" />');
      
    function news_find_kat ($kat) {
        $katpfad = 'include/images/news/';
        $katjpg = $katpfad . $kat . '.jpg';
        $katgif = $katpfad . $kat . '.gif';
        $katpng = $katpfad . $kat . '.png';
      
        if (file_exists($katjpg)) {
            $pfadzumBild = $katjpg;
        } elseif (file_exists ($katgif)) {
            $pfadzumBild = $katgif;
        } elseif (file_exists ($katpng)) {
            $pfadzumBild = $katpng;
        }
      
        if (!empty($pfadzumBild)) {
            $kategorie = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
        } else {
            $kategorie = '<b>' . $kat . '</b><br /><br />';
        }
      
        return ($kategorie);
    }
    // Schaut ob ein Name so oder ähnlich in der Datenbank vorhanden ist
    // gibt true zurück falls der Name noch nicht verwendet ist
    function checkName($name) {
        if (db_count_query("SELECT COUNT(name) FROM prefix_user WHERE name LIKE '$name'")) {
            return false;
        } else {
            return true;
        }
    }
      
    function checkKomName($name) {
        $resp = new xajaxResponse();
        if (checkName($name) OR loggedin()) {
            $resp->script('document.forms["komform"].submit();');
        } else {
            $resp->assign('komname', 'value' , '');
            $resp->alert('Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.');
            $resp->script("document.getElementById('komname').focus();");
        }
        return $resp;
    }
    // xajax für namencheck
    $xajax = new xajax();
    $xajax->configureMany(array('decodeUTF8Input' => true ,'characterEncoding' => 'ISO-8859-1', 'requestURI' => 'admin.php?news-ajax'));
    $xajax->register(XAJAX_FUNCTION, 'checkKomName');
    $xajax->processRequest();
      
    if ($menu->get(1) == 'ajax') {
        exit();
    }
      
    if (!is_numeric($menu->get(1))) {
        if ($menu->get(1) == 'rss' || $menu->get(1) == 'atom') {
            // ob_clean();
            $feed_type = $menu->get(1);
      
            $abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
            $erg = db_query($abf);
            $row = db_fetch_assoc($erg);
            $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
      
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
      
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,";
            $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
            $abf .= "a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          a.html
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE (a.news_recht | 1) = a.news_recht AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND a.news_id != $tn_id AND a.`archiv` != 1 AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY news_time DESC LIMIT 15";
            $erg = db_query($abf);
            $tpl = new tpl('news_' . $menu->get(1) . '.htm');
      
            header('Content-type: application/' . $menu->get(1) . '+xml');
      
            $tpl->set_ar_out(array(
                    'FEEDTITLE' => $allgAr['title'],
                    'UPDATED' => $last_update,
                    'SITEURL' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])
                    ), 0);
            while ($row = db_fetch_assoc($erg)) {
                if ($feed_type == 'atom') {
                    $Z = (date('Z') > 0 ? '+' : '') . date('H:i:s', date('Z') + 23 * 3600);
                    $row['datum'] = str_replace(' ', 'T', $row['datum']) . $Z;
                }
      
                $a = explode('[PREVIEWENDE]', $row['text']);
    
                $tpl->set_ar_out(array(
                        'TITLE' => $row['title'],
                        'TXT' => $row['html'] ? $a[0] : bbcode($a[0]),
                        'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?news-' . $row['id'],
                        'AUTHOR' => $row['username'],
                        'DATE' => $row['datum']
                        ), 1);
            }
            $tpl->out(2);
            exit;
        } else {
            $design->header();
            $limit = $allgAr['Nlimit'];
            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
      
            // Topnews ausgeben
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1, v2 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0, 0));
            $tn_koms = @db_result($news_opts, 0, 1);
            $tn_sql = db_query("SELECT 
                    a.news_title as title, a.news_text, 
                    a.news_kat, a.news_recht, a.html,
                    DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
                    DATE_FORMAT(a.news_time,'%W') as dayofweek,
                    b.name as username,
                    c.name as editorname,
                    a.html,
                    a.edit_time,
                    a.klicks,
                    b.id as uid
                FROM prefix_news a
                LEFT JOIN prefix_user as b ON a.user_id = b.id
                LEFT JOIN prefix_user as c ON a.editor_id = c.id
                WHERE a.news_id = $tn_id AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP()) AND
                (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht))");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_assoc($tn_sql);
      
                            $dontShow = false;
                            if ((pow(2, abs($_SESSION['authright'])) | $tn_r['news_recht']) != $tn_r['news_recht']) {
                                    $dontShow = true;
                            }
                    if (!$dontShow) {
                                    $tn_tpl = new tpl ('news/top');
                    if ($tn_koms) {
                        $tn_r['kom'] = db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'");
                    }
                        $tn_r['showkom'] = $tn_koms;
                    if (strpos ($tn_r['news_text'], '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $tn_r['news_text']);
                        $tn_r['news_text']= $a[0];
                        $tn_r['readwholenews'] = '<a href="index.php?news-' . $tn_id . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                    } else {
                         $tn_r['readwholenews'] = '';
                    }
                    $tn_r['id'] = $tn_id;
                        $tn_r['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $tn_r['klicks']. ' mal gelesen" title="' . $tn_r['klicks']. ' mal gelesen" border="0">';
                    $tn_r['datum']  = $lang[$tn_r['dayofweek']] . ' ' . $tn_r['datum'];
                        $tn_r['edit']   = is_null($tn_r['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($tn_r['edit_time'])) . '&nbsp;Uhr';
                        if (!empty($tn_r['edit']) and $tn_r['editorname'] != $tn_r['username']) {
                            $tn_r['edit'].= ' von ' . $tn_r['editorname']. '</i>';
                        } elseif (!empty($tn_r['edit'])) {
                            $tn_r['edit'].= '</i>';
                        }
      
                    $tn_r['kate'] = news_find_kat($tn_r['news_kat']);
                        $tn_r['text'] = $tn_r['html']? $tn_r['news_text']: bbcode($tn_r['news_text']);
                    $tn_tpl->set_ar_out($tn_r, 0);
                                    unset($tn_tpl);
                    }
            }
      
                    //Kategorie einschränken
                    if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                            $kats = $katssql = array();  #collect given kats
                            $i = 1;
                            while($kat = escape($menu->get($i), 'string')){
                                    $kats[] = $kat;
                                    $katssql[] = '"' . $kat . '"';
                                    $i++;
                            }
                            $news_kat = 'news_kat IN ('.implode(',', $katssql).') AND';
                            $katmpl = '-'.implode('-', $kats);
                            $page = $menu->getE('p');
                            if ($page < 1) {
                                    $page = 1;
                            }
                            $katmpl = str_replace('-p'.$page, '', $katmpl);
                    } else {
                            $news_kat = $katmpl = '';
                            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
                    }
      
            $anfang = ($page - 1) * $limit;
      
                    $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht)) AND $news_kat `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND archiv != 1 AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())" , $limit , '?news'.$katmpl , 'news');
            // Normale News
            $tpl = new tpl ('news/news.htm');
      
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,
          DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
          DATE_FORMAT(a.news_time,'%W') as dayofweek,
          a.news_kat as kate,
          a.news_text as text,
          b.name as username,
    	  b.id as userid,
          c.name as editorname,
          a.html,
          a.edit_time,
          a.klicks,
          b.id as uid
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        LEFT JOIN prefix_user as c ON a.editor_id = c.id
        WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht)) AND $news_kat
                    a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
                    (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY a.news_time DESC
        LIMIT " . $anfang . "," . $limit;
      
            // echo '<pre>'.$abf.'</pre>';
            $erg = db_query($abf);
                if (db_num_rows($erg) == 0 and !empty($news_kat)) {
                        echo 'Keine News in dieser Kategorie gefunden.<br />
                                <a href="index.php?news">News&uuml;bersichtsseite aufrufen</a>';
                        $design->footer(1);
                }
            while ($row = db_fetch_assoc($erg)) {
                $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
                $row['kom'] = db_result($k0m, 0);
      
                $row['kate'] = news_find_kat($row['kate']);
                $row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
                if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
                    $a = explode('[PREVIEWENDE]' , $row['text']);
                    $row['text'] = $a[0];
                    $row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                } else {
                    $row['readwholenews'] = '';
                }
                $row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
                if (!$row['html']) {
                    $row['text'] = bbcode($row['text']);
                }
                $row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . '&nbsp;Uhr';
                if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
                    $row['edit'] .= ' von ' . $row['editorname'] . '</i>';
                } elseif (!empty($row['edit'])) {
                    $row['edit'] .= '</i>';
                }
                $tpl->set_ar_out($row, 0);
            }
            $tpl->set_out('SITELINK', $MPL, 1);
            unset($tpl);
        }
    } else {
        $design->header();
        $xajax->printJavascript();
      
        $nid = escape($menu->get(1), 'integer');
        $erg = db_query("SELECT * FROM `prefix_news` WHERE `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id = '" . $nid . "'");
        if (db_num_rows($erg) == 0) {
            $dontShow = true;
            } else {
                    $dontShow = false;
                    $row = db_fetch_object($erg);
                    if ((pow(2, abs($_SESSION['authright'])) | $row->news_recht) != $row->news_recht) {
                            $dontShow = true;
                    }
            }
      
            if ($dontShow) {
                    echo 'News existiert nicht oder Sie haben keine Rechte sie zu sehen.  <a href="javascript:history.back();">zur&uuml;ck</a>';
                    $design->footer(1);
            }
      
        $komsOK = true;
        if ($allgAr['Ngkoms'] == 0) {
            if (loggedin()) {
                $komsOK = true;
            } else {
                $komsOK = false;
            }
        }
        if ($allgAr['Nukoms'] == 0) {
            $komsOK = false;
        }
      
        $kom_info = '';
        // kommentar add
        if ((loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt'])) {
            $_POST['txt'] = escape($_POST['txt'], 'string');
            $_POST['name'] = escape($_POST['name'], 'string');
            if (checkName($_POST['name']) or loggedin()) {
                if (loggedin()) {
                    $_POST['name'] = $_SESSION['authname'];
                }
                db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (" . $nid . ",'NEWS','" . $_POST['name'] . "','" . $_POST['txt'] . "')");
            } else {
                $kom_info = '<span style="color:red;">Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.</span><br />';
            }
        }
        // kommentar add
        // kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(- 7, 'news')) {
            $kommentar_id = escape($menu->getE(2), 'integer');
            db_query("DELETE FROM prefix_koms WHERE uid = " . $nid . " AND cat = 'NEWS' AND id = " . $kommentar_id);
        }
        // kommentar loeschen
        $kategorie = news_find_kat($row->news_kat);
      
        $textToShow = $row->html ? $row->news_text : bbcode($row->news_text);
        $textToShow = str_replace('[PREVIEWENDE]', '', $textToShow);
        if (!empty($such)) {
            $textToShow = markword($textToShow, $such);
        }
        // klicks zaehlen
        db_query("UPDATE prefix_news SET klicks = klicks + 1 WHERE news_id = " . $nid);
      
      
        $koms = db_count_query('SELECT COUNT(*) FROM `prefix_koms` WHERE `uid` = ' . $nid . ' AND `cat` = "NEWS"');
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
            'koms' => $koms
            );
        $tpl->set_ar_out($ar, 2);
      
        if ($komsOK) {
            $tpl->set_ar_out (array ('NAME' => $row->news_title , 'NID' => $nid, 'style' => loggedin() ? 'style="display:none;"' : ''), 3);
        }
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = " . $nid . " AND cat = 'NEWS' ORDER BY id DESC");
        $ergAnz1 = db_num_rows($erg1);
        if ($ergAnz1 == 0) {
            echo '<b>' . $lang['nocomments'] . '</b>';
        } else {
            $zahl = $ergAnz1;
            while ($row1 = db_fetch_assoc($erg1)) {
                $row1['text'] = bbcode(trim($row1['text']));
                if (has_right(- 7, 'news')) {
                    $row1['text'] .= '<a href="javascript:delkom(' . $nid . ',' . $row1['id'] . ')"><img src="include/images/icons/del.png" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
      
    $abf2 = 'SELECT id, name, avatar FROM prefix_user WHERE name = "'.$row1['name'].'" ';
    $erg2 = db_query($abf2);
    $row2 = db_fetch_object($erg2);
      
      
    if ( file_exists($row2->avatar) ) {
      $ava = '<img src="'.$row2->avatar.'" border="0" width="55" height="55">';
    }elseif ($row2->id != 0){
    $ava = '<img src="ich bin ein user ohne avatar" border="0" width="55" height="55">';
    }elseif ($row2->id == 0){
    $ava = '<img src="include/images/avatars/wurstegal.jpg border="0" width="55" height="55">';
    }
      
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'AVATA' => $ava, 'ZAHL' => $zahl, 'ID' => $row2['id']) , 4);
                $zahl--;
            }
        }
      
        $tpl->out(5);
    }
      
    $design->footer();
      
    ?>



    Und mach mal in der .htm das datum zu DATE


    Zuletzt modifiziert von -saarlonz- am 11.02.2014 - 12:45:28
    0 Mitglieder finden den Beitrag gut.
  10. #10
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    ZitatZitat geschrieben von -saarlonz-
    Versuch es mal so:

    <?php
    // Copyright by: Manuel Staechele
    // Support: www.ilch.de
    // Modded by Mairu für News Extended
    defined ('main') or die ('no direct access');
       
    $title = $allgAr['title'] . ' :: News';
    $hmenu = 'News';
    $design = new design ($title , $hmenu);
    $design->addheader('<link rel="alternate" type="application/atom+xml" title="News (Atom)" href="index.php?news-atom" />
    <link rel="alternate" type="application/rss+xml" title="News (RSS)" href="index.php?news-rss" />');
       
    function news_find_kat ($kat) {
        $katpfad = 'include/images/news/';
        $katjpg = $katpfad . $kat . '.jpg';
        $katgif = $katpfad . $kat . '.gif';
        $katpng = $katpfad . $kat . '.png';
       
        if (file_exists($katjpg)) {
            $pfadzumBild = $katjpg;
        } elseif (file_exists ($katgif)) {
            $pfadzumBild = $katgif;
        } elseif (file_exists ($katpng)) {
            $pfadzumBild = $katpng;
        }
       
        if (!empty($pfadzumBild)) {
            $kategorie = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
        } else {
            $kategorie = '<b>' . $kat . '</b><br /><br />';
        }
       
        return ($kategorie);
    }
    // Schaut ob ein Name so oder ähnlich in der Datenbank vorhanden ist
    // gibt true zurück falls der Name noch nicht verwendet ist
    function checkName($name) {
        if (db_count_query("SELECT COUNT(name) FROM prefix_user WHERE name LIKE '$name'")) {
            return false;
        } else {
            return true;
        }
    }
       
    function checkKomName($name) {
        $resp = new xajaxResponse();
        if (checkName($name) OR loggedin()) {
            $resp->script('document.forms["komform"].submit();');
        } else {
            $resp->assign('komname', 'value' , '');
            $resp->alert('Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.');
            $resp->script("document.getElementById('komname').focus();");
        }
        return $resp;
    }
    // xajax für namencheck
    $xajax = new xajax();
    $xajax->configureMany(array('decodeUTF8Input' => true ,'characterEncoding' => 'ISO-8859-1', 'requestURI' => 'admin.php?news-ajax'));
    $xajax->register(XAJAX_FUNCTION, 'checkKomName');
    $xajax->processRequest();
       
    if ($menu->get(1) == 'ajax') {
        exit();
    }
       
    if (!is_numeric($menu->get(1))) {
        if ($menu->get(1) == 'rss' || $menu->get(1) == 'atom') {
            // ob_clean();
            $feed_type = $menu->get(1);
       
            $abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
            $erg = db_query($abf);
            $row = db_fetch_assoc($erg);
            $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
       
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
       
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,";
            $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
            $abf .= "a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          a.html
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE (a.news_recht | 1) = a.news_recht AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND a.news_id != $tn_id AND a.`archiv` != 1 AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY news_time DESC LIMIT 15";
            $erg = db_query($abf);
            $tpl = new tpl('news_' . $menu->get(1) . '.htm');
       
            header('Content-type: application/' . $menu->get(1) . '+xml');
       
            $tpl->set_ar_out(array(
                    'FEEDTITLE' => $allgAr['title'],
                    'UPDATED' => $last_update,
                    'SITEURL' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])
                    ), 0);
            while ($row = db_fetch_assoc($erg)) {
                if ($feed_type == 'atom') {
                    $Z = (date('Z') > 0 ? '+' : '') . date('H:i:s', date('Z') + 23 * 3600);
                    $row['datum'] = str_replace(' ', 'T', $row['datum']) . $Z;
                }
       
                $a = explode('[PREVIEWENDE]', $row['text']);
     
                $tpl->set_ar_out(array(
                        'TITLE' => $row['title'],
                        'TXT' => $row['html'] ? $a[0] : bbcode($a[0]),
                        'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?news-' . $row['id'],
                        'AUTHOR' => $row['username'],
                        'DATE' => $row['datum']
                        ), 1);
            }
            $tpl->out(2);
            exit;
        } else {
            $design->header();
            $limit = $allgAr['Nlimit'];
            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
       
            // Topnews ausgeben
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1, v2 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0, 0));
            $tn_koms = @db_result($news_opts, 0, 1);
            $tn_sql = db_query("SELECT
                    a.news_title as title, a.news_text,
                    a.news_kat, a.news_recht, a.html,
                    DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
                    DATE_FORMAT(a.news_time,'%W') as dayofweek,
                    b.name as username,
                    c.name as editorname,
                    a.html,
                    a.edit_time,
                    a.klicks,
                    b.id as uid
                FROM prefix_news a
                LEFT JOIN prefix_user as b ON a.user_id = b.id
                LEFT JOIN prefix_user as c ON a.editor_id = c.id
                WHERE a.news_id = $tn_id AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP()) AND
                (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht))");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_assoc($tn_sql);
       
                            $dontShow = false;
                            if ((pow(2, abs($_SESSION['authright'])) | $tn_r['news_recht']) != $tn_r['news_recht']) {
                                    $dontShow = true;
                            }
                    if (!$dontShow) {
                                    $tn_tpl = new tpl ('news/top');
                    if ($tn_koms) {
                        $tn_r['kom'] = db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'");
                    }
                        $tn_r['showkom'] = $tn_koms;
                    if (strpos ($tn_r['news_text'], '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $tn_r['news_text']);
                        $tn_r['news_text']= $a[0];
                        $tn_r['readwholenews'] = '<a href="index.php?news-' . $tn_id . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                    } else {
                         $tn_r['readwholenews'] = '';
                    }
                    $tn_r['id'] = $tn_id;
                        $tn_r['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $tn_r['klicks']. ' mal gelesen" title="' . $tn_r['klicks']. ' mal gelesen" border="0">';
                    $tn_r['datum']  = $lang[$tn_r['dayofweek']] . ' ' . $tn_r['datum'];
                        $tn_r['edit']   = is_null($tn_r['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($tn_r['edit_time'])) . '&nbsp;Uhr';
                        if (!empty($tn_r['edit']) and $tn_r['editorname'] != $tn_r['username']) {
                            $tn_r['edit'].= ' von ' . $tn_r['editorname']. '</i>';
                        } elseif (!empty($tn_r['edit'])) {
                            $tn_r['edit'].= '</i>';
                        }
       
                    $tn_r['kate'] = news_find_kat($tn_r['news_kat']);
                        $tn_r['text'] = $tn_r['html']? $tn_r['news_text']: bbcode($tn_r['news_text']);
                    $tn_tpl->set_ar_out($tn_r, 0);
                                    unset($tn_tpl);
                    }
            }
       
                    //Kategorie einschränken
                    if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                            $kats = $katssql = array();  #collect given kats
                            $i = 1;
                            while($kat = escape($menu->get($i), 'string')){
                                    $kats[] = $kat;
                                    $katssql[] = '"' . $kat . '"';
                                    $i++;
                            }
                            $news_kat = 'news_kat IN ('.implode(',', $katssql).') AND';
                            $katmpl = '-'.implode('-', $kats);
                            $page = $menu->getE('p');
                            if ($page < 1) {
                                    $page = 1;
                            }
                            $katmpl = str_replace('-p'.$page, '', $katmpl);
                    } else {
                            $news_kat = $katmpl = '';
                            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
                    }
       
            $anfang = ($page - 1) * $limit;
       
                    $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht)) AND $news_kat `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND archiv != 1 AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())" , $limit , '?news'.$katmpl , 'news');
            // Normale News
            $tpl = new tpl ('news/news.htm');
       
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,
          DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
          DATE_FORMAT(a.news_time,'%W') as dayofweek,
          a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          b.id as userid,
          c.name as editorname,
          a.html,
          a.edit_time,
          a.klicks,
          b.id as uid
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        LEFT JOIN prefix_user as c ON a.editor_id = c.id
        WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht)) AND $news_kat
                    a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
                    (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY a.news_time DESC
        LIMIT " . $anfang . "," . $limit;
       
            // echo '<pre>'.$abf.'</pre>';
            $erg = db_query($abf);
                if (db_num_rows($erg) == 0 and !empty($news_kat)) {
                        echo 'Keine News in dieser Kategorie gefunden.<br />
                                <a href="index.php?news">News&uuml;bersichtsseite aufrufen</a>';
                        $design->footer(1);
                }
            while ($row = db_fetch_assoc($erg)) {
                $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
                $row['kom'] = db_result($k0m, 0);
       
                $row['kate'] = news_find_kat($row['kate']);
                $row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
                if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
                    $a = explode('[PREVIEWENDE]' , $row['text']);
                    $row['text'] = $a[0];
                    $row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                } else {
                    $row['readwholenews'] = '';
                }
                $row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
                if (!$row['html']) {
                    $row['text'] = bbcode($row['text']);
                }
                $row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . '&nbsp;Uhr';
                if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
                    $row['edit'] .= ' von ' . $row['editorname'] . '</i>';
                } elseif (!empty($row['edit'])) {
                    $row['edit'] .= '</i>';
                }
                $tpl->set_ar_out($row, 0);
            }
            $tpl->set_out('SITELINK', $MPL, 1);
            unset($tpl);
        }
    } else {
        $design->header();
        $xajax->printJavascript();
       
        $nid = escape($menu->get(1), 'integer');
        $erg = db_query("SELECT * FROM `prefix_news` WHERE `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id = '" . $nid . "'");
        if (db_num_rows($erg) == 0) {
            $dontShow = true;
            } else {
                    $dontShow = false;
                    $row = db_fetch_object($erg);
                    if ((pow(2, abs($_SESSION['authright'])) | $row->news_recht) != $row->news_recht) {
                            $dontShow = true;
                    }
            }
       
            if ($dontShow) {
                    echo 'News existiert nicht oder Sie haben keine Rechte sie zu sehen.  <a href="javascript:history.back();">zur&uuml;ck</a>';
                    $design->footer(1);
            }
       
        $komsOK = true;
        if ($allgAr['Ngkoms'] == 0) {
            if (loggedin()) {
                $komsOK = true;
            } else {
                $komsOK = false;
            }
        }
        if ($allgAr['Nukoms'] == 0) {
            $komsOK = false;
        }
       
        $kom_info = '';
        // kommentar add
        if ((loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt'])) {
            $_POST['txt'] = escape($_POST['txt'], 'string');
            $_POST['name'] = escape($_POST['name'], 'string');
            if (checkName($_POST['name']) or loggedin()) {
                if (loggedin()) {
                    $_POST['name'] = $_SESSION['authname'];
                }
                db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (" . $nid . ",'NEWS','" . $_POST['name'] . "','" . $_POST['txt'] . "')");
            } else {
                $kom_info = '<span style="color:red;">Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.</span><br />';
            }
        }
        // kommentar add
        // kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(- 7, 'news')) {
            $kommentar_id = escape($menu->getE(2), 'integer');
            db_query("DELETE FROM prefix_koms WHERE uid = " . $nid . " AND cat = 'NEWS' AND id = " . $kommentar_id);
        }
        // kommentar loeschen
        $kategorie = news_find_kat($row->news_kat);
       
        $textToShow = $row->html ? $row->news_text : bbcode($row->news_text);
        $textToShow = str_replace('[PREVIEWENDE]', '', $textToShow);
        if (!empty($such)) {
            $textToShow = markword($textToShow, $such);
        }
        // klicks zaehlen
        db_query("UPDATE prefix_news SET klicks = klicks + 1 WHERE news_id = " . $nid);
       
       
        $koms = db_count_query('SELECT COUNT(*) FROM `prefix_koms` WHERE `uid` = ' . $nid . ' AND `cat` = "NEWS"');
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
            'koms' => $koms,
        'ID' => $row->user_id
            );
        $tpl->set_ar_out($ar, 2);
       
        if ($komsOK) {
            $tpl->set_ar_out (array ('NAME' => $row->news_title , 'NID' => $nid, 'style' => loggedin() ? 'style="display:none;"' : ''), 3);
        }
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = " . $nid . " AND cat = 'NEWS' ORDER BY id DESC");
        $ergAnz1 = db_num_rows($erg1);
        if ($ergAnz1 == 0) {
            echo '<b>' . $lang['nocomments'] . '</b>';
        } else {
            $zahl = $ergAnz1;
            while ($row1 = db_fetch_assoc($erg1)) {
                $row1['text'] = bbcode(trim($row1['text']));
                if (has_right(- 7, 'news')) {
                    $row1['text'] .= '<a href="javascript:delkom(' . $nid . ',' . $row1['id'] . ')"><img src="include/images/icons/del.png" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
       
    $abf2 = 'SELECT id, name, avatar FROM prefix_user WHERE name = "'.$row1['name'].'" ';
    $erg2 = db_query($abf2);
    $row2 = db_fetch_object($erg2);
       
       
    if ( file_exists($row2->avatar) ) {
      $ava = '<img src="'.$row2->avatar.'" border="0" width="55" height="55">';
    }elseif ($row2->id != 0){
    $ava = '<img src="ich bin ein user ohne avatar" border="0" width="55" height="55">';
    }elseif ($row2->id == 0){
    $ava = '<img src="include/images/avatars/wurstegal.jpg border="0" width="55" height="55">';
    }
       
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'AVATA' => $ava, 'ZAHL' => $zahl) , 4);
                $zahl--;
            }
        }
       
        $tpl->out(5);
    }
       
    $design->footer();
       
    ?>



    Zuletzt modifiziert von -saarlonz- am 11.02.2014 - 12:41:42



    Hallo Saarlonz,

    danke für deine Antwort und hilfe.

    Ich Danke dir für die hilfe es ist jetzt nur ncoh das DATUM was noch nicht will.

    MFG


    Zuletzt modifiziert von FightClub am 11.02.2014 - 12:47:16
    0 Mitglieder finden den Beitrag gut.
  11. #11
    User Pic
    Saarlonz Hall Of Fame
    Registriert seit
    07.08.2008
    Beiträge
    3.003
    Beitragswertungen
    235 Beitragspunkte
    <?php
    // Copyright by: Manuel Staechele
    // Support: www.ilch.de
    // Modded by Mairu für News Extended
    defined ('main') or die ('no direct access');
      
    $title = $allgAr['title'] . ' :: News';
    $hmenu = 'News';
    $design = new design ($title , $hmenu);
    $design->addheader('<link rel="alternate" type="application/atom+xml" title="News (Atom)" href="index.php?news-atom" />
    <link rel="alternate" type="application/rss+xml" title="News (RSS)" href="index.php?news-rss" />');
      
    function news_find_kat ($kat) {
        $katpfad = 'include/images/news/';
        $katjpg = $katpfad . $kat . '.jpg';
        $katgif = $katpfad . $kat . '.gif';
        $katpng = $katpfad . $kat . '.png';
      
        if (file_exists($katjpg)) {
            $pfadzumBild = $katjpg;
        } elseif (file_exists ($katgif)) {
            $pfadzumBild = $katgif;
        } elseif (file_exists ($katpng)) {
            $pfadzumBild = $katpng;
        }
      
        if (!empty($pfadzumBild)) {
            $kategorie = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
        } else {
            $kategorie = '<b>' . $kat . '</b><br /><br />';
        }
      
        return ($kategorie);
    }
    // Schaut ob ein Name so oder ähnlich in der Datenbank vorhanden ist
    // gibt true zurück falls der Name noch nicht verwendet ist
    function checkName($name) {
        if (db_count_query("SELECT COUNT(name) FROM prefix_user WHERE name LIKE '$name'")) {
            return false;
        } else {
            return true;
        }
    }
      
    function checkKomName($name) {
        $resp = new xajaxResponse();
        if (checkName($name) OR loggedin()) {
            $resp->script('document.forms["komform"].submit();');
        } else {
            $resp->assign('komname', 'value' , '');
            $resp->alert('Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.');
            $resp->script("document.getElementById('komname').focus();");
        }
        return $resp;
    }
    // xajax für namencheck
    $xajax = new xajax();
    $xajax->configureMany(array('decodeUTF8Input' => true ,'characterEncoding' => 'ISO-8859-1', 'requestURI' => 'admin.php?news-ajax'));
    $xajax->register(XAJAX_FUNCTION, 'checkKomName');
    $xajax->processRequest();
      
    if ($menu->get(1) == 'ajax') {
        exit();
    }
      
    if (!is_numeric($menu->get(1))) {
        if ($menu->get(1) == 'rss' || $menu->get(1) == 'atom') {
            // ob_clean();
            $feed_type = $menu->get(1);
      
            $abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
            $erg = db_query($abf);
            $row = db_fetch_assoc($erg);
            $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
      
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
      
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,";
            $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
            $abf .= "a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          a.html
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE (a.news_recht | 1) = a.news_recht AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND a.news_id != $tn_id AND a.`archiv` != 1 AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY news_time DESC LIMIT 15";
            $erg = db_query($abf);
            $tpl = new tpl('news_' . $menu->get(1) . '.htm');
      
            header('Content-type: application/' . $menu->get(1) . '+xml');
      
            $tpl->set_ar_out(array(
                    'FEEDTITLE' => $allgAr['title'],
                    'UPDATED' => $last_update,
                    'SITEURL' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])
                    ), 0);
            while ($row = db_fetch_assoc($erg)) {
                if ($feed_type == 'atom') {
                    $Z = (date('Z') > 0 ? '+' : '') . date('H:i:s', date('Z') + 23 * 3600);
                    $row['datum'] = str_replace(' ', 'T', $row['datum']) . $Z;
                }
      
                $a = explode('[PREVIEWENDE]', $row['text']);
    
                $tpl->set_ar_out(array(
                        'TITLE' => $row['title'],
                        'TXT' => $row['html'] ? $a[0] : bbcode($a[0]),
                        'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?news-' . $row['id'],
                        'AUTHOR' => $row['username'],
                        'DATE' => $row['datum']
                        ), 1);
            }
            $tpl->out(2);
            exit;
        } else {
            $design->header();
            $limit = $allgAr['Nlimit'];
            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
      
            // Topnews ausgeben
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1, v2 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0, 0));
            $tn_koms = @db_result($news_opts, 0, 1);
            $tn_sql = db_query("SELECT 
                    a.news_title as title, a.news_text, 
                    a.news_kat, a.news_recht, a.html,
                    DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
                    DATE_FORMAT(a.news_time,'%W') as dayofweek,
                    b.name as username,
                    c.name as editorname,
                    a.html,
                    a.edit_time,
                    a.klicks,
                    b.id as uid
                FROM prefix_news a
                LEFT JOIN prefix_user as b ON a.user_id = b.id
                LEFT JOIN prefix_user as c ON a.editor_id = c.id
                WHERE a.news_id = $tn_id AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP()) AND
                (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht))");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_assoc($tn_sql);
      
                            $dontShow = false;
                            if ((pow(2, abs($_SESSION['authright'])) | $tn_r['news_recht']) != $tn_r['news_recht']) {
                                    $dontShow = true;
                            }
                    if (!$dontShow) {
                                    $tn_tpl = new tpl ('news/top');
                    if ($tn_koms) {
                        $tn_r['kom'] = db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'");
                    }
                        $tn_r['showkom'] = $tn_koms;
                    if (strpos ($tn_r['news_text'], '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $tn_r['news_text']);
                        $tn_r['news_text']= $a[0];
                        $tn_r['readwholenews'] = '<a href="index.php?news-' . $tn_id . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                    } else {
                         $tn_r['readwholenews'] = '';
                    }
                    $tn_r['id'] = $tn_id;
                        $tn_r['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $tn_r['klicks']. ' mal gelesen" title="' . $tn_r['klicks']. ' mal gelesen" border="0">';
                    $tn_r['datum']  = $lang[$tn_r['dayofweek']] . ' ' . $tn_r['datum'];
                        $tn_r['edit']   = is_null($tn_r['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($tn_r['edit_time'])) . '&nbsp;Uhr';
                        if (!empty($tn_r['edit']) and $tn_r['editorname'] != $tn_r['username']) {
                            $tn_r['edit'].= ' von ' . $tn_r['editorname']. '</i>';
                        } elseif (!empty($tn_r['edit'])) {
                            $tn_r['edit'].= '</i>';
                        }
      
                    $tn_r['kate'] = news_find_kat($tn_r['news_kat']);
                        $tn_r['text'] = $tn_r['html']? $tn_r['news_text']: bbcode($tn_r['news_text']);
                    $tn_tpl->set_ar_out($tn_r, 0);
                                    unset($tn_tpl);
                    }
            }
      
                    //Kategorie einschränken
                    if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                            $kats = $katssql = array();  #collect given kats
                            $i = 1;
                            while($kat = escape($menu->get($i), 'string')){
                                    $kats[] = $kat;
                                    $katssql[] = '"' . $kat . '"';
                                    $i++;
                            }
                            $news_kat = 'news_kat IN ('.implode(',', $katssql).') AND';
                            $katmpl = '-'.implode('-', $kats);
                            $page = $menu->getE('p');
                            if ($page < 1) {
                                    $page = 1;
                            }
                            $katmpl = str_replace('-p'.$page, '', $katmpl);
                    } else {
                            $news_kat = $katmpl = '';
                            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
                    }
      
            $anfang = ($page - 1) * $limit;
      
                    $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht)) AND $news_kat `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND archiv != 1 AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())" , $limit , '?news'.$katmpl , 'news');
            // Normale News
            $tpl = new tpl ('news/news.htm');
      
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,
          DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
          DATE_FORMAT(a.news_time,'%W') as dayofweek,
          a.news_kat as kate,
          a.news_text as text,
          b.name as username,
    	  b.id as userid,
          c.name as editorname,
          a.html,
          a.edit_time,
          a.klicks,
          b.id as uid
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        LEFT JOIN prefix_user as c ON a.editor_id = c.id
        WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht)) AND $news_kat
                    a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
                    (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY a.news_time DESC
        LIMIT " . $anfang . "," . $limit;
      
            // echo '<pre>'.$abf.'</pre>';
            $erg = db_query($abf);
                if (db_num_rows($erg) == 0 and !empty($news_kat)) {
                        echo 'Keine News in dieser Kategorie gefunden.<br />
                                <a href="index.php?news">News&uuml;bersichtsseite aufrufen</a>';
                        $design->footer(1);
                }
            while ($row = db_fetch_assoc($erg)) {
                $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
                $row['kom'] = db_result($k0m, 0);
      
                $row['kate'] = news_find_kat($row['kate']);
                $row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
                if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
                    $a = explode('[PREVIEWENDE]' , $row['text']);
                    $row['text'] = $a[0];
                    $row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                } else {
                    $row['readwholenews'] = '';
                }
                $row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
                if (!$row['html']) {
                    $row['text'] = bbcode($row['text']);
                }
                $row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . '&nbsp;Uhr';
                if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
                    $row['edit'] .= ' von ' . $row['editorname'] . '</i>';
                } elseif (!empty($row['edit'])) {
                    $row['edit'] .= '</i>';
                }
                $tpl->set_ar_out($row, 0);
            }
            $tpl->set_out('SITELINK', $MPL, 1);
            unset($tpl);
        }
    } else {
        $design->header();
        $xajax->printJavascript();
      
        $nid = escape($menu->get(1), 'integer');
        $erg = db_query("SELECT * FROM `prefix_news` WHERE `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id = '" . $nid . "'");
        if (db_num_rows($erg) == 0) {
            $dontShow = true;
            } else {
                    $dontShow = false;
                    $row = db_fetch_object($erg);
                    if ((pow(2, abs($_SESSION['authright'])) | $row->news_recht) != $row->news_recht) {
                            $dontShow = true;
                    }
            }
      
            if ($dontShow) {
                    echo 'News existiert nicht oder Sie haben keine Rechte sie zu sehen.  <a href="javascript:history.back();">zur&uuml;ck</a>';
                    $design->footer(1);
            }
      
        $komsOK = true;
        if ($allgAr['Ngkoms'] == 0) {
            if (loggedin()) {
                $komsOK = true;
            } else {
                $komsOK = false;
            }
        }
        if ($allgAr['Nukoms'] == 0) {
            $komsOK = false;
        }
      
        $kom_info = '';
        // kommentar add
        if ((loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt'])) {
            $_POST['txt'] = escape($_POST['txt'], 'string');
            $_POST['name'] = escape($_POST['name'], 'string');
            if (checkName($_POST['name']) or loggedin()) {
                if (loggedin()) {
                    $_POST['name'] = $_SESSION['authname'];
                }
                db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (" . $nid . ",'NEWS','" . $_POST['name'] . "','" . $_POST['txt'] . "')");
            } else {
                $kom_info = '<span style="color:red;">Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.</span><br />';
            }
        }
        // kommentar add
        // kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(- 7, 'news')) {
            $kommentar_id = escape($menu->getE(2), 'integer');
            db_query("DELETE FROM prefix_koms WHERE uid = " . $nid . " AND cat = 'NEWS' AND id = " . $kommentar_id);
        }
        // kommentar loeschen
        $kategorie = news_find_kat($row->news_kat);
      
        $textToShow = $row->html ? $row->news_text : bbcode($row->news_text);
        $textToShow = str_replace('[PREVIEWENDE]', '', $textToShow);
        if (!empty($such)) {
            $textToShow = markword($textToShow, $such);
        }
        // klicks zaehlen
        db_query("UPDATE prefix_news SET klicks = klicks + 1 WHERE news_id = " . $nid);
      
      
        $koms = db_count_query('SELECT COUNT(*) FROM `prefix_koms` WHERE `uid` = ' . $nid . ' AND `cat` = "NEWS"');
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
            'koms' => $koms,
    		'datum' => $row->news_time
            );
        $tpl->set_ar_out($ar, 2);
      
        if ($komsOK) {
            $tpl->set_ar_out (array ('NAME' => $row->news_title , 'NID' => $nid, 'style' => loggedin() ? 'style="display:none;"' : ''), 3);
        }
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = " . $nid . " AND cat = 'NEWS' ORDER BY id DESC");
        $ergAnz1 = db_num_rows($erg1);
        if ($ergAnz1 == 0) {
            echo '<b>' . $lang['nocomments'] . '</b>';
        } else {
            $zahl = $ergAnz1;
            while ($row1 = db_fetch_assoc($erg1)) {
                $row1['text'] = bbcode(trim($row1['text']));
                if (has_right(- 7, 'news')) {
                    $row1['text'] .= '<a href="javascript:delkom(' . $nid . ',' . $row1['id'] . ')"><img src="include/images/icons/del.png" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
      
    $abf2 = 'SELECT id, name, avatar FROM prefix_user WHERE name = "'.$row1['name'].'" ';
    $erg2 = db_query($abf2);
    $row2 = db_fetch_object($erg2);
      
      
    if ( file_exists($row2->avatar) ) {
      $ava = '<img src="'.$row2->avatar.'" border="0" width="55" height="55">';
    }elseif ($row2->id != 0){
    $ava = '<img src="ich bin ein user ohne avatar" border="0" width="55" height="55">';
    }elseif ($row2->id == 0){
    $ava = '<img src="include/images/avatars/wurstegal.jpg border="0" width="55" height="55">';
    }
      
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'AVATA' => $ava, 'ZAHL' => $zahl, 'ID' => $row2['id']) , 4);
                $zahl--;
            }
        }
      
        $tpl->out(5);
    }
      
    $design->footer();
      
    ?>



    Zuletzt modifiziert von -saarlonz- am 11.02.2014 - 12:57:16
    0 Mitglieder finden den Beitrag gut.
  12. #12
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    ZitatZitat geschrieben von -saarlonz-
    Ja, gerade geschrieben, ändere mal einfach datum in DATE


    Wo hast du das denn ein geschrieben.

    denn die Zuletzt modifiziert von -saarlonz- am 11.02.2014 - 12:45:28
    ist nicht Richtig wenn ich die nehme da ist die USER-ID nicht mehr ok

    MFG
    0 Mitglieder finden den Beitrag gut.
  13. #13
    User Pic
    Saarlonz Hall Of Fame
    Registriert seit
    07.08.2008
    Beiträge
    3.003
    Beitragswertungen
    235 Beitragspunkte
    nimm mal den letzten code über deinem Beitrag, und lass datum doch als datum zwinker
    0 Mitglieder finden den Beitrag gut.
  14. #14
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    ZitatZitat geschrieben von -saarlonz-
    nimm mal den letzten code über deinem Beitrag, und lass datum doch als datum zwinker


    Ja jetzt ist es OK aber das Datum soll ja oben rechts sein.

    So wie in dem Bild:
    gesperrtes Bild

    MFG und Danke zwinker
    0 Mitglieder finden den Beitrag gut.
  15. #15
    User Pic
    Saarlonz Hall Of Fame
    Registriert seit
    07.08.2008
    Beiträge
    3.003
    Beitragswertungen
    235 Beitragspunkte
    Also Thema erledigt, oder versteh ich das gerade falsch grumml
    0 Mitglieder finden den Beitrag gut.
  16. #16
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    ZitatZitat geschrieben von -saarlonz-
    Also Thema erledigt, oder versteh ich das gerade falsch grumml


    Ne noch nicht Richtig das Dautm soll ja oben Rechts sein.
    So wie in dem Bild:

    gesperrtes Bild
    0 Mitglieder finden den Beitrag gut.
  17. #17
    User Pic
    Saarlonz Hall Of Fame
    Registriert seit
    07.08.2008
    Beiträge
    3.003
    Beitragswertungen
    235 Beitragspunkte
    Ja und wo ist es jetzt?
    0 Mitglieder finden den Beitrag gut.
  18. #18
    User Pic
    FightClub Mitglied
    Registriert seit
    02.06.2013
    Beiträge
    196
    Beitragswertungen
    1 Beitragspunkte
    Sorry mein Fehler lächeln

    Habe es jetzt,
    ich DANKE dir 95% fertig. zwinker

    Bis auf die Datum ansicht: 2014-02-03 13:00:13
    So wäre es schöner: Montag 03. 02. 2014 - 13:00 Uhr

    <?php
    // Copyright by: Manuel Staechele
    // Support: www.ilch.de
    // Modded by Mairu für News Extended
    defined ('main') or die ('no direct access');
        
    $title = $allgAr['title'] . ' :: News';
    $hmenu = 'News';
    $design = new design ($title , $hmenu);
    $design->addheader('<link rel="alternate" type="application/atom+xml" title="News (Atom)" href="index.php?news-atom" />
    <link rel="alternate" type="application/rss+xml" title="News (RSS)" href="index.php?news-rss" />');
        
    function news_find_kat ($kat) {
        $katpfad = 'include/images/news/';
        $katjpg = $katpfad . $kat . '.jpg';
        $katgif = $katpfad . $kat . '.gif';
        $katpng = $katpfad . $kat . '.png';
        
        if (file_exists($katjpg)) {
            $pfadzumBild = $katjpg;
        } elseif (file_exists ($katgif)) {
            $pfadzumBild = $katgif;
        } elseif (file_exists ($katpng)) {
            $pfadzumBild = $katpng;
        }
        
        if (!empty($pfadzumBild)) {
            $kategorie = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
        } else {
            $kategorie = '<b>' . $kat . '</b><br /><br />';
        }
        
        return ($kategorie);
    }
    // Schaut ob ein Name so oder ähnlich in der Datenbank vorhanden ist
    // gibt true zurück falls der Name noch nicht verwendet ist
    function checkName($name) {
        if (db_count_query("SELECT COUNT(name) FROM prefix_user WHERE name LIKE '$name'")) {
            return false;
        } else {
            return true;
        }
    }
        
    function checkKomName($name) {
        $resp = new xajaxResponse();
        if (checkName($name) OR loggedin()) {
            $resp->script('document.forms["komform"].submit();');
        } else {
            $resp->assign('komname', 'value' , '');
            $resp->alert('Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.');
            $resp->script("document.getElementById('komname').focus();");
        }
        return $resp;
    }
    // xajax für namencheck
    $xajax = new xajax();
    $xajax->configureMany(array('decodeUTF8Input' => true ,'characterEncoding' => 'ISO-8859-1', 'requestURI' => 'admin.php?news-ajax'));
    $xajax->register(XAJAX_FUNCTION, 'checkKomName');
    $xajax->processRequest();
        
    if ($menu->get(1) == 'ajax') {
        exit();
    }
        
    if (!is_numeric($menu->get(1))) {
        if ($menu->get(1) == 'rss' || $menu->get(1) == 'atom') {
            // ob_clean();
            $feed_type = $menu->get(1);
        
            $abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
            $erg = db_query($abf);
            $row = db_fetch_assoc($erg);
            $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
        
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
        
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,";
            $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
            $abf .= "a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          a.html
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE (a.news_recht | 1) = a.news_recht AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND a.news_id != $tn_id AND a.`archiv` != 1 AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY news_time DESC LIMIT 15";
            $erg = db_query($abf);
            $tpl = new tpl('news_' . $menu->get(1) . '.htm');
        
            header('Content-type: application/' . $menu->get(1) . '+xml');
        
            $tpl->set_ar_out(array(
                    'FEEDTITLE' => $allgAr['title'],
                    'UPDATED' => $last_update,
                    'SITEURL' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])
                    ), 0);
            while ($row = db_fetch_assoc($erg)) {
                if ($feed_type == 'atom') {
                    $Z = (date('Z') > 0 ? '+' : '') . date('H:i:s', date('Z') + 23 * 3600);
                    $row['datum'] = str_replace(' ', 'T', $row['datum']) . $Z;
                }
        
                $a = explode('[PREVIEWENDE]', $row['text']);
      
                $tpl->set_ar_out(array(
                        'TITLE' => $row['title'],
                        'TXT' => $row['html'] ? $a[0] : bbcode($a[0]),
                        'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?news-' . $row['id'],
                        'AUTHOR' => $row['username'],
                        'DATE' => $row['datum']
                        ), 1);
            }
            $tpl->out(2);
            exit;
        } else {
            $design->header();
            $limit = $allgAr['Nlimit'];
            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
        
            // Topnews ausgeben
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1, v2 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0, 0));
            $tn_koms = @db_result($news_opts, 0, 1);
            $tn_sql = db_query("SELECT
                    a.news_title as title, a.news_text,
                    a.news_kat, a.news_recht, a.html,
                    DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
                    DATE_FORMAT(a.news_time,'%W') as dayofweek,
                    b.name as username,
                    c.name as editorname,
                    a.html,
                    a.edit_time,
                    a.klicks,
                    b.id as uid
                FROM prefix_news a
                LEFT JOIN prefix_user as b ON a.user_id = b.id
                LEFT JOIN prefix_user as c ON a.editor_id = c.id
                WHERE a.news_id = $tn_id AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP()) AND
                (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht))");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_assoc($tn_sql);
        
                            $dontShow = false;
                            if ((pow(2, abs($_SESSION['authright'])) | $tn_r['news_recht']) != $tn_r['news_recht']) {
                                    $dontShow = true;
                            }
                    if (!$dontShow) {
                                    $tn_tpl = new tpl ('news/top');
                    if ($tn_koms) {
                        $tn_r['kom'] = db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'");
                    }
                        $tn_r['showkom'] = $tn_koms;
                    if (strpos ($tn_r['news_text'], '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $tn_r['news_text']);
                        $tn_r['news_text']= $a[0];
                        $tn_r['readwholenews'] = '<a href="index.php?news-' . $tn_id . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                    } else {
                         $tn_r['readwholenews'] = '';
                    }
                    $tn_r['id'] = $tn_id;
                        $tn_r['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $tn_r['klicks']. ' mal gelesen" title="' . $tn_r['klicks']. ' mal gelesen" border="0">';
                    $tn_r['datum']  = $lang[$tn_r['dayofweek']] . ' ' . $tn_r['datum'];
                        $tn_r['edit']   = is_null($tn_r['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($tn_r['edit_time'])) . '&nbsp;Uhr';
                        if (!empty($tn_r['edit']) and $tn_r['editorname'] != $tn_r['username']) {
                            $tn_r['edit'].= ' von ' . $tn_r['editorname']. '</i>';
                        } elseif (!empty($tn_r['edit'])) {
                            $tn_r['edit'].= '</i>';
                        }
        
                    $tn_r['kate'] = news_find_kat($tn_r['news_kat']);
                        $tn_r['text'] = $tn_r['html']? $tn_r['news_text']: bbcode($tn_r['news_text']);
                    $tn_tpl->set_ar_out($tn_r, 0);
                                    unset($tn_tpl);
                    }
            }
        
                    //Kategorie einschränken
                    if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                            $kats = $katssql = array();  #collect given kats
                            $i = 1;
                            while($kat = escape($menu->get($i), 'string')){
                                    $kats[] = $kat;
                                    $katssql[] = '"' . $kat . '"';
                                    $i++;
                            }
                            $news_kat = 'news_kat IN ('.implode(',', $katssql).') AND';
                            $katmpl = '-'.implode('-', $kats);
                            $page = $menu->getE('p');
                            if ($page < 1) {
                                    $page = 1;
                            }
                            $katmpl = str_replace('-p'.$page, '', $katmpl);
                    } else {
                            $news_kat = $katmpl = '';
                            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
                    }
        
            $anfang = ($page - 1) * $limit;
        
                    $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht)) AND $news_kat `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND archiv != 1 AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())" , $limit , '?news'.$katmpl , 'news');
            // Normale News
            $tpl = new tpl ('news/news.htm');
        
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,
          DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
          DATE_FORMAT(a.news_time,'%W') as dayofweek,
          a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          b.id as userid,
          c.name as editorname,
          a.html,
          a.edit_time,
          a.klicks,
          b.id as uid
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        LEFT JOIN prefix_user as c ON a.editor_id = c.id
        WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht)) AND $news_kat
                    a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
                    (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY a.news_time DESC
        LIMIT " . $anfang . "," . $limit;
        
            // echo '<pre>'.$abf.'</pre>';
            $erg = db_query($abf);
                if (db_num_rows($erg) == 0 and !empty($news_kat)) {
                        echo 'Keine News in dieser Kategorie gefunden.<br />
                                <a href="index.php?news">News&uuml;bersichtsseite aufrufen</a>';
                        $design->footer(1);
                }
            while ($row = db_fetch_assoc($erg)) {
                $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
                $row['kom'] = db_result($k0m, 0);
        
                $row['kate'] = news_find_kat($row['kate']);
                $row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
                if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
                    $a = explode('[PREVIEWENDE]' , $row['text']);
                    $row['text'] = $a[0];
                    $row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                } else {
                    $row['readwholenews'] = '';
                }
                $row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
                if (!$row['html']) {
                    $row['text'] = bbcode($row['text']);
                }
                $row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . '&nbsp;Uhr';
                if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
                    $row['edit'] .= ' von ' . $row['editorname'] . '</i>';
                } elseif (!empty($row['edit'])) {
                    $row['edit'] .= '</i>';
                }
                $tpl->set_ar_out($row, 0);
            }
            $tpl->set_out('SITELINK', $MPL, 1);
            unset($tpl);
        }
    } else {
        $design->header();
        $xajax->printJavascript();
        
        $nid = escape($menu->get(1), 'integer');
        $erg = db_query("SELECT * FROM `prefix_news` WHERE `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id = '" . $nid . "'");
        if (db_num_rows($erg) == 0) {
            $dontShow = true;
            } else {
                    $dontShow = false;
                    $row = db_fetch_object($erg);
                    if ((pow(2, abs($_SESSION['authright'])) | $row->news_recht) != $row->news_recht) {
                            $dontShow = true;
                    }
            }
        
            if ($dontShow) {
                    echo 'News existiert nicht oder Sie haben keine Rechte sie zu sehen.  <a href="javascript:history.back();">zur&uuml;ck</a>';
                    $design->footer(1);
            }
        
        $komsOK = true;
        if ($allgAr['Ngkoms'] == 0) {
            if (loggedin()) {
                $komsOK = true;
            } else {
                $komsOK = false;
            }
        }
        if ($allgAr['Nukoms'] == 0) {
            $komsOK = false;
        }
        
        $kom_info = '';
        // kommentar add
        if ((loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt'])) {
            $_POST['txt'] = escape($_POST['txt'], 'string');
            $_POST['name'] = escape($_POST['name'], 'string');
            if (checkName($_POST['name']) or loggedin()) {
                if (loggedin()) {
                    $_POST['name'] = $_SESSION['authname'];
                }
                db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (" . $nid . ",'NEWS','" . $_POST['name'] . "','" . $_POST['txt'] . "')");
            } else {
                $kom_info = '<span style="color:red;">Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.</span><br />';
            }
        }
        // kommentar add
        // kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(- 7, 'news')) {
            $kommentar_id = escape($menu->getE(2), 'integer');
            db_query("DELETE FROM prefix_koms WHERE uid = " . $nid . " AND cat = 'NEWS' AND id = " . $kommentar_id);
        }
        // kommentar loeschen
        $kategorie = news_find_kat($row->news_kat);
        
        $textToShow = $row->html ? $row->news_text : bbcode($row->news_text);
        $textToShow = str_replace('[PREVIEWENDE]', '', $textToShow);
        if (!empty($such)) {
            $textToShow = markword($textToShow, $such);
        }
        // klicks zaehlen
        db_query("UPDATE prefix_news SET klicks = klicks + 1 WHERE news_id = " . $nid);
        
        $koms = db_count_query('SELECT COUNT(*) FROM `prefix_koms` WHERE `uid` = ' . $nid . ' AND `cat` = "NEWS"');
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
            'koms' => $koms,
    		'ID' => $row->user_id,
    		'datum' => $row->news_time
            );
    
        $tpl->set_ar_out($ar, 2);
        
        if ($komsOK) {
            $tpl->set_ar_out (array ('NAME' => $row->news_title , 'NID' => $nid, 'style' => loggedin() ? 'style="display:none;"' : ''), 3);
        }
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = " . $nid . " AND cat = 'NEWS' ORDER BY id DESC");
        $ergAnz1 = db_num_rows($erg1);
        if ($ergAnz1 == 0) {
            echo '<b>' . $lang['nocomments'] . '</b>';
        } else {
            $zahl = $ergAnz1;
            while ($row1 = db_fetch_assoc($erg1)) {
                $row1['text'] = bbcode(trim($row1['text']));
                if (has_right(- 7, 'news')) {
                    $row1['text'] .= '<a href="javascript:delkom(' . $nid . ',' . $row1['id'] . ')"><img src="include/images/icons/del.png" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
        
    $abf2 = 'SELECT id, name, avatar FROM prefix_user WHERE name = "'.$row1['name'].'" ';
    $erg2 = db_query($abf2);
    $row2 = db_fetch_object($erg2);
        
        
    if ( file_exists($row2->avatar) ) {
      $ava = '<img src="'.$row2->avatar.'" border="0" width="55" height="55">';
    }elseif ($row2->id != 0){
    $ava = '<img src="ich bin ein user ohne avatar" border="0" width="55" height="55">';
    }elseif ($row2->id == 0){
    $ava = '<img src="include/images/avatars/wurstegal.jpg border="0" width="55" height="55">';
    }
        
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'AVATA' => $ava, 'ZAHL' => $zahl) , 4);
                $zahl--;
            }
        }
        
        $tpl->out(5);
    }
        
    $design->footer();
        
    ?>


    So jetzt ist es 100% fertig zwinker
    <?php
    // Copyright by: Manuel Staechele
    // Support: www.ilch.de
    // Modded by Mairu für News Extended
    defined ('main') or die ('no direct access');
        
    $title = $allgAr['title'] . ' :: News';
    $hmenu = 'News';
    $design = new design ($title , $hmenu);
    $design->addheader('<link rel="alternate" type="application/atom+xml" title="News (Atom)" href="index.php?news-atom" />
    <link rel="alternate" type="application/rss+xml" title="News (RSS)" href="index.php?news-rss" />');
        
    function news_find_kat ($kat) {
        $katpfad = 'include/images/news/';
        $katjpg = $katpfad . $kat . '.jpg';
        $katgif = $katpfad . $kat . '.gif';
        $katpng = $katpfad . $kat . '.png';
        
        if (file_exists($katjpg)) {
            $pfadzumBild = $katjpg;
        } elseif (file_exists ($katgif)) {
            $pfadzumBild = $katgif;
        } elseif (file_exists ($katpng)) {
            $pfadzumBild = $katpng;
        }
        
        if (!empty($pfadzumBild)) {
            $kategorie = '<img style="" src="' . $pfadzumBild . '" alt="' . $kat . '">';
        } else {
            $kategorie = '<b>' . $kat . '</b><br /><br />';
        }
        
        return ($kategorie);
    }
    // Schaut ob ein Name so oder ähnlich in der Datenbank vorhanden ist
    // gibt true zurück falls der Name noch nicht verwendet ist
    function checkName($name) {
        if (db_count_query("SELECT COUNT(name) FROM prefix_user WHERE name LIKE '$name'")) {
            return false;
        } else {
            return true;
        }
    }
        
    function checkKomName($name) {
        $resp = new xajaxResponse();
        if (checkName($name) OR loggedin()) {
            $resp->script('document.forms["komform"].submit();');
        } else {
            $resp->assign('komname', 'value' , '');
            $resp->alert('Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.');
            $resp->script("document.getElementById('komname').focus();");
        }
        return $resp;
    }
    // xajax für namencheck
    $xajax = new xajax();
    $xajax->configureMany(array('decodeUTF8Input' => true ,'characterEncoding' => 'ISO-8859-1', 'requestURI' => 'admin.php?news-ajax'));
    $xajax->register(XAJAX_FUNCTION, 'checkKomName');
    $xajax->processRequest();
        
    if ($menu->get(1) == 'ajax') {
        exit();
    }
        
    if (!is_numeric($menu->get(1))) {
        if ($menu->get(1) == 'rss' || $menu->get(1) == 'atom') {
            // ob_clean();
            $feed_type = $menu->get(1);
        
            $abf = "SELECT MAX(news_time) AS last_update FROM prefix_news";
            $erg = db_query($abf);
            $row = db_fetch_assoc($erg);
            $last_update = str_replace(' ', 'T', $row['last_update']) . 'Z';
        
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0));
        
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,";
            $abf .= ($feed_type == 'atom') ? 'a.news_time as datum,' : "DATE_FORMAT(a.news_time,'%a, %e %b %y %H:%i:%s') as datum,";
            $abf .= "a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          a.html
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        WHERE (a.news_recht | 1) = a.news_recht AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND a.news_id != $tn_id AND a.`archiv` != 1 AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY news_time DESC LIMIT 15";
            $erg = db_query($abf);
            $tpl = new tpl('news_' . $menu->get(1) . '.htm');
        
            header('Content-type: application/' . $menu->get(1) . '+xml');
        
            $tpl->set_ar_out(array(
                    'FEEDTITLE' => $allgAr['title'],
                    'UPDATED' => $last_update,
                    'SITEURL' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])
                    ), 0);
            while ($row = db_fetch_assoc($erg)) {
                if ($feed_type == 'atom') {
                    $Z = (date('Z') > 0 ? '+' : '') . date('H:i:s', date('Z') + 23 * 3600);
                    $row['datum'] = str_replace(' ', 'T', $row['datum']) . $Z;
                }
        
                $a = explode('[PREVIEWENDE]', $row['text']);
      
                $tpl->set_ar_out(array(
                        'TITLE' => $row['title'],
                        'TXT' => $row['html'] ? $a[0] : bbcode($a[0]),
                        'LINK' => 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/index.php?news-' . $row['id'],
                        'AUTHOR' => $row['username'],
                        'DATE' => $row['datum']
                        ), 1);
            }
            $tpl->out(2);
            exit;
        } else {
            $design->header();
            $limit = $allgAr['Nlimit'];
            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
        
            // Topnews ausgeben
            $tn_id = intval(@db_result($news_opts = db_query("SELECT v1, v2 FROM prefix_allg WHERE k = 'news' LIMIT 1"), 0, 0));
            $tn_koms = @db_result($news_opts, 0, 1);
            $tn_sql = db_query("SELECT
                    a.news_title as title, a.news_text,
                    a.news_kat, a.news_recht, a.html,
                    DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
                    DATE_FORMAT(a.news_time,'%W') as dayofweek,
                    b.name as username,
                    c.name as editorname,
                    a.html,
                    a.edit_time,
                    a.klicks,
                    b.id as uid
                FROM prefix_news a
                LEFT JOIN prefix_user as b ON a.user_id = b.id
                LEFT JOIN prefix_user as c ON a.editor_id = c.id
                WHERE a.news_id = $tn_id AND a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP()) AND
                (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht))");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_assoc($tn_sql);
        
                            $dontShow = false;
                            if ((pow(2, abs($_SESSION['authright'])) | $tn_r['news_recht']) != $tn_r['news_recht']) {
                                    $dontShow = true;
                            }
                    if (!$dontShow) {
                                    $tn_tpl = new tpl ('news/top');
                    if ($tn_koms) {
                        $tn_r['kom'] = db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'");
                    }
                        $tn_r['showkom'] = $tn_koms;
                    if (strpos ($tn_r['news_text'], '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $tn_r['news_text']);
                        $tn_r['news_text']= $a[0];
                        $tn_r['readwholenews'] = '<a href="index.php?news-' . $tn_id . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                    } else {
                         $tn_r['readwholenews'] = '';
                    }
                    $tn_r['id'] = $tn_id;
                        $tn_r['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $tn_r['klicks']. ' mal gelesen" title="' . $tn_r['klicks']. ' mal gelesen" border="0">';
                    $tn_r['datum']  = $lang[$tn_r['dayofweek']] . ' ' . $tn_r['datum'];
                        $tn_r['edit']   = is_null($tn_r['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($tn_r['edit_time'])) . '&nbsp;Uhr';
                        if (!empty($tn_r['edit']) and $tn_r['editorname'] != $tn_r['username']) {
                            $tn_r['edit'].= ' von ' . $tn_r['editorname']. '</i>';
                        } elseif (!empty($tn_r['edit'])) {
                            $tn_r['edit'].= '</i>';
                        }
        
                    $tn_r['kate'] = news_find_kat($tn_r['news_kat']);
                        $tn_r['text'] = $tn_r['html']? $tn_r['news_text']: bbcode($tn_r['news_text']);
                    $tn_tpl->set_ar_out($tn_r, 0);
                                    unset($tn_tpl);
                    }
            }
        
                    //Kategorie einschränken
                    if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                            $kats = $katssql = array();  #collect given kats
                            $i = 1;
                            while($kat = escape($menu->get($i), 'string')){
                                    $kats[] = $kat;
                                    $katssql[] = '"' . $kat . '"';
                                    $i++;
                            }
                            $news_kat = 'news_kat IN ('.implode(',', $katssql).') AND';
                            $katmpl = '-'.implode('-', $kats);
                            $page = $menu->getE('p');
                            if ($page < 1) {
                                    $page = 1;
                            }
                            $katmpl = str_replace('-p'.$page, '', $katmpl);
                    } else {
                            $news_kat = $katmpl = '';
                            $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
                    }
        
            $anfang = ($page - 1) * $limit;
        
                    $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht)) AND $news_kat `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND archiv != 1 AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())" , $limit , '?news'.$katmpl , 'news');
            // Normale News
            $tpl = new tpl ('news/news.htm');
        
            $abf = "SELECT
          a.news_title as title,
          a.news_id as id,
          DATE_FORMAT(a.news_time,'%d. %m. %Y - %H:%i Uhr') as datum,
          DATE_FORMAT(a.news_time,'%W') as dayofweek,
          a.news_kat as kate,
          a.news_text as text,
          b.name as username,
          b.id as userid,
          c.name as editorname,
          a.html,
          a.edit_time,
          a.klicks,
          b.id as uid
        FROM prefix_news as a
        LEFT JOIN prefix_user as b ON a.user_id = b.id
        LEFT JOIN prefix_user as c ON a.editor_id = c.id
        WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | a.news_recht) = a.news_recht)) AND $news_kat
                    a.`show` > 0 AND a.`show` <= UNIX_TIMESTAMP() AND news_id != $tn_id AND a.`archiv` != 1 AND
                    (a.endtime IS NULL OR a.endtime > UNIX_TIMESTAMP())
        ORDER BY a.news_time DESC
        LIMIT " . $anfang . "," . $limit;
        
            // echo '<pre>'.$abf.'</pre>';
            $erg = db_query($abf);
                if (db_num_rows($erg) == 0 and !empty($news_kat)) {
                        echo 'Keine News in dieser Kategorie gefunden.<br />
                                <a href="index.php?news">News&uuml;bersichtsseite aufrufen</a>';
                        $design->footer(1);
                }
            while ($row = db_fetch_assoc($erg)) {
                $k0m = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = " . $row['id'] . " AND cat = 'NEWS'");
                $row['kom'] = db_result($k0m, 0);
        
                $row['kate'] = news_find_kat($row['kate']);
                $row['datum'] = $lang[$row['dayofweek']] . ' ' . $row['datum'];
                if (strpos ($row['text'] , '[PREVIEWENDE]') !== false) {
                    $a = explode('[PREVIEWENDE]' , $row['text']);
                    $row['text'] = $a[0];
                    $row['readwholenews'] = '<a href="index.php?news-' . $row['id'] . '" alt="mehr lesen" title="mehr lesen"><img src="include/images/icons/news/more.gif" alt="mehr lesen" border="0"></a>';
                } else {
                    $row['readwholenews'] = '';
                }
                $row['klicks'] = '<img src="include/images/icons/news/counter.gif" alt="' . $row['klicks'] . ' mal gelesen" title="' . $row['klicks'] . ' mal gelesen" border="0">';
                if (!$row['html']) {
                    $row['text'] = bbcode($row['text']);
                }
                $row['edit'] = is_null($row['edit_time']) ? '' : '<br /><i>zuletzt ge&auml;ndert am ' . date('d.m.Y - H:i', strtotime($row['edit_time'])) . '&nbsp;Uhr';
                if (!empty($row['edit']) and $row['editorname'] != $row['username']) {
                    $row['edit'] .= ' von ' . $row['editorname'] . '</i>';
                } elseif (!empty($row['edit'])) {
                    $row['edit'] .= '</i>';
                }
                $tpl->set_ar_out($row, 0);
            }
            $tpl->set_out('SITELINK', $MPL, 1);
            unset($tpl);
        }
    } else {
        $design->header();
        $xajax->printJavascript();
        
        $nid = escape($menu->get(1), 'integer');
        $erg = db_query("SELECT * FROM `prefix_news` WHERE `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND news_id = '" . $nid . "'");
        if (db_num_rows($erg) == 0) {
            $dontShow = true;
            } else {
                    $dontShow = false;
                    $row = db_fetch_object($erg);
                    if ((pow(2, abs($_SESSION['authright'])) | $row->news_recht) != $row->news_recht) {
                            $dontShow = true;
                    }
            }
        
            if ($dontShow) {
                    echo 'News existiert nicht oder Sie haben keine Rechte sie zu sehen.  <a href="javascript:history.back();">zur&uuml;ck</a>';
                    $design->footer(1);
            }
        
        $komsOK = true;
        if ($allgAr['Ngkoms'] == 0) {
            if (loggedin()) {
                $komsOK = true;
            } else {
                $komsOK = false;
            }
        }
        if ($allgAr['Nukoms'] == 0) {
            $komsOK = false;
        }
        
        $kom_info = '';
        // kommentar add
        if ((loggedin() OR chk_antispam ('newskom')) AND $komsOK AND !empty($_POST['name']) AND !empty($_POST['txt'])) {
            $_POST['txt'] = escape($_POST['txt'], 'string');
            $_POST['name'] = escape($_POST['name'], 'string');
            if (checkName($_POST['name']) or loggedin()) {
                if (loggedin()) {
                    $_POST['name'] = $_SESSION['authname'];
                }
                db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (" . $nid . ",'NEWS','" . $_POST['name'] . "','" . $_POST['txt'] . "')");
            } else {
                $kom_info = '<span style="color:red;">Dieser Name ist bereits an einen User vergeben, benutze bitte einen anderen.</span><br />';
            }
        }
        // kommentar add
        // kommentar loeschen
        if ($menu->getA(2) == 'd' AND is_numeric($menu->getE(2)) AND has_right(- 7, 'news')) {
            $kommentar_id = escape($menu->getE(2), 'integer');
            db_query("DELETE FROM prefix_koms WHERE uid = " . $nid . " AND cat = 'NEWS' AND id = " . $kommentar_id);
        }
        // kommentar loeschen
        $kategorie = news_find_kat($row->news_kat);
        
        $textToShow = $row->html ? $row->news_text : bbcode($row->news_text);
        $textToShow = str_replace('[PREVIEWENDE]', '', $textToShow);
        if (!empty($such)) {
            $textToShow = markword($textToShow, $such);
        }
        // klicks zaehlen
        db_query("UPDATE prefix_news SET klicks = klicks + 1 WHERE news_id = " . $nid);
        
        $koms = db_count_query('SELECT COUNT(*) FROM `prefix_koms` WHERE `uid` = ' . $nid . ' AND `cat` = "NEWS"');
        $tpl = new tpl ('news/news.htm');
        $ar = array (
            'TEXT' => $textToShow,
            'KATE' => $kategorie,
            'NID' => $nid,
            'uname' => $_SESSION['authname'],
            'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
            'NAME' => $row->news_title,
            'info' => $kom_info,
            'koms' => $koms,
    		'ID' => $row->user_id,
    		'datum' => $lang[date('l',strtotime($row->news_time))] . date('  d. m. Y - H:i \U\h\r', strtotime($row->news_time))
            );
    
        $tpl->set_ar_out($ar, 2);
        
        if ($komsOK) {
            $tpl->set_ar_out (array ('NAME' => $row->news_title , 'NID' => $nid, 'style' => loggedin() ? 'style="display:none;"' : ''), 3);
        }
        $erg1 = db_query("SELECT text, name, id FROM `prefix_koms` WHERE uid = " . $nid . " AND cat = 'NEWS' ORDER BY id DESC");
        $ergAnz1 = db_num_rows($erg1);
        if ($ergAnz1 == 0) {
            echo '<b>' . $lang['nocomments'] . '</b>';
        } else {
            $zahl = $ergAnz1;
            while ($row1 = db_fetch_assoc($erg1)) {
                $row1['text'] = bbcode(trim($row1['text']));
                if (has_right(- 7, 'news')) {
                    $row1['text'] .= '<a href="javascript:delkom(' . $nid . ',' . $row1['id'] . ')"><img src="include/images/icons/del.png" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
        
    $abf2 = 'SELECT id, name, avatar FROM prefix_user WHERE name = "'.$row1['name'].'" ';
    $erg2 = db_query($abf2);
    $row2 = db_fetch_object($erg2);
        
        
    if ( file_exists($row2->avatar) ) {
      $ava = '<img src="'.$row2->avatar.'" border="0" width="55" height="55">';
    }elseif ($row2->id != 0){
    $ava = '<img src="ich bin ein user ohne avatar" border="0" width="55" height="55">';
    }elseif ($row2->id == 0){
    $ava = '<img src="include/images/avatars/wurstegal.jpg border="0" width="55" height="55">';
    }
        
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'AVATA' => $ava, 'ZAHL' => $zahl) , 4);
                $zahl--;
            }
        }
        
        $tpl->out(5);
    }
        
    $design->footer();
        
    ?>


    MFG und noch mal Danke an Alle Bier zwinker


    Zuletzt modifiziert von FightClub am 11.02.2014 - 15:29:20
    0 Mitglieder finden den Beitrag gut.
  19. #19
    User Pic
    Saarlonz Hall Of Fame
    Registriert seit
    07.08.2008
    Beiträge
    3.003
    Beitragswertungen
    235 Beitragspunkte
    erledigt
    0 Mitglieder finden den Beitrag gut.
Geschlossen

Zurück zu Module und Modifikationen

Optionen: Bei einer Antwort zu diesem Thema eine eMail erhalten