";
}
//-----------------------------------------
if ( $r['root_forum'] )
{
$css = 'pformstrip';
}
else
{
$css = '';
}
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array(
"".$r['depthed_name']."",
$show,
$read,
$reply,
$start,
$upload
) ,$css );
}
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Обновить настройки доступа");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
$this->ipsclass->admin->output();
}
/*-------------------------------------------------------------------------*/
// Edit perm name
/*-------------------------------------------------------------------------*/
function edit_name_perm()
{
//-----------------------------------------
// Check for legal ID
//-----------------------------------------
if ($this->ipsclass->input['id'] == "")
{
$this->ipsclass->admin->error("Нельзя изменить ID группы, попытайтесь снова");
}
if ( $this->ipsclass->input['perm_name'] == "" )
{
$this->ipsclass->admin->error("Необходимо ввести имя");
}
$gid = $this->ipsclass->input['id'];
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'forum_perms', 'where' => "perm_id=".$this->ipsclass->input['id'] ) );
$this->ipsclass->DB->simple_exec();
if ( ! $gr = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->admin->error("Не действительный ID группы");
}
$this->ipsclass->DB->do_update( 'forum_perms', array( 'perm_name' => $this->ipsclass->input['perm_name'] ), 'perm_id='.$this->ipsclass->input['id'] );
$this->ipsclass->admin->save_log("Права доступа на форум отредактированы для маски: '{$gr['perm_name']}'");
$this->ipsclass->admin->done_screen("Права на форум для группы – обновлены", "Настройка уровня доступа", "{$this->ipsclass->form_code}&code=permsplash" );
}
/*-------------------------------------------------------------------------*/
// Save forum perms
/*-------------------------------------------------------------------------*/
function do_forum_perms()
{
//-----------------------------------------
// Check for legal ID
//-----------------------------------------
if ($this->ipsclass->input['id'] == "")
{
$this->ipsclass->admin->error("Нельзя изменить ID группы");
}
$gid = $this->ipsclass->input['id'];
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'forum_perms', 'where' => "perm_id=".$this->ipsclass->input['id'] ) );
$this->ipsclass->DB->simple_exec();
if ( ! $gr = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->admin->error("Недействительный ID группы");
}
//-----------------------------------------
// Pull the forum data..
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'forums', 'order' => "position ASC" ) );
$forum_q = $this->ipsclass->DB->simple_exec();
while ( $row = $this->ipsclass->DB->fetch_row( $forum_q ) )
{
$perms = unserialize(stripslashes( $row['permission_array'] ) );
$read = "";
$reply = "";
$start = "";
$upload = "";
$show = "";
//-----------------------------------------
// Is this global?
//-----------------------------------------
if ($perms['read_perms'] == '*')
{
$read = '*';
}
else
{
//-----------------------------------------
// Split the set IDs
//-----------------------------------------
$read_ids = explode( ",", $perms['read_perms'] );
if ( is_array($read_ids) )
{
foreach ($read_ids as $i)
{
//-----------------------------------------
// If it's the current ID, skip
//-----------------------------------------
if ($gid == $i)
{
continue;
}
else
{
$read .= $i.",";
}
}
}
//-----------------------------------------
// Was the box checked?
//-----------------------------------------
if ($this->ipsclass->input[ 'read_'.$row['id'] ] == 1)
{
// Add our group ID...
$read .= $gid.",";
}
// Tidy..
$read = preg_replace( "/,$/", "", $read );
$read = preg_replace( "/^,/", "", $read );
}
//-----------------------------------------
// Reply topics..
//-----------------------------------------
if ($perms['reply_perms'] == '*')
{
$reply = '*';
}
else
{
$reply_ids = explode( ",", $perms['reply_perms'] );
if ( is_array($reply_ids) )
{
foreach ($reply_ids as $i)
{
if ($gid == $i)
{
continue;
}
else
{
$reply .= $i.",";
}
}
}
if ($this->ipsclass->input[ 'reply_'.$row['id'] ] == 1)
{
$reply .= $gid.",";
}
$reply = preg_replace( "/,$/", "", $reply );
$reply = preg_replace( "/^,/", "", $reply );
}
//-----------------------------------------
// Start topics..
//-----------------------------------------
if ($perms['start_perms'] == '*')
{
$start = '*';
}
else
{
$start_ids = explode( ",", $perms['start_perms'] );
if ( is_array($start_ids) )
{
foreach ($start_ids as $i)
{
if ($gid == $i)
{
continue;
}
else
{
$start .= $i.",";
}
}
}
if ($this->ipsclass->input[ 'start_'.$row['id'] ] == 1)
{
$start .= $gid.",";
}
$start = preg_replace( "/,$/", "", $start );
$start = preg_replace( "/^,/", "", $start );
}
//-----------------------------------------
// Upload topics..
//-----------------------------------------
if ($perms['upload_perms'] == '*')
{
$upload = '*';
}
else
{
$upload_ids = explode( ",", $perms['upload_perms'] );
if ( is_array($upload_ids) )
{
foreach ($upload_ids as $i)
{
if ($gid == $i)
{
continue;
}
else
{
$upload .= $i.",";
}
}
}
if ($this->ipsclass->input[ 'upload_'.$row['id'] ] == 1)
{
$upload .= $gid.",";
}
$upload = preg_replace( "/,$/", "", $upload );
$upload = preg_replace( "/^,/", "", $upload );
}
//-----------------------------------------
// Show topics..
//-----------------------------------------
if ($perms['show_perms'] == '*')
{
$show = '*';
}
else
{
$show_ids = explode( ",", $perms['show_perms'] );
if ( is_array($show_ids) )
{
foreach ($show_ids as $i)
{
if ($gid == $i)
{
continue;
}
else
{
$show .= $i.",";
}
}
}
if ($this->ipsclass->input[ 'show_'.$row['id'] ] == 1)
{
$show .= $gid.",";
}
$show = preg_replace( "/,$/", "", $show );
$show = preg_replace( "/^,/", "", $show );
}
//-----------------------------------------
// Update the DB...
//-----------------------------------------
$this->ipsclass->DB->do_update( 'forums', array( 'permission_array' => addslashes(serialize(array(
'start_perms' => $start,
'reply_perms' => $reply,
'read_perms' => $read,
'upload_perms' => $upload,
'show_perms' => $show
) ) ) ), 'id='.$row['id']);
}
//-----------------------------------------
// Recache forums
//-----------------------------------------
require_once( ROOT_PATH.'sources/action_admin/forums.php' );
$adforums = new ad_forums();
$adforums->ipsclass =& $this->ipsclass;
$adforums->recache_forums();
$this->ipsclass->admin->save_log("Права доступа на форум отредактированы для маски: '{$gr['perm_name']}'");
$this->ipsclass->admin->done_screen("Права на форум для группы – обновлены", "Настройка уровня доступа", "{$this->ipsclass->form_code}&code=permsplash", 'redirect' );
}
/*-------------------------------------------------------------------------*/
// Delete a group
/*-------------------------------------------------------------------------*/
function delete_form()
{
if ($this->ipsclass->input['id'] == "")
{
$this->ipsclass->admin->error("Нельзя изменить ID группы, попытайтесь снова");
}
if ($this->ipsclass->input['id'] < 5)
{
$this->ipsclass->admin->error("Вы не можете перемещать группы, которые используются в данный момент, но переименовать и отредактировать функции можно");
}
$this->ipsclass->admin->page_title = "Удаление пользовательской группы";
$this->ipsclass->admin->page_detail = "Пожалуйста, убедитесь в том, что хотите удалить данную группу.";
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(id) as users', 'from' => 'members', 'where' => "mgroup=".$this->ipsclass->input['id'] ) );
$this->ipsclass->DB->simple_exec();
$black_adder = $this->ipsclass->DB->fetch_row();
if ($black_adder['users'] < 1)
{
$black_adder['users'] = 0;
}
$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(id) as users', 'from' => 'members', 'where' => "mgroup_others LIKE '%".$this->ipsclass->input['id']."%'" ) );
$this->ipsclass->DB->simple_exec();
$extra_group = $this->ipsclass->DB->fetch_row();
if ($extra_group['users'] < 1)
{
$extra_group['users'] = 0;
}
$this->ipsclass->DB->simple_construct( array( 'select' => 'g_title', 'from' => 'groups', 'where' => "g_id=".$this->ipsclass->input['id'] ) );
$this->ipsclass->DB->simple_exec();
$group = $this->ipsclass->DB->fetch_row();
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => 'g_id, g_title', 'from' => 'groups', 'where' => "g_id <> ".$this->ipsclass->input['id'] ) );
$this->ipsclass->DB->simple_exec();
$mem_groups = array();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
//-----------------------------------------
// Leave out root admin group
//-----------------------------------------
if ( $this->ipsclass->vars['admin_group'] == $r['g_id'] )
{
if ( $this->ipsclass->member['mgroup'] != $this->ipsclass->vars['admin_group'] )
{
continue;
}
}
$mem_groups[] = array( $r['g_id'], $r['g_title'] );
}
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , 'dodelete' ),
2 => array( 'act' , 'group' ),
3 => array( 'id' , $this->ipsclass->input['id'] ),
4 => array( 'name' , $group['g_title'] ),
5 => array( 'section', $this->ipsclass->section_code ),
) );
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Подтверждение перемещения: ".$group['g_title'] );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Количество пользователей в этой группе" ,
"".$black_adder['users']."",
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Количество пользователей с этой группой, как вторичная группа Эта вторичная группа будет удалена у этих пользователей." ,
"".$extra_group['users']."",
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Переместить пользователей из этой группы в..." ,
$this->ipsclass->adskin->form_dropdown("to_id", $mem_groups )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_form("Удалить эту группу");
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
$this->ipsclass->admin->output();
}
/*-------------------------------------------------------------------------*/
// DO DELETE
/*-------------------------------------------------------------------------*/
function do_delete()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->ipsclass->input['id'] = intval($this->ipsclass->input['id']);
$this->ipsclass->input['to_id'] = intval($this->ipsclass->input['to_id']);
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $this->ipsclass->input['id'] )
{
$this->ipsclass->admin->error("Нельзя изменить ID группы, попытайтесь снова");
}
if ( ! $this->ipsclass->input['to_id'] )
{
$this->ipsclass->admin->error("Нельзя переместить в указанную группу. /me плачет");
}
//-----------------------------------------
// Ensure we didn't choose the root admin
// group if we're not a root admin
//-----------------------------------------
if ( $this->ipsclass->vars['admin_group'] == $this->ipsclass->input['id'] )
{
if ( $this->ipsclass->member['mgroup'] != $this->ipsclass->vars['admin_group'] )
{
$this->ipsclass->admin->error("Извините, но у вас нет прав, чтобы переместить в эту группу");
}
}
//-----------------------------------------
// Check to make sure that the relevant groups exist.
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => 'g_id', 'from' => 'groups', 'where' => "g_id IN(".$this->ipsclass->input['id'].",".$this->ipsclass->input['to_id'].")" ) );
$this->ipsclass->DB->simple_exec();
if ( $this->ipsclass->DB->get_num_rows() != 2 )
{
$this->ipsclass->admin->error("Нельзя изменить ID удаленной группы");
}
$this->ipsclass->DB->do_update( 'members', array( 'mgroup' => $this->ipsclass->input['to_id'] ), 'mgroup='.$this->ipsclass->input['id'] );
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'groups', 'where' => "g_id=".$this->ipsclass->input['id'] ) );
//-----------------------------------------
// Look for promotions in case we have members to be promoted to this group...
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => 'g_id', 'from' => 'groups', 'where' => "g_promotion LIKE '{$this->ipsclass->input['id']}&%'" ) );
$prq = $this->ipsclass->DB->simple_exec();
while ( $row = $this->ipsclass->DB->fetch_row($prq) )
{
$this->ipsclass->DB->do_update( 'groups', array( 'g_promotion' => '-1&-1' ), 'g_id='.$row['g_id'] );
}
//-----------------------------------------
// Remove from moderators table
//-----------------------------------------
$this->ipsclass->DB->simple_exec_query( array( 'delete' => 'moderators', 'where' => "is_group=1 AND group_id=".$this->ipsclass->input['id'] ) );
//-----------------------------------------
// Remove as a secondary group
//-----------------------------------------
$this->ipsclass->DB->simple_construct( array( 'select' => 'mgroup,mgroup_others,id', 'from' => 'members', 'where' => "mgroup_others LIKE '%".$this->ipsclass->input['id']."%'" ) );
$exg = $this->ipsclass->DB->simple_exec();
while( $others = $this->ipsclass->DB->fetch_row($exg) )
{
$extra = array();
$extra = explode( ",", $others['mgroup_others'] );
$to_insert = array();
if( count( $extra ) )
{
foreach( $extra as $key => $mgroup_other )
{
if( $mgroup_other != $this->ipsclass->input['id'] )
{
if( $mgroup_other != "" )
{
$to_insert[] = $mgroup_other;
}
}
}
if( count( $to_insert ) )
{
$new_others = ','. implode( ',', $to_insert ) .',';
}
else
{
$new_others = "";
}
$this->ipsclass->DB->do_update( 'members', array( 'mgroup_others' => $new_others ), 'id='.$others['id'] );
}
}
$this->rebuild_group_cache();
$this->ipsclass->admin->save_log("Пользовательская группа'{$this->ipsclass->input['name']}' удалена");
$this->ipsclass->main_msg = "Группа удалена";
$this->main_screen();
}
/*-------------------------------------------------------------------------*/
// Save changes to DB
/*-------------------------------------------------------------------------*/
function save_group($type='edit')
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->ipsclass->input['id'] = intval($this->ipsclass->input['id']);
//-----------------------------------------
// Check...
//-----------------------------------------
if ($this->ipsclass->input['g_title'] == "")
{
$this->ipsclass->admin->error("Вы должны ввести название группы.");
}
if ($type == 'edit')
{
if ( ! $this->ipsclass->input['id'] )
{
$this->ipsclass->admin->error("Нельзя изменить id группы");
}
if ($this->ipsclass->input['id'] == $this->ipsclass->vars['admin_group'] and $this->ipsclass->input['g_access_cp'] != 1)
{
$this->ipsclass->admin->error("Вы не можете удалить права на админцентр у этой группы");
}
}
//-----------------------------------------
// Sort out the perm mask id things
//-----------------------------------------
if ( is_array( $_POST['permid'] ) )
{
$perm_id = implode( ",", $_POST['permid'] );
}
else
{
$this->ipsclass->admin->error("Ни одной маски доступа не выбрано");
}
// Build up the hashy washy for the database ..er.. wase.
$prefix = preg_replace( "/'/", "'" , $this->ipsclass->txt_safeslashes($_POST['prefix']) );
$prefix = preg_replace( "/</" , "<" , $prefix );
$suffix = preg_replace( "/'/", "'" , $this->ipsclass->txt_safeslashes($_POST['suffix']) );
$suffix = preg_replace( "/</" , "<" , $suffix );
$promotion_a = '-1'; //id
$promotion_b = '-1'; // posts
if ($this->ipsclass->input['g_promotion_id'] > 0)
{
$promotion_a = $this->ipsclass->input['g_promotion_id'];
$promotion_b = $this->ipsclass->input['g_promotion_posts'];
}
if ( $this->ipsclass->input['g_attach_per_post'] and $this->ipsclass->input['g_attach_max'] > 0 )
{
if ( $this->ipsclass->input['g_attach_per_post'] > $this->ipsclass->input['g_attach_max'] )
{
$this->ipsclass->main_msg = "Вы не можете указывать лимит на сообщения более, чем общий глобальный лимит.";
$this->group_form('edit');
}
}
$this->ipsclass->input['p_max'] = str_replace( ":", "", $this->ipsclass->input['p_max'] );
$this->ipsclass->input['p_width'] = str_replace( ":", "", $this->ipsclass->input['p_width'] );
$this->ipsclass->input['p_height'] = str_replace( ":", "", $this->ipsclass->input['p_height'] );
$db_string = array(
'g_view_board' => $this->ipsclass->input['g_view_board'],
'g_mem_info' => $this->ipsclass->input['g_mem_info'],
'g_other_topics' => $this->ipsclass->input['g_other_topics'],
'g_use_search' => $this->ipsclass->input['g_use_search'],
'g_email_friend' => $this->ipsclass->input['g_email_friend'],
'g_invite_friend' => $this->ipsclass->input['g_invite_friend'],
'g_edit_profile' => $this->ipsclass->input['g_edit_profile'],
'g_post_new_topics' => $this->ipsclass->input['g_post_new_topics'],
'g_reply_own_topics' => $this->ipsclass->input['g_reply_own_topics'],
'g_reply_other_topics' => $this->ipsclass->input['g_reply_other_topics'],
'g_edit_posts' => $this->ipsclass->input['g_edit_posts'],
'g_edit_cutoff' => $this->ipsclass->input['g_edit_cutoff'],
'g_delete_own_posts' => $this->ipsclass->input['g_delete_own_posts'],
'g_open_close_posts' => $this->ipsclass->input['g_open_close_posts'],
'g_delete_own_topics' => $this->ipsclass->input['g_delete_own_topics'],
'g_post_polls' => $this->ipsclass->input['g_post_polls'],
'g_vote_polls' => $this->ipsclass->input['g_vote_polls'],
'g_use_pm' => $this->ipsclass->input['g_use_pm'],
'g_is_supmod' => $this->ipsclass->input['g_is_supmod'],
'g_access_cp' => $this->ipsclass->input['g_access_cp'],
'g_title' => trim($this->ipsclass->input['g_title']),
'g_can_remove' => $this->ipsclass->input['g_can_remove'],
'g_append_edit' => $this->ipsclass->input['g_append_edit'],
'g_access_offline' => $this->ipsclass->input['g_access_offline'],
'g_avoid_q' => $this->ipsclass->input['g_avoid_q'],
'g_avoid_flood' => $this->ipsclass->input['g_avoid_flood'],
'g_icon' => trim($this->ipsclass->txt_safeslashes($_POST['g_icon'])),
'g_attach_max' => $this->ipsclass->input['g_attach_max'],
'g_avatar_upload' => $this->ipsclass->input['g_avatar_upload'],
'g_calendar_post' => $this->ipsclass->input['g_calendar_post'],
'g_max_messages' => $this->ipsclass->input['g_max_messages'],
'g_max_mass_pm' => $this->ipsclass->input['g_max_mass_pm'],
'g_search_flood' => $this->ipsclass->input['g_search_flood'],
'prefix' => $prefix,
'suffix' => $suffix,
'g_promotion' => $promotion_a.'&'.$promotion_b,
'g_hide_from_list' => $this->ipsclass->input['g_hide_from_list'],
'g_post_closed' => $this->ipsclass->input['g_post_closed'],
'g_perm_id' => $perm_id,
'g_photo_max_vars' => $this->ipsclass->input['p_max'].':'.$this->ipsclass->input['p_width'].':'.$this->ipsclass->input['p_height'],
'g_dohtml' => $this->ipsclass->input['g_dohtml'],
'g_edit_topic' => $this->ipsclass->input['g_edit_topic'],
'g_email_limit' => intval($this->ipsclass->input['join_limit']).':'.intval($this->ipsclass->input['join_flood']),
'g_bypass_badwords' => $this->ipsclass->input['g_bypass_badwords'],
'g_can_msg_attach' => $this->ipsclass->input['g_can_msg_attach'],
'g_attach_per_post' => $this->ipsclass->input['g_attach_per_post'],
'g_topic_rate_setting' => intval($this->ipsclass->input['g_topic_rate_setting']),
'g_dname_changes' => intval($this->ipsclass->input['g_dname_changes']),
'g_dname_date' => intval($this->ipsclass->input['g_dname_date']),
);
if ($type == 'edit')
{
$this->ipsclass->DB->do_update( 'groups', $db_string, 'g_id='.$this->ipsclass->input['id'] );
// Update the title of the group held in the mod table incase it changed.
$this->ipsclass->DB->do_update( 'moderators', array( 'group_name' => trim($this->ipsclass->input['g_title']) ), 'group_id='.$this->ipsclass->input['id'] );
$this->ipsclass->admin->save_log("Отредактирована группа '{$this->ipsclass->input['g_title']}'");
$this->rebuild_group_cache();
$this->ipsclass->main_msg = "Группа отредактирована";
$this->main_screen();
}
else
{
$this->ipsclass->DB->do_insert( 'groups', $db_string );
$this->ipsclass->admin->save_log("Добавлена группа '{$this->ipsclass->input['g_title']}'");
$this->rebuild_group_cache();
$this->ipsclass->main_msg = "Группа добавлена";
$this->main_screen();
}
}
/*-------------------------------------------------------------------------*/
// Rebuild group cache
/*-------------------------------------------------------------------------*/
function rebuild_group_cache()
{
$this->ipsclass->cache['group_cache'] = array();
$this->ipsclass->DB->simple_construct( array( 'select' => "*",
'from' => 'groups'
) );
$this->ipsclass->DB->simple_exec();
while ( $i = $this->ipsclass->DB->fetch_row() )
{
$this->ipsclass->cache['group_cache'][ $i['g_id'] ] = $i;
}
$this->ipsclass->update_cache( array( 'name' => 'group_cache', 'array' => 1, 'deletefirst' => 1 ) );
}
/*-------------------------------------------------------------------------*/
// Clean Perm string
/*-------------------------------------------------------------------------*/
function clean_perms($str)
{
$str = preg_replace( "/,$/", "", $str );
$str = str_replace( ",,", ",", $str );
return $str;
}
/*-------------------------------------------------------------------------*/
// Add / edit group
/*-------------------------------------------------------------------------*/
function group_form($type='edit')
{
$all_groups = array( 0 => array ('none', 'Не продвигать') );
if ($type == 'edit')
{
if ($this->ipsclass->input['id'] == "")
{
$this->ipsclass->admin->error("Невозможно определить идентификатор (id) группы пользователей.");
}
if ( $this->ipsclass->vars['admin_group'] == $this->ipsclass->input['id'] )
{
if ( $this->ipsclass->member['mgroup'] != $this->ipsclass->vars['admin_group'] )
{
$this->ipsclass->admin->error("Извините, у вас нет доступа к редактированию этой группы. Эта группа относится к главным администраторам.");
}
}
$form_code = 'doedit';
$button = 'Изменить группу';
}
else
{
$form_code = 'doadd';
$button = 'Добавить группу';
}
if ($this->ipsclass->input['id'] != "")
{
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'groups', 'where' => "g_id=".$this->ipsclass->input['id'] ) );
$this->ipsclass->DB->simple_exec();
$group = $this->ipsclass->DB->fetch_row();
$this->ipsclass->DB->simple_construct( array( 'select' => 'g_id, g_title',
'from' => 'groups',
'where' => "g_id <> {$this->ipsclass->input['id']}",
'order' => 'g_title' ) );
}
else
{
$group = array();
$this->ipsclass->DB->simple_construct( array( 'select' => 'g_id, g_title',
'from' => 'groups',
'order' => 'g_title' ) );
}
//-----------------------------------------
// sort out the promotion stuff
//-----------------------------------------
list($group['g_promotion_id'], $group['g_promotion_posts']) = explode( '&', $group['g_promotion'] );
if ($group['g_promotion_posts'] < 1)
{
$group['g_promotion_posts'] = '';
}
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
if ( $r['g_id'] == $this->ipsclass->vars['admin_group'] )
{
continue;
}
$all_groups[] = array( $r['g_id'], $r['g_title'] );
}
//-----------------------------------------
$perm_masks = array();
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'forum_perms' ) );
$this->ipsclass->DB->simple_exec();
while ( $r = $this->ipsclass->DB->fetch_row() )
{
$perm_masks[] = array( $r['perm_id'], $r['perm_name'] );
}
//-----------------------------------------
if ($type == 'edit')
{
$this->ipsclass->admin->page_title = "Изменение группы пользователей: ".$group['g_title'];
}
else
{
$this->ipsclass->admin->page_title = 'Добавление группы пользователей';
$group['g_title'] = 'Новая группа';
}
$guest_legend = "";
if ($group['g_id'] == $this->ipsclass->vars['guest_group'])
{
$guest_legend = " (Не применительно к гостям)";
}
$this->ipsclass->admin->page_detail = "Пожалуйста, перепроверьте все еще раз перед продолжением.";
//-----------------------------------------
$this->ipsclass->html .= "\n";
$this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code' , $form_code ),
2 => array( 'act' , 'group' ),
3 => array( 'id' , $this->ipsclass->input['id'] ),
4 => array( 'section', $this->ipsclass->section_code ),
) , 'adform', "onSubmit='return checkform()'" );
list($p_max, $p_width, $p_height) = explode( ":", $group['g_photo_max_vars'] );
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
//-----------------------------------------
$prefix = preg_replace( "/'/", "'", $group['prefix'] );
$prefix = preg_replace( "/\"/", """, $prefix );
$prefix = preg_replace( "/", "<" , $prefix );
$suffix = preg_replace( "/'/", "'", $group['suffix'] );
$suffix = preg_replace( "/\"/", """, $suffix );
$suffix = preg_replace( "/", "<" , $suffix );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Глобальные настройки", "Основные настройки группы" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Название группы" ,
$this->ipsclass->adskin->form_input("g_title", $group['g_title'] )
) );
//-----------------------------------------
// Sort out default array
//-----------------------------------------
$this->ipsclass->html .=
"";
$arr = explode( ",", $group['g_perm_id'] );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Использовать следующие маски доступа к форумам...
Можно выбрать несколько, удерживая клавишу Ctrl" ,
$this->ipsclass->adskin->form_multiselect("permid[]", $perm_masks, $arr, 5, 'onfocus="saveit(this)"; onchange="saveit(this)";' )."Показать выбранные маски"
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Картинка (иконка) группы
Может выглядеть как style_images/1/folder_team_icons/admin.gif, так и в виде полного адреса 'http://' Используйте style_images/<#IMG_DIR#>/folder_team_icons/{image} (заменив {image} именем картинки) для динамической загрузки картинок из папки /style_images/ в стиль пользователей. (заполнять не обязательно)
" ,
$this->ipsclass->adskin->form_textarea("g_icon", $group['g_icon'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Отображение в списке активных пользователей [приставка перед именем пользователя] (поле можно оставить пустым) (Пример: <span style='color:red'>)" ,
$this->ipsclass->adskin->form_input("prefix", $prefix )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Отображение в списке активных пользователей [суффикс после имени пользователя] (поле можно оставить пустым) (Пример: </span>)" ,
$this->ipsclass->adskin->form_input("suffix", $suffix )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Скрыть эту группу из списка пользователей?" ,
$this->ipsclass->adskin->form_yes_no("g_hide_from_list", $group['g_hide_from_list'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Прикрепление файлов", "Управление правами на прикрепление файлов к сообщениям в темах, личных сообщениях и т.д." );
if( $type == 'edit' AND $group['g_attach_max'] == 0 )
{
$group['g_attach_maxdis'] = "unlimited";
}
else
{
$group['g_attach_maxdis'] = $this->ipsclass->size_format( $group['g_attach_max'] * 1024 );
}
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Глобальные: Максимальное общее место на диске для всех файлов (включая личные сообщения и сообщения в темах) (в килобайтах)".$this->ipsclass->adskin->js_help_link('mg_upload')."
Введите -1 для отключения возможности прикреплять файлы. Введите 0 для отключения действия ограничения на место.
" ,
$this->ipsclass->adskin->form_input("g_attach_max", $group['g_attach_max'] ). ' (установлено: '.$group['g_attach_maxdis'].')'
) );
if( $type == 'edit' AND $group['g_attach_per_post'] == 0 )
{
$group['g_attach_per_postdis'] = "unlimited";
}
else
{
$group['g_attach_per_postdis'] = $this->ipsclass->size_format( $group['g_attach_per_post'] * 1024 );
}
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "В сообщениях: Максимальное общее место на диске для прикрепленных файлов каждого сообщения или личного сообщения (в килобайтах)".$this->ipsclass->adskin->js_help_link('mg_upload')."
Введите 0 для отключения действия ограничения на место. Это значение должны быть меньшим, чем глобальное ограничение.
" ,
$this->ipsclass->adskin->form_input("g_attach_per_post", $group['g_attach_per_post'] ). ' (установлено: '.$group['g_attach_per_postdis'].')'
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Фотография: Максимальное место на диске для фотографии пользователя (в килобайтах) (Оставьте поле пустым для запрета загрузки фотографии вообще)" ,
$this->ipsclass->adskin->form_input("p_max", $p_max )." "
."Макс. ширина (px): "
."Макс. высота (px): "
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Аватар: Разрешить загрузку аватара с жесткого диска пользователя?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_avatar_upload", $group['g_avatar_upload'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Личные сообщения: Разрешить прикрепление файлов к личным сообщениям?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_can_msg_attach", $group['g_can_msg_attach'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Основные права", "Ограничения группы: что могут и не могут делать пользователи из данной группы" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут просматривать весь форум?" ,
$this->ipsclass->adskin->form_yes_no("g_view_board", $group['g_view_board'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут просматривать ОТКЛЮЧЕННЫЙ (OFFLINE) ФОРУМ?" ,
$this->ipsclass->adskin->form_yes_no("g_access_offline", $group['g_access_offline'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут просматривать профили пользователей и список пользователей?" ,
$this->ipsclass->adskin->form_yes_no("g_mem_info", $group['g_mem_info'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут просматривать темы, созданные другими пользователями?" ,
$this->ipsclass->adskin->form_yes_no("g_other_topics", $group['g_other_topics'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут использовать поиск по форуму?" ,
$this->ipsclass->adskin->form_yes_no("g_use_search", $group['g_use_search'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Временной интервал между повторным поиском по форуму (защита от массовых атак сервера) (в секундах) Введите количество секунд, в течение которых пользователь этой группы после использования поиска не сможет им воспользоваться повторно. Эта опция защищает форум от атак на сервер за счет массового поиска в короткий период времени. Введите 0 для отключения ограничения." ,
$this->ipsclass->adskin->form_input("g_search_flood", $group['g_search_flood'] )
) );
list( $limit, $flood ) = explode( ":", $group['g_email_limit'] );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Пользователи этой группы могут отправлять письма с форума на e-mail? Для отключения ограничений оставьте поле пустым $guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_email_friend", $group['g_email_friend'] )
." Разрешить отправку писем на e-mail только ". $this->ipsclass->adskin->form_simple_input("join_limit", $limit, 2 )." штук в 24 часа"
." ... и разрешить отправку только 1 письма на e-mail каждые ".$this->ipsclass->adskin->form_simple_input("join_flood", $flood, 2 )." минут"
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут редактировать свои личные данные?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_edit_profile", $group['g_edit_profile'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут использовать личные сообщения (PM)?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_use_pm", $group['g_use_pm'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Введите максимальное число пользователей для массовой рассылки через личные сообщения пользователем данной группы? (Введите 0 или оставьте поле пустым для отключения возможности массовой отправки личных сообщений)" ,
$this->ipsclass->adskin->form_input("g_max_mass_pm", $group['g_max_mass_pm'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Максимальное количество сохраняемых личных сообщений?$guest_legend" ,
$this->ipsclass->adskin->form_input("g_max_messages", $group['g_max_messages'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
//-----------------------------------------
$dd_topic_rate = array( 0 => array( 0, 'Нет' ), 1 => array( 1, 'Да (Не позволять изменять голоса)' ), 2 => array( 2, 'Да (Разрешить изменять голоса)' ) );
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Настройки сообщений", "Права пользователей этой группы для тем и сообщений" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут открывать новые темы (где разрешено)?" ,
$this->ipsclass->adskin->form_yes_no("g_post_new_topics", $group['g_post_new_topics'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут оценивать темы (где это разрешено)?" ,
$this->ipsclass->adskin->form_dropdown("g_topic_rate_setting", $dd_topic_rate, $group['g_topic_rate_setting'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут публиковать ответы в СВОИХ (созданных самим пользователем) темах?" ,
$this->ipsclass->adskin->form_yes_no("g_reply_own_topics", $group['g_reply_own_topics'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут публиковать ответы на ЧУЖИЕ темы (где разрешено)?" ,
$this->ipsclass->adskin->form_yes_no("g_reply_other_topics", $group['g_reply_other_topics'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут редактировать свои сообщения?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_edit_posts", $group['g_edit_posts'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Временное ограничение с даты публикации сообщения, после которого редактирование сообщения будет запрещено (в минутах)?$guest_legend Запрещает пользователям этой группы редактировать свои сообщения после окончания указанного периода времени. Введите 0 или оставьте поле пустым для отключения ограничения. " ,
$this->ipsclass->adskin->form_input("g_edit_cutoff", $group['g_edit_cutoff'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут удалять пометку «Отредактировано...» при редактировании сообщения?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_append_edit", $group['g_append_edit'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут удалять свои сообщения?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_delete_own_posts", $group['g_delete_own_posts'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут открывать/закрывать свои темы?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_open_close_posts", $group['g_open_close_posts'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут изменять названия и описания своих тем?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_edit_topic", $group['g_edit_topic'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут удалять свои темы?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_delete_own_topics", $group['g_delete_own_topics'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут создавать новые опросы (где разрешено)?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_post_polls", $group['g_post_polls'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут голосовать (где разрешено)?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_vote_polls", $group['g_vote_polls'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Не применять к пользователям данной группы флуд-контроль?" ,
$this->ipsclass->adskin->form_yes_no("g_avoid_flood", $group['g_avoid_flood'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Не применять проверку сообщений перед публикацией модераторами для пользователей этой группы?" ,
$this->ipsclass->adskin->form_yes_no("g_avoid_q", $group['g_avoid_q'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут добавлять новые события в календари?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_calendar_post", $group['g_calendar_post'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Могут использовать HTML в сообщениях?$guest_legend ".$this->ipsclass->adskin->js_help_link('mg_dohtml') ,
$this->ipsclass->adskin->form_yes_no("g_dohtml", $group['g_dohtml'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Не применять к пользователям данной группы фильтры плохих слов?$guest_legend " ,
$this->ipsclass->adskin->form_yes_no("g_bypass_badwords", $group['g_bypass_badwords'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// DISPLAY NAME OPTIONS
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Права на изменения имен", "Действителен, только когда стоит показ имен" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Изменение имени: Лимит дней
Это количество дней в течение которых пользователь может произвести изменения. Для примера \"30\" это означает, что пользователь может изменить свое имя только на протяжении 30-ти дней.
" ,
$this->ipsclass->adskin->form_input("g_dname_date", $group['g_dname_date'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( " Изменение имени: Макс. кол-во изменений в Х дней
Здесь вы указываете число раз, сколько пользователь сможет изменить свое имя в течение Х дней. Установите \"0\", чтобы запретить пользоваться этим преимуществом.
" ,
$this->ipsclass->adskin->form_input("g_dname_changes", $group['g_dname_changes'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
// MODERATOR OPTIONS
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Установки модерирования", "Управление модераторскими возможностями для этой группы пользователей" );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Сделать пользователей этой группы супермодераторами (возможность модерировать везде)?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_is_supmod", $group['g_is_supmod'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Разрешить доступ к админцентру форума для пользователей этой группы (очень важный пункт!)?$guest_legend" ,
$this->ipsclass->adskin->form_yes_no("g_access_cp", $group['g_access_cp'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Позволить публиковать ответы в закрытых темах?" ,
$this->ipsclass->adskin->form_yes_no("g_post_closed", $group['g_post_closed'] )
) );
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
//-----------------------------------------
$this->ipsclass->adskin->td_header[] = array( " " , "40%" );
$this->ipsclass->adskin->td_header[] = array( " " , "60%" );
//-----------------------------------------
$this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Продвижение пользователей группы" );
if ($group['g_id'] == $this->ipsclass->vars['admin_group'])
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Выберите 'Не перемещать' для отключения продвижения ".$this->ipsclass->adskin->js_help_link('mg_promote') ,
"Эта возможность отключена для группы главных администраторов."
) );
}
else
{
$this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "Выберите «Не продвигать» для отключения продвижения пользователей этой группы$guest_legend ".$this->ipsclass->adskin->js_help_link('mg_promote') ,
'Перемещать пользователей этой группы в другую группу пользователей (например, с более высокими правами) '.$this->ipsclass->adskin->form_dropdown("g_promotion_id", $all_groups, $group['g_promotion_id'] )
.' когда они набирают указанное далее количество сообщений: '.$this->ipsclass->adskin->form_simple_input('g_promotion_posts', $group['g_promotion_posts'] ).' (Тут используется значение счетчика сообщений пользователя).'
) );
}
$this->ipsclass->html .= $this->ipsclass->adskin->end_form($button);
$this->ipsclass->html .= $this->ipsclass->adskin->end_table();
$this->ipsclass->admin->output();
}
/*-------------------------------------------------------------------------*/
// Show "Management Screen
/*-------------------------------------------------------------------------*/
function main_screen()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$g_array = array();
$content = "";
$form = array();
//-----------------------------------------
// Page details
//-----------------------------------------
$this->ipsclass->admin->page_title = "Группы пользователей";
$this->ipsclass->admin->page_detail = "Разделение пользователей на группы является очень полезной и мощной функцией для организации пользователей на форуме. Нужно помнить, что есть 4 группы, которые Вы не можете удалить, это: (Ожидающие, Гости, Пользователи and Администраторы), однако Вы можете их редактировать. Рекомендуем Вам создать группу 'Модераторы' и наделить их соответствующими правам на форуме (в разделах), которых нет у простых пользователей. В параметрах доступа Вы можете произвести быстрые настройки доступов к созданию тем, ответам и чтению форумов. Параметры доступа можно также отредактировать и через меню 'Управление форумами'. ";
//-----------------------------------------
// Get groups
//-----------------------------------------
$this->ipsclass->DB->cache_add_query( 'groups_main_screen', array() );
$this->ipsclass->DB->cache_exec_query();
while ( $row = $this->ipsclass->DB->fetch_row() )
{
//-----------------------------------------
// Set up basics
//-----------------------------------------
$row['_can_delete'] = ( $row['g_id'] > 4 ) ? 1 : 0;
$row['_can_acp'] = ( $row['g_access_cp'] == 1 ) ? 1 : 0;
$row['_can_supmod'] = ( $row['g_is_supmod'] == 1 ) ? 1 : 0;
$row['_title'] = $row['prefix'].$row['g_title'].$row['suffix'];
if ( $this->ipsclass->vars['admin_group'] == $row['g_id'] )
{
$row['_title'] .= " ( ROOT )";
}
//-----------------------------------------
// IMAGES
//-----------------------------------------
$row['_can_acp_img'] = $row['_can_acp'] ? 'aff_tick.png' : 'aff_cross.png';
$row['_can_supmod_img'] = $row['_can_supmod'] ? 'aff_tick.png' : 'aff_cross.png';
//-----------------------------------------
// Add
//-----------------------------------------
$content .= $this->html->groups_overview_wrapper_row( $row );
//-----------------------------------------
// Add to array
//-----------------------------------------
$g_array[] = array( $row['g_id'], $row['g_title'] );
}
//-----------------------------------------
// Add form
//-----------------------------------------
$form['_new_dd'] = $this->ipsclass->adskin->form_dropdown("id", $g_array, 3 );
$this->ipsclass->html .= $this->html->groups_overview_wrapper( $content, $form );
$this->ipsclass->admin->output();
}
}
?>