Jump to content
InvisionCommunity.de - Der Deutsche Invision Community Support
Sign in to follow this  
Koly007

Sitemap von 1.1 für 1.3

Recommended Posts

Hallo!

Also hab grad auf Ibforen folgenden Code gefunden..

<?php

    /*

    * Sitemap Builder for InvisionPowerBoard (IPB)

    * Version 1.0.1

    * Created 26/01/2003

    * Changed 27/01/2003

    * Check www.ibresource.de for updates!

    *

    * Copyright (c) 2003 by unknown,

    * this and all source!

    * PLEASE DO NOT REDISTRIBUTE THIS SOURCE,

    * CHANGING THIS TO FIT YOUR(YOUR!) NEEDS IS OK.

    */


    /*Forum id`s that will be not displayed,

    * divided by a '|' e.g. $hidden = "0|1|2"

    * so Forum with id 0|1 and 2 will not be displayed

    */

    $hidden = "";

?>




<?php require('conf_global.php');?><!doctype html public "-//W3C//DTD HTML 4.0 //EN">

<html>

<head>

      <title><?php print $INFO['board_name'];?> - Sitemap</title>


      <link href="sm.css" rel="stylesheet">

</head>

<body>

<?php




/**

* class sitemap

*

* { Creating a searchengine-friendly Sitemap for the Invision Power Board }

*

*/

class sitemap {


   /**

   * sitemap::$query

   *

   * { Result resource }

   *

   */

   var $query = "";

   /**

   * sitemap::$HTML

   *

   * { HTML output }

   *

   */

   var $HTML = "";

   /**

   * sitemap::$link

   *

   * { mySQL link identifier }

   *

   */

   var $link = FALSE;

   /**

   * sitemap::$row

   *

   * { Array with results from a query }

   *

   */

   var $row = array();


   /**

   * sitemap::smConnect()

   *

   * { connecting trough the DB by using the conf_global.php }

   *

   * @param string $str

   */

   function smConnect($str = ""){

       global $INFO;


       $this->link = @mysql_connect($INFO['sql_host'],$INFO['sql_user'],$INFO['sql_pass']);


       if($this->link){

           $db = @mysql_select_db($INFO['sql_database']);

       }

       if($this->link && $db){

           return TRUE;

       }else{

           return FALSE;

       }

   }


   /**

   * sitemap::smQuery()

   *

   * { Sends a query, only if the connection is established }

   *

   * @param string $str

   */

   function smQuery($str = ""){

       if(isset($str) && $this->link){

           $this->query = @mysql_query($str,$this->link);

       }

       if($this->query){

           return TRUE;

       }else{

           print mysql_error();

       }

   }


   /**

   * sitemap::smGetSitemap()

   *

   * { getting the sitemap with all it`s content }

   *

   */

   function smGetSitemap(){

       global $INFO,$hidden;

       if($this->link){

           $this->smQuery("SELECT * FROM `$INFO[sql_tbl_prefix]categories` WHERE `state` = '1' ORDER BY `position` ASC");

   }

       if($hidden != ""){

       $hidden = explode("|", $hidden);

       $ext = "";

       global $ext;



           foreach($hidden as $key => $value){

           $ext .= "AND `id` != '$value' ";

           }

       }else{

           $ext = "";

           global $ext;

       }


       

       $this->HTML .= "\n<!-- SITEMAP START -->\n\n\n";

       $this->HTML .= "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>\n";

       $this->HTML .= "<tr>\n<td align=\"center\" valign=\"top\" class=\"headline\">\n";

       $this->HTML .= "<p><strong>\n<a href=\"".$INFO['board_url']."\">".$INFO['board_name']."</a> - Sitemap\n</strong></p>\n<br>\n";

       $this->HTML .= "</td>\n</tr>\n\n";


       $i = 0;

       while($this->row = mysql_fetch_array($this->query)){


           $this->HTML .= "\n\n<!-- CATEGORY START -->\n";

           $this->HTML .= "<tr>\n";

           $this->HTML .= "<td align=\"left\" valign=\"top\" class=\"kategorie\">\n<br>\n<br>\n";


           $this->HTML .= "[KATEGORIE]&nbsp;<a href=\"show.php/c/".$this->row['id']."\">".$this->row['name']."</a>\n\n";

           $this->HTML .= " <br>\n<br>\n";

           $this->HTML .= "</td>\n</tr>\n";


           if($ext == ""){

               $queryb = mysql_query("SELECT * FROM `$INFO[sql_tbl_prefix]forums` WHERE `category` = '".$this->row[id]."' AND `status` = '1' ORDER BY `position` ASC");

           }else{

               $queryb = mysql_query("SELECT * FROM `$INFO[sql_tbl_prefix]forums` WHERE `category` = '".$this->row[id]."' AND `status` = '1' ".$ext."ORDER BY `position` ASC");

           }

           while($rowb = mysql_fetch_array($queryb)){

               $i++;

               $this->HTML .= "<tr>\n";

               $this->HTML .= "<td align=\"left\" valign=\"top\">\n";

               $this->HTML .= "<br><div id=\"".$i."b\" class=\"forum\">+ [FORUM] <a href=\"show.php/act/SF/f/$rowb[id]\">$rowb[name]</a></div>\n\n";


               $queryc = mysql_query("SELECT * FROM `$INFO[sql_tbl_prefix]topics` WHERE `forum_id` = '$rowb[id]' ORDER BY `posts` ASC");


               while($rowc = mysql_fetch_array($queryc)){

                   $this->HTML .= " <tr>\n";

                   $this->HTML .= "   <td align=\"left\" valign=\"top\">\n";

                   $this->HTML .= "    <div id=\"".$i."c\" class=\"desc\">&nbsp;|- [THEMA] <a href=\"show.php/act/ST/f/".$rowb['id']."/t/".$rowc['tid']."\">".$rowc['title']."</a></div>\n";

                   $this->HTML .= " </tr>\n   </td>";

               }


           }

           $this->HTML .= "<!-- CATEGORY END -->\n\n";



       $this->HTML .= "<br>\n";

       }

       $this->HTML .= "</table>\n\n\n";

       $this->HTML .= "<!-- SITEMAP END -->\n\n";

       print $this->HTML;

       $this->HTML = "";

   }


}


$Sitemap = new sitemap;

$Sitemap->smConnect();

$Sitemap->smGetSitemap();

?>

</body>

</html>

Diesen packt man in eine sm.php und lädt sie in das Forumhauptverzeichnis!

Wäre es möglich das jemand den Code fürs 1.3 anpasst?

http://www.tunsty.net/forum/sm.php leider kann man auf keinen Link klicken :(

Viele Grüße

Share this post


Link to post

Ich glaube das Problem liegt daran, dass er versucht localhost zu kontaktieren. Irgendwo hast du wahrscheinlich vergessen eine Variable zu definieren. wahrscheinlich in show.php. Wenn dort irgendwo localhost steht, muss das durch etwas ersetzt werden, vielleicht steht dabei ein Kommentar...

Greetz

Frog

Share this post


Link to post

Probier mal Version 1.0.2:

<?php

     /*$id

     * Sitemap Builder for InvisionPowerBoard (IPB)

     * Version 1.0.2

     * Created 26/01/2003

     * Changed 06/02/2003

     * Check www.ibresource.de for updates!

     *

     * Copyright (c) 2003 by unknown,

     * this and all source!

     * PLEASE DO NOT REDISTRIBUTE THIS SOURCE,

     * CHANGING THIS TO FIT YOUR(YOUR!) NEEDS IS OK.

     */


     /*$config

     * Basic configuration

     * You can leave this lines as it is,

     * they are set to default values.

     */



     /*$hidden['forums']

     * Set the Forum id`s to hide them.

     * Please seperate more than one id`s with an '|'

     * e.g. $hidden['forums'] = "1|2|3"; will hide forums

     * with id 1,2 and 3!

     *

     * Leave blank if there's no hidden forum

     */

     $hidden['forums'] = "";

     

     

     /*$hidden['cats']

     * Set the categorie id`s to hide them.

     * Please seperate more than one id`s with an '|'

     * e.g. $hidden['cats'] = "1|3"; will hide categories

     * with id 1 and 3!

     *

     * Leave blank if there's no hidden cat's

     */

     $hidden['cats'] = "";

     

     

     /*$end

     * END OF CONFIGURATION

     *

     * YOU SHOULD NOT (!) EDIT THE FOLLOWING LINES,

     * IF YOU DON'T KNOW WHAT YOU ARE DOING!

     */

?>




<?php require('conf_global.php');?><!doctype html public "-//W3C//DTD HTML 4.0 //EN">

<html>

<head>

       <title><?php print $INFO['board_name'];?> - Sitemap</title>


       <link href="sm.css" rel="stylesheet">

       <meta name="revisit-after" content="1 days">

       <meta name="Content-language" content="DE">

       <meta name="Robots" content="INDEX,FOLLOW">

       <meta http-equiv="Pragma" CONTENT="no-cache">

       <meta http-equiv="cache-control" content="no-cache">

</head>

<body>

<?php




/**

* class sitemap

*

* { Creating a searchengine-friendly Sitemap for the Invision Power Board }

*

*/

class sitemap {


    /**

    * sitemap::$query

    *

    * { Result resource }

    *

    */

    var $query = "";

    /**

    * sitemap::$HTML

    *

    * { HTML output }

    *

    */

    var $HTML = "";

    /**

    * sitemap::$link

    *

    * { mySQL link identifier }

    *

    */

    var $link = FALSE;

    /**

    * sitemap::$row

    *

    * { Array with results from a query }

    *

    */

    var $row = array();


    /**

    * sitemap::smConnect()

    *

    * { connecting trough the DB by using the conf_global.php }

    *

    * @param string $str

    */

    function smConnect($str = ""){

        global $INFO;


        $this->link = @mysql_connect($INFO['sql_host'],$INFO['sql_user'],$INFO['sql_pass']);


        if($this->link){

            $db = @mysql_select_db($INFO['sql_database']);

        }

        if($this->link && $db){

            return TRUE;

        }else{

            return FALSE;

        }

    }


    /**

    * sitemap::smQuery()

    *

    * { Sends a query, only if the connection is established }

    *

    * @param string $str

    */

    function smQuery($str = ""){

        if(isset($str) && $this->link){

            $this->query = @mysql_query($str,$this->link);

        }

        if($this->query){

            return TRUE;

        }else{

            print mysql_error();

        }

    }


    /**

    * sitemap::smGetSitemap()

    *

    * { getting the sitemap with all it`s content }

    *

    */

    function smGetSitemap(){

        global $INFO,$hidden;


        if($hidden['forums'] != ""){

        $hidden['forums'] = explode("|", $hidden['forums']);

        $ext['forums'] = "";

        global $ext;



            foreach($hidden['forums'] as $key => $value){

            $ext['forums'] .= "AND `id` != '$value' ";

            }

        }else{

            $ext['forums'] = "";

            global $ext;

        }

        

        if($hidden['cats'] != ""){

        $hidden['cats'] = explode("|", $hidden['cats']);

        $ext['cats'] = "";

        global $ext;



            foreach($hidden['cats'] as $key => $value){

            $ext['cats'] .= "AND `id` != '$value' ";

            }

        }else{

            $ext['cats'] = "";

            global $ext;

        }

        

        if($this->link){

            $this->smQuery("SELECT * FROM `$INFO[sql_tbl_prefix]categories` WHERE `state` = '1' ".$ext['cats']."ORDER BY `position` ASC");

        }

        

        $this->HTML .= "\n<!-- SITEMAP START -->\n\n\n";

        $this->HTML .= "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>\n";

        $this->HTML .= "<tr>\n<td align=\"center\" valign=\"top\" class=\"headline\">\n";

        $this->HTML .= "<p><strong>\n<a href=\"".$INFO['board_url']."\">".$INFO['board_name']."</a> - Sitemap\n</strong></p>\n<br>\n";

        $this->HTML .= "</td>\n</tr>\n\n";


        $i = 0;

        while($this->row = mysql_fetch_array($this->query)){


            $this->HTML .= "\n\n<!-- CATEGORY START -->\n";

            $this->HTML .= "<tr>\n";

            $this->HTML .= "<td align=\"left\" valign=\"top\" class=\"kategorie\">\n<br>\n<br>\n";


            $this->HTML .= "[KATEGORIE]&nbsp;<a href=\"show.php/c/".$this->row['id']."\">".$this->row['name']."</a>\n\n";

            $this->HTML .= " <br>\n<br>\n";

            $this->HTML .= "</td>\n</tr>\n";


            if($ext == ""){

                $queryb = mysql_query("SELECT * FROM `$INFO[sql_tbl_prefix]forums` WHERE `category` = '".$this->row[id]."' AND `status` = '1' ORDER BY `position` ASC");

            }else{

                $queryb = mysql_query("SELECT * FROM `$INFO[sql_tbl_prefix]forums` WHERE `category` = '".$this->row[id]."' AND `status` = '1' ".$ext['forums']."ORDER BY `position` ASC");

            }

            while($rowb = mysql_fetch_array($queryb)){

                $i++;

                $this->HTML .= "<tr>\n";

                $this->HTML .= "<td align=\"left\" valign=\"top\">\n";

                $this->HTML .= "<br><div id=\"".$i."b\" class=\"forum\">+ [FORUM] <a href=\"show.php/act/SF/f/$rowb[id]\">$rowb[name]</a></div>\n\n";


                $queryc = mysql_query("SELECT * FROM `$INFO[sql_tbl_prefix]topics` WHERE `forum_id` = '$rowb[id]' ORDER BY `posts` ASC");


                while($rowc = mysql_fetch_array($queryc)){

                    $this->HTML .= " <tr>\n";

                    $this->HTML .= "   <td align=\"left\" valign=\"top\">\n";

                    $this->HTML .= "    <div id=\"".$i."c\" class=\"desc\">&nbsp;|- [THEMA] <a href=\"show.php/act/ST/f/".$rowb['id']."/t/".$rowc['tid']."\">".$rowc['title']."</a></div>\n";

                    $this->HTML .= " </tr>\n   </td>";

                }


            }

            $this->HTML .= "<!-- CATEGORY END -->\n\n";



        $this->HTML .= "<br>\n";

        }

        $this->HTML .= "</table>\n\n\n";

        $this->HTML .= "<!-- SITEMAP END -->\n\n";

        print $this->HTML;

        $this->HTML = "";

    }


}


$Sitemap = new sitemap;

$Sitemap->smConnect();

$Sitemap->smGetSitemap();

?>

</body>

</html>

Funktioniert bei mir ohne Probleme :)

Edited by kingofcomedy

Share this post


Link to post

Yes ! Geht wunderbar !

Also nicht vergessen in der show.php Zeile 24

$base_url = 'http://localhost/invboard/index.php';  //Edit this to suit

anzupassen.

Share this post


Link to post

So ich habe das ganze nochmal getestet ...

Das Teil hat mal wieder Probleme mit den Zugriffsrechten :(

Als Gast werden alle Themen gepostet...

Also das was mal wider nix.... :wacko:

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×