93 lines
4.5 KiB
PHP
93 lines
4.5 KiB
PHP
<?php global $session;
|
|
/**
|
|
* 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: 220835b018d365f1e1cc18303854a8f657d49831 $
|
|
*/
|
|
If (!defined("IN_BCWE_ADMIN")) {
|
|
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
|
|
}
|
|
$addnav["right"]=FALSE;
|
|
$session->page_begin("adduser", True);
|
|
|
|
class adduser_panel extends admin_module{
|
|
|
|
function output(){
|
|
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($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`,`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($lang->_('DATASAVED'),$lang->_('DATASAVEDSUCCESS'),True,"adduser",3);
|
|
}else{
|
|
$panel->admin_message($lang->_('ERROR'),$lang->_('NEEDSUSERNAMEPASS'),True,"adduser",3);
|
|
}
|
|
|
|
}else{
|
|
$panel->title=$lang->_('ADDUSER');
|
|
$panel->content=$lang->_('ADDUSERTEXT');
|
|
$panel->form(array("action"=>$config["path"]."/admin/index.php?panel=adduser"));
|
|
$panel->content.="<h3>".$lang->_('USERNAME').":</h3>";
|
|
$panel->field(array("name"=>"name","typ"=>"text","value"=>""));
|
|
$panel->content.="<h3>".$lang->_('REALNAME').":</h3>";
|
|
$panel->field(array("name"=>"realname","typ"=>"text","value"=>""));
|
|
$panel->content.="<h3>".$lang->_('MAIL').":</h3>";
|
|
$panel->field(array("name"=>"email","value"=>"","typ"=>"text"));
|
|
$panel->content.="<h3>".$lang->_('PASSWORD').":</h3>";
|
|
$panel->field(array("name"=>"password","value"=>"","typ"=>"password"));
|
|
$panel->content.="<h3>".$lang->_('LOCATION').":</h3>";
|
|
$panel->field(array("name"=>"from","value"=>"","typ"=>"text"));
|
|
$panel->content.="<h3>".$lang->_('GENDER').":</h3>";
|
|
$panel->select(array($lang->_('DIV')=>"u", $lang->_('FEMALE')=>"f",$lang->_('MALE')=>"m"),"","gender");
|
|
$panel->content.="<h3>".$lang->_('HOMEPAGE').":</h3>";
|
|
$panel->field(array("name"=>"homepage","value"=>"","typ"=>"text"));
|
|
$panel->content.="<h3>".$lang->_('BANREASON').":</h3>";
|
|
$panel->textarea(array("name"=>"bio","value"=>"","typ"=>"text"));
|
|
$panel->content.="<h3>".$lang->_('ROLE').":</h3>";
|
|
$result=$db->query("SELECT `id`,`role_name` FROM `" . $config["prefix"] . "role`");
|
|
while($rdata = $db->fetch_array($result)){
|
|
$dd[$rdata["role_name"]]=$rdata["id"];
|
|
}
|
|
$panel->select($dd,"","role");
|
|
$panel->content.="<br />";
|
|
$panel->content.="<h3>".$lang->_('STATUS').":</h3>";
|
|
$panel->select(array($lang->_('ACTIVE')=>1,$lang->_('INACTIVE')=>0,$lang->_('BANNED')=>2),"","active");
|
|
$panel->field(array("name"=>"send","typ"=>"hidden","value"=>"1"));
|
|
$panel->content.="<br />";
|
|
$panel->content.="<br />";
|
|
$panel->submit();
|
|
$panel->formClose();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
?>
|