File: /home/awaldron/www/archive/demo/content_edit_owners.php
<?php
session_start();
?>
<html>
<head>
<title>Vocollect Inc. : Edit Content Owners</title>
</head>
<link rel="stylesheet" type="text/css" href="default.css">
<?php
include("_functions.php");
dbconnect();
if (!authorize(get_owners($_GET["p"]))) { // CHECK IF USER ATTEMPTING THE EDIT IS AUTHORIZED TO EDIT
echo "<br><br><br>".error("You do not have the proper privileges to edit this notice.")."<br><br><br>";
} else {
$display = TRUE;
if (isset($_GET["p"]) && isset($_GET["u"]) && isset($_GET["a"]) && ($_GET["a"] == "del")) {
if ($_GET["conf"] == 0) {
echo "<center><br><br><br><span style=\"color:DD0000;font-size:12px\"><img src=\"gui/icons/notice2.gif\"> <b>WARNING: Are you sure you want to remove user \"".$_GET["u"]."\"<br>from the list of content owners for this page?</b></span>\n";
echo "<P><a href=\"content_edit_owners.php?p=".$_GET["p"]."&u=".$_GET["u"]."&a=del&conf=1\">YES</a> | <a href=\"content_edit_owners.php?p=".$_GET["p"]."\">NO</a><br><br><br>\n";
echo "</center>\n";
$display = FALSE;
} else {
$sql = "DELETE FROM tbl_page_owners WHERE page_id=".$_GET["p"]." AND username='".$_GET["u"]."'";
$res = mysql_query($sql);
$del_ok = $res;
}
} else if (isset($_GET["a"]) && ($_GET["a"] == "add")) {
$sql = "INSERT INTO tbl_page_owners (page_id,username) VALUES (".$_GET["p"].",'".$_POST["newowner"]."')";
$res = mysql_query($sql);
$add_ok = $res;
}
if ($display) {
$owners = get_owners($_GET["p"]);
echo "<body style=\"margin:15px;font-size:12px;\">\n";
echo "<span class=\"headline\">Add/Remove Owners</span>\n";
echo "<P><b style=\"color:#009900;\">Use this form to add or remove owners of this page.</b>\n";
if ($add_ok) echo "<P>".notice("User successfully added as content owner");
if ($del_ok) echo "<P>".notice("User successfully removed from content owners");
echo "<P><table border=0 cellspacing=5>\n";
echo "<tr><td colspan=2><b><u>Current Owners</u></b></td></tr>\n";
for ($i=0; $i < count($owners); $i++) {
if (in_array($owners[$i],section_admin($_GET["p"]))) echo "<tr><td>".get_user($owners[$i],"fullname2")."</td><td>(section owner)</td></tr>\n";
else echo "<tr><td>".get_user($owners[$i],"fullname2")."</td><td>(<a href=\"content_edit_owners.php?p=".$_GET["p"]."&u=".$owners[$i]."&a=del&conf=0\">remove</a>)</td></tr>\n";
}
echo "</table>\n";
echo "<form action=\"content_edit_owners.php?p=".$_GET["p"]."&a=add\" method=\"post\">\n";
echo "<input type=\"hidden\" name=\"username\" value=\"".$_SESSION["auth_user"]."\">\n";
echo "<P><table border=0 cellspacing=5>\n";
echo "<tr><td><b><u>Add a New Owner</u></b></td></tr>\n";
echo "<tr><td>\n";
echo "<SELECT name=\"newowner\">\n";
employee_select();
echo "</SELECT>\n";
echo " <input type=\"submit\" value=\"Add As Owner\" name=\"submit\">\n";
echo "</td></tr>\n";
echo "</form>\n";
}
}
?>
</body>
</html>