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
/**
* Project:
* Contenido Content Management System
@ -17,18 +18,17 @@
*
* $Id: include.frontend.user_edit.php 292 2014-01-20 09:49:37Z oldperl $:
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
$oPage = new cPage();
$oPage->setHtml5();
$oFeUsers = new FrontendUserCollection();
if (is_array($cfg['plugins']['frontendusers'])) {
foreach ($cfg['plugins']['frontendusers'] as $plugin) {
plugin_include("frontendusers", $plugin."/".$plugin.".php");
foreach ($cfg['plugins']['frontendusers'] as $plugin) {
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.
$aFEGroup = array();
while($oFEGroup = $oFEGroupMemberCollection->next()) {
while ($oFEGroup = $oFEGroupMemberCollection->next()) {
$aFEGroup[] = $oFEGroup->get("idfrontendgroup");
}
if ($action == "frontend_create" && $perm->have_perm_area_action("frontend", "frontend_create")) {
$oFeUser = $oFeUsers->create(" ".i18n("-- new user --"));
$idfrontenduser = $oFeUser->get("idfrontenduser");
$oFeUser = $oFeUsers->create(" " . i18n("-- new user --"));
$idfrontenduser = $oFeUser->get("idfrontenduser");
}
if ($idfrontenduser && $action != '') {
@ -57,7 +57,7 @@ if ($idfrontenduser && $action != '') {
if (left_bottom) {
var href = left_bottom.location.href;
href = href.replace(/&frontenduser.*/, '');
left_bottom.location.href = href+'&frontenduser='+".$idfrontenduser.";
left_bottom.location.href = href+'&frontenduser='+" . $idfrontenduser . ";
top.content.left.left_top.refresh();
}
</script>";
@ -67,8 +67,8 @@ if ($idfrontenduser && $action != '') {
$sFormCheck = '
<script type="text/javascript">
var defaultName = "'. i18n("-- new user --").'";
var PwEmpty = '.(($oFeUser->get("password") == "d41d8cd98f00b204e9800998ecf8427e")?"true":"false").';
var defaultName = "' . i18n("-- new user --") . '";
var PwEmpty = ' . (($oFeUser->get("password") == "d41d8cd98f00b204e9800998ecf8427e") ? "true" : "false") . ';
function checkUserForm() {
if(document.getElementById("m1").value.match(/defaultName/i)) {
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()) {
$chainEntry->execute($idfrontenduser);
}
$idfrontenduser = 0;
$oFeUser = new FrontendUser();
$oPage->addScript('reload', $sReloadScript);
@ -105,25 +105,25 @@ if ($oFeUser->virgin == false && $oFeUser->get("idclient") == $client) {
$messages = array();
$bStore = true;
$initname = i18n("-- new user --");
$bNewUser = (strstr($username, $initname) === false)?false:true;
if(empty($username) || $bNewUser) {
$bNewUser = (strstr($username, $initname) === false) ? false : true;
if (empty($username) || $bNewUser) {
$messages[] = i18n("Username empty or not set! Please choose one.");
$bStore = false;
}
// 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!");
$bStore = false;
}
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()) {
$messages[] = i18n("Could not set new username: Username already exists");
} else {
$oFeUser->set("username", stripslashes($username));
}
}
if ($newpd != $newpd2) {
$messages[] = i18n("Could not set new password: Passwords don't match");
} else {
@ -131,122 +131,121 @@ if ($oFeUser->virgin == false && $oFeUser->get("idclient") == $client) {
$oFeUser->set("password", $newpd);
}
}
$oFeUser->set("active", $active);
/* Check out if there are any plugins */
if (is_array($cfg['plugins']['frontendusers'])) {
foreach ($cfg['plugins']['frontendusers'] as $plugin) {
if (function_exists("frontendusers_".$plugin."_wantedVariables") &&
function_exists("frontendusers_".$plugin."_store")) {
if (function_exists("frontendusers_" . $plugin . "_wantedVariables") && function_exists("frontendusers_" . $plugin . "_store")) {
# check if user belongs to a specific group
# if true store values defined in frontenduser plugin
if (function_exists("frontendusers_".$plugin."_checkUserGroup")) {
$bCheckUserGroup = call_user_func("frontendusers_".$plugin."_checkUserGroup");
if (function_exists("frontendusers_" . $plugin . "_checkUserGroup")) {
$bCheckUserGroup = call_user_func("frontendusers_" . $plugin . "_checkUserGroup");
} else {
$bCheckUserGroup = true;
}
if ($bCheckUserGroup) {
$wantVariables = call_user_func("frontendusers_".$plugin."_wantedVariables");
$wantVariables = call_user_func("frontendusers_" . $plugin . "_wantedVariables");
if (is_array($wantVariables)) {
$varArray = array();
foreach ($wantVariables as $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>";
}
$form = new UI_Table_Form("properties");
$form->setSubmitJS("return checkUserForm();");
$form->setVar("frame", $frame);
$form = new UI_Table_Form("properties");
$form->setSubmitJS("return checkUserForm();");
$form->setVar("frame", $frame);
$form->setVar("area", $area);
$form->setVar("action", "frontend_save_user");
$form->setVar("idfrontenduser", $idfrontenduser);
$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);
$form->addHeader(i18n("Edit user"));
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);
}
}
}
}
}
$arrGroups = $oFeUser->getGroupsForUser();
if(count($arrGroups) > 0) {
$aMemberGroups = array();
foreach($arrGroups as $iGroup) {
$oMemberGroup = new FrontendGroup($iGroup);
$aMemberGroups[] = $oMemberGroup->get("groupname");
$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)) {
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);
} else {
$sTemp = i18n("none");
$arrGroups = $oFeUser->getGroupsForUser();
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 = "";
$oPage->setContent( $notis . $form->render(true). $sDialog);
$oPage->addScript('reload', $sReloadScript);
$sDialog = "";
$oPage->setContent($notis . $form->render(true) . $sDialog);
$oPage->addScript('reload', $sReloadScript);
} else {
$oPage->setContent("");
$oPage->setContent("");
}
$oPage->render();
?>

Datei anzeigen

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

Datei anzeigen

@ -78,6 +78,9 @@ if (!defined('CL_VERSION')) {
// fixed functions for PHP 5.4 and later
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
include_once(str_replace('\\', '/', realpath(dirname(__FILE__) . '/..')) . '/classes/class.security.php');
try {