<?
    $_id 
= isset($_GET['i']) ? intval($_GET['i']) : 0;
    
$_name = isset($_POST['name']) ? trim(strval($_POST['name'])) : ''
    
$_desc = isset($_POST['description']) ? trim(strval($_POST['description'])) : ''

    
$community mysql_query("SELECT * FROM community_forums, community_sections, community WHERE community_forums.forum_id = " sq($_id) . " AND community_forums.forum_deleted = '0' AND community_forums.section_id = community_sections.section_id AND community_sections.section_deleted = '0' AND community_sections.community_id = community.community_id");
    if (!
$community_row mysql_fetch_assoc($community))
    {
        
make_cookie('notice''Sorry, you don\'t have permission to modify this community.');
        
header('Location: ./?s=community_create');
        die;
    }
    
    require_once(
'include/functions/community_permissions.php');
    
community_permissions($community_row['community_id']);
    
    if (!
$GLOBALS['auth']['community']['administration'])
    {
        
make_cookie('notice''Sorry, you don\'t have permission to modify this community.');
        
header('Location: ./?s=community_create');
        die;
    }
    
    require_once(
'include/functions/community_forum_valid.php');
    if (
$_err community_forum_valid($_name$_desc))    
    {
        
make_cookie('notice'$_err);
        
header('Location: ./?s=community_forum_modify&i=' $community_row['forum_id']);
    }    

    
mysql_query("UPDATE community_forums SET forum_name_english = " sq($_name) . ", forum_name_french = " sq($_name) . ", forum_description_english = " sq($_desc) . ", forum_description_french = " sq($_desc) . " WHERE forum_id = '" $community_row['forum_id'] . "'");
    
    
header('Location: ./?s=community_forum_modify&i=' $community_row['forum_id']);
    die;
?>