ilch Forum » Ilch Clan 1.1 » Module und Modifikationen » News mit Avatar

Geschlossen
  1. #1
    User Pic
    trejay Mitglied
    Registriert seit
    09.04.2009
    Beiträge
    372
    Beitragswertungen
    0 Beitragspunkte
    Hi Leutz.. ich mal wieder zwinker
    hab zwar schon einige Themen der selben Art gefunden, komme aber nicht weiter.

    ich habe extended news installiert, und möchte in bzw über den News den avatar des Verfassers anzeigen lassen, und wenn möglich auch bei den geschriebenen Kommentaren... denke dass irgend ne htm und ne php damit zu tun haben... aber welche? zwinker templates/news.htm?

    bzw wüsst ich auch gern was ich wo am besten einfügen muss... sry, aber bin eben kein progger^^

    quasi von:
    socclan.de/pics/screen2.jpg

    zu:
    socclan.de/pics/screen3.jpg

    betroffene Homepage: socclan.de


    Zuletzt modifiziert von jankrug am 28.08.2009 - 22:16:53
    XFire: Trejay
    Skype: Trejay2
    HP: www.socclan.1x.de
    0 Mitglieder finden den Beitrag gut.
  2. #2
    User Pic
    trejay Mitglied
    Registriert seit
    09.04.2009
    Beiträge
    372
    Beitragswertungen
    0 Beitragspunkte
    niemand ne Idee? zumindest welche php und welche htm dafür zuständig sind?... bz in welchem Pfad ich sie finde^^
    XFire: Trejay
    Skype: Trejay2
    HP: www.socclan.1x.de
    0 Mitglieder finden den Beitrag gut.
  3. #3
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    In der news.php unter prefix_news die ID des Erstellers user_id erfragen
    dann das Avatar so in der Art ermitteln

    $dbavatar = @db_result(db_query("SELECT avatar FROM prefix_user WHERE id = '".user_id."'"),0);
    if (!empty($dbavatar)) { $avatar = '<img src="'.$avatar.'" border="0">'; } else { $avatar = '<img src="noavatar.jpg" border="0">'; }


    und ausgeben, sowie die Ausgabe des Avatares in der news.htm einbinden!
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
  4. #4
    User Pic
    trejay Mitglied
    Registriert seit
    09.04.2009
    Beiträge
    372
    Beitragswertungen
    0 Beitragspunkte
    hmm, habe dies vollbracht^^... aber nix passiert....include/templates/news/news.htm?? und include/contents/news/news.php?
    XFire: Trejay
    Skype: Trejay2
    HP: www.socclan.1x.de
    0 Mitglieder finden den Beitrag gut.
  5. #5
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Ja diese Dateien, es kommt jetzt nur auf deine Art der Einbindung an!

    Wenn Du nur das von mir gepostete eingebunden hast, wird es nicht funktionieren. Dies war nur ein Anhalt und benötigt die genaue Anpassung an deine Abfragen!
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
  6. #6
    User Pic
    marsetex Mitglied
    Registriert seit
    22.07.2009
    Beiträge
    25
    Beitragswertungen
    2 Beitragspunkte
    Kannst du mir sagen wo ungefähr die Zeilen sind, denn ich find sie nicht traurig


    Zuletzt modifiziert von marsetex am 29.08.2009 - 14:58:25
    0 Mitglieder finden den Beitrag gut.
  7. #7
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Leider nicht, da ich ein modifiziertes Newssystem nutze, welches ich zusätzlich noch umgeschrieben habe!

    Wahrscheinlich ist ein Posting der Dateien sinnvoll!
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
  8. #8
    User Pic
    OloX Hall Of Fame
    Registriert seit
    25.02.2006
    Beiträge
    990
    Beitragswertungen
    23 Beitragspunkte
    Hey marsetex / trejay,
    SuFu zwinker
    externer Link

    MfG OloX


    Zuletzt modifiziert von OloX am 29.08.2009 - 15:05:26
    PHP, JavaScript, CSS
    0 Mitglieder finden den Beitrag gut.
  9. #9
    User Pic
    trejay Mitglied
    Registriert seit
    09.04.2009
    Beiträge
    372
    Beitragswertungen
    0 Beitragspunkte
    Danke Olox, aber sind modifizierte news.... ich poste mal die htm:
    <a href="javascript:history.back()"><u><b>ZURüCK</b></u></a>
    
    
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="newsbg"><tr><td>
    <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
        <tr>
          <td class="smalfont">{datum} - <strong><a href="index.php?news-{id}">{title}</a></strong></td>
          </tr>
    
    
        <tr>
          <td><hr style="height: 0px; border: dotted #000000 0px; border-top-width: 1px; " /></td>
          </tr>
    </table>
    
    
    
      <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" class="cbg1">
        <tr>
          <td align="center">{kate}</td>
        </tr>
    
      </table>
    
    
      <table width="100%"  border="0" cellspacing="0" cellpadding="2">
        <tr>
    	  <td>{text}</td>
    	</tr>
        <tr>
    	  <td><hr style="height: 0px; border: dotted #000000 0px; border-top-width: 1px; " /></td>
    	</tr>
     </table>
     <table width="100%"  border="0" cellspacing="0" cellpadding="1">
        <tr>
    
          <td align="left" width="60%" class="smalfont">Geschrieben von <strong>{username}</strong>{edit}</td>
          <td align="right" width="40%">
            <a href="index.php?user-details-{uid}" alt="Benutzerinfo: {username}" title="Benutzerinfo: {username}"><img src="include/images/icons/news/informant.gif" alt="Benutzerinfo: {username}" border="0">
            <a href="index.php?news-{id}" alt="Kommentare ({kom})" title="Kommentare ({kom})"><img src="include/images/icons/news/comments.gif" alt="Kommentare ({kom})" border="0"></a>
            <a href="index.php?news-send-{id}" alt="Diese News einen Freund senden" title="Diese News einen Freund senden"><img src="include/images/icons/news/send.gif" 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/news/print.gif" alt="Druckoptimierte Version" border="0"></a>
            {klicks}
            {readwholenews}
          </td>
        </tr>
      </table>
    </td></tr></table>
    
    <br />
    <br />
    {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 -->
    <table width="100%" cellpadding="5" cellspacing="1" border="0">
      <tr class="Chead">
        <th height="25"><b>{NAME}</b></th>
      </tr>
      <tr>
        <td height="25">{_lang_message}</td>
      </tr>
    
        <tr>
          <td align="center">{KATE}</td>
        </tr>
    
    
      <tr>
        <td >
          <div style="float:left; padding-left:10px; ">{TEXT}</div><br style="clear:both; " />
          <p></p>
          <a href="javascript:history.back(1)"><b>&laquo;</b>{_lang_back}</a> </td>
      </tr>
    
      <tr>
        <td height="25">{_lang_commentsfor} {NAME}</td>
      </tr>
      <tr>
        <td>
    
    	    {EXPLODE}
    	    <form action="index.php?news-{NID}" method="POST">
            <fieldset>
              <legend>{_lang_writecomment}</legend>
              <input type="text" name="name" value="{uname}" /> &nbsp; {ANTISPAM} &nbsp; <input type="submit" value="{_lang_enter}"><br />
              <textarea style="width: 98%" cols="50" rows="2" name="txt"></textarea><br />
            </fieldset>
          </form>
          <br />
          {EXPLODE}
    
          <span class="Cmite"># <b>{ZAHL}</b> von {NAME}</span>
          <br />{TEXT}<br /><br />
    
          {EXPLODE}
          <br />
          <a href="javascript:history.back(1)"><b>&laquo;</b> {_lang_back}</a>
    
        </td>
      </tr>
    </table>

    und eben die 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()) {
            $name = utf8_decode($name);
            $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('index.php?news-ajax');
    $xajax->registerFunction('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);
    $dbavatar = @db_result(db_query("SELECT avatar FROM prefix_user WHERE id = '".user_id."'"),0);
    if (!empty($dbavatar)) { $avatar = '<img src="'.$avatar.'" border="0">'; } else { $avatar = '<img src="noavatar.jpg" border="0">'; }        
    $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 news_title, news_text, news_recht, news_groups, html FROM prefix_news WHERE news_id = $tn_id AND `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_object($tn_sql);
    
    			$dontShow = false;
    			if ((pow(2, abs($_SESSION['authright'])) | $tn_r->news_recht) != $tn_r->news_recht) {
    				$dontShow = true;
    			}
    			if ($dontShow) {
    				foreach($_SESSION['authgrp'] as $id => $bool) {
    					if ($bool and (pow(2, abs($id)) | $tn_r->news_groups) == $tn_r->news_groups) {
    						$dontShow = false;
    						break;
    					}
    				}
    			}
            	if (!$dontShow) {
    				$tn_tpl = new tpl ('news/top');
    				$tn_tpl->set('title', $tn_r->news_title);
    				$tn_tpl->set('koms', $tn_koms == '1' ? '<br /><a href="index.php?news-' . $tn_id . '">' . db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'") . ' ' . $lang['comments'] . ' </a>' : '');
    				$tn_tpl->set_out('txt', $tn_r->html ? $tn_r->news_text : bbcode($tn_r->news_text), 0);
    				unset($tn_tpl);
            	}
            }
    
    		//Kategorie einschränken
    		if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
    			$news_kat = 'news_kat = "'.$menu->get(1).'" AND';
    			$katmpl = '-'.$menu->get(1);
    			$page = ($menu->getA(2) == 'p' ? $menu->getE(2) : 1);
    		} else {
    			$news_kat = $katmpl = '';
    			$page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
    		}
    
            $anfang = ($page - 1) * $limit;
    		//Gruppenrechte
    		$groups = getGroupRights();
    
    		$MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht) OR
    			(news_groups != 0 AND ((news_groups ^ $groups) != (news_groups | $groups)))) 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) OR
    	      (a.news_groups != 0 AND ((a.news_groups ^ $groups) != (a.news_groups | $groups)))) 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) {
    			foreach($_SESSION['authgrp'] as $id => $bool) {
    				if ($bool and (pow(2, abs($id)) | $row->news_groups) == $row->news_groups) {
    					$dontShow = false;
    					break;
    				}
    			}
    		}
    	}
    
    	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.gif" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'ZAHL' => $zahl) , 4);
                $zahl--;
            }
        }
        $tpl->out(5);
    }
    
    $design->footer();
    
    ?>


    sry, bin eben leider n noob in der hinsicht^^
    XFire: Trejay
    Skype: Trejay2
    HP: www.socclan.1x.de
    0 Mitglieder finden den Beitrag gut.
  10. #10
    User Pic
    OloX Hall Of Fame
    Registriert seit
    25.02.2006
    Beiträge
    990
    Beitragswertungen
    23 Beitragspunkte
    Hey trejay,
    Teste mal ob das funzt zwinker

    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()) {
            $name = utf8_decode($name);
            $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('index.php?news-ajax');
    $xajax->registerFunction('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);
    $dbavatar = @db_result(db_query("SELECT avatar FROM prefix_user WHERE id = '".user_id."'"),0);
    if (!empty($dbavatar)) { $avatar = '<img src="'.$avatar.'" border="0">'; } else { $avatar = '<img src="noavatar.jpg" border="0">'; }        
    $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 news_title, news_text, news_recht, news_groups, html FROM prefix_news WHERE news_id = $tn_id AND `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_object($tn_sql);
     
                $dontShow = false;
                if ((pow(2, abs($_SESSION['authright'])) | $tn_r->news_recht) != $tn_r->news_recht) {
                    $dontShow = true;
                }
                if ($dontShow) {
                    foreach($_SESSION['authgrp'] as $id => $bool) {
                        if ($bool and (pow(2, abs($id)) | $tn_r->news_groups) == $tn_r->news_groups) {
                            $dontShow = false;
                            break;
                        }
                    }
                }
                if (!$dontShow) {
                    $tn_tpl = new tpl ('news/top');
                    $tn_tpl->set('title', $tn_r->news_title);
                    $tn_tpl->set('koms', $tn_koms == '1' ? '<br /><a href="index.php?news-' . $tn_id . '">' . db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'") . ' ' . $lang['comments'] . ' </a>' : '');
                    $tn_tpl->set_out('txt', $tn_r->html ? $tn_r->news_text : bbcode($tn_r->news_text), 0);
                    unset($tn_tpl);
                }
            }
     
            //Kategorie einschränken
            if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                $news_kat = 'news_kat = "'.$menu->get(1).'" AND';
                $katmpl = '-'.$menu->get(1);
                $page = ($menu->getA(2) == 'p' ? $menu->getE(2) : 1);
            } else {
                $news_kat = $katmpl = '';
                $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
            }
     
            $anfang = ($page - 1) * $limit;
            //Gruppenrechte
            $groups = getGroupRights();
     
            $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht) OR
                (news_groups != 0 AND ((news_groups ^ $groups) != (news_groups | $groups)))) 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.avatar as avatar,	 
         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) OR
              (a.news_groups != 0 AND ((a.news_groups ^ $groups) != (a.news_groups | $groups)))) 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['useravatar'] = !empty($row['avatar']) && file_exists($row['avatar']) ? '<a href="index.php?user-details-'.$row['uid'].'"><img src="'.$row['avatar'].'" border="0" alt="'.$row['username'].'" title="'.$row['username'].'" /></a>' : 'n/a';
                $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 a.news_title,
         a.news_id,
         DATE_FORMAT(a.news_time,'%d. %m. %Y') as datum,
         DATE_FORMAT(a.news_time,'%W') as dayofweek,
         a.news_kat,
         a.news_text,
         a.news_recht,
    	 a.news_groups,
    	 a.html,
    	 a.show,
         b.name as username,
         b.avatar as avatar,
         b.id as userid
         FROM prefix_news as a
         LEFT JOIN prefix_user as b ON a.user_id = b.id     
         WHERE `a`.`show` > 0 AND `a`.`show` <= UNIX_TIMESTAMP() AND `a`.`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) {
                foreach($_SESSION['authgrp'] as $id => $bool) {
                    if ($bool and (pow(2, abs($id)) | $row->news_groups) == $row->news_groups) {
                        $dontShow = false;
                        break;
                    }
                }
            }
        }
     
        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);
        } 
    	$avatar = !empty($row->avatar) && file_exists($row->avatar) ? '<a href="index.php?user-details-'.$row->userid.'"><img src="'.$row->avatar.'" border="0" alt="'.$row->username.'" title="'.$row->username.'"></a>' : 'n/a';	
    	
    	// 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,
            'AVATAR' => $avatar,
    		'USERID' => $row->userid,
    		'USERNAME' => $row->username,					
            '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 `a`.`text`, `a`.`name`, `a`.`id`, `b`.`id` AS `userid`, `b`.`name` AS `username`, `b`.`avatar`
    	                  FROM `prefix_koms` AS `a` 
                          LEFT JOIN `prefix_user` AS `b` ON `a`.`name` = `b`.`name`    
    	                  WHERE `a`.`uid` = " . $nid . " AND `a`.`cat` = 'NEWS' ORDER BY `a`.`id` DESC");
    		$ergAnz1 = db_num_rows($erg1);
    		if ( $ergAnz1 == 0 ) {
    		  echo '<b>'.$lang['nocomments'].'</b>';
    		} else {
    		  $zahl = $ergAnz1;
    		  while ($row1 = db_fetch_assoc($erg1)) {
            
    		$username = empty($row1['userid']) ? '<em>Gast:</em> '.$row1['name'] : '<a href="index.php?user-details-'.$row1['userid'].'">'.$row1['username'].'</a>';
            $komavatar = (empty($row1['userid']) ? '' : (!empty($row1['avatar']) && file_exists($row1['avatar']) ? '<a href="index.php?user-details-'.$row1['userid'].'"><img src="'.$row1['avatar'].'" border="0" alt="'.$row1['username'].'" title="'.$row1['username'].'"></a>' : '<img src="include/images/avatars/wurstegal.jpg" alt="Kein Avatar" />'));		
    		
    		$row1['text'] = bbcode(trim($row1['text']));
            if (has_right(-7, 'news')) {
              $row1['text'] .= '<a href="?news-'.$nid.'-d'.$row1['id'].'"><img src="include/images/icons/del.gif" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
            }
            $tpl->set_ar_out( array('NAME' => $username,
    		                        'AVATAR' => $komavatar, 
    		                        'TEXT' => $row1['text'], 
    								'ZAHL' => $zahl ) , 4 );
            $zahl--;
            }
        }
        $tpl->out(5);
    }
     
    $design->footer();
     
    ?>


    include/templates/news/news.htm
    <a href="javascript:history.back()"><u><b>ZURüCK</b></u></a>
     
     
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="newsbg"><tr><td>
    <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
        <tr>
          <td class="smalfont">{datum} - <strong><a href="index.php?news-{id}">{title}</a></strong></td>
          </tr>
     
     
        <tr>
          <td><hr style="height: 0px; border: dotted #000000 0px; border-top-width: 1px; " /></td>
          </tr>
    </table>
     
     
     
      <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" class="cbg1">
        <tr>
          <td align="center">{kate}</td>
        </tr>
     
      </table>
     
     
      <table width="100%"  border="0" cellspacing="0" cellpadding="2">
        <tr>
          <td>{text}</td>
        </tr>
        <tr>
          <td><hr style="height: 0px; border: dotted #000000 0px; border-top-width: 1px; " /></td>
        </tr>
     </table>
     <table width="100%"  border="0" cellspacing="0" cellpadding="1">
        <tr>
     
          <td align="left" width="60%" class="smalfont">Geschrieben von <strong>{username}</strong>{edit}</td>
          <td align="right" width="40%">
            <a href="index.php?user-details-{uid}" alt="Benutzerinfo: {username}" title="Benutzerinfo: {username}"><img src="include/images/icons/news/informant.gif" alt="Benutzerinfo: {username}" border="0">
            <a href="index.php?news-{id}" alt="Kommentare ({kom})" title="Kommentare ({kom})"><img src="include/images/icons/news/comments.gif" alt="Kommentare ({kom})" border="0"></a>
            <a href="index.php?news-send-{id}" alt="Diese News einen Freund senden" title="Diese News einen Freund senden"><img src="include/images/icons/news/send.gif" 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/news/print.gif" alt="Druckoptimierte Version" border="0"></a>
            {klicks}
            {readwholenews}
          </td>
        </tr>
      </table>
    </td></tr></table>
     
    <br />
    <br />
    {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 -->
    <table width="100%" cellpadding="5" cellspacing="1" border="0">
      <tr class="Chead">
        <th height="25"><b>{NAME}</b></th>
      </tr>
      <tr>
        <td height="25">{_lang_message}</td>
      </tr>
     
        <tr>
          <td align="center">{KATE}<br /><br />von: <strong><a href="index.php?user-details-{USERID}">{USERNAME}</a></strong><br />{AVATAR}</td>
        </tr>
     
     
      <tr>
        <td >
          <div style="float:left; padding-left:10px; ">{TEXT}</div><br style="clear:both; " />
          <p></p>
          <a href="javascript:history.back(1)"><b>&laquo;</b>{_lang_back}</a> </td>
      </tr>
     
      <tr>
        <td height="25">{_lang_commentsfor} {NAME}</td>
      </tr>
      <tr>
        <td>
     
            {EXPLODE}
            <form action="index.php?news-{NID}" method="POST">
            <fieldset>
              <legend>{_lang_writecomment}</legend>
              <input type="text" name="name" value="{uname}" /> &nbsp; {ANTISPAM} &nbsp; <input type="submit" value="{_lang_enter}"><br />
              <textarea style="width: 98%" cols="50" rows="2" name="txt"></textarea><br />
            </fieldset>
          </form>
          <br />
          {EXPLODE}
          <div style="float:left; margin:4px; width:120px; padding:2px 4px 2px 2px; border-right:4px solid #990000;"><span class="Cmite"># <b>{ZAHL}</b> von {NAME}</span><br/> <div style="height:7px;"></div><span style="text-align:center; display:block;">{AVATAR}</span></div>
          <div style="float:left; margin:4px; width:350px; padding:3px;">{TEXT}</div>
          <div style="clear:both;"></div>
          {EXPLODE}
          <br />
          <a href="javascript:history.back(1)"><b>&laquo;</b> {_lang_back}</a>
     
        </td>
      </tr>
    </table>


    MfG OloX


    Zuletzt modifiziert von OloX am 30.08.2009 - 18:33:09
    PHP, JavaScript, CSS
    1 Mitglieder finden den Beitrag gut.
  11. #11
    User Pic
    trejay Mitglied
    Registriert seit
    09.04.2009
    Beiträge
    372
    Beitragswertungen
    0 Beitragspunkte
    nee, wird nur:
    von: {USERNAME}
    {AVATAR}

    angezeigt... und leider bei den kommentaren auch nix...
    XFire: Trejay
    Skype: Trejay2
    HP: www.socclan.1x.de
    0 Mitglieder finden den Beitrag gut.
  12. #12
    User Pic
    OloX Hall Of Fame
    Registriert seit
    25.02.2006
    Beiträge
    990
    Beitragswertungen
    23 Beitragspunkte
    Du musst den news.php Code auch ersetzen zwinker
    PHP, JavaScript, CSS
    0 Mitglieder finden den Beitrag gut.
  13. #13
    User Pic
    trejay Mitglied
    Registriert seit
    09.04.2009
    Beiträge
    372
    Beitragswertungen
    0 Beitragspunkte
    lol.... habe ich ja, aber anscheinend grift er auf ne andere news.php zu^^... ich guck nochmal nach
    XFire: Trejay
    Skype: Trejay2
    HP: www.socclan.1x.de
    0 Mitglieder finden den Beitrag gut.
  14. #14
    User Pic
    OloX Hall Of Fame
    Registriert seit
    25.02.2006
    Beiträge
    990
    Beitragswertungen
    23 Beitragspunkte
    Ja, die include/contents/news/news.php müsste das bei dir sein zwinker
    MfG OloX
    PHP, JavaScript, CSS
    0 Mitglieder finden den Beitrag gut.
  15. #15
    User Pic
    trejay Mitglied
    Registriert seit
    09.04.2009
    Beiträge
    372
    Beitragswertungen
    0 Beitragspunkte
    jo... zum teil funzt es.... wenn ich oben rechts in der lastnews box news anklicke funzt es... aber wenn ich bei der newsübersicht klicke siehts naja... blöd aus^^ socclan.de/index.php?news
    XFire: Trejay
    Skype: Trejay2
    HP: www.socclan.1x.de
    0 Mitglieder finden den Beitrag gut.
  16. #16
    User Pic
    OloX Hall Of Fame
    Registriert seit
    25.02.2006
    Beiträge
    990
    Beitragswertungen
    23 Beitragspunkte
    Habe oben mal den Code überarbeitet... Teste mal zwinker
    MfG OloX
    PHP, JavaScript, CSS
    0 Mitglieder finden den Beitrag gut.
  17. #17
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    EDIT: Sehe gerade das ihr daran arbeitet! Evtl. meins ignorieren!

    Habe es jetzt nicht getestet, sollte aber funktionieren! Anpassungen kannst du ja selbst noch erledigen!


    news.php (siehe Zeile 221 - 223)
    <?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()) {
            $name = utf8_decode($name);
            $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('index.php?news-ajax');
    $xajax->registerFunction('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 news_title, news_text, news_recht, news_groups, html FROM prefix_news WHERE news_id = $tn_id AND `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_object($tn_sql);
     
                $dontShow = false;
                if ((pow(2, abs($_SESSION['authright'])) | $tn_r->news_recht) != $tn_r->news_recht) {
                    $dontShow = true;
                }
                if ($dontShow) {
                    foreach($_SESSION['authgrp'] as $id => $bool) {
                        if ($bool and (pow(2, abs($id)) | $tn_r->news_groups) == $tn_r->news_groups) {
                            $dontShow = false;
                            break;
                        }
                    }
                }
                if (!$dontShow) {
                    $tn_tpl = new tpl ('news/top');
                    $tn_tpl->set('title', $tn_r->news_title);
                    $tn_tpl->set('koms', $tn_koms == '1' ? '<br /><a href="index.php?news-' . $tn_id . '">' . db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'") . ' ' . $lang['comments'] . ' </a>' : '');
                    $tn_tpl->set_out('txt', $tn_r->html ? $tn_r->news_text : bbcode($tn_r->news_text), 0);
                    unset($tn_tpl);
                }
            }
     
            //Kategorie einschränken
            if ($menu->get(1) != '' and ($menu->getA(1) != 'p' or $menu->getE(1) == 0)) {
                $news_kat = 'news_kat = "'.$menu->get(1).'" AND';
                $katmpl = '-'.$menu->get(1);
                $page = ($menu->getA(2) == 'p' ? $menu->getE(2) : 1);
            } else {
                $news_kat = $katmpl = '';
                $page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
            }
     
            $anfang = ($page - 1) * $limit;
            //Gruppenrechte
            $groups = getGroupRights();
     
            $MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht) OR
                (news_groups != 0 AND ((news_groups ^ $groups) != (news_groups | $groups)))) 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) OR
              (a.news_groups != 0 AND ((a.news_groups ^ $groups) != (a.news_groups | $groups)))) 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>';
                }
                // AVATAR
                $dbavatar = @db_result(db_query("SELECT avatar FROM prefix_user WHERE name = '".$row['username'].'"),0);
    			if (!empty($dbavatar)) { $row['avatar'] = '<br><img src="'.$avatar.'" border="0"><br>'; } else { $row['avatar'] = '<br><img src="noavatar.jpg" border="0"><br>'; }
    			
                $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) {
                foreach($_SESSION['authgrp'] as $id => $bool) {
                    if ($bool and (pow(2, abs($id)) | $row->news_groups) == $row->news_groups) {
                        $dontShow = false;
                        break;
                    }
                }
            }
        }
     
        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.gif" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'ZAHL' => $zahl) , 4);
                $zahl--;
            }
        }
        $tpl->out(5);
    }
     
    $design->footer();
     
    ?>


    news.html (siehe Zeile 23)
    <a href="javascript:history.back()"><u><b>ZURüCK</b></u></a>
     
     
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="newsbg"><tr><td>
    <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
        <tr>
          <td class="smalfont">{datum} - <strong><a href="index.php?news-{id}">{title}</a></strong></td>
          </tr>
     
     
        <tr>
          <td><hr style="height: 0px; border: dotted #000000 0px; border-top-width: 1px; " /></td>
          </tr>
    </table>
     
     
     
      <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" class="cbg1">
        <tr>
          <td align="center">{kate}</td>
        </tr>
         <tr>
          <td align="center" width="60%" class="smalfont">von <strong>{username}</strong>{avatar}{edit}</td>
        </tr>
      </table>
     
     
      <table width="100%"  border="0" cellspacing="0" cellpadding="2">
        <tr>
          <td>{text}</td>
        </tr>
        <tr>
          <td><hr style="height: 0px; border: dotted #000000 0px; border-top-width: 1px; " /></td>
        </tr>
     </table>
     <table width="100%"  border="0" cellspacing="0" cellpadding="1">
        <tr>
          <td align="right" width="40%">
            <a href="index.php?user-details-{uid}" alt="Benutzerinfo: {username}" title="Benutzerinfo: {username}"><img src="include/images/icons/news/informant.gif" alt="Benutzerinfo: {username}" border="0">
            <a href="index.php?news-{id}" alt="Kommentare ({kom})" title="Kommentare ({kom})"><img src="include/images/icons/news/comments.gif" alt="Kommentare ({kom})" border="0"></a>
            <a href="index.php?news-send-{id}" alt="Diese News einen Freund senden" title="Diese News einen Freund senden"><img src="include/images/icons/news/send.gif" 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/news/print.gif" alt="Druckoptimierte Version" border="0"></a>
            {klicks}
            {readwholenews}
          </td>
        </tr>
      </table>
    </td></tr></table>
     
    <br />
    <br />
    {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 -->
    <table width="100%" cellpadding="5" cellspacing="1" border="0">
      <tr class="Chead">
        <th height="25"><b>{NAME}</b></th>
      </tr>
      <tr>
        <td height="25">{_lang_message}</td>
      </tr>
     
        <tr>
          <td align="center">{KATE}</td>
        </tr>
     
     
      <tr>
        <td >
          <div style="float:left; padding-left:10px; ">{TEXT}</div><br style="clear:both; " />
          <p></p>
          <a href="javascript:history.back(1)"><b>&laquo;</b>{_lang_back}</a> </td>
      </tr>
     
      <tr>
        <td height="25">{_lang_commentsfor} {NAME}</td>
      </tr>
      <tr>
        <td>
     
            {EXPLODE}
            <form action="index.php?news-{NID}" method="POST">
            <fieldset>
              <legend>{_lang_writecomment}</legend>
              <input type="text" name="name" value="{uname}" /> &nbsp; {ANTISPAM} &nbsp; <input type="submit" value="{_lang_enter}"><br />
              <textarea style="width: 98%" cols="50" rows="2" name="txt"></textarea><br />
            </fieldset>
          </form>
          <br />
          {EXPLODE}
     
          <span class="Cmite"># <b>{ZAHL}</b> von {NAME}</span>
          <br />{TEXT}<br /><br />
     
          {EXPLODE}
          <br />
          <a href="javascript:history.back(1)"><b>&laquo;</b> {_lang_back}</a>
     
        </td>
      </tr>
    </table>



    Zuletzt modifiziert von Lord|Schirmer am 30.08.2009 - 15:12:23
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
  18. #18
    User Pic
    trejay Mitglied
    Registriert seit
    09.04.2009
    Beiträge
    372
    Beitragswertungen
    0 Beitragspunkte
    Dank dir Olox, jetzt funzt es lächeln Auch dir Lord riesen Dank für deine Mühe.

    gehts denn das bei den Kommentaren auch n kleiner avatar zu sehen ist?
    XFire: Trejay
    Skype: Trejay2
    HP: www.socclan.1x.de
    0 Mitglieder finden den Beitrag gut.
  19. #19
    User Pic
    OloX Hall Of Fame
    Registriert seit
    25.02.2006
    Beiträge
    990
    Beitragswertungen
    23 Beitragspunkte
    Ja, Kommt gleich zwinker
    MFG OloX
    PHP, JavaScript, CSS
    0 Mitglieder finden den Beitrag gut.
  20. #20
    User Pic
    trejay Mitglied
    Registriert seit
    09.04.2009
    Beiträge
    372
    Beitragswertungen
    0 Beitragspunkte
    fettes thx schonmal im vorraus an dich /euch.... vlt kann ich mich ja irgendwie erkenntlich zeigen^^
    XFire: Trejay
    Skype: Trejay2
    HP: www.socclan.1x.de
    0 Mitglieder finden den Beitrag gut.
  21. #21
    User Pic
    OloX Hall Of Fame
    Registriert seit
    25.02.2006
    Beiträge
    990
    Beitragswertungen
    23 Beitragspunkte
    Bitte Bitte zwinker Oben Code Update zwinker
    Viel Spaß damit...
    MfG OloX


    Zuletzt modifiziert von OloX am 30.08.2009 - 16:19:44
    PHP, JavaScript, CSS
    0 Mitglieder finden den Beitrag gut.
  22. #22
    User Pic
    trejay Mitglied
    Registriert seit
    09.04.2009
    Beiträge
    372
    Beitragswertungen
    0 Beitragspunkte
    Yeehaaaa... Gracias lächeln
    XFire: Trejay
    Skype: Trejay2
    HP: www.socclan.1x.de
    0 Mitglieder finden den Beitrag gut.
  23. #23
    User Pic
    marsetex Mitglied
    Registriert seit
    22.07.2009
    Beiträge
    25
    Beitragswertungen
    2 Beitragspunkte
    Was müsste im news.php-Code geändert werden das der Avatar von den Usern bei einem Comment angezeigt werden? Leider zeigt es mir bei den Kommentaren nur den Avatar des Verfassers an.

    Wäre nett wenn mir jemand helfen könnte.

    PS: OloX hast du meine PN nicht gekriegt?
    0 Mitglieder finden den Beitrag gut.
  24. #24
    User Pic
    OloX Hall Of Fame
    Registriert seit
    25.02.2006
    Beiträge
    990
    Beitragswertungen
    23 Beitragspunkte
    Hey marsetex,
    sorry habe die Übersehen ...Sorry grumml Poste dir hier Morgen den Code zwinker
    MfG OloX
    PHP, JavaScript, CSS
    0 Mitglieder finden den Beitrag gut.
  25. #25
    User Pic
    marsetex Mitglied
    Registriert seit
    22.07.2009
    Beiträge
    25
    Beitragswertungen
    2 Beitragspunkte
    Ok. Danke OloX zwinker
    0 Mitglieder finden den Beitrag gut.
  26. #26
    User Pic
    marsetex Mitglied
    Registriert seit
    22.07.2009
    Beiträge
    25
    Beitragswertungen
    2 Beitragspunkte
    Ich will ja nicht nerven, aber ich wollte jetzt fragen ob mir jemand helfen könnte. In dem folgenden Code wird der Autor-Avatar bei den Kommentaren angezeigt ... könnte mir jemand den Code editieren?

    <?php
    #   Copyright by: Manuel
    #   Support: www.ilch.de
     
     
    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 );
    }
     
     
     
    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';
     
        $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      
       FROM prefix_news as a
       LEFT JOIN prefix_user as b ON a.user_id = b.id
       WHERE a.news_recht = 0
       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')
          {
              $row['datum'] = str_replace(' ', 'T', $row['datum']) . 'Z';
          }
     
          $a = explode('[PREVIEWENDE]', $row['text']);
          $tpl->set_ar_out(array('TITLE' => $row['title'],
                                 'TXT' => 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 );
        $MPL = db_make_sites ($page , "WHERE news_recht >= ".$_SESSION['authright'] , $limit , '?news' , 'news' );
        $anfang = ($page - 1) * $limit;
     
        $tpl = new tpl ( 'news.htm' );
     
        $abf = "SELECT
         a.news_title as title,
         a.news_id as id,
         DATE_FORMAT(a.news_time,'%d. %m. %Y') 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.avatar as avatar,
          b.id as userid      
       FROM prefix_news as a
       LEFT JOIN prefix_user as b ON a.user_id = b.id
       WHERE ".$_SESSION['authright']." <= a.news_recht
          OR a.news_recht = 0
       ORDER BY news_time DESC
       LIMIT ".$anfang.",".$limit;
        #echo '<pre>'.$abf.'</pre>';
     
        $erg = db_query($abf);
        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']);
          if ( !empty($row['avatar']) ) {
          $row['avatar'] = '<a href="index.php?user-details-'.$row['userid'].'"><img src="'.$row['avatar'].'" border="0" alt="'.$row['username'].'" title="'.$row['username'].'"></a>';
          } else {
          $row['avatar'] = 'n/a';
          }   
          $row['datum'] = $lang[$row['dayofweek']].' '.$row['datum'];
          if ( strpos ( $row['text'] , '[PREVIEWENDE]' ) !== FALSE ) {
            $a = explode('[PREVIEWENDE]' , $row['text']);
            $row['text'] = $a[0];
            $row['readwholenews'] = '&raquo; <a href="index.php?news-'.$row['id'].'">'.$lang['readwholenews'].'</a>  &laquo;';
          } else {
            $row['readwholenews'] = '';
          }
          $row['text'] = bbcode($row['text']);
          $tpl->set_ar_out($row,0);
        }
        $tpl->set_out('SITELINK', $MPL,1);
        unset($tpl);
      }
     
     
     
    } else {
     
     $design->header();
     $nid = escape($menu->get(1), 'integer');
     $row = db_fetch_object(db_query("SELECT
         a.news_title,
         a.news_id,
         DATE_FORMAT(a.news_time,'%d. %m. %Y') as datum,
         DATE_FORMAT(a.news_time,'%W') as dayofweek,
         a.news_kat,
         a.news_text,
          a.news_recht,
         b.name as username,
          b.avatar as avatar,
          b.id as userid
          FROM prefix_news as a
          LEFT JOIN prefix_user as b ON a.user_id = b.id      
         WHERE a.news_id = '".$nid."'"));
     
        if ( !empty($row->avatar) ) {    
           $avatar = '<a href="index.php?user-details-'.$row->userid.'"><img src="'.$row->avatar.'" border="0" alt="'.$row->username.'" title="'.$row->username.'"></a>';
        } else {
           $avatar = 'n/a';
        }   
      
      if ( has_right(array($row->news_recht)) ) {
        $komsOK = true;
          if ( $allgAr['Ngkoms'] == 0 ) {
          if ( loggedin() ) {
            $komsOK = true;
            } else {
              $komsOK = false;
              }
        }
          if ( $allgAr['Nukoms'] == 0 ) {
            $komsOK = false;
          }
     
        # 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');
          db_query("INSERT INTO `prefix_koms` (`uid`,`cat`,`name`,`text`) VALUES (".$nid.",'NEWS','".$_POST['name']."','".$_POST['txt']."')");
          }
          # 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 = bbcode($row->news_text);
            $textToShow = str_replace('[PREVIEWENDE]','',$textToShow);
            if ( !empty($such) ) {
              $textToShow = markword($textToShow,$such);
            }
     
            $tpl = new tpl ( 'news.htm' );
            $ar = array (
          'TEXT'  => $textToShow,
          'AVATAR' => $avatar,
                'KATE'  => $kategorie,
          'NID' => $nid,
          'uname' => $_SESSION['authname'],
                'ANTISPAM' => (loggedin()?'':get_antispam ('newskom', 0)),
                'NAME'  => $row->news_title
            );
            $tpl->set_ar_out($ar, 2 );
     
            if ($komsOK) {
              $tpl->set_ar_out ( array ( 'NAME' => $row->news_title , 'NID' => $nid ), 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="?news-'.$nid.'-d'.$row1['id'].'"><img src="include/images/icons/del.gif" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
            }
            $tpl->set_ar_out( array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'ZAHL' => $zahl ) , 4 );
            $zahl--;
              }
        }
        }
      $tpl->out(5);
    }
     
    $design->footer();
     
    ?>
    0 Mitglieder finden den Beitrag gut.
  27. #27
    User Pic
    lucasch Mitglied
    Registriert seit
    14.11.2009
    Beiträge
    85
    Beitragswertungen
    5 Beitragspunkte
    Hallo, ich habe das ma getestet aber bei mir kommt diese fehlermeldung
    ZitatZitat
    Fatal error: Call to undefined function getGroupRights() in /data/multiserv/users/268514/projects/323578/www/include/contents/news.php on line 162

    und in der zeile 162 is das
    $groups = getGroupRights();

    wie bekomm ich das weg?
    0 Mitglieder finden den Beitrag gut.
  28. #28
    User Pic
    -=NLNF=-Keule Mitglied
    Registriert seit
    13.05.2009
    Beiträge
    58
    Beitragswertungen
    0 Beitragspunkte
    Moin zusammen,

    ich habe beide auch so abgeändert aber wenn ich beide Datein dann hochlade und ich die Seite neu lade kommt die Fehlermeldung:

    Parse error: syntax error, unexpected T_STRING in /www/htdocs/w00c7016/nlnf/include/contents/news/news.php on line 241

    Was mache ich da falsch ?

    <?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 news_title, news_text, news_kat, news_recht, news_groups, html FROM prefix_news WHERE news_id = $tn_id AND `show` > 0 AND `show` <= UNIX_TIMESTAMP() AND (endtime IS NULL OR endtime > UNIX_TIMESTAMP())");
            if (db_num_rows($tn_sql) > 0) {
                $tn_r = db_fetch_object($tn_sql);
    
    			$dontShow = false;
    			if ((pow(2, abs($_SESSION['authright'])) | $tn_r->news_recht) != $tn_r->news_recht) {
    				$dontShow = true;
    			}
    			if ($dontShow) {
    				foreach($_SESSION['authgrp'] as $id => $bool) {
    					if ($bool and (pow(2, abs($id)) | $tn_r->news_groups) == $tn_r->news_groups) {
    						$dontShow = false;
    						break;
    					}
    				}
    			}
            	if (!$dontShow) {
    				$tn_tpl = new tpl ('news/top');
    				$tn_tpl->set('title', $tn_r->news_title);
    				$tn_tpl->set('koms', $tn_koms == '1' ? '<br /><a href="index.php?news-' . $tn_id . '">' . db_count_query("SELECT COUNT(id) FROM prefix_koms WHERE uid = $tn_id AND cat = 'NEWS'") . ' ' . $lang['comments'] . ' </a>' : '');
                    if (strpos ($tn_r->news_text , '[PREVIEWENDE]') !== false) {
                        $a = explode('[PREVIEWENDE]' , $tn_r->news_text);
                        $tn_r->news_text = $a[0];
                        $tn_tpl->set('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_tpl->set('readwholenews', '');
                    }
                    $tn_tpl->set('kate', news_find_kat($tn_r->news_kat));
                    $tn_tpl->set_out('txt', $tn_r->html ? $tn_r->news_text : bbcode($tn_r->news_text), 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;
    		//Gruppenrechte
    		$groups = getGroupRights();
    
    		$MPL = db_make_sites ($page , "WHERE (((" . pow(2, abs($_SESSION['authright'])) . " | news_recht) = news_recht) OR
    			(news_groups != 0 AND ((news_groups ^ $groups) != (news_groups | $groups)))) 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) OR
    	      (a.news_groups != 0 AND ((a.news_groups ^ $groups) != (a.news_groups | $groups)))) 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>';
                }
                // AVATAR
                $dbavatar = @db_result(db_query("SELECT avatar FROM prefix_user WHERE name = '".$row['username'].'"),0);
                if (!empty($dbavatar)) { $row['avatar'] = '<br><img src="'.$avatar.'" border="0"><br>'; } else { $row['avatar'] = '<br><img src="noavatar.jpg" border="0"><br>'; }
    			
                $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) {
    			foreach($_SESSION['authgrp'] as $id => $bool) {
    				if ($bool and (pow(2, abs($id)) | $row->news_groups) == $row->news_groups) {
    					$dontShow = false;
    					break;
    				}
    			}
    		}
    	}
    
    	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.gif" alt="l&ouml;schen" border="0" title="l&ouml;schen" /></a>';
                }
                $tpl->set_ar_out(array('NAME' => $row1['name'], 'TEXT' => $row1['text'], 'ZAHL' => $zahl) , 4);
                $zahl--;
            }
        }
        $tpl->out(5);
    }
    
    $design->footer();
    
    ?>


    Und die .html natürlich auch.

    <img src="include/designs/shooterbase/images/news_top.jpg" width="567" height="27">
    <table background="include/designs/shooterbase/images/news_bg.jpg" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="newsbg">
    <tr>
    <td width="10"></td>
    <td>
    <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
        <tr>
          <td class="smalfont">{datum} - <strong><a href="index.php?news-{id}">{title}</a></strong></td>
          </tr>
    <table width="98%"  border="0" cellspacing="0" cellpadding="2">
    
        <tr>
          <td><hr style="height: 0px; border: dotted #000000 0px; border-top-width: 1px; " /></td>
          </tr>
    </table>
    
    
    
      <table width="100%" border="0" align="center" cellpadding="1" cellspacing="0" class="cbg1">
        <tr>
          <td align="center">{kate}</td>
        </tr>
    <tr>
          <td align="center" width="60%" class="smalfont">von <strong>{username}</strong>{avatar}{edit}</td>
        </tr>
      </table>
    
    
      <table width="98%"  border="0" cellspacing="0" cellpadding="2">
        <tr>
    	  <td>{text}</td>
    	</tr>
        <tr>
    	  <td><hr style="height: 0px; border: dotted #000000 0px; border-top-width: 1px; " /></td>
    	</tr>
     </table>
     <table width="98%"  border="0" cellspacing="0" cellpadding="1">
        <tr>
    
          <td align="left" width="60%" class="smalfont">Geschrieben von <strong>{username}</strong>{edit}</td>
          <td align="right" width="40%">
            <div align="right">{readwholenews}
            </div></td>
          </td>
    	  <td width="10"></td>
        </tr>
      </table>
    </td></tr></table>
    <img src="include/designs/shooterbase/images/news_bt.jpg" width="567" height="25">
    <br />
    <br />
    {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 -->
    <table width="100%" cellpadding="5" cellspacing="1" border="0">
      <tr class="Chead">
        <th height="25"><b>{NAME}</b></th>
      </tr>
      <tr>
        <td height="25">{_lang_message}</td>
      </tr>
    
        <tr>
          <td align="center">{KATE}</td>
        </tr>
    
    
      <tr>
        <td >
          <div style="float:left; padding-left:10px; ">{TEXT}</div><br style="clear:both; " />
          <p></p>
          <a href="javascript:history.back(1)"><b>&laquo;</b>{_lang_back}</a> </td>
      </tr>
    
      <tr>
        <td height="25">{_lang_commentsfor} {NAME}</td>
      </tr>
      <tr>
        <td>
    
    	    {EXPLODE}
    	    <form action="index.php?news-{NID}" method="POST">
            <fieldset>
              <legend>{_lang_writecomment}</legend>
              <input type="text" name="name" value="{uname}" /> &nbsp; {ANTISPAM} &nbsp; <input type="submit" value="{_lang_enter}"><br />
              <textarea style="width: 98%" cols="50" rows="2" name="txt"></textarea><br />
            </fieldset>
          </form>
          <br />
          {EXPLODE}
    
          <span class="Cmite"># <b>{ZAHL}</b> von {NAME}</span>
          <br />{TEXT}<br /><br />
    
          {EXPLODE}
          <br />
          <a href="javascript:history.back(1)"><b>&laquo;</b> {_lang_back}</a>
    
        </td>
      </tr>
    </table>
    0 Mitglieder finden den Beitrag gut.
  29. #29
    User Pic
    Mairu Coder
    Registriert seit
    16.06.2006
    Beiträge
    15.334
    Beitragswertungen
    386 Beitragspunkte
                // AVATAR
                $dbavatar = @db_result(db_query("SELECT avatar FROM prefix_user WHERE name = '".$row['username']."'"),0);
    Und auch immer mal ein Blick auf die FAQ werfen. | Mairus Ilchseite
    0 Mitglieder finden den Beitrag gut.
  30. #30
    User Pic
    -=NLNF=-Keule Mitglied
    Registriert seit
    13.05.2009
    Beiträge
    58
    Beitragswertungen
    0 Beitragspunkte
    Hi Mairu,

    soll ich die Zeile 241. jetzt ganz löschen oder wie meinst du das jetzt? lächeln

    Besten Gruss
    Keule
    0 Mitglieder finden den Beitrag gut.
Geschlossen

Zurück zu Module und Modifikationen

Optionen: Bei einer Antwort zu diesem Thema eine eMail erhalten