All pastes #420025 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-01 20:14 UTC
rendered paste body
<?php

defined ('main') or die ( 'no direct access' );

$title = $allgAr['title'].' :: Newsarchiv';
$hmenu = 'Newsarchiv';
$design = new design ( $title , $hmenu );
$design->header();

if (isset($_POST['chcat'])) {
  $kat = $_POST['cat'];
  }
else $kat = 'showallcats';

$limit = 20;
$page = ( $menu->getA(1) == 'p' ? $menu->getE(1) : 1 );
if ($menu->getA(2) == 'p') {
  $kat = $menu->get(1);
  $page = ( $menu->getA(2) == 'p' ? $menu->getE(2) : 1 );
  }
$MPL = db_make_sites ($page , "WHERE ".($kat == 'showallcats'?'':"news_kat = BINARY '$kat' AND ")."news_recht >= ".$_SESSION['authright'] , $limit , '?narchiv'.($kat == 'showallcats'?'':'-'.$kat) , 'news' );
$anfang = ($page - 1) * $limit;

echo '<form action="index.php?narchiv" method="post">Kategorie: <select name="cat"><option value="showallcats">Alle Kategorien anzeigen</option>';
$sql = db_query("SELECT DISTINCT news_kat FROM `prefix_news`");
while ($cats = db_fetch_object($sql)) echo '<option value="$cats->news_kat\"'.($kat == $cats->news_kat? ' selected="selected"':'').'>'.$cats->news_kat.'</option>';
echo '</select> <input type="submit" value="w&auml;hlen" name="chcat" /></form><br />';

  $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,
    b.name as username,
    b.id as uid,
    c.name as editor,
    c.id as eid
  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 ".($kat == 'showallcats'?'':"a.news_kat = BINARY '$kat' AND ")
  .$_SESSION['authright']." <= a.news_recht
  ORDER BY news_time DESC
  LIMIT $anfang,$limit";


  echo '<table width="100%">
  <tr class="Chead"><th>Datum</th><th>Titel</th><th>Autorname</th><th>Kategorie</th><th>Kommentare</th><th>Drucken</th></tr>';
  $erg = db_query($abf);
    while ($row = db_fetch_object($erg)) {
	$k0m  = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = ".$row->id." AND cat = 'NEWS'");
$komm  = db_result($k0m,0);
    echo '
    <tr class="Cnorm">
    <td>'.$row->datum.'</td>
    <td><a href="index.php?news-'.$row->id.'">'.$row->title.'</a></td><td><a href="index.php?user-details-'.$row->uid.'">'.$row->username.'</a>'.((!empty($row->editor) AND $row->uid != $row->eid) ? " (Last edit: $row->editor)":'').'</td>
    <td><a href="index.php?katnews-'.$row->kate.'">'.$row->kate.'</a></td>
    <td><p align="right"><a href="index.php?news-'.$row->id.'">('.$komm.')</a></p></td>
    <td><a href="index.php?printable-'.$row->id.'"><center><img border="0" src="include/images/news/other/print.gif">
    </center></a></td></tr>';
    }
  echo "</table><br />
  <div align=\"center\">$MPL</div>
  ";
  
$design->footer();
?>