ilch Forum » Ilch Clan 1.1 » Allgemein » Suchfunktion erweitern

Geschlossen
  1. #1
    User Pic
    Chewbacca Mitglied
    Registriert seit
    07.02.2009
    Beiträge
    137
    Beitragswertungen
    0 Beitragspunkte
    Guten Abend Zusammen,

    ich wollte die Suchfunktion erweitern, soll heissen ich habe die php anpassen wollen und dann einfach die abfrage um bis zu 5 Jahre erweitert - leider bekomme ich eine Fehlermeldung.

    if(isset($_GET['days'])) {
    	$days = ($_GET['days'] == 0 ? 360 : intval($_GET['days']));
    }
    else $days = 360;
    $days_ar = array(  1800 => 'alle Beiträge (5 Jahr)',
                    1   => '1 Tag',
                    7   => '7 Tage',
                    14  => '2 Wochen',
                    30  => '1 Monat',
                    90  => '3 Monate',
                    180 => '6 Monate');
                    360 => '1 Jahr');
                    720 => '2 Jahre');
                    1080 => '3 Jahre');
    $tpl->set('days',arlistee($days, $days_ar));
    $tpl->out(0);


    Anscheinend habe ich einen denkfehler!

    Ich bitte um Hilfe

    Danke der Zottel

    betroffene Homepage: externer Link
    0 Mitglieder finden den Beitrag gut.
  2. #2
    User Pic
    Mairu Coder
    Registriert seit
    16.06.2006
    Beiträge
    15.334
    Beitragswertungen
    386 Beitragspunkte
    Ich halte es mal als kleines Rätsel, schau dir mal die Zeilenenden genauer an zwinker
    Und auch immer mal ein Blick auf die FAQ werfen. | Mairus Ilchseite
    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
    Du hast ein paar Klammern zuviel lächeln

    $days_ar = array( 1800 => 'alle Beiträge (5 Jahre)',
                    1   => '1 Tag',
                    7   => '7 Tage',
                    14  => '2 Wochen',
                    30  => '1 Monat',
                    90  => '3 Monate',
                    180 => '6 Monate',
                    360 => '1 Jahr',
                    720 => '2 Jahre',
                    1080 => '3 Jahre');
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
  4. #4
    User Pic
    Chewbacca Mitglied
    Registriert seit
    07.02.2009
    Beiträge
    137
    Beitragswertungen
    0 Beitragspunkte
    sry...habe es gesehen!

    Vielen Dank für den richtigen Tipp!

    Greets

    Chewy
    0 Mitglieder finden den Beitrag gut.
  5. #5
    User Pic
    Galle81 gelöschter User
    Guten Tag,

    ich weiß das Thema hier ist schon etwas älter.
    Ist es irgendwie möglich, dass man bei der Suche statt 5 Jahre gar keine Begrenzung einfügen kann?
    Ich hatte diese Frage auch schon in einem anderem Thema gestellt, allerdings bisher ohne Erfolg.

    Mfg, Galle
    0 Mitglieder finden den Beitrag gut.
  6. #6
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Probiers mal ... nicht getestet!

    <?php
    #   Copyright by: Manuel
    #   Support: www.ilch.de
    
    
    defined ('main') or die ( 'no direct access' );
    
    function  serach_mark($text,$such) {
      #$text = BBcode($text);
    	$serar = explode(' ', $such);
      $text  = strip_tags($text);
      $text  = stripslashes($text);
      $rte   = '';
      $tleng = 30;
      foreach($serar as $v) {
        $firs = strpos(strtolower($text),strtolower($v));
        $begi = (($firs - $tleng) < 0 ? 0 : $firs - $tleng );
        $leng = strlen($text);
        $ende = (($firs + strlen($v) + $tleng) > $leng ? $leng : $firs + strlen($v) + $tleng );
        $ttxt = substr($text,$begi,($ende - $begi));
        $rte .= ' ... '.preg_replace("/".$v."/si",'<b>'.$v.'</b>',$ttxt);
      }
      return ($rte);
    }
    
    function search_finduser() {
      $design = new design ( 'Finduser' , '', 0 );
      $design->header();
    
      $tpl = new tpl ( 'search_finduser' );
      $tpl->out(0);
      if ( isset ( $_POST['sub'] ) AND !empty($_POST['name']) ) {
    	  $name = str_replace('*',"%",$_POST['name']);
        $name = escape($name, 'string');
    	  $q = "SELECT name,name FROM prefix_user WHERE name like '".$name."'";
    	  $tpl->set ('username',dbliste('',$tpl,'username',$q));
    	  $tpl->out(1);
      }
      $tpl->out(2);
      $design->footer();
    }
    
    if ($menu->get(1) == 'finduser') {
      search_finduser();
      exit();
    }
    
    
    $such = '';
    if ($menu->get(1) != '') {
      $such = $menu->get(1);
    } elseif (isset($_REQUEST['search'])) {
      $such = $_REQUEST['search'];
    }
    
    if ($such == 'aubt' OR $such == 'augt' OR $such == 'aeit') {
        header('Location: index.php?forum-'.$such);
        exit();
    }
    
    $such = stripslashes(escape($such, 'string'));
    
    $snac = 'Suche';
    if ($such == 'augt' OR $such == 'aeit' OR $such == 'aubt') {
      $ar_s = array('aubt'=>'unbeantworteten Themen','aeit'=>'eigenen Beitr&auml;gen','augt'=>'neue Themen seit dem letzten Besuch');
      $snac = $ar_s[$such];
    } elseif ( isset($_REQUEST['search']) ) {
      $snac = 'nach: '.$such;
    }
    
    $snacEnt = htmlentities($snac, ILCH_ENTITIES_FLAGS, ILCH_CHARSET);
    $title = $allgAr['title'].' :: Suchen :: ' . $snacEnt;
    $hmenu  = '<a class="smalfont" href="index.php?search">Suchen</a><b> &raquo; </b>' . $snacEnt;
    $design = new design ( $title , $hmenu );
    $design->header();
    
    $tpl = new tpl ('search');
    $tpl->set ('size', 30);
    
    $gAnz = 0;
    $autor = '';
    if(isset($_GET['autor'])) {
    	$autor = escape($_GET['autor'],'string');
    }
    $tpl->set ('autor', $autor);
    
    if(isset($_GET['in'])) {
    	for($i=1;$i<=3;$i++){
    		if($_GET['in'] == $i) {
    			$tpl->set ('checked'.$i, 'checked="checked"');
    		}
    	}
    } else $tpl->set ('checked1', 'checked="checked"');
    
    if ($such != 'augt' AND $such != 'aeit' AND $such != 'aubt') {
      $tpl->set('search',escape_for_fields($such),0);
    }
    
    if(isset($_GET['days'])) {
    	$days = ($_GET['days'] == 0 ? 0 : intval($_GET['days']));
    } else {
    	$days = 360;
    }
    $days_ar = array(
    				0   => 'alle Beitr&auml;ge',
                    1   => '1 Tag',
                    7   => '7 Tage',
                    14  => '2 Wochen',
                    30  => '1 Monat',
                    90  => '3 Monate',
                    180 => '6 Monate',
    				360 => '1 Jahr');
    $tpl->set('days',arlistee($days, $days_ar));
    $tpl->out(0);
    
    if (!empty($such) OR !empty($autor)) {
    
      $page = 1;
      
      if (isset($_GET['page'])) {
        $page = str_replace('-p','',$_GET['page']);
      }
    
      $limit = 25;  // Limit
      $anfang = ($page - 1) * $limit;
      
    	if ($days == 0) {
    		$x = 0;
    	} else {
    		$x = time() - (3600 * 24 * $days);
    	}
    
        $such = str_replace('-','',$such);
        $such = str_replace('=','',$such);
        $such = str_replace('&','',$such);
    
    	$serar = explode(' ', $such);
        $str_forum	= '';
    	$str_forum_a = '';
        $str_news	= '';
    	$str_news_a = '';
        $str_downs  = '';
    	$str_downs_ = '';
    	$str_downs_a = '';
    	  foreach($serar as $v) {
    	    $str = str_replace('\'','',$v);
    		  $str = str_replace('"','',$str);
          $str = addslashes($str);
    		  if ( !empty($str) ) {
    		    if($_GET['in'] == 1) {
    				$str_forum .= "txt LIKE '%".$str."%' AND ";
    			}
    			elseif($_GET['in'] == 2) {
    				$str_news  .= "news_text LIKE '%".$str."%' AND ";
    			}
            	elseif($_GET['in'] == 3) {
    				$str_downs  .= "`descl` LIKE '%".$str."%' AND ";
    				$str_downs_ .= "name LIKE '%".$str."%' AND ";
    			}
    		  }
    	  }
    	  if(isset($_GET['autor'])) {
    		    if($_GET['in'] == 1) {
    				$str_forum_a .= "c.erst LIKE '%".$autor."%' AND ";
    			}
    		  	elseif($_GET['in'] == 2) {
    				$str_news_a .= "`name` LIKE '%".$autor."%' AND ";
    			}
           		elseif($_GET['in'] == 3) {
    			$str_downs_a .= "`creater` LIKE '%".$autor."%' AND ";
    			}
    	}
    
    // 1 = forum, ist immer standart
    	$q = "
    	  SELECT DISTINCT
            a.fid as fid,
            a.name as titel,
            'foru' as typ,
            a.id as id,
            `time`,
    		c.erst as autor
          FROM prefix_posts c
            LEFT JOIN prefix_topics a ON a.id = c.tid
            LEFT JOIN prefix_forums b ON b.id = a.fid
            LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
            LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
            LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
          WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
            AND (".$str_forum." 1 = 1)
    		AND (".$str_forum_a." 1 = 1)
            AND (time >= ". $x .")
          GROUP BY a.id
    	  ORDER BY time DESC";
    if(isset($_GET['in'])) {
      if($_GET['in'] == 2) {
    	$q = "
    	  SELECT DISTINCT
            0 as fid,
            news_title as titel,
            'news' as typ,
            news_id as id,
            news_time as `time`,
    		prefix_user.name as autor
          FROM prefix_news
    	  	LEFT JOIN prefix_user ON prefix_news.user_id = prefix_user.id
          WHERE (".$str_news." 1 = 1)
    	  	AND (".$str_news_a." 1 = 1)
            AND (news_time >= ". $x .")
    	  ORDER BY `time` DESC";
      } elseif($_GET['in'] == 3) {
    	$q = "
    	  SELECT DISTINCT
            0 as fid,
            CONCAT( name, ' ', version ) AS titel,
            'down' as typ,
            id,
            UNIX_TIMESTAMP(`time`) as `time`,
    		creater as autor
          FROM prefix_downloads
          WHERE ((".$str_downs." 1 = 1)
    	  	OR (".$str_downs_." 1 = 1))
    		AND (".$str_downs_a." 1 = 1)
            AND (UNIX_TIMESTAMP(`time`) >= ". $x .")
    	  ORDER BY UNIX_TIMESTAMP(`time`) DESC";
      }
    }
    
        $gAnz = db_num_rows(db_query($q));
    
      $q .= " LIMIT ".$anfang.",".$limit;
    
      $MPL = db_make_sites ($page , "" , $limit , "index.php?search=".urlencode($such)."&autor=".urlencode($autor)."&in=".$_GET['in']."&days=".$days."&page=", "", $gAnz );
      $tpl->set_ar_out(array('MPL'=>$MPL,'gAnz'=>$gAnz),1);
    
      $q = db_query($q);
      $class = '';
      while($r = db_fetch_assoc($q) ) {
        $class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
        $r['class'] = $class;
        if ($r['typ'] == 'foru') {
          $r['ctime'] = db_result(db_query("SELECT MAX(time) FROM prefix_posts WHERE tid = ".$r['id']),0,0);
          $r['ord'] = forum_get_ordner($r['ctime'],$r['id'],$r['fid']);
          $r['link'] = 'forum-showposts-'.$r['id'];
        } elseif ($r['typ'] == 'news') {
          $r['ord']  = 'ord';
          $r['link'] = 'news-'.$r['id'];
        } elseif ($r['typ'] == 'down') {
          $r['ord']  = 'ord';
          $r['link'] = 'downloads-show-'.$r['id'];
        }
        $tpl->set_ar_out($r,2);
      }
      $tpl->out(3);
    }
    
    
    $design->footer();
    
    ?>
    rules :: doku :: faq :: linkus
    1 Mitglieder finden den Beitrag gut.
  7. #7
    User Pic
    Galle81 gelöschter User
    Mit diesem Code bekomme ich folgende Fehlermeldung:
    Warning: htmlentities() expects parameter 2 to be long, string given in /var/www/web711/html/hp/include/contents/search.php on line 71
    
    Warning: Cannot modify header information - headers already sent by (output started at /var/www/web711/html/hp/include/contents/search.php:71) in /var/www/web711/html/hp/include/includes/class/design.php on line 23


    Allerdings habe ich jetzt einige Zeilen und meiner search.php übernommen und es scheint hoffentlich ohne Fehlermeldung zu funktionieren.
    Kannst ja vorsichtshalber noch einmal kurz drüber schauen, wenn du magst.

    <?php
    #   Copyright by: Manuel
    #   Support: www.ilch.de
    
    
    defined ('main') or die ( 'no direct access' );
    
    function  serach_mark($text,$such) {
      #$text = BBcode($text);
    	$serar = explode(' ', $such);
      $text  = strip_tags($text);
      $text  = stripslashes($text);
      $rte   = '';
      $tleng = 30;
      foreach($serar as $v) {
        $firs = strpos(strtolower($text),strtolower($v));
        $begi = (($firs - $tleng) < 0 ? 0 : $firs - $tleng );
        $leng = strlen($text);
        $ende = (($firs + strlen($v) + $tleng) > $leng ? $leng : $firs + strlen($v) + $tleng );
        $ttxt = substr($text,$begi,($ende - $begi));
        $rte .= ' ... '.preg_replace("/".$v."/si",'<b>'.$v.'</b>',$ttxt);
      }
      return ($rte);
    }
    
    function search_finduser() {
      $design = new design ( 'Finduser' , '', 0 );
      $design->header();
    
      $tpl = new tpl ( 'search_finduser' );
      global $menu;
      $tpl->set('add', $menu->get(2) == 'add' ? '-add' : '');
      $tpl->out(0);
      if ( isset ( $_POST['sub'] ) AND !empty($_POST['name']) ) {
    	  $name = str_replace('*',"%",$_POST['name']);
        $name = escape($name, 'string');
    	  $q = "SELECT name,name FROM prefix_user WHERE name like '".$name."'";
    	  $tpl->set ('username',dbliste('',$tpl,'username',$q));
    	  $tpl->out(1);
      }
      $tpl->out(2);
      $design->footer();
    }
    
    if ($menu->get(1) == 'finduser') {
      search_finduser();
      exit();
    }
    
    
    $such = '';
    if ($menu->get(1) != '') {
      $such = $menu->get(1);
    } elseif (isset($_REQUEST['search'])) {
      $such = $_REQUEST['search'];
    }
    
    if ($such == 'aubt' OR $such == 'augt' OR $such == 'aeit') {
        header('Location: index.php?forum-'.$such);
        exit();
    }
    
    $such = stripslashes(escape($such, 'string'));
    
    $snac = 'Suche';
    if ($such == 'augt' OR $such == 'aeit' OR $such == 'aubt') {
      $ar_s = array('aubt'=>'unbeantworteten Themen','aeit'=>'eigenen Beitr&auml;gen','augt'=>'neue Themen seit dem letzten Besuch');
      $snac = $ar_s[$such];
    } elseif ( isset($_REQUEST['search']) ) {
      $snac = 'nach: '.$such;
    }
    
    
    $title = $allgAr['title'].' :: Suchen :: '.htmlentities($snac);
    $hmenu  = '<a class="smalfont" href="index.php?search">Suchen</a><b> &raquo; </b>'.htmlentities($snac);
    $design = new design ( $title , $hmenu );
    $design->header();
    
    $tpl = new tpl ('search');
    $tpl->set ('sizes', 35);
    $tpl->set ('sizea', 25);
    
    $gAnz = 0;
    $autor = '';
    if(isset($_GET['autor'])) {
    	$autor = escape($_GET['autor'],'string');
    }
    $tpl->set ('autor', $autor);
    
    if(isset($_GET['in'])) {
    	for($i=1;$i<=3;$i++){
    		if($_GET['in'] == $i) {
    			$tpl->set ('checked'.$i, 'checked="checked"');
    		}
    	}
    } else $tpl->set ('checked1', 'checked="checked"');
    
    if ($such != 'augt' AND $such != 'aeit' AND $such != 'aubt') {
      $tpl->set('search',escape_for_fields($such),0);
    }
    
    if(isset($_GET['days'])) {
        $days = ($_GET['days'] == 0 ? 0 : intval($_GET['days']));
    } else {
        $days = 360;
    }
    $days_ar = array(
                    0   => 'alle Beitr&auml;ge',
                    1   => '1 Tag',
                    7   => '7 Tage',
                    14  => '2 Wochen',
                    30  => '1 Monat',
                    90  => '3 Monate',
                    180 => '6 Monate',
                    360 => '1 Jahr');
    $tpl->set('days',arlistee($days, $days_ar));
    $tpl->out(0);
     
    if (!empty($such) OR !empty($autor)) {
     
      $page = 1;
       
      if (isset($_GET['page'])) {
        $page = str_replace('-p','',$_GET['page']);
      }
     
      $limit = 25;  // Limit
      $anfang = ($page - 1) * $limit;
       
        if ($days == 0) {
            $x = 0;
        } else {
            $x = time() - (3600 * 24 * $days);
        }
    
        $such = str_replace('-','',$such);
        $such = str_replace('=','',$such);
        $such = str_replace('&','',$such);
    
    	$serar = explode(' ', $such);
        $str_forum	= '';
    	$str_forum_a = '';
        $str_news	= '';
    	$str_news_a = '';
        $str_downs  = '';
    	$str_downs_ = '';
    	$str_downs_a = '';
    	  foreach($serar as $v) {
    	    $str = str_replace('\'','',$v);
    		  $str = str_replace('"','',$str);
          $str = addslashes($str);
    		  if ( !empty($str) ) {
    		    if($_GET['in'] == 1) {
    				$str_forum .= "txt LIKE '%".$str."%' AND ";
    			}
    			elseif($_GET['in'] == 2) {
    				$str_news  .= "news_text LIKE '%".$str."%' AND ";
    			}
            	elseif($_GET['in'] == 3) {
    				$str_downs  .= "`descl` LIKE '%".$str."%' AND ";
    				$str_downs_ .= "name LIKE '%".$str."%' AND ";
    			}
    		  }
    	  }
    	  if(isset($_GET['autor'])) {
    		    if($_GET['in'] == 1) {
    				$str_forum_a .= "c.erst LIKE '%".$autor."%' AND ";
    			}
    		  	elseif($_GET['in'] == 2) {
    				$str_news_a .= "`name` LIKE '%".$autor."%' AND ";
    			}
           		elseif($_GET['in'] == 3) {
    			$str_downs_a .= "`creater` LIKE '%".$autor."%' AND ";
    			}
    	}
    
    // 1 = forum, ist immer standart
    	$q = "
    	  SELECT DISTINCT
            a.fid as fid,
            a.name as titel,
            'foru' as typ,
            a.id as id,
            `time`,
    		c.erst as autor
          FROM prefix_posts c
            LEFT JOIN prefix_topics a ON a.id = c.tid
            LEFT JOIN prefix_forums b ON b.id = a.fid
            LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
            LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
            LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
          WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
            AND (".$str_forum." 1 = 1)
    		AND (".$str_forum_a." 1 = 1)
            AND (time >= ". $x .")
          GROUP BY a.id
    	  ORDER BY time DESC";
    if(isset($_GET['in'])) {
      if($_GET['in'] == 2) {
    	$q = "
    	  SELECT DISTINCT
            0 as fid,
            news_title as titel,
            'news' as typ,
            news_id as id,
            news_time as `time`,
    		prefix_user.name as autor
          FROM prefix_news
    	  	LEFT JOIN prefix_user ON prefix_news.user_id = prefix_user.id
          WHERE (".$str_news." 1 = 1)
    	  	AND (".$str_news_a." 1 = 1)
            AND (news_time >= ". $x .")
    	  ORDER BY `time` DESC";
      } elseif($_GET['in'] == 3) {
    	$q = "
    	  SELECT DISTINCT
            0 as fid,
            CONCAT( name, ' ', version ) AS titel,
            'down' as typ,
            id,
            UNIX_TIMESTAMP(`time`) as `time`,
    		creater as autor
          FROM prefix_downloads
          WHERE ((".$str_downs." 1 = 1)
    	  	OR (".$str_downs_." 1 = 1))
    		AND (".$str_downs_a." 1 = 1)
            AND (UNIX_TIMESTAMP(`time`) >= ". $x .")
    	  ORDER BY UNIX_TIMESTAMP(`time`) DESC";
      }
    }
    
        $gAnz = db_num_rows(db_query($q));
    
      $q .= " LIMIT ".$anfang.",".$limit;
    
      $MPL = db_make_sites ($page , "" , $limit , "index.php?search=".urlencode($such)."&autor=".urlencode($autor)."&in=".$_GET['in']."&days=".$days."&page=", "", $gAnz );
      $tpl->set_ar_out(array('MPL'=>$MPL,'gAnz'=>$gAnz),1);
    
      $q = db_query($q);
      $class = '';
      while($r = db_fetch_assoc($q) ) {
        $class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
        $r['class'] = $class;
        if ($r['typ'] == 'foru') {
          $r['ctime'] = db_result(db_query("SELECT MAX(time) FROM prefix_posts WHERE tid = ".$r['id']),0,0);
          $r['ord'] = forum_get_ordner($r['ctime'],$r['id'],$r['fid']);
          $r['link'] = 'forum-showposts-'.$r['id'];
        } elseif ($r['typ'] == 'news') {
          $r['ord']  = 'ord';
          $r['link'] = 'news-'.$r['id'];
        } elseif ($r['typ'] == 'down') {
          $r['ord']  = 'ord';
          $r['link'] = 'downloads-show-'.$r['id'];
        }
        $tpl->set_ar_out($r,2);
      }
      $tpl->out(3);
    }
    
    
    $design->footer();
    
    ?>


    Ist die Zeile 105 eigentlich für den vordefinierten Intervall oder hat diese noch andere Funktionen?
    Sprich wenn man jetzt von 360 auf 0 ändert, sodass Standardmäßig alle Beiträge steht und nicht 1 Jahr wie zurzeit.

    Schönen Herrentag gewünscht. lächeln

    Mfg, Galle
    0 Mitglieder finden den Beitrag gut.
  8. #8
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Genau!

    Der Fehler lag daran, dass Du uns verschwiegen hast, dass Du nicht 1.1P verwendest. zwinker
    rules :: doku :: faq :: linkus
    1 Mitglieder finden den Beitrag gut.
  9. #9
    User Pic
    Galle81 gelöschter User
    Hatte halt gedacht, dass derjenige auch in das andere Thema schaut.
    Da hatte ich meine Version angegeben.
    Aber denn weiß ich für das nächste mal bescheid. lachen

    Vielen Dank.
    0 Mitglieder finden den Beitrag gut.
  10. #10
    User Pic
    Galle81 gelöschter User
    Guten Morgen, ich bin es nochmal.

    Könnte man die Zeit auch in der search.php (include/contents/forum)
    auf unbegrenzt setzen?
    Da dort ja auch nur das letzte Jahr berechnet wird.

    In der Zeile 73 wird scheinbar die Zeit berechnet, allerdings bin ich mir da nicht sicher und ich wüsste jetzt auch nicht, was ich dort einfügen müsste, damit nicht nur das letzte Jahr berechnet wird.
    <?php
    #   Copyright by: Manuel Staechele
    #   Support: www.ilch.de
    
    
    defined ('main') or die ( 'no direct access' );
    
    $such = $menu->get(1);
    
    if ($such == 'aeit') {
        if (isset($_POST['name'])) {
            $name = escape($_POST['name'],'string');
            $uid = @db_result(db_query("SELECT id FROM prefix_user WHERE name = BINARY '".$name."'"));
            if ($uid > 0) {
                $menu->set_url(2,$uid);
            }
        }
        if ($menu->get(2) >= 1 AND $menu->get(2) != $_SESSION['authid']) {
        $uid = $menu->get(2);
        $name = get_n($uid);
        $mtitle = $lang['posts'].' '.$lang['from'].' '.$name;
        } else {
            $uid = $_SESSION['authid'];
            $mtitle = $lang['ownposts'];
            $name = '';
        }
    } elseif ($such == 'aubt') {
        $mtitle = $lang['topicwithnoreply'];
    } else {
        $mtitle = $lang['newtopicssincelastvisit'];
    }
    
    $title = $allgAr['title'].' :: Forum :: '.$mtitle;
    $hmenu  = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> &raquo; </b> '.$mtitle;
    $design = new design ( $title , $hmenu, 1);
    $design->header();
    
    # mehrere seiten falls gefordert
    $limit = 25;  // Limit
    $page = ($menu->getE('p') > 0 ? $menu->getE('p') : 1 );
    $anfang = ($page - 1) * $limit;
    
    $s = "DISTINCT b.id as fid, a.name as titel, a.id as id, d.name as author";
    $q = "SELECT {SELECT}
      FROM prefix_topics a
        LEFT JOIN prefix_forums b ON b.id = a.fid
        LEFT JOIN prefix_posts c ON c.tid = a.id
        LEFT JOIN prefix_user d ON c.erstid = d.id
        LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
        LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
        LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
      WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
         AND {WHERE}
      ORDER BY c.time DESC";
    $q2 = "SELECT DISTINCT b.id as fid, a.name as titel, a.id as id, MIN(c.id) AS firstnew, d.name as author
        FROM prefix_topics a
          LEFT JOIN prefix_forums b ON b.id = a.fid
          LEFT JOIN prefix_posts c ON c.tid = a.id
          LEFT JOIN prefix_user d ON c.erstid = d.id
          LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
          LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
          LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
        WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
          AND c.time >= ".$_SESSION['lastlogin']."
        GROUP BY b.id,a.id, a.name
        ORDER BY c.time DESC";
    $x = time() - (3600 * 24 * 360);
    if ($such == 'aubt') {
        $where = "c.time >= ". $x ." AND a.rep = 0";
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    } elseif ($such == 'augt') {
        $where = "c.time >= ". $x ." AND c.time >= ".$_SESSION['lastlogin'];
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q2));
    } elseif ($such == 'aeit') {
        $where = "c.time >= ". $x ." AND c.erstid = ".$uid;
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    }
    $MPL = db_make_sites ($page , "", $limit , 'index.php?forum-'.$such.($such == 'aeit' ? '-'.$uid : '') , "" , $gAnz);
    
    $tpl = new tpl('forum/search');
    $q = db_query($q." LIMIT $anfang,$limit");
    $class = '';
    $tpl->set_out('gAnz',$gAnz,0);
    while($r = db_fetch_assoc($q) ) {
        $class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
        $r['class'] = $class;
        $r['ctime'] = db_result(db_query("SELECT MAX(time) FROM prefix_posts WHERE tid = ".$r['id']),0,0);
        $r['ord'] = forum_get_ordner($r['ctime'],$r['id'],$r['fid']);
        $r['link'] = 'forum-showposts-'.$r['id'];
        if ($menu->get(1) == 'aeit') {
            $r['author'] = '';
        } elseif ($such == 'aubt') {
            $r['author'] = ' '.$lang['from'].' '.$r['author'];
        } else {
            $r['author'] = ' '.$lang['newpost'].' '.$lang['from'].' '.$r['author'];
            $r['postsbefore'] = db_count_query('SELECT COUNT(id) FROM prefix_posts WHERE tid = '.$r['id'].' AND id < '.$r['firstnew']);
            $r['page'] = ceil(($r['postsbefore']+1)/$allgAr['Fpanz']);
            $r['link'] .= '-p'.$r['page'].'#'.$r['firstnew'];
        }
    
        $tpl->set_ar_out($r,1);
    }
    $tpl->set_out('MPL',$MPL,2);
    if ($such == 'aeit') {
        $tpl->set_out('name',$name,3);
    }
    
    $design->footer();
    ?>


    Meine Homepage: www.fsc-clan.org
    Ilch Version: 1.1O

    Mfg, Galle
    0 Mitglieder finden den Beitrag gut.
  11. #11
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Das ist richtig. In der Zeile 73 wird der Zeitstempel vor genau einem Jahr berechnet, welcher dann in den späteren DB-Abfragen angewandt wird.

    Wenn jedoch $x = 0; ist würden alle Daten nach 01.01.1970 geprüft.

    php.net/manual/de/function.time.php

    Besser jedoch ist jedoch die Angaben c.time >= ". $x ." in den folgenden DB-Abfragen entfernen!


    Zuletzt modifiziert von Lord|Schirmer am 15.05.2015 - 12:13:19
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
  12. #12
    User Pic
    Galle81 gelöschter User
    Zeile 75:
    $where = "c.time >= ". $x ." AND a.rep = 0";

    ändern in:
    $where = "a.rep = 0";


    Zeile 79:
    $where = "c.time >= ". $x ." AND c.time >= ".$_SESSION['lastlogin'];

    ändern in:
    $where = "c.time >= ".$_SESSION['lastlogin'];


    Zeile 83:
    $where = "c.time >= ". $x ." AND c.erstid = ".$uid;

    ändern in:
    $where = "c.erstid = ".$uid;


    Wäre dies so richtig?

    Mfg, Galle


    Zuletzt modifiziert von Galle81 am 15.05.2015 - 15:41:35
    0 Mitglieder finden den Beitrag gut.
  13. #13
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Genau Yes
    rules :: doku :: faq :: linkus
    2 Mitglieder finden den Beitrag gut.
  14. #14
    User Pic
    Galle81 gelöschter User
    Alles klar und schon mal vielen Dank.

    Eine Frage hätte ich noch.
    Ist es normal, dass auf meiner Seite bei mir nur 153 Beiträge angezeigt werden?
    Denn eigentlich habe ich 868 Beiträge.
    Und unten werden bei mir auch nur 7 Seiten angezeigt.
    Wenn ich aber oben die URL ändere, kann ich bis 35 Seiten angezeigt bekommen, wo auch der erste Eintrag (Mittwoch, 27. Jan 2010 - 20:49 Uhr) von mir zu sehen ist.

    Mfg, Galle
    0 Mitglieder finden den Beitrag gut.
  15. #15
    User Pic
    Galle81 gelöschter User
    Keiner einen Tipp, wie man dieses Problem beheben könnte?
    0 Mitglieder finden den Beitrag gut.
  16. #16
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Sry hab den Betrag übersehen. Es werden ja die Themen und nicht die Beträge aufgelistet. Wenn Du in einem Thema mehrere Beiträge hast sollte diese Anzahl normal sein.

    Wenn ich bei Dir alle Forumbeiträge von Dir "Galle" aufrufe, zeigt es mir 90 Themen an. Da deine Listen 25 Zeilen haben, ist die Seitenanzahl von 4 korrekt.

    Oder habe ich jetzt etwas missverstanden.
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
  17. #17
    User Pic
    Galle81 gelöschter User
    Sry, hatte mich verkehrt ausgerückt.
    Es handelt sich hierbei um die Beitragssuche im Forum, siehe hier: www.fsc-clan.org/index.php?forum-aeit

    Denn dort sind ja mehrere Beiträge in Themen angezeigt.
    Wenn du dort meinen Namen eingibst und auf Suche klickst, werden 4 Seiten angezeigt, richtig wäre dabei 22 Seiten.

    Mfg, Galle


    Zuletzt modifiziert von Galle81 am 22.05.2015 - 11:12:23
    0 Mitglieder finden den Beitrag gut.
  18. #18
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Poste mal deine forum/search.php
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
  19. #19
    User Pic
    Galle81 gelöschter User
    Bitte schön:
    <?php
    #   Copyright by: Manuel Staechele
    #   Support: www.ilch.de
    
    
    defined ('main') or die ( 'no direct access' );
    
    $such = $menu->get(1);
    
    if ($such == 'aeit') {
        if (isset($_POST['name'])) {
            $name = escape($_POST['name'],'string');
            $uid = @db_result(db_query("SELECT id FROM prefix_user WHERE name = BINARY '".$name."'"));
            if ($uid > 0) {
                $menu->set_url(2,$uid);
            }
        }
        if ($menu->get(2) >= 1 AND $menu->get(2) != $_SESSION['authid']) {
        $uid = $menu->get(2);
        $name = get_n($uid);
        $mtitle = $lang['posts'].' '.$lang['from'].' '.$name;
        } else {
            $uid = $_SESSION['authid'];
            $mtitle = $lang['ownposts'];
            $name = '';
        }
    } elseif ($such == 'aubt') {
        $mtitle = $lang['topicwithnoreply'];
    } else {
        $mtitle = $lang['newtopicssincelastvisit'];
    }
    
    $title = $allgAr['title'].' :: Forum :: '.$mtitle;
    $hmenu  = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> &raquo; </b> '.$mtitle;
    $design = new design ( $title , $hmenu, 1);
    $design->header();
    
    # mehrere seiten falls gefordert
    $limit = 25;  // Limit
    $page = ($menu->getE('p') > 0 ? $menu->getE('p') : 1 );
    $anfang = ($page - 1) * $limit;
    
    $s = "DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, c.time as time, c.erst as last, a.id as id, d.name as author";
    $q = "SELECT {SELECT}
      FROM prefix_topics a
        LEFT JOIN prefix_forums b ON b.id = a.fid
        LEFT JOIN prefix_posts c ON c.tid = a.id
        LEFT JOIN prefix_user d ON c.erstid = d.id
        LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
        LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
        LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
      WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
         AND {WHERE}
      ORDER BY c.time DESC";
    $q2 = "SELECT DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, c.time as time, c.erst as last, a.id as id, MIN(c.id) AS firstnew, d.name as author
        FROM prefix_topics a
          LEFT JOIN prefix_forums b ON b.id = a.fid
          LEFT JOIN prefix_posts c ON c.tid = a.id
          LEFT JOIN prefix_user d ON c.erstid = d.id
          LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
          LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
          LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
        WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
          AND c.time >= ".$_SESSION['lastlogin']."
        GROUP BY b.id,a.id, a.name
        ORDER BY c.time DESC";
    $x = time() - (3600 * 24 * 360);
    if ($such == 'aubt') {
        $where = "a.rep = 0";
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    } elseif ($such == 'augt') {
        $where = "c.time >= ".$_SESSION['lastlogin'];
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q2));
    } elseif ($such == 'aeit') {
        $where = "c.erstid = ".$uid;
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    }
    $MPL = db_make_sites ($page , "", $limit , 'index.php?forum-'.$such.($such == 'aeit' ? '-'.$uid : '') , "" , $gAnz);
    
    $tpl = new tpl('forum/search');
    $q = db_query($q." LIMIT $anfang,$limit");
    $class = '';
    $tpl->set_out('gAnz',$gAnz,0);
    while($r = db_fetch_assoc($q) ) {
        $class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
        $r['class'] = $class;
        $r['ctime'] = db_result(db_query("SELECT MAX(time) FROM prefix_posts WHERE tid = ".$r['id']),0,0);
        $r['ord'] = forum_get_ordner($r['ctime'],$r['id'],$r['fid']);
        $r['link'] = 'forum-showposts-'.$r['id'];
        if ($menu->get(1) == 'aeit') {
            $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
        } elseif ($such == 'aubt') {
            $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
        } else {
            $r['author'] = ' <span style="color:#666666">'.$lang['newpost'].' '.$lang['from'].':</span> '.$r['author'];
            $r['postsbefore'] = db_count_query('SELECT COUNT(id) FROM prefix_posts WHERE tid = '.$r['id'].' AND id < '.$r['firstnew']);
            $r['page'] = ceil(($r['postsbefore']+1)/$allgAr['Fpanz']);
            $r['link'] .= '-p'.$r['page'].'#'.$r['firstnew'];
        }
    	
    		$monatsnamen = array( '','Jan','Feb','M&auml;r', 'Apr','Mai','Jun', 'Jul','Aug','Sep', 'Okt','Nov','Dez');
    		$month_current = $monatsnamen [gmdate('n')];
    		$tag = array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag');
    		
    	
    	$r['date'] = $tag[date('w',$r['time'])].', '.date( 'd', $r['time']).'. '.$monatsnamen[gmdate('n', $r['time'])].' '.date('Y - H:i', $r['time']); 
    
        $tpl->set_ar_out($r,1);
    }
    $tpl->set_out('MPL',$MPL,2);
    if ($such == 'aeit') {
        $tpl->set_out('name',$name,3);
    }
    
    $design->footer();
    ?>
    0 Mitglieder finden den Beitrag gut.
  20. #20
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Bin mir jetzt nicht ganz sicher, aber bei kurzer Prüfung habe ich eine Vermutung. Entferne mal das DISTINCT aus Zeile 84, so dass nur noch COUNT(a.id) da steht.

    } elseif ($such == 'aeit') {
        $where = "c.erstid = ".$uid;
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    }
    rules :: doku :: faq :: linkus
    1 Mitglieder finden den Beitrag gut.
  21. #21
    User Pic
    Galle81 gelöschter User
    Hi,

    es scheint zu Funktionieren. lächeln

    Danke schon mal.

    Gibt es eigentlich noch ein Trick, damit man bei den vorhandenen Beiträgen die dort angezeigt werden, direkt zum Beitrag gelangt, statt nur zum Thema?

    Mfg, Galle
    0 Mitglieder finden den Beitrag gut.
  22. #22
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Sollte auch gehen. Probier mal folgende Anpassung:

    $s = "DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, c.time as time, c.erst as last, a.id as id, d.name as author";

    zu
    $s = "DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, MIN(c.id) AS firstnew, c.time as time, c.erst as last, a.id as id, d.name as author";


    und

        if ($menu->get(1) == 'aeit') {
            $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];

    zu
        if ($menu->get(1) == 'aeit') {
            $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
            $r['postsbefore'] = db_count_query('SELECT COUNT(id) FROM prefix_posts WHERE tid = '.$r['id'].' AND id < '.$r['firstnew']);
            $r['page'] = ceil(($r['postsbefore']+1)/$allgAr['Fpanz']);
            $r['link'] .= '-p'.$r['page'].'#'.$r['firstnew'];


    Habe es nicht getestet!
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
  23. #23
    User Pic
    Galle81 gelöschter User
    Dann wird bei mir leider nur 1 Beitrag angezeigt.
    Ich denke mal, dass es mit dem firstnew Probleme gibt, da es ja eigentlich mit der augt Abfrage zusammen hängt, sprich neue Beiträge seit dem letzten Login.

    Mfg, Galle
    0 Mitglieder finden den Beitrag gut.
  24. #24
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Sollte keine Rolle spielen, deshalb wurde die DB Abfrage erweitert.
    Poste nochmal deinen aktuellen Code.
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
  25. #25
    User Pic
    Galle81 gelöschter User
    Bitte schön:
    <?php
    #   Copyright by: Manuel Staechele
    #   Support: www.ilch.de
    
    
    defined ('main') or die ( 'no direct access' );
    
    $such = $menu->get(1);
    
    if ($such == 'aeit') {
        if (isset($_POST['name'])) {
            $name = escape($_POST['name'],'string');
            $uid = @db_result(db_query("SELECT id FROM prefix_user WHERE name = BINARY '".$name."'"));
            if ($uid > 0) {
                $menu->set_url(2,$uid);
            }
        }
        if ($menu->get(2) >= 1 AND $menu->get(2) != $_SESSION['authid']) {
        $uid = $menu->get(2);
        $name = get_n($uid);
        $mtitle = $lang['posts'].' '.$lang['from'].' '.$name;
        } else {
            $uid = $_SESSION['authid'];
            $mtitle = $lang['ownposts'];
            $name = '';
        }
    } elseif ($such == 'aubt') {
        $mtitle = $lang['topicwithnoreply'];
    } else {
        $mtitle = $lang['newtopicssincelastvisit'];
    }
    
    $title = $allgAr['title'].' :: Forum :: '.$mtitle;
    $hmenu  = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> &raquo; </b> '.$mtitle;
    $design = new design ( $title , $hmenu, 1);
    $design->header();
    
    # mehrere seiten falls gefordert
    $limit = 25;  // Limit
    $page = ($menu->getE('p') > 0 ? $menu->getE('p') : 1 );
    $anfang = ($page - 1) * $limit;
    
    $s = "DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, c.time as time, c.erst as last, a.id as id, d.name as author";
    $q = "SELECT {SELECT}
      FROM prefix_topics a
        LEFT JOIN prefix_forums b ON b.id = a.fid
        LEFT JOIN prefix_posts c ON c.tid = a.id
        LEFT JOIN prefix_user d ON c.erstid = d.id
        LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
        LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
        LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
      WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
         AND {WHERE}
      ORDER BY c.time DESC";
    $q2 = "SELECT DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, c.time as time, c.erst as last, a.id as id, MIN(c.id) AS firstnew, d.name as author
        FROM prefix_topics a
          LEFT JOIN prefix_forums b ON b.id = a.fid
          LEFT JOIN prefix_posts c ON c.tid = a.id
          LEFT JOIN prefix_user d ON c.erstid = d.id
          LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
          LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
          LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
        WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
          AND c.time >= ".$_SESSION['lastlogin']."
        GROUP BY b.id,a.id, a.name
        ORDER BY c.time DESC";
    $x = time() - (3600 * 24 * 360);
    if ($such == 'aubt') {
        $where = "a.rep = 0";
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    } elseif ($such == 'augt') {
        $where = "c.time >= ".$_SESSION['lastlogin'];
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q2));
    } elseif ($such == 'aeit') {
        $where = "c.erstid = ".$uid;
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    }
    $MPL = db_make_sites ($page , "", $limit , 'index.php?forum-'.$such.($such == 'aeit' ? '-'.$uid : '') , "" , $gAnz);
    
    $tpl = new tpl('forum/search');
    $q = db_query($q." LIMIT $anfang,$limit");
    $class = '';
    $tpl->set_out('gAnz',$gAnz,0);
    while($r = db_fetch_assoc($q) ) {
        $class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
        $r['class'] = $class;
        $r['ctime'] = db_result(db_query("SELECT MAX(time) FROM prefix_posts WHERE tid = ".$r['id']),0,0);
        $r['ord'] = forum_get_ordner($r['ctime'],$r['id'],$r['fid']);
        $r['link'] = 'forum-showposts-'.$r['id'];
        if ($menu->get(1) == 'aeit') {
            $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
        } elseif ($such == 'aubt') {
            $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
        } else {
            $r['author'] = ' <span style="color:#666666">'.$lang['newpost'].' '.$lang['from'].':</span> '.$r['author'];
            $r['postsbefore'] = db_count_query('SELECT COUNT(id) FROM prefix_posts WHERE tid = '.$r['id'].' AND id < '.$r['firstnew']);
            $r['page'] = ceil(($r['postsbefore']+1)/$allgAr['Fpanz']);
            $r['link'] .= '-p'.$r['page'].'#'.$r['firstnew'];
        }
    	
    		$monatsnamen = array( '','Jan','Feb','M&auml;r', 'Apr','Mai','Jun', 'Jul','Aug','Sep', 'Okt','Nov','Dez');
    		$month_current = $monatsnamen [gmdate('n')];
    		$tag = array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag');
    		
    	
    	$r['date'] = $tag[date('w',$r['time'])].', '.date( 'd', $r['time']).'. '.$monatsnamen[gmdate('n', $r['time'])].' '.date('Y - H:i', $r['time']); 
    
        $tpl->set_ar_out($r,1);
    }
    $tpl->set_out('MPL',$MPL,2);
    if ($such == 'aeit') {
        $tpl->set_out('name',$name,3);
    }
    
    $design->footer();
    ?>


    Oder hier mit der Änderung der Abfrage für den Direktlink:
    <?php
    #   Copyright by: Manuel Staechele
    #   Support: www.ilch.de
    
    
    defined ('main') or die ( 'no direct access' );
    
    $such = $menu->get(1);
    
    if ($such == 'aeit') {
        if (isset($_POST['name'])) {
            $name = escape($_POST['name'],'string');
            $uid = @db_result(db_query("SELECT id FROM prefix_user WHERE name = BINARY '".$name."'"));
            if ($uid > 0) {
                $menu->set_url(2,$uid);
            }
        }
        if ($menu->get(2) >= 1 AND $menu->get(2) != $_SESSION['authid']) {
        $uid = $menu->get(2);
        $name = get_n($uid);
        $mtitle = $lang['posts'].' '.$lang['from'].' '.$name;
        } else {
            $uid = $_SESSION['authid'];
            $mtitle = $lang['ownposts'];
            $name = '';
        }
    } elseif ($such == 'aubt') {
        $mtitle = $lang['topicwithnoreply'];
    } else {
        $mtitle = $lang['newtopicssincelastvisit'];
    }
    
    $title = $allgAr['title'].' :: Forum :: '.$mtitle;
    $hmenu  = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> &raquo; </b> '.$mtitle;
    $design = new design ( $title , $hmenu, 1);
    $design->header();
    
    # mehrere seiten falls gefordert
    $limit = 25;  // Limit
    $page = ($menu->getE('p') > 0 ? $menu->getE('p') : 1 );
    $anfang = ($page - 1) * $limit;
    
    $s = "DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, MIN(c.id) AS firstnew, c.time as time, c.erst as last, a.id as id, d.name as author";
    $q = "SELECT {SELECT}
      FROM prefix_topics a
        LEFT JOIN prefix_forums b ON b.id = a.fid
        LEFT JOIN prefix_posts c ON c.tid = a.id
        LEFT JOIN prefix_user d ON c.erstid = d.id
        LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
        LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
        LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
      WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
         AND {WHERE}
      ORDER BY c.time DESC";
    $q2 = "SELECT DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, c.time as time, c.erst as last, a.id as id, MIN(c.id) AS firstnew, d.name as author
        FROM prefix_topics a
          LEFT JOIN prefix_forums b ON b.id = a.fid
          LEFT JOIN prefix_posts c ON c.tid = a.id
          LEFT JOIN prefix_user d ON c.erstid = d.id
          LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
          LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
          LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
        WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
          AND c.time >= ".$_SESSION['lastlogin']."
        GROUP BY b.id,a.id, a.name
        ORDER BY c.time DESC";
    $x = time() - (3600 * 24 * 360);
    if ($such == 'aubt') {
        $where = "a.rep = 0";
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    } elseif ($such == 'augt') {
        $where = "c.time >= ".$_SESSION['lastlogin'];
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q2));
    } elseif ($such == 'aeit') {
        $where = "c.erstid = ".$uid;
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    }
    $MPL = db_make_sites ($page , "", $limit , 'index.php?forum-'.$such.($such == 'aeit' ? '-'.$uid : '') , "" , $gAnz);
    
    $tpl = new tpl('forum/search');
    $q = db_query($q." LIMIT $anfang,$limit");
    $class = '';
    $tpl->set_out('gAnz',$gAnz,0);
    while($r = db_fetch_assoc($q) ) {
        $class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
        $r['class'] = $class;
        $r['ctime'] = db_result(db_query("SELECT MAX(time) FROM prefix_posts WHERE tid = ".$r['id']),0,0);
        $r['ord'] = forum_get_ordner($r['ctime'],$r['id'],$r['fid']);
        $r['link'] = 'forum-showposts-'.$r['id'];
        if ($menu->get(1) == 'aeit') {
        $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
        $r['postsbefore'] = db_count_query('SELECT COUNT(id) FROM prefix_posts WHERE tid = '.$r['id'].' AND id < '.$r['firstnew']);
        $r['page'] = ceil(($r['postsbefore']+1)/$allgAr['Fpanz']);
        $r['link'] .= '-p'.$r['page'].'#'.$r['firstnew'];
        } elseif ($such == 'aubt') {
            $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
        } else {
            $r['author'] = ' <span style="color:#666666">'.$lang['newpost'].' '.$lang['from'].':</span> '.$r['author'];
            $r['postsbefore'] = db_count_query('SELECT COUNT(id) FROM prefix_posts WHERE tid = '.$r['id'].' AND id < '.$r['firstnew']);
            $r['page'] = ceil(($r['postsbefore']+1)/$allgAr['Fpanz']);
            $r['link'] .= '-p'.$r['page'].'#'.$r['firstnew'];
        }
    	
    		$monatsnamen = array( '','Jan','Feb','M&auml;r', 'Apr','Mai','Jun', 'Jul','Aug','Sep', 'Okt','Nov','Dez');
    		$month_current = $monatsnamen [gmdate('n')];
    		$tag = array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag');
    		
    	
    	$r['date'] = $tag[date('w',$r['time'])].', '.date( 'd', $r['time']).'. '.$monatsnamen[gmdate('n', $r['time'])].' '.date('Y - H:i', $r['time']); 
    
        $tpl->set_ar_out($r,1);
    }
    $tpl->set_out('MPL',$MPL,2);
    if ($such == 'aeit') {
        $tpl->set_out('name',$name,3);
    }
    
    $design->footer();
    ?>


    Mfg, Galle
    0 Mitglieder finden den Beitrag gut.
  26. #26
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Probiers mal so:

    <?php
    #   Copyright by: Manuel Staechele
    #   Support: www.ilch.de
     
     
    defined ('main') or die ( 'no direct access' );
     
    $such = $menu->get(1);
     
    if ($such == 'aeit') {
        if (isset($_POST['name'])) {
            $name = escape($_POST['name'],'string');
            $uid = @db_result(db_query("SELECT id FROM prefix_user WHERE name = BINARY '".$name."'"));
            if ($uid > 0) {
                $menu->set_url(2,$uid);
            }
        }
        if ($menu->get(2) >= 1 AND $menu->get(2) != $_SESSION['authid']) {
        $uid = $menu->get(2);
        $name = get_n($uid);
        $mtitle = $lang['posts'].' '.$lang['from'].' '.$name;
        } else {
            $uid = $_SESSION['authid'];
            $mtitle = $lang['ownposts'];
            $name = '';
        }
    } elseif ($such == 'aubt') {
        $mtitle = $lang['topicwithnoreply'];
    } else {
        $mtitle = $lang['newtopicssincelastvisit'];
    }
     
    $title = $allgAr['title'].' :: Forum :: '.$mtitle;
    $hmenu  = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> &raquo; </b> '.$mtitle;
    $design = new design ( $title , $hmenu, 1);
    $design->header();
     
    # mehrere seiten falls gefordert
    $limit = 25;  // Limit
    $page = ($menu->getE('p') > 0 ? $menu->getE('p') : 1 );
    $anfang = ($page - 1) * $limit;
     
    $s = "DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, c.id AS postid, c.time as time, c.erst as last, a.id as id, d.name as author";
    $q = "SELECT {SELECT}
      FROM prefix_topics a
        LEFT JOIN prefix_forums b ON b.id = a.fid
        LEFT JOIN prefix_posts c ON c.tid = a.id
        LEFT JOIN prefix_user d ON c.erstid = d.id
        LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
        LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
        LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
      WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
         AND {WHERE}
      ORDER BY c.time DESC";
    $q2 = "SELECT DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, c.time as time, c.erst as last, a.id as id, MIN(c.id) AS firstnew, d.name as author
        FROM prefix_topics a
          LEFT JOIN prefix_forums b ON b.id = a.fid
          LEFT JOIN prefix_posts c ON c.tid = a.id
          LEFT JOIN prefix_user d ON c.erstid = d.id
          LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
          LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
          LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
        WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
          AND c.time >= ".$_SESSION['lastlogin']."
        GROUP BY b.id,a.id, a.name
        ORDER BY c.time DESC";
    $x = time() - (3600 * 24 * 360);
    if ($such == 'aubt') {
        $where = "a.rep = 0";
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    } elseif ($such == 'augt') {
        $where = "c.time >= ".$_SESSION['lastlogin'];
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q2));
    } elseif ($such == 'aeit') {
        $where = "c.erstid = ".$uid;
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    }
    $MPL = db_make_sites ($page , "", $limit , 'index.php?forum-'.$such.($such == 'aeit' ? '-'.$uid : '') , "" , $gAnz);
     
    $tpl = new tpl('forum/search');
    $q = db_query($q." LIMIT $anfang,$limit");
    $class = '';
    $tpl->set_out('gAnz',$gAnz,0);
    while($r = db_fetch_assoc($q) ) {
        $class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
        $r['class'] = $class;
        $r['ctime'] = db_result(db_query("SELECT MAX(time) FROM prefix_posts WHERE tid = ".$r['id']),0,0);
        $r['ord'] = forum_get_ordner($r['ctime'],$r['id'],$r['fid']);
        $r['link'] = 'forum-showposts-'.$r['id'];
        if ($menu->get(1) == 'aeit') {
    		$r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
    		$r['postsbefore'] = db_count_query('SELECT COUNT(id) FROM prefix_posts WHERE tid = '.$r['id'].' AND id < '.$r['postid']);
    		$r['page'] = ceil(($r['postsbefore']+1)/$allgAr['Fpanz']);
    		$r['link'] .= '-p'.$r['page'].'#'.($r['postsbefore']+1);		
        } elseif ($such == 'aubt') {
            $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
        } else {
            $r['author'] = ' <span style="color:#666666">'.$lang['newpost'].' '.$lang['from'].':</span> '.$r['author'];
            $r['postsbefore'] = db_count_query('SELECT COUNT(id) FROM prefix_posts WHERE tid = '.$r['id'].' AND id < '.$r['firstnew']);
            $r['page'] = ceil(($r['postsbefore']+1)/$allgAr['Fpanz']);
            $r['link'] .= '-p'.$r['page'].'#'.$r['firstnew'];
        }
         
            $monatsnamen = array( '','Jan','Feb','M&auml;r', 'Apr','Mai','Jun', 'Jul','Aug','Sep', 'Okt','Nov','Dez');
            $month_current = $monatsnamen [gmdate('n')];
            $tag = array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag');
             
         
        $r['date'] = $tag[date('w',$r['time'])].', '.date( 'd', $r['time']).'. '.$monatsnamen[gmdate('n', $r['time'])].' '.date('Y - H:i', $r['time']); 
     
        $tpl->set_ar_out($r,1);
    }
    $tpl->set_out('MPL',$MPL,2);
    if ($such == 'aeit') {
        $tpl->set_out('name',$name,3);
    }
     
    $design->footer();
    ?>



    Zuletzt modifiziert von Lord|Schirmer am 23.05.2015 - 19:40:16
    rules :: doku :: faq :: linkus
    1 Mitglieder finden den Beitrag gut.
  27. #27
    User Pic
    Galle81 gelöschter User
    Fast lächeln

    Die richtige Seite wird so schon mal angezeigt, außer das nicht die post id berechnet wird, sondern der Beitrag in dem Thema, sprich (#55. Beitrag zu diesem Thema).

    Mfg, Galle
    0 Mitglieder finden den Beitrag gut.
  28. #28
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Jetzt aber ... war halt alles ohne zu testen zwinker

    <?php
    #   Copyright by: Manuel Staechele
    #   Support: www.ilch.de
      
      
    defined ('main') or die ( 'no direct access' );
      
    $such = $menu->get(1);
      
    if ($such == 'aeit') {
        if (isset($_POST['name'])) {
            $name = escape($_POST['name'],'string');
            $uid = @db_result(db_query("SELECT id FROM prefix_user WHERE name = BINARY '".$name."'"));
            if ($uid > 0) {
                $menu->set_url(2,$uid);
            }
        }
        if ($menu->get(2) >= 1 AND $menu->get(2) != $_SESSION['authid']) {
        $uid = $menu->get(2);
        $name = get_n($uid);
        $mtitle = $lang['posts'].' '.$lang['from'].' '.$name;
        } else {
            $uid = $_SESSION['authid'];
            $mtitle = $lang['ownposts'];
            $name = '';
        }
    } elseif ($such == 'aubt') {
        $mtitle = $lang['topicwithnoreply'];
    } else {
        $mtitle = $lang['newtopicssincelastvisit'];
    }
      
    $title = $allgAr['title'].' :: Forum :: '.$mtitle;
    $hmenu  = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> &raquo; </b> '.$mtitle;
    $design = new design ( $title , $hmenu, 1);
    $design->header();
      
    # mehrere seiten falls gefordert
    $limit = 25;  // Limit
    $page = ($menu->getE('p') > 0 ? $menu->getE('p') : 1 );
    $anfang = ($page - 1) * $limit;
      
    $s = "DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, c.id AS postid, c.time as time, c.erst as last, a.id as id, d.name as author";
    $q = "SELECT {SELECT}
      FROM prefix_topics a
        LEFT JOIN prefix_forums b ON b.id = a.fid
        LEFT JOIN prefix_posts c ON c.tid = a.id
        LEFT JOIN prefix_user d ON c.erstid = d.id
        LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
        LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
        LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
      WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
         AND {WHERE}
      ORDER BY c.time DESC";
    $q2 = "SELECT DISTINCT b.id as fid, a.name as titel, a.rep, a.hit, c.time as time, c.erst as last, a.id as id, MIN(c.id) AS firstnew, d.name as author
        FROM prefix_topics a
          LEFT JOIN prefix_forums b ON b.id = a.fid
          LEFT JOIN prefix_posts c ON c.tid = a.id
          LEFT JOIN prefix_user d ON c.erstid = d.id
          LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = b.view
          LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = b.reply
          LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = b.start
        WHERE (((b.view >= ".$_SESSION['authright']." AND b.view <= 0) OR
                (b.reply >= ".$_SESSION['authright']." AND b.reply <= 0) OR
                (b.start >= ".$_SESSION['authright']." AND b.start <= 0)) OR
                (vg.fid IS NOT NULL OR rg.fid IS NOT NULL OR sg.fid IS NOT NULL OR ".$_SESSION['authright']." = -9))
          AND c.time >= ".$_SESSION['lastlogin']."
        GROUP BY b.id,a.id, a.name
        ORDER BY c.time DESC";
    $x = time() - (3600 * 24 * 360);
    if ($such == 'aubt') {
        $where = "a.rep = 0";
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    } elseif ($such == 'augt') {
        $where = "c.time >= ".$_SESSION['lastlogin'];
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(DISTINCT a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q2));
    } elseif ($such == 'aeit') {
        $where = "c.erstid = ".$uid;
        $gAnz  = @db_result(db_query(str_replace('{WHERE}',$where,str_replace('{SELECT}',' COUNT(a.id)',$q))),0);
        $q     = str_replace('{WHERE}',$where,str_replace('{SELECT}',$s,$q));
    }
    $MPL = db_make_sites ($page , "", $limit , 'index.php?forum-'.$such.($such == 'aeit' ? '-'.$uid : '') , "" , $gAnz);
      
    $tpl = new tpl('forum/search');
    $q = db_query($q." LIMIT $anfang,$limit");
    $class = '';
    $tpl->set_out('gAnz',$gAnz,0);
    while($r = db_fetch_assoc($q) ) {
        $class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
        $r['class'] = $class;
        $r['ctime'] = db_result(db_query("SELECT MAX(time) FROM prefix_posts WHERE tid = ".$r['id']),0,0);
        $r['ord'] = forum_get_ordner($r['ctime'],$r['id'],$r['fid']);
        $r['link'] = 'forum-showposts-'.$r['id'];
        if ($menu->get(1) == 'aeit') {
            $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
            $r['postsbefore'] = db_count_query('SELECT COUNT(id) FROM prefix_posts WHERE tid = '.$r['id'].' AND id < '.$r['postid']);
            $r['page'] = ceil(($r['postsbefore']+1)/$allgAr['Fpanz']);
            $r['link'] .= '-p'.$r['page'].'#'.$r['postid'];        
        } elseif ($such == 'aubt') {
            $r['author'] = ' <span style="color:#666666">'.$lang['from'].':</span> '.$r['author'];
        } else {
            $r['author'] = ' <span style="color:#666666">'.$lang['newpost'].' '.$lang['from'].':</span> '.$r['author'];
            $r['postsbefore'] = db_count_query('SELECT COUNT(id) FROM prefix_posts WHERE tid = '.$r['id'].' AND id < '.$r['firstnew']);
            $r['page'] = ceil(($r['postsbefore']+1)/$allgAr['Fpanz']);
            $r['link'] .= '-p'.$r['page'].'#'.$r['firstnew'];
        }
          
            $monatsnamen = array( '','Jan','Feb','M&auml;r', 'Apr','Mai','Jun', 'Jul','Aug','Sep', 'Okt','Nov','Dez');
            $month_current = $monatsnamen [gmdate('n')];
            $tag = array('Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag');
              
          
        $r['date'] = $tag[date('w',$r['time'])].', '.date( 'd', $r['time']).'. '.$monatsnamen[gmdate('n', $r['time'])].' '.date('Y - H:i', $r['time']); 
      
        $tpl->set_ar_out($r,1);
    }
    $tpl->set_out('MPL',$MPL,2);
    if ($such == 'aeit') {
        $tpl->set_out('name',$name,3);
    }
      
    $design->footer();
    ?>
    rules :: doku :: faq :: linkus
    1 Mitglieder finden den Beitrag gut.
  29. #29
    User Pic
    Galle81 gelöschter User
    Passt perfekt lachen

    Vielen Dank und allen ein schönes Pfingstfest gewünscht.

    Mfg, Galle
    1 Mitglieder finden den Beitrag gut.
  30. #30
    User Pic
    Lord|Schirmer Administrator
    Registriert seit
    21.03.2007
    Beiträge
    7.675
    Beitragswertungen
    1212 Beitragspunkte
    Gern geschehen ... Dir auch.
    rules :: doku :: faq :: linkus
    0 Mitglieder finden den Beitrag gut.
Geschlossen

Zurück zu Allgemein

Optionen: Bei einer Antwort zu diesem Thema eine eMail erhalten