Location: PHPKode > projects > ChiCoMaS - Chilek CMS > chicomas/modules/user/allusers.php
<?
defined( '_VALID_DA_' ) or die( 'Bu sayfaya dogrudan eriþim yapýlamaz.' );

/*****************************************************************************/
function List_Users($request){

	global $module;
	global $module_path;

	$content = null;

	$obj_tempdbarray = new CTempDBArray();
	$obj_tempdbengine = new CTempDBEngine();
	
	$obj_tempdb2array = new CTempDBArray();
	$obj_tempdb2engine = new CTempDBEngine();

	//Toplam gosterilecek kayit sayisi
	$record = 20;

	$groupid = $request['group'];
	$desc = $request['desc'];
	$orderby = $request['orderby'];
	//Sayfa Numarasi
	$page = $request['page'];
	if ($page<=0)
		$page = 1;

	$SQL = "SELECT * FROM users ";
//	$SQL .= "WHERE group_id='".intval($groupid)."' ";
	$obj_tempdbarray = $obj_tempdbengine->GetRows($SQL);

	$total_record = $obj_tempdbarray->count();
	$max_page = ceil($total_record / $record);

	$content = "<center>";

	if ($total_record>0){

		switch ($orderby){
		default:
				$SQL .= "ORDER BY user_id ";
		break;
		case 'active':
//				$SQL .= "ORDER BY active ";
		break;
		case 'username':
//				$SQL .= "ORDER BY username ";
		break;
		case 'name':
//				$SQL .= "ORDER BY name_surname ";
		break;
		}
		
		$start = ($page-1)*$record;
		$SQL .= "LIMIT $start ,$record";
		
		$obj_tempdbarray = $obj_tempdbengine->GetRows($SQL);
	
		$content .= "
	
		<table width=\"100%\" cellpadding=\"3\" cellspacing=\"3\" border=\"1\">
		<tbody>
			<th><a href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=list&group=$groupid&orderby=active&desc=".intval($desc).">"._CP_UA_ACTIVE_."</a></th>
			<th>"._CP_UA_GROUP_NAME_."</th>
			<th><a href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=list&group=$groupid&orderby=name&desc=".intval($desc).">"._CP_UA_USERNAME_."</a></th>
			<th>"._CP_UA_NAMESURNAME_."</th>
			<th>"._CMN_EDIT_."</th>
			<th>"._CMN_DELETE_."</th>
		</tbody>";
	
		while( $row = $obj_tempdbarray->get() ){
			//print_r($row);
			$usergroupid = $row['user_group_id'];
			$userid = $row['user_id'];
			//$groupid = $row['group_id'];

			$SQL2 = "SELECT * FROM users ";
			$SQL2 .= "WHERE user_id='".intval($userid)."' ";
			$row2 = $obj_tempdb2engine->GetRow($SQL2);
			$active = $row2['active'];
			$name_surname = $row2['name_surname'];
			$username = $row2['username'];
			$email = $row2['email'];

			$SQL2 = "SELECT * FROM user_groups ";
			$SQL2 .= "WHERE user_id='".intval($userid)."' ";
			$row2 = $obj_tempdb2engine->GetRow($SQL2);
			$usergroupid = $row2['group_id'];

			$SQL2 = "SELECT * FROM groups ";
			$SQL2 .= "WHERE group_id='".intval($usergroupid)."' ";
			$row2 = $obj_tempdb2engine->GetRow($SQL2);
			$usergroupname = $row2['group_name'];

			$content .= "
			<tr>
				<td align=\"center\">";
				if ($active)
					$content .= "<img border=0 src=\"images/icon/check.png\">";
				else
					$content .= "<img border=0 src=\"images/icon/disable.png\">";
				$content .= "
				</td>

				<td align=\"center\"><a href=\"".basename($PHP_SELF)."?f=user&sf=groupusers&group=$usergroupid\">$usergroupname</a></td>
				<td align=\"center\"><a href=\"".basename($PHP_SELF)."?f=user&sf=allusers&group=$groupid&operation=edit&user=$userid&orderby=".$orderby."&desc=".intval($desc)."&page=".$page."\">$username</a></td>
				<td align=\"center\">$name_surname</td>
				<td align=\"center\"><a href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=edit&group=$groupid&user=$userid&orderby=".$orderby."&desc=".intval($desc)."&page=".$page."><img border=0 src=\"images/icon/edit.gif\"></a></td>
				<td align=\"center\"><a href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=delete&group=$groupid&user=$userid&orderby=".$orderby."&desc=".intval($desc)."&page=".$page."><img border=0 src=\"images/icon/remove.gif\"></a></td>
			</tr>";
		}
		$content .= "</table><br>";
	
		if ($max_page>1){
			$fpage = 1;
			$lpage = $max_page;
			if ($page>1)
				$ppage = $page-1;
			else
				$ppage = 1;
		
			if ($page>=$max_page)
				$npage = $max_page;
			else
				$npage = $page+1;
		
			//Sayfa gosterimi
			$content .= "
			<a href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=list&group=$groupid&orderby=".$orderby."&desc=".intval($desc)."&page=".$fpage.">
				<img src=\"./images/icon16/left2.png\" width=\"16\" height=\"16\" border=\"0\">
			</a>
		
			<a href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=list&group=$groupid&orderby=".$orderby."&desc=".intval($desc)."&page=".$ppage.">
				<img src=\"./images/icon16/left.png\" width=\"16\" height=\"16\" border=\"0\">
			</a>
		
			<a href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=list&group=$groupid&orderby=".$orderby."&desc=".intval($desc)."&page=".$npage.">
				<img src=\"./images/icon16/right.png\" width=\"16\" height=\"16\" border=\"0\">
			</a>
		
			<a href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=list&group=$groupid&orderby=".$orderby."&desc=".intval($desc)."&page=".$lpage.">
				<img src=\"./images/icon16/right2.png\" width=\"16\" height=\"16\" border=\"0\">
			</a>
		
			<br><br>";
		}
		
		$content .= _CMN_TOTAL_RECORD_.$total_record."<br>";
		$content .= _CMN_PAGE_.$page." / ".$max_page."<br>";
		$content .= "<br>";
	
	}
	else{
		$content .= "
		<div class=note>
			<h3>"._CMN_NOTES_."</h3>
			<p>";
				$content .= _CMN_NO_RECORD_FOUND_;
				$content .= "<br><br>";
				$content .= go_back();
			$content .= "
			</p>
		</div>";
	}

	$content .= "
	<a class=\"inline-button orange\" href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=list&group=$groupid&orderby=".$orderby."&desc=".intval($desc)."&page=".$page."><em>@</em><span>"._CMN_LIST_."</span></a>

	<a class=\"inline-button orange\" href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=add&group=$groupid><em>@</em><span>"._CMN_ADD_."</span></a>

	</center>
	";

	return $content;
}

/*****************************************************************************/
function Add_Users($request){

	global $module;
	global $module_path;

	$obj_tempdbarray = new CTempDBArray();
	$obj_tempdbengine = new CTempDBEngine();
	
	$obj_tempdb2array = new CTempDBArray();
	$obj_tempdb2engine = new CTempDBEngine();

	$groupid = $request['group'];

	$content = null;

	$content = "
	<center>
	<form action='".basename($PHP_SELF)."?f=user&sf=allusers' method='post'>
	<input type=\"hidden\" name=\"operation\" value=\"save\" />
	<input type=\"hidden\" name=\"lastoperation\" value=\"add\" />
	<fieldset>
	<img style=\"float:right;\" src=\"./images/icon48/users.png\" width=\"48\" height=\"48\" border=\"0\">
	<legend>"._CP_UA_FORM_USERS_INFORMATION_."</legend>
		<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">
		<tr>
			<td><label for=\"active\">"._CP_UA_FORM_ACTIVE_."</label></td>
			<td><input type=\"checkbox\" name=\"active\" $active style=\"float:left;\"/></td>
		</tr>
		<tr>
			<td><label for=\"group\">"._CP_UA_FORM_GROUP_NAME_."</label></td>
			<td>
				<select name=\"group\" style=\"float:left;\">";
				if ($groupid==0)
					$selected="selected=\"selected\" style=\"background-color:gold;color:navy\"";
				else
					$selected = "";
		
				$SQL2 = "SELECT * FROM groups";
				$obj_tempdb2array = $obj_tempdb2engine->GetRows($SQL2);
		
				//$content .= "<option value=\"0\" $selected>"._CMN_SELECT_AN_OPTION_."</option>";
				while( $row2 = $obj_tempdb2array->get() ){
						if ($groupid == $row2['group_id'])
							$selected="selected=\"selected\" style=\"background-color:gold;color:navy\"";
						else
							$selected = "";
						$content .= "<option value=\"".$row2['group_id']."\" $selected>".$row2['group_name']."</option>";
				}
				$content .= "
				</select>
			</td>
		</tr>
		<tr>
			<td><label for=\"username\">"._CP_UA_FORM_USERNAME_."</label></td>
			<td><input type=\"text\" name=\"username\" value=\"$username\" style=\"float:left;\" maxlength=\"16\"/></td>
		</tr>
		<tr>
			<td><label for=\"name_surname\">"._CP_UA_FORM_NAME_SURNAME_."</label></td>
			<td><input type=\"text\" name=\"name_surname\" value=\"$name_surname\" style=\"float:left;\" maxlength=\"32\"/></td>
		</tr>
		<tr>
			<td><label for=\"email\">"._CP_UA_FORM_EMAIL_."</label></td>
			<td><input type=\"text\" name=\"email\" value=\"$email\" style=\"float:left;\" size=\"24\" maxlength=\"64\"/></td>
		</tr>
		<tr>
			<td><label for=\"password1\">"._CP_UA_FORM_PASSWORD_."</label></td>
			<td><input type=\"password\" name=\"password1\" style=\"float:left;\" size=\"8\" maxlength=\"16\"/></td>
		</tr>
		<tr>
			<td><label for=\"password2\">"._CP_UA_FORM_REPEAT_PASSWORD_."</label></td>
			<td><input type=\"password\" name=\"password2\" style=\"float:left;\" size=\"8\" maxlength=\"16\"/></td>
		</tr>

		<tr>
			<td colspan=\"2\" align=\"center\">
				<br>";
				$content .= "<input type=\"submit\" value=\""._CMN_ADD_."\" style=\"float:center;\"/>";
				$content .= go_back();
				$content .= "
			</td>
		</tr>
		</table>
		<br>
	</fieldset>
	</form>

	<a class=\"inline-button orange\" href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=list&group=$groupid><em>@</em><span>"._CMN_LIST_."</span></a>

	</center>";

	return $content;
}

/*****************************************************************************/
function Edit_Users($request){

	global $module;
	global $module_path;

	$content = null;

	$obj_tempdbarray = new CTempDBArray();
	$obj_tempdbengine = new CTempDBEngine();

	$obj_tempdb2array = new CTempDBArray();
	$obj_tempdb2engine = new CTempDBEngine();

	$groupid = $request['group'];
	$userid = $request['user'];
	$accept = $request['accept'];
	$desc = $request['desc'];
	$orderby = $request['orderby'];
	//Sayfa Numarasi
	$page = $request['page'];
	if ($page<=0)
		$page = 1;

	$SQL = "SELECT * FROM users WHERE user_id=".intval($userid);
	$row = $obj_tempdbengine->GetRow($SQL);
	$active = $row['active'];
	if ($active)
		$active = " checked ";
	$username = $row['username'];
	$name_surname = $row['name_surname'];
	$email = $row['email'];

	$SQL = "SELECT * FROM user_groups ";
	$SQL .= "WHERE user_id='".intval($userid)."' ";
	$row = $obj_tempdbengine->GetRow($SQL);
	$groupid = $row['group_id'];
	
	$content = "
	<center>
	<form action='".basename($PHP_SELF)."?f=user&sf=allusers' method='post'>
	<input type=\"hidden\" name=\"operation\" value=\"save\" />
	<input type=\"hidden\" name=\"lastoperation\" value=\"update\" />
	<input type=\"hidden\" name=\"oldusername\" value=\"$username\" />
	<input type=\"hidden\" name=\"group\" value=\"$groupid\" />
	<input type=\"hidden\" name=\"user\" value=\"$userid\" />
	<input type=\"hidden\" name=\"orderby\" value=\"$orderby\" />
	<input type=\"hidden\" name=\"desc\" value=\"$desc\" />
	<input type=\"hidden\" name=\"page\" value=\"$page\" />
	<fieldset>
	<img style=\"float:right;\" src=\"./images/icon48/users.png\" width=\"48\" height=\"48\" border=\"0\">
	<legend>"._CP_UA_FORM_USERS_INFORMATION_."</legend>
		<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">
		<tr>
			<td><label for=\"active\">"._CP_UA_FORM_ACTIVE_."</label></td>
			<td><input type=\"checkbox\" name=\"active\" $active style=\"float:left;\"/></td>
		</tr>
		<tr>
			<td><label for=\"newgroup\">"._CP_UA_FORM_GROUP_NAME_."</label></td>
			<td>
				<select name=\"newgroup\" style=\"float:left;\">";
				if ($groupid==0)
					$selected="selected=\"selected\" style=\"background-color:gold;color:navy\"";
				else
					$selected = "";
		
				$SQL2 = "SELECT * FROM groups";
				$obj_tempdb2array = $obj_tempdb2engine->GetRows($SQL2);
		
				//$content .= "<option value=\"0\" $selected>"._CMN_SELECT_AN_OPTION_."</option>";
				while( $row2 = $obj_tempdb2array->get() ){
						if ($groupid == $row2['group_id'])
							$selected="selected=\"selected\" style=\"background-color:gold;color:navy\"";
						else
							$selected = "";
						$content .= "<option value=\"".$row2['group_id']."\" $selected>".$row2['group_name']."</option>";
				}
				$content .= "
				</select>
			</td>
		</tr>
		<tr>
			<td><label for=\"username\">"._CP_UA_FORM_USERNAME_."</label></td>
			<td><input type=\"text\" name=\"username\" value=\"$username\" style=\"float:left;\" maxlength=\"16\"/></td>
		</tr>
		<tr>
			<td><label for=\"name_surname\">"._CP_UA_FORM_NAME_SURNAME_."</label></td>
			<td><input type=\"text\" name=\"name_surname\" value=\"$name_surname\" style=\"float:left;\" maxlength=\"32\"/></td>
		</tr>
		<tr>
			<td><label for=\"email\">"._CP_UA_FORM_EMAIL_."</label></td>
			<td><input type=\"text\" name=\"email\" value=\"$email\" style=\"float:left;\" size=\"24\" maxlength=\"64\"/></td>
		</tr>
		<tr>
			<td><label for=\"password1\">"._CP_UA_FORM_PASSWORD_."</label></td>
			<td><input type=\"password\" name=\"password1\" style=\"float:left;\" size=\"8\" maxlength=\"16\"/></td>
		</tr>
		<tr>
			<td><label for=\"password2\">"._CP_UA_FORM_REPEAT_PASSWORD_."</label></td>
			<td><input type=\"password\" name=\"password2\" style=\"float:left;\" size=\"8\" maxlength=\"16\"/></td>
		</tr>

		<tr>
			<td colspan=\"2\" align=\"center\">
				<br>";
				$content .= "<input type=\"submit\" value=\""._CMN_UPDATE_."\" style=\"float:center;\"/>";
				$content .= go_back();
				$content .= "
			</td>
		</tr>
		</table>
		<br>
	</fieldset>
	</form>

	<a class=\"inline-button orange\" href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=list&group=$groupid&orderby=".$orderby."&desc=".intval($desc)."&page=".$page."><em>@</em><span>"._CMN_LIST_."</span></a>

	</center>";

	return $content;
}

/*****************************************************************************/
function Save_Users($request){

	global $module;
	global $module_path;

	$content = null;

	$obj_tempdbarray = new CTempDBArray();
	$obj_tempdbengine = new CTempDBEngine();

	$orderby = $request['orderby'];
	//Sayfa Numarasi
	$page = $request['page'];
	if ($page<=0)
		$page = 1;
	$groupid = $request['group'];
	$newgroupid = $request['newgroup'];
	$userid = $request['user'];
	$active = $request['active'];
	if ($active=="on")
		$active=1;
	else
		$active=0;
	$name_surname = $request['name_surname'];
	$username = $request['username'];
	$password1 = $request['password1'];
	$password2 = $request['password2'];
	$email = $request['email'];
	$lastoperation = $request['lastoperation'];
	$oldusername = $request['oldusername'];

	$my_validator = new validator();

	if (!(($my_validator->validate_fields("name_surname")) && ($my_validator->validate_fields("username")) && ($my_validator->validate_fields("email")))) {
		$failed = true;
	}
	else{

		if ($password1!=$password2)
			$password_failed = false;
		else
			if ($password1!="")
				$changepassword = true;

		$password = sha1($password1);

	
		if ($username==$oldusername)
			$sameusername = true;
	
		if ($lastoperation=="update"){
			if (intval($userid)>1){
				$SQL  = "UPDATE users ";
				$SQL .= "SET ";
				$SQL .= "active = '".$active."', ";
				$SQL .= "name_surname = '".ucwords($name_surname)."', ";
				if (!$sameusername)
					$SQL .= "username = '".strtolower($username)."', ";
				if ($changepassword)
					$SQL .= "password = '".$password."', ";
				$SQL .= "email = '".strtolower($email)."' ";
				$SQL .= "WHERE user_id=".intval($userid);
	
				if (!$obj_tempdbengine->ExecQuery($SQL))
					$content .= "<br>Update Error on ExecQuery<br>";
	
				$SQL = "SELECT * FROM user_groups ";
				$SQL .= "WHERE user_id=".intval($userid);
				$row = $obj_tempdbengine->GetRow($SQL);
				if ($row){
					$SQL  = "UPDATE user_groups ";
					$SQL .= "SET ";
					$SQL .= "group_id = '".intval($newgroupid)."' ";
					$SQL .= "WHERE user_id=".intval($userid);
		
					if (!$obj_tempdbengine->ExecQuery($SQL))
						$content .= "<br>Update Error on ExecQuery<br>";
				}
				else{
					$SQL = "INSERT INTO user_groups ";
					$SQL .= "( ";
					$SQL .= "user_id, ";
					$SQL .= "group_id ";
					$SQL .= ") ";
					$SQL .= "VALUES";
					$SQL .= "( ";
					$SQL .= "'".intval($userid)."', ";
					$SQL .= "'".intval($newgroupid)."' ";
					$SQL .= ") ";
	
					$usergroupid = $obj_tempdbengine->AddRecord($SQL);
				}
			}
		}
		else{

			$SQL = "SELECT * FROM users WHERE username='".($username)."' ";
			$row = $obj_tempdbengine->GetRow($SQL);
			if ($row==null){
				$SQL = "INSERT INTO users ";
				$SQL .= "( ";
				$SQL .= "active, ";
				$SQL .= "name_surname, ";
				$SQL .= "username, ";
				$SQL .= "password, ";
				$SQL .= "email, ";
				$SQL .= "reg_date ";
				$SQL .= ") ";
				$SQL .= "VALUES";
				$SQL .= "( ";
				$SQL .= "'".$active."', ";
				$SQL .= "'".$name_surname."', ";
				$SQL .= "'".$username."', ";
				$SQL .= "'".$password."', ";
				$SQL .= "'".$email."', ";
				$SQL .= "'".get_datetime()."' ";
				$SQL .= ") ";

				$userid = $obj_tempdbengine->AddRecord($SQL);

				$SQL = "INSERT INTO user_groups ";
				$SQL .= "( ";
				$SQL .= "user_id, ";
				$SQL .= "group_id ";
				$SQL .= ") ";
				$SQL .= "VALUES";
				$SQL .= "( ";
				$SQL .= "'".intval($userid)."', ";
				$SQL .= "'".intval($groupid)."' ";
				$SQL .= ") ";

				$usergroupid = $obj_tempdbengine->AddRecord($SQL);

			}
			else{
				$samerecord = true;
			}
		}
		//$content .= $SQL;
	}


	$content .= "
	<div class=note>
		<h3>"._CMN_NOTE_."</h3>
		<p>";
		if (!$failed){
			if (!$samerecord){
				$content .= _CMN_SAVE_OK_;
				ReDirection(basename($PHP_SELF)."?f=user&sf=allusers&group=$groupid&orderby=".$orderby."&desc=".intval($desc)."&page=".$page."");
			}
			else{
				$content .= _CP_UA_AU_SAME_RECORD_."<br><br>";
				$content .= go_back();
			}
		}
		else{
			$content .= _CMN_SAVE_FAILED_."<br><br>";
			$content .= go_back();
		}
		$content .= "
		</p>
	</div>
	";

	return $content;
}

/*****************************************************************************/
function Delete_Users($request){

	global $module;
	global $module_path;

	$content = null;

	$obj_tempdbarray = new CTempDBArray();
	$obj_tempdbengine = new CTempDBEngine();

	$obj_tempdb2array = new CTempDBArray();
	$obj_tempdb2engine = new CTempDBEngine();

	//$groupid = $request['group'];
	$userid = $request['user'];
	$accept = $request['accept'];
	$desc = $request['desc'];
	$orderby = $request['orderby'];
	//Sayfa Numarasi
	$page = $request['page'];
	if ($page<=0)
		$page = 1;

	$SQL = "SELECT * FROM users WHERE user_id=".intval($userid);
	$row = $obj_tempdbengine->GetRow($SQL);
	$active = $row['active'];
	if ($active)
		$active = " checked ";
	$username = $row['username'];
	$name_surname = $row['name_surname'];
	$email = $row['email'];

	$SQL = "SELECT * FROM user_groups ";
	$SQL .= "WHERE user_id='".intval($userid)."' ";
	$row = $obj_tempdbengine->GetRow($SQL);
	$groupid = $row['group_id'];

	if ($accept && ($userid>2)){

		$SQL = "DELETE FROM users ";
		$SQL .= "WHERE user_id='".intval($userid)."'";
		//$content .= $SQL;
	
		if (!$obj_tempdbengine->ExecQuery($SQL))
			$content .= "<br>Delete Error on ExecQuery<br>";

		$SQL = "DELETE FROM user_groups ";
		$SQL .= "WHERE user_id='".intval($userid)."'";
		//$content .= $SQL;
	
		if (!$obj_tempdbengine->ExecQuery($SQL))
			$content .= "<br>Delete Error on ExecQuery<br>";


		$content .= "
		<div class=note>
			<h3>"._CMN_NOTE_."</h3>
			<p>";
			$content .= _CMN_DELETE_OK_;
			$content .= "<br><br>";
			ReDirection(basename($PHP_SELF)."?f=user&sf=allusers&group=$groupid&orderby=".$orderby."&desc=".intval($desc)."&page=".$page."");
			$content .= "
			</p>
		</div>
		";
	}
	else{

		$content = "
		<center>
		<form action='".basename($PHP_SELF)."?f=user&sf=allusers' method='post'>
		<input type=\"hidden\" name=\"operation\" value=\"delete\" />
		<input type=\"hidden\" name=\"group\" value=\"$groupid\" />
		<input type=\"hidden\" name=\"user\" value=\"$userid\" />
		<input type=\"hidden\" name=\"accept\" value=\"1\" />
		<input type=\"hidden\" name=\"orderby\" value=\"$orderby\" />
		<input type=\"hidden\" name=\"desc\" value=\"$desc\" />
		<input type=\"hidden\" name=\"page\" value=\"$page\" />
	
		<fieldset>
		<img style=\"float:right;\" src=\"./images/icon48/users.png\" width=\"48\" height=\"48\" border=\"0\">
		<legend>"._CP_UA_FORM_USERS_INFORMATION_."</legend>
			<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\">
			<tr>
				<td><label for=\"active\">"._CP_UA_FORM_ACTIVE_."</label></td>
				<td><input type=\"checkbox\" name=\"active\" $active style=\"float:left;\"/></td>
			</tr>
			<tr>
				<td><label for=\"group\">"._CP_UA_FORM_GROUP_NAME_."</label></td>
				<td>
					<select name=\"group\" style=\"float:left;\">";
					if ($groupid==0)
						$selected="selected=\"selected\" style=\"background-color:gold;color:navy\"";
					else
						$selected = "";
			
					$SQL2 = "SELECT * FROM groups";
					$obj_tempdb2array = $obj_tempdb2engine->GetRows($SQL2);
			
					//$content .= "<option value=\"0\" $selected>"._CMN_SELECT_AN_OPTION_."</option>";
					while( $row2 = $obj_tempdb2array->get() ){
							if ($groupid == $row2['group_id'])
								$selected="selected=\"selected\" style=\"background-color:gold;color:navy\"";
							else
								$selected = "";
							$content .= "<option value=\"".$row2['group_id']."\" $selected>".$row2['group_name']."</option>";
					}
					$content .= "
					</select>
				</td>
			</tr>
			<tr>
				<td><label for=\"username\">"._CP_UA_FORM_USERNAME_."</label></td>
				<td><input type=\"text\" name=\"username\" value=\"$username\" style=\"float:left;\" maxlength=\"16\"/></td>
			</tr>
			<tr>
				<td><label for=\"name_surname\">"._CP_UA_FORM_NAME_SURNAME_."</label></td>
				<td><input type=\"text\" name=\"name_surname\" value=\"$name_surname\" style=\"float:left;\" maxlength=\"32\"/></td>
			</tr>
			<tr>
				<td><label for=\"email\">"._CP_UA_FORM_EMAIL_."</label></td>
				<td><input type=\"text\" name=\"email\" value=\"$email\" style=\"float:left;\" size=\"24\" maxlength=\"64\"/></td>
			</tr>
			<tr>
				<td><label for=\"password1\">"._CP_UA_FORM_PASSWORD_."</label></td>
				<td><input type=\"password\" name=\"password1\" style=\"float:left;\" size=\"8\" maxlength=\"16\"/></td>
			</tr>
			<tr>
				<td><label for=\"password2\">"._CP_UA_FORM_REPEAT_PASSWORD_."</label></td>
				<td><input type=\"password\" name=\"password2\" style=\"float:left;\" size=\"8\" maxlength=\"16\"/></td>
			</tr>
	
			<tr>
				<td colspan=\"2\" align=\"center\">
					<br>";
					$content .= "<input type=\"submit\" value=\""._CMN_DELETE_."\" style=\"float:center;\"/>";
					$content .= go_back();
					$content .= "
				</td>
			</tr>
			</table>
			<br>
		</fieldset>
		</form>

		<a class=\"inline-button orange\" href=".basename($PHP_SELF)."?f=user&sf=allusers&operation=list&group=$groupid&orderby=".$orderby."&desc=".intval($desc)."&page=".$page."><em>@</em><span>"._CMN_LIST_."</span></a>

		</center>";
	}

	return $content;
}

//*****************************************************************************
function All_Users($request){

	global $module;
	global $module_path;

	$obj_tempdbarray = new CTempDBArray();
	$obj_tempdbengine = new CTempDBEngine();

	$operation = $request['operation'];

	switch ($operation){
	default:
	case 'list':
		$content = List_Users($request);
	break;
	case 'add':
		$content .= Add_Users($request);
	break;
	case 'edit':
		$content .= Edit_Users($request);
	break;
	case 'save':
		$content .= Save_Users($request);
	break;
	case 'delete':
		$content .= Delete_Users($request);
	break;
	}

	return $content;
}

?>
Return current item: ChiCoMaS - Chilek CMS