vBadvanced Forums  
Go Back   vBadvanced Forums > vBadvanced Products > vBadvanced CMPS > vBa CMPS v4.0 Support > Troubleshooting & Problems

Reply
 
Thread Tools Display Modes
  #1  
Old 04-29-2012, 05:37 PM
Captain Tycoon Captain Tycoon is offline
Junior Member
 
Join Date: Jun 2008
Posts: 12
Exclamation Integration with Advanced Applications?

I've tried to integrate this plugin: http://www.vbulletin.org/forum/showthread.php?t=263944 using scriptname and filename method's, but neither of them work, they show the footer and header of the page, no sidebars (from cmps) and no content (from the plugin), also it doesn't add the additional.css file to the template.

Is there any other way or modifications I need to make?

Using vB4.1.8 and vBa CMPS 4.2
Reply With Quote
  #2  
Old 05-01-2012, 12:28 AM
CareyCrew CareyCrew is offline
Gone. vB is worthless now
 
Join Date: Sep 2007
Posts: 1,676
Default

vBa Mian Options > Portal Output Global Variables

Quote:
If you have other hacks installed on your forums, it may be necessary to globalize some of the variables used in those hacks for use with the CMPS. You may enter a list of variables to globalize here. Separate each variable with a carrage return. Please note as well that it is NOT necessary to add the $ mark before the variable name.
Reply With Quote
  #3  
Old 05-16-2012, 05:57 AM
Captain Tycoon Captain Tycoon is offline
Junior Member
 
Join Date: Jun 2008
Posts: 12
Default

I've attempted that and listed every single variable possible in the file(s).

All I can say is that 2 of 3 php files integrate, without even using the global variables. The primary file (application-forms.php) refuses to work. I would really appreciate any help at all.

I noticed when I remove (Line 29) "if ($imp_vars['do'] == 'main')" and (Line 24) "$pages = array( 'main', 'start','send');", both of the sidebars appear, but the content only shows a link back to the homepage. I have a feeling that (line 81) "print_output($templater->render());" may be affecting it...

Here is the application-forms file:
Code:
<?php
/*
|| Advanced Application Forms 1.2.5
|| Created by Snog (NHawk on vBulletin.org)
*/
error_reporting(E_ALL & ~E_NOTICE);
define('THIS_SCRIPT', 'application-forms');
define('CSRF_PROTECTION', true);
$phrasegroups = array();
$specialtemplates = array();
$globaltemplates = array(
	'advapp_select',
	'advapp_application',
	'human_verify',
	'humanverify_image',
	'humanverify_question',
	'humanverify_recaptcha'
);
$actiontemplates = array();
require_once('./global.php');
$imp_vars = array(
	'do' => $_REQUEST['do']
);
$pages = array(
	'main',
	'start',
	'send'
);
if (!in_array($imp_vars['do'], $pages)) $imp_vars['do'] = 'main';
if ($vbulletin->options['advapp_enable'] == 0) standard_error(fetch_error('advapp_off'));
if (is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['advapp_perms']))) print_no_permission();
if ($bbuserinfo['usergroup'] && $bbuserinfo['userid'] != 1 && $vbulletin->userinfo['posts'] < $vbulletin->options['advapp_postcount']) standard_error(fetch_error('advapp_noposts'));
if ($imp_vars['do'] == 'main')
{
	$vbulletin->input->clean_array_gpc('r', array(
		'appid' => TYPE_INT,
	));
	$appid = intval($vbulletin->GPC['appid']);
	$application = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "advapp_applications WHERE appid = '" . intval($appid) . "'");
	if (!is_member_of($vbulletin->userinfo, explode(',', $application['usergroup'])) || (!$application['active'] && !is_member_of($vbulletin->userinfo, explode(',', $application['editgroup'])))) print_no_permission();
	$typeperms = 0;
	$editperms = 0;
	if (is_member_of($vbulletin->userinfo, explode(',', $vbulletin->options['advapp_addedit_permissions']))) $typeperms = 1;
	if (is_member_of($vbulletin->userinfo, explode(',', $application['editgroup']))) $editperms = 1;
	$greeting_text = str_replace("{1}", $vbulletin->userinfo['username'], $application['greeting']);
	$greeting_text = str_replace("{2}", $vbulletin->options['bbtitle'], $greeting_text);
	$pagetitle = $application['type'];
	$appprompt = $application['prompt'];
	$description = $application['description'];
	$appquestion = $application['question'];
	$apperror = $application['error'];
	$positions = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "advapp_positions ORDER BY position ASC");
	$open_positions = '';
	while($position = $vbulletin->db->fetch_array($positions))
	{
		if ($position['active'] && is_member_of($vbulletin->userinfo, explode(',', $position['usergroup'])) && in_array($appid, explode(',', $position['apptype'])))
		{
			$open_positions .= '<input type="radio" name="positionapplying" value="' . $position['posid'] . '"/>&nbsp;' . $position['position']. '<br />';
		}
	}
	if(!$open_positions && !is_member_of($vbulletin->userinfo, explode(',', $application['editgroup']))) standard_error(fetch_error('advapp_off'));
	$navbits = construct_navbits(array('' => $application['type']));
	$navbar = render_navbar_template($navbits);
	$templater = vB_Template::create('advapp_select');
	$templater->register_page_templates();
	$templater->register('navbar', $navbar);
	$templater->register('navbits', $navbits);
	$templater->register('greeting', $greeting_text);
	$templater->register('pagetitle', $pagetitle);
	$templater->register('appprompt', $appprompt);
	$templater->register('appquestion', $appquestion);
	$templater->register('description', $description);
	$templater->register('apperror', $apperror);
	$templater->register('appid', $appid);
	$templater->register('apptype', $application['type']);
	$templater->register('editperms', $editperms);
	$templater->register('typeperms', $typeperms);
	$templater->register('imp_vars', $imp_vars);
	$templater->register('openpositions', $open_positions);
	$templater->register('pages', $pages);
	$templater->register('human_verify', $human_verify);
	$templater->register('vbgpc', $vbgpc);
	$vbulletin->db->free_result($positions);
	$vbulletin->db->free_result($application);
	print_output($templater->render());
}
if ($imp_vars['do'] == 'start')
{
	$vbulletin->input->clean_array_gpc('p', array(
		'positionapplying' => TYPE_INT,
		'appid' => TYPE_INT,
		'apptype' => TYPE_STR,
		'apperror' => TYPE_STR,
		'username'	=> TYPE_NOHTML,
	));
	$positionapplying = intval($vbulletin->GPC['positionapplying']);
	$appid =  intval($vbulletin->GPC['appid']);
	$apptype = $vbulletin->GPC['apptype'];
	$apperror = $vbulletin->GPC['apperror'];
	if ($positionapplying <= 0) eval(print_standard_redirect($apperror, false, true));
	$position_name = $vbulletin->db->query_first("SELECT position, postcount, usergroup, active FROM " . TABLE_PREFIX . "advapp_positions
		WHERE posid = '" . $positionapplying . "'
	");
	if (!is_member_of($vbulletin->userinfo, explode(',', $position_name['usergroup'])) || !$position_name['active']) print_no_permission();
	if ($vbulletin->userinfo['posts'] < intval($position_name['postcount'])) eval(standard_error(fetch_error('advapp_noposts')));
	$questions = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "advapp_questions WHERE posid = " . $positionapplying . " ORDER BY display ASC");
	$navbits = construct_navbits(array('application-forms.php?' . $vbulletin->session->vars['sessionurl'] . 'do=main&appid=' . $appid => $apptype,'' => $position_name['position']));
	$navbar = render_navbar_template($navbits);
	$templater = vB_Template::create('advapp_application');
	$templater->register_page_templates();
	$templater->register('navbar', $navbar);
	$templater->register('navbits', $navbits);
	$templater->register('positionapplying', $positionapplying);
	$templater->register('appid', $appid);
	$templater->register('apptype', $apptype);
	$templater->register('pagetitle', $apptype);
	$templater->register('positionname', $position_name['position']);
	$templater->register('username', $vbulletin->GPC['username']);
	if ($vbulletin->options['advapp_humanverify'])
	{
		require_once(DIR . '/includes/class_humanverify.php');
		$verify =& vB_HumanVerify::fetch_library($vbulletin);
		$human_verify = $verify->output_token();
		$templater->register('human_verify', $human_verify);
	}
	$question_info = '';
	$question_number = 0;
	while($question = $vbulletin->db->fetch_array($questions))
	{
		$question_number++;
		$question_id = "question" . $question_number;
		switch($question['type'])
		{
			case 1:
				$question_info .= '<div class="blockrow">' . "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">' . "\r\n";
				$question_info .= '<input type="text" class="primary textbox" name="' . $question_id . '" value="" maxlength="200" />' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 2:
				$question_info .= '<div class="blockrow">' . "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">' . "\r\n";
				$question_info .= '<textarea name="' . $question_id . '" rows="5" cols="44" wrap="soft"></textarea>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 3:
				$question_info .= '<div class="blockrow">'. "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">'. "\r\n";
				$question_info .= '<input type="radio" name="' . $question_id . '"  value="' . $vbphrase['yes'] . '" />&nbsp;' . $vbphrase['yes'] . '<br />' . "\r\n";
				$question_info .= '<input type="radio" name="' . $question_id . '"  value="' . $vbphrase['no'] . '" />&nbsp;' . $vbphrase['no']  . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 4:
				$question_info .= '<div class="blockrow">'. "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">'. "\r\n";
				$options = explode(",",$question['expected']);
				for($i=0;$i<count($options);$i++)
				{
					$j = $i + 1;
					$question_info .= '<input type="radio" name="' . $question_id . '"  value="'. $j . '" />&nbsp;' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
				}
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 5:
				$question_info .= '<div class="blockrow">'. "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">'. "\r\n";
				$options = explode(",",$question['expected']);
				for($i=0;$i<count($options);$i++)
				{
					$j = $i + 1;
					$question_info .= '<input type="checkbox" name="' . $question_id . '[' . $j . ']"  value="'. $j . '" />&nbsp;' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
				}
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$multichoice[] = $question_number;
				break;
			case 6:
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<h3 class="blocksubhead">' . $question['text'] . '</h3>' . "\r\n";
				$question_info .= '<div class="section">' . "\r\n";
				break;
			case 7:
				$question_info .= '<div class="blockrow">'. "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">'. "\r\n";
				$options = explode(",",$question['expected']);
				$question_info .= '<select name="' . $question_id . '">' . "\r\n";
				$question_info .= '<option value="">' . $vbphrase['advapp_chooseone'] . '<br />' . "\r\n";
				for($i=0;$i<count($options);$i++)
				{
					$j = $i + 1;
					$question_info .= '<option value="'. $j . '">' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
				}
				$question_info .= '</select>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 8:
				$question_info .= '<div class="blockrow">'. "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">'. "\r\n";
				$question['expected'] .= ',' . $vbphrase['advapp_multi_allabove'];
				$options = explode(",",$question['expected']);
				for($i=0;$i<count($options);$i++)
				{
					$j = $i + 1;
					$question_info .= '<input type="checkbox" name="' . $question_id . '[' . $j . ']"  value="'. $j . '" />&nbsp;' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
				}
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$multichoice[] = $question_number;
				break;
			default:
				eval(print_standard_redirect('Unknown Question Type', false, true));
		}
		$maxquestions = $question['display'];
	}
	$templater->register('questions', $question_info);
	$templater->register('maxquestions', $maxquestions);
	if (is_array($multichoice)){
		$templater->register('multichoice', implode(",",$multichoice));
	}
	else if ($multichoice)
	{
		$templater->register('multichoice', $multichoice);
	}
	$templater->register('imp_vars', $imp_vars);
	$vbulletin->db->free_result($questions);
	$vbulletin->db->free_result($position_name);
	print_output($templater->render());
}
if ($imp_vars['do'] == 'send')
{
	$vbulletin->input->clean_array_gpc('p', array(
		'maxquestions' => TYPE_INT,
		'multichoice' => TYPE_NOHTML,
		'positionapplying' => TYPE_INT,
		'appid' => TYPE_INT,
		'apptype' => TYPE_STR,
		'positionname'	=> TYPE_NOHTML,
		'username'	=> TYPE_NOHTML,
		'humanverify' => TYPE_ARRAY
	));
	$maxquestions = intval($vbulletin->GPC['maxquestions']);
	$positionapplying = intval($vbulletin->GPC['positionapplying']);
	$appid = intval($vbulletin->GPC['appid']);
	$apptype = $vbulletin->GPC['apptype'];
	$multichoice = explode(',',$vbulletin->GPC['multichoice']);
	$position_thanks = $vbulletin->db->query_first("SELECT thanks FROM " . TABLE_PREFIX . "advapp_applications
		WHERE appid = '" . $appid . "'
	");
	for($i=1;$i<=$maxquestions;$i++)
	{
		$question_number = "question" . $i;
		if(in_array($i, $multichoice))
		{
			$vbulletin->input->clean_array_gpc('p', array($question_number => TYPE_ARRAY_NOHTML,));
		}
		else
		{
			$vbulletin->input->clean_array_gpc('p', array($question_number => TYPE_NOHTML,));
		}
	}
	$question_number = 0;
	$error_msg = '';
	if ($vbulletin->options['advapp_humanverify'])
	{
		require_once(DIR . '/includes/class_humanverify.php');
		$verify =& vB_HumanVerify::fetch_library($vbulletin);
		$human_verify = $verify->output_token();
		if(!$verify->verify_token($vbulletin->GPC['humanverify']))
		{
			$error_msg .= $vbphrase['advapp_humanverifyerror'] . '<br />';
			$imp_vars['do'] = 'errors';
		}
	}
	$questions = $vbulletin->db->query_read("SELECT * FROM " . TABLE_PREFIX . "advapp_questions WHERE posid = " . $positionapplying . " ORDER BY display ASC");
	while($question = $vbulletin->db->fetch_array($questions))
	{
		$stored_questions[] = $question;
		$question_number++;
		$reply = 'question' . $question_number;
		if(!$vbulletin->GPC[$reply] && $question['error'])
		{
			$error_msg .= $question['error'] . '<br />' . "\r\n";
			$imp_vars['do'] = 'errors';
		}
		switch($question['type'])
		{
			case 1:
				$question_info .= '<div class="blockrow">' . "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">' . "\r\n";
				$question_info .= '<input type="text" class="primary textbox" name="' . $reply . '" value="'. $vbulletin->GPC[$reply] . '" maxlength="200" />' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 2:
				$question_info .= '<div class="blockrow">' . "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">' . "\r\n";
				$question_info .= '<textarea name="' . $reply . '" rows="5" cols="44" wrap="soft">'. $vbulletin->GPC[$reply] . '</textarea>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 3:
				$question_info .= '<div class="blockrow">'. "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">'. "\r\n";
				if($vbulletin->GPC[$reply] == $vbphrase['yes'])
				{
					$question_info .= '<input type="radio" name="' . $reply . '"  value="' . $vbphrase['yes'] . '" Checked />&nbsp;' . $vbphrase['yes'] . '<br />' . "\r\n";
				}
				else
				{
					$question_info .= '<input type="radio" name="' . $reply . '"  value="' . $vbphrase['yes'] . '" />&nbsp;' . $vbphrase['yes'] . '<br />' . "\r\n";
				}
				if($vbulletin->GPC[$reply] == $vbphrase['no'])
				{
					$question_info .= '<input type="radio" name="' . $reply . '"  value="' . $vbphrase['no'] . '" Checked />&nbsp;' . $vbphrase['no']  . "\r\n";
				}
				else
				{
					$question_info .= '<input type="radio" name="' . $reply . '"  value="' . $vbphrase['no'] . '" />&nbsp;' . $vbphrase['no']  . "\r\n";
				}
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 4:
				$question_info .= '<div class="blockrow">'. "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">'. "\r\n";
				$options = explode(",",$question['expected']);
				for($i=0;$i<count($options);$i++)
				{
					$j = $i + 1;
					if(intval($vbulletin->GPC[$reply]) == $j)
					{
						$question_info .= '<input type="radio" name="' . $reply . '"  value="'. $j . '" Checked />&nbsp;' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
					}
					else
					{
						$question_info .= '<input type="radio" name="' . $reply . '"  value="'. $j . '" />&nbsp;' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
					}
				}
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 5:
				$question_info .= '<div class="blockrow">'. "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">'. "\r\n";
				$options = explode(",",$question['expected']);
				for($i=0;$i<count($options);$i++)
				{
					$j = $i + 1;
					if (in_array($j,$vbulletin->GPC[$reply]))
					{
						$question_info .= '<input type="checkbox" name="' . $reply . '[' . $j . ']" value="'. $j . '" Checked />&nbsp;' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
					}
					else
					{
						$question_info .= '<input type="checkbox" name="' . $reply . '[' . $j . ']" value="'. $j . '" />&nbsp;' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
					}
				}
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 6:
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<h3 class="blocksubhead">' . $question['text'] . '</h3>' . "\r\n";
				$question_info .= '<div class="section">' . "\r\n";
				break;
			case 7:
				$question_info .= '<div class="blockrow">'. "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">'. "\r\n";
				$options = explode(",",$question['expected']);
				$question_info .= '<select name="' . $reply . '">' . "\r\n";
				$question_info .= '<option value="">' . $vbphrase['advapp_chooseone'] . '<br />' . "\r\n";
				for($i=0;$i<count($options);$i++)
				{
					$j = $i + 1;
					if(intval($vbulletin->GPC[$reply]) == $j)
					{
						$question_info .= '<option value="'. $j . '" selected>' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
					}
						else
					{
						$question_info .= '<option value="'. $j . '">' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
					}
				}
				$question_info .= '</select>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			case 8:
				$question_info .= '<div class="blockrow">'. "\r\n";
				$question_info .= '<div class="advappleftcol">' . "\r\n";
				$question_info .= '<label>' . $question['text'] . '</label>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<div class="advapprightcol">'. "\r\n";
				$question['expected'] .= ',' . $vbphrase['advapp_multi_allabove'];
				$options = explode(",",$question['expected']);
				$check_all = false;
				if (in_array(count($options),$vbulletin->GPC[$reply]))$check_all = true;
				for($i=0;$i<count($options);$i++)
				{
					$j = $i + 1;
					if (in_array($j,$vbulletin->GPC[$reply]) || $check_all)
					{
						$question_info .= '<input type="checkbox" name="' . $reply . '[' . $j . ']" value="'. $j . '" Checked />&nbsp;' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
					}
					else
					{
						$question_info .= '<input type="checkbox" name="' . $reply . '[' . $j . ']" value="'. $j . '" />&nbsp;' . unhtmlspecialchars($options[$i]) . '<br />' . "\r\n";
					}
				}
				$question_info .= '</div>' . "\r\n";
				$question_info .= '<p class="advappdescription">' . $question['description'] . '</p>' . "\r\n";
				$question_info .= '</div>' . "\r\n";
				break;
			default:
				eval(print_standard_redirect('Unknown Question Type', false, true));
		}
		$maxquestions = $question['display'];
	}
	if($error_msg)
	{
		$errors = '<b>' . $vbphrase['advapp_errors'] . '</b><br />' . "\r\n";
		$errors .= $error_msg;
		$navbits = construct_navbits(array('application-forms.php?' . $vbulletin->session->vars['sessionurl'] . 'do=main&appid=' . $appid => $apptype,'' => $vbulletin->GPC['positionname']));
		$navbar = render_navbar_template($navbits);
		$templater = vB_Template::create('advapp_application');
		$templater->register_page_templates();
		$templater->register('navbar', $navbar);
		$templater->register('navbits', $navbits);
		$templater->register('positionapplying', $positionapplying);
		$templater->register('appid', $appid);
		$templater->register('apptype', $apptype);
		$templater->register('pagetitle', $apptype);
		$templater->register('positionname', $vbulletin->GPC['positionname']);
		$templater->register('username', $vbulletin->GPC['username']);
		if ($vbulletin->options['advapp_humanverify'])
		{
			require_once(DIR . '/includes/class_humanverify.php');
			$verify =& vB_HumanVerify::fetch_library($vbulletin);
			$human_verify = $verify->output_token();
			$templater->register('human_verify', $human_verify);
		}
		$templater->register('errors', $errors);
		$templater->register('questions', $question_info);
		if (is_array($multichoice))
		{
			$templater->register('multichoice', implode(",",$multichoice));
		}
		else if ($multichoice)
		{
			$templater->register('multichoice', $multichoice);
		}
		$templater->register('maxquestions', $maxquestions);
		$templater->register('imp_vars', $imp_vars);
		$vbulletin->db->free_result($questions);
		print_output($templater->render());
		exit;
	}
	else
	{
		$position_info = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "advapp_positions
			WHERE posid = '" . $positionapplying . "'
		");
		if($position_info['email']) $addresses = explode(',', $position_info['email']);
		if (!empty($addresses) || $position_info['inthread'] || $position_info['bypm'] || $position_info['inold'])
		{
			$subject = '';
			if(!stristr($position_info['subject'],"{2}")) $subject = str_replace("{1}", $vbulletin->GPC['username'], $position_info['subject']);
		}
		if (!empty($addresses))
		{
			if($position_info['incname'])
			{
				$message = "{$vbphrase['advapp_membername']}: {$vbulletin->GPC['username']}
 
						";
			}
			else
			{
				$message = '';
			}
			foreach($stored_questions as $question)
			{	
				$answer = 'question' . $question['display'];
				if(stristr($position_info['subject'],"{2}") && $question['type'] == 1 && !$subject)
				{
					$subject = str_replace("{2}", $vbulletin->GPC[$answer], $position_info['subject']);
					$subject = str_replace("{1}", $vbulletin->GPC['username'], $subject);
				}
				if($question['type'] < 4)
				{
					$message .= "{$question['text']}: {$vbulletin->GPC[$answer]}
 
						";
				}
				if($question['type'] == 4 || $question['type'] == 7)
				{
					$choices = explode(',', $question['expected']);
					$message .= "{$question['text']}: {$choices[($vbulletin->GPC[$answer]-1)]}
 
						";
				}
				if($question['type'] == 5 || $question['type'] == 8)
				{
					$choices = explode(',', $question['expected']);
					$check_all = false;
					$detail = $vbulletin->GPC[$answer];
					if (in_array(count($choices)+1,$detail)) $check_all = true;
					for($i=0;$i<(count($choices)+1);$i++)
					{
						if (in_array($i, $detail) || $check_all)
						{
							if($final_answer)
							{
								$final_answer .= ", " . $choices[($i - 1)];
							}
							else
							{
								$final_answer = $choices[($i - 1)];
							}
						}
					}
					$message .= "{$question['text']}: {$final_answer}
 
						";
					$final_answer = '';
				}
			}
			if($vbulletin->options['advapp_options_includeip'])
			{
				$message .= "{$vbphrase['advapp_ipaddy']}: " . IPADDRESS . "

				";
			}
			foreach ($addresses AS $address)
			{
				vbmail($address, $subject, $message, true, $vbulletin->GPC['webmasteremail']);
			}
		}
		if ($position_info['inthread'] || $position_info['bypm'] || $position_info['inold'])
		{
			require_once(DIR . '/includes/functions_application-forms.php');
			if($position_info['incname'])
			{
				$message = "{$vbphrase['advapp_membername']}: ";
				if($vbulletin->options['advapp_answer_color'])
				{
					$message .= '[color="' . $vbulletin->options['advapp_answer_color'] . '"]' . $vbulletin->GPC['username'] . '[/color]' . "\r\n". "\r\n";
				}else{
					$message .= $vbulletin->GPC['username'] . "\r\n". "\r\n";
				}
			}
			else
			{
				$message = '';
			}
			foreach($stored_questions as $question)
			{	
				$answer = 'question' . $question['display'];
				if(stristr($position_info['subject'],"{2}") && $question['type'] == 1 && !$subject)
				{
					$subject = str_replace("{2}", $vbulletin->GPC[$answer], $position_info['subject']);
					$subject = str_replace("{1}", $vbulletin->GPC['username'], $subject);
				}
				if($question['type'] < 4)
				{
					$message .= "{$question['text']}: ";
					if($vbulletin->options['advapp_answer_color'])
					{
						$message .= '[color="' . $vbulletin->options['advapp_answer_color'] . '"] ' . html_entity_decode($vbulletin->GPC[$answer]) . ' [/color]' ."\r\n". "\r\n";
					}else{
						$message .= html_entity_decode($vbulletin->GPC[$answer]) . "\r\n". "\r\n";
					}
				}
				if($question['type'] == 4 || $question['type'] == 7)
				{
					$choices = explode(',', $question['expected']);
					$message .= "{$question['text']}: ";
					if($vbulletin->options['advapp_answer_color'])
					{
						$message .= '[color="' . $vbulletin->options['advapp_answer_color'] . '"]' . html_entity_decode($choices[($vbulletin->GPC[$answer]-1)], ENT_QUOTES) . '[/color]' . "\r\n". "\r\n";
					}else{
						$message .= html_entity_decode($choices[($vbulletin->GPC[$answer]-1)], ENT_QUOTES) . "\r\n". "\r\n";
					}
				}
				if($question['type'] == 5 || $question['type'] == 8)
				{
					$choices = explode(',', $question['expected']);
					$check_all = false;
					$detail = $vbulletin->GPC[$answer];
					if (in_array(count($choices)+1,$detail)) $check_all = true;
					for($i=1;$i<(count($choices))+1;$i++)
					{
						if (in_array($i, $detail) || $check_all)
						{
							if($final_answer)
							{
								if($vbulletin->options['advapp_answer_incolumn'])
								{
									$final_answer .= "\r\n" . html_entity_decode($choices[($i - 1)], ENT_QUOTES);
								}else{
									$final_answer .= ", " . html_entity_decode($choices[($i - 1)], ENT_QUOTES);
								}
							}
							else
							{
								if($vbulletin->options['advapp_answer_color'])
								{
									$final_answer = '[color="' . $vbulletin->options['advapp_answer_color'] . '"]' . html_entity_decode($choices[($i - 1)], ENT_QUOTES);
								}else{
									$final_answer = html_entity_decode($choices[($i - 1)], ENT_QUOTES);
								}
							}
						}
					}
					if($vbulletin->options['advapp_answer_color']) $final_answer .= "[/color]";
					$message .= "{$question['text']}: ";
					if($vbulletin->options['advapp_answer_incolumn']) $message .= "\r\n";
					$message .= $final_answer . "\r\n" . "\r\n";
					$final_answer = '';
				}
			}
			$userip = IPADDRESS;
			if($vbulletin->options['advapp_options_includeip'])
			{
				$message .= "{$vbphrase['advapp_ipaddy']} ";
				if($vbulletin->options['advapp_answer_color'])
				{
					$message .= '[color="' . $vbulletin->options['advapp_answer_color'] . '"]' . $userip . '[/color]' . "\r\n". "\r\n";
				}else{
					$message .= $userip . "\r\n". "\r\n";
				}
			}
			if($position_info['parseyesno'])
			{
				require_once(DIR . '/includes/functions_newpost.php');
				$message = convert_url_to_bbcode($message);
			}
			$yes = true;
			$no = false;
			if ($position_info['inthread'])
			{
				$forumid = intval($position_info['forum']);
				($hook = vBulletinHook::fetch_hook('advapp_hook2')) ? eval($hook) : false;
				if($position_info['posterid'] == 0)
				{
					$poster_id = $vbulletin->userinfo['userid'];
					$postername = $vbulletin->db->fetch_array(get_name($vbulletin->userinfo['userid']));
					$posterip = IPADDRESS;
				}
				else
				{
					$poster_id = $position_info['posterid'];
					$postername = $vbulletin->db->fetch_array(get_name($position_info['posterid']));
					$posterip = "0.0.0.0";
				}
				$threaddm =& datamanager_init('Thread_FirstPost', $vbulletin, ERRTYPE_SILENT, 'threadpost');
				$threaddm->do_set('forumid', $forumid);
				$threaddm->do_set('userid', $poster_id);
				$threaddm->do_set('username', $postername['username']);
				if($position_info['prefixid'])
				{
					$threaddm->do_set('prefixid', $position_info['prefixid']);
				}
				$threaddm->do_set('title', $subject);
				$threaddm->do_set('pagetext', $message);
				$threaddm->do_set('allowsmilie', $no);
				if($position_info['postapproval'])
				{
					$threaddm->do_set('visible', $no);
				}
				else
				{
					$threaddm->do_set('visible', $yes);
				}
				$threaddm->do_set('ipaddress', $posterip);
				$threaddm->set_info('is_automated', $yes);
				($hook = vBulletinHook::fetch_hook('advapp_hook6')) ? eval($hook) : false;
				$return_thread = $threaddm->save();
				unset($threaddm);
				require_once(DIR . '/includes/functions_databuild.php');
				build_forum_counters(intval($forumid));
			}
			if ($position_info['inold'])
			{
				$threadid = intval($position_info['oldthread']);
				$threadinfo = fetch_threadinfo($threadid);
				$foruminfo = fetch_foruminfo($threadinfo['forumid']);
				if($position_info['posterid'] == 0)
				{
					$poster_id = $vbulletin->userinfo['userid'];
					$posterip = IPADDRESS;
				}
				else
				{
					$poster_id = $position_info['posterid'];
					$posterip = "0.0.0.0";
				}
				$postdm =& datamanager_init('Post', $vbulletin, ERRTYPE_SILENT, 'threadpost');
				$postdm->set_info('forum', $foruminfo);
				$postdm->set_info('thread', $threadinfo);
				$postdm->set_info('skip_floodcheck', $yes);
				$postdm->set_info('skip_charcount', $yes);
				$postdm->set_info('is_automated', $yes);
				$postdm->set('threadid', $threadid);
				$postdm->set('userid', $poster_id);
				$postdm->set('allowsmilie', $yes);
				if($position_info['postapproval'])
				{
					$postdm->set('visible', $no);
				}
				else
				{
					$postdm->set('visible', $yes);
				}
				$postdm->set('title', $subject);
				$postdm->set('pagetext', $message);
				$postdm->set('ipaddress', $posterip);
				$postdm->save();
				unset($postdm);
				require_once(DIR . '/includes/functions_databuild.php');
				build_thread_counters($threadinfo);
				build_forum_counters($foruminfo);
			}
			if($position_info['bypm'])
			{
				$sender = $vbulletin->db->fetch_array(get_name($position_info['pmsender']));
				$blank = array();
				$pmdata =& datamanager_init('PM', $vbulletin, ERRTYPE_SILENT);
				$pmdata->set('fromuserid', $position_info['pmsender']);
				$pmdata->set('fromusername', $sender['username']);
				$pmdata->set_recipients($position_info['pmto'], $blank);
				$pmdata->set_info('reciept', false);
				$pmdata->set_info('savecopy', false);
				$pmdata->set('title', $subject);
				$pmdata->set('message', $message);
				$pmdata->set('dateline', TIMENOW);
				$pmdata->set_info('is_automated', true);
				$pmdata->save();
				unset($pmdata);
			}
		}
		if($position_info['pmapp'])
		{
			require_once(DIR . '/includes/functions_application-forms.php');
			$sender = $vbulletin->db->fetch_array(get_name($position_info['pmsender']));
			$pmmessage = str_replace('{3}',$sender['username'],$position_info['pmtext']);
			$pmmessage = str_replace('{2}', $vbulletin->options['bbtitle'], $pmmessage);
			$pmmessage = str_replace('{1}', $vbulletin->userinfo['username'], $pmmessage);			
			$blank = array();
			$pmdata =& datamanager_init('PM', $vbulletin, ERRTYPE_SILENT);
			$pmdata->set('fromuserid', $position_info['pmsender']);
			$pmdata->set('fromusername', $sender['username']);
			$pmdata->set_recipients($vbulletin->userinfo['username'], $blank);
			$pmdata->set_info('reciept', false);
			$pmdata->set_info('savecopy', false);
			$pmdata->set('title', $vbphrase['advapp_pmtitle']);
			$pmdata->set('message', $pmmessage);
			$pmdata->set('dateline', TIMENOW);
			$pmdata->set_info('is_automated', true);
			$pmdata->save();
			unset($pmdata);
		}
		($hook = vBulletinHook::fetch_hook('advapp_hook10')) ? eval($hook) : false;
	}
	switch($position_info['returnto'])
	{
		case 1:
			$vbulletin->url = 'application-forms.php?' . $vbulletin->session->var['sessionurl'] . 'appid=' . $appid;
			break;
		case 2:
			$vbulletin->url = $vbulletin->options['bburl'] . '/' . $vbulletin->options['forumhome'] . '.php' . $vbulletin->session->var['sessionurl'];
			break;
		case 3:
			$vbulletin->url = $vbulletin->options['bburl'] . '/showthread.php?' . $return_thread . $vbulletin->session->var['sessionurl'];
			break;
		case 4:
			$vbulletin->url = $position_info['returnlink'];
			break;
	}
	eval(print_standard_redirect($position_thanks['thanks'], false, true));
}
?>
Here is the portal global output variables i used:
Code:
do
main
start
send
imp_vars
bbuserinfo
direct_link
advapp_applyfor
main
advapp_enable
advapp_perms
vbphrase
j
r
i
verify
username
apperror
apptype
appid
positionapplying
do
start
vbgpc
human_verify
postdm
address
subject
message
posterip
threadinfo
threadid
foruminfo
return_thread
threaddm
posterip
postername
poster_id
forumid
hook
yes
no
userip
appid
pmmessage
final_answer
detail
check_all
choices
blank
sender
pmdata
appperms
application_type
types
vbulletin
open_positions
defaultquestions
position
advapp_addedit_permissions
application-forms
saved_groups
last_displayed
usergroups
usergroup
authgroups
editgroups
editgroup
postcount
question_info
grouptext
edittext
confirm
returntext
templater
newdisplay
display
advapp_off
nomove
navbits
previousquestion
navbar
gotconfirm
showsave
application
typeperms
editperms
_REQUEST
do
greeting_text
humanverify_question
humanverify_recaptcha
humanverify_image
pagetitle
description
advapp_select
advapp_application
appquestion
appprompt
prompt
apperror
positions
positionapplying
position_name
question_number
greeting
start
question
type
stored_questions
community
description
active
header
question_id
multichoice
options
maxquestions
apptype
position_thanks
type
reply
error_msg
actiontemplates
pages
openpositions
error
groups
phrasegroups
globaltemplates
thanks
specialtemplates
deltype
posid
advapp_select
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced Integration Method iguanairs "How Do I..." Questions 2 12-18-2011 07:43 AM
Integration & VSa-Advanced forum statistics fahl Troubleshooting & Problems 4 08-28-2011 10:47 AM
Really creative applications of VB Dynamics? lingstar Pre-Sale Questions 4 12-26-2008 10:47 AM
Applications for vB Dynamics Bill Thebert Pre-Sale Questions 1 09-16-2007 11:44 AM
I need help with V advanced bobncolorado Troubleshooting & Problems 1 11-20-2006 11:56 AM


All times are GMT -4. The time now is 06:31 AM.

Forums Powered by vBulletin, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
Please note that vBadvanced is in no way affiliated with Jelsoft Enterprises Ltd, nor will Jelsoft be able to provide any support for our products.