This file is indexed.

/usr/share/php/xajax/tests/registerObjectTest.php is in php-xajax 0.5-1ubuntu1.

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
<?php
/*
    File: registerObjectTest.php

    Script to test callable objects.
    
    Title: Call methods of registered objects.
    
    Please see <copyright.inc.php> for a detailed description, copyright
    and license information.
*/

/*
    @package xajax
    @version $Id: registerObjectTest.php 362 2007-05-29 15:32:24Z calltoconstruct $
    @copyright Copyright (c) 2005-2006 by Jared White & J. Max Wilson
    @license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
require_once( "../xajax_core/xajax.inc.php" );

class myObjectTest
{
    var $myValue='default';

    function testInstanceMethod( $formData )
    {
        $objResponse=new xajaxResponse();
        $objResponse->alert( "My value is: {$this->myValue}" );
        $objResponse->alert( "formData: " . print_r( $formData, true ) );
        $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) );
        return $objResponse;
    }

    function testClassMethod( $formData )
    {
        $objResponse=new xajaxResponse();
        $objResponse->alert( "This is a class method." );
        $objResponse->alert( "formData: " . print_r( $formData, true ) );
        $objResponse->assign( "submittedDiv", "innerHTML", nl2br( print_r( $formData, true ) ) );
        return $objResponse;
    }
}

class objectMethodsTest
{
    var $myValue='default';

    function firstMethod( )
    {
        $objResponse=new xajaxResponse();
        $objResponse->alert( "In firstMethod. My value is: {$this->myValue}" );
        return $objResponse;
    }

    function second_method( )
    {
        $objResponse=new xajaxResponse();
        $objResponse->alert( "In second_method. My value is: {$this->myValue}" );
        return $objResponse;
    }
}

class objectMethodsTest2
    extends objectMethodsTest
{
    function thirdMethod( $arg1 )
    {
        $objResponse=new xajaxResponse();
        $objResponse->alert( "In thirdMethod. My value is: {$this->myValue} and arg1: $arg1" );
        return $objResponse;
    }
}

$xajax=new xajax();

//$xajax->setFlag("debug", true);

$myObj2=new objectMethodsTest();

if ( 0 <= version_compare( '5.0', PHP_VERSION ) )
    // for PHP4
    eval( '$aMethodsTest =& $xajax->register(XAJAX_CALLABLE_OBJECT, &$myObj2);' );
else
    $aMethodsTest=&$xajax->register( XAJAX_CALLABLE_OBJECT, $myObj2 );
$myObj2->myValue='right:2';

$myObj3=new objectMethodsTest2();

if ( 0 <= version_compare( '5.0', PHP_VERSION ) )
    // for PHP4
    eval( '$aMethodsTest2 =& $xajax->register(XAJAX_CALLABLE_OBJECT, &$myObj3);' );
else
    $aMethodsTest2=&$xajax->register( XAJAX_CALLABLE_OBJECT, $myObj3 );
$aMethodsTest2['thirdmethod']->setParameter( 0, XAJAX_QUOTED_VALUE, 'howdy' );
$myObj3->myValue='right:3';

$myObj=new myObjectTest();
$myObj->myValue='wrong';
$requestInstanceMethod=&$xajax->registerFunction( array
    (
    "testForm",
    &$myObj,
    "testInstanceMethod"
    ));

$requestInstanceMethod->setParameter( 0, XAJAX_FORM_VALUES, 'testForm1' );
$requestClassMethod=&$xajax->registerFunction( array
    (
    "testForm2",
    "myObjectTest",
    "testClassMethod"
    ));

$requestClassMethod->setParameter( 0, XAJAX_FORM_VALUES, 'testForm1' );
$myObj->myValue='right';

$xajax->processRequest();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
    <head>
        <title>Register Object Test | xajax Tests</title>

        <?php $xajax->printJavascript( "../" ) ?>
    </head>

    <body>
        <h2><a href = "index.php">xajax Tests</a></h2>

        <h1>Register Object Test</h1>

        <p>
            <a href = '#' onclick = '<?php $aMethodsTest['firstmethod']->printScript(); ?>; return false;'>Test
            Callable Object:2</a>

            <br />

            <a href = '#' onclick = '<?php $aMethodsTest['second_method']->printScript(); ?>; return false;'>Test
            Callable Object:2</a>

            <br />

            <a href = '#' onclick = '<?php $aMethodsTest2['thirdmethod']->printScript(); ?>; return false;'>Test
            Callable Object:3</a>

            <br />

            <a href = '#' onclick = '<?php $aMethodsTest2['firstmethod']->printScript(); ?>; return false;'>Test
            Callable Object:3</a>
        </p>

        <form id = "testForm1" onsubmit = "return false;">
            <p>
                <input type = "text" id = "textBox1" name = "textBox1" value = "This is some text" />
            </p>

            <p>
                <input type = 'submit' value = 'Submit to Instance Method'
                    onclick = '<?php $requestInstanceMethod->printScript(); ?>; return false;' />
            </p>

            <p>
                <input type = 'submit' value = 'Submit to Class Method'
                    onclick = '<?php $requestClassMethod->printScript(); ?>; return false;' />
            </p>
        </form>

        <div id = "submittedDiv">
        </div>
    </body>
</html>