function Connection($driver) { if (URL::validClass($driver)) { $db_driver = $driver->getProtocol() . 'Connection'; if (!JPHPClassRegistry::isRegistered($db_driver)) { JPHP::import('jphp.sql.drivers.' . $driver->getProtocol() . '.*'); } if (JPHPClassRegistry::isRegistered($db_driver)) { $db_driver = '$this->driver = new ' . $db_driver . '();'; $this->drivername = $driver; eval($db_driver); $this->setDBConnection($driver->getHost(), substr($driver->getFile(), 1), $driver->getUserName(), $driver->getPassword()); } else { die("no driver found ... "); } // should throw an exception } }
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.sql.interface.IResultSet'); JPHP::import('jphp.sql.ResultMeta'); class ResultSet extends IResultSet { var $resultset = NULL; var $statement = NULL; function ResultSet(&$resultset, &$statement) { if (isset($resultset) && isset($statement)) { $this->resultset =& $resultset; $this->statement =& $statement; } } function &getStatement() { return $this->statement; } function getCurrentResult() {
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.http.HttpContext'); class HttpServletContext extends HttpContext { var $context = NULL; function HttpServletContext(&$servletcontext) { parent::HttpContext(); if (ServletContext::validClass($servletcontext)) { $this->context =& $servletcontext; } } function &getServletContext() { return $this->context; } }
<?php /*----------------------------------------------------------------------*\ * Calendar class demo * \*----------------------------------------------------------------------*/ require_once '../_include.php'; JPHP::import('jphp.http.HttpRequest'); JPHP::import('jphp.util.MultiConfigLoader'); $request = new HttpRequest(); $source = (bool) $request->getParameter('source'); ?> <style type='text/css'> <!-- FONT,TD { font-family: Verdana; font-size: 11px} TD.name { background-color: #ffffff; color: #00000 } TD.value { background-color: #ffffff; color: #ff3300; font-weight: bold; width: 80px;} //--> </style> <table cellspacing=1 cellpadding=4 border=0 width='760' bgcolor=#ececec> <tr> <td bgcolor=#ffffff> <strong>jphp://jphp.demo/MultiConfigLoader/<a href="<?php echo $request->getRequestPath(), $source ? '">display demo</a>' : '?source=TRUE">show-source</a>'; ?> </strong></font> </td> </tr> <tr> <td bgcolor=#ffffff> <br> <br>
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.http.HttpRequest'); class HttpServletRequest extends HttpRequest { var $context = NULL; function HttpServletRequest(&$servletcontext) { parent::HttpRequest(); if (ServletContext::validClass($servletcontext)) { $this->context =& $servletcontext; } } function &getServletContext() { return $this->context; } function &createSession($create = TRUE) { if (ServletContext::validClass($this->context)) { $response =& $this->context->getServletResponse();
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.io.FilterWriter'); JPHP::import('jphp.io.StandardWriter'); class PrintWriter extends FilterWriter { function PrintWriter(&$writer) { parent::FilterWriter($writer); } function standardWriter() { return new PrintWriter(new StandardWriter()); } function validClass($object) { return Object::validClass($object, 'printstream'); } }
<?php /*----------------------------------------------------------------------*\ * Calendar class demo * \*----------------------------------------------------------------------*/ require_once '../_include.php'; JPHP::import('jphp.http.HttpRequest'); JPHP::import('jphp.io.StringReader'); JPHP::import('jphp.xml.dom.*'); $request = new HttpRequest(); $source = (bool) $request->getParameter('source'); ?> <style type='text/css'> <!-- FONT,TD { font-family: Verdana; font-size: 11px} TD.name { background-color: #ffffff; color: #00000 } TD.value { background-color: #ffffff; color: #ff3300; font-weight: bold; width: 80px;} //--> </style> <table cellspacing=1 cellpadding=4 border=0 width='760' bgcolor=#ececec> <tr> <td bgcolor=#ffffff> <strong>jphp://jphp.demo/XMLTreeReader/<a href="<?php echo $request->getRequestPath(), $source ? '">display demo</a>' : '?source=TRUE">show-source</a>'; ?> </strong></font> </td> </tr> <tr> <td bgcolor=#ffffff> <br>
<?php /*----------------------------------------------------------------------*\ * Calendar class demo * \*----------------------------------------------------------------------*/ require_once '../_include.php'; JPHP::import('jphp.http.HttpRequest'); JPHP::import('jphp.io.FileReader'); JPHP::import('jphp.http.servlet.ServletXMLConfigReader'); $request = new HttpRequest(); $source = (bool) $request->getParameter('source'); ?> <style type='text/css'> <!-- FONT,TD { font-family: Verdana; font-size: 11px} TD.name { background-color: #ffffff; color: #00000 } TD.value { background-color: #ffffff; color: #ff3300; font-weight: bold; width: 80px;} //--> </style> <table cellspacing=1 cellpadding=4 border=0 width='760' bgcolor=#ececec> <tr> <td bgcolor=#ffffff> <strong>jphp://jphp.demo/ServletXMLConfigReader/<a href="<?php echo $request->getRequestPath(), $source ? '">display demo</a>' : '?source=TRUE">show-source</a>'; ?> </strong></font> </td> </tr> <tr> <td bgcolor=#ffffff> <br>
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.sql.interface.IStatement'); JPHP::import('jphp.sql.ResultSet'); class Statement extends IStatement { var $statement = NULL; var $connection = NULL; function Statement(&$statement, &$connection) { if (isset($statement) && isset($connection)) { $this->statement =& $statement; $this->connection =& $connection; } } function &getCurrentConnection() { return $this->connection; } function addBatch($query) {
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.net.URL'); JPHP::import('jphp.util.Enumeration'); JPHP::import('jphp.util.Arrays'); class ServletConfig extends Object { var $displayname = ''; var $datasources = NULL; var $contexts = NULL; var $sessions = NULL; var $request = NULL; var $response = NULL; var $securities = NULL; var $logins = NULL; function ServletConfig() { $this->datasources = array(); $this->contexts = array(); $this->sessions = array(); $this->securities = array();
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.http.HttpSession'); class HttpServletSession extends HttpSession { var $context = NULL; function HttpServletSession(&$servletcontext) { parent::HttpSession(); if (ServletContext::validClass($servletcontext)) { $this->context =& $servletcontext; } } function &getServletContext() { return $this->context; } }
<?php /*----------------------------------------------------------------------*\ * Calendar class demo * \*----------------------------------------------------------------------*/ require_once '../_include.php'; JPHP::import('jphp.http.HttpRequest'); JPHP::import('jphp.io.FileReader,jphp.io.FileWriter'); JPHP::import('jphp.io.ObjectReader,jphp.io.ObjectWriter'); $request = new HttpRequest(); $source = (bool) $request->getParameter('source'); ?> <style type='text/css'> <!-- FONT,TD { font-family: Verdana; font-size: 11px} TD.name { background-color: #ffffff; color: #00000 } TD.value { background-color: #ffffff; color: #ff3300; font-weight: bold; width: 80px;} //--> </style> <table cellspacing=1 cellpadding=4 border=0 width='760' bgcolor=#ececec> <tr> <td bgcolor=#ffffff> <strong>jphp://jphp.demo/ObjectReader-ObjectWriter/<a href="<?php echo $request->getRequestPath(), $source ? '">display demo</a>' : '?source=TRUE">show-source</a>'; ?> </strong></font> </td> </tr> <tr> <td bgcolor=#ffffff> <br>
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.datastructure.interface.ILinkListNode'); class IDoubleLinkListNode extends ILinkListNode { function &getPrevious() { } function setPrevious(&$previous_node) { } function isHead() { } function validClass($object) { return Object::validClass($object, 'idoublelinklistnode'); } }
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.util.Comparator'); class Arrays { function swap(&$array, $a, $b) { $object = $array[$a]; $array[$a] = $array[$b]; $array[$b] = $object; } function quickSort(&$array, &$comparator, $head_offset, $tail_offset) { $head = $head_offset; $tail = $tail_offset; $middle = intval(($head + $tail) / 2); $pivot = $array[$middle]; do { while ($comparator->compare($array[$head], $pivot) < 0 && $head < $tail_offset) { $head++; }
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.io.IReader,jphp.io.FileReader'); JPHP::import('jphp.util.Hashtable'); define('CONFIG_COMMENT', '#'); define('CONFIG_SEPARATOR', '='); define('CONFIG_END_KEY', "\n"); class ConfigLoader extends Hashtable { var $reader = NULL; function ConfigLoader($reader) { if (IReader::validClass($reader)) { $this->reader =& $reader; } else { $this->reader =& new FileReader($reader); } } function loadFromFile() { $configname = new StringBuffer();
* The latest version can be obtained from: * http://www.jphplib.org */ define('XML_ELEMENT', 1); define('XML_ATTRIBUTE', 2); define('XML_TEXT', 3); define('XML_CDATA', 4); define('XML_ENTITY_REFERENCE', 5); define('XML_ENTITY', 6); define('XML_PROCESSING_INSTRUCTION', 7); define('XML_COMMENT', 8); define('XML_DOCUMENT', 9); define('XML_DOCUMENT_TYPe', 10); define('XML_DOCUMENT_FRAGMENT', 11); define('XML_NOTATION', 12); JPHP::import('jphp.datastructure.interface.ITreeNode'); class XMLNode extends ITreeNode { var $node_name = NULL; var $node_type = NULL; var $node_value = NULL; var $node_level = 0; // parent reference var $parent_node = NULL; // child, previous and next brother var $child = NULL; var $sibling = NULL; var $previous_sibling = NULL; var $attributes = NULL; var $document = NULL; function XMLNode()
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.io.File'); class UploadFile extends File { var $upload_name = NULL; var $upload_type = NULL; var $upload_size = NULL; function UploadFile($name, $type, $size, $tmpfile) { parent::File($tmpfile); $this->setUploadFileType($type); $this->setUploadFileName($name); $this->setUploadFileSize($size); } function setUploadFileName($name) { $name = StringBuffer::toStringBuffer($name); $this->upload_name = $name; } function getUploadFileName()
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.http.interface.IHttpContext'); JPHP::import('jphp.util.Enumeration,jphp.util.StringBuffer'); class HttpContext extends IHttpContext { var $path = ''; var $name = ''; function HttpContext($path = '', $name = '') { $this->path = $path; $this->name = $name; } /** * return the name of the current context * @return core.StringBuffer the context name */ function getContextName() { return $this->name; }
<?php /*----------------------------------------------------------------------*\ * Calendar class demo * \*----------------------------------------------------------------------*/ require_once '../_include.php'; JPHP::import('jphp.http.HttpRequest'); JPHP::import('jphp.io.FileReader'); JPHP::import('jphp.http.servlet.*'); $request = new HttpRequest(); $source = (bool) $request->getParameter('source'); $context =& new ServletContext('web.xml'); $request =& $context->getServletRequest(); $session =& $request->createSession(); $data =& $context->getServletConfig(); ?> <style type='text/css'> <!-- FONT,TD { font-family: Verdana; font-size: 11px} TD.name { background-color: #ffffff; color: #00000 } TD.value { background-color: #ffffff; color: #ff3300; font-weight: bold; width: 80px;} //--> </style> <table cellspacing=1 cellpadding=4 border=0 width='760' bgcolor=#ececec> <tr> <td bgcolor=#ffffff> <strong>jphp://jphp.demo/<a href="<?php echo $request->getRequestPath(); ?> ">ServletXMLConfigReader</a>/<a href="<?php
<?php /*----------------------------------------------------------------------*\ * Calendar class demo * \*----------------------------------------------------------------------*/ require_once '../_include.php'; JPHP::import('jphp.http.HttpRequest'); JPHP::import('jphp.util.Calendar'); JPHP::import('jphp.util.Date'); JPHP::import('jphp.util.LocaleZone'); $request = new HttpRequest(); $cal = new Calendar(); $source = (bool) $request->getParameter('source'); ?> <style type='text/css'> <!-- FONT,TD { font-family: Verdana; font-size: 11px} TD.name { background-color: #ffffff; color: #00000 } TD.value { background-color: #ffffff; color: #ff3300; font-weight: bold; width: 80px;} //--> </style> <table cellspacing=1 cellpadding=4 border=0 width='760' bgcolor=#ececec> <tr> <td bgcolor=#ffffff> <strong>jphp://jphp.demo/Calendar/<a href="<?php echo $request->getRequestPath(), $source ? '">display demo</a>' : '?source=TRUE">show-source</a>'; ?> </strong></font> </td> </tr> <tr>
<?php /*----------------------------------------------------------------------*\ * Calendar class demo * \*----------------------------------------------------------------------*/ require_once '../_include.php'; JPHP::import('jphp.http.HttpRequest'); JPHP::import('jphp.util.ConfigLoader'); $request = new HttpRequest(); $source = (bool) $request->getParameter('source'); ?> <style type='text/css'> <!-- FONT,TD { font-family: Verdana; font-size: 11px} TD.name { background-color: #ffffff; color: #00000 } TD.value { background-color: #ffffff; color: #ff3300; font-weight: bold; width: 80px;} //--> </style> <table cellspacing=1 cellpadding=4 border=0 width='760' bgcolor=#ececec> <tr> <td bgcolor=#ffffff> <strong>jphp://jphp.demo/ConfigLoader.File/<a href="<?php echo $request->getRequestPath(), $source ? '">display demo</a>' : '?source=TRUE">show-source</a>'; ?> </strong></font> </td> </tr> <tr> <td bgcolor=#ffffff> <br> <?php
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.util.Date,jphp.util.StringBuffer,jphp.util.Date,jphp.util.LocaleZone'); class Calendar extends Object { var $dateobj = NULL; var $locale = NULL; function Calendar($dateobj = '', $locale = '') { if (!LocaleZone::validClass($locale)) { $locale = new LocaleZone(); $locale = $locale->getDefaultZone(); } $this->locale = $locale; if (Date::validClass($dateobj)) { $this->dateobj = $dateobj; } else { $this->dateobj = new Date($dateobj); } } function setDate($year = '', $month = '', $day = '', $hour = '', $min = '', $sec = '')
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.io.IReader'); class FilterReader extends IReader { var $reader = NULL; function FilterReader($reader) { if (IReader::validClass($reader)) { $this->reader =& $reader; } } function read() { return $this->reader->read(); } function ready() { return $this->reader->ready(); } function close()
<?php /*----------------------------------------------------------------------*\ * Calendar class demo * \*----------------------------------------------------------------------*/ require_once '../_include.php'; JPHP::import('jphp.http.HttpRequest'); JPHP::import('jphp.io.FileReader'); $request = new HttpRequest(); $source = (bool) $request->getParameter('source'); ?> <style type='text/css'> <!-- FONT,TD { font-family: Verdana; font-size: 11px} TD.name { background-color: #ffffff; color: #00000 } TD.value { background-color: #ffffff; color: #ff3300; font-weight: bold; width: 80px;} //--> </style> <table cellspacing=1 cellpadding=4 border=0 width='760' bgcolor=#ececec> <tr> <td bgcolor=#ffffff> <strong>jphp://jphp.demo/FileReader/<a href="<?php echo $request->getRequestPath(), $source ? '">display demo</a>' : '?source=TRUE">show-source</a>'; ?> </strong></font> </td> </tr> <tr> <td bgcolor=#ffffff> <br> <br>
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.http.HttpResponse'); class HttpServletResponse extends HttpResponse { var $context = NULL; function HttpServletResponse(&$servletcontext) { parent::HttpResponse(); if (ServletContext::validClass($servletcontext)) { $this->context =& $servletcontext; } } function &getServletContext() { return $this->context; } }
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.io.FilterWriter'); JPHP::import('jphp.util.ObjectSerializer'); class ObjectWriter extends FilterWriter { function ObjectWriter(&$writer) { parent::FilterWriter($writer); } function writeObject($object) { if (isset($object)) { $serialized = ObjectSerializer::save($object); $len = strlen($serialized); $data = 'obj[' . $len . '][' . $serialized . ']'; $this->write($data); } } function validClass($object) {
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.util.StringBuffer'); class File extends Object { var $path = NULL; var $separator = NULL; var $os = NULL; function File($path = NULL) { $this->separator = DIRECTORY_SEPARATOR; $this->os = getenv('OS'); $this->setFilePath($path); } function setFilePath($path) { if (File::validClass($path)) { $this->path = $path->getFilePath(); } else { $this->path = StringBuffer::validClass($path) ? $path->toString() : $path; }
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import("jphp.util.Dictionary"); JPHP::import("jphp.util.Enumeration"); class Hashtable extends Dictionary { var $entries = array(); function Hashtable() { $this->entries = array(); } /** * * @param string|core.StringBuffer * @param primitive|object * @access public */ function put($key, $object) { $this->set($key, $object); }
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.sql.interface.IResultMeta'); class ResultMeta extends IResultMeta { var $resultmeta = NULL; var $resultset = NULL; function ResultMeta(&$resultmeta, &$resultset) { if (isset($resultmeta) && isset($resultset)) { $this->resultmeta =& $resultmeta; $this->resultset =& $resultset; } } function &getResultSet() { return $this->resultset; } function countFields() { $this->resultmeta->countField();
<?php /** * @version 2.0 * @author Nicolas BUI <*****@*****.**> * * This source file is part of JPHP Library Project. * Copyright: 2002 Vitry sur Seine/FRANCE * * The latest version can be obtained from: * http://www.jphplib.org */ JPHP::import('jphp.xml.AbstractSAXParser'); JPHP::import('jphp.io.IReader'); JPHP::import('jphp.http.servlet.ServletConfig'); class ServletXMLConfigReader extends AbstractSAXParser { var $reader = NULL; var $config = NULL; var $level = 0; var $accept = FALSE; var $stack = NULL; var $text = ''; var $current_dbc_id = ''; var $current_dbc_profile = ''; var $current_login_profile = ''; var $context_param_name = ''; var $context_param_value = ''; var $context_class_property = ''; var $session_class_property = ''; var $request_class_property = '';