* * 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 in GPL.txt for more details. */ define('IN_ADMIN', 1); require_once('common.php'); const CONFIG_FILE_PATH = '../config/site.php'; updateAdminHistory($conn); function updateConfiguration(string $path, array $new_config) { $fp = fopen($path, 'w'); $new_config_text = var_export($new_config, true); $code = "query('SELECT * FROM captcha WHERE id = 1'); if ($row = $result->fetch()) { $cap_e = $row['cap_e']; $mode = $row['mode']; $mul = $row['mul']; $allowed = $row['allowed']; $color = $row['color']; $recaptcha_sitekey = $row['recaptcha_sitekey']; $recaptcha_secretkey = $row['recaptcha_secretkey']; } /* Update the configuration if necessary */ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $action = $_POST['action']; if ($action === 'manage') { $new_site_info = [ 'title' => trim($_POST['title']), 'description' => trim($_POST['description']), 'baseurl' => trim($_POST['baseurl']), 'keywords' => trim($_POST['keywords']), 'site_name' => trim($_POST['site_name']), 'email' => trim($_POST['email']), 'google_analytics' => trim($_POST['ga']), 'additional_scripts' => trim($_POST['additional_scripts']) ]; $current_config['site_info'] = $new_site_info; $current_site_info = $new_site_info; updateConfiguration(CONFIG_FILE_PATH, $current_config); $msg = '
Configuration saved.
'; } elseif ($action === 'permissions') { $new_permissions = [ 'disable_guest' => trim($_POST['disableguest']), 'private' => trim($_POST['siteprivate']) ]; $current_config['permissions'] = $new_permissions; $current_permissions = $new_permissions; updateConfiguration(CONFIG_FILE_PATH, $current_config); $msg = '
Site permissions saved.
'; } elseif (isset($_POST['cap'])) { $query = $conn->prepare( 'UPDATE captcha SET cap_e = ?, mode = ?, mul = ?, allowed = ?, color = ?, recaptcha_sitekey = ?, recaptcha_secretkey = ? WHERE id = 1' ); $query->execute([ trim($_POST['cap_e']), trim($_POST['mode']), trim($_POST['mul']), trim($_POST['allowed']), trim($_POST['color']), trim($_POST['recaptcha_sitekey']), trim($_POST['recaptcha_secretkey']) ]); $msg = '
Captcha settings saved
'; } } ?> Paste - Configuration
type="checkbox" name="disableguest" id="disableguest">
type="checkbox" name="siteprivate" id="siteprivate">

type="checkbox" name="cap_e" id="cap_e">


Internal Captcha Settings:
type="checkbox" name="mul" id="mul">


reCAPTCHA Settings: