class Env
{
- // {{{ function _get
+ // {{{ public static function _get
- function _get($key, $default)
+ public static function _get($key, $default)
{
return isset($_REQUEST[$key]) ? $_REQUEST[$key] : $default;
}
// }}}
- // {{{ function has
+ // {{{ public static function has
- function has($key)
+ public static function has($key)
{
return isset($_REQUEST[$key]);
}
// }}}
- // {{{ function kill
+ // {{{ public static function kill
- function kill($key)
+ public static function kill($key)
{
unset($_REQUEST[$key]);
}
// }}}
- // {{{ function v
+ // {{{ public static function v
- function v($key, $default = null)
+ public static function v($key, $default = null)
{
return Env::_get($key, $default);
}
// }}}
- // {{{ function b
+ // {{{ public static function b
- function b($key, $default = false)
+ public static function b($key, $default = false)
{
return (bool)Env::_get($key, $default);
}
// }}}
- // {{{ function i
+ // {{{ public static function i
- function i($key, $default = 0)
+ public static function i($key, $default = 0)
{
$i = Env::_get($key, $default);
return is_numeric($i) ? intval($i) : $default;
class Post
{
- // {{{ function _get
+ // {{{ public static function _get
- function _get($key, $default)
+ public static function _get($key, $default)
{
return isset($_POST[$key]) ? $_POST[$key] : $default;
}
// }}}
- // {{{ function has
+ // {{{ public static function has
- function has($key)
+ public static function has($key)
{
return isset($_POST[$key]);
}
// }}}
- // {{{ function kill
+ // {{{ public static function kill
- function kill($key)
+ public static function kill($key)
{
unset($_POST[$key]);
}
// }}}
- // {{{ function v
+ // {{{ public static function v
- function v($key, $default = null)
+ public static function v($key, $default = null)
{
return Post::_get($key, $default);
}
// }}}
- // {{{ function b
+ // {{{ public static function b
- function b($key, $default = false)
+ public static function b($key, $default = false)
{
return (bool)Post::_get($key, $default);
}
// }}}
- // {{{ function i
+ // {{{ public static function i
- function i($key, $default = 0)
+ public static function i($key, $default = 0)
{
$i = Post::_get($key, $default);
return is_numeric($i) ? intval($i) : $default;
class Get
{
- // {{{ function _get
+ // {{{ public static function _get
- function _get($key, $default)
+ public static function _get($key, $default)
{
return isset($_GET[$key]) ? $_GET[$key] : $default;
}
// }}}
- // {{{ function has
+ // {{{ public static function has
- function has($key)
+ public static function has($key)
{
return isset($_GET[$key]);
}
// }}}
- // {{{ function kill
+ // {{{ public static function kill
- function kill($key)
+ public static function kill($key)
{
unset($_GET[$key]);
}
// }}}
- // {{{ function v
+ // {{{ public static function v
- function v($key, $default = null)
+ public static function v($key, $default = null)
{
return Get::_get($key, $default);
}
// }}}
- // {{{ function b
+ // {{{ public static function b
- function b($key, $default = false)
+ public static function b($key, $default = false)
{
return (bool)Get::_get($key, $default);
}
// }}}
- // {{{ function i
+ // {{{ public static function i
- function i($key, $default = 0)
+ public static function i($key, $default = 0)
{
$i = Get::_get($key, $default);
return is_numeric($i) ? intval($i) : $default;
class Cookie
{
- // {{{ function _get
+ // {{{ public static function _get
- function _get($key, $default)
+ public static function _get($key, $default)
{
return isset($_COOKIE[$key]) ? $_COOKIE[$key] : $default;
}
// }}}
- // {{{ function has
+ // {{{ public static function has
- function has($key)
+ public static function has($key)
{
return isset($_COOKIE[$key]);
}
// }}}
- // {{{ function kill
+ // {{{ public static function kill
- function kill($key)
+ public static function kill($key)
{
unset($_COOKIE[$key]);
}
// }}}
- // {{{ function v
+ // {{{ public static function v
- function v($key, $default = null)
+ public static function v($key, $default = null)
{
return Cookie::_get($key, $default);
}
// }}}
- // {{{ function b
+ // {{{ public static function b
- function b($key, $default = false)
+ public static function b($key, $default = false)
{
return (bool)Cookie::_get($key, $default);
}
// }}}
- // {{{ function i
+ // {{{ public static function i
- function i($key, $default = 0)
+ public static function i($key, $default = 0)
{
$i = Cookie::_get($key, $default);
return is_numeric($i) ? intval($i) : $default;
session_write_close();
- $this->assign("xorg_errors", $this->_errors);
- $this->assign("xorg_failure", $this->_failure);
+ $this->assign('xorg_errors', $this->_errors);
+ $this->assign('xorg_failure', $this->_failure);
$this->assign('globals', $globals);
switch ($this->_page_type) {
case NO_SKIN:
+ error_reporting(0);
$this->display($this->_tpl);
exit;
}
if (!$globals->debug) {
+ error_reporting(0);
$this->display($skin);
exit;
}
}
$this->assign('validate', true);
+ error_reporting(0);
$result = $this->fetch($skin);
- $ttime .= sprintf('Temps total: %.02fs<br />', microtime_float() - $TIME_BEGIN);
+ $ttime = sprintf('Temps total: %.02fs<br />', microtime_float() - $TIME_BEGIN);
$replc = "<span class='erreur'>VALIDATION HTML INACTIVE</span><br />";
if ($globals->debug & 2) {
/* static functions */
- function factory($modname)
+ public static function factory($modname)
{
$mod_path = dirname(__FILE__).'/../modules/'.strtolower($modname).'.php';
$class = ucfirst($modname).'Module';
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-class S extends Session { }
+class S extends Session {
+}
?>
class Session
{
- function init()
+ public static function init()
{
@session_start();
if (empty($_SESSION['challenge'])) {
}
}
- function destroy()
+ public static function destroy()
{
@session_destroy();
unset($_SESSION);
}
-
-
- function has($key)
+ public static function has($key)
{
return isset($_SESSION[$key]);
}
- function kill($key)
+ public static function kill($key)
{
unset($_SESSION[$key]);
}
- function v($key, $default = null)
+ public static function v($key, $default = null)
{
return isset($_SESSION[$key]) ? $_SESSION[$key] : $default;
}
- function i($key, $default = 0)
+ public static function i($key, $default = 0)
{
$i = Session::v($key, $default);
return is_numeric($i) ? intval($i) : $default;
}
- function has_perms()
+ public static function has_perms()
{
return Session::logged() && Session::v('perms') == PERMS_ADMIN;
}
- function logged()
+ public static function logged()
{
return Session::v('auth', AUTH_PUBLIC) >= AUTH_COOKIE;
}
- function identified()
+ public static function identified()
{
return Session::v('auth', AUTH_PUBLIC) >= AUTH_MDP;
}
{
var $_trace_data = array();
- // {{{ function _prepare
+ // {{{ public static function _prepare
- function _prepare($args) {
+ public static function _prepare($args) {
$query = array_map(Array('XDB', '_db_escape'), $args);
$query[0] = str_replace('{?}', '%s', str_replace('%', '%%', $args[0]));
return call_user_func_array('sprintf', $query);
}
// }}}
- // {{{ function _reformatQuery
+ // {{{ public static function _reformatQuery
- function _reformatQuery($query)
+ public static function _reformatQuery($query)
{
$query = preg_split("/\n\\s*/", $query);
$length = 0;
}
// }}}
- // {{{ function _query
+ // {{{ public static function _query
- function _query($query) {
+ public static function _query($query) {
global $globals;
if ($globals->debug & 1) {
}
// }}}
- // {{{ function query
+ // {{{ public static function query
- function &query()
+ public static function query()
{
return new XOrgDBResult(XDB::_prepare(func_get_args()));
}
// }}}
- // {{{ function execute()
+ // {{{ public static function execute()
- function execute()
+ public static function execute()
{
return XDB::_query(XDB::_prepare(func_get_args()));
}
// }}}
- // {{{ function iterator()
+ // {{{ public static function iterator()
- function &iterator()
+ public static function iterator()
{
return new XOrgDBIterator(XDB::_prepare(func_get_args()));
}
// }}}
- // {{{ function iterRow()
+ // {{{ public static function iterRow()
- function &iterRow()
+ public static function iterRow()
{
return new XOrgDBIterator(XDB::_prepare(func_get_args()), MYSQL_NUM);
}
// }}}
- // {{{ function insertId()
+ // {{{ public static function insertId()
- function insertId()
+ public static function insertId()
{
return mysql_insert_id();
}
// }}}
- // {{{ function _db_escape
+ // {{{ public static function _db_escape
- function _db_escape($var)
+ public static function _db_escape($var)
{
switch (gettype($var)) {
case 'boolean':
// }}}
- function trace_format(&$page, $template = 'database-debug.tpl') {
- $page->assign('trace_data', $GLOBALS['XDB::trace_data']);
- $page->assign('db_error', $GLOBALS['XDB::error']);
+ public static function trace_format(&$page, $template = 'database-debug.tpl') {
+ $page->assign('trace_data', @$GLOBALS['XDB::trace_data']);
+ $page->assign('db_error', @$GLOBALS['XDB::error']);
return $page->fetch($template);
}
}
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-require_once dirname(__FILE__).'/Platal.php';
-
class Xnet extends Platal
{
function Xnet()
[ choix de classes faites par le skinneur
*******************************************************************************/
+.phperror {
+ color: red;
+ background: white;
+ margin: 2px auto;
+ padding: 4px 2px;
+ border: 1px solid black;
+ width: 80%;
+}
+
#dev {
width: auto;
text-align: center;
define('SIMPLE', 1);
define('NO_SKIN', 2);
-require dirname(dirname(__FILE__)).'/classes/env.php';
-
function __autoload($cls)
{
@include dirname(dirname(__FILE__)).'/classes/'.strtolower($cls).'.php';
}
+__autoload('Env');
+
+function pl_error_handler($errno, $errstr, $errfile, $errline)
+{
+ if (!error_reporting())
+ return;
+
+ $errortype = array (
+ E_ERROR => "Error",
+ E_WARNING => "Warning",
+ E_PARSE => "Parsing Error",
+ E_NOTICE => "Notice",
+ E_CORE_ERROR => "Core Error",
+ E_CORE_WARNING => "Core Warning",
+ E_COMPILE_ERROR => "Compile Error",
+ E_COMPILE_WARNING => "Compile Warning",
+ E_USER_ERROR => "User Error",
+ E_USER_WARNING => "User Warning",
+ E_USER_NOTICE => "User Notice",
+ E_STRICT => "Runtime Notice"
+ );
+
+ $errstr = htmlentities($errstr);
+ $GLOBALS['pl_errors'][] =
+ "<div class='phperror'>".
+ "<strong>{$errortype[$errno]}</strong> <em>$errstr</em><br />".
+ "<tt>$errfile : $errline</tt>".
+ "</div>";
+}
+
+function pl_print_errors()
+{
+ print join("\n", $GLOBALS['pl_errors']);
+}
+
+set_error_handler('pl_error_handler', E_ALL | E_STRICT);
+register_shutdown_function('pl_print_errors');
+
function pl_url($path, $query = null, $fragment = null)
{
{
// {{{ function init
- function init() {
+ public static function init() {
global $globals;
S::init();
}
// }}}
- // {{{ function destroy()
+ // {{{ public static function destroy()
- function destroy() {
+ public static function destroy() {
S::destroy();
XnetSession::init();
}
// }}}
- // {{{ function doAuth()
+ // {{{ public static function doAuth()
/** Try to do an authentication.
*
* @param page the calling page (by reference)
*/
- function doAuth()
+ public static function doAuth()
{
if (S::identified()) { // ok, c'est bon, on n'a rien à faire
return true;
// }}}
// {{{ doAuthCookie
- function doAuthCookie() {
+ public static function doAuthCookie() {
return XnetSession::doAuth();
}
// }}}
// {{{ doAuthX
- function doAuthX() {
+ public static function doAuthX() {
global $globals, $page;
if (md5('1'.S::v('challenge').$globals->xnet->secret.Get::i('uid').'1') != Get::v('auth')) {
class XorgSession
{
- // {{{ function init
+ // {{{ public static function init
- function init() {
+ public static function init() {
S::init();
if (!S::has('uid')) {
try_cookie();
}
// }}}
- // {{{ function destroy()
+ // {{{ public static function destroy()
- function destroy() {
+ public static function destroy() {
S::destroy();
XorgSession::init();
}
// }}}
- // {{{ function doAuth()
+ // {{{ public static function doAuth()
- function doAuth($new_name = false)
+ public static function doAuth($new_name = false)
{
global $globals;
if (S::identified()) { // ok, c'est bon, on n'a rien à faire
}
// }}}
- // {{{ function doAuthCookie()
+ // {{{ public static function doAuthCookie()
/** Try to do a cookie-based authentication.
*
* @param page the calling page (by reference)
*/
- function doAuthCookie()
+ public static function doAuthCookie()
{
if (S::logged()) {
return true;
{
return array(
'payment' => $this->make_hook('payment', AUTH_MDP),
- 'payment/cyber_return' => $this->make_hook('cyber_return', AUTH_PUB),
- 'payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUB),
+ 'payment/cyber_return' => $this->make_hook('cyber_return', AUTH_PUBLIC),
+ 'payment/paypal_return' => $this->make_hook('paypal_return', AUTH_PUBLIC),
'admin/payments' => $this->make_hook('admin', AUTH_MDP, 'admin'),
);
}