<?php
/**************************************************************************
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, or
(at your option) any later version.
@Authors: Ryan Thompson(hide@address.com)
***************************************************************************/
include("./data.php");
$service['add_header'] = TRUE;
include("../config.inc.php");
include($here. "/class.admin.php");
$admin = new admin;
echo $layout->page_header;
echo $layout->service_header($lang->msgs['service_name'] .' - '. $lang->msgs['add_user'], $admin->nav_buttons());
if(isset($_POST['add_user']))
{
$i =0;
if(!$user_added = $user->create_user($_POST))
{
echo str_replace('%USERNAME%', $_POST['new_username'], $lang->get_msg('failed_creating_account', 'ad'));
} else {
echo str_replace('%USERNAME%', $_POST['new_username'], $lang->get_msg('user_account_added', 'ad'));
}
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td class="input_header">Username:</td>
<td><input type="text" name="new_username"></td>
</tr>
<?php
$sql = "SELECT value FROM o_settings WHERE setting_id='9'";
$db->query($sql);
$db->fetch_results();
if($db->record['value'] == "TRUE")
{
$disabled = " disabled=\"disabled\"";
}
?>
<tr>
<td class="input_header">Password:</td>
<td><input type="password" name="new_password" value="" <?php echo $disabled?>></td>
<td class="input_header">Confirm:</td>
<td><input type="password" name="confirm_password" value="" <?php echo $disabled?>></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td class="input_header">Firstname:</td>
<td><input type="text" name="firstname"></td>
<td class="input_header">Lastname:</td>
<td><input type="text" name="lastname"></td>
</tr>
<tr>
<td class="input_header">Email Address:</td>
<td><input type="text" name="email"></td>
</tr>
<tr>
<td><br /></td>
</tr>
<tr>
<td class="input_header" colspan="2">Services:</td>
<td class="input_header" colspan="2">Groups:</td>
</tr>
<tr>
<td colspan="2">
<br />
<?php
$db->query("SELECT * FROM o_services");
echo "<table cellspacing=\"0\">\n";
echo "</tr>\n";
while($db->fetch_results())
{
if($class == 'list_dark')
{
$class = "list_light";
} else {
$class = "list_dark";
}
include($O->dir ."/". $db->record['location']. "/data.php");
echo "<tr>\n";
echo "<td class=\"$class\">". $service['name'] ."</td>\n";
$rights_levels = array(0=>"None", 1=>"User", 2=>"Manager", 3=>"Administrator");
echo "<td class=\"$class\">";
echo "<select name=\"access_rights[". $service[code] ."]\">\n";
$t = 0;
while($t < count($rights_levels))
{
echo "<option value=\"$t\"";
if($rights[$service[code]] == $t)
{
echo " selected=\"selected\"";
}
echo ">$rights_levels[$t]</option>\n";
$t++;
}
echo "</select>";
echo "</td>\n";
echo "</tr>\n";
}
echo "</table>\n";
?>
</td>
<td colspan="2" valign="top">
<br />
<select name="groups[]" size="6" multiple>
<?php
$db->query("SELECT * FROM o_groups", __FILE__, __LINE__);
while($db->fetch_results())
{
echo "<option value=\"". $db->record['group_id'] ."\">". $db->record['group_name'] ."</option>";
}
?>
</td>
<tr>
<td><input type="submit" value="Add User" name="add_user" class="button1"></td>
<td><input type="submit" value="Cancel" name="cancel" class="button1"></td>
</tr>
</table>
<?php
echo $layout->create_footer();
?>