403Webshell
Server IP : 195.130.67.5  /  Your IP : 216.73.217.154
Web Server : Microsoft-IIS/10.0
System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586
User : IUSR ( 0)
PHP Version : 7.4.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Old Sites/Libteiser - Ojs/ojs2/classes/security/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Old Sites/Libteiser - Ojs/ojs2/classes/security/AuthSourceDAO.inc.php
<?php

/**
 * @file classes/security/AuthSourceDAO.inc.php
 *
 * Copyright (c) 2003-2009 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @class AuthSourceDAO
 * @ingroup security
 * @see AuthSource
 *
 * @brief Operations for retrieving and modifying AuthSource objects.
 */

// $Id: AuthSourceDAO.inc.php,v 1.9.2.1 2009/04/08 19:42:49 asmecher Exp $


import('security.AuthSource');

class AuthSourceDAO extends DAO {
	var $plugins;

	/**
	 * Constructor.
	 */
	function AuthSourceDAO() {
		parent::DAO();
		$this->plugins = &PluginRegistry::loadCategory(AUTH_PLUGIN_CATEGORY);
	}

	/**
	 * Get plugin instance corresponding to the ID.
	 * @param $authId int
	 * @return AuthPlugin
	 */
	function &getPlugin($authId) {
		$plugin = null;
		$auth = &$this->getSource($authId);
		if ($auth != null) {
			$plugin =& $auth->getPluginClass();
			if ($plugin != null) {
				$plugin = &$plugin->getInstance($auth->getSettings(), $auth->getAuthId());
			}
		}
		return $plugin;
	}

	/**
	 * Get plugin instance for the default authentication source.
	 * @return AuthPlugin
	 */
	function &getDefaultPlugin() {
		$plugin = null;
		$auth = &$this->getDefaultSource();
		if ($auth != null) {
			$plugin =& $auth->getPluginClass();
			if ($plugin != null) {
				$plugin = &$plugin->getInstance($auth->getSettings(), $auth->getAuthId());
			}
		}
		return $plugin;
	}

	/**
	 * Retrieve a source.
	 * @param $authId int
	 * @return AuthSource
	 */
	function &getSource($authId) {
		$result = &$this->retrieve(
			'SELECT * FROM auth_sources WHERE auth_id = ?', $authId
		);

		$returner = null;
		if ($result->RecordCount() != 0) {
			$returner = &$this->_returnAuthSourceFromRow($result->GetRowAssoc(false));
		}

		$result->Close();
		unset($result);

		return $returner;
	}

	/**
	 * Retrieve the default authentication source.
	 * @return AuthSource
	 */
	function &getDefaultSource() {
		$result = &$this->retrieve(
			'SELECT * FROM auth_sources WHERE auth_default = 1'
		);

		$returner = null;
		if ($result->RecordCount() != 0) {
			$returner = &$this->_returnAuthSourceFromRow($result->GetRowAssoc(false));
		}

		$result->Close();
		unset($result);

		return $returner;
	}

	/**
	 * Internal function to return an AuthSource object from a row.
	 * @param $row array
	 * @return AuthSource
	 */
	function &_returnAuthSourceFromRow(&$row) {
		$auth = &new AuthSource();
		$auth->setAuthId($row['auth_id']);
		$auth->setTitle($row['title']);
		$auth->setPlugin($row['plugin']);
		$auth->setPluginClass(@$this->plugins[$row['plugin']]);
		$auth->setDefault($row['auth_default']);
		$auth->setSettings(unserialize($row['settings']));
		return $auth;
	}

	/**
	 * Insert a new source.
	 * @param $auth AuthSource
	 */
	function insertSource(&$auth) {
		if (!isset($this->plugins[$auth->getPlugin()])) return false;
		if (!$auth->getTitle()) $auth->setTitle($this->plugins[$auth->getPlugin()]->getDisplayName());
		$this->update(
			'INSERT INTO auth_sources
				(title, plugin, settings)
				VALUES
				(?, ?, ?)',
			array(
				$auth->getTitle(),
				$auth->getPlugin(),
				serialize($auth->getSettings() ? $auth->getSettings() : array())
			)
		);

		$auth->setAuthId($this->getInsertId('auth_sources', 'auth_id'));
		return $auth->getAuthId();
	}

	/**
	 * Update a source.
	 * @param $auth AuthSource
	 */
	function updateSource(&$auth) {
		return $this->update(
			'UPDATE auth_sources SET
				title = ?,
				settings = ?
			WHERE auth_id = ?',
			array(
				$auth->getTitle(),
				serialize($auth->getSettings() ? $auth->getSettings() : array()),
				$auth->getAuthId()
			)
		);
	}

	/**
	 * Delete a source.
	 * @param $authId int
	 */
	function deleteSource($authId) {
		return $this->update(
			'DELETE FROM auth_sources WHERE auth_id = ?', $authId
		);
	}

	/**
	 * Set the default authentication source.
	 * @param $authId int
	 */
	function setDefault($authId) {
		$this->update(
			'UPDATE auth_sources SET auth_default = 0'
		);
		$this->update(
			'UPDATE auth_sources SET auth_default = 1 WHERE auth_id = ?', $authId
		);
	}

	/**
	 * Retrieve a list of all auth sources for the site.
	 * @return array AuthSource
	 */
	function &getSources($rangeInfo = null) {
		$result = &$this->retrieveRange(
			'SELECT * FROM auth_sources ORDER BY auth_id',
			false, $rangeInfo
		);

		$returner = &new DAOResultFactory($result, $this, '_returnAuthSourceFromRow');
		return $returner;
	}
}

?>

Youez - 2016 - github.com/yon3zu
LinuXploit