Location: PHPKode > projects > GeBlog > v.1/func.php
<?php
// ----------------------------------------------------------------------
// GeBlog - Weblogging system
// Copyright (C) 2003 by the GeBlog Development Team.
// https://sourceforge.net/projects/geblog/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Jay Talbot
// Purpose of file: To house general internal functions.
// ----------------------------------------------------------------------

if (eregi("func.php", $_SERVER[PHP_SELF]))
{
    die ("You can't access this file directly...");
}

extract($GLOBALS);
//$mainndx = "content/Main_Index/index.php";

function make_menu()
{
    global $v,$menulist,$f,$mod;
    extract($GLOBALS);
    extract($_GET);
    $handle = opendir('mod');
    while ($f = readdir($handle))
    {
        if (!ereg('[.]',$f) && !ereg('^NS-.*',$f) && !ereg('^CVS',$f) && !ereg('admin',$f))
        {
            $menulist[] = $f;
        }
    }
    closedir($handle);
    //$name1 = $v;
    sort($menulist);
    foreach ($menulist as $v)
    {
//        if (!eregi($mainndx,$v))
//        {
            $name = ereg_replace("_", " ", $v);
            echo "<TR><TD VALIGN=\"TOP\" ALIGN=\"left\" WIDTH=\"100%\">\n"
                ."<font class=\"menu-link\"><b>&middot;&nbsp;<a class=\"menu-link\" href=\"index.php?mod=$v\">$name</a></b></font><br>\n"
                ."</TD></TR>\n";
            if (!ereg('[.]',$v) && ($content == $v))
            {
                make_sub_menu();
            }
            else
            {
            }
//        }
    }
}

function make_sub_menu()
{
    global $s,$submenu,$p,$mod,$sub;
    extract($GLOBALS);
    extract($_GET);
    $co = "mod/$mod";
    $handle1 = opendir($co);
    while ($p = readdir($handle1))
    {
        if (!ereg('[.]',$p) && !ereg('^NS-.*',$p) && !ereg('^CVS',$p) && !ereg('admin',$p))
        {
            $submenu[] = $p;
        }
        else
        {
        }
    }
    closedir($handle1);
    $c1 = $mod;
    if (!empty($submenu))
    {
        foreach ($submenu as $v=>$c1)
        {
            $name = ereg_replace("_", " ", $c1);
            echo "<TR><TD ALIGN=\"left\" WIDTH=\"100%\">\n"
                ."<font class=\"sub-menu-link\">&nbsp;&nbsp;&nbsp;&middot;&nbsp;<a href=\"index.php?mod=$mod&sub=$c1\">$name</a></font><br>\n"
                ."</TD></TR>\n";
        }
    }
}

function content()
{
    global $cont,$name,$sub,$admin;
    extract($GLOBALS);
    extract($_GET);
    if ($mod && $admin)
	{
		include "mod/$mod/admin/index.php";
	}
	elseif ($sub)
    {
        $cont = "mod/$mod/$sub/index.php";
        include $cont;
    }
	elseif ($cmd && $mod)
	{
		include "mod/$mod/$cmd/index.php";
	}
    elseif ($mod)
    {
        $cont = "mod/$mod/index.php";
        include $cont;
    }
    else
    {
        include "mod/$main/index.php";
    }
}

?>
Return current item: GeBlog