Quote:
Originally Posted by Dave
That happens because you're not escaping the variable correctly.
The following is the right way:
PHP Code:
$template_hook['postbit_userinfo_right_after_posts'] .= '<br><dt>Nominate for Members Choice Award </dt> <dd><a href="testingthread.php?threadid=' . $threadinfo['title'] . '"> <img src="images/buttons/memchoice.png" style="width: 26px; height: 26px; border: 0px;" alt="Nominate This Poem for Members Choice Award. Thank you."></a></dd>';
|
Thanks Dave . Always the 'little' things that upset the proverbials !
--------------- Added [DATE]1454947523[/DATE] at [TIME]1454947523[/TIME] ---------------
To get a working work-around I settled on the following .
HTML Code:
{vb:raw template_hook.postbit_controls}
<vb:if condition="(in_array($thread['forumid'], array(189,105,104,114,115,109,110,111,113,112,207,106,116,108,216,225,226,231,247))) AND ($post[postcount] == '1'))">
<a href="testingthread.php?{vb:raw session.sessionurl}do=&p={vb:raw post.postid}" rel="nofollow" title="Nominate This Poem for Members Choice Award"><img src="images/buttons/memchoice.png" style="width: 26px; height: 26px; border: 0px;" alt="Nominate This Poem for Members Choice Award. Thank you." /> </a>
</vb:if>
Placed in "postbit legacy" template .
--------------- Added [DATE]1454947988[/DATE] at [TIME]1454947988[/TIME] ---------------
The accompanying .php file works as expected except it doesn't always trap the "cannot self-nominate" section - but I'll sort it out .
I've also got the layout to address in the newpost, but otherwise the following is working.
I fully appreciate it's probably very 'raw' with stuff that shouldn't be in there and stuff that ought to be added - If anyone can find any glaring issues - please advise. I've bundled together ideas from numerous places and the end result may not be 'tidy' in the eyes of experience - sadly lacking in myself!
Things to change at a later stage when I've had a breather would be a 'better' call-out on the "Cannot Self-Nominate" and a "Thank-you for Nominating" at the end of the routine ....
warmly Geoff
PHP Code:
error_reporting(E_ALL & ~E_NOTICE & ~8192);
define('GET_EDIT_TEMPLATES', true);
define('THIS_SCRIPT', 'testingthread');
define('CSRF_PROTECTION', true);
require_once('./global.php');
require_once('./includes/functions_databuild.php');
global $postid;
$_REQUEST['postid'];
$vbulletin->input->clean_array_gpc('p', array(
'$Alto_nom'=> TYPE_STR,
'$Alto_poet' => TYPE_STR,
'$Alto_nomID'=> TYPE_INT,
'$Alto_poetID' => TYPE_INT,
'$Alto_title' => TYPE_STR,
'$Alto_forum' => TYPE_STR,
'$Alto_poemid' => TYPE_INT,
));
$Alto_nom = $postinfo['username']; //Gives name of poet
$Alto_poet = $vbulletin->userinfo['username']; //Gives name of nominator
$Alto_nomID = $postinfo['userid']; //Gives ID of poet
$Alto_poetID = $vbulletin->userinfo['userid']; //Gives ID of nominator
$Alto_title = $threadinfo['title']; //Gives title of poem
$Alto_forum = $foruminfo['title']; // Gives name of Forum
$Alto_poemid = $postinfo['threadid']; //Gives ID of thread
/*Check own poem isn't being nominated !*/
if ($Alto_nomID == $Alto_poetID)
{
echo "Whoops, I'm sorry, you may not nominate your own poem." . "<br><br>" . "Please press back-button on your browser. Thank you";
eval(print_standard_redirect('')); //Return to thread/post
}
/*Set for output to post*/
/*Set the subject */
$Alto_subject = "Nomination for Member's Choice Award";
/*Set the contents*/
$Alto_text = "Poet =" . $Alto_nom . "Poem Title =" . $Alto_title . "Forum = " . $Alto_forum . "Poem Link =" . "[URL]" . "http://localhost/poetsl/showthread.php?" . $Alto_poemid . "[/URL]";
/*Post thread to nominated Forum*/
/*Create a new datamanager for posting*/
$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_ARRAY, 'threadpost');
/*Bits & pieces*/
$forumid = '260'; // ID of Destination Forum (Adjust Accordingly) - Should Equate to "Members' Choice Nominations" (260 on Test)
$userid = $Alto_poetID; // The name of the nominator
$title = $Alto_subject; // Thread subject title
$pagetext = $Alto_text; // Content
$allowsmilie = '0'; // No smilies
$visible = '1'; // Post visible
// Parse, retrieve and process the information we need to post
$foruminfo = fetch_foruminfo($forumid);
$threadinfo = array();
$user = htmlspecialchars_uni( fetch_userinfo($userid) );
$threaddm->set_info('forum', $foruminfo);
$threaddm->set_info('thread', $threadinfo);
$threaddm->setr('forumid', $forumid);
$threaddm->setr('userid', $userid);
$threaddm->setr('pagetext', $pagetext);
$threaddm->setr('title', $title);
$threaddm->set('allowsmilie', $allowsmilie);
$threaddm->set('visible', $visible);
// Lets see what happens if we save the page
$threaddm->pre_save();
if(count($threaddm->errors) < 1) {
// Basically if the page will save without errors then let do it for real this time
$threadid = $threaddm->save();
unset($threaddm);
} else {
// There was errors in the practice run, so lets display them
var_dump ($threaddm->errors);
exit();
}
//$threadid = $threaddm->save();
eval(print_standard_redirect('')); //Return to thread/post