Hi meine frage kann man im Forum ein Hide button einbauen ?
so das man z.b. einen youtube link erst nach antwort sieht ?
betroffene Homepage: externer Link
Hier kann eine Notiz zum Merk-Eintrag hinzugefügt werden (optional)
Geschlossen |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | ############################################################################ ## MOD HIDE | Made By / Auteur: Philiweb < http://www.philiweb.fr.st/ > ############################################################################ ## Description : MOD "HIDE" (aka lockdown) - this mod allow users to hide ## a message via some "bbcodes", ex : [hide] message [/hide]. To see the ## hidden message, you must be a member and you must post a reply to ## the message... ############################################################################ ## VERSION DE PHPBB : PHPBB 2.0 RC3 - RC4 - 2.0.x (gold) - 2.0.4 |02/2003| ############################################################################ ## You can find the last versions and informations here on the official ## website (in English and French) : ## Info : There is also some pre-modified files if you have difficulties ! ############################################################################ ## And you can find some modifications to "hide" mod here : ## new : version 4 => administrators and moderators can see "hidden ## messages" immediatly...) ############################################################################ ############################################################################ ## This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites ############################################################################ There is 7 files to modify : 1 - posting.php 2 - viewtopic.php 3 - search.php 4 - topic_review.php // in the "/includes" directory 5 - bbcode.php // in the "/includes" directory 6 - bbcode.tpl // in the Templates/{Used template}/ directory 7 - posting_body.tpl // in the Templates/{Used template}/ directory This mod is easy to install. (20 mn) ------------------ 1 - In posting.php ------------------ Find if( $attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid'] ) { $user_sig = bbencode_second_pass($user_sig, $userdata['user_sig_bbcode_uid']); } if( $bbcode_on ) { $preview_message = bbencode_second_pass($preview_message, $bbcode_uid); } Replace by $valid = FALSE; if( $userdata['session_logged_in'] ) { $sql = "SELECT p.poster_id, p.topic_id FROM " . POSTS_TABLE . " p WHERE p.topic_id = $topic_id AND p.poster_id = " . $userdata['user_id']; $resultat = $db->sql_query($sql); $valid = $db->sql_numrows($resultat) ? TRUE : FALSE;} if( $attach_sig && $user_sig != '' && $userdata['user_sig_bbcode_uid'] ) { $user_sig = bbencode_second_pass($user_sig, $userdata['user_sig_bbcode_uid']); $user_sig = bbencode_third_pass($user_sig, $userdata['user_sig_bbcode_uid'], $valid); } if( $bbcode_on ) { $preview_message = bbencode_second_pass($preview_message, $bbcode_uid); $preview_message = bbencode_third_pass($preview_message, $bbcode_uid, $valid); } Find if ( !preg_match('/^Re:/', $subject) && strlen($subject) > 0 ) { $subject = 'Re: ' . $subject; } Add Below if( !$userdata['session_logged_in'] ) {$message = hide_in_quote($message);} else { $sql = "SELECT p.poster_id, p.topic_id FROM " . POSTS_TABLE . " p WHERE p.topic_id = $topic_id AND p.poster_id = " . $userdata['user_id']; $resultat = $db->sql_query($sql); if(!$db->sql_numrows($resultat)) {$message = hide_in_quote($message);} } -------------------- 2 - In viewtopic.php -------------------- Find // // Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed // then get it's value, find the number of topics with dates newer than it (to properly // handle pagination) and alter the main query // Add below $valid = FALSE; if( $userdata['session_logged_in'] ) { $sql = "SELECT p.poster_id, p.topic_id FROM " . POSTS_TABLE . " p WHERE p.topic_id = $topic_id AND p.poster_id = " . $userdata['user_id']; $resultat = $db->sql_query($sql); $valid = $db->sql_numrows($resultat) ? TRUE : FALSE;} Find if ( $user_sig != '' && $user_sig_bbcode_uid != '' ) { $user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig); } if ( $bbcode_uid != '' ) { $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); } Replace by if ( $user_sig != '' && $user_sig_bbcode_uid != '' ) { $user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig); $user_sig = bbencode_third_pass($user_sig, $user_sig_bbcode_uid, $valid); } if ( $bbcode_uid != '' ) { $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); $message = bbencode_third_pass($message, $bbcode_uid, $valid); } ----------------- 3 - In search.php ----------------- Find // // If the board has HTML off but the post has HTML // on then we process it, else leave it alone // if ( $return_chars != -1 ) And replace it by // // If the board has HTML off but the post has HTML // on then we process it, else leave it alone // if( $return_chars == -1 ) Find if ( $bbcode_uid != '' ) { $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); } Replace by if ( $bbcode_uid != '' ) { $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); $message = bbencode_third_pass($message, $bbcode_uid, FALSE); } ----------------------- 4 - In topic_review.php // in the "/includes" directory ----------------------- Find // // Okay, let's do the loop, yeah come on baby let's do the loop // and it goes like this ... // if ( $row = $db->sql_fetchrow($result) ) { Add below $valid = FALSE; if( $userdata['session_logged_in'] ) { $sql = "SELECT p.poster_id, p.topic_id FROM " . POSTS_TABLE . " p WHERE p.topic_id = $topic_id AND p.poster_id = " . $userdata['user_id']; $resultat = $db->sql_query($sql); $valid = $db->sql_numrows($resultat) ? TRUE : FALSE;} Find if ( $bbcode_uid != "" ) { $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); } Replace by if ( $bbcode_uid != "" ) { $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); $message = bbencode_third_pass($message, $bbcode_uid, $valid); } ----------------- 5 - In bbcode.php // in the "/includes" directory ----------------- Find $bbcode_tpl['email'] = str_replace('{EMAIL}', '\\1', $bbcode_tpl['email']); Add Below $bbcode_tpl['show'] = str_replace('{HTEXTE}', '\\1', $bbcode_tpl['show']); *Before* this text /** * Does second-pass bbencoding. This should be used before displaying the message in * a thread. Assumes the message is already first-pass encoded, and we are given the * correct UID as used in first-pass encoding. */ Add this functions function hide_in_quote($text) { $text = preg_replace("#\[hide\](.*?)\[\/hide\]#si","--- phpBB : The Protected Message is not copied in this quote ---", $text); return $text; } function bbencode_third_pass($text, $uid, $deprotect) { global $bbcode_tpl; // pad it with a space so we can distinguish between FALSE and matching the 1st char (index 0). // This is important; bbencode_quote(), bbencode_list(), and bbencode_code() all depend on it. $text = " " . $text; // First: If there isn't a "[" and a "]" in the message, don't bother. if (! (strpos($text, "[") && strpos($text, "]")) ) { // Remove padding, return. $text = substr($text, 1); return $text; } // Patterns and replacements for URL and email tags.. $patterns = array(); $replacements = array(); if ( $deprotect ) { $patterns[0] = "#\[hide:$uid\](.*?)\[/hide:$uid\]#si"; $replacements[0] = $bbcode_tpl['show']; } else { $patterns[0] = "#\[hide:$uid\](.*?)\[/hide:$uid\]#si"; $replacements[0] = $bbcode_tpl['hide']; } $text = preg_replace($patterns, $replacements, $text); // Remove our padding from the string.. $text = substr($text, 1); return $text; } Find in function "bbencode_first_pass" // [img]image_url_here[/img] code.. $text = preg_replace("#\[img\](([a-z]+?)://([^ \"\n\r]+?))\[/img\]#si", "[img:$uid]\\1[/img:$uid]", $text); Add Below //[hide]message[/hide] $text = preg_replace("#\[hide\](.*?)\[\/hide\]#si","[hide:$uid]\\1[/hide:$uid]", $text); ----------------- 6 - In bbcode.tpl // in the Templates/{Used template}/ directory ----------------- At the top, add <!-- BEGIN show --> </span> <table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"> <tr> <td><span class="genmed"><b>Protected Message:</b></span></td> </tr> <tr> <td class="quote"> {HTEXTE} </td> </tr> </table> <span class="postbody"> <!-- END show --> <!-- BEGIN hide --> </span> <table border="0" align="center" width="90%" cellpadding="3" cellspacing="1"> <tr> <td><span class="genmed"><b>Protected Message:</b></span></td> </tr> <tr> <td class="quote"> <center>--- If you are a *registered user* : you need to post in this topic to see the message ---</center> </td> </tr> </table> <span class="postbody"> <!-- END hide --> ----------------------- 7 - In posting_body.tpl // in the Templates/{Used template}/ directory ----------------------- This part add a button in the dialog box (newtopic,...). In the list of "// Helpline messages", add : h_help = "Hide: [hide]message[/hide] (alt+h)"; Find this line : bbtags = new Array('[b]','[/b]'... And add at the end : '[hide]' and '[/hide]' You will obtain something like this : bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]',' |
Geschlossen | ||
![]() |
Zurück zu Fehlersuche und Probleme |