* * 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']; } $result = $conn->query("SELECT * FROM site_permissions WHERE id='1'"); if ($row = $result->fetch()) { $disableguest = Trim($row['disableguest']); $siteprivate = Trim($row['siteprivate']); } $result = $conn->query("SELECT * FROM mail WHERE id='1'"); if ($row = $result->fetch()) { $verification = Trim($row['verification']); $smtp_host = Trim($row['smtp_host']); $smtp_username = Trim($row['smtp_username']); $smtp_password = Trim($row['smtp_password']); $smtp_port = Trim($row['smtp_port']); $protocol = Trim($row['protocol']); $auth = Trim($row['auth']); $socket = Trim($row['socket']); } /* 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.
'; } if (isset($_POST['manage'])) { $query = $conn->prepare( 'UPDATE site_info SET title = ?, des = ?, baseurl = ?, keyword = ?, site_name = ?, email = ?, twit = ?, face = ?, gplus = ?, ga = ?, additional_scripts = ? WHERE id = 1' ); $query->execute([ trim($_POST['des']), trim($_POST['baseurl']), trim($_POST['keyword']), trim($_POST['site_name']), trim($_POST['email']), trim($_POST['twit']), trim($_POST['face']), trim($_POST['gplus']), trim($_POST['ga']), trim($_POST['additional_scripts']) ]); $msg = '
Configuration saved
'; } if (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
'; } if (isset($_POST['permissions'])) { $query = $conn->prepare('UPDATE site_permissions SET disableguest = ?, siteprivate = ? WHERE id = 1'); $query->execute([ trim($_POST['disableguest']), trim($_POST['siteprivate']) ]); $msg = '
Site permissions saved.
'; } } if (isset($_POST['smtp_code'])) { $query = $conn->prepare( 'UPDATE mail SET verification = ?, smtp_host = ?, smtp_port = ?, smtp_username = ?, smtp_password = ?, socket = ?, protocol = ?, auth = ? WHERE id = 1' ); $query->execute([ trim($_POST['verification']), trim($_POST['smtp_host']), trim($_POST['smtp_port']), trim($_POST['smtp_user']), trim($_POST['socket']), trim($_POST['auth']), trim($_POST['protocol']) ]); $msg = '
Mail settings updated
'; } ?> 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:
Registration Settings
Mail Settings