<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2001 by Francisco Burzi (fbc@mandrakesoft.com)         */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/************************************************************************/
/* Additional Disclaimer:   DYNMETAKEYS-1.1.2                            */
/* ======================                                               */
/* This file was modificated by Bernd Kamm (webmaster@be-ka.de)         */
/* http://be-ka.de                                                      */
/* For the modifications: Copyright (c)2002 by Bernd Kamm, Nuernberg,FRG*/
/* This Modification gives possability to generate dynamic META-TAG KEY */
/* WORDS and MEATE - description for news generated by article.php.     */
/* This Modification is part of the new administration-module           */
/* DYNMETAKEYS Version 1.1 made by Bernd Kamm. This new Admin-Module is */
/* build as a tribute to the great work of Francisco Burzi.             */
/* These new Admin-Module: DYNMETAKEYS Version 1.1 is free software.    */
/* You can redistribute it and/or modify it under the terms of the      */
/* GNU General Public License as published by                           */
/* the Free Software Foundation; either version 2 of the License.       */
/* Modifications are marked by comments: "//mod beka"                   */
/* DYNMETAKEYS is part of a new phpnukemodule for building static pages */
/* with phpnuke - first release of the complete Module march 2002, stay  */
/* tuned ;-) or register at http://be-ka.de for information              */
/************************************************************************/

if (eregi("meta.php",$PHP_SELF)) {
    Header("Location: ../index.php");
    die();
}
global $dynkeys, $metatime, $description, $date;
//mod dynamic metakeys
//statkeys here you must insert your STATIC META-Keywords:
$statkeys = "insert, your, static, keywords";
// actual date in the Meta name=Date, if you don't like uncomment meta tage date above//
$metatime = date("Y-m-d")."T". date("H:i:s");

dynmeta();
//static or dynmaic keywords?
 if (!$dynkeys){
    $metakeys = $statkeys;
    }
 else {
      $metakeys = ereg_replace("\n", "", $dynkeys);
      }
//static or dynamic description
 if (!$description){
    $description = $slogan;
 }
 else {
      $description = ereg_replace("\n", "", $description);
 }
//actual date or article date
 if (!$date){
    $datetime = $metatime;
 }
 else {
      $datetime = ereg_replace(" ", "T", $date);
 }
//end mod

echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset="._CHARSET."\">\n";
echo "<META HTTP-EQUIV=\"EXPIRES\" CONTENT=\"0\">\n";
//mod by beka new METATAG DATE!
echo "<META NAME=\"DATE\" CONTENT=\"$datetime\">\n";
// end mod
echo "<META NAME=\"RESOURCE-TYPE\" CONTENT=\"DOCUMENT\">\n";
echo "<META NAME=\"DISTRIBUTION\" CONTENT=\"GLOBAL\">\n";
echo "<META NAME=\"AUTHOR\" CONTENT=\"$sitename\">\n";
echo "<META NAME=\"COPYRIGHT\" CONTENT=\"Copyright (c) 2001 by $sitename\">\n";
// mod beka var $metakeys
echo "<META NAME=\"KEYWORDS\" CONTENT=\"$metakeys\">\n";
// mod beka dynamic description
echo "<META NAME=\"DESCRIPTION\" CONTENT=\"$description\">\n";
//end mod
echo "<META NAME=\"ROBOTS\" CONTENT=\"INDEX, FOLLOW\">\n";
echo "<META NAME=\"REVISIT-AFTER\" CONTENT=\"7 DAYS\">\n";
echo "<META NAME=\"RATING\" CONTENT=\"GENERAL\">\n";
echo "<META NAME=\"GENERATOR\" CONTENT=\"PHP-Nuke $Version_Num - http://phpnuke.org\">\n";

//mod beka
function dynmeta(){
//-------------------------------------------------------
// selects keywords and description from table metakeys
// selects article Date/time from table stories

         global $prefix, $dbi, $dynkeys, $description, $date;
         $remote = getenv ("REMOTE_ADDR");
         $uri = getenv ("REQUEST_URI");
         //echo "remote: $remote,<br>\n"
         //."uri: $uri<br>\n";

         if (eregi("article\&sid=([0-9]{1,5})",$uri,$regs)){
            //debug
            //echo "<b>debug all true!</b><br><br>\n";
            //echo "regs1: $regs[1]<br>\n";
            $storyid = $regs[1];
            $result = sql_query("select keywords, description from $prefix"._metakeys." WHERE storyid='$storyid'", $dbi);
            while(list($dynkeys, $description) = sql_fetch_row($result, $dbi)){
                 $result2 = sql_query("select time from $prefix"._stories." WHERE sid='$storyid'", $dbi);
                 while(list($date) = sql_fetch_row($result2, $dbi)){
                   return $date;
                   return $dynkeys;
                   return $description;
                 }
            }
         }
} //ende func

?>
