<?php
// File: $Id: admin.php,v 1.36 2001/12/06 21:14:41 gregorrothfuss Exp $ $Name: $
// ----------------------------------------------------------------------
// POST-NUKE Content Management System
// Copyright (C) 2001 by the Post-Nuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// Based on:
// PHP-NUKE Web Portal System - http://phpnuke.org/
// Thatware - http://thatware.org/
// ----------------------------------------------------------------------
// 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: Francisco Burzi
// Purpose of file:
// ----------------------------------------------------------------------
// to be put somewhere else !!! review ?
function deleteNotice($id, $table, $op_back)
{
global $dbconn;
csrfcheck();
// fifers: this is a bit of magic here. works in my tests...
$column = &$pntable["{$table}_column"];
$dbconn->Execute("DELETE FROM $table WHERE $column[id]=$id");
pnRedirect("admin.php?op=$op_back");
}
// to be put somewhere else !!! end ;-))
include 'mainfile.php';
include 'modules/NS-Admin/tools.php';
if (file_exists("language/$currentlang/admin.php")) {
include "language/$currentlang/admin.php";
}
elseif (file_exists("language/eng/admin.php")) {
include "language/eng/admin.php";
}
// $module / $op control
if (!isset($op) or $op=='adminMain') {
$module = 'NS-Admin';
$op = 'main';
}
if (!isset($module)) $module = 'oldway';
// to be put somewhere else !!! filemanger ?
$basedir = dirname($SCRIPT_FILENAME);
$textrows = 20;
$textcols = 85;
$udir = dirname($PHP_SELF);
if (empty($wdir)) $wdir='/';
// to be put somewhere else !!! end
// to be put somewhere else !!! review ?
if (($module=='oldway') and ($op=='deleteNotice')) {
deleteNotice($id, $table, $op_back);
exit;
}
// to be put somewhere else !!! end
// prepare the menu
admin_menu('admin.html');
// new way
if (file_exists($file='modules/'.$module.'/admin.php')) {
// eugeniobaldi 2001/31/11 Don't view define of terms in Modules'module
$ModName = $module;
//
include $file;
modules_get_language();
if (substr($module,0,3)=='NS-') {
$function = substr($module,3).'_admin_';
}
else {
$function = $module.'_admin_';
}
$function_op = $function.$op;
$function_main = $function.'main';
$var = array_merge($GLOBALS['HTTP_GET_VARS'],$GLOBALS['HTTP_POST_VARS']);
if (function_exists($function_op)) {
$function_op($var);
}
elseif (function_exists($function_main)) {
$function_main($var);
}
else {
die("error : admin_execute($file,$function_op)");
}
}
elseif ($module!='oldway') {
die("Fatal error :<br>module = $module<br>op = $op<br>");
}
else {
// modules
$moddir = opendir('modules/');
while ($modulename = readdir($moddir))
{
if (@is_dir("modules/$modulename/admin/case/"))
{
$casedir = opendir("modules/$modulename/admin/case/");
while ($func = readdir($casedir))
{
if (eregi('^case.', $func))
{
$caselist[$func]['path'] = "modules/$modulename/admin/case";
$caselist[$func]['module'] = $modulename;
}
}
closedir($casedir);
}
}
closedir($moddir);
ksort($caselist);
foreach ($caselist as $k=>$v)
{
$ModName = $v['module'];
include "$v[path]/$k";
}
}
?>