Permalink
Browse files

Merge branch 'master' into paypal-rework

  • Loading branch information...
M4LuZ committed Jun 8, 2018
2 parents 6e620a9 + d464ca5 commit 10ee400df6908e2d89f388e48c556fc3af1ab9ab
@@ -19,7 +19,8 @@
"smarty/smarty": "^3.1",
"geshi/geshi": "^1.0.9",
"setasign/fpdf": "^1.8",
"paypal/rest-api-sdk-php": "^1.13"
"paypal/rest-api-sdk-php": "^1.13",
"symfony/debug": "^3.4"
},
"require-dev": {
"phpunit/phpunit": "^6.5",

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -1,6 +1,7 @@
<?php
namespace LanSuite;
use LanSuite\AzDGCrypt;
/**
@@ -18,9 +18,7 @@
* $debug = new \LanSuite\Debug(1);
* $debug->tracker("BEFOREINCLUDE"); // Set Timerpoint
* $debug->addvar('$cfg Serverconfig',$cfg); // Add an Debugvar (Arrays posible)
* $debug->timer_start('function sortarray');
* $array = sortarray($array)
* $debug->timer_stop('function sortarray');
* echo $sys_debug->show(); // Show() generates simple HTML-Output
*
* @todo Add percentual display for Tracker/Timer
@@ -84,7 +82,13 @@ class Debug
private $sql_query_list = [];
/**
* debug constructor.
* @var bool
*/
private $sql_query_running = false;
/**
* Debug constructor.
*
* @param string $mode 0 = off, 1 = normal, 2 = file
* @param string $debug_path Path for filedebug
*/
@@ -167,6 +171,35 @@ public function addvar($key, $value)
}
}
/**
* Start Timer for Querys.
* Always use with query_stop()
*
* @param string $query Executed query string
* @return void
*/
public function query_start($query){
if (($this->mode > 0) && (!$this->sql_query_running)) {
$this->sql_query_running = true;
$this->sql_query_start = microtime(true);
$this->sql_query_string = $query;
}
}
/**
* @param string $error
* @return void
*/
public function query_stop($error = null){
if (($this->mode > 0) && ($this->sql_query_running)) {
$this->sql_query_running = false;
$sql_query_end = microtime(true);
$this->sql_query_list[] = [
round(($sql_query_end - $this->sql_query_start) * 1000, 4), $this->sql_query_string, $error
];
}
}
/**
* Generate and sort querylist
*
@@ -199,16 +232,16 @@ private function query_fetchlist()
*/
private function sort_array_by_col($array)
{
function compare($wert_a, $wert_b)
$compare = function ($wert_a, $wert_b)
{
$a = $wert_a[0];
$b = $wert_b[0];
if ($a == $b) {
return 0;
}
return ($a > $b) ? -1 : +1;
}
usort($array, 'compare');
};
usort($array, $compare);
return $array;
}
@@ -1221,7 +1221,7 @@ public function FetchSpanButton($title, $link, $hint = null, $target = null)
* @throws \Exception
* @throws \SmartyException
*/
public function FetchIcon($picname, $link, $hint = null, $target = null, $align = 'left')
public function FetchIcon($picname, $link = '', $hint = null, $target = null, $align = 'left')
{
global $smarty;
@@ -2,6 +2,8 @@
// Composer autoloading
require __DIR__ . '/vendor/autoload.php';
use Symfony\Component\Debug\Debug;
// Set error_reporting.
// It is set to this value on purpose, because otherwise
// LanSuite might not work properly anymore.
@@ -14,7 +16,15 @@
ini_set('url_rewriter.tags', '');
}
function myErrorHandler($errno, $errstr, $errfile, $errline) {
/**
* @param int $errno
* @param string $errstr
* @param string $errfile
* @param int $errline
* @return bool
*/
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
global $PHPErrors, $PHPErrorsFound, $db, $auth;
// Only show errors, which sould be reported according to error_reporting
@@ -97,7 +107,8 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
// Write to DB-Log
if (isset($db) and $db->success) {
$db->qry('
$db->qry(
'
INSERT INTO %prefix%log
SET date = NOW(),
userid = %int%,
@@ -112,9 +123,47 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
return true;
}
$PHPErrorsFound = 0;
$PHPErrors = '';
set_error_handler("myErrorHandler");
// Read Config and Definitionfiles
// Load Basic Config
if (file_exists('inc/base/config.php')) {
$config = parse_ini_file('inc/base/config.php', 1);
// Default config. Will be used only until the wizard has created the config file
} else {
$config = [];
$config['lansuite']['version'] = 'Nightly';
$config['lansuite']['default_design'] = 'simple';
$config['lansuite']['chmod_dir'] = '777';
$config['lansuite']['chmod_file'] = '666';
$config['lansuite']['debugmode'] = '0';
$config['database']['server'] = 'localhost';
$config['database']['user'] = 'root';
$config['database']['passwd'] = '';
$config['database']['database'] = 'lansuite';
$config['database']['prefix'] = 'ls_';
$config['database']['charset'] = 'utf8';
$config['environment']['configured'] = 0;
}
// If the debug mode is disabled, we launch the original error handler.
// The original error handler shows PHP Warnings in a typical red box
if (!$config['lansuite']['debugmode']) {
$PHPErrorsFound = 0;
set_error_handler("myErrorHandler");
// If the debug mode is enabled, we register the Symonfy/Debug component.
// This component shows the error in a nice stack trace.
// More information here: https://symfony.com/components/Debug
} elseif ($config['lansuite']['debugmode'] > 0) {
// TODO Once LanSuite is notice free, we set the $errorReportingLevel back to E_ALL
$errorReportingLevel = E_ALL & ~E_NOTICE;
Debug::enable($errorReportingLevel);
}
// Start session-management
session_start();
@@ -154,7 +203,6 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
foreach ($_GET as $key => $val) {
if (!is_array($_GET[$key])) {
$_GET[$key] = $func->NoHTML($_GET[$key], 1);
} else {
foreach ($_GET[$key] as $key2 => $val2) {
if (!is_array($_GET[$key][$key2])) {
@@ -198,38 +246,13 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
}
}
// Read Config and Definitionfiles
// Load Basic Config
if (file_exists('inc/base/config.php')) {
$config = parse_ini_file('inc/base/config.php', 1);
// Default config. Will be used only until the wizard has created the config file
} else {
$config = [];
$config['lansuite']['version'] = 'Nightly';
$config['lansuite']['default_design'] = 'simple';
$config['lansuite']['chmod_dir'] = '777';
$config['lansuite']['chmod_file'] = '666';
$config['lansuite']['debugmode'] = '0';
$config['database']['server'] = 'localhost';
$config['database']['user'] = 'root';
$config['database']['passwd'] = '';
$config['database']['database'] = 'lansuite';
$config['database']['prefix'] = 'ls_';
$config['database']['charset'] = 'utf8';
$config['environment']['configured'] = 0;
}
// Read definition file
include_once('inc/base/define.php');
// Include and Initialize base classes
$lang = [];
// Debug initialisieren
// Initialize debug mode
if ($config['lansuite']['debugmode'] > 0) {
$debug = new \LanSuite\Debug($config['lansuite']['debugmode']);
}
@@ -292,7 +315,6 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
if ($_GET["action"] == "wizard" && isset($_GET["step"]) && $_GET["step"] > 3) {
$cfg = $func->read_db_config();
}
} else {
// Normal auth cycle and Database-init
$db->connect(0);
@@ -5,11 +5,11 @@
// Execute install.php only if dependencies are met
$preCheckResult = dependencyPreCheck();
if ($preCheckResult){
// Issue(s) found, show text to user
echo $preCheckResult;
if ($preCheckResult) {
// Issue(s) found, show text to user
echo $preCheckResult;
} else {
// No issues found, continue execution
$_GET["mod"] = "install";
include_once("index.php");
// No issues found, continue execution
$_GET["mod"] = "install";
include_once("index.php");
}
@@ -50,9 +50,10 @@ public function __construct($id = null)
private function read()
{
global $db;
if ($this->cat_id != null) {
$row = $db->qry_first("SELECT * FROM %prefix%food_cat WHERE cat_id=%int%", $this->cat_id);
if ($db->num_rows($row) > 0) {
if (is_array($row)) {
$this->name = $row['name'];
return true;
} else {
@@ -119,7 +119,7 @@ private function read()
if ($this->supp_id != null) {
$row = $db->qry_first("SELECT * FROM %prefix%food_supp WHERE supp_id=%int%", $this->supp_id);
if ($db->num_rows($row) > 0) {
if (is_array($row)) {
$this->supp_caption = $row['name'];
$this->supp_desc = $row['s_desc'];
return true;
@@ -75,7 +75,12 @@
$xml_file = fopen($file, "r");
$xml_content = fread($xml_file, filesize($file));
if ($xml_content != "") {
($config['lansuite']['default_design'] == $akt_design) ? $selected = "selected" : $selected = "";
if ($config['lansuite']['default_design'] == $akt_design) {
$selected = 'selected';
} else {
$selected = '';
}
$xml = new \LanSuite\XML();
array_push($t_array, "<option $selected value=\"$akt_design\">". $xml->get_tag_content("name", $xml_content) ."</option>");
}
fclose($xml_file);
@@ -32,8 +32,8 @@
md5($_POST["password"]),
$_POST["email"]
);
} // If not found, insert
else {
// If not found, insert
} else {
$db->qry(
"INSERT INTO %prefix%user SET username = 'ADMIN', firstname = 'ADMIN', name = 'ADMIN', email=%string%, password = %string%, type = '3'",
$_POST["email"],
Oops, something went wrong.

0 comments on commit 10ee400

Please sign in to comment.