<?PHP
    
/**
     *    Mambo Site Server Open Source Edition Version 3.0.7
     *    Dynamic portal server and Content managment engine
     *    04-05-2001
      *
     *    Copyright (C) 2000 - 2001 Miro Contruct Pty Ltd
     *    Distributed under the terms of the GNU General Public License
     *    This software may be used without warrany provided these statements are left
     *    intact and a "Powered By Mambo" appears at the bottom of each HTML page.
     *    This code is Available at http://sourceforge.net/projects/mambo
     *
     *    Site Name: Mambo Site Server Open Source Edition Version 3.0.7
     *    File Name: rightComponent.php
     *    Developers: Danny Younes - danny@miro.com.au
     *                Nicole Anderson - nicole@miro.com.au
     *    Date: 17/07/2001
     *     Version #: 3.0.7
     *    Comments: Display all modules which are to be displayed on the right.
    **/

    
$query "SELECT id, title, module FROM components WHERE publish='1' AND position='right' ORDER BY ordering";
    
$result $database->openConnectionWithReturn($query);
    while (
$row mysql_fetch_object($result)){
        
$id1 $row->id;
        
$title $row->title;
        
$module $row->module;
        if (
$module == "survey"){
            if (
$Itemid == "")
                
$Itemid 1;
            
$query1="select poll_menu.pollid AS pollID from poll_menu, poll_desc where poll_menu.menuid='$Itemid' AND poll_desc.pollID=poll_menu.pollid AND poll_desc.published=1";
            
$result1=$database->openConnectionWithReturn($query1);
            while (list(
$pollID)=mysql_fetch_array($result1)){
                if (
trim($pollID)!="0"){
                    
$query3 "SELECT pollTitle FROM poll_desc WHERE pollID='$pollID' and published=1";
                    
$result3 $database->openConnectionWithReturn($query3);
                    while (
$row mysql_fetch_object($result3)){
                        
$pollTitle $row->pollTitle;
                    }
                    if (
trim($pollTitle)!=""){
                        
$query "SELECT voteid, optionText FROM poll_data WHERE pollid='$pollID' AND optionText <> '' order by voteid";
                        
$result4 $database->openConnectionWithReturn($query);
                        
$j 0;
                        while (
$row mysql_fetch_object($result4)){
                            
$optionText[$j] = $row->optionText;
                            
$voters[$j] = $row->voteid;
                            
$j++;
                        }
                        
$components->survey($pollTitle$optionText$pollID$voters$title);
                        
$optionText="";
                    }
                }
            }
        }elseif (
$module == "newsarchive"){
            
$content="<a href=\"index.php?option=archiveNews&type=News\">Click here to find all our past news</a>
            <BR>"
;
            
$components->component($title$content);

        }elseif (
$module == "articlearchive"){
            
$content="<a href=\"index.php?option=archiveNews&type=Articles\">Click here to find all our past articles</a>
            <BR>"
;
            
$components->component($title$content);

        }else if (
$module == "login"){
            if (
$HTTP_COOKIE_VARS["usercookie"]==""){
                  
$components->AuthorLogin($title);
            }else{
                
$cryptSessionID=md5($HTTP_COOKIE_VARS["usercookie"]);
                
$query6="SELECT userid FROM session WHERE session_ID='$cryptSessionID'";
                
$result6=$database->openConnectionWithReturn($query6);
                if (
mysql_num_rows($result6)==0){
                    echo 
"<SCRIPT>document.location.href='index.php?option=logout';</SCRIPT>";
                }
            }
            echo 
"<BR>";

        }else if (
$module == "usermenu"){
            if (
$HTTP_COOKIE_VARS["usercookie"]!=""){
                
$cryptSessionID=md5($HTTP_COOKIE_VARS["usercookie"]);
                
$query6="SELECT userid FROM session WHERE session_ID='$cryptSessionID'";
                
$result6=$database->openConnectionWithReturn($query6);
                if (
mysql_num_rows($result6)!=0){
                    
$op2="showMenuComponent";
                    list(
$uid)=mysql_fetch_array($result6);
                    include (
"usermenu.php");
                }
            }
            echo 
"<BR>";

        } else if (
$module == "newsfeeds"){
            echo 
"<div class=componentHeading>$title</div>";
            include(
"newsfeeds.php");
            echo 
"<BR>";

        }elseif (
$module == "whos_online"){
            include (
"whosOnline.php");
            
$components->component($title$content);
            echo 
"<BR>";

        }elseif (
$module == "users_online"){
            include (
"onlinemodule.php");
            
$components->component($title$content);
            echo 
"<BR>";

        }else {
            
$query "SELECT content FROM component_module WHERE componentid=$id1";
            
$result5 $database->openConnectionWithReturn($query);
            while (
$row5 mysql_fetch_object($result5)){
                
$content $row5->content;
                
$components->component($title$content);
                }
            }
        }
?>