<?php /* * Copyright (C) 2007 Joshua Eichorn * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * I This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ // HTML_AJAX_Server class require_once 'HTML/AJAX/Server.php'; // UploadProgressMeter class were exporting require $_SERVER["DOCUMENT_ROOT"] . "/php/libs/uploadprogressmeter/UploadProgressMeterStatus.class.php"; $server = new HTML_AJAX_Server(); $status = new UploadProgressMeterStatus(); // were registering class and method name by hand so we don't run into php4/5 case compat problems $server->registerClass($status, 'UploadProgressMeterStatus', array('getStatus')); $server->handleRequest(); ?>
<?php /** * Simplest possible usage of HTML_AJAX_Server * * The server responds to ajax calls and also serves the js client libraries, so they can be used directly from the PEAR data dir * 304 not modified headers are used when server client libraries so they will be cached on the browser reducing overhead * * @category HTML * @package AJAX * @author Joshua Eichorn <*****@*****.**> * @copyright 2005 Joshua Eichorn * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version Release: @package_version@ * @link http://pear.php.net/package/HTML_AJAX */ // include the server class include 'HTML/AJAX/Server.php'; // include the test class will be registering include 'support/test.class.php'; // create our new server $server = new HTML_AJAX_Server(); // register an instance of the class were registering $test =& new test(); $server->registerClass($test); $server->ajax->packJavaScript = true; // handle different types of requests possiblities are // ?client=all - request for all javascript client files // ?stub=classname - request for proxy stub for given class, can be combined with client but this may hurt caching unless stub=all is used // ?c=classname&m=method - an ajax call, server handles serialization and handing things off to the proper method then returning the results $server->handleRequest();
<?php /** * AJAX Initialization * * @author Christopher Troup <*****@*****.**> * @package CMS * @subpackage Core * @version 2.0 */ /** * Require the Site initialization file. */ require dirname(__FILE__) . '/../include/Site.php'; /** * Require the AJAX Server class */ require 'HTML/AJAX/Server.php'; //Create server instance $server = new HTML_AJAX_Server(); $server->ajax->packJavaScript = true; include_once dirname(__FILE__) . '/../modules/Menu/include/Menu.php'; $menu = new Menu(); $server->registerClass($menu, 'Menu', array('getLinkables')); //Handle the request based on $_GET variables $server->handleRequest();
* The server responds to ajax calls and also serves the js client libraries, so they can be used directly from the PEAR data dir * 304 not modified headers are used when server client libraries so they will be cached on the browser reducing overhead * * @category HTML * @package AJAX * @author Joshua Eichorn <*****@*****.**> * @copyright 2005 Joshua Eichorn * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version Release: 0.5.6 * @link http://pear.php.net/package/HTML_AJAX */ // include the server class require_once 'HTML/AJAX/Server.php'; // include the test class will be registering include 'support/test.class.php'; // create our new server $server = new HTML_AJAX_Server(); // register an instance of the class were registering $test =& new test(); $server->registerClass($test); $server->ajax->packJavaScript = true; if (isset($_GET['gzip']) && $_GET['gzip'] == 'true') { $server->compression['enabled'] = true; } // user HTML_AJAX to deliver a custom library $server->registerJSLibrary('customLib', 'customLib.js', './support/'); // handle different types of requests possiblities are // ?client=all - request for all javascript client files // ?stub=classname - request for proxy stub for given class, can be combined with client but this may hurt caching unless stub=all is used // ?c=classname&m=method - an ajax call, server handles serialization and handing things off to the proper method then returning the results $server->handleRequest();
<?php require_once 'includes/config.php'; require_once 'HTML/AJAX/Server.php'; $server = new HTML_AJAX_Server(); $server->handleRequest(); if (isset($_REQUEST['act']) && $_REQUEST['act'] == "show_gallery" && isset($_REQUEST['gal_id']) && is_numeric($_REQUEST['gal_id'])) { $query = "\n\t\tSELECT p.realname\n\t\tFROM iShark_Galleries_Pictures AS gp\n\t\tLEFT JOIN iShark_Pictures AS p ON p.picture_id = gp.picture_id\n\t\tWHERE gp.gallery_id = '" . intval($_REQUEST['gal_id']) . "'\n\t\tORDER BY gp.orders ASC\n\t"; $result =& $mdb2->query($query); $gals = $result->fetchAll(); echo json_encode($gals); } if (isset($_REQUEST['act']) && $_REQUEST['act'] == "saveResult" && isset($_SESSION['teszt_email']) && !empty($_SESSION['teszt_email']) && isset($_SESSION['teszt_name']) && !empty($_SESSION['teszt_name'])) { $answers = array("d", "c", "c", "c", "a", "b", "b", 7, "d", "c", "c", "b", "a", "a"); $result = 0; if (is_array($_REQUEST["a"])) { foreach ($_REQUEST["a"] as $key => $value) { if ($value == $answers[$key]) { $result++; } } } if (intval($_REQUEST["secs"]) == -1) { $secs = 0; } else { $secs = intval($_REQUEST["secs"]); } $uemail = $mdb2->escape($_SESSION['teszt_email']); $uname = $mdb2->escape($_SESSION['teszt_name']); $q = "\n\t\tSELECT *\n\t\tFROM iShark_Users\n\t\tWHERE email = '" . $uemail . "'\n\t"; $res = $mdb2->query($q);
<?php include 'HTML/AJAX/Server.php'; include 'support/xml.class.php'; $server = new HTML_AJAX_Server(); // register an instance of the class were registering $xml =& new TestXml(); $server->registerClass($xml, 'TestXml', array('createHealthy', 'createJunk', 'writeDoc')); $server->setSerializer('XML'); $server->handleRequest();
<?php /** * Usage example for HTML_QuickForm2 package: AJAX-backed hierselect element, AJAX server */ require_once 'HTML/AJAX/Server.php'; require_once '../support/hierselect-loader.php'; $server = new HTML_AJAX_Server(); $server->registerClass(new OptionLoader(), 'OptionLoader', array('getOptionsAjax')); $server->handleRequest();
<?php require_once 'HTML/AJAX/Server.php'; class Foo { function bar() { return 'hello'; } } function foobar() { return 'hello'; } // start server $server = new HTML_AJAX_Server(); // register normal function $callback = 'foobar'; $server->registerPhpCallback($callback); // register static method $callback = array('Foo', 'bar'); $server->registerPhpCallback($callback); // register object method $foo = new Foo(); $callback = array($foo, 'bar'); $server->registerPhpCallback($callback); // handle the request if ($server->handleRequest()) { exit; } ?>
function javascript() { $server = new HTML_AJAX_Server($this->request); $server->handleRequest(); }
/** * HTML_AJAX_Server with a register itnerceptor class * * The server responds to ajax calls and also serves the js client libraries, so they can be used directly from the PEAR data dir * 304 not modified headers are used when server client libraries so they will be cached on the browser reducing overhead * * @category HTML * @package AJAX * @author Joshua Eichorn <*****@*****.**> * @copyright 2007 Joshua Eichorn * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version Release: 0.5.2 * @link http://pear.php.net/package/HTML_AJAX */ // include the server class include 'HTML/AJAX/Server.php'; // include the test class will be registering include 'support/test.class.php'; include 'support/test2.class.php'; include 'support/interceptor.php'; // create our new server $server = new HTML_AJAX_Server(); // register an instance of the class were registering $test = new test(); $server->registerClass($test, 'test'); $test2 = new test2(); $server->registerClass($test2, 'test2'); $server->ajax->packJavaScript = true; $server->ajax->setInterceptor(new Interceptor()); $server->handleRequest();
<?php include 'HTML/AJAX/Server.php'; include 'support/xml.class.php'; $server = new HTML_AJAX_Server(); // register an instance of the class were registering $xml =& new TestXml(); $server->registerClass($xml); $server->setSerializer('XML'); $server->handleRequest();
// * Copyright (c) 2006 Senza Limiti s.r.o. * // * * // * This program is free software; you can redistribute it and/or * // * modify it under the terms of the GNU General Public License * // * as published by the Free Software Foundation; either version 2 * // * of the License, or (at your option) any later version. * // * * // * This program is distributed in the hope that it will be useful, * // * but WITHOUT ANY WARRANTY; without even the implied warranty of * // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * // * GNU General Public License for more details. * // * * // * For commercial licenses please contact Senza Limiti at * // * - http://www.senzalimiti.sk * // * - info(at)senzalimiti.sk * // ***************************************************************************** if (!defined("GRID_SOURCE")) { //define("GRID_SOURCE", str_replace(DIRECTORY_SEPARATOR, '/', realpath(dirname(__FILE__)))); define("GRID_SOURCE", ""); } //include_once '../../core/core.db.inc.php'; // TODO: Modificado para que corra el sistema //error_reporting(E_ALL|E_NOTICE); include_once "class/gridclasses.php"; @session_start(); include 'HTML/AJAX/Server.php'; include_once './ajax/functions.php'; $gridajax =& new gridajax(); $server = new HTML_AJAX_Server(); $server->registerClass($gridajax); $server->handleRequest();
function __construct($db, $db_prefix) { $this->db = $db; $this->db_prefix = $db_prefix; parent::HTML_AJAX_Server(); }