This file is indexed.

/usr/share/php/xajax/examples/thewall/thewall.server.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
230
231
232
233
234
235
236
237
<?php
/*
	File: thewall.server.php

	Example which demonstrates a xajax implementation of a graffiti wall.
	
	Title: Graffiti Wall Example
	
	Please see <copyright.inc.php> for a detailed description, copyright
	and license information.
*/

/*
	Section: Files
	
	- <thewall.php>
	- <thewall.common.php>
	- <thewall.server.php>
*/

/*
	@package xajax
	@version $Id: xajax.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
*/

/*
	Section: Define constants
	
	Integer: MAX_SCRIBBLES
	
	The number of scribbles that will be retained.  The default is 5.
*/
if (!defined ('MAX_SCRIBBLES'))
{
	define ('MAX_SCRIBBLES', 5);
}

/*
	String: DATA_FILE
	
	The file that will be used to store the messages on the server.
*/
if (!defined ('DATA_FILE'))
{
	define ('DATA_FILE', "thewall.dta");
}

/*
	Class: graffiti
*/
class graffiti
{
	/*
		String: html
		
		Stores the html that is being generated for the current request.
	*/
	var $html;
	
	/*
		Boolean: isValid
		
		Indicates that the html generated for this request is valid and
		can be added to the wall <DATA_FILE>.
	*/
	var $isValid = false;
	
	/*
		Constructor: graffiti
		
		Builds the <html> output and sets the <isValid> indicator.
	*/
	function graffiti($sHandle, $sWords)
	{
		if (trim($sHandle) == "" || trim($sWords) == "")
		{
			return;
		}
		$this->html  = "\n<div style=\"font-weight: bold;text-align:".$this->getRandomAlignment();
		$this->html .= ";color:".$this->getRandomColor().";\">";
		$this->html .= "<span style=\"font-size:".$this->getRandomFontSize()."%;\">";
		$this->html .= strip_tags(stripslashes($sWords));
		$this->html .= "</span><br/><span style=\"font-size: small;\">";
		$this->html .= " ~ ".strip_tags(stripslashes($sHandle))." ".date("m/d/Y H:i:s")."</span></div>";
		
		$this->isValid = true;
	}
	
	/*
		Function: getRandomFontSize
		
		Generate a font size based off a random number.
	*/
	function getRandomFontSize()
	{
		srand((double)microtime()*1000003);
		return rand(100,300);
	}
	
	/*
		Function: getRandomColor
		
		Generate a browser safe color based on a random number.
	*/
	function getRandomColor()
	{
		$sColor = "rgb(";
		srand((double)microtime()*1000003);
		$sColor .= rand(0,255).",";
		srand((double)microtime()*1000003);
		$sColor .= rand(0,255).",";
		$sColor .= rand(0,255).")";
		
		return $sColor;
	}
	
	/*
		Function: getRandomAlignment
		
		Generates a text-alignment value based on a random number.
	*/
	function getRandomAlignment()
	{
		$sAlign = "";
		srand((double)microtime()*1000003);
		$textAlign = rand(0,2);
		switch($textAlign)
		{
			case 0: $sAlign = "left"; break;
			case 1: $sAlign = "right"; break;
			case 2: $sAlign = "center"; break;
			
		}
		return $sAlign;
	}
	
	/*
		Function: save
		
		Writes the current <graffiti->html> to the <DATA_FILE> when <graffiti->isValid>
		or returns an error message.
	*/
	function save()
	{
		if ($this->isValid)
		{
			$rFile = @fopen(DATA_FILE,"a+");
			if (!$rFile) {
				return "ERROR: the graffiti data file could not be written to the " . dirname(realpath(DATA_FILE)) . " folder.";
			}
			fwrite($rFile, $this->html);
			fclose($rFile);
			return null;
		}
		else
		{
			return "Please supply both a handle and some graffiti to scribble on the wall.";
		}
	}
}

/*
	Section: xajax request handlers
	
	Function: scribble
	
	Processes the users form input and passes the values to an instance
	of the <graffiti> class.
	
	If the graffiti class generates and error, it is returned to the browser
	using <xajax->alert>, otherwise, <xajax->script> is used to instruct the
	browser to make a request to <updateWall> and <xajax->clear> is used to
	clear the form input.
*/
function scribble($aFormValues)
{
	$sHandle = $aFormValues['handle'];
	$sWords = $aFormValues['words'];
	$objResponse = new xajaxResponse();
	
	$objGraffiti = new graffiti($sHandle,$sWords);
	$sErrMsg = $objGraffiti->save();
	if (!$sErrMsg)
	{
		$objResponse->script("xajax_updateWall();");
		$objResponse->clear("words","value");
	}
	else
		$objResponse->alert($sErrMsg);
	
	return $objResponse;
}

/*
	Function: updateWall
	
	Processes the data previously written to the <DATA_FILE> by <graffiti->save>.
*/
function updateWall()
{
	$objResponse = new xajaxResponse();
	
	if (file_exists(DATA_FILE)) {
		$aFile = @file(DATA_FILE);
		if (!$aFile) {
			$objResponse->addAlert("ERROR: the graffiti data file could not be written to the " . dirname(realpath(DATA_FILE)) . " folder.");
			return $objResponse;
		}
		
		$sHtmlSave = implode("\n",array_slice($aFile, -MAX_SCRIBBLES));
		$sHtmlSave=str_replace("\n\n","\n",$sHtmlSave);
	}
	else {
		$sHtmlSave = "";
		$aFile = array();
	}
	$rFile = @fopen(DATA_FILE,"w+");
	if (!$rFile) {
		$objResponse->alert("ERROR: the graffiti data file could not be written to the " . dirname(realpath(DATA_FILE)) . " folder.");
		return $objResponse;
	}
	fwrite($rFile, $sHtmlSave);
	fclose($rFile);
	
	$sHtml = implode("\n",array_reverse(array_slice($aFile, -MAX_SCRIBBLES)));
	
	$objResponse->assign("theWall","innerHTML",$sHtml);

	return $objResponse;
}

require("thewall.common.php");
$xajax->processRequest();
?>