151 lines
No EOL
5.2 KiB
PHP
151 lines
No EOL
5.2 KiB
PHP
<?php
|
|
/**
|
|
* Project: astat - simple site engine
|
|
* File: /admin/addgroup.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.astat.org SVN: $URL: http://svn.astat.org/astat/trunk/admin/addgroup.apnl.php $
|
|
* @copyright 2009 becast.at
|
|
* @author Bernhard Jaud <bernhard at becast dot at>
|
|
* @package astat core
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
* @version $Id: addgroup.apnl.php 41 2009-06-21 19:24:29Z genuineparts $
|
|
*/
|
|
If (!defined("in_BL_ADMIN")) {
|
|
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
|
|
}
|
|
$addnav["right"]=FALSE;
|
|
$session->page_begin("addgroup", True);
|
|
|
|
class addgroup_panel extends admin_module{
|
|
|
|
function output(){
|
|
global $session,$config,$db,$panel,$admin,$module,$root,$firephp,$log;
|
|
if(isset($_POST["send"])){
|
|
if(!empty($_POST["name"])){
|
|
$db->query("BEGIN");
|
|
$db->query("INSERT INTO `" . $config["prefix"] . "role` (`role_name`) VALUES ('".$db->escape($_POST["name"])."')");
|
|
$role_id=$db->last_id();
|
|
unset($_POST["name"]);
|
|
unset($_POST["submit"]);
|
|
unset($_POST["send"]);
|
|
foreach($_POST as $key=>$value){
|
|
$db->query("INSERT INTO `" . $config["prefix"] . "roleset` (`role_id`,`role_value_id`,`value`) VALUES ('".intval($role_id)."','".intval($key)."','".$db->escape($value)."')");
|
|
}
|
|
$db->query("COMMIT");
|
|
$panel->admin_message("Daten übernommen!","Die Daten wurden erfolgreich übernommen.",True,"addgroup",3);
|
|
}else{
|
|
$panel->admin_message("Fehler!","Der Rollenname muss ausgefüllt werden.",True,"addgroup",3);
|
|
}
|
|
|
|
}else{
|
|
$result = $db->query("SELECT * FROM " . $config["prefix"] . "role_values");
|
|
$panel->title="Gruppe anlegen";
|
|
$panel->content='Hier kann man Benutzergruppen anlegen.';
|
|
$panel->form(array("action"=>$config["path"]."/admin/index.php?panel=addgroup"));
|
|
$panel->content.="<h3>Gruppename:</h3>";
|
|
$panel->field(array("name"=>"name","typ"=>"text","value"=>$data["name"]));
|
|
$panel->content.="<br /><br />";
|
|
$panel->content.="<table width=\"90%\" cellspacing=\"2\">
|
|
<tr>
|
|
<th><strong>Rechte</strong></th>
|
|
</tr>";
|
|
while ($row = $db->fetch_array($result)){
|
|
$panel->content.="<tr><td><strong>".$row["text"].":</strong><br />".$this->get_option($row["type"],$row["id"])."</td></tr>";
|
|
}
|
|
$panel->content.="</table><br />";
|
|
$panel->field(array("name"=>"send","typ"=>"hidden","value"=>"1"));
|
|
$panel->content.="<br />";
|
|
$panel->submit();
|
|
$panel->formClose();
|
|
}
|
|
}
|
|
|
|
function get_option($option,$name) {
|
|
global $config,$db,$panel,$userinfo,$admin,$root,$firephp;
|
|
|
|
if($option=="yesno"){
|
|
$checked["yes"]="";
|
|
$checked["no"]="";
|
|
$yn=$panel->radio(array("name"=>$name,"value"=>"1"),NULL,TRUE);
|
|
$yn.="Ja";
|
|
$yn.=$panel->radio(array("name"=>$name,"value"=>"0"),NULL,TRUE);
|
|
$yn.="Nein";
|
|
return $yn;
|
|
}
|
|
if($option=="onoff"){
|
|
$checked["on"]="";
|
|
$checked["off"]="";
|
|
$yn=$panel->radio(array("name"=>$name,"value"=>"1"),NULL,TRUE);
|
|
$yn.="An";
|
|
$yn.=$panel->radio(array("name"=>$name,"value"=>"0"),NULL,TRUE);
|
|
$yn.="Aus";
|
|
return $yn;
|
|
}
|
|
|
|
if($option=="text"){
|
|
$text=$panel->field(array("name"=>$name,"typ"=>"text"),"",TRUE);
|
|
return $text;
|
|
}
|
|
|
|
if(strstr($option,"wysiwyg")){
|
|
$string=str_replace("wysiwyg(","",substr($option, 0, -1));
|
|
$sarr=explode(";",$string);
|
|
foreach($sarr as $str){
|
|
$substr=explode("|",$str);
|
|
$a_name[]=$substr[0];
|
|
$value[]=$substr[1];
|
|
}
|
|
if(is_array($sarr)){
|
|
$text=$panel->textarea(array("name"=>$name, $a_name[0]=>$value[0],$a_name[1]=>$value[1]),"class=\"mceEditor\"",TRUE);
|
|
}else{
|
|
$text=$panel->textarea(array("name"=>$name),"class=\"mceEditor\"",TRUE);
|
|
}
|
|
return $text;
|
|
}
|
|
|
|
if(strstr($option,"textarea")){
|
|
$string=str_replace("textarea(","",substr($option, 0, -1));
|
|
$sarr=explode(";",$string);
|
|
foreach($sarr as $str){
|
|
$substr=explode("|",$str);
|
|
$a_name[]=$substr[0];
|
|
$value[]=$substr[1];
|
|
}
|
|
if(is_array($sarr)){
|
|
$text=$panel->textarea(array("name"=>$name, $a_name[0]=>$value[0],$a_name[1]=>$value[1]),"",TRUE);
|
|
}else{
|
|
$text=$panel->textarea(array("name"=>$name),"",TRUE);
|
|
}
|
|
return $text;
|
|
}
|
|
|
|
if(strstr($option,"select")){
|
|
//$text=$panel->field("text",$name,"value=\"".$config[$name]."\"",TRUE);
|
|
$string=str_replace("select(","",substr($option, 0, -1));
|
|
$sarr=explode(";",$string);
|
|
foreach($sarr as $str){
|
|
$substr=explode("|",$str);
|
|
$values[$substr[0]]=$substr[1];
|
|
}
|
|
$select=$panel->select($values,NULL,$name,"",TRUE);
|
|
return $select;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
?>
|