TinyPortal

Development => Block Codes => Topic started by: Dragooon on November 11, 2007, 05:15:33 AM

Title: Quick Post to any board panel
Post by: Dragooon on November 11, 2007, 05:15:33 AM
Here is a Quick post to Any Board Panel based on a request made here.


Please Note: Due to my personal issues, I have not been able to test this much. So chances are that this might be buggy. Any Feedback will be greatly appreciated.
Also I want to say that, I recommend using this for a specific member Group or 2 as this can result a spam session on your forums.


Features :
# Does Permission checks, A User can post only where he/she can post
# Support Smileys and BBC
# Notify the people who are watching that board where the post is posted(Wasn't able to test this, hopefully it should work)
# Made sure of security
# Have ability to hide/show BBC and Smileys without page refresh(Using JavaScript)


Implementation :
Step 1 : Download QuickPost.php(Attached) and upload to /Sources directory
Step 2 : In Index.php(The one in Root folder of your SMF) Find:
$actionArray = array(
'activate' => array('Register.php', 'Activate'),

Add After
                'quickpost' => array('QuickPost.php', 'QuickPost_Action'),
Step 3 : In a PHP Block Add
/***********************************
*   Quick Post to any Board Panel
*   By Dragooon                           
*   Version 1.0                           
*   www.gforumx.com 
*   Block Code
************************************/
// Make the globals
global $sourcedir;

// And call the file.
require_once($sourcedir . '/QuickPost.php');
/***********************************
* About
************************************/
/* This snippet is made by Dragooon based on a Request made over TinyPortal.net. Unlikely my other snippets, currently it does not have any customization options(Well Why would we needing one on a Quick Post Panel ?) */
/***********************************
* End About
************************************/
// Call the function and finish this thing
QuickPost_Template();

// Thank you for using this snippet :)

And it is done


A Special Thanks to.....
IchBinâ,,¢ for making me remind about ensuring security
J.A.Cortina for helping me with permission checks and reminding me about Notification
tamasir for releasing his Show/Hide Code which I used as Show/Hide BBC


Quick Post to any board panel
By Dragooon
Version 1.0

Please use this thread to report any bugs/errors, feedbacks or questions.

Again Please Note: Due to my personal issues, I have not been able to test this much. So chances are that this might be buggy. Any Feedback will be greatly appreciated.
Title: Re: Quick Post to any board panel
Post by: The Danger on November 14, 2007, 08:11:31 PM
Isn't working for me... all I got was an empty block.
I copied the file and pasted all the code... isn't working.
Started over and tried it again, still nothing.
Title: Re: Quick Post to any board panel
Post by: IchBin on November 14, 2007, 11:16:59 PM
Did you put the Quickpost.php file in the Sources directory?
Title: Re: Quick Post to any board panel
Post by: The Danger on November 14, 2007, 11:20:48 PM
Sure did.
If one of you would like to/are willing to take a look at my setup, I don't mind making you an acct
Title: Re: Quick Post to any board panel
Post by: Dragooon on November 15, 2007, 08:57:46 AM
PM Me FTP and Admin Info and I'll see what is wrong.
Title: Re: Quick Post to any board panel
Post by: fangweile on December 06, 2007, 11:59:26 AM
Would it be possible to use this as quick post to a certain topic within the specific board??
Title: Re: Quick Post to any board panel
Post by: Dragooon on December 06, 2007, 12:01:07 PM
Hmmm...Not Sure I think so it will be But I have no intension on doing it.
Title: Re: Quick Post to any board panel
Post by: Xarcell on December 07, 2007, 02:41:47 AM
Wow, this is a nice handy little script. Nice work Dragooon.
Title: Re: Quick Post to any board panel
Post by: Dragooon on December 07, 2007, 03:29:56 AM
Thank you :)
Title: Re: Quick Post to any board panel
Post by: Angelotus on January 18, 2008, 07:33:05 AM
Thank you, this is great!
Title: Re: Quick Post to any board panel
Post by: Angelotus on January 18, 2008, 10:09:40 AM
Hi, is it possible to get an ajaxbased popup screen to post, so that I only have a link to the popupscreen on my index???
Title: Re: Quick Post to any board panel
Post by: Dragooon on January 18, 2008, 11:15:39 AM
It is I think But I got no idea how to do that :)
Title: Re: Quick Post to any board panel
Post by: Angelotus on January 18, 2008, 03:46:06 PM
It would be great if someone is able to make something like that!
Title: Re: Quick Post to any board panel
Post by: evilicy on January 18, 2008, 07:43:47 PM
Sweeeet! This looks awesome can't wait to try it.
Title: Re: Quick Post to any board panel
Post by: phfire on February 17, 2008, 12:01:22 AM
Quote
8: Undefined variable: message
File: /home/butuanon/public_html/forums/Sources/QuickPost.php
Line: 126

Line 126 of QuickPost.php
   
QuoteMessage:
<textarea id="message" class="editor" name="', $context['post_box_name'], '" rows="', $context['post_box_rows'], '" cols="', $context['post_box_columns'], '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" tabindex="', $context['tabindex']++, '"', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? ' style="border: 1px solid red;"' : '', '>', $message, '</textarea>


Title: Re: Quick Post to any board panel
Post by: phfire on February 17, 2008, 12:05:48 AM
Error when I post a topic using quick post.

Quote8: Undefined index: icon
File: /home/butuanon/public_html/forums/Sources/QuickPost.php
Line: 490

Line 490 of QuickPost.php
Quote'icon' => preg_replace('~[\./\\\\*\':"<>]~', '', $_POST['icon']),
Title: Re: Quick Post to any board panel
Post by: Dragooon on February 17, 2008, 05:30:58 AM
OK, I'll soon upload a bugfix release.
Title: Re: Quick Post to any board panel
Post by: Ricky. on February 17, 2008, 04:01:34 PM
Is it possible to send post only to a specific board ?
Title: Re: Quick Post to any board panel
Post by: Dragooon on February 17, 2008, 04:28:57 PM
Open QuickPost.php
Find :
$query = db_query("
SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.childLevel, b.boardOrder
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
                WHERE $user_info[query_see_board]
                $check"
                , __FILE__, __LINE__) or die(mysql_error());

And replace it with
$query = db_query("
SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.childLevel, b.boardOrder
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
                WHERE $user_info[query_see_board]
AND b.ID_BOARD = 1
                $check"
                , __FILE__, __LINE__) or die(mysql_error());

Replace that 1 with ID of that board.
Title: Re: Quick Post to any board panel
Post by: Ricky. on February 17, 2008, 05:20:02 PM
Thanx.. that will be useful !
Title: Re: Quick Post to any board panel
Post by: ApplianceJunk on February 17, 2008, 07:15:36 PM
This looks like something I could put to good use.

I gave it a try and get this error message showing up on my site in the phpbox.

QuoteParse error: parse error, unexpected T_DEC, expecting T_VARIABLE or '$' in /home/content/a/p/p/appliancejunk/html/forums/Sources/Load.php(1753) : eval()'d code(35) : eval()'d code on line 25

Did I not get something correct?

Thanks
Title: Re: Quick Post to any board panel
Post by: Dragooon on February 18, 2008, 07:18:58 AM
Are you sure you pasted the whole code?
Title: Re: Quick Post to any board panel
Post by: Ricky. on February 18, 2008, 09:53:51 AM
Is it possible to remove certain boards from the list ?
Like.. adding an exclude list ?
Title: Re: Quick Post to any board panel
Post by: Dragooon on February 18, 2008, 11:35:12 AM
You got a code like this
$query = db_query("
SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.childLevel, b.boardOrder
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
                WHERE $user_info[query_see_board]
                $check"
                , __FILE__, __LINE__) or die(mysql_error());

Replace the part with
$exclude_boards = array(1,2,3);
$query = db_query("
SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.childLevel, b.boardOrder
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
                WHERE $user_info[query_see_board]
                $check
AND b.ID_BOARD NOT IN('".implode(',',$exclude_boards)."')"
                , __FILE__, __LINE__) or die(mysql_error());
Title: Re: Quick Post to any board panel
Post by: ApplianceJunk on February 18, 2008, 01:04:24 PM
Quote from: Dragooon on February 18, 2008, 07:18:58 AM
Are you sure you pasted the whole code?

Looks like that was the trouble.
Now it's working. :)

This is awesome!

A couple more questions.
I have this is a center box and the word "Subject:" is to the right of the "Select a board:" Drop down menu and not to the left of the subject box that is below the drop down menu.

Also in my regular posting box I have a second text box show up like the "Subject:" box that is called "Model Number:".
Would it be easy for me to find and add this to the quick post too.

Thanks,
Title: Re: Quick Post to any board panel
Post by: Ricky. on February 19, 2008, 07:02:16 PM
You need to edit quickpost.php, I did to make it suitable to my need.
Title: Re: Quick Post to any board panel
Post by: Angelotus on March 05, 2008, 02:06:08 PM
Quote from: Angelotus on January 18, 2008, 10:09:40 AM
Hi, is it possible to get an ajaxbased popup screen to post, so that I only have a link to the popupscreen on my index???

I have on my site (http://www.klifix.eu) on the top right site (link calls 'direct posten'). Give it a try. If you register you can see the whole function.

It uses the greybox function: http://www.orangoo.com/labs/GreyBox/
Title: Re: Quick Post to any board panel
Post by: Ricky. on March 21, 2008, 12:11:13 PM
Hi... seems there is a glitch, actually I found that if user select certain forum then it is actually posting in some different forum..


Also, how do I make "forum" listing box little bigger as I am using it in article page but not in side bar. ie. I want to use full forum name instead of short one..
Title: Re: Quick Post to any board panel
Post by: Dragooon on March 21, 2008, 12:26:46 PM
I'm unable to understand what does your "glitch" means?
Title: Re: Quick Post to any board panel
Post by: Ricky. on March 28, 2008, 09:59:46 AM
I asked your previously that how to remove certain boards from the list.
I did that and removed some board.
But still I found that member are able to post in those forum using "Quick Post" block code you gave.
so glitch is that, somehow people are able to post on those boards which are not even listed in the FORM.
Title: Re: Quick Post to any board panel
Post by: DBO on April 04, 2008, 10:23:27 PM
this is almost working bob on for me. the 1 little problem that i do have is that the drop down catergory box is hanging out of my side block. i have had a good look in the QuickPost.php to see if i can see where to make this box a bit smaller but had no luck so would just like to ask if this can be done and if so how ?

regards
Dave