Move function out of the class, as they should be global
This commit is contained in:
parent
1a4cd29203
commit
436bfd0c36
3 changed files with 48 additions and 55 deletions
|
@ -1,19 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
error_reporting(E_ERROR | E_PARSE);
|
|
||||||
set_error_handler('err_callback');
|
|
||||||
|
|
||||||
// For error handling, buffer all output
|
|
||||||
ob_start('ob_callback_r2login');
|
|
||||||
|
|
||||||
include_once '../config.php';
|
|
||||||
include_once '../login_translations.php';
|
|
||||||
include_once '../../tools/nel_message.php';
|
|
||||||
include_once '../../tools/domain_info.php';
|
|
||||||
include_once '../login_service_itf.php';
|
|
||||||
include_once '../../ring/join_shard.php';
|
|
||||||
include_once './CWwwLog.php';
|
|
||||||
include_once './LoginCb.php';
|
include_once './LoginCb.php';
|
||||||
|
include_once './../tools/utils.php';
|
||||||
|
include_once './../config.php';
|
||||||
|
include_once './../login_translations.php';
|
||||||
|
include_once './../login_service_itf.php';
|
||||||
|
include_once './../../ring/join_shard.php';
|
||||||
|
include_once './../../tools/nel_message.php';
|
||||||
|
include_once './../../tools/domain_info.php';
|
||||||
|
|
||||||
class ConnectionHandler
|
class ConnectionHandler
|
||||||
{
|
{
|
||||||
|
@ -238,35 +231,6 @@ class ConnectionHandler
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public function errorMsgBlock($errNum = GENERIC_ERROR_NUM)
|
|
||||||
{
|
|
||||||
return '0:' . call_user_func_array('errorMsg', func_get_args());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback called on end of output buffering
|
|
||||||
*/
|
|
||||||
public function ob_callback_r2login($buffer)
|
|
||||||
{
|
|
||||||
// Log only in case of error or malformed result string
|
|
||||||
$blockHd = substr($buffer, 0, 2);
|
|
||||||
if ($blockHd != '1:') {
|
|
||||||
$logFile = new CWwwLog();
|
|
||||||
$logFile->logStr(str_replace("\n", '\n', $buffer));
|
|
||||||
}
|
|
||||||
return $buffer; // sent to output
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback called on error
|
|
||||||
*/
|
|
||||||
public function err_callback($errno, $errmsg, $filename, $linenum, $vars)
|
|
||||||
{
|
|
||||||
$logFile = new CWwwLog();
|
|
||||||
$logFile->logStr('PHP ERROR/$errno $errmsg ($filename:$linenum)');
|
|
||||||
$logFile->logStr('PHP CALLSTACK/' . print_r(debug_backtrace(), true));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string
|
* @param string
|
||||||
* the password to extract the salt from.
|
* the password to extract the salt from.
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
error_reporting(E_ERROR | E_PARSE);
|
include_once './tools/utils.php';
|
||||||
set_error_handler('err_callback');
|
|
||||||
|
|
||||||
// For error handling, buffer all output
|
|
||||||
ob_start('ob_callback_r2login');
|
|
||||||
|
|
||||||
include_once 'config.php';
|
|
||||||
include_once 'login_translations.php';
|
|
||||||
include_once '../tools/nel_message.php';
|
|
||||||
include_once '../tools/domain_info.php';
|
|
||||||
include_once 'login_service_itf.php';
|
|
||||||
include_once '../ring/join_shard.php';
|
|
||||||
include_once './class/connection_handler.php';
|
include_once './class/connection_handler.php';
|
||||||
include_once './class/nel_command.php';
|
include_once './class/nel_command.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there is no command, no point in going further.
|
||||||
|
*/
|
||||||
if (!isset($_GET['cmd'])) {
|
if (!isset($_GET['cmd'])) {
|
||||||
die(errorMsgBlock(3002));
|
die(errorMsgBlock(3002));
|
||||||
}
|
}
|
||||||
|
|
37
code/web/public_php/login/tools/utils.php
Normal file
37
code/web/public_php/login/tools/utils.php
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
include_once './../class/CWwwLog.php';
|
||||||
|
|
||||||
|
error_reporting(E_ERROR | E_PARSE);
|
||||||
|
set_error_handler('err_callback');
|
||||||
|
|
||||||
|
// For error handling, buffer all output
|
||||||
|
ob_start('ob_callback_r2login');
|
||||||
|
|
||||||
|
function errorMsgBlock($errNum = GENERIC_ERROR_NUM)
|
||||||
|
{
|
||||||
|
return '0:' . call_user_func_array('errorMsg', func_get_args());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback called on end of output buffering
|
||||||
|
*/
|
||||||
|
function ob_callback_r2login($buffer)
|
||||||
|
{
|
||||||
|
// Log only in case of error or malformed result string
|
||||||
|
$blockHd = substr($buffer, 0, 2);
|
||||||
|
if ($blockHd != '1:') {
|
||||||
|
$logFile = new CWwwLog();
|
||||||
|
$logFile->logStr(str_replace("\n", '\n', $buffer));
|
||||||
|
}
|
||||||
|
return $buffer; // sent to output
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback called on error
|
||||||
|
*/
|
||||||
|
function err_callback($errno, $errmsg, $filename, $linenum, $vars)
|
||||||
|
{
|
||||||
|
$logFile = new CWwwLog();
|
||||||
|
$logFile->logStr('PHP ERROR/$errno $errmsg ($filename:$linenum)');
|
||||||
|
$logFile->logStr('PHP CALLSTACK/' . print_r(debug_backtrace(), true));
|
||||||
|
}
|
Loading…
Reference in a new issue