<?php
	if( !$this->user->is_logged ) {
		$this->redirect('home');
	}
	
	$D->codgroup = '';
	if ($this->param('g')) $D->codgroup = $this->param('g');

	if (empty($D->codgroup)) $this->redirect($C->SITE_URL.'dashboard/groups');	
	
	/*************************************************************************/
	// needed before proceeding
	require_once('_all-required-language.php');
	
	$this->load_langfile('global/global.php');	
	$this->load_langfile('inside/dashboard.php');

	/*************************************************************************/
	
	
	require_once('_all-required-dashboard.php');
	

	/*************************************************************************/

	$r = $this->db2->query("SELECT * FROM groups WHERE code='".$D->codgroup."' AND idcreator=".$this->user->id." LIMIT 1");
	
	if (!$obj = $this->db2->fetch_object($r)) {
		$this->redirect($C->SITE_URL.'dashboard/groups');
	} else {
		$D->idgroup = $obj->idgroup;
		$D->codegroup = $obj->code;
		$D->num_members = $obj->num_members;
		$D->numpostsgroup = $obj->num_posts;
		$D->covergroup = $obj->cover_group;
		$D->namegroup = stripslashes($obj->name_group);
		$D->aboutgroup = stripslashes($obj->about_group);
		$D->urlgroup = $obj->url;
		$D->privacy = $obj->privacy;
	}
	
	/*************************************************************************/

	$D->optionactive = 12;
	$D->tab_active = 1;
	$this->load_template('dashboard-groups-edit.php');
?>