/***************************************************************************
* Dolphin Smart Community Builder
* -----------------
* begin : Mon Mar 23 2006
* copyright : (C) 2006 BoonEx Group
* website : http://www.boonex.com/
* This file is part of Dolphin - Smart Community Builder
*
* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License.
* http://creativecommons.org/licenses/by/3.0/
*
* Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Creative Commons Attribution 3.0 License for more details.
* You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin,
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once( '../inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'admin_design.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'utils.inc.php' );
require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolGroups.php' );
$logged['admin'] = member_auth( 1 );
$_page['header'] = 'Groups';
$_page['css_name'] = 'groups.css';
$actionMsg = '';
switch( $_REQUEST['action'] )
{
case 'add_cat':
$categName = trim( $_POST['Categ_Name'] );
if( $categName ) {
$sPrepName = process_db_input($categName);
$sNewURI = uriGenerate($sPrepName, 'GroupsCateg', 'Uri', 255);
db_res( "INSERT INTO `GroupsCateg` SET `Name`='{$sPrepName}', `Uri`='{$sNewURI}'" );
$newID = mysql_insert_id();
if( $newID )
$actionMsg .= 'Added succesfully';
else
$actionMsg .= 'Some error occured while adding';
} else
$actionMsg .= 'Please enter category name';
break;
case 'del_cat':
$catID = (int)$_GET['cat'];
if( $catID ) {
db_res( "DELETE FROM `GroupsCateg` WHERE `ID`=$catID" );
if( mysql_affected_rows() )
$actionMsg .= 'Deleted succesfully';
else
$actionMsg .= 'Couldn\'t delete';
}
break;
case 'edit_cat':
$catID = (int)$_REQUEST['cat'];
$name = trim( $_REQUEST['name'] );
if( $catID and $name ) {
db_res( "UPDATE `GroupsCateg` SET `Name`='".process_db_input($name)."' WHERE `ID`=$catID" );
if( mysql_affected_rows() )
$actionMsg .= 'Renamed succesfully';
else
$actionMsg .= 'Error while renaming';
}
break;
case 'suspend_group':
$groupID = (int)$_REQUEST['group'];
if( $groupID ) {
db_res( "UPDATE `Groups` SET `status`='Suspended' WHERE `ID`=$groupID" );
}
break;
case 'activate_group':
$groupID = (int)$_REQUEST['group'];
if( $groupID ) {
db_res( "UPDATE `Groups` SET `status`='Active' WHERE `ID`=$groupID" );
}
break;
}
TopCodeAdmin();
ContentBlockHead("Groups Categories");
?>