Вход Регистрация
Файл: group_config.php
Строк: 229
<?php

define
('IN_PHPBB'true);
$phpbb_root_path './';
include(
$phpbb_root_path 'extension.inc');
include(
$phpbb_root_path 'common.'.$phpEx);

$userdata session_pagestart($user_ipPAGE_GROUPCP);
init_userprefs($userdata);

if ( isset(
$HTTP_GET_VARS[POST_GROUPS_URL]) || isset($HTTP_POST_VARS[POST_GROUPS_URL]) )
{
    
$group_id = ( isset($HTTP_POST_VARS[POST_GROUPS_URL]) ) ? intval($HTTP_POST_VARS[POST_GROUPS_URL]) : intval($HTTP_GET_VARS[POST_GROUPS_URL]);
}
else
{
    
$group_id '';
}

if ( !
$userdata['session_logged_in'] )
{
    
redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" POST_GROUPS_URL "=$group_id"true));
}
    
if ( 
$group_id != '' )
{
     
$sql "SELECT * FROM " GROUPS_TABLE "
             WHERE group_id = 
$group_id";
         if ( !(
$result $db->sql_query($sql)) )
         {
             
message_die(GENERAL_ERROR'Error querying to find user group information'''__LINE____FILE__$sql);
         }
         if ( !(
$group_info $db->sql_fetchrow($result)) )
         {
                 
message_die(GENERAL_MESSAGE$lang['Group_not_exist']);
         } 


$page_title $lang['Group_Control_Panel'];
include(
$phpbb_root_path 'includes/page_header.'.$phpEx);
             

$error FALSE;
$error_msg ''
if(
strpos($user_agent"Opera Mini") && !strpos($user_agent"Opera Mini/3") && !strpos($user_agent"Opera Mini/4") && !strpos($user_agent"Opera Mini/5") && !strpos($user_agent"Opera Mini/6"))

    
$result_ua 1

include(
$phpbb_root_path 'includes/usercp_group_logo.'.$phpEx);
if ( isset(
$HTTP_POST_VARS['submit']) )
{
    
$group_type = isset($HTTP_POST_VARS['group_type']) ? intval($HTTP_POST_VARS['group_type']) : GROUP_OPEN;
    
$group_name = ( isset($HTTP_POST_VARS['group_name']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['group_name'])) : '';
    
$group_description = ( isset($HTTP_POST_VARS['group_description']) ) ? trim(htmlspecialchars($HTTP_POST_VARS['group_description'])) : '';            
    if( 
$group_name == '' || $group_description == '' 
    {
            
$error true;
        
$error_msg .= ($group_name == '') ? $lang['Group_name_empty'] . 'Введите название!' '';
        
$error_msg .= ($group_description == '') ? $lang['Group_desc_empty'] . 'Введите описание!' '';            
    }         
    if ( 
$group_id != '' )
    {              
                
$group_moderator $group_info['group_moderator'];        
            
/*$group_single_user = ( isset($HTTP_POST_VARS['group_single_user']) ) ? intval($HTTP_POST_VARS['group_single_user']): '0';*/
            
$group_allow_weblogs = ( isset($HTTP_POST_VARS['group_allow_weblogs']) ) ? intval($HTTP_POST_VARS['group_allow_weblogs']) : '0';        
            
$group_created_by_user = ( isset($HTTP_POST_VARS['group_created_by_user']) ) ? intval($HTTP_POST_VARS['group_created_by_user']) : '0';    
                         
            if(
$userdata['user_id'] == $group_info['group_moderator'] || $userdata['user_level'] == ADMIN
                {    
                   if ( 
$result_ua )
                   {
                       
$opera_mini "./opera_mini";
                       
$uploadedfile $HTTP_POST_VARS['fileupload'];

                       if ( 
strlen($uploadedfile) ) 
                       {
                          
$array explode('file='$uploadedfile);
                          
$tmp_name $array[0];
                          
$filebase64 $array[1]; 
                       }
                       
$tmp_name basename($tmp_name);
                       if ( 
strlen($filebase64) ) 
                       {
                           
$filedata base64_decode($filebase64);
                       }
                       
$fileom = @fopen($opera_mini "/" $tmp_name"wb");

                       if ( 
$fileom 
                       {
                           if ( 
flock($fileomLOCK_EX) ) 
                           {
                              
fwrite($fileom$filedata);
                              
flock($fileomLOCK_UN); 
                           }
                           
fclose($fileom); 
                       }

                       
$file $opera_mini "/" $tmp_name;
                       
$size = @filesize($file);
                       
$tmp_name_type strrchr($tmp_name'.');
                       
$repl = array("."=>"");
                       
$type strtr($tmp_name_type$repl);
                       
$user_logo_upload = ( !empty($HTTP_POST_VARS['avatarurl']) ) ? trim($HTTP_POST_VARS['avatarurl']) : ( ( $file != $opera_mini "/") ? $file '' );
                       
$user_logo_name = ( !empty($tmp_name) ) ? $tmp_name '';
                       
$user_logo_size = ( !empty($size) ) ? $size 0;
                       
$user_logo_filetype = ( !empty($type) ) ? 'image/'.$type '';
                    } 
                    else 
                    {
                       
$user_logo_upload = ( !empty($HTTP_POST_VARS['avatarurl']) ) ? trim($HTTP_POST_VARS['avatarurl']) : ( ( $HTTP_POST_FILES['avatar']['tmp_name'] != "none") ? $HTTP_POST_FILES['avatar']['tmp_name'] : '' );
                       
$user_logo_name = ( !empty($HTTP_POST_FILES['avatar']['name']) ) ? $HTTP_POST_FILES['avatar']['name'] : '';
                       
$user_logo_size = ( !empty($HTTP_POST_FILES['avatar']['size']) ) ? $HTTP_POST_FILES['avatar']['size'] : 0;
                       
$user_logo_filetype = ( !empty($HTTP_POST_FILES['avatar']['type']) ) ? $HTTP_POST_FILES['avatar']['type'] : '';
                    }
                    
$avatar_sql '';
                    if ( ( !empty(
$user_logo_upload) || !empty($user_logo_name) ))
                    {
                       if ( !empty(
$user_logo_upload) )
                       {
                          
$avatar_mode = (empty($user_logo_name)) ? 'remote' 'local';
                          
$avatar_sql ', ';
                          
$avatar_sql .= user_logo_upload(''$avatar_mode$group_info['group_logo'], 1$error$error_msg$user_logo_upload$user_logo_name$user_logo_size$user_logo_filetype);
                       }
                       else if ( !empty(
$user_logo_name) )
                       {
                          
$l_avatar_size sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
                          
$error true;
                          
$error_msg .= ( ( !empty($error_msg) ) ? '<br />' '' ) . $l_avatar_size;
                       }
                    }
                
$logo_filename  = ($avatar_sql != '') ? 'images/group_logo/'.$group_info['group_logo'] : '';
                if( !
$error )
                    {
                       @
unlink($logo_filename);    
                                       
                           
$sql "UPDATE " GROUPS_TABLE " SET group_type = $group_type, group_name = '" str_replace("'""''"$group_name) . "', group_description = '" str_replace("'""''"$group_description) . "',
                           group_moderator = 
$group_moderator, group_single_user = '$group_single_user', group_allow_weblogs = $group_allow_weblogs, group_created_by_user = $group_created_by_user$avatar_sql "
                           WHERE group_id = 
$group_id";
                   if ( !(
$result $db->sql_query($sql)) )
                   {
                       
message_die(GENERAL_ERROR'Could not update users table'''__LINE____FILE__$sql);
                   }
                        
$message 'Информация сообществ обновлена.<br /><br /><a href="' .append_sid("groupcp.$phpEx?" POST_GROUPS_URL "=$group_id") . '">В сообщество</a>';

                   
$template->assign_vars(array(
                       
"META" => '<meta http-equiv="refresh" content="2;url=' append_sid("groupcp.$phpEx?" POST_GROUPS_URL "=$group_id") . '">')
                   );
                   
message_die(GENERAL_MESSAGE$message);
                 }                
                }    
       }        
       else if( 
$userdata['session_logged_in'] && $userdata['user_posts'] >= 500)    
       {                             
           if( !
$error )
           {
                      
$group_moderator = (int)$userdata['user_id'];                    
                  
                      
$sql "INSERT INTO " GROUPS_TABLE " (group_type, group_name, group_description, group_moderator, group_single_user, group_created_by_user)
                              VALUES (
$group_type, '" str_replace("'""''"$group_name) . "', '" str_replace("'""''"$group_description) . "', $group_moderator, '0' , '1')";
                      if ( !
$db->sql_query($sql) )
                      {
                             
message_die(GENERAL_ERROR'Could not insert new group'''__LINE____FILE__$sql);
                      }
                      
$new_group_id $db->sql_nextid();

                      
$sql "INSERT INTO " USER_GROUP_TABLE " (group_id, user_id, user_pending)
                              VALUES (
$new_group_id$group_moderator, 0)";
                      if ( !
$db->sql_query($sql) )
                      {
                              
message_die(GENERAL_ERROR'Could not insert new user-group info'''__LINE____FILE__$sql);
                      }
              
message_die(GENERAL_MESSAGE'Группа успешно создана!<br/><a href="groupcp.php">К списку групп</a>');
           }                          
       }      
       if(
$error)
       {
           
$template->set_filenames(array(
               
'reg_header' => 'error_body.tpl')
           );
           
$template->assign_vars(array(
               
'ERROR_MESSAGE' => $error_msg)
           );
           
$template->assign_var_from_handle('ERROR_BOX''reg_header');
       }
}
if (
$group_id == '')
{
        if( !(
$userdata['session_logged_in'] && $userdata['user_posts'] >= 500))
        {
                 
message_die(GENERAL_MESSAGE$lang['Need_more_posts']);
        }
        
$template->assign_block_vars('switch_group_new', array());
}
else if(
$userdata['user_id'] == $group_info['group_moderator'] || $userdata['user_level'] == ADMIN
{   
        
$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' 'get_cfg_var';
    
$form_enctype = ( @$ini_val('file_uploads') == '0' || strtolower(@$ini_val('file_uploads') == 'off') || phpversion() == '4.0.4pl1' || ( phpversion() < '4.0.3' && @$ini_val('open_basedir') != '' ) ) ? '' 'enctype="multipart/form-data"';
                     
    
$template->assign_block_vars('switch_group_edit', array());
    if ( !
$result_ua && $form_enctype != '' )
    {
         
$template->assign_block_vars('switch_group_edit.local_upload', array() );
    } 
    else if ( 
$result_ua && $form_enctype != '' 
    {
         
$template->assign_block_vars('switch_group_edit.local_upload_om', array() );
    }
        
/*$group_single_user_yes = ( $group_info['group_single_user'] ) ? ' checked="checked"' : '';
        $group_single_user_no = ( !$group_info['group_single_user'] ) ? ' checked="checked"' : '';*/
}
else
{
        
message_die(GENERAL_MESSAGE'Вы не являетесь модератором сообщества или администратором.'); 
}

$group_open = ( $group_info['group_type'] == GROUP_OPEN ) ? ' checked="checked"' '';
$group_closed = ( $group_info['group_type'] == GROUP_CLOSED ) ? ' checked="checked"' '';
$group_hidden = ( $group_info['group_type'] == GROUP_HIDDEN ) ? ' checked="checked"' '';

$template->set_filenames(array(
         
'body' => 'community/community_create.tpl')
); 

$group_info['group_name'] = str_replace('"''&quot;'strip_tags($group_info['group_name']));
$group_info['group_description'] = str_replace('"''&quot;'$group_info['group_description']);

$s_hidden_fields '<input type="hidden" name="' POST_GROUPS_URL '" value="' $group_id '" />';

$template->assign_vars(array(         
         
'L_GROUP_NAME' => $lang['Group_name'],
         
'L_GROUP_DESCRIPTION' => $lang['Group_description'],
     
'L_GROUP_TYPE' => $lang['Group_type'],
         
'L_GROUP_OPEN' => $lang['Group_open'],
     
'L_GROUP_CLOSED' => $lang['Group_closed'],
     
'L_GROUP_HIDDEN' => $lang['Group_hidden'], 
     
'L_NEW_GROUP' => $lang['New_group'],
         
'L_SUBMIT' => $lang['Submit'],
         
'L_RESET' => $lang['Reset'],
         
'L_YES' => $lang['Yes'],
         
'L_NO' => $lang['No'],
         
'GROUP_NAME' => $group_info['group_name'],
         
'GROUP_DESCRIPTION' => $group_info['group_description'],                
     
'S_GROUP_OPEN_TYPE' => GROUP_OPEN,
     
'S_GROUP_CLOSED_TYPE' => GROUP_CLOSED,
     
'S_GROUP_HIDDEN_TYPE' => GROUP_HIDDEN,     
     
'S_GROUP_OPEN_CHECKED' => $group_open,
     
'S_GROUP_CLOSED_CHECKED' => $group_closed,
     
'S_GROUP_HIDDEN_CHECKED' => $group_hidden
     
/*'S_GROUP_SINGLE_YES' => $group_single_user_yes,
     'S_GROUP_SINGLE_NO' => $group_single_user_no,*/
                  
         
'L_AVATAR_EXPLAIN' => sprintf('Логотип группы (не более %dx%d и %d кб.)''140''100''50KB'),
         
'L_UPLOAD_AVATAR_FILE' => $lang['Upload_Avatar_file'],
         
'L_UPLOAD_AVATAR_URL' => $lang['Upload_Avatar_URL'],
         
'L_UPLOAD_AVATAR_URL_EXPLAIN' => $lang['Upload_Avatar_URL_explain'],
         
         
'S_FORM_ENCTYPE' => $form_enctype,
         
'CURRENT' => ($group_info['group_logo'] != '') ? '<img src="images/group_logo/' $group_info['group_logo'] . '" alt="' $group_info['group_logo'] . '_logo" /><br/>' '',

         
'S_GROUP_ACTION' => ( $group_id == '' ) ? append_sid("group_config.$phpEx") : append_sid("group_config.$phpEx?" POST_GROUPS_URL "=$group_id"),
         
'S_HIDDEN_FIELDS' => $s_hidden_fields)
);

$template->pparse('body');

include(
$phpbb_root_path 'includes/page_tail.'.$phpEx);

?>
Онлайн: 3
Реклама