B.X Опубликовано 15 Августа 2003 Жалоба Поделиться Опубликовано 15 Августа 2003 1) Хак include. Я просмотрел, старый код вроде на месте (заменять можно), но будет ли это корректно работать? /// /// Find file sources/functions.php /// at the beginning after <?php and copyright insert these lines (between ///) /// function include_hack_handler($buf) { global $include_temp_str; $include_temp_str.=$buf; return ""; } /// /// In sources/functions.php find this line: $text = preg_replace( "/(<|<)% (BOARD HEADER|CSS|JAVASCRIPT|TITLE|BOARD|STATS|GENERATOR|COPYRIGHT|NAVIGATION) %(>|>)/i", "<% \\2 %>", $text ); /// Replace it with $text = preg_replace( "/(<|<)% (BOARD HEADER|CSS|JAVASCRIPT|TITLE|BOARD|STATS|GENERATOR|COPYRIGHT|NAVIGATION|INCLUDE \"\\S*?\") %(>|>)/i", "<% \\2 %>", $text ); /// /// ///In file sources/functions.php find function do_output($output_array) { global $DB, $Debug, $skin_universal, $ibforums; /// replace with function do_output($output_array) { global $DB, $Debug, $skin_universal, $ibforums, $include_temp_str; /// /// ///In file sources/functions.php after $ibforums->skin['template'] = str_replace( "<% NAVIGATION %>" , $nav , $ibforums->skin['template']); /// insert this // // Include tag hack // $incmatches=array(); while (preg_match("\x3C\% INCLUDE \"(\S*?)\" \%\x3E",$ibforums->skin['template'],$incmatches)>0) { $include_temp_str=""; ob_start('include_hack_handler'); include($incmatches[1]); ob_end_flush(); $ibforums->skin['template'] = str_replace("<".$incmatches[0].">",$include_temp_str,$ibforums->skin['template']); $incmatches=array(); } /// Now you can use this directive in board wrapper: <% INCLUDE "http://www.yourdomain.com/test.html" %> You can include any valid PHP or HTML file this way.2) Хак span tag. Цдобно. Не понимаю, почему его еще не включили в стандарт. Быть мрожет он и немного не так сделан (выставляет хтмл, а не ib коды, но всё равно, хорошее соедство для разнообразия и упорядочивания (в случае редизайна, например)...Usage: Using 'style' element: [span style=background: #000000; color: #FFFFFF]Text[/span] Using 'class' ibresource: [span class="class_from_ipb_stylesheet"]Text[/span] Using 'id' ibresource: [span class="id_from_ipb_stylesheet"]Text[/span] Instructions: 1) Download 'post_parser.php' from the /sources/lib/ of your Invision Power Board directory. 2) Make a backup of the file you downloaded (just in case). 3) Find this block of code (around line 228). // Start off with the easy stuff $txt = preg_replace( "#\[b\](.+?)\[/b\]#is", "<b>\\1</b>", $txt ); $txt = preg_replace( "#\[i\](.+?)\[/i\]#is", "<i>\\1</i>", $txt ); $txt = preg_replace( "#\[u\](.+?)\[/u\]#is", "<u>\\1</u>", $txt ); $txt = preg_replace( "#\[s\](.+?)\[/s\]#is", "<s>\\1</s>", $txt ); 4) Underneath it add the following: // Span Style Tags Convert by primetime $conv_span_search = array( "#\[span style=(.+?)\](.+?)\[\/span\]#is", "#\[span class=(.+?)\](.+?)\[\/span\]#is", "#\[span id=(.+?)\](.+?)\[\/span\]#is", ); $conv_span_replace = array( "<span style=\"\\1\">\\2</span>", "<span class=\"\\1\">\\2</span>", "<span id=\"\\1\">\\2</span>", ); $txt = preg_replace($conv_span_search, $conv_span_replace, $txt); // End Span Style Convert 5) Find the following line of code: (around line 500) $txt = preg_replace( "#<u>(.+?)</u>#is" , "\[u\]\\1\[/u\]" , $txt ); 6) Underneath that line add the following block of code: // Span Style Unconvert by primetime $unconv_span_search = array( "#<span style=\"(.+?)\">(.+?)<\/span>#", "#<span class=\"(.+?)\">(.+?)<\/span>#", "#<span id=\"(.+?)\">(.+?)<\/span>#", ); $unconv_span_replace = array( "[span style=\\1]\\2[/span]", "[span class=\\1]\\2[/span]", "[span id=\\1]\\2[/span]", ); $txt = preg_replace($unconv_span_search, $unconv_span_replace, $txt); // End Span Style Unconvert 7) Save the file and re-upload back into the sources/lib directory3) IBCode in Word Filter (а фильтре нехороших слов). Это, чтобы, например заменять все коды в сообщении на совершенно другие (или похожие)... Не хочешь, чтоб было , а лезть только ради этого и что-то исправлять - влом. Заменил из Админки. И теперь все новые запостенные будут . А в сочетании с хаком span tag вообще открываются удивительные возможности.Allow IB Code in word filter v 1.0 by Ahnteis April 2003 This hasn't been more then summarily tested, but I see no potential problems. If there are BUGS, please email at Ahnteis@Packmule.org I don't do tech support. Sorry. ------------------------------------------------------- Open .../sources/lib/post_parser.php Around line 320, FIND: $txt = $this->bad_words($txt); MOVE that line up to about line 150 so that it immediately FOLLOWS: //-------------------------------------- // convert <br> to \n //-------------------------------------- $txt = preg_replace( "/<br>|<br\s*\/>/", "\n", $txt ); THE END RESULT should place the line as seen below. function convert($in=array( 'TEXT' => "", 'SMILIES' => 0, 'CODE' => 0, 'SIGNATURE' => 0, 'HTML' => 0)) { global $ibforums, $DB; $this->in_sig = $in['SIGNATURE']; $txt = $in['TEXT']; //-------------------------------------- // Returns any errors as $this->error //-------------------------------------- // Remove session id's from any post $txt = preg_replace( "#(\?|&|;|&)s=([0-9a-zA-Z]){32}(&|;|&|$)?#e", "\$this->regex_bash_session('\\1', '\\3')", $txt ); //-------------------------------------- // convert <br> to \n //-------------------------------------- $txt = preg_replace( "/<br>|<br\s*\/>/", "\n", $txt ); $txt = $this->bad_words($txt); //-------------------------------------- // Are we parsing iB_CODE and do we have either '[' or ']' in the // text we are processing? //--------------------------------------4) Гости, чтоб могли голосовать в опросах. Не понимаю, почему голосовать не могут гости? Это бред. Постить могут, а голосовать нет? Mod Name: Allow guest to vote at polls Author: x00179 AuthorMail: x00179@hotmail.com Author HP: x00179.host.sk/forum IPB Ver: 1.1 (<= RC2) DESC. allow guest to vote at polls NOTE: this mod allow guest to vote at every poll on the intire forum where the incoming ip didn't vote yet (for each poll checked) Open Topic.php Find if (! $ibforums->member['id'] ) { $check = 1; $poll_footer = $ibforums->lang['poll_no_guests']; } Replace with if (! $ibforums->member['id'] ) { $DB->query("SELECT ip_address from ibf_voters WHERE ip_address='".$ibforums->input['IP_ADDRESS']."' and tid='".$this->topic['tid']."'"); $voter = $DB->fetch_row(); if ($voter['ip_address'] == $ibforums->input['IP_ADDRESS']) { $check = 1; $poll_footer = $ibforums->lang['poll_ip_exists']; } } Close & Save Open lang\en\lang_post.php Find ); ?> Add before poll_ip_exists => "This ip already voted", open sources\lib\add_poll.php find // Have we voted before? $DB->query("SELECT member_id from ibf_voters WHERE tid='".$this->topic['tid']."' and member_id='".$ibforums->member['id']."'"); if ( $DB->get_num_rows() ) { $std->Error( array( LEVEL => 1, MSG => 'poll_you_voted') ); } replace with // Have we voted before? if($ibforums->member['id']) { $DB->query("SELECT member_id from ibf_voters WHERE tid='".$this->topic['tid']."' and member_id='".$ibforums->member['id']."'"); if ( $DB->get_num_rows() ) { $std->Error( array( LEVEL => 1, MSG => 'poll_you_voted') ); } } else { $DB->query("SELECT ip_address from ibf_voters WHERE tid='".$this->topic['tid']."' and ip_address='".$ibforums->input['IP_ADDRESS']."'"); if ( $DB->get_num_rows() ) { $std->Error( array( LEVEL => 1, MSG => 'poll_you_voted') ); } } close & save goto AdminCP click Users and Groups click Manage User Groups click Edit Group (Guests) Find Can vote in polls (where allowed)? (set to YES) click complete edit And your done guest can now vote Вот вроде и всё пока. Подскажите, если можете, какие из них нормально работают, а какие нет. Если все нормально, тогда их можно перевести и пополнить наш Архив. Хаки-то хорошие. Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
Рекомендуемые сообщения
Присоединиться к обсуждению
Вы можете ответить сейчас, а зарегистрироваться позже. Если у вас уже есть аккаунт, войдите, чтобы ответить от своего имени.