This file is indexed.

/usr/share/php/xajax/xajax_core/plugin_layer/xajaxEventPlugin.inc.php is in php-xajax 0.5-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?php
/*
	File: xajaxEventPlugin.inc.php

	Contains the xajaxEventPlugin class

	Title: xajaxEventPlugin class

	Please see <copyright.inc.php> for a detailed description, copyright
	and license information.
*/

/*
	@package xajax
	@version $Id: xajaxEventPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
	@copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
	@copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White  & J. Max Wilson
	@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/

/*
	Constant: XAJAX_EVENT
		Specifies that the item being registered via the <xajax->register> function
		is an event.
		
	Constant: XAJAX_EVENT_HANDLER
		Specifies that the item being registered via the <xajax->register> function
		is an event handler.
*/
if (!defined ('XAJAX_EVENT')) define ('XAJAX_EVENT', 'xajax event');
if (!defined ('XAJAX_EVENT_HANDLER')) define ('XAJAX_EVENT_HANDLER', 'xajax event handler');

//SkipAIO
require dirname(__FILE__) . '/support/xajaxEvent.inc.php';
//EndSkipAIO

/*
	Class: xajaxEventPlugin
	
	Plugin that adds server side event handling capabilities to xajax.  Events can
	be registered, then event handlers attached.
*/
class xajaxEventPlugin extends xajaxRequestPlugin
{
	/*
		Array: aEvents
	*/
	var $aEvents;

	/*
		String: sXajaxPrefix
	*/
	var $sXajaxPrefix;
	
	/*
		String: sEventPrefix
	*/
	var $sEventPrefix;

	/*
		String: sDefer
	*/
	var $sDefer;
	
	var $bDeferScriptGeneration;

	/*
		String: sRequestedEvent
	*/
	var $sRequestedEvent;

	/*
		Function: xajaxEventPlugin
	*/
	function xajaxEventPlugin()
	{
		$this->aEvents = array();

		$this->sXajaxPrefix = 'xajax_';
		$this->sEventPrefix = 'event_';
		$this->sDefer = '';
		$this->bDeferScriptGeneration = false;

		$this->sRequestedEvent = NULL;

		if (isset($_GET['xjxevt'])) $this->sRequestedEvent = $_GET['xjxevt'];
		if (isset($_POST['xjxevt'])) $this->sRequestedEvent = $_POST['xjxevt'];
	}

	/*
		Function: configure
	*/
	function configure($sName, $mValue)
	{
		if ('wrapperPrefix' == $sName) {
			$this->sXajaxPrefix = $mValue;
		} else if ('eventPrefix' == $sName) {
			$this->sEventPrefix = $mValue;
		} else if ('scriptDefferal' == $sName) {
			if (true === $mValue) $this->sDefer = 'defer ';
			else $this->sDefer = '';
		} else if ('deferScriptGeneration' == $sName) {
			if (true === $mValue || false === $mValue)
				$this->bDeferScriptGeneration = $mValue;
			else if ('deferred' === $mValue)
				$this->bDeferScriptGeneration = $mValue;
		}
	}

	/*
		Function: register

		$sType - (string): type of item being registered
		$sEvent - (string): the name of the event
		$ufHandler - (function name or reference): a reference to the user function to call
		$aConfiguration - (array): an array containing configuration options
	*/
	function register($aArgs)
	{
		if (1 < count($aArgs))
		{
			$sType = $aArgs[0];

			if (XAJAX_EVENT == $sType)
			{
				$sEvent = $aArgs[1];

				if (false === isset($this->aEvents[$sEvent]))
				{
					$xe =& new xajaxEvent($sEvent);

					if (2 < count($aArgs))
						if (is_array($aArgs[2]))
							foreach ($aArgs[2] as $sKey => $sValue)
								$xe->configure($sKey, $sValue);

					$this->aEvents[$sEvent] =& $xe;

					return $xe->generateRequest($this->sXajaxPrefix, $this->sEventPrefix);
				}
			}

			if (XAJAX_EVENT_HANDLER == $sType)
			{
				$sEvent = $aArgs[1];

				if (isset($this->aEvents[$sEvent]))
				{
					if (isset($aArgs[2]))
					{
						$xuf =& $aArgs[2];

						if (false === is_a($xuf, 'xajaxUserFunction'))
							$xuf =& new xajaxUserFunction($xuf);

						$objEvent =& $this->aEvents[$sEvent];
						$objEvent->addHandler($xuf);

						return true;
					}
				}
			}
		}

		return false;
	}

	/*
		Function: generateClientScript
	*/
	function generateClientScript()
	{
		if (false === $this->bDeferScriptGeneration || 'deferred' === $this->bDeferScriptGeneration)
		{
			if (0 < count($this->aEvents))
			{
				echo "\n<script type='text/javascript' ";
				echo $this->sDefer;
				echo "charset='UTF-8'>\n";
				echo "/* <![CDATA[ */\n";

				foreach (array_keys($this->aEvents) as $sKey)
					$this->aEvents[$sKey]->generateClientScript($this->sXajaxPrefix, $this->sEventPrefix);

				echo "/* ]]> */\n";
				echo "</script>\n";
			}
		}
	}

	/*
		Function: canProcessRequest
	*/
	function canProcessRequest()
	{
		if (NULL == $this->sRequestedEvent)
			return false;

		return true;
	}

	/*
		Function: processRequest
	*/
	function processRequest()
	{
		if (NULL == $this->sRequestedEvent)
			return false;

		$objArgumentManager =& xajaxArgumentManager::getInstance();
		$aArgs = $objArgumentManager->process();

		foreach (array_keys($this->aEvents) as $sKey)
		{
			$objEvent =& $this->aEvents[$sKey];

			if ($objEvent->getName() == $this->sRequestedEvent)
			{
				$objEvent->fire($aArgs);
				return true;
			}
		}

		return 'Invalid event request received; no event was registered with this name.';
	}
}

$objPluginManager =& xajaxPluginManager::getInstance();
$objPluginManager->registerPlugin(new xajaxEventPlugin(), 103);