+---------------------------------------------------------------------| Invision Power Board v2.3.x| =================================================================| При поддержке [url=http://ipbskins.ru]ipbskins.ru[/url]| =================================================================+---------------------------------------------------------------------|| > Мод "Куратор/Модератор одной темы"| > Автор fr0z3n aka andar!l|| > Автор оригинального мода для версий 2.0.х winnie| > Версия: 1.1| > Дата: 19.02.2007|+---------------------------------------------------------------------|| > Эта модификация позволяет добавить куратора для темы. | > Куратор может удалять, и редактировать сообщения в пределах одной| > темы. Добавлять куратора может супермодератор|+---------------------------------------------------------------------|| > Автор не несет ответственности за проблемы в связи с | > использованием этой модификации| > Используйте мод на свой страх и риск.|| > Author is not responsible for any consequences of using this| > forum modification, including those caused by this module| > Use at your own risk|+---------------------------------------------------------------------######################################################################Выполнить SQL запрос в базе данных вашего форума. Не забывайте сменитьпрефикс (ibf_) таблиц на свой если вы не используете стандартный.======================================================================ALTER TABLE `ibf_topics` ADD `curator_id` VARCHAR( 255 ) DEFAULT NULL ;======================================================================######################################################################./sources/action_public/moderate.php======================================================================НАЙТИ----------------------------------------------------------------------function auto_run(){----------------------------------------------------------------------НАЙТИ НИЖЕ----------------------------------------------------------------------$post_array = array( '04', '02', '20', '22', 'resync', 'prune_start', 'prune_finish', 'prune_move', 'editmember' );----------------------------------------------------------------------ЗАМЕНИТЬ НА----------------------------------------------------------------------//curator////$post_array = array( '04', '02', '20', '22', 'resync', 'prune_start', 'prune_finish', 'prune_move', 'editmember' );$post_array = array( '04', '02', '20', '22', 'resync', 'prune_start', 'prune_finish', 'prune_move', 'editmember', 'topiccurator' );//curator//----------------------------------------------------------------------НАЙТИ----------------------------------------------------------------------case 'editmember': $this->edit_member(); break;----------------------------------------------------------------------НИЖЕ ДОБАВИТЬ----------------------------------------------------------------------//curator case 'topiccurator': $this->topic_curator(); break;//curator----------------------------------------------------------------------НАЙТИ----------------------------------------------------------------------/*-------------------------------------------------------------------------*/// Edit member/*-------------------------------------------------------------------------*/function edit_member()----------------------------------------------------------------------ВЫШЕ, ДОБАВИТЬ---------------------------------------------------------------------- //----------------------------------------- // Topic curator //----------------------------------------- function topic_curator() { //----------------------------------------- // Check Permissions //----------------------------------------- $passed = 0; if ($this->ipsclass->member['g_is_supmod'] == 1) { $passed = 1; } else if ($this->moderator['add_curator'] == 1) { $passed = 1; } else { $passed = 0; } if ($passed != 1) $this->moderate_error(); if ( ! $this->topic['tid'] ) { $this->moderate_error(); } //----------------------------------------------- // Are we checking first? //----------------------------------------------- $update=''; if ($this->ipsclass->input['check'] == 1) { $user_list=$this->ipsclass->input['topic_curator']; if (isset($user_list) and $user_list != "") { //--------------------------- // Sort out the array //--------------------------- $user_list = str_replace( "<br>", "<br />" , trim($user_list) ); $user_list = str_replace( "<br /><br />", "<br />" , trim($user_list) ); $user_list = preg_replace( "#^(<br />){1}#", "" , $user_list ); $user_list = preg_replace( "#(<br />){1}$#", "" , $user_list ); $user_list = preg_replace( "#<br />\s+#", "," , $user_list ); $this->ipsclass->DB->simple_construct( array( 'select' => 'id, members_display_name', 'from' => 'members', 'where' => "LOWER(members_display_name)='{$user_list}'" )); $this->ipsclass->DB->simple_exec(); if ( ! $this->ipsclass->DB->get_num_rows() ) { $this->moderate_error('cp_error_no_mem'); return; } else { $sql_row = $this->ipsclass->DB->fetch_row(); $cc_array['name'] = $sql_row['members_display_name']; $cc_array['id'] = $sql_row['id']; } $this->ipsclass->DB->do_update( 'topics', array ('curator_id' =>addslashes(serialize($cc_array)),),"tid={$this->ipsclass->input['t']}" ); $update="Добавлен куратор: <b>{$cc_array['name']}</b>"; // $this->ipsclass->DB->do_update } else { $this->ipsclass->DB->do_update( 'topics', array ('curator_id' =>'',),"tid={$this->ipsclass->input['t']}" ); $update="Куратор удалён!"; } } $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'topics', 'where' => 'tid='.intval($this->ipsclass->input['t']) ) ); $this->ipsclass->DB->simple_exec(); $this->topic = $this->ipsclass->DB->fetch_row(); $list = unserialize(stripslashes($this->topic['curator_id'])); $this->output .= $this->ipsclass->compiled_templates['skin_mod']->topic_curator_splash ($this->forum, $this->topic, $this->ipsclass->return_md5_check(),$list['name'], $update ); // $print->pop_up_window( "", $this->output ); $this->ipsclass->print->pop_up_window( "", $this->output ); }----------------------------------------------------------------------НАЙТИ----------------------------------------------------------------------function delete_post(){ // Get this post id. $this->ipsclass->input['p'] = intval($this->ipsclass->input['p']);----------------------------------------------------------------------НИЖЕ НАЙТИ----------------------------------------------------------------------$this->ipsclass->DB->simple_construct( array( 'select' => 'pid, author_id, post_date, new_topic', 'from' => 'posts', 'where' => "topic_id={$this->topic['tid']} and pid={$this->ipsclass->input['p']}" ) );----------------------------------------------------------------------ЗАМЕНИТЬ НА----------------------------------------------------------------------//curator////$this->ipsclass->DB->simple_construct( array( 'select' => 'pid, author_id, post_date, new_topic', 'from' => 'posts', 'where' => "topic_id={$this->topic['tid']} and pid={$this->ipsclass->input['p']}" ) );$this->ipsclass->DB->simple_construct( array( 'select' => 'pid, author_id, post_date, new_topic, curator_id', 'from' => 'posts p LEFT JOIN '.SQL_PREFIX.'topics t ON (tid=topic_id)', 'where' => "topic_id={$this->topic['tid']} and pid={$this->ipsclass->input['p']}" ) );//curator//----------------------------------------------------------------------НАЙТИ----------------------------------------------------------------------else if ( ($this->ipsclass->member['g_delete_own_posts'] == 1) and ( $this->ipsclass->member['id'] == $post['author_id'] ) ){ $passed = 1;}----------------------------------------------------------------------НИЖЕ ДОБАВИТЬ----------------------------------------------------------------------//curator// else if ($post['curator_id']) { $list = unserialize(stripslashes($post['curator_id'])); if ($this->ipsclass->member['id']==$list['id']) $passed = 1; }//curator//======================================================================######################################################################./sources/classes/post/class_post_edit.php======================================================================НАЙТИ----------------------------------------------------------------------//-----------------------------------------// Load the old post//---------------------------------------------------------------------------------------------------------------НИЖЕ НАЙТИ----------------------------------------------------------------------$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'posts', 'where' => "pid=".intval($this->ipsclass->input['p']) ) );----------------------------------------------------------------------ЗАМЕНИТЬ НА----------------------------------------------------------------------//curator//$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'posts', 'where' => "pid=".intval($this->ipsclass->input['p']) ) ); $this->ipsclass->DB->simple_construct(array( 'select' => '*, curator_id', 'from' => 'posts p LEFT JOIN '.SQL_PREFIX.'topics t ON (tid=topic_id)', 'where' => "pid=".intval($this->ipsclass->input['p']) ) );//curator----------------------------------------------------------------------НАЙТИ----------------------------------------------------------------------if ($this->moderator['edit_post']){ $can_edit = 1;}----------------------------------------------------------------------НИЖЕ ДОБАВИТЬ---------------------------------------------------------------------- //curator if ($this->orig_post['curator_id']) { $list = unserialize(stripslashes($this->topic['curator_id'])); if ($this->ipsclass->member['id']==$list['id']) $can_edit = 1; } //curator######################################################################./sources/action_public/topics.php======================================================================НАЙТИ----------------------------------------------------------------------if ($this->moderator['delete_post']) return $button;----------------------------------------------------------------------НИЖЕ ДОБАВИТЬ----------------------------------------------------------------------//curatorif ($this->topic['curator_id']){ $curator = unserialize(stripslashes($this->topic['curator_id'])); if ($this->ipsclass->member['id']==$curator['id']) return $button;}//curator----------------------------------------------------------------------НАЙТИ----------------------------------------------------------------------if ($this->moderator['edit_post']) return $button;----------------------------------------------------------------------НИЖЕ, ДОБАВИТЬ ----------------------------------------------------------------------//curatorif ($this->topic['curator_id']){ $curator = unserialize(stripslashes($this->topic['curator_id'])); if ($this->ipsclass->member['id']==$curator['id']) return $button;}//curator======================================================================######################################################################./sources/ipsclass.php======================================================================$member['member_group'] = $this->compiled_templates[ $skin_file ]->member_group( $group_name );----------------------------------------------------------------------НИЖЕ ДОБАВИТЬ---------------------------------------------------------------------- //curator if ( $skin_file == 'skin_topic') { $curator = unserialize(stripslashes($this->topic['curator_id'])); if ( $member['id'] == $curator['id']) { $member['member_group'] = "<strong>Куратор темы</strong>"; } } //curator======================================================================######################################################################./sources/action_public/forums.php======================================================================НАЙТИ (примерно строка 1581)---------------------------------------------------------------------- else if ( isset($topic['_hasqueued']) AND $topic['_hasqueued'] ) { $classposts = 'row4shaded'; }}----------------------------------------------------------------------ДОБАВИТЬ НИЖЕ---------------------------------------------------------------------- //curator if ( $topic['curator_id'] ) { $list = unserialize(stripslashes($topic['curator_id'])); $topic['curator']='<br />Куратор темы: '.$this->ipsclass->make_profile_link($list['name'], $list['id']); } //curator======================================================================######################################################################ACP Home > Skin Manager Home > Edit Template HTMLВыбираем там группу фрагментов Forum Index в ней выбираем фрагмент render_forum_row======================================================================Ищем в фрагменте ----------------------------------------------------------------------</span> {$data['PAGES']} <div class="desc"><span onclick='return span_desc_to_input("{$data['tid']}");' id='tid-desc-{$data['tid']}'>{$data['description']}</span>----------------------------------------------------------------------Вставляем после этого ----------------------------------------------------------------------<span class="forumdesc"><if="$data['curator']"><i>{$data['curator']}</i></if></span>======================================================================######################################################################Выполнить SQL запрос в базе данных вашего форума. Не забывайте сменитьпрефикс (ibf_) таблиц на свой если вы не используете стандартный.======================================================================ALTER TABLE `ibf_moderators` ADD add_curator TINYINT( 1 ) DEFAULT 0;----------------------------------------------------------------------ЕСЛИ ВЫ ХОТИТЕ ЧТОБЫ ВСЕ ТЕКУЩИЕ МОДЕРАТОРЫ МОГЛИ УСТАНАВЛИВАТЬ УСТНЫЕ ПРЕДУПРЕЖДЕНИЯ ВЫПОЛНИТЕ СЛЕДУЮЩИЙ ЗАПРОС----------------------------------------------------------------------UPDATE `ibf_moderators` SET `add_curator` = '1'======================================================================######################################################################ACP Home > Cache Control > Moderators > Update cacheМожет навигацию не правильно написал, вообщем обновите кэш модераторов.Без этого работать не будет.############################################################################################################################################./sources/action_admin/moderator.php======================================================================НАЙТИ ( ЭТА СТРОКА ПОВТОРЯЕТСЯ ДВА РАЗА )----------------------------------------------------------------------'allow_warn' => intval($this->ipsclass->input['allow_warn']),----------------------------------------------------------------------НИЖЕ, ДОБАВИТЬ (ПОСЛЕ КАЖДОГО ПОВТОРЕНИЯ)----------------------------------------------------------------------// curator'add_curator' => intval($this->ipsclass->input['add_curator']),// curator----------------------------------------------------------------------НАЙТИ----------------------------------------------------------------------$this->ipsclass->adskin->form_yes_no("allow_warn", $mod['allow_warn'] ) ) ); ----------------------------------------------------------------------НИЖЕ, ДОБАВИТЬ----------------------------------------------------------------------//curator $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Добавлять кураторов тем?</b><div class='desctext'>Куратор может удалять/редактировать сообщения в курируемой им теме.</div>" , $this->ipsclass->adskin->form_yes_no("add_curator", $mod['add_curator'] ) ) );//curator======================================================================Возможность добавлять куратора для модераторов ставитсяпри добавлении/редактировании модератора======================================================================######################################################################Заходим в админцентрACP Home > Look & feel > Edit Template HTML (В меню стиля)Выбираем там "Moderator Function"======================================================================Нажимаем Add Template Bit (Добавить фрагмент)----------------------------------------------------------------------New Template Bit Name (Название фрагмента):----------------------------------------------------------------------topic_curator_splash----------------------------------------------------------------------New Template Bit Incoming Data Variables (Входящие переменные):----------------------------------------------------------------------$forum="", $topic="", $auth_key="", $list_user="", $update=""----------------------------------------------------------------------Template group (Группа фрагмента):----------------------------------------------------------------------skin_mod----------------------------------------------------------------------Тело фрагмента----------------------------------------------------------------------</script><div class='borderwrap'><div class='maintitle'><table><tr><td width="99%">Добавить куратора для темы {$topic['title']}<td width="1%"><a href="javascript:self.close();"><b>[X]</b></a><td></td></tr></table></div><div class='pformstrip'>{$update}</div><div class='tablepad'>Впишите имя пользователя, которого хотите назначить куратором темы.</div><script type="text/javascript" src='jscripts/ipb_xhr_findnames.js'></script><div id='ipb-get-members' style='border:1px solid #000; background:#FFF;padding:2px;position:absolute;width:210px;display:none;z-index:1'></div><form action='{$this->ipsclass->baseurl}' method='POST' name='REPLIER' id='curator_form'><input type='hidden' name='s' value='{$this->ipsclass->session_id}'><input type='hidden' name='act' value='mod'><input type='hidden' name='CODE' value='topiccurator'><input type='hidden' name='f' value='{$forum['id']}'><input type='hidden' name='t' value='{$topic['tid']}'><input type='hidden' name='auth_key' value='$auth_key' /><input type='hidden' name='check' value='1'><table width="100%" cellspacing="0"><tr><td class='pformright' align='center'><input type="text" name='topic_curator' id='topic_curator' size='30' autocomplete='off' style='width:210px' value={$list_user}><br /></td></tr></table><div class='formsubtitle' align='center'><input type='submit' value='Сохранить' class='button' /></div></form><script type="text/javascript">// INIT find namesinit_js( 'curator_form', 'topic_curator', 'get-member-names');// Run main loopsetTimeout( 'main_loop()', 10 );</script></div>======================================================================Заходим в админцентрACP Home > Look & feel > Edit Template HTML (В меню стиля)Выбираем "Topic view" в нем "mod_panel_wrapper"======================================================================НАЙТИ----------------------------------------------------------------------<form name="modform" method="post" action="{$this->ipsclass->base_url}" onsubmit="return checkdelete();">----------------------------------------------------------------------ВЫШЕ ДОБАВИТЬ----------------------------------------------------------------------<a href='#' onclick="ipsclass.pop_up_window('{$this->ipsclass->vars['board_url']}/index.php?act=mod&CODE=topiccurator&f={$data['TOPIC']['forum_id']}&t={$data['TOPIC']['tid']}&auth_key={$auth_key}','300','200'); return false;" class='button' style='text-decoration:none' target="_blank">Управление Куратором</a>======================================================================СОХРАНИТЬ######################################################################Готово