<?php
/**
* TS2WebAdmin - Lightweight TeamSpeak 2 Control Panel
*
* $Id: mod_globalset.php 2009-09-03 20:23:12 sven $
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package TS2WebAdmin
* @version 2.0.0-alpha2
* @author Sven 'ScP' Paulsen
* @copyright Copyright (c) 2009 by Planet TeamSpeak. All rights reserved.
*/
/* check if file is included correctly */
defined('TS2WA_VALID') || die('Access denied...');
/**
* @package TS2WebAdmin_Module_Globalset
* @category TS2WebAdmin_Module
*/
class TS2WebAdmin_Module_Globalset extends TS2WebAdmin_Module
{
/**
* Module requires SSA permissions.
*
* @return void
*/
function checkLogin()
{
$this->isAuthorized(TS2WA_LOGIN_SUPERADMIN);
$wicookie = $this->_app->getSessionParam('server_wicookie');
$httpport = $this->_app->getConfigParam('server_httpport', 0);
if(!$wicookie)
{
$this->_ts2->wi_login($httpport) || $this->_app->raiseError($this->_ts2->debug_lastreply(), 500);
$this->_app->setSessionParam('server_wicookie', $this->_ts2->wiCookie);
}
else
{
$this->_ts2->wiPort = $httpport;
$this->_ts2->wiCookie = $wicookie;
}
}
/**
* Displays a form to modify global settings.
*
* @return void
*/
function indexAction()
{
$this->setSubMenu('global');
if(!$globalinfo = $this->_ts2->wi_readHostSettings())
{
$this->_app->raiseError($this->_ts2->debug_lastreply(), 500);
}
$this->assign('countrylist', getCountryList());
$this->assign('globalinfo', $globalinfo);
}
/**
* Updates global settings.
*
* @return void
*/
function do_updateAction()
{
$this->setNoRender();
if(!$this->_ts2->wi_writeHostSettings($this->_app->clientParams))
{
$this->_app->raiseError($this->_ts2->debug_lastreply(), 500);
}
$this->_app->setLastEvent('The global configuration has been changed successfully.');
$this->redirect('globalset');
}
}