View Single Post
  #1  
Old 10-06-2005, 03:59 AM
Mr Blunt Mr Blunt is offline
 
Join Date: Jan 2004
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default can't get admincp css from outside it's dir

I'm close, but no cigar so far.

I'm trying to put a do=deletetable inside a 3rd party NON admincp file to complete a "product uninstall code" with a clickable button to delete a self contained 3rd party database table of old saved data.

Most people (like me) wouldn't want to delete this table ... even if uninstalling ... so this is why I'm being complex with the product.

I realize the easy way is to make two seperate files (putting the admin do's in the admin folder) but I already have another 3rd party php file in root with lots of other normal code and being used so figured why make a seperate file for 1 small call.

Everything "works" except for the lack of CSS (white backround black text).
The blue admincp sidebar and header remains intact.
Only the main pane goes to white/black.

Just wondering why I can't get the admincp's css.

Is it wrong to define VB_AREA as admincp when the file is not truely in admincp directory (inspection of the code led me to believe this would help me attain the admin css)?

Code:
error_reporting(E_ALL & ~E_NOTICE);
define('THIS_SCRIPT', 'blunts_whodownloaded_ip');
if ($_GET['do'] == 'deletewhodlip' OR $_POST['do'] == 'do_deletewhodlip')
{
	define('VB_AREA', 'AdminCP');
	define('CWD', (($getcwd = getcwd()) ? $getcwd : '.'));
	define('DIR', CWD);
	require_once(DIR . '/includes/class_core.php');
	$vbulletin =& new vB_Registry();
	$vbulletin->fetch_config();

	chdir(DIR . "/{$vbulletin->config['Misc']['admincpdir']}");
	require_once('./global.php');

	if (!can_administer('canadminplugins')) {
	    print_cp_no_permission();
	}
	$vbulletin->input->clean_array_gpc('r', array(
		'verify'    => TYPE_UINT,
		'deltable'  => TYPE_STR,
		'productid' => TYPE_STR
	));

	print_cp_header('Final Uninstallation Step for Blunts Whodownloaded_IP');

	if ($_REQUEST['do'] == 'deletewhodlip') {
		echo "<p>&nbsp;</p><p>&nbsp;</p>";
		print_form_header(THIS_SCRIPT, 'do_deletewhodlip', 0, 1, '', '75%');
		construct_hidden_code('deltable', $vbulletin->GPC['deltable']);
		construct_hidden_code('productid', $vbulletin->GPC['productid']);
		print_table_header(construct_phrase($vbphrase['confirm_deletion_of_x_y'], $vbphrase['table'], $vbulletin->GPC['deltable']));
		print_description_row("<blockquote><br />" . construct_phrase($vbphrase['are_you_sure_you_want_to_delete_the_x_called_y'], $vbphrase['table'], TABLE_PREFIX . $vbulletin->GPC['deltable'], 'dB Table', TABLE_PREFIX . $vbulletin->GPC['deltable'], ' ') . "<br /></blockquote>\n\t");
		print_submit_row($vbphrase['yes'], 0, 2, $vbphrase['no']);
		print_cp_footer();
	}
}
I've tried with the above code.
I've tried without the chdir and adding the admincp to the require global line.
Both ways had the same results.

I figured the chdir would solve it since the css appears to be called with a ../ from admincp global, but it didn't help.

Any ideas??

And if I implemented something like this, would it decrease any security??

Ohhh, and here's the bit of product uninstall code I'm calling this from.
Code:
			<uninstallcode><![CDATA[define('DISABLE_PRODUCT_REDIRECT', '1');
print_form_header();
construct_hidden_code('productid', $vbulletin->GPC['productid']);
print_table_header("Uninstalling " . $vbulletin->GPC['productid'] . " - Code 1.1.1", 2, 0, '', 'center', 0);
print_label_row("By default, this does NOT delete the current table of saved data.", '', 'alt2');
print_label_row("Click here to delete 3rd party database table '" . TABLE_PREFIX . "blunts_whodownloaded_ip'", '', 'alt2');
print_table_footer(2, construct_button_code('Delete Stored Data', '../blunts_whodownloaded_ip.php?' . $vbulletin->session->vars['sessionurl'] . 'do=deletewhodlip&amp;deltable=blunts_whodownloaded_ip'));]]></uninstallcode>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01293 seconds
  • Memory Usage 1,780KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete