Server IP : 1.179.227.78 / Your IP : 10.104.4.41 Web Server : Apache System : Linux afdc-mdu34 5.4.0-153-generic #170-Ubuntu SMP Fri Jun 16 13:43:31 UTC 2023 x86_64 User : www ( 1001) PHP Version : 7.4.30 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/afdc-mdu34.rtarf.mi.th/joomla/components/com_privacy/models/ |
Upload File : |
<?php /** * @package Joomla.Site * @subpackage com_privacy * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Remind confirmation model class. * * @since 3.9.0 */ class PrivacyModelRemind extends JModelAdmin { /** * Confirms the remind request. * * @param array $data The data expected for the form. * * @return mixed Exception | JException | boolean * * @since 3.9.0 */ public function remindRequest($data) { // Get the form. $form = $this->getForm(); $data['email'] = JStringPunycode::emailToPunycode($data['email']); // Check for an error. if ($form instanceof Exception) { return $form; } // Filter and validate the form data. $data = $form->filter($data); $return = $form->validate($data); // Check for an error. if ($return instanceof Exception) { return $return; } // Check the validation results. if ($return === false) { // Get the validation messages from the form. foreach ($form->getErrors() as $formError) { $this->setError($formError->getMessage()); } return false; } /** @var PrivacyTableConsent $table */ $table = $this->getTable(); $db = $this->getDbo(); $query = $db->getQuery(true) ->select($db->quoteName(array('r.id', 'r.user_id', 'r.token'))); $query->from($db->quoteName('#__privacy_consents', 'r')); $query->join('LEFT', $db->quoteName('#__users', 'u') . ' ON u.id = r.user_id'); $query->where($db->quoteName('u.email') . ' = ' . $db->quote($data['email'])); $query->where($db->quoteName('r.remind') . ' = 1'); $db->setQuery($query); try { $remind = $db->loadObject(); } catch (RuntimeException $e) { $this->setError(JText::_('COM_PRIVACY_ERROR_NO_PENDING_REMIND')); return false; } if (!$remind) { $this->setError(JText::_('COM_PRIVACY_ERROR_NO_PENDING_REMIND')); return false; } // Verify the token if (!JUserHelper::verifyPassword($data['remind_token'], $remind->token)) { $this->setError(JText::_('COM_PRIVACY_ERROR_NO_REMIND_REQUESTS')); return false; } // Everything is good to go, transition the request to extended $saved = $this->save( array( 'id' => $remind->id, 'remind' => 0, 'token' => '', 'created' => JFactory::getDate()->toSql(), ) ); if (!$saved) { // Error was set by the save method return false; } return true; } /** * Method for getting the form from the model. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. * * @return JForm|boolean A JForm object on success, false on failure * * @since 3.9.0 */ public function getForm($data = array(), $loadData = true) { // Get the form. $form = $this->loadForm('com_privacy.remind', 'remind', array('control' => 'jform')); if (empty($form)) { return false; } $input = JFactory::getApplication()->input; if ($input->getMethod() === 'GET') { $form->setValue('remind_token', '', $input->get->getAlnum('remind_token')); } return $form; } /** * Method to get a table object, load it if necessary. * * @param string $name The table name. Optional. * @param string $prefix The class prefix. Optional. * @param array $options Configuration array for model. Optional. * * @return JTable A JTable object * * @since 3.9.0 * @throws \Exception */ public function getTable($name = 'Consent', $prefix = 'PrivacyTable', $options = array()) { return parent::getTable($name, $prefix, $options); } /** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 3.9.0 */ protected function populateState() { // Get the application object. $params = JFactory::getApplication()->getParams('com_privacy'); // Load the parameters. $this->setState('params', $params); } }