Updates to newest version

This commit is contained in:
genuineparts 2025-06-20 20:13:33 +02:00
parent cd6cfc3e78
commit ccdf8fbb81
4 changed files with 81 additions and 68 deletions

View file

@ -1,4 +1,29 @@
<?php
/**
* Project: BeCast WebEngine - simple site engine
* File: /admin/addusers.apnl.php
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @link http://www.becast.at
* @copyright 2009-2025 becast.at
* @author Bernhard Jaud <bernhard at becast dot at>
* @package BcWe core
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
*/
If (!defined("in_BL_ADMIN")) {
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
}
@ -11,17 +36,18 @@ class adduser_panel extends admin_module{
global $plugin,$session,$config,$db,$panel,$admin,$module,$root,$firephp,$log,$lang;
if(isset($_POST["send"])){
if($_POST['role']==2 && $session->userdata['role']!=2){
$panel->admin_message("Error","You cannot assign a role higher then yours!",True,"editusers",3);
$panel->admin_message($lang->_('ERROR'),$lang->_('CANTASSIGNHIGHERRIGHT'),True,"editusers",3);
}
if(!empty($_POST["name"]) && !empty($_POST["password"])){
$key=$session->generate_key(50);
$salt = $session->generate_Key(6);
$plugin->run_hook('admin_user_before_create',array('data'=>$_POST,'key'=>$key,'user_fid'=>$session->userdata['fuid']));
$db->query("INSERT INTO `" . $config["prefix"] . "users` (`username`,`realname`,`password`,`loginkey`,`role`,`email`,`active`) VALUES ('".$db->escape($_POST["name"])."','".$db->escape($_POST["realname"])."','".hash("sha256",$db->escape($_POST["password"]))."','".$key."','".$db->escape($_POST["role"])."','".$db->escape($_POST["email"])."','".$_POST["active"]."')");
$db->query("INSERT INTO `" . $config["prefix"] . "users` (`username`,`realname`,`password`,`salt`,`loginkey`,`role`,`email`,`active`) VALUES ('".$db->escape($_POST["name"])."','".$db->escape($_POST["realname"])."','".hash("sha256",$salt.$db->escape($_POST["password"]))."','".$salt."','".$key."','".$db->escape($_POST["role"])."','".$db->escape($_POST["email"])."','".$_POST["active"]."')");
$_POST['uid']=$db->last_id();
$plugin->run_hook('admin_user_after_create',array('data'=>$_POST));
$panel->admin_message("Daten &uuml;bernommen!","Die Daten wurden erfolgreich &uuml;bernommen.",True,"adduser",3);
$panel->admin_message($lang->_('DATASAVED'),$lang->_('DATASAVEDSUCCESS'),True,"adduser",3);
}else{
$panel->admin_message("Fehler!","Der Name und das Passwort m&uuml;ssen ausgef&uuml;lt werden.",True,"adduser",3);
$panel->admin_message($lang->_('ERROR'),$lang->_('NEEDSUSERNAMEPASS'),True,"adduser",3);
}
}else{
@ -40,27 +66,20 @@ class adduser_panel extends admin_module{
$panel->content.="<h3>".$lang->_('LOCATION').":</h3>";
$panel->field(array("name"=>"from","value"=>$data["from"],"typ"=>"text"));
$panel->content.="<h3>".$lang->_('GENDER').":</h3>";
$panel->select(array("N/A"=>"u", "weiblich"=>"f","m&auml;nnlich"=>"m"),$data["gender"],"gender");
$panel->content.="<h3>".$lang->_('BANREASON').":</h3>";
$panel->textarea(array("name"=>"bio","value"=>$data["bio"],"typ"=>"text"));
$panel->select(array($lang->_('DIV')=>"u", $lang->_('FEMALE')=>"f",$lang->_('MALE')=>"m"),$data["gender"],"gender");
$panel->content.="<h3>".$lang->_('HOMEPAGE').":</h3>";
$panel->field(array("name"=>"homepage","value"=>$data["homepage"],"typ"=>"text"));
$panel->content.="<h3>ICQ:</h3>";
$panel->field(array("name"=>"icq","value"=>$data["icq"],"typ"=>"text"));
$panel->content.="<h3>AIM:</h3>";
$panel->field(array("name"=>"aim","value"=>$data["aim"],"typ"=>"text"));
$panel->content.="<h3>Skype:</h3>";
$panel->field(array("name"=>"skype","value"=>$data["skype"],"typ"=>"text"));
$panel->content.="<h3>".$lang->_('BANREASON').":</h3>";
$panel->textarea(array("name"=>"bio","value"=>$data["bio"],"typ"=>"text"));
$panel->content.="<h3>".$lang->_('ROLE').":</h3>";
$result=$db->query("SELECT `id`,`role_name` FROM `" . $config["prefix"] . "role`");
while($data = $db->fetch_array($result)){
$dd[$data["role_name"]]=$data["id"];
}
$panel->select($dd,"1","role");
$panel->content.="<h3>".$lang->_('ACTIVE').":</h3>";
$panel->select(array($lang->_('YES')=>1,$lang->_('NO')=>0),"0","active");
while($rdata = $db->fetch_array($result)){
$dd[$rdata["role_name"]]=$rdata["id"];
}
$panel->select($dd,$data["role"],"role");
$panel->content.="<br />";
$panel->content.="<h3>".$lang->_('STATUS').":</h3>";
$panel->select(array($lang->_('ACTIVE')=>1,$lang->_('INACTIVE')=>0,$lang->_('BANNED')=>2),$data["active"],"active");
$panel->field(array("name"=>"send","typ"=>"hidden","value"=>"1"));
$panel->content.="<br />";
$panel->content.="<br />";