<?
/*
 * This file is part of a larger software package. Please read the License file 
 * in the root of this installation for terms of usage and distribution.
 * 
 * @author The Web Pro Miami, Inc. <info@thewebpro.com>
 * @copyright The Web Pro Miami, Inc. <info@thewebpro.com>, http://www.thewebpro.com/
 * 
 * CORE: manage/user_modify.php - version 1.0
*/

// $nSecureMe = 0;

// Secure and connect
require("../inc/dbconnect.php");
require("inc/secure_page.php");
require("../inc/tracker.php");

// Includes
require("../inc/config.php");
require("inc/lang.php");

// set page defaults
$nLoadJS = ""; // used for changing title onload

// Get passed-in variables
$usr = (isset($_GET["usr"]) ? $_GET["usr"] : NULL);
if(!$usr){ $usr = (isset($_POST["usr"]) ? $_POST["usr"] : NULL); }

// Additional security check if this account is a limited user (give only self access)
if(!$nAdminAccess && $usr!=$UID){ header ("Location: index.php?msg=4"); exit; }
?>
<?php include("inc/nav/header.php"); ?>

<div id="titlediv">
    <div class="clearfix container" id="pattern">
        <div class="row">
            <div class="col_12">
                <ul class="breadcrumbs hor-list">
                    <li><a href="home.php"><?php echo _("Dashboard"); ?></a></li>
                    <li><a href="users.php"><?php echo _("BackOffice Users"); ?></a></li>
					<li><a href="user_modify.php?usr=<?=$usr;?>"><?php echo _("Edit"); ?></a></li>
                </ul>
                <h1><?php echo _("Edit User"); ?></h1>
            </div>
        </div>
    </div>
</div>

<div class="container" id="actualbody">
	
	<div class="row clearfix">
	    <div class="col_8">
            
			<div class="widget clearfix">
                <h2><?php echo _("Profile"); ?></h2>
                <div class="widget_inside">
                    <div id="ajaxUserEdit"></div>
                </div>
            </div>
			
	    </div>
	    <div class="col_4 last">
            
			<div class="widget clearfix">
                <h2><?php echo _("Access"); ?></h2>
                <div class="widget_inside" style="padding-bottom:0;">
                    <div id="ajaxUserPageEdit"></div>
                </div>
            </div>
			
	    </div>
	</div>
    
</div>

<script>
	// load external content
	function nLoadUsersTable(){
		loadContentToID("#ajaxUserEdit","edit/user.php?id=<?php echo $usr;?>");
		loadContentToID("#ajaxUserPageEdit","edit/userpage.php?id=<?php echo $usr;?>");
	}
	$(function(){
		nLoadUsersTable();
	});
	<?=$nLoadJS;?>
</script>

<?php include("inc/nav/footer.php") ?>
<?
function nGetUserIDFromName($nUserName){
	global $DBName,$Link;
	if(!$nUserName){ return; }
	$Query = "SELECT nID FROM nEditor WHERE nUser='$nUserName' LIMIT 1";
	mysql_select_db($DBName); $Result = mysql_query($Query,$Link);
	if($Row = mysql_fetch_array($Result)) {
		$nUserID = $Row["nID"];
	}
	return $nUserID;
}

// disconnect from mysql
mysql_close($Link);
?>