All pastes #548921 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-06-07 22:38 UTC
rendered paste body
<?php
#  Script Copyright by:  Topolino
#  Support auf www.honklords.de 
  
defined ('main') or die ( 'no direct access' );


# Allgemeine Variablen

$titellaenge 	= 45;					# beispielsweise: $titellaenge	= '12'  					würde bedeuten: "Neues Counte..." 	=> ganz praktisch um Designsprengungen zu verhindern
$unamelaenge 	= 15;					# beispielsweise: $linkclass		= '6' 						würde bedeuten: "$CoRpI..." 				=> ganz praktisch um Designsprengungen zu verhindern
$rowclass1		=	'Cnorm';		# beispielsweise: $linkclass		= 'Cnorm' 				würde bedeuten: (1. Zeilenklasse) <tr class="Cnorm"><td>.......</td></tr>
$rowclass2		=	'Cmite';		# beispielsweise: $linkclass		= 'Cmite' 				würde bedeuten: (2. Zeilenklasse) <tr class="Cnorm"><td>.......</td></tr>
$linkclass		= '';					# beispielsweise: $linkclass		= 'class="box"' 	würde bedeuten: <a class="box" href="xyz">xyz</a>
$limit 				= 20;					# beispielsweise: $limit				= '100' 					würde bedeuten: in der Tabellenübersicht werden 100 News angezeigt bis eine neue Seite käme


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

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

$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 , '?newsarchiv'.($kat == 'showallcats'?'':'-'.$kat) , 'news' );
$anfang = ($page - 1) * $limit;


   $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_frei as frei,
      a.news_text as text,
	  a.news_tn as tn,
      b.name as username,
      b.id as uid
    FROM prefix_news as a
    LEFT JOIN prefix_user as b ON a.user_id = b.id
  WHERE ".($kat == 'showallcats'?'':"a.news_kat = BINARY '$kat' AND ")
  .$_SESSION['authright']." <= a.news_recht AND a.news_tn = 'true'
  ORDER BY news_time DESC
  LIMIT $anfang,$limit";
     $abf1 = "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_frei as frei,
      a.news_text as text,
	  a.news_tn as tn,
      b.name as username,
      b.id as uid
    FROM prefix_news as a
    LEFT JOIN prefix_user as b ON a.user_id = b.id
  WHERE ".($kat == 'showallcats'?'':"a.news_kat = BINARY '$kat' AND ")
  .$_SESSION['authright']." <= a.news_recht AND a.news_tn = 'false'
  ORDER BY news_time DESC
  LIMIT $anfang,$limit";
		
    $tpl = new tpl ( 'newsarchiv.htm' );

    $sql = db_query("SELECT DISTINCT news_kat FROM `prefix_news`");
    $kats .= '<form action="index.php?newsarchiv" method="post"><select name="cat"><option value="showallcats">Alle Kategorien anzeigen</option>';
    while ($cats = db_fetch_object($sql)) 
    $kats .= "<option value=\"$cats->news_kat\"".($kat == $cats->news_kat? ' selected="selected"':'').">$cats->news_kat</option>";
	  
    $kats .= '</select>&nbsp;<input type="submit" value="w&auml;hlen" name="chcat" /></form>';
    
    $ar = array (
			'KATS'        => $kats,
      'SITELINK' 		=> $MPL
		);
		$tpl->set_ar_out($ar, 0 );
    $erg = db_query($abf);
	 $erg1 = db_query($abf1);
	
		$i = 0;
    while ($row = db_fetch_assoc($erg)) {
      $i++;
	  if($row['frei'] == "true"){
      $k0m  = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = ".$row['id']." AND cat = 'NEWS'");
      $row['kom']  = db_result($k0m,0);
			
      if ($i % 2 != 0) { 
				$rowcolorclass = $rowclass1;
			}else{ 
				$rowcolorclass = $rowclass2; 
			}

			if(strlen($row['title']) > $titellaenge ){
			  $row['title'] = substr($row['title'], 0, $titellaenge ).'...';
			}
    
      if(strlen($row['username']) > $unamelaenge ){
			  $row['username'] = substr($row['username'], 0, $unamelaenge ).'...';
			}
			
			$ar = array (
  			'RCC' 			=> $rowcolorclass,
        'DATE'  		=> $row['datum'],
				'TITLE' 		=> '<a '.$linkclass.' href="?news-'.$row['id'].'">'.$row['title'].'</a>',
				'USERNAME' 	=> '<a '.$linkclass.' href="?user-details-'.$row['uid'].'" alt="Benutzerinfo: '.$row['username'].'" title="Benutzerinfo: '.$row['username'].'">'.$row['username'].'</a>',
				'COMMENTS' 	=> '<a '.$linkclass.' href="?news-'.$row['id'].'" alt="Kommentare ('.$row['kom'].')" title="Kommentare ('.$row['kom'].')">('.$row['kom'].')',
				'PRINT'     => '<a '.$linkclass.' href="?printsite-'.$row['id'].'" alt="Druckoptimierte Version" title="Druckoptimierte Version"><img src="include/images/icons/print.gif" alt="Druckoptimierte Version" border="0"></a>'
        );
			
				$tpl->set_ar_out($ar, 1 );
    }
	}
	while ($row = db_fetch_assoc($erg1)) {
      $i++;
	  if($row['frei'] == "true"){
      $k0m  = db_query("SELECT COUNT(ID) FROM `prefix_koms` WHERE uid = ".$row['id']." AND cat = 'NEWS'");
      $row['kom']  = db_result($k0m,0);
			
      if ($i % 2 != 0) { 
				$rowcolorclass = $rowclass1;
			}else{ 
				$rowcolorclass = $rowclass2; 
			}

			if(strlen($row['title']) > $titellaenge ){
			  $row['title'] = substr($row['title'], 0, $titellaenge ).'...';
			}
    
      if(strlen($row['username']) > $unamelaenge ){
			  $row['username'] = substr($row['username'], 0, $unamelaenge ).'...';
			}
			
			$ar = array (
  			'RCC' 			=> $rowcolorclass,
        'DATE'  		=> $row['datum'],
				'TITLE' 		=> '<a '.$linkclass.' href="?news-'.$row['id'].'">'.$row['title'].'</a>',
				'USERNAME' 	=> '<a '.$linkclass.' href="?user-details-'.$row['uid'].'" alt="Benutzerinfo: '.$row['username'].'" title="Benutzerinfo: '.$row['username'].'">'.$row['username'].'</a>',
				'COMMENTS' 	=> '<a '.$linkclass.' href="?news-'.$row['id'].'" alt="Kommentare ('.$row['kom'].')" title="Kommentare ('.$row['kom'].')">('.$row['kom'].')',
				'PRINT'     => '<a '.$linkclass.' href="?printsite-'.$row['id'].'" alt="Druckoptimierte Version" title="Druckoptimierte Version"><img src="include/images/icons/print.gif" alt="Druckoptimierte Version" border="0"></a>'
        );
			
				$tpl->set_ar_out($ar, 1 );
    }
	}
		$tpl->out(2);
		unset($tpl);

    
	$design->footer();
	
?>