Dieser Commit ist enthalten in:
oldperl 2019-02-11 15:38:11 +00:00
Ursprung 4d005004cb
Commit e8f3efb90e
4 geänderte Dateien mit 111 neuen und 100 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,6 @@
<?php
if (!function_exists('is_countable')) {
function is_countable($var) {
return (is_array($var) || $var instanceof Countable);
}
}

Datei anzeigen

@ -1,4 +1,5 @@
<?php <?php
/** /**
* Project: * Project:
* Contenido Content Management System * Contenido Content Management System
@ -17,18 +18,17 @@
* *
* $Id: include.frontend.user_edit.php 292 2014-01-20 09:49:37Z oldperl $: * $Id: include.frontend.user_edit.php 292 2014-01-20 09:49:37Z oldperl $:
*/ */
if (!defined('CON_FRAMEWORK')) {
if(!defined('CON_FRAMEWORK')) { die('Illegal call');
die('Illegal call');
} }
$oPage = new cPage(); $oPage = new cPage();
$oPage->setHtml5(); $oPage->setHtml5();
$oFeUsers = new FrontendUserCollection(); $oFeUsers = new FrontendUserCollection();
if (is_array($cfg['plugins']['frontendusers'])) { if (is_array($cfg['plugins']['frontendusers'])) {
foreach ($cfg['plugins']['frontendusers'] as $plugin) { foreach ($cfg['plugins']['frontendusers'] as $plugin) {
plugin_include("frontendusers", $plugin."/".$plugin.".php"); plugin_include("frontendusers", $plugin . "/" . $plugin . ".php");
} }
} }
@ -42,13 +42,13 @@ $oFEGroupMemberCollection->query();
# The array $aFEGroup can be used in frontenduser plugins to display selfdefined user properties group dependent. # The array $aFEGroup can be used in frontenduser plugins to display selfdefined user properties group dependent.
$aFEGroup = array(); $aFEGroup = array();
while($oFEGroup = $oFEGroupMemberCollection->next()) { while ($oFEGroup = $oFEGroupMemberCollection->next()) {
$aFEGroup[] = $oFEGroup->get("idfrontendgroup"); $aFEGroup[] = $oFEGroup->get("idfrontendgroup");
} }
if ($action == "frontend_create" && $perm->have_perm_area_action("frontend", "frontend_create")) { if ($action == "frontend_create" && $perm->have_perm_area_action("frontend", "frontend_create")) {
$oFeUser = $oFeUsers->create(" ".i18n("-- new user --")); $oFeUser = $oFeUsers->create(" " . i18n("-- new user --"));
$idfrontenduser = $oFeUser->get("idfrontenduser"); $idfrontenduser = $oFeUser->get("idfrontenduser");
} }
if ($idfrontenduser && $action != '') { if ($idfrontenduser && $action != '') {
@ -57,7 +57,7 @@ if ($idfrontenduser && $action != '') {
if (left_bottom) { if (left_bottom) {
var href = left_bottom.location.href; var href = left_bottom.location.href;
href = href.replace(/&frontenduser.*/, ''); href = href.replace(/&frontenduser.*/, '');
left_bottom.location.href = href+'&frontenduser='+".$idfrontenduser."; left_bottom.location.href = href+'&frontenduser='+" . $idfrontenduser . ";
top.content.left.left_top.refresh(); top.content.left.left_top.refresh();
} }
</script>"; </script>";
@ -67,8 +67,8 @@ if ($idfrontenduser && $action != '') {
$sFormCheck = ' $sFormCheck = '
<script type="text/javascript"> <script type="text/javascript">
var defaultName = "'. i18n("-- new user --").'"; var defaultName = "' . i18n("-- new user --") . '";
var PwEmpty = '.(($oFeUser->get("password") == "d41d8cd98f00b204e9800998ecf8427e")?"true":"false").'; var PwEmpty = ' . (($oFeUser->get("password") == "d41d8cd98f00b204e9800998ecf8427e") ? "true" : "false") . ';
function checkUserForm() { function checkUserForm() {
if(document.getElementById("m1").value.match(/defaultName/i)) { if(document.getElementById("m1").value.match(/defaultName/i)) {
alert("Default username, please use a new one!"); alert("Default username, please use a new one!");
@ -92,7 +92,7 @@ if ($action == "frontend_delete" && $perm->have_perm_area_action("frontend", "fr
while ($chainEntry = $iterator->next()) { while ($chainEntry = $iterator->next()) {
$chainEntry->execute($idfrontenduser); $chainEntry->execute($idfrontenduser);
} }
$idfrontenduser = 0; $idfrontenduser = 0;
$oFeUser = new FrontendUser(); $oFeUser = new FrontendUser();
$oPage->addScript('reload', $sReloadScript); $oPage->addScript('reload', $sReloadScript);
@ -105,25 +105,25 @@ if ($oFeUser->virgin == false && $oFeUser->get("idclient") == $client) {
$messages = array(); $messages = array();
$bStore = true; $bStore = true;
$initname = i18n("-- new user --"); $initname = i18n("-- new user --");
$bNewUser = (strstr($username, $initname) === false)?false:true; $bNewUser = (strstr($username, $initname) === false) ? false : true;
if(empty($username) || $bNewUser) { if (empty($username) || $bNewUser) {
$messages[] = i18n("Username empty or not set! Please choose one."); $messages[] = i18n("Username empty or not set! Please choose one.");
$bStore = false; $bStore = false;
} }
// check for empty password // check for empty password
if($bStore && empty($newpd) && $oFeUser->get("password") == "d41d8cd98f00b204e9800998ecf8427e") { if ($bStore && empty($newpd) && $oFeUser->get("password") == "d41d8cd98f00b204e9800998ecf8427e") {
$messages[] = i18n("Password not set right now!"); $messages[] = i18n("Password not set right now!");
$bStore = false; $bStore = false;
} }
if ($bStore && $oFeUser->get("username") != stripslashes($username)) { if ($bStore && $oFeUser->get("username") != stripslashes($username)) {
$oFeUsers->select("username = '".urlencode($username)."' and idclient='$client'"); $oFeUsers->select("username = '" . urlencode($username) . "' and idclient='$client'");
if ($oFeUsers->next()) { if ($oFeUsers->next()) {
$messages[] = i18n("Could not set new username: Username already exists"); $messages[] = i18n("Could not set new username: Username already exists");
} else { } else {
$oFeUser->set("username", stripslashes($username)); $oFeUser->set("username", stripslashes($username));
} }
} }
if ($newpd != $newpd2) { if ($newpd != $newpd2) {
$messages[] = i18n("Could not set new password: Passwords don't match"); $messages[] = i18n("Could not set new password: Passwords don't match");
} else { } else {
@ -131,122 +131,121 @@ if ($oFeUser->virgin == false && $oFeUser->get("idclient") == $client) {
$oFeUser->set("password", $newpd); $oFeUser->set("password", $newpd);
} }
} }
$oFeUser->set("active", $active); $oFeUser->set("active", $active);
/* Check out if there are any plugins */ /* Check out if there are any plugins */
if (is_array($cfg['plugins']['frontendusers'])) { if (is_array($cfg['plugins']['frontendusers'])) {
foreach ($cfg['plugins']['frontendusers'] as $plugin) { foreach ($cfg['plugins']['frontendusers'] as $plugin) {
if (function_exists("frontendusers_".$plugin."_wantedVariables") && if (function_exists("frontendusers_" . $plugin . "_wantedVariables") && function_exists("frontendusers_" . $plugin . "_store")) {
function_exists("frontendusers_".$plugin."_store")) {
# check if user belongs to a specific group # check if user belongs to a specific group
# if true store values defined in frontenduser plugin # if true store values defined in frontenduser plugin
if (function_exists("frontendusers_".$plugin."_checkUserGroup")) { if (function_exists("frontendusers_" . $plugin . "_checkUserGroup")) {
$bCheckUserGroup = call_user_func("frontendusers_".$plugin."_checkUserGroup"); $bCheckUserGroup = call_user_func("frontendusers_" . $plugin . "_checkUserGroup");
} else { } else {
$bCheckUserGroup = true; $bCheckUserGroup = true;
} }
if ($bCheckUserGroup) { if ($bCheckUserGroup) {
$wantVariables = call_user_func("frontendusers_".$plugin."_wantedVariables"); $wantVariables = call_user_func("frontendusers_" . $plugin . "_wantedVariables");
if (is_array($wantVariables)) { if (is_array($wantVariables)) {
$varArray = array(); $varArray = array();
foreach ($wantVariables as $value) { foreach ($wantVariables as $value) {
$varArray[$value] = stripslashes($GLOBALS[$value]); $varArray[$value] = stripslashes($GLOBALS[$value]);
} }
} }
$store = call_user_func("frontendusers_".$plugin."_store", $varArray); $store = call_user_func("frontendusers_" . $plugin . "_store", $varArray);
} }
} }
} }
} }
if($bStore) $oFeUser->store(); if ($bStore)
$oFeUser->store();
} }
if (count($messages) > 0) { if (count($messages) > 0) {
$notis = $notification->returnNotification("warning", implode("<br>", $messages)) . "<br>"; $notis = $notification->returnNotification("warning", implode("<br>", $messages)) . "<br>";
} }
$form = new UI_Table_Form("properties"); $form = new UI_Table_Form("properties");
$form->setSubmitJS("return checkUserForm();"); $form->setSubmitJS("return checkUserForm();");
$form->setVar("frame", $frame); $form->setVar("frame", $frame);
$form->setVar("area", $area); $form->setVar("area", $area);
$form->setVar("action", "frontend_save_user"); $form->setVar("action", "frontend_save_user");
$form->setVar("idfrontenduser", $idfrontenduser); $form->setVar("idfrontenduser", $idfrontenduser);
$form->addHeader(i18n("Edit user")); $form->addHeader(i18n("Edit user"));
$username = new cHTMLTextbox("username", ((isset($_POST['username']) && $bStore === false)?$_POST['username']:$oFeUser->get("username")),40);
$newpw = new cHTMLPasswordBox("newpd","",40);
$newpw2 = new cHTMLPasswordBox("newpd2","",40);
$active = new cHTMLCheckbox("active","1");
$active->setChecked($oFeUser->get("active"));
$form->add(i18n("User name"), $username->render());
$form->add(i18n("New password"), $newpw->render());
$form->add(i18n("New password (again)"), $newpw2->render());
$form->add(i18n("Active"), $active->toHTML(false));
$pluginOrder = trim_array(explode(",",getSystemProperty("plugin", "frontendusers-pluginorder")));
/* Check out if there are any plugins */
if (is_array($pluginOrder)) {
foreach ($pluginOrder as $plugin) {
if (function_exists("frontendusers_".$plugin."_getTitle") &&
function_exists("frontendusers_".$plugin."_display")) {
# check if user belongs to a specific group
# if true display frontenduser plugin
if (function_exists("frontendusers_".$plugin."_checkUserGroup")) {
$bCheckUserGroup = call_user_func("frontendusers_".$plugin."_checkUserGroup");
} else {
$bCheckUserGroup = true;
}
if ($bCheckUserGroup) {
$plugTitle = call_user_func("frontendusers_".$plugin."_getTitle");
$display = call_user_func("frontendusers_".$plugin."_display", $oFeUser);
if (is_array($plugTitle) && is_array($display)) { $username = new cHTMLTextbox("username", ((isset($_POST['username']) && $bStore === false) ? $_POST['username'] : $oFeUser->get("username")), 40);
foreach ($plugTitle as $key => $value) { $newpw = new cHTMLPasswordBox("newpd", "", 40);
$form->add($value, $display[$key]); $newpw2 = new cHTMLPasswordBox("newpd2", "", 40);
} $active = new cHTMLCheckbox("active", "1");
} else { $active->setChecked($oFeUser->get("active"));
if (is_array($plugTitle) || is_array($display)) {
$form->add(i18n("WARNING"), sprintf(i18n("The plugin %s delivered an array for the displayed titles, but did not return an array for the contents."), $plugin)); $form->add(i18n("User name"), $username->render());
} else { $form->add(i18n("New password"), $newpw->render());
$form->add($plugTitle, $display); $form->add(i18n("New password (again)"), $newpw2->render());
} $form->add(i18n("Active"), $active->toHTML(false));
}
} $pluginOrder = trim_array(explode(",", getSystemProperty("plugin", "frontendusers-pluginorder")));
}
} /* Check out if there are any plugins */
if (is_array($pluginOrder)) {
$arrGroups = $oFeUser->getGroupsForUser(); foreach ($pluginOrder as $plugin) {
if (function_exists("frontendusers_" . $plugin . "_getTitle") && function_exists("frontendusers_" . $plugin . "_display")) {
if(count($arrGroups) > 0) { # check if user belongs to a specific group
$aMemberGroups = array(); # if true display frontenduser plugin
if (function_exists("frontendusers_" . $plugin . "_checkUserGroup")) {
foreach($arrGroups as $iGroup) { $bCheckUserGroup = call_user_func("frontendusers_" . $plugin . "_checkUserGroup");
$oMemberGroup = new FrontendGroup($iGroup); } else {
$aMemberGroups[] = $oMemberGroup->get("groupname"); $bCheckUserGroup = true;
}
if ($bCheckUserGroup) {
$plugTitle = call_user_func("frontendusers_" . $plugin . "_getTitle");
$display = call_user_func("frontendusers_" . $plugin . "_display", $oFeUser);
if (is_array($plugTitle) && is_array($display)) {
foreach ($plugTitle as $key => $value) {
$form->add($value, $display[$key]);
}
} else {
if (is_array($plugTitle) || is_array($display)) {
$form->add(i18n("WARNING"), sprintf(i18n("The plugin %s delivered an array for the displayed titles, but did not return an array for the contents."), $plugin));
} else {
$form->add($plugTitle, $display);
}
}
}
}
} }
asort($aMemberGroups);
$sTemp = implode('<br/>', $aMemberGroups); $arrGroups = $oFeUser->getGroupsForUser();
} else {
$sTemp = i18n("none"); if (count($arrGroups) > 0) {
$aMemberGroups = array();
foreach ($arrGroups as $iGroup) {
$oMemberGroup = new FrontendGroup($iGroup);
$aMemberGroups[] = $oMemberGroup->get("groupname");
}
asort($aMemberGroups);
$sTemp = implode('<br/>', $aMemberGroups);
} else {
$sTemp = i18n("none");
}
$form->add(i18n("Group membership"), $sTemp);
$form->add(i18n("Author"), $classuser->getUserName($oFeUser->get("author")) . " (" . $oFeUser->get("created") . ")");
$form->add(i18n("Last modified by"), $classuser->getUserName($oFeUser->get("modifiedby")) . " (" . $oFeUser->get("modified") . ")");
} }
$form->add(i18n("Group membership"), $sTemp );
$form->add(i18n("Author"), $classuser->getUserName($oFeUser->get("author")) . " (". $oFeUser->get("created").")" );
$form->add(i18n("Last modified by"), $classuser->getUserName($oFeUser->get("modifiedby")). " (". $oFeUser->get("modified").")" );
}
//$sDialog = '<div id="dialog" title="Dialog Title">I\'m in a dialog</div>'; //$sDialog = '<div id="dialog" title="Dialog Title">I\'m in a dialog</div>';
$sDialog = ""; $sDialog = "";
$oPage->setContent( $notis . $form->render(true). $sDialog); $oPage->setContent($notis . $form->render(true) . $sDialog);
$oPage->addScript('reload', $sReloadScript); $oPage->addScript('reload', $sReloadScript);
} else { } else {
$oPage->setContent(""); $oPage->setContent("");
} }
$oPage->render(); $oPage->render();
?> ?>

Datei anzeigen

@ -405,6 +405,9 @@ function parseCronFile($PC_cronTabFile, $PC_debug) {
$file = @file($PC_cronTabFile); $file = @file($PC_cronTabFile);
$job = Array(); $job = Array();
$jobs = Array(); $jobs = Array();
if(!is_countable($file)) {
return $jobs;
}
for ($i = 0; $i < count($file); $i++) { for ($i = 0; $i < count($file); $i++) {
if ($file[$i][0] != '#') { if ($file[$i][0] != '#') {
// old regex, without dow abbreviations: // old regex, without dow abbreviations:

Datei anzeigen

@ -78,6 +78,9 @@ if (!defined('CL_VERSION')) {
// fixed functions for PHP 5.4 and later // fixed functions for PHP 5.4 and later
include_once(str_replace('\\', '/', realpath(dirname(__FILE__) . '/..')) . '/includes/functions.php54.php'); include_once(str_replace('\\', '/', realpath(dirname(__FILE__) . '/..')) . '/includes/functions.php54.php');
// simulate PHP 7.3 functions
include_once(str_replace('\\', '/', realpath(dirname(__FILE__) . '/..')) . '/includes/functions.php73.php');
// 1. security check: Include security class and invoke basic request checks // 1. security check: Include security class and invoke basic request checks
include_once(str_replace('\\', '/', realpath(dirname(__FILE__) . '/..')) . '/classes/class.security.php'); include_once(str_replace('\\', '/', realpath(dirname(__FILE__) . '/..')) . '/classes/class.security.php');
try { try {