fix 'Array Offset on value of type int' PHP 8
Dieser Commit ist enthalten in:
Ursprung
f6f95929dd
Commit
04741dd66f
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* functions.system.php
|
||||
*
|
||||
|
@ -20,8 +21,7 @@
|
|||
* @link http://www.contenido.org
|
||||
* @since file available since contenido release <= 4.6
|
||||
*/
|
||||
|
||||
if(!defined('CON_FRAMEWORK')) {
|
||||
if (!defined('CON_FRAMEWORK')) {
|
||||
die('Illegal call');
|
||||
}
|
||||
|
||||
|
@ -39,19 +39,19 @@ function emptyLogFile() {
|
|||
global $cfg, $notification;
|
||||
$tmp_notification = '';
|
||||
|
||||
if($_GET['log'] == 1) {
|
||||
$sNewLogPath = $cfg['path']['conlite_logs']."errorlog.txt";
|
||||
$sOldLogPath = $cfg['path']['contenido']."logs/errorlog.txt";
|
||||
} else if($_GET['log'] == 2) {
|
||||
$sNewLogPath = $cfg['path']['conlite_logs']."errorlog.txt";
|
||||
$sOldLogPath = $cfg['path']['contenido']."logs/errorlog.txt";
|
||||
if ($_GET['log'] == 1) {
|
||||
$sNewLogPath = $cfg['path']['conlite_logs'] . "errorlog.txt";
|
||||
$sOldLogPath = $cfg['path']['contenido'] . "logs/errorlog.txt";
|
||||
} else if ($_GET['log'] == 2) {
|
||||
$sNewLogPath = $cfg['path']['conlite_logs'] . "errorlog.txt";
|
||||
$sOldLogPath = $cfg['path']['contenido'] . "logs/errorlog.txt";
|
||||
}
|
||||
|
||||
if(file_exists($sNewLogPath) && is_writable($sNewLogPath)) {
|
||||
if (file_exists($sNewLogPath) && is_writable($sNewLogPath)) {
|
||||
$sDelFile = $sNewLogPath;
|
||||
} else if(file_exists($sOldLogPath) && is_writable($sOldLogPath)) {
|
||||
} else if (file_exists($sOldLogPath) && is_writable($sOldLogPath)) {
|
||||
$sDelFile = $sOldLogPath;
|
||||
} else if(file_exists($sNewLogPath) || file_exists($sOldLogPath)) {
|
||||
} else if (file_exists($sNewLogPath) || file_exists($sOldLogPath)) {
|
||||
return $notification->returnNotification("error", i18n("Can't clear install error log : Access is denied!"));
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,7 @@ function emptyLogFile() {
|
|||
* @return string returns phpinfo() HTML output
|
||||
* @author Marco Jahn
|
||||
*/
|
||||
function phpInfoToHtml()
|
||||
{
|
||||
function phpInfoToHtml() {
|
||||
/* get output */
|
||||
ob_start();
|
||||
phpinfo();
|
||||
|
@ -89,45 +88,36 @@ function phpInfoToHtml()
|
|||
* @return boolean wether user has access or not
|
||||
* @author Marco Jahn
|
||||
*/
|
||||
function system_have_perm($client)
|
||||
{
|
||||
function system_have_perm($client) {
|
||||
global $auth;
|
||||
|
||||
if (!isset ($auth->perm['perm']))
|
||||
{
|
||||
if (!isset($auth->perm['perm'])) {
|
||||
$auth->perm['perm'] = '';
|
||||
}
|
||||
|
||||
$userPerm = explode(',', $auth->auth['perm']);
|
||||
|
||||
if (in_array('sysadmin', $userPerm))
|
||||
{ // is user sysadmin ?
|
||||
if (in_array('sysadmin', $userPerm)) { // is user sysadmin ?
|
||||
return true;
|
||||
}
|
||||
elseif (in_array('admin['.$client.']', $userPerm))
|
||||
{ // is user admin for this client ?
|
||||
} elseif (in_array('admin[' . $client . ']', $userPerm)) { // is user admin for this client ?
|
||||
return true;
|
||||
}
|
||||
elseif (in_array('client['.$client.']', $userPerm))
|
||||
{ // has user access to this client ?
|
||||
} elseif (in_array('client[' . $client . ']', $userPerm)) { // has user access to this client ?
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* check for valid ip adress
|
||||
*
|
||||
* @param string ip adress
|
||||
*
|
||||
* @return boolean if string is a valid ip or not
|
||||
*/
|
||||
function isIPv4($strHostAdress)
|
||||
{
|
||||
* check for valid ip adress
|
||||
*
|
||||
* @param string ip adress
|
||||
*
|
||||
* @return boolean if string is a valid ip or not
|
||||
*/
|
||||
function isIPv4($strHostAdress) {
|
||||
// ip pattern needed for validation
|
||||
$ipPattern = "([0-9]|1?\d\d|2[0-4]\d|25[0-5])";
|
||||
if (preg_match("/^$ipPattern\.$ipPattern\.$ipPattern\.$ipPattern?$/", $strHostAdress))
|
||||
{ // ip is valid
|
||||
if (preg_match("/^$ipPattern\.$ipPattern\.$ipPattern\.$ipPattern?$/", $strHostAdress)) { // ip is valid
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -139,64 +129,50 @@ function isIPv4($strHostAdress)
|
|||
* @param string $strBrowserUrl current browser string
|
||||
* @return boolean|string status of path comparement or false
|
||||
*/
|
||||
function checkPathInformation($strConUrl, $strBrowserUrl)
|
||||
{
|
||||
function checkPathInformation($strConUrl, $strBrowserUrl) {
|
||||
// parse url
|
||||
$arrConUrl = parse_url($strConUrl);
|
||||
$arrBrowserUrl = parse_url($strBrowserUrl);
|
||||
|
||||
if($arrConUrl === FALSE || $arrBrowserUrl === FALSE) {
|
||||
if ($arrConUrl === FALSE || $arrBrowserUrl === FALSE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isIPv4($arrConUrl['host']))
|
||||
{ // is
|
||||
if (isIPv4($arrBrowserUrl['host']))
|
||||
{ // is
|
||||
if (compareUrlStrings($arrConUrl, $arrBrowserUrl))
|
||||
{
|
||||
if (isIPv4($arrConUrl['host'])) { // is
|
||||
if (isIPv4($arrBrowserUrl['host'])) { // is
|
||||
if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) {
|
||||
return '1';
|
||||
}
|
||||
|
||||
return '2';
|
||||
} else
|
||||
{ // isn't
|
||||
} else { // isn't
|
||||
$arrBrowserUrl['host'] = gethostbyname($arrBrowserUrl['host']);
|
||||
if (!isIPv4($arrBrowserUrl['host']))
|
||||
{
|
||||
if (!isIPv4($arrBrowserUrl['host'])) {
|
||||
return '3';
|
||||
}
|
||||
|
||||
if (compareUrlStrings($arrConUrl, $arrBrowserUrl))
|
||||
{
|
||||
if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) {
|
||||
return '1';
|
||||
}
|
||||
|
||||
return '2';
|
||||
}
|
||||
} else
|
||||
{ // isn't
|
||||
if (isIPv4($arrBrowserUrl['host']))
|
||||
{ //is
|
||||
} else { // isn't
|
||||
if (isIPv4($arrBrowserUrl['host'])) { //is
|
||||
$tmpAddr = gethostbyaddr($arrBrowserUrl['host']);
|
||||
$arrBrowserUrl['host'] = str_replace('-', '.', substr($tmpAddr, 0, strpos($tmpAddr, ".")));
|
||||
|
||||
if (isIPv4($arrBrowserUrl['host']))
|
||||
{
|
||||
if (isIPv4($arrBrowserUrl['host'])) {
|
||||
return '3';
|
||||
}
|
||||
|
||||
if (compareUrlStrings($arrConUrl, $arrBrowserUrl, true))
|
||||
{
|
||||
if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) {
|
||||
return '1';
|
||||
}
|
||||
|
||||
return '2';
|
||||
|
||||
} else
|
||||
{ // isn't
|
||||
if (compareUrlStrings($arrConUrl, $arrBrowserUrl))
|
||||
{
|
||||
} else { // isn't
|
||||
if (compareUrlStrings($arrConUrl, $arrBrowserUrl)) {
|
||||
return '1';
|
||||
}
|
||||
|
||||
|
@ -210,30 +186,38 @@ function checkPathInformation($strConUrl, $strBrowserUrl)
|
|||
*
|
||||
* @param array $arrConUrl
|
||||
* @param array $arrBrowserUrl
|
||||
* @param boolean $isIP not used, don' t know if needed
|
||||
* @return boolean
|
||||
*/
|
||||
function compareUrlStrings($arrConUrl, $arrBrowserUrl, $isIP = false)
|
||||
{
|
||||
// && $isIP == false
|
||||
function compareUrlStrings($arrConUrl, $arrBrowserUrl) {
|
||||
|
||||
// remove 'www.' if needed
|
||||
if (strpos($arrConUrl['host'], 'www.') == 0 || strpos($arrBrowserUrl['host'], 'www.') == 0)
|
||||
{
|
||||
if (strpos($arrConUrl['host'], 'www.') == 0 || strpos($arrBrowserUrl['host'], 'www.') == 0) {
|
||||
$arrConUrl['host'] = str_replace('www.', '', $arrConUrl);
|
||||
$arrBrowserUrl['host'] = str_replace('www.', '', $arrBrowserUrl);
|
||||
}
|
||||
|
||||
$strConUrl = $arrConUrl['scheme'].'://'.$arrConUrl['host'].$arrConUrl['path'];
|
||||
$strBrowserUrl = $arrBrowserUrl['scheme'].'://'.$arrBrowserUrl['host'].$arrBrowserUrl['path'];
|
||||
$strConUrl = unparse_url($arrConUrl);
|
||||
$strBrowserUrl = unparse_url($arrBrowserUrl);
|
||||
|
||||
if (strcmp($strConUrl, $strBrowserUrl) != 0)
|
||||
{
|
||||
if (strcmp($strConUrl, $strBrowserUrl) != 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function unparse_url($parsed_url) {
|
||||
$scheme = isset($parsed_url['scheme']) && is_string($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
|
||||
$host = isset($parsed_url['host']) && is_string($parsed_url['host']) ? $parsed_url['host'] : '';
|
||||
$port = isset($parsed_url['port']) && is_string($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
|
||||
$user = isset($parsed_url['user']) && is_string($parsed_url['user']) ? $parsed_url['user'] : '';
|
||||
$pass = isset($parsed_url['pass']) && is_string($parsed_url['pass']) ? ':' . $parsed_url['pass'] : '';
|
||||
$pass = ($user || $pass) ? "$pass@" : '';
|
||||
$path = isset($parsed_url['path']) && is_string($parsed_url['path']) ? $parsed_url['path'] : '';
|
||||
$query = isset($parsed_url['query']) && is_string($parsed_url['query']) ? '?' . $parsed_url['query'] : '';
|
||||
$fragment = isset($parsed_url['fragment']) && is_string($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
|
||||
return "$scheme$user$pass$host$port$path$query$fragment";
|
||||
}
|
||||
|
||||
/**
|
||||
* writeSystemValuesOutput - get several server and Contenido settings
|
||||
*
|
||||
|
@ -242,68 +226,59 @@ function compareUrlStrings($arrConUrl, $arrBrowserUrl, $isIP = false)
|
|||
* @return string returns a string containing several server and Contenido settings
|
||||
* @author Marco Jahn
|
||||
*/
|
||||
function writeSystemValuesOutput($usage)
|
||||
{
|
||||
function writeSystemValuesOutput($usage) {
|
||||
|
||||
global $db, $_SERVER, $cfg, $i18n, $tpl;
|
||||
|
||||
/* variables to proof against each other*/
|
||||
/* variables to proof against each other */
|
||||
|
||||
$contenidoFullHtml = $cfg['path']['contenido_fullhtml'];
|
||||
$browserPath = $_SERVER['SERVER_PORT'] == '443' ? 'https' : 'http';
|
||||
$browserPath .= "://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||
$browserPath .= "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
$browserPath = substr($browserPath, 0, strrpos($browserPath, "/") + 1);
|
||||
|
||||
$status = checkPathInformation($contenidoFullHtml, $browserPath);
|
||||
|
||||
if ($status == 1)
|
||||
{ // green
|
||||
$contenidoFullHtml = "<span style=\"color:green;\">".$contenidoFullHtml."</span><br>";
|
||||
$browserPath = "<span style=\"color:green;\">".$browserPath."</span>";
|
||||
|
||||
}
|
||||
elseif ($status == 2)
|
||||
{ // red
|
||||
$contenidoFullHtml = "<span style=\"color:red;\">".$contenidoFullHtml."</span><br>";
|
||||
$browserPath = "<span style=\"color:red;\">".$browserPath."</span>";
|
||||
|
||||
}
|
||||
elseif ($status == 3)
|
||||
{ //orange
|
||||
$contenidoFullHtml = "<span style=\"color:orange;\">".$contenidoFullHtml."</span><br>";
|
||||
$browserPath = "<span style=\"color:orange;\">".$browserPath."</span>";
|
||||
|
||||
if ($status == 1) { // green
|
||||
$contenidoFullHtml = "<span style=\"color:green;\">" . $contenidoFullHtml . "</span><br>";
|
||||
$browserPath = "<span style=\"color:green;\">" . $browserPath . "</span>";
|
||||
} elseif ($status == 2) { // red
|
||||
$contenidoFullHtml = "<span style=\"color:red;\">" . $contenidoFullHtml . "</span><br>";
|
||||
$browserPath = "<span style=\"color:red;\">" . $browserPath . "</span>";
|
||||
} elseif ($status == 3) { //orange
|
||||
$contenidoFullHtml = "<span style=\"color:orange;\">" . $contenidoFullHtml . "</span><br>";
|
||||
$browserPath = "<span style=\"color:orange;\">" . $browserPath . "</span>";
|
||||
}
|
||||
|
||||
/* generate sysvalue output */
|
||||
$i = 0; // array start value
|
||||
// current Contenido version
|
||||
$sysvalues[$i]['variable'] = i18n('Contenido version');
|
||||
$sysvalues[$i ++]['value'] = $cfg['version'];
|
||||
$sysvalues[$i++]['value'] = $cfg['version'];
|
||||
// paths from config.php
|
||||
$sysvalues[$i]['variable'] = i18n('Contenido path');
|
||||
$sysvalues[$i ++]['value'] = $cfg['path']['contenido'];
|
||||
$sysvalues[$i++]['value'] = $cfg['path']['contenido'];
|
||||
$sysvalues[$i]['variable'] = i18n('Contenido HTML path');
|
||||
$sysvalues[$i ++]['value'] = $cfg['path']['contenido_html'];
|
||||
$sysvalues[$i++]['value'] = $cfg['path']['contenido_html'];
|
||||
$sysvalues[$i]['variable'] = i18n('Contenido full HTML path');
|
||||
$sysvalues[$i ++]['value'] = $contenidoFullHtml;
|
||||
$sysvalues[$i++]['value'] = $contenidoFullHtml;
|
||||
$sysvalues[$i]['variable'] = i18n('Contenido frontend path');
|
||||
$sysvalues[$i ++]['value'] = $cfg['path']['frontend'];
|
||||
$sysvalues[$i++]['value'] = $cfg['path']['frontend'];
|
||||
$sysvalues[$i]['variable'] = i18n('Contenido PHPLIB path');
|
||||
$sysvalues[$i ++]['value'] = $cfg['path']['phplib'];
|
||||
$sysvalues[$i++]['value'] = $cfg['path']['phplib'];
|
||||
$sysvalues[$i]['variable'] = i18n('Contenido wysiwyg path');
|
||||
$sysvalues[$i ++]['value'] = $cfg['path']['wysiwyg'];
|
||||
$sysvalues[$i++]['value'] = $cfg['path']['wysiwyg'];
|
||||
$sysvalues[$i]['variable'] = i18n('Contenido wysiwyg HTML path');
|
||||
$sysvalues[$i ++]['value'] = $cfg['path']['wysiwyg_html'];
|
||||
$sysvalues[$i++]['value'] = $cfg['path']['wysiwyg_html'];
|
||||
// host name
|
||||
$sysvalues[$i]['variable'] = i18n('Host name');
|
||||
$sysvalues[$i ++]['value'] = $_SERVER['HTTP_HOST'];
|
||||
$sysvalues[$i++]['value'] = $_SERVER['HTTP_HOST'];
|
||||
// Contenido browser path
|
||||
$sysvalues[$i]['variable'] = i18n('Browser path');
|
||||
/* cut of file information */
|
||||
$sysvalues[$i ++]['value'] = $browserPath;
|
||||
$sysvalues[$i++]['value'] = $browserPath;
|
||||
// get number of clients
|
||||
$sql = "SELECT count(name) clientcount FROM ".$cfg["tab"]["clients"];
|
||||
$sql = "SELECT count(name) clientcount FROM " . $cfg["tab"]["clients"];
|
||||
$db->query($sql);
|
||||
$db->next_record();
|
||||
$clientcount = $db->f("clientcount");
|
||||
|
@ -313,7 +288,7 @@ function writeSystemValuesOutput($usage)
|
|||
a.name clientname,
|
||||
a.idclient
|
||||
FROM
|
||||
".$cfg["tab"]["clients"]." a
|
||||
" . $cfg["tab"]["clients"] . " a
|
||||
GROUP BY a.name,
|
||||
a.idclient";
|
||||
$db->query($sql);
|
||||
|
@ -322,15 +297,13 @@ function writeSystemValuesOutput($usage)
|
|||
$db2 = new DB_ConLite;
|
||||
$clientInformation = "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">
|
||||
<tr class=\"textw_medium\" style=\"background-color: #E2E2E2\">
|
||||
<td width=\"20%\" class=\"textg_medium\" style=\"border:1px; border-color:#B3B3B3; border-style:solid;; border-bottom: none;\" nowrap=\"nowrap\">".i18n("client settings")."</td>
|
||||
<td class=\"textg_medium\" style=\"border:1px; border-left:0px; border-color: #B3B3B3; border-style: solid;border-bottom: none;\" nowrap=\"nowrap\">".i18n("values")."</td>
|
||||
<td width=\"20%\" class=\"textg_medium\" style=\"border:1px; border-color:#B3B3B3; border-style:solid;; border-bottom: none;\" nowrap=\"nowrap\">" . i18n("client settings") . "</td>
|
||||
<td class=\"textg_medium\" style=\"border:1px; border-left:0px; border-color: #B3B3B3; border-style: solid;border-bottom: none;\" nowrap=\"nowrap\">" . i18n("values") . "</td>
|
||||
</tr>";
|
||||
|
||||
$clientPermCount = 0;
|
||||
while ($db->next_record())
|
||||
{
|
||||
if (system_have_perm($db->f("idclient")))
|
||||
{
|
||||
while ($db->next_record()) {
|
||||
if (system_have_perm($db->f("idclient"))) {
|
||||
$clientlang = "";
|
||||
|
||||
// get client name
|
||||
|
@ -341,155 +314,149 @@ function writeSystemValuesOutput($usage)
|
|||
$clientlang = "";
|
||||
// select languages belong to a client
|
||||
$sql = "SELECT c.name clientlang
|
||||
FROM ".$cfg["tab"]["clients"]." a
|
||||
LEFT JOIN ".$cfg["tab"]["clients_lang"]." b ON a.idclient = b.idclient
|
||||
LEFT JOIN ".$cfg["tab"]["lang"]." c ON b.idlang = c.idlang
|
||||
WHERE a.idclient=".Contenido_Security::toInteger($db->f("idclient"))." AND c.name IS NOT NULL";
|
||||
FROM " . $cfg["tab"]["clients"] . " a
|
||||
LEFT JOIN " . $cfg["tab"]["clients_lang"] . " b ON a.idclient = b.idclient
|
||||
LEFT JOIN " . $cfg["tab"]["lang"] . " c ON b.idlang = c.idlang
|
||||
WHERE a.idclient=" . Contenido_Security::toInteger($db->f("idclient")) . " AND c.name IS NOT NULL";
|
||||
$db2->query($sql);
|
||||
while ($db2->next_record())
|
||||
{
|
||||
$clientlang .= $db2->f("clientlang").", ";
|
||||
while ($db2->next_record()) {
|
||||
$clientlang .= $db2->f("clientlang") . ", ";
|
||||
}
|
||||
// cut off last ","
|
||||
$clientlang = substr($clientlang, 0, strlen($clientlang) - 2);
|
||||
|
||||
$clientInformation .= "<tr class=\"text_medium\" style=\"background-color: {BGCOLOR};\" >
|
||||
<td class=\"text_medium\" style=\"border:1px; border-top:0px; border-color: #B3B3B3; border-style: solid; \" nowrap=\"nowrap\" align=\"left\" valign=\"top\">".i18n("language(s)")."</td>
|
||||
<td class=\"text_medium\" style=\"border:1px; border-top:0px; border-color: #B3B3B3; border-style: solid; \" nowrap=\"nowrap\" align=\"left\" valign=\"top\">" . i18n("language(s)") . "</td>
|
||||
<td class=\"text_medium\" width=\"60%\" style=\"border:1px; border-left:0px; border-top:0px; border-color: #B3B3B3; border-style: solid; \" nowrap=\"nowrap\">$clientlang </td>
|
||||
</tr>";
|
||||
|
||||
$sql = "SELECT frontendpath, htmlpath FROM ".$cfg["tab"]["clients"]." WHERE idclient='".Contenido_Security::toInteger($db->f("idclient"))."'";
|
||||
$sql = "SELECT frontendpath, htmlpath FROM " . $cfg["tab"]["clients"] . " WHERE idclient='" . Contenido_Security::toInteger($db->f("idclient")) . "'";
|
||||
$db2->query($sql);
|
||||
while ($db2->next_record())
|
||||
{
|
||||
while ($db2->next_record()) {
|
||||
$clientInformation .= "<tr class=\"text_medium\" style=\"background-color: {BGCOLOR};\" >
|
||||
<td class=\"text_medium\" style=\"border:1px; border-top:0px; border-color: #B3B3B3; border-style: solid\" nowrap=\"nowrap\" align=\"left\" valign=\"top\">".i18n("htmlpath")."</td>
|
||||
<td class=\"text_medium\" width=\"60%\" style=\"border:1px; border-left:0px; border-top:0px; border-color: #B3B3B3; border-style: solid;\" nowrap=\"nowrap\">".$db2->f("htmlpath")." </td>
|
||||
<td class=\"text_medium\" style=\"border:1px; border-top:0px; border-color: #B3B3B3; border-style: solid\" nowrap=\"nowrap\" align=\"left\" valign=\"top\">" . i18n("htmlpath") . "</td>
|
||||
<td class=\"text_medium\" width=\"60%\" style=\"border:1px; border-left:0px; border-top:0px; border-color: #B3B3B3; border-style: solid;\" nowrap=\"nowrap\">" . $db2->f("htmlpath") . " </td>
|
||||
</tr>";
|
||||
$clientInformation .= "<tr class=\"text_medium\" style=\"background-color: {BGCOLOR};\" >
|
||||
<td class=\"text_medium\" style=\"border:1px; border-top:0px; border-color: #B3B3B3; border-style: solid\" nowrap=\"nowrap\" align=\"left\" valign=\"top\">".i18n("frontendpath")."</td>
|
||||
<td class=\"text_medium\" width=\"60%\" style=\"border:1px; border-left:0px; border-top:0px; border-color: #B3B3B3; border-style: solid;\" nowrap=\"nowrap\">".$db2->f("frontendpath")." </td>
|
||||
<td class=\"text_medium\" style=\"border:1px; border-top:0px; border-color: #B3B3B3; border-style: solid\" nowrap=\"nowrap\" align=\"left\" valign=\"top\">" . i18n("frontendpath") . "</td>
|
||||
<td class=\"text_medium\" width=\"60%\" style=\"border:1px; border-left:0px; border-top:0px; border-color: #B3B3B3; border-style: solid;\" nowrap=\"nowrap\">" . $db2->f("frontendpath") . " </td>
|
||||
</tr>";
|
||||
}
|
||||
$clientPermCount ++;
|
||||
$clientPermCount++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($clientPermCount == 0)
|
||||
{
|
||||
if ($clientPermCount == 0) {
|
||||
$clientInformation .= "<tr class=\"text_medium\" style=\"background-color: {BGCOLOR};\" >
|
||||
<td colspan=\"2\" class=\"text_medium\" style=\"border:1px; border-top:0px; border-color: #B3B3B3; border-style: solid; \" nowrap=\"nowrap\" align=\"left\" valign=\"top\">".i18n("No permissions!")."</td>
|
||||
<td colspan=\"2\" class=\"text_medium\" style=\"border:1px; border-top:0px; border-color: #B3B3B3; border-style: solid; \" nowrap=\"nowrap\" align=\"left\" valign=\"top\">" . i18n("No permissions!") . "</td>
|
||||
</tr>";
|
||||
}
|
||||
|
||||
$clientInformation .= '</table>';
|
||||
|
||||
$clientdata = i18n('Number of installed clients: ').$clientcount."<br>".$clientInformation;
|
||||
$clientdata = i18n('Number of installed clients: ') . $clientcount . "<br>" . $clientInformation;
|
||||
|
||||
// client quantity and their assigned language and are they online
|
||||
$sysvalues[$i]['variable'] = i18n('Client informations');
|
||||
$sysvalues[$i ++]['value'] = "$clientdata";
|
||||
$sysvalues[$i++]['value'] = "$clientdata";
|
||||
// get number of users installed
|
||||
$sql = "SELECT count(user_id) usercount FROM ".$cfg["tab"]["phplib_auth_user_md5"];
|
||||
$sql = "SELECT count(user_id) usercount FROM " . $cfg["tab"]["phplib_auth_user_md5"];
|
||||
$db->query($sql);
|
||||
$db->next_record();
|
||||
// number of users
|
||||
$sysvalues[$i]['variable'] = i18n('Number of users');
|
||||
$sysvalues[$i ++]['value'] = $db->f("usercount");
|
||||
$sysvalues[$i++]['value'] = $db->f("usercount");
|
||||
//get number of articles
|
||||
$sql = "SELECT count(idart) articlecount FROM ".$cfg["tab"]["art"];
|
||||
$sql = "SELECT count(idart) articlecount FROM " . $cfg["tab"]["art"];
|
||||
$db->query($sql);
|
||||
$db->next_record();
|
||||
// number of articles
|
||||
$sysvalues[$i]['variable'] = i18n('Number of articles');
|
||||
$sysvalues[$i ++]['value'] = $db->f("articlecount");
|
||||
$sysvalues[$i++]['value'] = $db->f("articlecount");
|
||||
// server operating system
|
||||
$sysvalues[$i]['variable'] = i18n('Server operating system');
|
||||
$sysvalues[$i ++]['value'] = $_SERVER['SERVER_SOFTWARE'];
|
||||
$sysvalues[$i++]['value'] = $_SERVER['SERVER_SOFTWARE'];
|
||||
// SQL version
|
||||
$sql_server_info = $db->server_info();
|
||||
$sysvalues[$i]['variable'] = i18n('PHP database extension');
|
||||
$sysvalues[$i ++]['value'] = $cfg["database_extension"];
|
||||
$sysvalues[$i++]['value'] = $cfg["database_extension"];
|
||||
$sysvalues[$i]['variable'] = i18n('Database server version');
|
||||
$sysvalues[$i ++]['value'] = $sql_server_info['description'];
|
||||
$sysvalues[$i++]['value'] = $sql_server_info['description'];
|
||||
// php version
|
||||
$sysvalues[$i]['variable'] = i18n('Installed PHP version');
|
||||
$sysvalues[$i ++]['value'] = phpversion();
|
||||
$sysvalues[$i++]['value'] = phpversion();
|
||||
// php config values
|
||||
// config values
|
||||
// php safe_mode
|
||||
(ini_get('safe_mode') == 1) ? $safe_mode = "<span stlye=\"color:red;\">".i18n('activated')."</span>" : $safe_mode = "<span style=\"color:green;\">".i18n('deactivated')."</span>";
|
||||
(ini_get('safe_mode') == 1) ? $safe_mode = "<span stlye=\"color:red;\">" . i18n('activated') . "</span>" : $safe_mode = "<span style=\"color:green;\">" . i18n('deactivated') . "</span>";
|
||||
$sysvalues[$i]['variable'] = "safe_mode";
|
||||
$sysvalues[$i ++]['value'] = $safe_mode;
|
||||
$sysvalues[$i++]['value'] = $safe_mode;
|
||||
// magig quotes GPC
|
||||
(ini_get('magic_quotes_gpc') == 1) ? $magic_quotes_gpc = i18n('activated') : $magic_quotes_gpc = i18n('deactivated');
|
||||
$sysvalues[$i]['variable'] = "magic_quotes_gpc";
|
||||
$sysvalues[$i ++]['value'] = $magic_quotes_gpc;
|
||||
$sysvalues[$i++]['value'] = $magic_quotes_gpc;
|
||||
// magic quotes runtime
|
||||
(ini_get('magic_quotes_runtime') == 1) ? $magic_quotes_runtime = i18n('activated') : $magic_quotes_runtime = i18n('deactivated');
|
||||
$sysvalues[$i]['variable'] = "magic_quotes_runtime";
|
||||
$sysvalues[$i ++]['value'] = $magic_quotes_runtime;
|
||||
$sysvalues[$i++]['value'] = $magic_quotes_runtime;
|
||||
// GPC order
|
||||
$sysvalues[$i]['variable'] = "gpc_order";
|
||||
$sysvalues[$i ++]['value'] = ini_get('gpc_order');
|
||||
$sysvalues[$i++]['value'] = ini_get('gpc_order');
|
||||
// memory limit
|
||||
$sysvalues[$i]['variable'] = "memory_limit";
|
||||
$sysvalues[$i ++]['value'] = ini_get('memory_limit');
|
||||
$sysvalues[$i++]['value'] = ini_get('memory_limit');
|
||||
// max execution time
|
||||
$sysvalues[$i]['variable'] = "max_execution_time";
|
||||
$sysvalues[$i ++]['value'] = ini_get('max_execution_time');
|
||||
$sysvalues[$i++]['value'] = ini_get('max_execution_time');
|
||||
// disabled functions
|
||||
(strlen(ini_get('disable_functions')) > 0) ? $disable_functions = "<span style=\"color:red;\">". str_replace(",", ", ", ini_get('disable_functions'))."</span>" : $disable_functions = "<span style=\"color:green\">".i18n('nothing disabled')."</span>";
|
||||
(strlen(ini_get('disable_functions')) > 0) ? $disable_functions = "<span style=\"color:red;\">" . str_replace(",", ", ", ini_get('disable_functions')) . "</span>" : $disable_functions = "<span style=\"color:green\">" . i18n('nothing disabled') . "</span>";
|
||||
$sysvalues[$i]['variable'] = i18n('Disabled functions');
|
||||
$sysvalues[$i ++]['value'] = $disable_functions;
|
||||
$sysvalues[$i++]['value'] = $disable_functions;
|
||||
// gettext loaded
|
||||
(extension_loaded('gettext') == true) ? $gettext = "<span style=\"color:green;\">".i18n('loaded')."</span>" : $gettext = "<span stlye=\"color:red;\">".i18n('not loaded')."</span>";
|
||||
(extension_loaded('gettext') == true) ? $gettext = "<span style=\"color:green;\">" . i18n('loaded') . "</span>" : $gettext = "<span stlye=\"color:red;\">" . i18n('not loaded') . "</span>";
|
||||
$sysvalues[$i]['variable'] = i18n('Gettext extension');
|
||||
$sysvalues[$i ++]['value'] = $gettext;
|
||||
$sysvalues[$i++]['value'] = $gettext;
|
||||
// sql.safe_mode
|
||||
(ini_get('sql.safe_mode') == 1) ? $sql_safe_mode = "<span style=\"color:red;\">".i18n('activated')."</span>" : $sql_safe_mode = "<span style=\"color:green;\">".i18n('deactivated')."</span>";
|
||||
(ini_get('sql.safe_mode') == 1) ? $sql_safe_mode = "<span style=\"color:red;\">" . i18n('activated') . "</span>" : $sql_safe_mode = "<span style=\"color:green;\">" . i18n('deactivated') . "</span>";
|
||||
$sysvalues[$i]['variable'] = "sql.safe_mode";
|
||||
$sysvalues[$i ++]['value'] = $sql_safe_mode;
|
||||
$sysvalues[$i++]['value'] = $sql_safe_mode;
|
||||
// gdlib with installed features
|
||||
$gdLib = array();
|
||||
$gdLib = getPhpModuleInfo($moduleName = 'gd');
|
||||
$gdLibFeatures = "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\">
|
||||
<tr class=\"textg_medium\" style=\"background-color: #E2E2E2\">
|
||||
<td width=\"20%\" class=\"textg_medium\" style=\"border:1px; border-color:#B3B3B3; border-style:solid;border-bottom:none\" nowrap=\"nowrap\">".i18n("Settings")."</td>
|
||||
<td class=\"textg_medium\" style=\"border:1px; border-left:0px; border-color: #B3B3B3; border-style: solid; border-bottom:none\" nowrap=\"nowrap\">".i18n("Values")."</td>
|
||||
<td width=\"20%\" class=\"textg_medium\" style=\"border:1px; border-color:#B3B3B3; border-style:solid;border-bottom:none\" nowrap=\"nowrap\">" . i18n("Settings") . "</td>
|
||||
<td class=\"textg_medium\" style=\"border:1px; border-left:0px; border-color: #B3B3B3; border-style: solid; border-bottom:none\" nowrap=\"nowrap\">" . i18n("Values") . "</td>
|
||||
</tr>";
|
||||
|
||||
foreach ($sysvalues as $key => $value) {
|
||||
if (trim ($value['value']) == '') {
|
||||
if (trim($value['value']) == '') {
|
||||
$sysvalues[$key]['value'] = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($gdLib as $setting => $value)
|
||||
{
|
||||
foreach ($gdLib as $setting => $value) {
|
||||
$gdLibFeatures .= "<tr class=\"text_medium\" style=\"background-color: {BGCOLOR};\" >
|
||||
<td class=\"text_medium\" style=\"border:1px; border-top:0px; border-color: #B3B3B3; border-style: solid;\" nowrap=\"nowrap\" align=\"left\" valign=\"top\">".$setting."</td>
|
||||
<td class=\"text_medium\" width=\"60%\" style=\"border:1px; border-left:0px; border-top:0px; border-color: #B3B3B3; border-style: solid;\" nowrap=\"nowrap\">".$value[0]."</td>
|
||||
<td class=\"text_medium\" style=\"border:1px; border-top:0px; border-color: #B3B3B3; border-style: solid;\" nowrap=\"nowrap\" align=\"left\" valign=\"top\">" . $setting . "</td>
|
||||
<td class=\"text_medium\" width=\"60%\" style=\"border:1px; border-left:0px; border-top:0px; border-color: #B3B3B3; border-style: solid;\" nowrap=\"nowrap\">" . $value[0] . "</td>
|
||||
</tr>";
|
||||
}
|
||||
$gdLibFeatures .= '</table>';
|
||||
$sysvalues[$i]['variable'] = i18n('GD library');
|
||||
$sysvalues[$i ++]['value'] = $gdLibFeatures;
|
||||
$sysvalues[$i++]['value'] = $gdLibFeatures;
|
||||
|
||||
// include path settings
|
||||
$sysvalues[$i]['variable'] = "include_path";
|
||||
$sysvalues[$i ++]['value'] = ini_get('include_path');
|
||||
$sysvalues[$i++]['value'] = ini_get('include_path');
|
||||
|
||||
$iRowId = 1;
|
||||
$sRowBgColor2 = $sRowBgColor1 = "#fff";
|
||||
$iRowId = 1;
|
||||
$sRowBgColor2 = $sRowBgColor1 = "#fff";
|
||||
//loop array for every parameter
|
||||
foreach ($sysvalues AS $sysvalue)
|
||||
{
|
||||
foreach ($sysvalues AS $sysvalue) {
|
||||
$tpl->set('d', 'VARIABLE', $sysvalue['variable']);
|
||||
$tpl->set('d', 'LOCALVALUE', $sysvalue['value']);
|
||||
$tpl->set('d', 'ROWID', 'sysrow_'.$iRowId);
|
||||
if($iRowId % 2) {
|
||||
$tpl->set('d', 'ROWID', 'sysrow_' . $iRowId);
|
||||
if ($iRowId % 2) {
|
||||
$tpl->set('d', 'BGCOLOR', $sRowBgColor1);
|
||||
} else {
|
||||
$tpl->set('d', 'BGCOLOR', $sRowBgColor2);
|
||||
|
@ -499,15 +466,11 @@ $sRowBgColor2 = $sRowBgColor1 = "#fff";
|
|||
}
|
||||
|
||||
/* irgendwas sinnvolles :) */
|
||||
if ($usage == 'mail')
|
||||
{
|
||||
return $tpl->generate($cfg['path']['templates'].$cfg['templates']['systam_variables_mailattach'], true);
|
||||
}
|
||||
elseif ($usage == 'output')
|
||||
{
|
||||
if ($usage == 'mail') {
|
||||
return $tpl->generate($cfg['path']['templates'] . $cfg['templates']['systam_variables_mailattach'], true);
|
||||
} elseif ($usage == 'output') {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -535,51 +498,43 @@ $sRowBgColor2 = $sRowBgColor1 = "#fff";
|
|||
* @return string returns several server and Contenido settings
|
||||
* @author Marco Jahn
|
||||
*/
|
||||
function sendBugReport()
|
||||
{
|
||||
function sendBugReport() {
|
||||
global $_POST, $notification, $cfg;
|
||||
|
||||
/* will be set to another value than 0 if an error attempts */
|
||||
$mailSendError = 0;
|
||||
|
||||
/* check if email is filled out */
|
||||
if (strlen($_POST['sender']) == 0)
|
||||
{
|
||||
if (strlen($_POST['sender']) == 0) {
|
||||
$mailSendError = 1;
|
||||
}
|
||||
|
||||
/* check if forename is filled out */
|
||||
if (strlen($_POST['forename']) == 0)
|
||||
{
|
||||
if (strlen($_POST['forename']) == 0) {
|
||||
$mailSendError = 1;
|
||||
}
|
||||
|
||||
/* check if surname is filled out */
|
||||
if (strlen($_POST['surname']) == 0)
|
||||
{
|
||||
if (strlen($_POST['surname']) == 0) {
|
||||
$mailSendError = 1;
|
||||
}
|
||||
|
||||
/* check if bugreport is filled out */
|
||||
if (strlen($_POST['bugreport']) == 0)
|
||||
{
|
||||
if (strlen($_POST['bugreport']) == 0) {
|
||||
$mailSendError = 1;
|
||||
}
|
||||
|
||||
/* check if email adress is valid */
|
||||
if (isValidMail($_POST['sender']) == false)
|
||||
{
|
||||
if (isValidMail($_POST['sender']) == false) {
|
||||
$mailSendError = 2;
|
||||
}
|
||||
|
||||
/* user has not agreed */
|
||||
if ($_POST['agreement'] != 'on')
|
||||
{
|
||||
if ($_POST['agreement'] != 'on') {
|
||||
$mailSendError = 3;
|
||||
}
|
||||
|
||||
if ($mailSendError == 0)
|
||||
{
|
||||
if ($mailSendError == 0) {
|
||||
/* send mail */
|
||||
|
||||
/* initialize mail class */
|
||||
|
@ -587,7 +542,7 @@ function sendBugReport()
|
|||
|
||||
/* set sender information */
|
||||
$mail->From = strip_tags($_POST['sender']);
|
||||
$mail->FromName = strip_tags($_POST['forename']." ".$_POST['surname']);
|
||||
$mail->FromName = strip_tags($_POST['forename'] . " " . $_POST['surname']);
|
||||
|
||||
/* set recipient */
|
||||
$mail->AddAddress($cfg['bugreport']['targetemail'], "Bugreport recipient");
|
||||
|
@ -597,65 +552,50 @@ function sendBugReport()
|
|||
|
||||
/* generate subject & body */
|
||||
$mail->Subject = "Bugreport";
|
||||
$mail->Body = "Fehlerbereich: ".$_POST['selectarea']."<br><br>".nl2br(strip_tags($_POST['bugreport']));
|
||||
$mail->AltBody = "Fehlerbereich: ".$_POST['selectarea']."\n\n".strip_tags($_POST['bugreport']);
|
||||
$mail->Body = "Fehlerbereich: " . $_POST['selectarea'] . "<br><br>" . nl2br(strip_tags($_POST['bugreport']));
|
||||
$mail->AltBody = "Fehlerbereich: " . $_POST['selectarea'] . "\n\n" . strip_tags($_POST['bugreport']);
|
||||
|
||||
/* add attachements */
|
||||
if ($_POST['errorlog'] == 'on')
|
||||
{
|
||||
if (filesize($cfg['path']['contenido']."logs/errorlog.txt") > 0)
|
||||
{ //filesize > 0 send alternative attachement
|
||||
$mail->AddAttachment($cfg['path']['contenido']."logs/errorlog.txt", "errorlog.txt");
|
||||
} else
|
||||
{
|
||||
if ($_POST['errorlog'] == 'on') {
|
||||
if (filesize($cfg['path']['contenido'] . "logs/errorlog.txt") > 0) { //filesize > 0 send alternative attachement
|
||||
$mail->AddAttachment($cfg['path']['contenido'] . "logs/errorlog.txt", "errorlog.txt");
|
||||
} else {
|
||||
$mail->AddStringAttachment("No error log entries found\n", "errorlog.txt");
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST['upgradeerrorlog'] == 'on')
|
||||
{
|
||||
if (filesize($cfg['path']['contenido']."logs/install.log.txt") > 0)
|
||||
{ //filesize > 0 send alternative attachement
|
||||
$mail->AddAttachment($cfg['path']['contenido']."logs/install.log.txt", "install.log.txt");
|
||||
} else
|
||||
{
|
||||
if ($_POST['upgradeerrorlog'] == 'on') {
|
||||
if (filesize($cfg['path']['contenido'] . "logs/install.log.txt") > 0) { //filesize > 0 send alternative attachement
|
||||
$mail->AddAttachment($cfg['path']['contenido'] . "logs/install.log.txt", "install.log.txt");
|
||||
} else {
|
||||
$mail->AddStringAttachment("No install error log entries found\n", "install.log.txt");
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST['sysvalues'] == 'on')
|
||||
{
|
||||
if ($_POST['sysvalues'] == 'on') {
|
||||
//send sysvalue output
|
||||
$mail->AddStringAttachment(writeSystemValuesOutput($usage = 'mail'), "systemvariables.html");
|
||||
}
|
||||
|
||||
if ($_POST['phpinfo'] == 'on')
|
||||
{
|
||||
if ($_POST['phpinfo'] == 'on') {
|
||||
//send phpinfo output
|
||||
$mail->AddStringAttachment(phpInfoToHtml(), "phpinfo.html");
|
||||
}
|
||||
|
||||
if (!$mail->Send())
|
||||
{
|
||||
if (!$mail->Send()) {
|
||||
$tmp_notification = $notification->returnNotification("error", i18n("an error occured while sending your bug report! Please try again"));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
$tmp_notification = $notification->returnNotification("info", i18n("bug report forwarded"));
|
||||
}
|
||||
}
|
||||
elseif ($mailSendError == 1)
|
||||
{
|
||||
} elseif ($mailSendError == 1) {
|
||||
/* user should fill all fields */
|
||||
$tmp_notification = $notification->returnNotification("warning", i18n("please fill out all mandatory fields"));
|
||||
}
|
||||
elseif ($mailSendError == 2)
|
||||
{ /* email adress is not valid */
|
||||
} elseif ($mailSendError == 2) { /* email adress is not valid */
|
||||
$tmp_notification = $notification->returnNotification("warning", i18n("please enter a valid E-Mail adress"));
|
||||
}
|
||||
elseif ($mailSendError == 3)
|
||||
{ /* user hasn't agreed to the declaration of consent */
|
||||
} elseif ($mailSendError == 3) { /* user hasn't agreed to the declaration of consent */
|
||||
$tmp_notification = $notification->returnNotification("warning", i18n("you must agree the declaration of consent"));
|
||||
}
|
||||
return $mailSendError."||".$tmp_notification;
|
||||
return $mailSendError . "||" . $tmp_notification;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Laden…
In neuem Issue referenzieren