- Code: Select all
############################################################## ## MOD Title]http://www.CreativePulses.nl#[/url]# MOD Description: Extra field on the posting page.## -Input is an url## -http, ftp whatever## -'preview' button so user can see url## - SubSilver style 'www link' button## - You can pre-define some common urls :)#### MOD Version: 1.0.0## Tested on: PhpBB 2.0.17## Should be phpBB version independent, if not let me know## ## Installation Level: easy## Installation Time: 5 Minutes## Files To Edit: (5) root/viewtopic.php, root/posting.php## root/includes/functions_post.php## root/templates/[yourtemplatename]/posting_body.tpl## root/templates/[yourtemplatename]/viewtopic_body.tpl## Included Files: (2) MOD_add_url_to_post_install.php## mod_post_url_link.gif############################################################## ############################################################## ## Authors Notes:## ## SubSilver style button:## Made by Rfn, original files from SubSilver SDK## [url=http://www.phpbb.com/downloads.php#subSilver]http://www.phpbb.com/downloads.php#subSilver[/url]## ## Check ## http://phpbb2italia.za.net/phpbb2/viewforum.php?f=12 ## for updates, update manuals, support and screenshots#### Version History:## 1.0.0 - 20112005 - first version#### If you like this mod add your phpbb forum url to: [url=http://www.rfn-online.tk#]http://www.rfn-online.tk#[/url]### Thanks to:## PhpBB styles team for the SubSilver SDK !!############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ COPY ]------------------------------------------ #mod_post_url_link.gif -> root/imagesMOD_add_url_to_post_install.php -> root/ # #-----[ OPEN ]------------------------------------------ #root/viewtopic.php # #-----[ FIND ]------------------------------------------# $template->assign_block_vars('postrow', array( 'ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, # #-----[ REPLACE WITH ]-----------------------------------# // MOD post url txt if (($post_url != '') && ($post_url != 'http://') && ($post_url != 'ftp://')) { $l_post_url = '<a><img></a>'; $post_url = '<a>'.$post_url.'</a>'; } else { // empty sjizzle $l_post_url = ''; $post_url = ''; } // MOD post url txt $template->assign_block_vars('postrow', array( 'POST_URL' => $post_url, 'L_POST_URL' => $l_post_url, 'ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, # #-----[ OPEN ]------------------------------------------ #root/posting.php # #-----[ FIND ]------------------------------------------# $select_sql = ( !$submit ) # #-----[ BEFORE, ADD ]-----------------------------------# // MOD post url txt # #-----[ FIND ]------------------------------------------# pt.bbcode_uid, u.username, # #-----[ BEFORE, ADD ]-----------------------------------# pt.post_url, # #-----[ FIND ]------------------------------------------#if( $refresh || isset($HTTP_POST_VARS['del_poll_option']) || $error_msg != '' ){ $username = ( !empty($HTTP_POST_VARS['username']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['username']))) : ''; $subject = ( !empty($HTTP_POST_VARS['subject']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['subject']))) : ''; $message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : ''; # #-----[ AFTER, ADD ]-----------------------------------# // MOD post url keep field value while updating poll $post_url = ( !empty($HTTP_POST_VARS['post_url']) ) ? $HTTP_POST_VARS['post_url'] : ''; // MOD post url # #-----[ FIND ]------------------------------------------# // // User default entry point // if ( $mode == 'newtopic' ) { $user_sig = ( $userdata['user_sig'] != '' ) ? $userdata['user_sig'] : ''; # #-----[ AFTER, ADD ]-----------------------------------# // MOD rfn post url $post_url = 'http://'; # #-----[ FIND ]------------------------------------------# $message = $post_info['post_text']; if ( $mode == 'editpost' ) { # #-----[ AFTER, ADD ]-----------------------------------# // MOD rfn post url $post_url = $post_info['post_url']; if($post_url =='') $post_url = 'http://'; # #-----[ FIND ]------------------------------------------#//// Output the data to the template//$template->assign_vars(array( 'POST_URL' => $post_url, 'USERNAME' => $username, # #-----[ REPLACE WITH ]-----------------------------------#//// Output the data to the template//// MOD url rfn$template->assign_vars(array( 'POST_URL_TAG1' => ' -->', 'POST_URL_TAG2' => '<!-- ', 'POST_URL' => $post_url, 'USERNAME' => $username, # #-----[ OPEN ]------------------------------------------ #root/includes/functions_post.php # #-----[ FIND ]------------------------------------------# if ($mode != 'editpost') { $post_id = $db->sql_nextid(); } # #-----[ AFTER, ADD ]-----------------------------------# // MOD url rfn $post_url = $_POST[post_url]; if ( $post_url == 'http://') { $post_url = null; } # #-----[ FIND ]------------------------------------------# $sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ('$post_url', $post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message', bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id"; # #-----[ REPLACE WITH ]-----------------------------------# $sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_url, post_id, post_subject, bbcode_uid, post_text) VALUES ('$post_url', $post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_url = '$post_url', post_text = '$post_message', bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id"; // MOD url rfn # #-----[ OPEN ]------------------------------------------ #root/templates/[yourtemplatename]/posting_body.tpl # #-----[ FIND ]------------------------------------------#<script><!--// bbCode control by BEFORE, ADD<script>function post_url(text) { document.post.post_url.value = text;}function visit_url() { url = document.post.post_url.value; if ((url != 'http://') && (url != '') && (url != 'ftp://')) { window.open(url,"visit_url","titlebar=0,toolbar=0,location=0,directories=0,status=0,menubar=0,width=750,height=400,scrollbars=1,resizable=1"); } else { alert("Fill in a right format like http ftp"); }}</script> # #-----[ FIND ]------------------------------------------# <tr> <td><span> <textarea>{MESSAGE}</textarea> </span></td> # #-----[ BEFORE, ADD ]-----------------------------------## Edit the autofill to pre-define some urls ! :)# <!-- {POST_URL_TAG1} <tr> <td><font>Bron/url: </font><br><span> <span> <input></span></span></td> </tr> <tr> <td> <div> <table> <tr> <td><font>Autofill: </font><span> <font>[<a>Rfn mods at 3D forum</a>] - [<a>Google.com</a>] - [<a>PhpBB.com</a>]</font></span></td> <td> </td> <td> <p><input></td> </tr> </table> </div> </td> </tr> {POST_URL_TAG2} --> # #-----[ OPEN ]------------------------------------------ #root/templates/[yourtemplatename]/viewtopic_body.tpl # #-----[ FIND ]------------------------------------------# <tr> <td><hr></td> </tr> # #-----[ REPLACE WITH ]-----------------------------------# <MOD> </tr> <tr> <td><span>{postrow.L_POST_URL} {postrow.POST_URL}</span></td> </tr> <MOD> <tr> <td><hr></td> </tr> # #-----[ RUN ]------------------------------------------- #root/MOD_add_url_to_post_install.php # #-----[ SAVE/CLOSE ALL FILES ]-------------------------- # # EoM
MOD_add_url_to_post_install.php
[code] <?php define('IN_PHPBB', 1);include($phpbb_root_path . 'extension.inc');include($phpbb_root_path . 'common.'.$phpEx);include($phpbb_root_path . 'config.'.$phpEx); Echo "Starting DB upgrade ."; $sql = "ALTER TABLE " . POSTS_TEXT_TABLE . "ADD COLUMN `post_url` varchar(255) NULL DEFAULT `http]
(the install file gives an sql error i've created the column muself in phpmyadmin