Moved the Agents into their own repo. Kept the agent.pl just for reference

This commit is contained in:
Frank Harris 2025-09-11 13:27:32 -04:00
parent 22381be29a
commit 8680a02b13
18132 changed files with 0 additions and 2569420 deletions

View file

@ -1,197 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* 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 2
* of the License, or 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
function exec_ogp_module()
{
global $db;
require_once 'includes/api_functions.php';
$api_hosts_file = 'api_authorized.hosts';
$api_fwd_hosts_file = 'api_authorized.fwd_hosts';
echo "<h2>".get_lang('autohorized_hosts')."</h2>";
if(isset($_POST['remove_hosts']) or isset($_POST['remove_fwd_hosts']))
{
if(isset($_POST['remove_hosts']))
{
$hosts_file = $api_hosts_file;
$to_remove = $_POST['hosts_to_remove'];
}
else
{
$hosts_file = $api_fwd_hosts_file;
$to_remove = $_POST['fwd_hosts_to_remove'];
}
if(file_exists($hosts_file))
{
$hosts_list = file_get_contents($hosts_file);
$hosts = preg_split("/[\r\n]+/", $hosts_list);
$new_hosts = array();
foreach($hosts as $host)
{
$host = trim($host);
if($host == '')
continue;
if(in_array($host, $to_remove))
continue;
$new_hosts[] = $host;
}
file_put_contents($hosts_file, implode("\n", $new_hosts));
}
}
if(isset($_POST['add_host']) or isset($_POST['add_fwd_host']))
{
if(isset($_POST['add_host']))
{
$hosts_file = $api_hosts_file;
$host_to_add = trim($_POST['host_to_add']);
}
else
{
$hosts_file = $api_fwd_hosts_file;
$host_to_add = trim($_POST['fwd_host_to_add']);
}
$new_hosts = array();
if(file_exists($hosts_file))
{
$hosts_list = file_get_contents($hosts_file);
$hosts = preg_split("/[\r\n]+/", $hosts_list);
foreach($hosts as $host)
{
$host = trim($host);
if($host == '' or in_array($host, $new_hosts))
continue;
$new_hosts[] = $host;
}
}
if(strstr($host_to_add, '/'))
{
list($ip, $range) = explode('/', $host_to_add, 2);
if(is_valid_ipv4($ip) and !in_array($host_to_add, $new_hosts))
$new_host = $host_to_add;
elseif(is_valid_ipv6($ip) and !in_array(ipv6_compress($ip)."/".$range, $new_hosts))
$new_host = ipv6_compress($ip)."/".$range;
}
else
{
$ip = getHostByName($host_to_add);
if(is_valid_ipv4($ip) and !in_array($ip, $new_hosts))
$new_host = $ip;
elseif(is_valid_ipv6($ip) and !in_array(ipv6_compress($ip), $new_hosts))
$new_host = ipv6_compress($ip);
}
if(file_exists($hosts_file))
{
if(isset($new_host))
$new_hosts[] = $new_host;
file_put_contents($hosts_file, implode("\n", $new_hosts));
}
else
{
if(isset($new_host))
file_put_contents($hosts_file, $new_host);
}
}
$authorized_hosts = array();
$ip = getHostByName(getHostName());
if(filter_var($ip, FILTER_VALIDATE_IP))
$authorized_hosts[] = $ip;
$remote_servers = $db->getRemoteServers();
foreach($remote_servers as $remote_server)
{
$ip = getHostByName($remote_server['agent_ip']);
if(filter_var($ip, FILTER_VALIDATE_IP))
if(!in_array($ip, $authorized_hosts))
$authorized_hosts[] = $ip;
}
echo "<h4>".get_lang('default_trusted_hosts')."</h4>\n<br>\n<div align='center'>\n";
foreach($authorized_hosts as $authorized_host)
{
echo $authorized_host."<br>\n";
}
echo "</div>\n<br>\n<form method=POST action='?m=settings&p=api_hosts'>\n<div align='center'>\n".
"<h4>".get_lang('trusted_host_or_proxy_addresses_or_cidr')."</h4>\n<br>\n";
if(file_exists($api_hosts_file))
{
$hosts_list = file_get_contents($api_hosts_file);
$hosts = preg_split("/[\r\n]+/", $hosts_list);
$hosts = array_filter($hosts);
if(!empty($hosts))
{
foreach($hosts as $host)
{
$host = trim($host);
if($host == '')
continue;
echo "<input type=checkbox id='$host' name='hosts_to_remove[]' value='$host' ><label for='$host'>$host</label><br>\n";
}
echo "<br><input type=submit name=remove_hosts value='".get_lang('remove')."'>\n<br>\n<br>\n";
}
}
echo "<input type=text name='host_to_add' >\n".
"<input type=submit name=add_host value='".get_lang('add')."'>\n".
"</div>\n".
"</form>\n".
"<br>\n".
"<br>\n";
echo "<form method=POST action='?m=settings&p=api_hosts'>\n<div align='center'>\n".
"<h4>".get_lang('trusted_forwarded_ip_addresses_or_cidr')."</h4>\n<br>\n";
if(file_exists($api_fwd_hosts_file))
{
$fwd_hosts_list = file_get_contents($api_fwd_hosts_file);
$fwd_hosts = preg_split("/[\r\n]+/", $fwd_hosts_list);
$fwd_hosts = array_filter($fwd_hosts);
if(!empty($fwd_hosts))
{
foreach($fwd_hosts as $fwd_host)
{
$fwd_host = trim($fwd_host);
if($fwd_host == '')
continue;
echo "<input type=checkbox id='$fwd_host' name='fwd_hosts_to_remove[]' value='$fwd_host' ><label for='$fwd_host'>$fwd_host</label><br>\n";
}
echo "<br><input type=submit name=remove_fwd_hosts value='".get_lang('remove')."'>\n<br>\n<br>\n";
}
}
echo "<input type=text name='fwd_host_to_add' >\n".
"<input type=submit name=add_fwd_host value='".get_lang('add')."'>\n".
"</div>\n".
"</form>\n".
"<br>\n".
"<br>\n".
"<a href='?m=settings'>".get_lang('back')."</a>";
}

View file

@ -1,50 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* 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 2
* of the License, or 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/// @param $selected What value should be selected.
function get_theme_html_str( $selected, $add_empty = FALSE )
{
$themes = makefilelist("themes/", ".|..|.svn", true, "folders");
$retval = "<select id='theme' name='theme'>";
if ( empty($selected) )
{
$retval .= "<option value='' selected=selected >-</option>";
}
foreach ( $themes as $theme )
{
$retval .= "<option value='$theme'";
if ( $theme === $selected )
$retval .= ' selected=selected ';
$retval .= ">$theme</option>";
}
if ( $add_empty )
{
$retval .= "<option value='' >-</option>";
}
$retval .= "</select>";
return $retval;
}
?>

View file

@ -1,46 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* 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 2
* of the License, or 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
// Module general information
$module_title = "Settings";
$module_version = "1.1";
$db_version = 1;
$module_required = TRUE;
$module_menus = array(
array( 'subpage' => '', 'name'=>'Panel Settings', 'group'=>'admin' ),
array( 'subpage' => 'themes', 'name'=>'Theme Settings', 'group'=>'admin' )
);
$install_queries = array();
$install_queries[0] = array(
"DROP TABLE IF EXISTS ".OGP_DB_PREFIX."settings;",
"CREATE TABLE ".OGP_DB_PREFIX."settings (
`setting` varchar(63) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`setting`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;");
$install_queries[1] = array(
"ALTER TABLE `".OGP_DB_PREFIX."settings` CHANGE `value` `value` VARCHAR( 1024 ) NOT NULL;");
?>

View file

@ -1,5 +0,0 @@
<navigation>
<page key="default" file="settings.php" access="admin" />
<page key="api_hosts" file="api_hosts.php" access="admin" />
<page key="themes" file="themes.php" access="admin" />
</navigation>

View file

@ -1,242 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* 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 2
* of the License, or 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
function exec_ogp_module()
{
require_once('includes/form_table_class.php');
global $db,$view;
if ( isset($_REQUEST['update_settings']) )
{
// Validate GitHub repository format
if (!empty($_REQUEST['github_update_repository'])) {
$repoparts = explode('/', $_REQUEST['github_update_repository']);
if (count($repoparts) != 2 || empty(trim($repoparts[0])) || empty(trim($repoparts[1]))) {
echo "<h2>".get_lang('settings')."</h2>";
print_failure(get_lang('invalid_repository_format') . ': ' . $_REQUEST['github_update_repository'] . '. ' . get_lang('expected_format_username_repo'));
return;
}
}
// Validate GitHub branch format (basic check for invalid characters)
if (!empty($_REQUEST['github_update_branch'])) {
if (preg_match('/[^a-zA-Z0-9\-_\/]/', $_REQUEST['github_update_branch'])) {
echo "<h2>".get_lang('settings')."</h2>";
print_failure(get_lang('invalid_branch_format') . ': ' . $_REQUEST['github_update_branch']);
return;
}
}
$ssl = (isset($_POST['smtp_secure']) and $_POST['smtp_secure'] == 'ssl') ? 1 : 0;
$tls = (isset($_POST['smtp_secure']) and $_POST['smtp_secure'] == 'tls') ? 1 : 0;
$oldSettings = $db->getSettings();
$settings = array("panel_name" => $_REQUEST['panel_name'],
"header_code" => $_REQUEST['header_code'],
"maintenance_mode" => $_REQUEST['maintenance_mode'],
"maintenance_title" => $_REQUEST['maintenance_title'],
"maintenance_message" => $_REQUEST['maintenance_message'],
"panel_language" => $_REQUEST['panel_language'],
"time_zone" => $_REQUEST['time_zone'],
"charset" => $_REQUEST['charset'],
"page_auto_refresh" => $_REQUEST['page_auto_refresh'],
"smtp_server" => $_REQUEST['smtp_server'],
"smtp_port" => $_REQUEST['smtp_port'],
"smtp_login" => $_REQUEST['smtp_login'],
"smtp_passw" => $_REQUEST['smtp_passw'],
"smtp_ssl" => $ssl,
"smtp_tls" => $tls,
"panel_email_address" => $_REQUEST['panel_email_address'],
"remote_query" => $_REQUEST['remote_query'],
"feed_enable" => $_REQUEST['feed_enable'],
"feed_url" => $_REQUEST['feed_url'],
"query_cache_life" => $_REQUEST['query_cache_life'],
"query_num_servers_stop" => $_REQUEST['query_num_servers_stop'],
"steam_user" => $_REQUEST['steam_user'],
"steam_pass" => $_REQUEST['steam_pass'],
"steam_guard" => $_REQUEST['steam_guard'],
"editable_email" => $_REQUEST['editable_email'],
"old_dashboard_behavior" => $_REQUEST['old_dashboard_behavior'],
"rsync_available" => $_REQUEST['rsync_available'],
"support_widget_title" => $_REQUEST['support_widget_title'],
"support_widget_content" => $_REQUEST['support_widget_content'],
"support_widget_link" => $_REQUEST['support_widget_link'],
"check_expiry_by" => $_REQUEST['check_expiry_by'],
"recaptcha_site_key" => $_REQUEST['recaptcha_site_key'],
"recaptcha_secret_key" => $_REQUEST['recaptcha_secret_key'],
"recaptcha_use_login" => $_REQUEST['recaptcha_use_login'],
"login_attempts_before_banned" => $_REQUEST['login_attempts_before_banned'],
"github_update_repository" => $_REQUEST['github_update_repository'],
"github_update_branch" => $_REQUEST['github_update_branch'],
"show_server_id_game_monitor" => $_REQUEST['show_server_id_game_monitor'],
"default_game_server_home_path_prefix" => $_REQUEST['default_game_server_home_path_prefix'],
"use_authorized_hosts" => $_REQUEST['use_authorized_hosts'],
"allow_setting_cpu_affinity" => $_REQUEST['allow_setting_cpu_affinity'],
"regex_invalid_file_name_chars" => addslashes($_REQUEST['regex_invalid_file_name_chars']),
"login_ban_time" => $_REQUEST['login_ban_time']
);
$db->setSettings($settings);
if(array_key_exists("reset_game_server_order", $_REQUEST) && $_REQUEST["reset_game_server_order"] == 1){
$db->resetGameServerOrder();
}
if($oldSettings["github_update_branch"] != $settings["github_update_branch"] || $oldSettings["github_update_repository"] != $settings["github_update_repository"]){
// Delete any old atom files for extras module
$extrasPathData = realpath('modules/extras/') . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR;
array_map('unlink', glob($extrasPathData . "*.atom"));
// Delete any branch atom for update module
$updatesPath = realpath('modules/update/');
array_map('unlink', glob($updatesPath . "*.atom"));
}
echo "<h2>".get_lang('settings')."</h2>";
print_success(get_lang('settings_updated'));
$view->refresh("?m=settings");
return;
}
function formatOffset($offset) {
$hours = $offset / 3600;
$remainder = $offset % 3600;
$sign = $hours > 0 ? '+' : '-';
$hour = (int) abs($hours);
$minutes = (int) abs($remainder / 60);
if ($hour == 0 AND $minutes == 0) {
$sign = ' ';
}
return $sign . str_pad($hour, 2, '0', STR_PAD_LEFT) .':'. str_pad($minutes,2, '0');
}
$utc = new DateTimeZone('UTC');
$dt = new DateTime('now', $utc);
foreach(DateTimeZone::listIdentifiers() as $tz) {
$current_tz = new DateTimeZone($tz);
$offset = $current_tz->getOffset($dt);
$transition = $current_tz->getTransitions($dt->getTimestamp(), $dt->getTimestamp());
$abbr = $transition[0]['abbr'];
$zones["$tz"] = $tz . '[' . $abbr . ' ' . formatOffset($offset) . ']';
}
$rsync_options = array("1" => get_lang('all_available_servers'), "2" => get_lang('only_remote_servers'), "3" => get_lang('only_local_servers'));
$row = $db->getSettings();
echo "<h2>".get_lang('settings')."</h2>";
if(@$row['use_authorized_hosts']){
echo "<h4><a href='?m=settings&p=api_hosts'>".get_lang('setup_api_authorized_hosts')."</a></h4>";
}
$ft = new FormTable();
$ft->start_form("?m=settings", "post", "autocomplete=\"off\"");
$ft->start_table();
$ft->add_field('string','panel_name',@$row['panel_name']);
$locale_files = makefilelist("lang/", ".|..|.svn", true, "folders");
$locale_files = array('' => "-") + $locale_files;
$ft->add_custom_field('panel_language',
create_drop_box_from_array($locale_files,"panel_language",@$row['panel_language']));
$zones = array('' => "-") + $zones;
$ft->add_custom_field('time_zone',
create_drop_box_from_array($zones,"time_zone",@$row['time_zone'],false));
$ft->add_field('string','charset',@$row['charset']);
$ft->add_field('text','header_code',@$row['header_code'], 38);
$ft->add_field('on_off','maintenance_mode',@$row['maintenance_mode']);
$ft->add_field('string','maintenance_title',@$row['maintenance_title']);
$ft->add_field('text','maintenance_message',@$row['maintenance_message'], 38);
$ft->add_field('on_off','page_auto_refresh',@$row['page_auto_refresh']);
$ft->add_field('string','panel_email_address',@$row['panel_email_address']);
$ft->add_field('string','smtp_server',@$row['smtp_server']);
$ft->add_field('string','smtp_port',@$row['smtp_port']);
$ssl = (isset($row['smtp_ssl']) and $row['smtp_ssl'] == 1) ? "checked='checked'" : "";
$tls = (isset($row['smtp_tls']) and $row['smtp_tls'] == 1) ? "checked='checked'" : "";
$no = (!isset($row['smtp_ssl']) or $row['smtp_ssl'] == 0 AND !isset($row['smtp_tls']) or ( isset($row['smtp_tls']) and $row['smtp_tls'] == 0)) ? "checked='checked'" : "";
$ft->add_custom_field('smtp_secure','<input type=radio name=smtp_secure value=0 '.$no.
'>'.get_lang('no').'&nbsp;&nbsp;<input type=radio name=smtp_secure value=ssl '.$ssl.
'>SSL&nbsp;&nbsp;<input type=radio name=smtp_secure value=tls '.$tls.'>TLS');
$ft->add_field('string','smtp_login',@$row['smtp_login']);
$ft->add_field('password','smtp_passw',@$row['smtp_passw']);
$ft->add_field('on_off','remote_query',@$row['remote_query']);
$ft->add_field('on_off','feed_enable',@$row['feed_enable']);
$ft->add_field('string','feed_url',@$row['feed_url']);
$query_cache_life = (isset($row['query_cache_life']) and $row['query_cache_life'] != "" )? $row['query_cache_life'] : "30";
$ft->add_field('string','query_cache_life',$query_cache_life);
$query_num_servers_stop = (isset($row['query_num_servers_stop']) and $row['query_num_servers_stop'] != "" )? $row['query_num_servers_stop'] : "15";
$ft->add_field('string','query_num_servers_stop',$query_num_servers_stop);
$ft->add_field('string','steam_user',@$row['steam_user']);
$ft->add_field('password','steam_pass',@$row['steam_pass']);
$ft->add_field('password','steam_guard',@$row['steam_guard']);
$mail_setting = isset($row['editable_email']) ? $row['editable_email'] : "1";
$ft->add_field('on_off','editable_email',$mail_setting);
$ft->add_field('on_off','old_dashboard_behavior',@$row['old_dashboard_behavior']);
$ft->add_custom_field('rsync_available',
create_drop_box_from_array($rsync_options,"rsync_available",@$row['rsync_available'],false));
$ft->add_field('string','support_widget_title',@$row['support_widget_title']);
$ft->add_field('text','support_widget_content',@$row['support_widget_content'], 38);
$ft->add_field('string','support_widget_link',@$row['support_widget_link']);
$ft->add_custom_field('check_expiry_by',
create_drop_box_from_array(array('once_logged_in' => get_lang('once_logged_in'), 'cron_job' => get_lang('cron_job')),"check_expiry_by",@$row['check_expiry_by'],false));
$ft->add_field('string','recaptcha_site_key',@$row['recaptcha_site_key']);
$ft->add_field('string','recaptcha_secret_key',@$row['recaptcha_secret_key']);
$ft->add_field('on_off','recaptcha_use_login',@$row['recaptcha_use_login']);
$login_attempts_before_banned = (isset($row['login_attempts_before_banned']) and $row['login_attempts_before_banned'] != "" and is_numeric($row['login_attempts_before_banned']))? $row['login_attempts_before_banned'] : "6";
$ft->add_field('string','login_attempts_before_banned',$login_attempts_before_banned);
$ft->add_field('string','login_ban_time', array_key_exists("login_ban_time", $row) && !empty($row["login_ban_time"]) && is_numeric($row["login_ban_time"]) ? $row["login_ban_time"] : '');
// Panel Update Settings Section
$ft->add_custom_field('panel_update_settings_section', '<h3>'.get_lang('panel_update_settings').'</h3>');
$github_repository = (!empty($row['github_update_repository'])) ? $row['github_update_repository'] : 'Gameservers-World/ControlPanel';
$ft->add_field('string','github_update_repository', $github_repository);
$github_branch = (!empty($row['github_update_branch'])) ? $row['github_update_branch'] : 'backup';
$ft->add_field('string','github_update_branch', $github_branch);
$ft->add_field('on_off','show_server_id_game_monitor',@$row['show_server_id_game_monitor']);
$ft->add_field('string','default_game_server_home_path_prefix',@$row['default_game_server_home_path_prefix']);
// Use authorized hosts for API - this should be disabled by default since using the KEY alone should be secure enough
$ft->add_field('on_off','use_authorized_hosts',@$row['use_authorized_hosts']);
// Allow setting the cpu affinity for game servers
$ft->add_field('on_off','allow_setting_cpu_affinity',@$row['allow_setting_cpu_affinity']);
// Add regex setting for file manager
$ft->add_field('string','regex_invalid_file_name_chars',(@empty($row['regex_invalid_file_name_chars']) ? htmlentities('/[\^\$\*\+\?\(\)\[\{\\\\\\|\]!@#%&=~`,\\\'<>"}\s]/i', ENT_COMPAT | ENT_HTML401 | ENT_QUOTES) : htmlentities(@$row['regex_invalid_file_name_chars'], ENT_COMPAT | ENT_HTML401 | ENT_QUOTES)));
// Add option to reset game server order to default
$ft->add_field('checkbox','reset_game_server_order','0');
$ft->end_table();
$ft->add_button("submit","update_settings",get_lang('update_settings'));
$ft->end_form();
}
?>

View file

@ -1,107 +0,0 @@
<?php
/*
*
* OGP - Open Game Panel
* Copyright (C) 2008 - 2018 The OGP Development Team
*
* http://www.opengamepanel.org/
*
* 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 2
* of the License, or 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
function exec_ogp_module()
{
require_once('modules/settings/functions.php');
require_once('includes/form_table_class.php');
global $db,$view,$settings;
if ( isset($_REQUEST['update_settings']) )
{
$settings = array("theme" => $_REQUEST['theme'],
"welcome_title" => $_REQUEST['welcome_title'],
"welcome_title_message" => $_REQUEST['welcome_title_message'],
"logo_link" => $_REQUEST['logo_link'],
"bg_wrapper" => @$_REQUEST['bg_wrapper'],
"custom_tab" => $_REQUEST['custom_tab'],
"custom_tab_name" => @$_REQUEST['custom_tab_name'],
"custom_tab_link" => @$_REQUEST['custom_tab_link'],
"custom_tab_sub" => @$_REQUEST['custom_tab_sub'],
"custom_tab_sub_name" => @$_REQUEST['custom_tab_sub_name'],
"custom_tab_sub_link" => @$_REQUEST['custom_tab_sub_link'],
"custom_tab_sub_name2" => @$_REQUEST['custom_tab_sub_name2'],
"custom_tab_sub_link2" => @$_REQUEST['custom_tab_sub_link2'],
"custom_tab_sub_name3" => @$_REQUEST['custom_tab_sub_name3'],
"custom_tab_sub_link3" => @$_REQUEST['custom_tab_sub_link3'],
"custom_tab_sub_name4" => @$_REQUEST['custom_tab_sub_name4'],
"custom_tab_sub_link4" => @$_REQUEST['custom_tab_sub_link4'],
"custom_tab_target_blank" => @$_REQUEST['custom_tab_target_blank']);
$db->setSettings($settings);
print_success(get_lang('settings_updated'));
$view->refresh("?m=settings&p=themes");
return;
}
echo "<h2>".get_lang('theme_settings')."</h2>";
$bg_wrapper = array("" => "Default",
"url(images/bg/connect.png);" => "Connect",
"url(images/bg/foggy_birds.png);" => "Foggy Birds",
"url(images/bg/handmadepaper.png);" => "Handmade Paper",
"url(images/bg/tvlines.png);" => "TV Lines",
"url(images/bg/graycells.png);" => "Gray Cells",
"url(images/bg/coated.png);" => "Coated");
$tab_targets = array("_self" => "Self Page",
"_blank" => "New Page");
$row = $db->getSettings();
$ft = new FormTable();
$ft->start_form("?m=settings&p=themes");
$ft->start_table();
$ft->add_custom_field('theme',get_theme_html_str(@$row['theme']));
$ft->add_field('on_off','welcome_title',@$row['welcome_title']);
$ft->add_field('text','welcome_title_message',@$row['welcome_title_message'], 38);
$ft->add_field('string','logo_link',@$row['logo_link']);
$ft->add_custom_field('bg_wrapper',
create_drop_box_from_array($bg_wrapper,"bg_wrapper",@$row['bg_wrapper'],false));
$ft->add_field('on_off','custom_tab',@$row['custom_tab']);
if( isset($settings['custom_tab']) && $settings['custom_tab'] == "1" )
{
$ft->add_field('string','custom_tab_name',@$row['custom_tab_name']);
$ft->add_field('string','custom_tab_link',@$row['custom_tab_link']);
$ft->add_field('on_off','custom_tab_sub',@$row['custom_tab_sub']);
if( isset($settings['custom_tab_sub']) && $settings['custom_tab_sub'] == "1" )
{
$ft->add_field('string','custom_tab_sub_name',@$row['custom_tab_sub_name']);
$ft->add_field('string','custom_tab_sub_link',@$row['custom_tab_sub_link']);
$ft->add_field('string','custom_tab_sub_name2',@$row['custom_tab_sub_name2']);
$ft->add_field('string','custom_tab_sub_link2',@$row['custom_tab_sub_link2']);
$ft->add_field('string','custom_tab_sub_name3',@$row['custom_tab_sub_name3']);
$ft->add_field('string','custom_tab_sub_link3',@$row['custom_tab_sub_link3']);
$ft->add_field('string','custom_tab_sub_name4',@$row['custom_tab_sub_name4']);
$ft->add_field('string','custom_tab_sub_link4',@$row['custom_tab_sub_link4']);
}
$ft->add_custom_field('custom_tab_target_blank',
create_drop_box_from_array($tab_targets,"custom_tab_target_blank",@$row['custom_tab_target_blank'],false));
}
$ft->end_table();
$ft->add_button("submit","update_settings",get_lang('update_settings'));
$ft->end_form();
}
?>