Пример #1
0
	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
	EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
	OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
	NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
	HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
	WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
	OTHER DEALINGS IN THE SOFTWARE.
*/
/*
	Creates the necessary JavaScript stub for a remote php class
*/
require_once "Pajax.class.php";
header("Content-Type: text/javascript");
$pajax = new Pajax(substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "/") + 1));
$class = $_SERVER['QUERY_STRING'];
if ($class != "") {
    // Generate class stubs for the remotable classes
    if ($pajax->loadClass($class)) {
        echo $pajax->getJavaScriptStub($class);
    } else {
        error_log("PAJAX: Can't load '" . $class . "'");
        echo "// Can't load '" . $class . "'";
    }
} else {
    error_log("PAJAX: Class '" . $class . "' not valid");
    echo "// Class '" . $class . "' not valid! ";
}
?>
Пример #2
0
	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
	EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
	OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
	NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
	HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
	WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
	OTHER DEALINGS IN THE SOFTWARE.
*/
/*
	This script will dispatch the request to the proper PHP object and return
	the result of the call. It takes care of marshaling parameters back and
	forth.
*/
require_once 'Pajax.class.php';
$pajax = new Pajax();
$input = $HTTP_RAW_POST_DATA;
error_log("PAJAX: Input JSON: " . $input);
$invoke = json_decode($input);
// Marshaled parameters
$class = $invoke->className;
$method = $invoke->method;
$id = $invoke->id;
$output = "null";
$obj = null;
error_log("PAJAX: Dispatching");
// Attempts to load class definition
if ($pajax->loadClass($class)) {
    /* 
    	The session stuff needs to be here, once the class definition has been
    	loaded, otherwise the object gets deserialized from the session as