PATH:
home
/
sudairsocs
/
www
/
forum
/
Sources
<?php /** * This file handles the user and privacy policy agreements. * * Simple Machines Forum (SMF) * * @package SMF * @author Simple Machines https://www.simplemachines.org * @copyright 2022 Simple Machines and individual contributors * @license https://www.simplemachines.org/about/smf/license.php BSD * * @version 2.1.0 */ if (!defined('SMF')) die('No direct access...'); /* The purpose of this file is to show the user an updated registration agreement, and get them to agree to it. bool prepareAgreementContext() // !!! bool canRequireAgreement() // !!! bool canRequirePrivacyPolicy() // !!! void Agreement() - Show the new registration agreement void AcceptAgreement() - Called when they actually accept the agreement - Save the date of the current agreement to the members database table - Redirect back to wherever they came from */ function prepareAgreementContext() { global $boarddir, $context, $language, $modSettings, $user_info; // What, if anything, do they need to accept? $context['can_accept_agreement'] = !empty($modSettings['requireAgreement']) && canRequireAgreement(); $context['can_accept_privacy_policy'] = !empty($modSettings['requirePolicyAgreement']) && canRequirePrivacyPolicy(); $context['accept_doc'] = $context['can_accept_agreement'] || $context['can_accept_privacy_policy']; if (!$context['accept_doc'] || $context['can_accept_agreement']) { // Grab the agreement. // Have we got a localized one? if (file_exists($boarddir . '/agreement.' . $user_info['language'] . '.txt')) $context['agreement_file'] = $boarddir . '/agreement.' . $user_info['language'] . '.txt'; elseif (file_exists($boarddir . '/agreement.txt')) $context['agreement_file'] = $boarddir . '/agreement.txt'; if (!empty($context['agreement_file'])) { $cache_id = strtr($context['agreement_file'], array($boarddir => '', '.txt' => '', '.' => '_')); $context['agreement'] = parse_bbc(file_get_contents($context['agreement_file']), true, $cache_id); } elseif ($context['can_accept_agreement']) fatal_lang_error('error_no_agreement', false); } if (!$context['accept_doc'] || $context['can_accept_privacy_policy']) { // Have we got a localized policy? if (!empty($modSettings['policy_' . $user_info['language']])) $context['privacy_policy'] = parse_bbc($modSettings['policy_' . $user_info['language']]); elseif (!empty($modSettings['policy_' . $language])) $context['privacy_policy'] = parse_bbc($modSettings['policy_' . $language]); // Then I guess we've got nothing elseif ($context['can_accept_privacy_policy']) fatal_lang_error('error_no_privacy_policy', false); } } function canRequireAgreement() { global $boarddir, $context, $modSettings, $options, $user_info; // Guests can't agree if (!empty($user_info['is_guest']) || empty($modSettings['requireAgreement'])) return false; $agreement_lang = file_exists($boarddir . '/agreement.' . $user_info['language'] . '.txt') ? $user_info['language'] : 'default'; if (empty($modSettings['agreement_updated_' . $agreement_lang])) return false; $context['agreement_accepted_date'] = empty($options['agreement_accepted']) ? 0 : $options['agreement_accepted']; // A new timestamp means that there are new changes to the registration agreement and must therefore be shown. return empty($options['agreement_accepted']) || $modSettings['agreement_updated_' . $agreement_lang] > $options['agreement_accepted']; } function canRequirePrivacyPolicy() { global $modSettings, $options, $user_info, $language, $context; if (!empty($user_info['is_guest']) || empty($modSettings['requirePolicyAgreement'])) return false; $policy_lang = !empty($modSettings['policy_' . $user_info['language']]) ? $user_info['language'] : $language; if (empty($modSettings['policy_updated_' . $policy_lang])) return false; $context['privacy_policy_accepted_date'] = empty($options['policy_accepted']) ? 0 : $options['policy_accepted']; return empty($options['policy_accepted']) || $modSettings['policy_updated_' . $policy_lang] > $options['policy_accepted']; } // Let's tell them there's a new agreement function Agreement() { global $context, $modSettings, $scripturl, $smcFunc, $txt; prepareAgreementContext(); loadLanguage('Agreement'); loadTemplate('Agreement'); $page_title = ''; if (!empty($context['agreement']) && !empty($context['privacy_policy'])) $page_title = $txt['agreement_and_privacy_policy']; elseif (!empty($context['agreement'])) $page_title = $txt['agreement']; elseif (!empty($context['privacy_policy'])) $page_title = $txt['privacy_policy']; $context['page_title'] = $page_title; $context['linktree'][] = array( 'url' => $scripturl . '?action=agreement', 'name' => $context['page_title'], ); if (isset($_SESSION['old_url'])) $_SESSION['redirect_url'] = $_SESSION['old_url']; } // I solemly swear to no longer chase squirrels. function AcceptAgreement() { global $context, $modSettings, $smcFunc, $user_info; $can_accept_agreement = !empty($modSettings['requireAgreement']) && canRequireAgreement(); $can_accept_privacy_policy = !empty($modSettings['requirePolicyAgreement']) && canRequirePrivacyPolicy(); if ($can_accept_agreement || $can_accept_privacy_policy) { checkSession(); if ($can_accept_agreement) { $smcFunc['db_insert']('replace', '{db_prefix}themes', array('id_member' => 'int', 'id_theme' => 'int', 'variable' => 'string', 'value' => 'string'), array($user_info['id'], 1, 'agreement_accepted', time()), array('id_member', 'id_theme', 'variable') ); logAction('agreement_accepted', array('applicator' => $user_info['id']), 'user'); } if ($can_accept_privacy_policy) { $smcFunc['db_insert']('replace', '{db_prefix}themes', array('id_member' => 'int', 'id_theme' => 'int', 'variable' => 'string', 'value' => 'string'), array($user_info['id'], 1, 'policy_accepted', time()), array('id_member', 'id_theme', 'variable') ); logAction('policy_accepted', array('applicator' => $user_info['id']), 'user'); } } // Redirect back to chasing those squirrels, er, viewing those memes. redirectexit(!empty($_SESSION['redirect_url']) ? $_SESSION['redirect_url'] : ''); } ?>
[+]
..
[-] Errors.php~
[edit]
[-] ReportedContent.php
[edit]
[-] Profile.php~
[edit]
[-] Notify.php
[edit]
[-] Security.php~
[edit]
[-] ScheduledTasks.php
[edit]
[-] ModerationCenter.php
[edit]
[-] Mentions.php
[edit]
[-] DbExtra-mysql.php~
[edit]
[-] Subs-MessageIndex.php
[edit]
[-] Display.php~
[edit]
[-] DbPackages-sqlite.php
[edit]
[-] ManageSettings.php~
[edit]
[-] Subs-Compat.php
[edit]
[-] ManageScheduledTasks.php
[edit]
[-] Security.php
[edit]
[-] Profile-View.php~
[edit]
[-] BoardIndex.php
[edit]
[-] Class-Punycode.php
[edit]
[-] Subs-Db-postgresql.php~
[edit]
[-] MessageIndex.php
[edit]
[-] ManageMail.php~
[edit]
[-] Modlog.php
[edit]
[-] Calendar.php
[edit]
[-] Subs-Members.php~
[edit]
[-] Profile-Modify.php~
[edit]
[-] .reference
[edit]
[-] RemoveTopic.php~
[edit]
[-] ManageSmileys.php
[edit]
[-] MoveTopic.php
[edit]
[-] RemoveTopic.php
[edit]
[-] Subs-Post.php~
[edit]
[-] Profile.php
[edit]
[+]
Unicode
[-] Groups.php
[edit]
[-] Subs-Sound.php~
[edit]
[-] Groups.php~
[edit]
[-] Recent.php~
[edit]
[-] Who.php~
[edit]
[-] Class-TOTP.php
[edit]
[-] ManageRegistration.php~
[edit]
[-] Agreement.php
[edit]
[-] ReportToMod.php
[edit]
[-] Profile-Actions.php
[edit]
[-] Subs-Db-sqlite.php~
[edit]
[-] Display.php
[edit]
[-] ManageCalendar.php~
[edit]
[-] PersonalMessage.php
[edit]
[-] ManageAttachments.php~
[edit]
[-] Subs-Attachments.php
[edit]
[-] Help.php
[edit]
[-] Subs-Notify.php
[edit]
[-] index.php
[edit]
[-] Subs-Admin.php~
[edit]
[-] Subs-Db-mysql.php~
[edit]
[-] Subs-Package.php
[edit]
[-] Printpage.php
[edit]
[-] Subs-Post.php
[edit]
[-] Class-SearchAPI.php
[edit]
[-] Subs-Admin.php
[edit]
[-] DbExtra-postgresql.php
[edit]
[-] ManageSmileys.php~
[edit]
[-] Class-Graphics.php~
[edit]
[-] Subs-Categories.php
[edit]
[-] ManageSearch.php~
[edit]
[-] Subs-Editor.php~
[edit]
[-] Likes.php
[edit]
[-] Subs.php~
[edit]
[-] SendTopic.php
[edit]
[-] DbPackages-postgresql.php
[edit]
[-] DbSearch-mysql.php
[edit]
[-] Xml.php
[edit]
[-] Reports.php
[edit]
[-] Subs-Membergroups.php
[edit]
[-] ManagePosts.php
[edit]
[-] ManageAttachments.php
[edit]
[-] ManagePaid.php~
[edit]
[-] SearchAPI-Standard.php
[edit]
[-] DbExtra-mysql.php
[edit]
[-] ManageLanguages.php
[edit]
[+]
Cache
[-] Session.php
[edit]
[-] Load.php~
[edit]
[-] Packages.php~
[edit]
[-] ManageScheduledTasks.php~
[edit]
[-] Karma.php
[edit]
[-] Poll.php~
[edit]
[-] ManageMembers.php~
[edit]
[-] News.php
[edit]
[-] Subs-Compat.php~
[edit]
[-] DbSearch-sqlite.php
[edit]
[-] Subs-Charset.php
[edit]
[-] Subs.php
[edit]
[-] Reminder.php
[edit]
[-] Modlog.php~
[edit]
[-] ManagePaid.php
[edit]
[-] LogInOut.php
[edit]
[-] DbSearch-postgresql.php
[edit]
[-] hcaptcha.php
[edit]
[-] Subs-BoardIndex.php
[edit]
[-] ManageMembergroups.php~
[edit]
[+]
minify
[-] Class-Graphics.php
[edit]
[-] Subs-Graphics.php~
[edit]
[-] Subs-Menu.php
[edit]
[-] Admin.php~
[edit]
[-] ManageMail.php
[edit]
[-] SearchAPI-Custom.php
[edit]
[-] ScheduledTasks.php~
[edit]
[-] Logging.php
[edit]
[-] DbPackages-mysql.php
[edit]
[-] Subs-Recent.php
[edit]
[-] Class-CurlFetchWeb.php~
[edit]
[-] ModerationCenter.php~
[edit]
[+]
random_compat
[-] Admin.php
[edit]
[-] Class-Package.php
[edit]
[-] ManageMaintenance.php
[edit]
[-] Packages.php
[edit]
[-] Subs-BoardIndex.php~
[edit]
[-] ManageBans.php~
[edit]
[-] ManageMembers.php
[edit]
[-] ManageServer.php
[edit]
[-] Subs-Db-mysql.php
[edit]
[-] ManageErrors.php
[edit]
[-] Subs-Calendar.php
[edit]
[-] Subs-Editor.php
[edit]
[-] Load.php
[edit]
[-] Subs-Graphics.php
[edit]
[-] Subs-Boards.php
[edit]
[-] News.php~
[edit]
[-] Stats.php
[edit]
[-] ManageNews.php
[edit]
[-] Subs-Db-sqlite.php
[edit]
[-] Attachments.php
[edit]
[-] Subs-ReportedContent.php
[edit]
[-] Register.php~
[edit]
[-] Subs-Sound.php
[edit]
[-] Who.php
[edit]
[-] Subs-Members.php
[edit]
[-] Search.php~
[edit]
[-] ManageRegistration.php
[edit]
[-] Help.php~
[edit]
[-] PostModeration.php
[edit]
[-] ShowAttachments.php
[edit]
[-] Subs-Db-postgresql.php
[edit]
[-] Recent.php
[edit]
[-] Memberlist.php
[edit]
[-] ManageBoards.php
[edit]
[-] Themes.php~
[edit]
[-] Errors.php
[edit]
[-] ManagePermissions.php
[edit]
[-] SplitTopics.php
[edit]
[-] Profile-Modify.php
[edit]
[-] Themes.php
[edit]
[-] Register.php
[edit]
[-] Profile-Export.php
[edit]
[-] ManageServer.php~
[edit]
[-] Subs-Auth.php
[edit]
[-] PersonalMessage.php~
[edit]
[-] ManageSearchEngines.php
[edit]
[-] Drafts.php
[edit]
[-] Subs-Package.php~
[edit]
[-] Subs-MembersOnline.php
[edit]
[-] ManageCalendar.php
[edit]
[-] Memberlist.php~
[edit]
[-] QueryString.php
[edit]
[-] Poll.php
[edit]
[-] ManageMembergroups.php
[edit]
[+]
tasks
[-] ManageSearch.php
[edit]
[-] Subs-Auth.php~
[edit]
[-] Agreement.php~
[edit]
[-] Topic.php
[edit]
[-] QueryString.php~
[edit]
[-] ViewQuery.php
[edit]
[-] ManageMaintenance.php~
[edit]
[-] PackageGet.php
[edit]
[-] Post.php
[edit]
[-] Subs-Timezones.php
[edit]
[-] ManageErrors.php~
[edit]
[-] Post.php~
[edit]
[-] SearchAPI-Fulltext.php~
[edit]
[-] Profile-View.php
[edit]
[-] Subs-OpenID.php
[edit]
[-] ManageBans.php
[edit]
[-] Class-CurlFetchWeb.php
[edit]
[-] DbExtra-sqlite.php
[edit]
[-] ManageNews.php~
[edit]
[-] Subscriptions-PayPal.php
[edit]
[-] ManageSearchEngines.php~
[edit]
[-] RepairBoards.php
[edit]
[-] Class-BrowserDetect.php
[edit]
[+]
ReCaptcha
[-] Subs-List.php
[edit]
[-] Notify.php~
[edit]
[-] ManageSettings.php
[edit]
[-] RepairBoards.php~
[edit]
[-] Subs-Themes.php
[edit]
[-] Search.php
[edit]
[-] SearchAPI-Fulltext.php
[edit]