<?php

(!defined('IN_PowerBB')) ? die() : '';

define('IN_ADMIN',true);

include('common.php');

define('CLASS_NAME','PowerBBCPOptionsMOD');

class PowerBBCPOptionsMOD
{
	function run()
	{
		global $PowerBB;

		if ($PowerBB->_CONF['member_permission'])
		{
			$PowerBB->template->display('header');

			if ($PowerBB->_GET['index'])
			{
				$this->_IndexPage();
			}
			elseif ($PowerBB->_GET['ajax'])
			{
				if ($PowerBB->_GET['main'])
				{
					$this->_AjaxMain();
				}
				elseif ($PowerBB->_GET['update'])
				{
					$this->_AjaxUpdate();
				}
			}

			$PowerBB->template->display('footer');
		}
	}

	function _IndexPage()
	{
		global $PowerBB;

		$PowerBB->template->display('cp_options_main');
	}

	function _AjaxMain()
	{
		global $PowerBB;

		$PowerBB->template->display('cp_options_ajax');
	}

	function _AjaxUpdate()
	{
		global $PowerBB;

		$update = array();

		$update[0] = $PowerBB->info->UpdateInfo(array('value'=>$PowerBB->_POST['admin_ajax_main_rename'],'var_name'=>'admin_ajax_main_rename'));

		if ($update[0])
		{
			$PowerBB->functions->msg($PowerBB->_CONF['template']['lang']['updated_successfully_Please_wait']);
			$PowerBB->functions->redirect('admin.php?page=cp_options&amp;ajax=1&amp;main=1');
		}
	}
}

?>
