<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.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.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}

global $admin_file;
$aid = substr("$aid", 0,25);
$row = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `title`, `admins` FROM `".TABLE_MODULES."` WHERE `title`='Content'"));
$row2 = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `name`, `radminsuper` FROM `".TABLE_AUTHORS."` WHERE `aid`='$aid'"));
$admins = explode(",", $row['admins']);
$auth_user = 0;
for ($i=0; $i < sizeof($admins); $i++) {
	if ($row2['name'] == "$admins[$i]" AND $row['admins'] != "") {
		$auth_user = 1;
	}
}

if ($row2['radminsuper'] == 1 || $auth_user == 1) {

	/*********************************************************/
	/* Sections Manager Functions                            */
	/*********************************************************/

	function content() {
		global $language, $multilingual, $bgcolor2, $admin_file, $wysiwyg;
		incoh();
		if ( $wysiwyg == 'fck' ) {
   		 include_once('FCKeditor/fckeditor.php');
   		 }
		title("" . _CONTENTMANAGER . "");
		Max_OpenTable();
		echo "<table border=\"1\" width=\"100%\"><tr>"
		."<td bgcolor=\"$bgcolor2\"><b>" . _TITLE . "</b></td><td align=\"center\" bgcolor=\"$bgcolor2\">&nbsp;<b>" . _STATUS . "</b>&nbsp;</td><td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _CATEGORY . "</b></td><td align=\"center\" bgcolor=\"$bgcolor2\"><b>" . _FUNCTIONS . "</b></td></tr>";
		$result = $GLOBALS['db']->sql_query("SELECT * from ".TABLE_PAGES." order by pid");
		while ($mypages = $GLOBALS['db']->sql_fetchrow($result)) {
			$mycid    = $GLOBALS['db']->XMFnum($mypages['cid']);
			$myactive = $GLOBALS['db']->XMFnum($mypages['active']);
			$mypid    = $GLOBALS['db']->XMFnum($mypages['pid']);
			$mytitle  = stripslashes($mypages['title']);
			if ($mycid == "0" OR $mycid == "") {
				$cat_title = _NONE;
			} else {
				$row_res = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `title` from `".TABLE_PAGES_CATEGORIES."` where `cid`='$mycid'"));
				$cat_title = $row_res['title'];
			}
			if ($myactive == 1) {
				$status = "<img src=\"images/active.gif\" alt=\""._ACTIVE."\" title=\""._ACTIVE."\" border=\"0\" width=\"16\" height=\"16\" />";
				$status_chng = "<img src=\"images/inactive.gif\" alt=\""._DEACTIVATE."\" title=\""._DEACTIVATE."\" border=\"0\" width=\"16\" height=\"16\" />";
				$active = 1;
			} else {
				$status = "<img src=\"images/inactive.gif\" alt=\""._INACTIVE."\" title=\""._INACTIVE."\" border=\"0\" width=\"16\" height=\"16\">";
				$status_chng = "<img src=\"images/active.gif\" alt=\""._ACTIVATE."\" title=\""._ACTIVATE."\" border=\"0\" width=\"16\" height=\"16\">";
				$active = 0;
			}
			echo "<tr><td width=\"100%\"><a href=\"modules.php?name=Content&pa=showpage&pid=$mypid\">$mytitle</a></td><td align=\"center\" nowrap>$status</td><td align=\"center\" nowrap>&nbsp;$cat_title&nbsp;</td><td align=\"center\" nowrap>&nbsp;<a href=\"".$admin_file.".php?op=content_edit&pid=$mypid\"><img src=\"images/edit.gif\" alt=\""._EDIT."\" title=\""._EDIT."\" border=\"0\" width=\"17\" height=\"17\" /></a>  <a href=\"".$admin_file.".php?op=content_change_status&pid=$mypid&active=$active\">$status_chng</a>  <a href=\"".$admin_file.".php?op=content_delete&pid=$mypid\"><img src=\"images/delete.gif\" alt=\""._DELETE."\" title=\""._DELETE."\" border=\"0\" width=\"17\" height=\"17\" /></a>&nbsp;</td></tr>";
		}
		echo "</table>";
		Max_CloseTable();
		br('1');
		Max_OpenTable();
		echo "<center><b>" . _ADDCATEGORY . "</b></center><br /><br />"
		."<form action=\"".$admin_file.".php\" method=\"post\">"
		."<b>" . _TITLE . ":</b><br /><input type=\"text\" name=\"cat_title\" size=\"50\" /><br /><br />"
		."<b>" . _DESCRIPTION . ":</b><br />";

if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(description2) ;
$oFCKeditor->InstanceName = "description2" ;
$oFCKeditor->Create();
} else {
     echo "<textarea name=\"description2\" rows=\"15\" cols=\"100\"></textarea>";
     }
		echo "<br /><br />"
		."<input type=\"hidden\" name=\"op\" value=\"add_category\" />"
		."<input type=\"submit\" value=\"" . _ADD . "\" />"
		."</form>";
		Max_CloseTable();
		$rescat = $GLOBALS['db']->sql_query("SELECT `cid`, `title` from `".TABLE_PAGES_CATEGORIES."` order by `title`");
		$numrows = $GLOBALS['db']->sql_numrows($rescat);
		if ($numrows > 0) {
			br('1');
			Max_OpenTable();
			echo "<center><b>" . _EDITCATEGORY . "</b></center><br /><br />"
			."<form action=\"".$admin_file.".php\" method=\"post\">"
			."<b>" . _CATEGORY . ":</b> "
			."<select name=\"cid\">";
			while ($row_cat = $GLOBALS['db']->sql_fetchrow($rescat)) {
				$cid       = $GLOBALS['db']->XMFnum($row_cat['cid']);
				$cat_title = stripslashes($row_cat['title']);
				echo "<option value=\"$cid\">$cat_title</option>";
			}
			echo "</select>&nbsp;&nbsp;"
			."<input type=\"hidden\" name=\"op\" value=\"edit_category\" />"
			."<input type=\"submit\" value=\"" . _EDIT . "\" />"
			."</form>";
			Max_CloseTable();
		}
		br('1');
		Max_OpenTable();
		$res2 = $GLOBALS['db']->sql_query("SELECT `cid`, `title` from `".TABLE_PAGES_CATEGORIES."` order by `title`");
		$numrows2 = $GLOBALS['db']->sql_numrows($res2);
		echo "<center><b>" . _ADDANEWPAGE . "</b></center><br /><br />"
		."<form action=\"".$admin_file.".php\" method=\"post\">"
		."<b>" . _TITLE . ":</b><br />"
		."<input type=\"text\" name=\"title\" size=\"50\" /><br /><br />";
		if ($numrows2 > 0) {
			echo "<b>" . _CATEGORY . ":</b>&nbsp;&nbsp;"
			."<select name=\"cid\">"
			."<option value=\"0\" selected>" . _NONE . "</option>";
			while ($row_res2 = $GLOBALS['db']->sql_fetchrow($res2)) {
				$cid       = $GLOBALS['db']->XMFnum($row_res2['cid']);
				$cat_title = stripslashes($row_res2['title']);
				echo "<option value=\"$cid\">$cat_title</option>";
			}
			echo "</select><br /><br />";
		} else {
			echo "<input type=\"hidden\" name=\"cid\" value=\"0\" />";
		}
		echo "<b>" . _CSUBTITLE . ":</b><br />"
		."<input type=\"text\" name=\"subtitle\" size=\"50\" /><br /><br />"
		."<b>" . _HEADERTEXT . ":</b><br />";
		if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(page_header) ;
$oFCKeditor->InstanceName = "page_header" ;
$oFCKeditor->Create();
} else {
     echo "<textarea name=\"page_header\" cols=\"100\" rows=\"15\"></textarea>";
     }
	   br('2');
	echo "<b>" . _PAGETEXT . ":</b><br />"
		."<font class=\"tiny\">" . _PAGEBREAK . "</font><br />";
			if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(text) ;
$oFCKeditor->InstanceName = "text" ;
$oFCKeditor->Create();
} else {
     echo "<textarea name=\"text\" cols=\"100\" rows=\"20\"></textarea>";
     }
	br('2');
	echo "<b>" . _FOOTERTEXT . ":</b><br />";
		if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(page_footer) ;
$oFCKeditor->InstanceName = "page_footer" ;
$oFCKeditor->Create();
} else {
     echo "<textarea name=\"page_footer\" cols=\"100\" rows=\"15\"></textarea>";
     }
		echo "<br /><br />"
		."<b>" . _SIGNATURE . ":</b><br />";
			if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(signature) ;
$oFCKeditor->InstanceName = "signature" ;
$oFCKeditor->Create();
} else {
     echo "<textarea name=\"signature\" cols=\"100\" rows=\"15\"></textarea>";
     }
		br('2');
		if ($multilingual == 1) {
			echo "<br /><b>" . _LANGUAGE . ": </b>"
			."<select name=\"clanguage\">";
			$handle=opendir('language');
			while ($file = readdir($handle)) {
				if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
					$langFound = $matches[1];
					$languageslist .= "$langFound ";
				}
			}
			closedir($handle);
			$languageslist = explode(" ", $languageslist);
			sort($languageslist);
			for ($i=0; $i < sizeof($languageslist); $i++) {
				if($languageslist[$i]!="") {
					echo "<option value=\"$languageslist[$i]\" ";
					if($languageslist[$i]==$language) echo "selected";
					echo ">".ucfirst($languageslist[$i])."</option>\n";
				}
			}
			echo "</select><br /><br />";
		} else {
			echo "<input type=\"hidden\" name=\"clanguage\" value=\"$language\" />";
		}
		echo "<b>" . _ACTIVATEPAGE . "</b><br />"
		."<input type=\"radio\" name=\"active\" value=\"1\" checked />&nbsp;" . _YES . "&nbsp;&nbsp;<input type=\"radio\" name=\"active\" value=\"0\" />&nbsp;" . _NO . "<br /><br />"
		."<input type=\"hidden\" name=\"op\" value=\"content_save\" />"
		."<input type=\"submit\" value=\"" . _SEND . "\" />"
		."</form>";
		Max_CloseTable();
		incof();
	}

	function add_category($cat_title, $description2) {
		global $admin_file;
		$GLOBALS['db']->sql_query("insert into `".TABLE_PAGES_CATEGORIES."` values (NULL, '$cat_title', '$description2')");
		redirect_url("".$admin_file.".php?op=content");
	}

	function edit_category($cid) {
		global $admin_file, $wysiwyg;
		incoh();
		if ( $wysiwyg == 'fck' ) {
   		 include_once('FCKeditor/fckeditor.php');
   		 }
		title("" . _CONTENTMANAGER . "");
		Max_OpenTable();
		$cid = $GLOBALS['db']->XMFnum($cid);
		$row = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `title`, `description` from `".TABLE_PAGES_CATEGORIES."` where `cid`='$cid'"));
		$title        = stripslashes($row['title']);
		$description2 = stripslashes($row['description']);
		echo "<center><b>" . _EDITCATEGORY . "</b></center><br /><br />"
		."<form action=\"\" method=\"post\">"
		."<b>" . _TITLE . "</b><br />"
		."<input type=\"text\" name=\"cat_title\" value='$title' size=\"50\" /><br /><br />"
		."<b>" . _DESCRIPTION . "</b>:<br />";
		if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(description2) ;
$oFCKeditor->InstanceName = "description2" ;
$oFCKeditor->Value = "$description2" ;
$oFCKeditor->Create();
} else {
     echo "<textarea cols=\"100\" rows=\"15\" name=\"description2\">$description2</textarea>";
     }
		echo "<br /><br />"
		."<input type=\"hidden\" name=\"cid\" value=\"$cid\" />"
		."<input type=\"hidden\" name=\"op\" value=\"save_category\" />"
		."<input type=\"submit\" value=\"" . _SAVECHANGES . "\" />&nbsp;&nbsp;"
		."[ <a href=\"".$admin_file.".php?op=del_content_cat&amp;cid=$cid\">" . _DELETE . "</a> ]"
		."</form>";
		Max_CloseTable();
		incof();
	}

	function save_category($cid, $cat_title, $description2) {
		global $admin_file;
		$cid = $GLOBALS['db']->XMFnum($cid);
		$GLOBALS['db']->sql_query("update `".TABLE_PAGES_CATEGORIES."` set `title`='$cat_title', `description`='$description2' where `cid`='$cid'");
		redirect_url("".$admin_file.".php?op=content");
	}

	function del_content_cat($cid, $ok=0) {
		global $admin_file;
		if ($ok==1) {
			$cid = $GLOBALS['db']->XMFnum($cid);
			$GLOBALS['db']->sql_query("delete from `".TABLE_PAGES_CATEGORIES."` where `cid`='$cid'");
			$result = $GLOBALS['db']->sql_query("SELECT `pid` from `".TABLE_PAGES."` where `cid`='$cid'");
			while ($row = $GLOBALS['db']->sql_fetchrow($result)) {
				$pid = $GLOBALS['db']->XMFnum($row['pid']);
				$GLOBALS['db']->sql_query("update ".TABLE_PAGES." set cid='0' where pid='$pid'");
			}
			Header("Location: ".$admin_file.".php?op=content");
		} else {
			incoh();
			//GraphicAdmin();
			title("" . _CONTENTMANAGER . "");
			$cid  = $GLOBALS['db']->XMFnum($cid);
			$row2 = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT title from ".TABLE_PAGES_CATEGORIES." where cid='$cid'"));
			$title = stripslashes($row2['title']);
			Max_OpenTable();
			echo "<center><b>" . _DELCATEGORY . ": $title</b><br /><br />"
			.""._DELCONTENTCAT."<br /><br />"
			."[ <a href=\"".$admin_file.".php?op=content\">" . _NO . "</a> | <a href=\"".$admin_file.".php?op=del_content_cat&amp;cid=$cid&amp;ok=1\">" . _YES . "</a> ]</center>";
			Max_CloseTable();
			incof();
		}
	}

	function content_edit($pid) {
		global $language, $multilingual, $bgcolor2, $admin_file, $wysiwyg;
		incoh();
		if ( $wysiwyg == 'fck' ) {
   		 include_once('FCKeditor/fckeditor.php');
   		 }
		//GraphicAdmin();
		title(""._CONTENTMANAGER."");
		$pid = $GLOBALS['db']->XMFnum($pid);
		$mypages = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT * from `".TABLE_PAGES."` WHERE `pid`='$pid'"));
		$mycid         = $GLOBALS['db']->XMFnum($mypages['cid']);
		$myactive      = $GLOBALS['db']->XMFbin($mypages['active']);
		$mytitle       = stripslashes($mypages['title']);
		$mysubtitle    = stripslashes($mypages['subtitle']);
		$mypage_header = stripslashes($mypages['page_header']);
		$mytext        = stripslashes($mypages['text']);
		$mypage_footer = stripslashes($mypages['page_footer']);
		$mysignature   = stripslashes($mypages['signature']);
		$myclanguage   = stripslashes($mypages['clanguage']);
		if ($myactive == 1) {
			$sel1 = "checked";
			$sel2 = "";
		} else {
			$sel1 = "";
			$sel2 = "checked";
		}
		Max_OpenTable();
		echo "<center><b>" . _EDITPAGECONTENT . "</b></center><br /><br />"
		."<form action=\"".$admin_file.".php\" method=\"post\">"
		."<b>" . _TITLE . ":</b><br />"
		."<input type=\"text\" name=\"title\" size=\"50\" value=\"$mytitle\" /><br /><br />";
		$res = $GLOBALS['db']->sql_query("SELECT `cid`, `title` from `".TABLE_PAGES_CATEGORIES."`");
		$numrows = $GLOBALS['db']->sql_numrows($res);
		if ($numrows > 0) {
			echo "<b>" . _CATEGORY . ":</b>&nbsp;&nbsp;"
			."<select name=\"cid\">";
			if ($mycid == 0) {
				$sel = "selected";
			} else {
				$sel = "";
			}
			echo "<option value=\"0\" $sel>" . _NONE . "</option>";
			while ($row_res = $GLOBALS['db']->sql_fetchrow($res)) {
				$cid       = $GLOBALS['db']->XMFnum($row_res['cid']);
				$cat_title = stripslashes($row_res['title']);
				if ($mycid == $cid) {
					$sel = "selected";
				} else {
					$sel = "";
				}
				echo "<option value=\"$cid\" $sel>$cat_title</option>";
			}
			echo "</select><br /><br />";
		} else {
			echo "<input type=\"hidden\" name=\"cid\" value=\"0\" />";
		}
		echo "<b>" . _CSUBTITLE . ":</b><br />"
		."<input type=\"text\" name=\"subtitle\" size=\"50\" value=\"$mysubtitle\" /><br /><br />"
		."<b>" . _HEADERTEXT . ":</b><br />";
		if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(page_header) ;
$oFCKeditor->InstanceName = "page_header" ;
$oFCKeditor->Value = "$mypage_header" ;
$oFCKeditor->Create();
} else {
     echo "<textarea name=\"page_header\" cols=\"100\" rows=\"15\">$mypage_header</textarea>";
     }
		echo "<br /><br />"
		."<b>" . _PAGETEXT . ":</b><br />"
		."<font class=\"tiny\">" . _PAGEBREAK . "</font><br />";
		if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(text) ;
$oFCKeditor->InstanceName = "text" ;
$oFCKeditor->Value = "$mytext" ;
$oFCKeditor->Create();
} else {
     echo "<textarea name=\"text\" cols=\"100\" rows=\"20\">$mytext</textarea>";
     }
		echo "<br /><br />"
		."<b>" . _FOOTERTEXT . ":</b><br />";
		if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(page_footer) ;
$oFCKeditor->InstanceName = "page_footer" ;
$oFCKeditor->Value = "$mypage_footer" ;
$oFCKeditor->Create();
} else {
     echo "<textarea name=\"page_footer\" cols=\"100\" rows=\"15\">$mypage_footer</textarea>";
     }
		echo "<br /><br />"
		."<b>" . _SIGNATURE . ":</b><br />";
			if ( $wysiwyg == 'fck' ) {
$oFCKeditor = new FCKeditor(signature) ;
$oFCKeditor->InstanceName = "signature" ;
$oFCKeditor->Value = "$mysignature" ;
$oFCKeditor->Create();
} else {
     echo "<textarea name=\"signature\" cols=\"100\" rows=\"15\">$mysignature</textarea>";
     }
		br('2');
		if ($multilingual == 1) {
			echo "<br /><b>" . _LANGUAGE . ": </b>"
			."<select name=\"clanguage\">";
			$handle=opendir('language');
			while ($file = readdir($handle)) {
				if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
					$langFound = $matches[1];
					$languageslist .= "$langFound ";
				}
			}
			closedir($handle);
			$languageslist = explode(" ", $languageslist);
			sort($languageslist);
			for ($i=0; $i < sizeof($languageslist); $i++) {
				if($languageslist[$i]!="") {
					echo "<option value=\"$languageslist[$i]\" ";
					if($languageslist[$i]==$language) echo "selected";
					echo ">".ucfirst($languageslist[$i])."</option>\n";
				}
			}
			echo "</select><br /><br />";
		} else {
			echo "<input type=\"hidden\" name=\"clanguage\" value=\"$myclanguage\" />";
		}
		echo "<b>" . _ACTIVATEPAGE . "</b><br />"
		."<input type=\"radio\" name=\"active\" value=\"1\" $sel1 />&nbsp;" . _YES . "&nbsp&nbsp;<input type=\"radio\" name=\"active\" value=\"0\" $sel2 />&nbsp;" . _NO . "<br /><br />"
		."<input type=\"hidden\" name=\"pid\" value=\"$pid\" />"
		."<input type=\"hidden\" name=\"op\" value=\"content_save_edit\" />"
		."<input type=\"submit\" value=\"" . _SAVECHANGES . "\" />"
		."</form>";
		Max_CloseTable();
		incof();
	}

	function content_save($title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active, $cid) {
		global $admin_file;
		$text     = stripslashes(FixQuotes($text));
		$title    = stripslashes(FixQuotes($title));
		$subtitle = stripslashes(FixQuotes($subtitle));
		$GLOBALS['db']->sql_query("insert into `".TABLE_PAGES."` values (NULL, '$cid', '$title', '$subtitle', '$active', '$page_header', '$text', '$page_footer', '$signature', now(), '0', '$clanguage')");
		redirect_url("".$admin_file.".php?op=content");
	}

	function content_save_edit($pid, $title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active, $cid) {
		global $admin_file;
		$text     = stripslashes(FixQuotes($text));
		$title    = stripslashes(FixQuotes($title));
		$subtitle = stripslashes(FixQuotes($subtitle));
		$pid      = $GLOBALS['db']->XMFnum($pid);
		$GLOBALS['db']->sql_query("update `".TABLE_PAGES."` set `cid`='$cid', `title`='$title', `subtitle`='$subtitle', `active`='$active', `page_header`='$page_header', `text`='$text', `page_footer`='$page_footer', `signature`='$signature', `clanguage`='$clanguage' where `pid`='$pid'");
		redirect_url("".$admin_file.".php?op=content");
	}

	function content_change_status($pid, $active) {
		global $admin_file;
		if ($active == 1) {
			$new_active = 0;
		} elseif ($active == 0) {
			$new_active = 1;
		}
		$pid = $GLOBALS['db']->XMFnum($pid);
		$GLOBALS['db']->sql_query("update `".TABLE_PAGES."` set `active`='$new_active' WHERE `pid`='$pid'");
		redirect_url("".$admin_file.".php?op=content");
	}

	function content_delete($pid, $ok=0) {
		global $admin_file;
		$pid = $GLOBALS['db']->XMFnum($pid);
		if ($ok==1) {
			$GLOBALS['db']->sql_query("delete from `".TABLE_PAGES."` where `pid`='$pid'");
			redirect_url("".$admin_file.".php?op=content");
		} else {
			incoh();
			title("" . _CONTENTMANAGER . "");
			$row = $GLOBALS['db']->sql_fetchrow($GLOBALS['db']->sql_query("SELECT `title` from `".TABLE_PAGES."` where `pid`='$pid'"));
			$title = $row['title'];
			Max_OpenTable();
			echo "<center><b>" . _DELCONTENT . ": $title</b><br /><br />"
			.""._DELCONTWARNING." $title?<br /><br />"
			."[ <a href=\"".$admin_file.".php?op=content\">" . _NO . "</a> | <a href=\"".$admin_file.".php?op=content_delete&amp;pid=$pid&amp;ok=1\">" . _YES . "</a> ]</center>";
			Max_CloseTable();
			incof();
		}
	}
	if($admintest && $adminsecu)  {
	switch ($op) {

		case "content":
		content();
		break;

		case "content_edit":
		content_edit($pid);
		break;

		case "content_delete":
		content_delete($pid, $ok);
		break;

		case "content_review":
		content_review($title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active);
		break;

		case "content_save":
		content_save($title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active, $cid);
		break;

		case "content_save_edit":
		content_save_edit($pid, $title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active, $cid);
		break;

		case "content_change_status":
		content_change_status($pid, $active);
		break;

		case "add_category":
		add_category($cat_title, $description2);
		break;

		case "edit_category":
		edit_category($cid);
		break;

		case "save_category":
		save_category($cid, $cat_title, $description2);
		break;

		case "del_content_cat":
		del_content_cat($cid, $ok);
		break;
	}
}
} else {
	incoh();
	GraphicAdmin();
	Max_OpenTable();
	echo "<center><b>"._ERROR."</b><br /><br />You do not have administration permission for module \"$module_name\"</center>";
	Max_CloseTable();
	incof();
}