<?php

if ( ! @include_once( './mainfile.php' ) ) { exit( '!! INCLUDE ERROR. ACCESS DENIED !!' ); }
error_reporting( _E_VALUE );


/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | myPHPNuke Version 188_8 RC2                                          |
// +----------------------------------------------------------------------+
// | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html              |
// +----------------------------------------------------------------------+
// | Support: http://myphpnuke.com/                                       |
// +----------------------------------------------------------------------+
// | Author: myPHPNuke Dev Team                                           |
// +----------------------------------------------------------------------+
// | Copyright: © 2001-2004 myPHPNuke Dev Team                            |
// +----------------------------------------------------------------------+
// $Id: mymsg2_functions.php,v 1.3.2.2 2004/04/18 12:45:43 ajvwaay Exp $



/************************************************************************/
/*  myMessage II v1.2.1 (MPN Addon)                                     */
/*  Kazumi Ono                                                          */
/*  http://www.myweb.ne.jp                                              */
/*                                                                      */
/*                                                                      */
/* This addon will let you add your own messages at the top of your     */
/* home page and each category page. There is also a function to        */
/* add your own message to each topic page, but this feature            */
/* will not be used in MPN1.8.6. Only the admin can add/edit/delete     */
/* messages.                                                            */
/*                                                                      */
/************************************************************************/

function display_mymsg2(){
    global $admin, $phpEx, $mpnTables, $cat, $topic;

        if($cat>0){
            $query="SELECT title,text FROM ".$mpnTables['mymsg2']." WHERE catid='$cat' and topicid=0 and display=1";
        }elseif($topic>0){
            $query="SELECT title,text FROM ".$mpnTables['mymsg2']." WHERE catid=0 and topicid=$topic and display=1";
        }else{
            $query="SELECT title,text FROM ".$mpnTables['mymsg2']." WHERE catid=0 and topicid=0 and display=1 ORDER BY time DESC";
        }

    $result=mysql_query("$query");
    if(mysql_num_rows($result)>0){
        while(list($title,$text)=mysql_fetch_row($result)){
            $title = StripSlashes($title);
            $text = StripSlashes($text);
            if(isset($admin)){
                $text .= "<br><br>[<a href=\"admin.$phpEx?fct=mymsg2\">".translate("Edit"). "</a>]";
            }
            themecenterposts($title, $text);
        }
    }
}

?>
